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
@@ -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
  = link_to t(:back, scope: 'locomotive.content_entries.shared').html_safe, content_entries_path(current_site, @content_type.slug), class: 'btn btn-sm btn-default'
@@ -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
  - content_for :actions do
6
6
  = locale_picker_link
@@ -1,4 +1,8 @@
1
1
  = f.inputs :url_redirections do
2
+ = f.input :url_redirections_expert_mode, as: :toggle
3
+
4
+ = f.input :url_redirections_plain_text, as: :text, wrapper_html: { class: 'hide' }, input_html: { rows: 30 }
5
+
2
6
  = f.input :url_redirections, as: :array, hint: t(:url_redirections, scope: 'simple_form.hints.locomotive.site').html_safe, placeholder: true, collection: f.object.url_redirections_with_information(false).to_a, template: :url_redirection, template_url: new_url_redirection_current_site_path(current_site)
3
7
 
4
8
  = f.actions do
@@ -1,6 +1,6 @@
1
1
  - title current_site_metafields_ui[:title]
2
2
 
3
- = help current_site_metafields_ui[:hint]
3
+ - help current_site_metafields_ui[:hint]
4
4
 
5
5
  - if @site.has_metafields?
6
6
 
@@ -17,6 +17,9 @@ ul.activity-feed
17
17
  | ·
18
18
  |  
19
19
  span.sentence= render_activity_sentence(activity)
20
+ - if activity.locale && activity.locale.to_s != current_site.default_locale.to_s
21
+ span.locale
22
+ = activity.locale.to_s
20
23
 
21
24
  - if info = render_activity_additional_information(activity)
22
25
  .additional-information= info
@@ -26,10 +26,11 @@ html xmlns='http://www.w3.org/1999/xhtml'
26
26
 
27
27
  - if title
28
28
  .row.header-row
29
- .col-md-8.col-xs-9
29
+ .col-md-7.col-xs-9
30
30
  h1== title
31
+ == help
31
32
 
32
- .col-md-4.col-xs-3.actions
33
+ .col-md-5.col-xs-3.actions
33
34
  = yield :actions
34
35
 
35
36
  = yield
@@ -12,3 +12,5 @@ html xmlns='http://www.w3.org/1999/xhtml'
12
12
  .content-overlay
13
13
 
14
14
  = yield
15
+
16
+
@@ -1,6 +1,6 @@
1
1
  - title t('.title', name: @membership.account.name)
2
2
 
3
- = help t('.help', default: '')
3
+ - help t('.help', default: '')
4
4
 
5
5
  = locomotive_form_for @membership, url: membership_path(current_site, @membership) do |f|
6
6
 
@@ -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 @membership, url: memberships_path(current_site) do |f|
6
6
 
@@ -16,3 +16,4 @@
16
16
  <%= javascript_include_tag 'locomotive/editor' %>
17
17
  <%= stylesheet_link_tag 'locomotive/editor', media: 'screen' %>
18
18
  <% end %>
19
+
@@ -6,7 +6,7 @@ json.data do
6
6
  json.page do
7
7
  json.(@page, :id, :title, :seo_title, :meta_description, :meta_keywords, :listed, :published)
8
8
 
9
- json.slug @page.slug if !@page.index? && !@page.not_found? && !@page.templatized?
9
+ json.slug @page.slug if display_slug?(@page)
10
10
 
11
11
  json.fullpath nice_preview_page_path(@page)
12
12
  json.contentEntryId @page.content_entry&.id
@@ -28,6 +28,8 @@ json.data do
28
28
  json.locale current_content_locale
29
29
  json.locales current_site.locales
30
30
  json.uiLocale I18n.locale
31
+
32
+ json.contentTypes content_types_with_templates(current_site)
31
33
  end
32
34
 
33
35
  json.urls do
@@ -1,6 +1,6 @@
1
1
  - title t(:title, title: h(@page.title), fullpath: nice_preview_page_path(@page), scope: 'locomotive.pages.edit')
2
2
 
3
- = help t('.help', default: '')
3
+ - help t('.help', default: '')
4
4
 
5
5
  - if current_site.localized?
6
6
  - content_for :actions do
