locomotivecms 4.0.0.alpha2 → 4.0.0.alpha3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/Rakefile +14 -6
  4. data/app/api/locomotive/api/forms/site_form.rb +8 -2
  5. data/app/api/locomotive/api/helpers/locales_helper.rb +4 -0
  6. data/app/api/locomotive/api/resources/content_entry_resource.rb +1 -1
  7. data/app/assets/javascripts/locomotive/editor.js +2859 -2561
  8. data/app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee +4 -1
  9. data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +6 -0
  10. data/app/assets/javascripts/locomotive/views/shared/bulk_delete_view.js.coffee +27 -0
  11. data/app/assets/javascripts/locomotive/views/translations/index_view.js.coffee +6 -0
  12. data/app/assets/stylesheets/locomotive/application.scss +1 -0
  13. data/app/assets/stylesheets/locomotive/editor.css +119 -113
  14. data/app/assets/stylesheets/locomotive/new/_checkbox.scss +38 -0
  15. data/app/assets/stylesheets/locomotive/old/_activity_feed.scss +10 -0
  16. data/app/assets/stylesheets/locomotive/old/_list.scss +28 -0
  17. data/app/assets/stylesheets/locomotive/old/_main.scss +21 -4
  18. data/app/assets/stylesheets/locomotive/old/_search_bars.scss +2 -5
  19. data/app/assets/stylesheets/locomotive/old/_translations.scss +2 -2
  20. data/app/controllers/locomotive/content_entries_controller.rb +5 -5
  21. data/app/controllers/locomotive/current_site_controller.rb +8 -1
  22. data/app/controllers/locomotive/custom_fields/select_options_controller.rb +1 -1
  23. data/app/controllers/locomotive/editable_elements_controller.rb +1 -1
  24. data/app/controllers/locomotive/page_content_controller.rb +2 -2
  25. data/app/controllers/locomotive/pages_controller.rb +1 -1
  26. data/app/controllers/locomotive/search_for_resources_controller.rb +1 -1
  27. data/app/controllers/locomotive/translations_controller.rb +7 -1
  28. data/app/helpers/locomotive/base_helper.rb +6 -5
  29. data/app/helpers/locomotive/dashboard_helper.rb +18 -6
  30. data/app/helpers/locomotive/page_content_helper.rb +28 -5
  31. data/app/helpers/locomotive/pages_helper.rb +4 -0
  32. data/app/helpers/locomotive/shared/pages_helper.rb +8 -4
  33. data/app/models/locomotive/activity.rb +1 -0
  34. data/app/models/locomotive/concerns/content_entry/file_size.rb +5 -1
  35. data/app/models/locomotive/concerns/content_type/public_submission_title_template.rb +1 -1
  36. data/app/models/locomotive/concerns/page/sections.rb +11 -0
  37. data/app/models/locomotive/concerns/site/url_redirections.rb +11 -1
  38. data/app/policies/locomotive/membership_policy.rb +3 -7
  39. data/app/services/locomotive/content_entry_service.rb +21 -10
  40. data/app/services/locomotive/custom_field_service.rb +28 -4
  41. data/app/services/locomotive/editable_element_service.rb +2 -2
  42. data/app/services/locomotive/editor_service.rb +47 -31
  43. data/app/services/locomotive/page_service.rb +2 -2
  44. data/app/services/locomotive/translation_service.rb +7 -0
  45. data/app/views/locomotive/accounts/new.html.slim +1 -1
  46. data/app/views/locomotive/content_assets/_list.html.slim +5 -0
  47. data/app/views/locomotive/content_assets/_search_form.html.slim +1 -1
  48. data/app/views/locomotive/content_entries/_list.html.slim +3 -3
  49. data/app/views/locomotive/content_entries/edit.html.slim +2 -1
  50. data/app/views/locomotive/content_entries/index.html.slim +53 -40
  51. data/app/views/locomotive/content_entries/new.html.slim +1 -1
  52. data/app/views/locomotive/current_site/edit.html.slim +1 -1
  53. data/app/views/locomotive/current_site/form/_url_redirections.html.slim +4 -0
  54. data/app/views/locomotive/current_site_metafields/index.html.slim +1 -1
  55. data/app/views/locomotive/dashboard/_activity.html.slim +3 -0
  56. data/app/views/locomotive/layouts/application.html.slim +3 -2
  57. data/app/views/locomotive/layouts/editor.html.slim +2 -0
  58. data/app/views/locomotive/memberships/edit.html.slim +1 -1
  59. data/app/views/locomotive/memberships/new.html.slim +1 -1
  60. data/app/views/locomotive/page_content/edit.html.erb +1 -0
  61. data/app/views/locomotive/page_content/edit.json.jbuilder +3 -1
  62. data/app/views/locomotive/pages/_header.html.slim +1 -1
  63. data/app/views/locomotive/pages/form/_main.html.slim +1 -1
  64. data/app/views/locomotive/pages/new.html.slim +1 -1
  65. data/app/views/locomotive/public_submission_accounts/edit.html.slim +1 -1
  66. data/app/views/locomotive/translations/_form.html.slim +0 -3
  67. data/app/views/locomotive/translations/edit.html.slim +1 -1
  68. data/app/views/locomotive/translations/index.html.slim +34 -15
  69. data/config/locales/devise.fr.yml +3 -3
  70. data/config/locales/editor.en.yml +39 -13
  71. data/config/locales/editor.fr.yml +39 -13
  72. data/config/locales/en.yml +4 -0
  73. data/config/locales/flash.en.yml +4 -0
  74. data/config/locales/flash.fr.yml +4 -0
  75. data/config/locales/fr.yml +14 -0
  76. data/config/locales/mongoid.fr.yml +0 -2
  77. data/config/locales/simple_form.en.yml +4 -0
  78. data/config/locales/simple_form.fr.yml +6 -1
  79. data/config/routes.rb +7 -4
  80. data/config/webpack/development.js +26 -0
  81. data/config/webpack/production.js +7 -0
  82. data/config/webpack/test.js +6 -0
  83. data/lib/locomotive/engine.rb +1 -0
  84. data/lib/locomotive/steam/middlewares/page_editing.rb +20 -1
  85. data/lib/locomotive/steam/services/api_entry_submission_service.rb +6 -6
  86. data/lib/locomotive/version.rb +1 -1
  87. metadata +9 -32
