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 end
def set_image def set_image
@card.content["image"] = params[:image] @card.image = params[:image]
@card.save @card.save
redirect_to section_cards_url(@card.section.id) redirect_to section_cards_url(@card.section.id) , notice: "Image selected: #{@card.image}"
end end
def move def move

View File

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

View File

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

View File

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

View File

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