fix images

This commit is contained in:
Torsten 2022-12-12 18:35:18 +02:00
parent 7966437324
commit e6effde4ff
5 changed files with 11 additions and 8 deletions

View File

@ -11,9 +11,9 @@ module Merged
end
def set_image
@card.content["image"] = params[:image]
@card.image = params[:image]
@card.save
redirect_to section_cards_url(@card.section.id)
redirect_to section_cards_url(@card.section.id) , notice: "Image selected: #{@card.image}"
end
def move

View File

@ -37,9 +37,9 @@ module Merged
end
def set_image
@section.content["image"] = params[:image]
@section.image = params[:image]
@section.save
redirect_to section_url(@section.id)
redirect_to section_url(@section.id) , notice: "Image selected: #{@section.image}"
end
def set_template

View File

@ -7,7 +7,8 @@ module Merged
include Optioned
fields :index , :section_id, :id , :text , :header, :image
fields :id , :index , :section_id
fields :text , :header, :image , :options
def move_up
swap_index_with(next_card)

View File

@ -55,13 +55,14 @@ module Merged
end
def save
updated_at = Time.now
super
Page.save_all
end
def self.new_page(name )
raise "only alphanumeric, not #{name}" unless check_name(name).nil?
data = { name: name.dup }
data = { name: name.dup , updated_at: Time.now }
Page.new(data)
end

View File

@ -7,8 +7,9 @@ module Merged
include Optioned
fields :name , :page_id , :index , :options
fields :template , :card_template , :id , :text , :header, :image
fields :id , :name , :page_id , :index
fields :template , :card_template
fields :header, :text , :image , :options
def cards
Card.where(section_id: id).order(index: :asc)