@@ -18,7 +18,11 @@ module Locomotive
18
18
  private
19
19
 
20
20
  def sync_file_size
21
- self._file_size = self.file_custom_fields.inject(0) { |sum,field| send(field).size + sum }
21
+ self._file_size = self.file_custom_fields.inject(0) do |sum, field|
22
+ file = send(field)&.file
23
+ _size = file&.exists? ? file.size : 0
24
+ _size + sum
25
+ end
22
26
  end
23
27
 
24
28
  end
@@ -13,7 +13,7 @@ module Locomotive
13
13
  template = ::Liquid::Template.parse(self.public_submission_title_template, {})
14
14
 
15
15
  assigns = { 'site' => self.site, 'entry' => entry }.merge(options)
16
- registers = { site: self.site }
16
+ registers = { site: self.site, services: Locomotive::Steam::Services.build_instance }
17
17
 
18
18
  template.render(::Liquid::Context.new({}, assigns, registers))
19
19
  end
@@ -17,6 +17,17 @@ module Locomotive
17
17
  json_attribute :sections_content
18
18
  end
19
19
 
20
+ def all_sections_content
21
+ (self.sections_dropzone_content || []).map.each_with_index do |section, index|
22
+ # based on the mechanism that Steam uses to generate the anchors
23
+ _anchor = (section['anchor'] || "dropzone-#{index}") + '-section'
24
+ section.merge({ 'anchor' => _anchor })
25
+ end +
26
+ (self.sections_content || {}).map do |(section_id, section)|
27
+ section.merge({ 'anchor' => "page-#{section_id}-section" })
28
+ end
29
+ end
30
+
20
31
  private