@@ -5,7 +5,7 @@
5
5
  - if display_page_layouts?
6
6
  = f.input :layout_id, as: :select, collection: options_for_page_layouts, include_blank: false
7
7
 
8
- - if !@page.index? && !@page.not_found? && !@page.templatized?
8
+ - if display_slug?(@page)
9
9
 
10
10
  = f.input :slug
11
11
 
@@ -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 @page, url: pages_path(current_site), html: { multipart: true } do |f|
6
6
 
@@ -1,6 +1,6 @@
1
1
  - title t('.title', name: @content_type.name)
2
2
 
3
- = help t('.help', default: '')
3
+ - help t('.help', default: '')
4
4
 
5
5
  = locomotive_form_for @content_type, url: public_submission_accounts_path(current_site, @content_type.slug), html: { multipart: true } do |f|
6
6
 
@@ -1,6 +1,3 @@
1
- - (params[:_location] || {}).each do |name, value|
2
- = hidden_field_tag "_location[#{name}]", value
3
-
4
1
  = f.inputs do
5
2
 
6
3
  = f.simple_fields_for :values, OpenStruct.new(@translation.values) do |g|
@@ -1,6 +1,6 @@
1
1
  - title t('.title', key: @translation.key )
2
2
 
3
- = locomotive_form_for @translation, url: translation_path(current_site, @translation) do |f|
3
+ = locomotive_form_for @translation, url: translation_path(current_site, @translation, translation_nav_params) do |f|
4
4
 
5
5
  = render 'form', f: f
6
6
 
@@ -1,9 +1,25 @@
1
1
  - title t('.title')
2
-
3
- .row
4
- .col-md-7
5
- = help t('.help')
6
- .col-md-5
2
+ - help t('.help')
3
+
4
+ - content_for :actions do
5
+ .bulk-destroy-action.hidden
6
+ = form_tag bulk_destroy_translations_path(current_site, page: params[:page] || 1, filter_by: params[:filter_by], q: params[:q]), method: :delete do
7
+ = hidden_field_tag 'ids', ''
8
+ = button_tag type: 'submit', class: 'btn btn-primary btn-sm', data: { confirm: t('locomotive.messages.confirm') } do
9
+ i.far.fa-trash-alt
10
+ | &nbsp;
11
+ = t('.bulk_destroy')
12
+
13
+ .row.list-groups
14
+ .nav-container
15
+ ul.nav.nav-tabs role='tablist'
16
+ - %w(all done partially none).each_with_index do |name, index|
17
+
18
+ li class="#{'active' if params[:filter_by] == name || (index == 0 && params[:filter_by].blank?)}"
19
+ = link_to t(".filter_by.#{name}"), translations_path(current_site, q: params[:q], filter_by: index == 0 ? '' : name)
20
+
21
+ .row.list-header
22
+ .col.col-md-6.col-xs-6.text-left
7
23
  .search-bar
8
24
  = form_tag translations_path(current_site), method: :get do
9
25
  .form-group
@@ -11,12 +27,11 @@
11
27
  = text_field_tag :q, params[:q], placeholder: t('.search_placeholder'), class: 'form-control'
12
28
  i.fa.fa-search.icon
13
29
 
14
- .nav-container
15
- ul.nav.nav-tabs role='tablist'
16
- - %w(all done partially none).each_with_index do |name, index|
17
-
18
- li class="#{'active' if params[:filter_by] == name || (index == 0 && params[:filter_by].blank?)}"
19
- = link_to t(".filter_by.#{name}"), translations_path(current_site, q: params[:q], filter_by: index == 0 ? '' : name)
30
+ .col.col-md-6.col-xs-6.text-right
31
+ - unless @translations.empty?
32
+ .checkbox
33
+ = check_box_tag 'all_translations', 1, false, class: 'list-main-checkbox'
34
+ = label_tag 'all_translations', ''
20
35
 
21
36
  - if @translations.empty?
22
37
  br
@@ -25,18 +40,22 @@
25
40
  == t('.no_items')
26
41
 
27
42
  - else
28
-
29
43
  #translations-list.row.big-list
30
44
  - @translations.each do |translation|
31
45
  .item.col-md-12 class=translation_completion_to_class(current_site, translation)
