push the filter_fields property of a content type + fix a bug about filtering layouts when deploying a site

did committed Apr 01, 2016
commit 832f9db526cc68e84b463228fc90b97f79c2fc02
Showing 5 changed files with 17 additions and 4 deletions
Gemfile +1 -1
@@ @@ -12,7 +12,7 @@ gem 'rb-fsevent', '~> 0.9.1'
# Local development
# gem 'locomotivecms_coal', path: '../gems/coal', require: false
- # gem 'locomotivecms_steam', path: '../gems/steam', require: false
+ gem 'locomotivecms_steam', path: '../gems/steam', require: false
# gem 'locomotivecms_common', path: '../gems/common', require: false
group :development, :test do
generators/content_type/app/content_types/%slug%.yml.tt +4 -0
@@ @@ -32,6 +32,10 @@ order_by: manually
# position: 1 # position in the sidebar menu
# hidden: false # hidden for authors?
+ # You can add a search bar at the top of the list of entries in the back-office.
+ # It will search for entries the fields listed below match the keyword.
+ # filter_fields: ['name', 'email']
+
# By default, the back-office displays the _label property (see label_field_name) of the content entry. This can be modified by writing your own Liquid template below:
# entry_template: '<a href="{{ link }}">{{ entry._label }}</a>' # The default template
locomotive/wagon/commands/pull_sub_commands/pull_content_types_command.rb b/lib/locomotive/wagon/commands/pull_sub_commands/pull_content_types_command.rb +1 -1
@@ @@ -17,7 +17,7 @@ module Locomotive::Wagon
private
def yaml_attributes(content_type)
- content_type.attributes.slice('name', 'slug', 'description', 'label_field_name', 'order_by', 'order_direction', 'group_by', 'public_submission_enabled', 'public_submission_account_emails', 'display_settings').tap do |attributes|
+ content_type.attributes.slice('name', 'slug', 'description', 'label_field_name', 'order_by', 'order_direction', 'group_by', 'public_submission_enabled', 'public_submission_account_emails', 'display_settings', 'entry_template', 'filter_fields').tap do |attributes|
# fields
attributes['fields'] = content_type.fields.map { |f| field_yaml_attributes(f) }
locomotive/wagon/commands/push_sub_commands/push_pages_command.rb b/lib/locomotive/wagon/commands/push_sub_commands/push_pages_command.rb +5 -1
@@ @@ -117,7 +117,11 @@ module Locomotive::Wagon
def skip?(entity)
return false if @only_entities.blank?
- _path = entity.template_path[default_locale].gsub('./app/views/pages/', '')
+ template_path = entity.template_path[default_locale]
+
+ return unless template_path # can be false if layout
+
+ _path = template_path.gsub('./app/views/pages/', '')
!@only_entities.any? { |regexp| regexp.match(_path) }
end
locomotive/wagon/decorators/content_type_decorator.rb b/lib/locomotive/wagon/decorators/content_type_decorator.rb +6 -1
@@ @@ -16,7 +16,8 @@ module Locomotive
public_submission_enabled
public_submission_accounts
public_submission_title_template
- entry_template display_settings)
+ entry_template display_settings
+ filter_fields)
end
def fields
@@ @@ -66,6 +67,10 @@ module Locomotive
self[:display_settings]
end
+ def filter_fields
+ self[:filter_fields]
+ end
+
def with_relationships?
__getobj__.fields.associations.count > 0
end