21
32
 
22
33
  # Example:
@@ -11,6 +11,9 @@ module Locomotive
11
11
  field :url_redirections, type: Array, default: []
12
12
  field :url_redirections_information, type: Hash, default: {}
13
13
 
14
+ ## virtual attributes ##
15
+ attr_accessor :url_redirections_expert_mode
16
+
14
17
  end
15
18
 
16
19
  module ClassMethods
@@ -22,6 +25,13 @@ module Locomotive
22
25
 
23
26
  end
24
27
 
28
+ def url_redirections_plain_text
29
+ url_redirections
30
+ .sort { |a, b| a.first <=> b.first }
31
+ .map { |redirection| redirection.join(' ') }
32
+ .join("\n")
33
+ end
34
+
25
35
  def url_redirections_with_information(with_hidden = true)
26
36
  url_redirections.map do |(source, target)|
27
37
  url_id = Digest::MD5.hexdigest(source)
@@ -67,7 +77,7 @@ module Locomotive
67
77
  protected
68
78
 
69
79
  def add_leading_slash_to(path)
70
- path.starts_with?('/') ? path : "/#{path}"
80
+ path.starts_with?('/') || path =~ /\Ahttps+:\/\// ? path : "/#{path}"
71
81
  end
72
82
 
73
83
  end
@@ -2,7 +2,7 @@ module Locomotive
2
2
  class MembershipPolicy < ApplicationPolicy
3
3
 
4
4
  def index?
5
- site_admin?
5
+ site_admin_or_designer?
6
6
  end
7
7
 
8
8
  def create?
@@ -14,7 +14,7 @@ module Locomotive
14
14
  end
15
15
 
16
16
  def destroy?
17
- site_admin? && change_role?
17
+ site_admin_or_designer? && change_role?
18
18
  end
19
19
 
20
20
  # The role cannot be set higher than the current one (we use the index in
@@ -25,11 +25,7 @@ module Locomotive
25
25
  end
26
26
 
27
27
  def permitted_attributes
28
- if site_admin?
29
- [:email, :role]
30
- else
31
- []
32
- end
28
+ [:email, :role]
33
29
  end
34
30
 
35
31
  end
@@ -1,5 +1,5 @@
1
1
  module Locomotive
2
- class ContentEntryService < Struct.new(:content_type, :account)
2
+ class ContentEntryService < Struct.new(:content_type, :account, :locale)
3
3
 
4
4
  include Locomotive::Concerns::ActivityService
5
5
 
@@ -85,7 +85,7 @@ module Locomotive
85
85
  # send an email to selected local accounts
86
86
  send_notifications(entry)
87
87
 
88
- track_activity 'content_entry.created_public', parameters: activity_parameters(entry)
88
+ track_activity 'content_entry.created_public', locale: locale, parameters: activity_parameters(entry)
89
89
  end
90
90
  end
91
91
  end
@@ -106,7 +106,7 @@ module Locomotive
106
106
  entry.updated_by = account
107
107
 
108
108
  if entry.save
109
- track_activity 'content_entry.updated', parameters: activity_parameters(entry)
109
+ track_activity 'content_entry.updated', locale: locale, parameters: activity_parameters(entry)
110
110
  end
111
111
  end
112
112
  end
@@ -127,6 +127,24 @@ module Locomotive
127
127
  end
128
128
  end
129
129
 
130
+ # Destroy all the entries described by their id
131
+ def bulk_destroy(ids)
132
+ content_type.entries.where(:_id.in => ids).map do |entry|
133
+ entry.destroy
134
+ entry._label
135
+ end.tap do |labels|
136
+ track_activity 'content_entry.destroyed_bulk',
137
+ parameters: activity_parameters.merge(labels: labels)
138
+ end
139
+ end
140
+
141
+ # Destroy all the entries of a content type.
142
+ # Runs each entry's destroy callbacks.
143
+ #
144
+ def destroy_all
145
+ content_type.entries.destroy_all
146
+ end
147
+
130
148
  # Make sure the content entries has a non-blank slug in the new locales.
