fix issue #177
This commit is contained in:
parent
c990a89e57
commit
71a592eec1
@ -1,5 +1,3 @@
|
|||||||
require 'ruby-debug'
|
|
||||||
|
|
||||||
module Admin::ContentTypesHelper
|
module Admin::ContentTypesHelper
|
||||||
|
|
||||||
MAX_DISPLAYED_CONTENTS = 4
|
MAX_DISPLAYED_CONTENTS = 4
|
||||||
|
@ -8,6 +8,7 @@ class EditableElement
|
|||||||
field :default_content
|
field :default_content
|
||||||
field :default_attribute
|
field :default_attribute
|
||||||
field :hint
|
field :hint
|
||||||
|
field :priority, :type => Integer, :default => 0
|
||||||
field :disabled, :type => Boolean, :default => false
|
field :disabled, :type => Boolean, :default => false
|
||||||
field :assignable, :type => Boolean, :default => true
|
field :assignable, :type => Boolean, :default => true
|
||||||
field :from_parent, :type => Boolean, :default => false
|
field :from_parent, :type => Boolean, :default => false
|
||||||
@ -18,6 +19,9 @@ class EditableElement
|
|||||||
## validations ##
|
## validations ##
|
||||||
validates_presence_of :slug
|
validates_presence_of :slug
|
||||||
|
|
||||||
|
## scopes ##
|
||||||
|
scope :by_priority, :order_by => [[:priority, :desc]]
|
||||||
|
|
||||||
## methods ##
|
## methods ##
|
||||||
|
|
||||||
end
|
end
|
@ -32,7 +32,7 @@ module Extensions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def editable_elements_grouped_by_blocks
|
def editable_elements_grouped_by_blocks
|
||||||
all_enabled = self.editable_elements.reject { |el| el.disabled? }
|
all_enabled = self.editable_elements.by_priority.reject { |el| el.disabled? }
|
||||||
groups = all_enabled.group_by(&:block)
|
groups = all_enabled.group_by(&:block)
|
||||||
groups.delete_if { |block, elements| elements.empty? }
|
groups.delete_if { |block, elements| elements.empty? }
|
||||||
end
|
end
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
%li{ :id => "block-#{index}", :class => 'block', :style => "display: #{index == 0 ? 'block' : 'none' }" }
|
%li{ :id => "block-#{index}", :class => 'block', :style => "display: #{index == 0 ? 'block' : 'none' }" }
|
||||||
%fieldset.inputs
|
%fieldset.inputs
|
||||||
%ol
|
%ol
|
||||||
- elements.each_with_index do |el, index|
|
- elements.each do |el|
|
||||||
= f.fields_for 'editable_elements', el, :child_index => el._index do |g|
|
= f.fields_for 'editable_elements', el, :child_index => el._index do |g|
|
||||||
- case el
|
- case el
|
||||||
- when EditableLongText
|
- when EditableLongText
|
||||||
|
@ -8,5 +8,4 @@
|
|||||||
- fix carrierwave version to 0.5.6 (#163)
|
- fix carrierwave version to 0.5.6 (#163)
|
||||||
- has_many target is not exported correctly (issue #165) + fix the import module as well
|
- has_many target is not exported correctly (issue #165) + fix the import module as well
|
||||||
- XSS vulnerability when adding new content from the api_contents_controller (#170)
|
- XSS vulnerability when adding new content from the api_contents_controller (#170)
|
||||||
- small bugs: #169
|
- small bugs: #169, #171, #179
|
||||||
-
|
|
@ -26,11 +26,13 @@ module Locomotive
|
|||||||
:block => @context[:current_block].try(:name),
|
:block => @context[:current_block].try(:name),
|
||||||
:slug => @slug,
|
:slug => @slug,
|
||||||
:hint => @options[:hint],
|
:hint => @options[:hint],
|
||||||
|
:priority => @options[:priority] || 0,
|
||||||
:default_attribute => @options[:default],
|
:default_attribute => @options[:default],
|
||||||
:default_content => default_content_option,
|
:default_content => default_content_option,
|
||||||
:assignable => @options[:assignable],
|
:assignable => @options[:assignable],
|
||||||
:disabled => false,
|
:disabled => false,
|
||||||
:from_parent => false
|
:from_parent => false,
|
||||||
|
:_type => self.document_type.to_s
|
||||||
}, document_type)
|
}, document_type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user