app/models/activeadmin_selleo_cms/layout.rb in activeadmin-selleo-cms-0.0.20 vs app/models/activeadmin_selleo_cms/layout.rb in activeadmin-selleo-cms-0.0.21
- old
+ new
@@ -35,40 +35,48 @@
Dir.glob(File.join(Rails.root, 'app/views/layouts/[a-z]*html.erb')).map{|l| l.split('/').last.split('.').first }
end
end
class Section
- attr_accessor :name, :type, :toolbar, :width, :height, :resize_method
+ attr_accessor :name, :type, :toolbar, :width, :height, :resize_method, :cover_width, :cover_height, :cover_resize_method
def initialize(node)
@name = node.attributes["name"].content
@type = node.attributes["data-type"] ? node.attributes["data-type"].content : 'ckeditor'
- @attachments = (['files'].include?(@type) or node.attributes["data-attachments"]) ? true : false
- @attachment = (['file'].include?(@type) or node.attributes["data-attachment"]) ? true : false
+ @attachments = node.attributes["data-attachments"] ? node.attributes["data-attachments"].content.eql?("true") : false
+ @attachment = node.attributes["data-attachment"] ? node.attributes["data-attachment"].content.eql?("true") : false
+ @related = node.attributes["data-related"] ? node.attributes["data-related"].content.eql?("true") : false
@toolbar = node.attributes["data-toolbar"] ? node.attributes["data-toolbar"].content : 'Minimal'
@width = node.attributes["data-width"] ? node.attributes["data-width"].content : 640
@height = node.attributes["data-height"] ? node.attributes["data-height"].content : 480
@resize_method = node.attributes["data-resize-method"] ? node.attributes["data-resize-method"].content : "#"
+ @cover_width = node.attributes["data-cover-width"] ? node.attributes["data-cover-width"].content : 140
+ @cover_height = node.attributes["data-cover-height"] ? node.attributes["data-cover-height"].content : 199
+ @cover_resize_method = node.attributes["data-cover-resize-method"] ? node.attributes["data-cover-resize-method"].content : ">"
end
def text?
- ['ckeditor', 'text'].include? @type
+ ['ckeditor', 'text', 'string'].include? @type.downcase
end
def image?
- ['image'].include? @type
+ ['image'].include? @type.downcase
end
def images?
- ['images'].include? @type
+ ['images'].include? @type.downcase
end
def attachments?
- @attachments == true
+ ['files'].include?(@type.downcase) or @attachments
end
def attachment?
- @attachment == true
+ ['file'].include?(@type.downcase) or @attachment
+ end
+
+ def related?
+ ['related'].include?(@type.downcase) or @related
end
end
end
end