131
149
  # We take the slug in the default locale or the previous default locale (if provided)
132
150
  #
@@ -148,13 +166,6 @@ module Locomotive
148
166
  end
149
167
  end
150
168
 
151
- # Destroy all the entries of a content type.
152
- # Runs each entry's destroy callbacks.
153
- #
154
- def destroy_all
155
- content_type.entries.destroy_all
156
- end
157
-
158
169
  def send_notifications(entry)
159
170
  return unless self.content_type.public_submission_enabled?
160
171
 
@@ -1,5 +1,5 @@
1
1
  module Locomotive
2
- class CustomFieldService < Struct.new(:field)
2
+ class CustomFieldService < Struct.new(:field, :locale)
3
3
 
4
4
  # Update the options of a "select" field.
5
5
  #
@@ -10,19 +10,43 @@ module Locomotive
10
10
  def update_select_options(options)
11
11
  return nil if options.blank?
12
12
 
13
+ default_locale = field._parent.site.default_locale.to_sym
14
+ include_new_options = false
15
+
13
16
  # set the right position
14
17
  options.each_with_index do |option, position|
15
18
  option['position'] = position
19
+ include_new_options = true if option['_id'].blank?
16
20
  end
17
21
 
18
22
  self.field.select_options_attributes = options
19
23
 
24
+ save_field
25
+
26
+ # make sure the new options are also available in the default locale
27
+ if include_new_options && locale != default_locale
28
+ ::Mongoid::Fields::I18n.with_locale(default_locale) do
29
+ self.field.reload.select_options.each do |option|
30
+ next unless option.attributes[:name][default_locale].blank?
31
+
32
+ # force the name in the default locale
33
+ option.name = option.attributes[:name].values.first
34
+ end
35
+ end
36
+
37
+ save_field # we have to save it again and that's okay
38
+ end
39
+
40
+ self.field.select_options
41
+ end
42
+
43
+ private
44
+
45
+ def save_field
20
46
  # save the content type so that all the content entries get a fresh version
21
47
  # of the custom fields rules
22
- self.field._parent.save
23
48
  self.field.save
24
-
25
- self.field.select_options
49
+ self.field._parent.save
26
50
  end
27
51
 
28
52
  end
@@ -1,5 +1,5 @@
1
1
  module Locomotive
2
- class EditableElementService < Struct.new(:site, :account)
2
+ class EditableElementService < Struct.new(:site, :account, :locale)
3
3
 
4
4
  include Locomotive::Concerns::ActivityService
5
5
 
@@ -25,7 +25,7 @@ module Locomotive
25
25
 
26
26
  save_all_pages(pages.values)
27
27
 
28
- track_activity 'editable_element.updated_bulk', parameters: {
28
+ track_activity 'editable_element.updated_bulk', locale: locale, parameters: {
29
29
  pages: modified_pages.values.map { |p| { title: p.title, _id: p._id } }
30
30
  } unless modified_pages.empty?
31
31
  end
@@ -1,36 +1,21 @@
1
1
  module Locomotive
2
- class EditorService < Struct.new(:site, :account, :page)
2
+ class EditorService < Struct.new(:site, :account, :page, :locale)
3
3
 
4
4
  include Locomotive::Concerns::ActivityService
5
5
 
6
6
  # Used by the URL picker to retrieve either a page or a content entry.
7
- def find_resources(query, max_results = 10)
8
- return [] if query.strip.blank?
9
-
10
- (
11
- site.pages
12
- .only(:_id, :title)
13
- .where(title: /#{query}/i, is_layout: false, target_klass_name: nil, :slug.ne => '404')
14
- .limit(max_results).map do |page|
15
- { type: 'page', value: page._id, label: ['Pages', page.title] }
16
- end
17
- ) + (
18
- site.pages
19
- .only(:_id, :site_id, :target_klass_name)
20
- .where(:target_klass_name.ne => nil).map do |page|
21
- page.fetch_target_entries(
22
- page.content_type.label_field_name => /#{query}/i, _visible: true
23
- ).map do |entry|
24
- {
25
- type: 'content_entry',
26
- value: { content_type_slug: entry.content_type_slug, id: entry._id, page_id: page._id },
27
- label: [entry.content_type.name, entry._label]
28
- }
29
- end
30
- end.flatten
31
- )
32
- .sort { |a, b| a[:label][1] <=> b[:label][1] }
33
- .first(max_results)
7
+ def find_resources(type, query, scope = nil, max_results = 10)
8
+ return [] if type.blank? || query.strip.blank?
9
+
10
+ case type
11
+ when 'page'
12
+ find_pages(query, max_results)
13
+ when 'content_entry'
14
+ find_content_entries(scope, query, max_results)
15
+ else
16
+ Rails.logger.warn("[EditorService] Unknown type: #{type}")
17
+ []
18
+ end
34
19
  end
35
20
 
36
21
  # Save sections for both the current site (global versions) and the page
@@ -42,13 +27,44 @@ module Locomotive
42
27
  page_attributes[:sections_dropzone_content] = parse_sections_dropzone_content(page_attributes[:sections_dropzone_content])
43
28
  page.update_attributes(page_attributes)
44
29
 
45
- track_activity 'editable_element.updated_bulk', parameters: {
46
- pages: [page].map { |p| { title: p.title, _id: p._id } }
47
- }
30
+ track_activity 'page_content.updated',
31
+ parameters: { _id: page._id, title: page.title },
32
+ locale: locale
48
33
  end
49
34
 
50
35
  private
51
36
 
37
+ def find_pages(query, max_results = 10)
38
+ site.pages
39
+ .only(:_id, :title, :sections_dropzone_content, :sections_content)
40
+ .where(is_layout: false, target_klass_name: nil, :slug.ne => '404')
41
+ .or({ title: /#{query}/i }, { _id: query })
42
+ .limit(max_results)
43
+ .sort(title: 1).map do |page|
44
+ {
45
+ type: 'page',
46
+ value: page._id,
47
+ label: ['Page', page.title],
48
+ sections: page.all_sections_content
49
+ }
50
+ end
51
+ end
52
+
53
+ def find_content_entries(scope, query, max_results)
54
+ content_type = site.content_types.where(slug: scope).first
55
+ content_type.entries
56
+ .where(
57
+ content_type.label_field_name => /#{query}/i, _visible: true
58
+ )
59
+ .limit(max_results).map do |entry|
60
+ {
61
+ type: 'content_entry',
62
+ value: { content_type_slug: scope, id: entry._id },
63
+ label: [content_type.name, entry._label]
64
+ }
65
+ end
66
+ end
67
+
52
68
  def parse_sections_content(value)
53
69
  return nil if value.nil?
54
70
 
@@ -1,6 +1,6 @@
1
1
  module Locomotive
2
2
 
3
- class PageService < Struct.new(:site, :account)
3
+ class PageService < Struct.new(:site, :account, :locale)
4
4
 
5
5
  include Locomotive::Concerns::ActivityService
6
6
 
@@ -41,7 +41,7 @@ module Locomotive
41
41
  page.updated_by = account if account
42
42
 
43
43
  if page.save
44
- track_activity 'page.updated', parameters: { title: page.title, _id: page._id }
44
+ track_activity 'page.updated', locale: locale, parameters: { title: page.title, _id: page._id }
45
45
  end
46
46
  end
47
47
  end
@@ -24,6 +24,13 @@ module Locomotive
24
24
  end
25
25
  end
26
26
 
27
+ def bulk_destroy(ids)
28
+ site.translations.where(:id.in => ids).map do |translation|
29
+ translation.destroy
30
+ translation._id
31
+ end
32
+ end
33
+
27
34
  protected
28
35
 
29
36
  def prepare_keywords_statement(keywords)
@@ -1,6 +1,6 @@
1
1
  - title t('.title')
2
2
 
3
- = help t('.help', default: '')
3
+ - help t('.help', default: '')
4
4
 
5
5
  = locomotive_form_for @account, url: accounts_path(current_site) do |f|
6
6
 
@@ -22,6 +22,11 @@
22
22
  span= asset_text(asset)
23
23
 
24
24
  .actions
25
+ - if asset.source&.url
26
+ = link_to asset.source.url, class: 'btn btn-primary btn-sm', target: '_blank' do
27
+ i.fas.fa-download
28
+ | &nbsp;
29
+
25
30
  - if enable_select
26
31
  = link_to t('.buttons.select'), asset.source.url, class: 'btn btn-primary btn-sm select', title: asset_filename(asset), data: { image: asset.image? }
27
32
  | &nbsp;
@@ -1,5 +1,5 @@
1
1
  = form_tag content_assets_path(current_site), method: 'GET', remote: remote do
2
2
  = hidden_field_tag :types, params[:types] if params[:types]
3
3
  .form-group
4
- = text_field_tag :query, params[:query], placeholder: t('.placeholder'), class: 'form-control'
5
4
  i.fa.fa-search.icon
5
+ = text_field_tag :query, params[:query], placeholder: t('.placeholder'), class: 'form-control'
@@ -24,9 +24,9 @@
24
24
  == document_stamp(entry)
25
25
 
26
26
  .actions
27
- = link_to content_entry_path(current_site, content_type.slug, entry), title: t(:delete, scope: 'simple_form.buttons.defaults.locomotive'), class: 'remove', data: { confirm: t('locomotive.messages.confirm') }, method: :delete do
28
- i.far.fa-trash-alt
29
-
27
+ .checkbox
28
+ = check_box_tag "item_#{entry._id}", entry._id
29
+ = label_tag "item_#{entry._id}", ''
30
30
 
31
31
  - if entries.respond_to?(:current_page)
32
32
  .text-center
@@ -1,6 +1,6 @@
1
1
  - title t('.title', type: @content_type.name.capitalize)
2
2
 
3
- = help @content_type.description
3
+ - help @content_type.description
4
4
 
5
5
  - content_for :actions do
6
6
  - if @content_type.localized?
@@ -11,6 +11,7 @@
11
11
 
12
12
  = locomotive_form_for @content_entry, as: :content_entry, url: content_entry_path(current_site, @content_type.slug, @content_entry), html: { multipart: true, novalidate: true } do |f|
13
13
 
14
+ = hidden_field_tag :content_locale, current_content_locale
14
15
  = hidden_field_tag :active_tab, ''
15
16
  = hidden_field_tag :_location, params[:_location]
16
17
 
@@ -1,55 +1,68 @@
1
1
  - title t('.title', type: @content_type.name.capitalize)
2
+ - help @content_type.description
2
3
 
3
4
  - content_for :actions do
4
5
  - if @content_type.localized?
5
6
  = locale_picker_link
6
7
 
7
- - if can_edit_public_submission_accounts?(@content_type)
8
- = link_to edit_public_submission_accounts_path(current_site, @content_type.slug), class: 'btn btn-primary btn-sm' do
9
- i.fa.fa-pencil
10
- | &nbsp;
11
- = t('.edit_notification_settings')
12
-
13
- = link_to new_content_entry_path(current_site, @content_type.slug), class: 'btn btn-primary btn-sm' do
14
- i.fa.fa-plus
15
- | &nbsp;
16
- = t('.new')
17
-
18
- - if @content_type.filter_fields.present?
19
- .row
20
- .col-md-6
21
- = help @content_type.description
22
- .col-md-6
8
+ .bulk-destroy-action.hidden
9
+ = form_tag bulk_destroy_content_entries_path(current_site, @content_type.slug, page: params[:page] || 1), method: :delete do
10
+ = hidden_field_tag 'ids', ''
11
+ = button_tag type: 'submit', class: 'btn btn-primary btn-sm', data: { confirm: t('locomotive.messages.confirm') } do
12
+ i.far.fa-trash-alt
13
+ | &nbsp;
14
+ = t('.bulk_destroy')
15
+
16
+ .main-action
17
+ .btn-group
18
+ = link_to new_content_entry_path(current_site, @content_type.slug), class: 'btn btn-primary btn-sm' do
19
+ i.fa.fa-plus
20
+ | &nbsp;
21
+ = t('.new')
22
+ button.btn.btn-primary.btn-sm.dropdown-toggle data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
23
+ span.caret
24
+ span.sr-only Toggle Dropdown
25
+ ul.dropdown-menu.dropdown-menu-right
26
+ - if can_edit_public_submission_accounts?(@content_type)
27
+ li
28
+ = link_to edit_public_submission_accounts_path(current_site, @content_type.slug) do
29
+ i.fas.fa-cog
30
+ = t('.edit_notification_settings')
31
+
32
+ - unless empty_collection?(@content_entries)
33
+ li
34
+ = link_to export_content_entries_path(current_site, @content_type.slug, :csv) do
35
+ i.fa.fa-download
36
+ = t('.download')
37
+
38
+ - if @content_type.groupable?
39
+ .row.list-groups
40
+ .nav-container
41
+ ul.nav.nav-tabs role='tablist'
42
+ li class="#{'active' if params[:group].nil?}"
43
+ = link_to t('.group_by.all'), content_entries_path(current_site, @content_type.slug, query: params[:query])
44
+
45
+ - each_content_entry_group(@content_type) do |group|
46
+ li class="#{'active' if params[:group] == group[:name]}"
47
+ = link_to group[:name], group[:url]
48
+
49
+ .row.list-header
50
+ .col.col-md-6.text-left
51
+ - if @content_type.filter_fields.present?
23
52
  .search-bar
24
53
  = form_tag content_entries_path(current_site, @content_type.slug), method: :get do
25
54
  .form-group
26
55
  = hidden_field_tag :group, params[:group]
27
56
  = hidden_field_tag :where, params[:where]
28
- = text_field_tag :q, params[:q], placeholder: t('.search_placeholder'), class: 'form-control'
29
57
  i.fa.fa-search.icon
58
+ = text_field_tag :q, params[:q], placeholder: t('.search_placeholder'), class: 'form-control'
59
+ - else
60
+ p
30
61
 
31
- - else
32
- = help @content_type.description
33
-
34
- - if @content_type.groupable?
35
- .nav-container
36
- ul.nav.nav-tabs role='tablist'
37
- li class="#{'active' if params[:group].nil?}"
38
- = link_to t('.group_by.all'), content_entries_path(current_site, @content_type.slug, query: params[:query])
39
-
40
- - each_content_entry_group(@content_type) do |group|
41
- li class="#{'active' if params[:group] == group[:name]}"
42
- = link_to group[:name], group[:url]
62
+ .col.col-md-6.text-right
63
+ - unless empty_collection?(@content_entries)
64
+ .checkbox
65
+ = check_box_tag 'all_entries', 1, false, class: 'list-main-checkbox'
66
+ = label_tag 'all_entries', ''
43
67
 
44
68
  = render 'list', content_type: @content_type, entries: @content_entries
45
-
46
- - unless empty_collection?(@content_entries)
47
- .row
48
- .col-md-12
49
- br
50
- p.text-right
51
- = link_to export_content_entries_path(current_site, @content_type.slug, :csv), class: 'btn btn-primary btn-sm' do
52
- i.fa.fa-download
53
- | &nbsp;
54
- = t('.download')
55
-