46
+ .status
47
+ span.completion
48
+ i.fa.fa-circle
49
+
32
50
  .text
33
- strong= link_to translation.key, edit_translation_path(current_site, translation, _location: { filter_by: params[:filter_by], q: params[:q] })
51
+ strong= link_to translation.key, edit_translation_path(current_site, translation, translation_nav_params)
34
52
  .stamp
35
53
  == document_stamp(translation)
36
54
 
37
55
  .actions
38
- span.completion
39
- i.fa.fa-circle
56
+ .checkbox
57
+ = check_box_tag "item_#{translation._id}", translation._id
58
+ = label_tag "item_#{translation._id}", ''
40
59
 
41
60
  .text-center
42
61
  = paginate @translations, theme: 'twitter-bootstrap-3', pagination_class: 'pagination-sm'
@@ -40,11 +40,11 @@ fr:
40
40
  unlocked: 'Votre compte à été dé-verouillé. Vous êtes connecté!'
41
41
  mailer:
42
42
  confirmation_instructions:
43
- locomotive_account_subject: 'Instructions de validation'
43
+ locomotive_account_subject: 'Instructions pour confirmation'
44
44
  reset_password_instructions:
45
- locomotive_account_subject: 'Instructions de rétablissement du mot de passe'
45
+ locomotive_account_subject: 'Instructions pour ré-initialiser le mot de passe'
46
46
  unlock_instructions:
47
- locomotive_account_subject: 'Instructions de déverrouillage.'
47
+ locomotive_account_subject: 'Instructions pour débloquer'
48
48
  locomotive:
49
49
  devise_mailer:
50
50
  common:
@@ -10,22 +10,25 @@ en:
10
10
  action: "Apply"
11
11
  action_in_progress: "Cropping..."
12
12
 
13
- url_picker:
14
- no_url: "No URL for now"
15
- placeholder: "Please type the label of a resource"
16
- open_new_window: "Open in a new window?"
17
- select_button: "Select"
18
- cancel_button: "Cancel"
19
- change_button: "Change"
20
- done_button: "Done"
21
- types:
22
- external: "External"
23
- pages: "Page"
24
-
25
13
  locale_switcher:
26
14
  locale: "<strong>{{locale}}</strong> version"
27
15
 
16
+ draft:
17
+ link:
18
+ title: Insert link
19
+ insert_link: Done
20
+
28
21
  inputs:
22
+ url:
23
+ select_button: "Select"
24
+ change_button: "Change"
25
+ remove_button: "Remove"
26
+ types:
27
+ page: Page
28
+ content_entry: Model
29
+ _external: URL
30
+ email: Email
31
+
29
32
  image_picker:
30
33
  select_button: "Select"
31
34
  change_button: "Change"
@@ -50,12 +53,35 @@ en:
50
53
  settings: "Settings"
51
54
  seo: "SEO"
52
55
 
53
- assets:
56
+ pickers:
54
57
  images:
55
58
  title: "Images"
56
59
  loading: "Loading the images. Please wait!"
57
60
  add: "+ add"
61
+ too_big: "Your image is too big: Maximum file size is 2MB"
58
62
  upload_in_progress: "Uploading..."
63
+ url:
64
+ title: "Pick a target"
65
+ open_new_window: "Open in a new window?"
66
+ types:
67
+ page: Page
68
+ content_entry: Model
69
+ _external: URL
70
+ email: Email
71
+ page:
72
+ label: Page
73
+ placeholder: Type the title of your page
74
+ section_label: Section
75
+ content_entry:
76
+ content_type_label: Which model?
77
+ label: Instance of your model
78
+ placeholder: Type the label of the instance
79
+ _external:
80
+ label: URL address
81
+ placeholder: "https://www.example.com"
82
+ email:
83
+ label: Email address
84
+ placeholder: "name@example.com"
59
85
 
60
86
  preview:
61
87
  view: "View"
@@ -10,22 +10,25 @@ fr:
10
10
  action: "Appliquer"
11
11
  action_in_progress: "Rognage..."
12
12
 
