fixes from transition, tests pass, just because there are too little
This commit is contained in:
@ -15,7 +15,7 @@ module Merged
|
||||
end
|
||||
|
||||
def options
|
||||
@content["options"] || {}
|
||||
attributes[:options] || {}
|
||||
end
|
||||
|
||||
def set_option( option , value)
|
||||
|
@ -2,8 +2,7 @@ module Merged
|
||||
class Page < ActiveYaml::Base
|
||||
set_root_path Rails.root #ouside engines not necessary
|
||||
include ActiveHash::Associations
|
||||
has_many :sections , class_name: "Merged::Section"
|
||||
|
||||
has_many :sections , class_name: "Merged::Section" , scope: -> { order(index: :desc) }
|
||||
# could be config options
|
||||
def self.cms_root
|
||||
"cms"
|
||||
|
@ -4,11 +4,12 @@ module Merged
|
||||
|
||||
include ActiveHash::Associations
|
||||
belongs_to :page , class_name: "Merged::Page"
|
||||
has_many :cards , class_name: "Merged::Card"
|
||||
has_many :cards , class_name: "Merged::Card" , scope: -> { order(index: :desc) }
|
||||
|
||||
|
||||
include Optioned
|
||||
|
||||
fields :name , :page_id , :index , :cards
|
||||
fields :name , :page_id , :index , :cards , :options
|
||||
fields :template , :card_template , :id , :text , :header, :image
|
||||
|
||||
def set_template(new_template)
|
||||
@ -66,13 +67,11 @@ module Merged
|
||||
end
|
||||
|
||||
def previous_section
|
||||
return nil if index == 0
|
||||
page.sections[index - 1]
|
||||
page.sections.where(index: index - 1).first
|
||||
end
|
||||
|
||||
def next_section
|
||||
return nil if index == (page.sections.length - 1)
|
||||
page.sections[index + 1]
|
||||
page.sections.where(index: index + 1).first
|
||||
end
|
||||
|
||||
def move_card_up(card)
|
||||
@ -135,12 +134,5 @@ module Merged
|
||||
data
|
||||
end
|
||||
|
||||
def self.find(section_id)
|
||||
raise "nil given" if section_id.blank?
|
||||
section = @@all[section_id]
|
||||
raise "Section not found #{section_id}" unless section
|
||||
return section
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user