13
- url_picker:
14
- no_url: "Aucune URL pour le moment"
15
- placeholder: "Veuillez taper le titre d'une ressource"
16
- open_new_window: "Ouvrir dans une nouvelle fenêtre ?"
17
- select_button: "Sélectionner"
18
- cancel_button: "Annuler"
19
- change_button: "Changer"
20
- done_button: "Finir"
21
- types:
22
- external: "Externe"
23
- pages: "Page"
24
-
25
13
  locale_switcher:
26
14
  locale: 'version <strong>{{locale}}</strong>'
27
15
 
16
+ draft:
17
+ link:
18
+ title: Insérer un lien
19
+ insert_link: Terminé
20
+
28
21
  inputs:
22
+ url:
23
+ select_button: "Sélectionner"
24
+ change_button: "Changer"
25
+ remove_button: "Enlever"
26
+ types:
27
+ page: Page
28
+ content_entry: Modèle
29
+ _external: URL
30
+ email: Email
31
+
29
32
  image_picker:
30
33
  select_button: "Sélectionner"
31
34
  change_button: "Changer"
@@ -50,12 +53,35 @@ fr:
50
53
  settings: "Paramètres"
51
54
  seo: "SEO"
52
55
 
53
- assets:
56
+ pickers:
54
57
  images:
55
58
  title: "Images"
56
59
  loading: "Chargement des images en cours !"
60
+ too_big: "Votre image est trop lourde : la taille maximale pour un fichier est de 2Mo"
57
61
  add: "+ ajouter"
58
62
  upload_in_progress: "Téléchargement en cours..."
63
+ url:
64
+ title: "Sélectionner une cible"
65
+ open_new_window: "Ouvrir dans une nouvelle fenêtre ?"
66
+ types:
67
+ page: Page
68
+ content_entry: Modèle
69
+ _external: URL
70
+ email: Email
71
+ page:
72
+ label: Page
73
+ placeholder: Taper le titre de votre page
74
+ section_label: Section
75
+ content_entry:
76
+ content_type_label: Quel modèle ?
77
+ label: Titre d'une ressource
78
+ placeholder: Taper le tire de votre ressource
79
+ _external:
80
+ label: Adresse WEB
81
+ placeholder: "https://www.example.com"
82
+ email:
83
+ label: Adresse Email
84
+ placeholder: "name@example.com"
59
85
 
60
86
  preview:
61
87
  view: "Aperçu"
@@ -102,6 +102,8 @@ en:
102
102
  updated: 'updated the %{page} page'
103
103
  destroyed: 'deleted the %{page} page'
104
104
  sorted: 'sorted pages'
105
+ page_content:
106
+ updated: 'modified the content of %{page}'
105
107
  editable_element:
106
108
  updated_bulk: 'modified the content of %{pages}'
107
109
  content_entry:
@@ -110,6 +112,7 @@ en:
110
112
  updated: 'updated %{entry} from %{content_type}'
111
113
  destroyed: 'deleted %{entry} from %{content_type}'
112
114
  sorted: 'sorted %{content_type}'
115
+ destroyed_bulk: 'deleted %{entry} from %{content_type}'
113
116
  content_asset:
114
117
  created_bulk: 'uploaded %{count} asset(s)'
115
118
  destroyed: 'deleted the %{name} asset'
@@ -358,6 +361,7 @@ en:
358
361
  title: '%{type}'
359
362
  download: download entries
360
363
  new: new entry
364
+ bulk_destroy: delete entries
361
365
  edit_notification_settings: Edit notification settings
362
366
  search_placeholder: "Enter your search keywords here"
363
367
  group_by:
@@ -24,6 +24,8 @@ en:
24
24
  notice: "Entries were successfully sorted."
25
25
  destroy:
26
26
  notice: "Entry was successfully deleted."
27
+ bulk_destroy:
28
+ notice: "Entries were successfully deleted."
27
29
 
28
30
  content_types:
29
31
  update:
@@ -85,6 +87,8 @@ en:
85
87
  alert: "Translation was not updated."
86
88
  destroy:
87
89
  notice: "Translation was successfully deleted."
90
+ bulk_destroy:
91
+ notice: "Translations were successfully deleted."
88
92
 
89
93
  custom_fields:
90
94
  select_options: