locomotivecms 4.0.3 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -0
  3. data/app/api/locomotive/api/entities/content_type_entity.rb +1 -1
  4. data/app/api/locomotive/api/entities/site_entity.rb +1 -0
  5. data/app/api/locomotive/api/forms/content_type_form.rb +2 -1
  6. data/app/api/locomotive/api/forms/site_form.rb +2 -0
  7. data/app/api/locomotive/api/helpers/persistence_helper.rb +1 -1
  8. data/app/api/locomotive/api/resources/content_asset_resource.rb +6 -0
  9. data/app/api/locomotive/api/resources/content_type_resource.rb +2 -0
  10. data/app/api/locomotive/api/resources/current_site_resource.rb +2 -1
  11. data/app/api/locomotive/api/resources/site_resource.rb +5 -1
  12. data/app/assets/javascripts/locomotive/editor.js +7819 -100
  13. data/app/assets/javascripts/locomotive/views/content_entry_imports/new_view.js.coffee +12 -0
  14. data/app/assets/javascripts/locomotive/views/content_entry_imports/show_view.js.coffee +8 -0
  15. data/app/assets/stylesheets/locomotive/application.scss +2 -0
  16. data/app/assets/stylesheets/locomotive/editor.css +105 -12
  17. data/app/assets/stylesheets/locomotive/new/_dashboard.scss +20 -0
  18. data/app/assets/stylesheets/locomotive/old/_content_assets.scss +1 -1
  19. data/app/controllers/locomotive/content_assets_controller.rb +1 -1
  20. data/app/controllers/locomotive/content_entry_imports_controller.rb +50 -0
  21. data/app/helpers/locomotive/base_helper.rb +1 -1
  22. data/app/helpers/locomotive/shared/pages_helper.rb +1 -1
  23. data/app/jobs/locomotive/import_content_entry_job.rb +12 -0
  24. data/app/mailers/locomotive/notifications.rb +37 -11
  25. data/app/models/locomotive/account.rb +1 -0
  26. data/app/models/locomotive/concerns/asset/vignette.rb +7 -5
  27. data/app/models/locomotive/concerns/content_entry/slug.rb +7 -2
  28. data/app/models/locomotive/concerns/content_type/import.rb +124 -0
  29. data/app/models/locomotive/concerns/shared/slug.rb +3 -3
  30. data/app/models/locomotive/concerns/site/metafields.rb +26 -0
  31. data/app/models/locomotive/content_asset.rb +9 -2
  32. data/app/models/locomotive/content_type.rb +1 -0
  33. data/app/models/locomotive/section.rb +3 -1
  34. data/app/models/locomotive/site.rb +3 -0
  35. data/app/policies/locomotive/content_entry_policy.rb +1 -2
  36. data/app/policies/locomotive/content_type_policy.rb +3 -0
  37. data/app/policies/locomotive/site_policy.rb +5 -3
  38. data/app/services/locomotive/content_asset_service.rb +27 -4
  39. data/app/services/locomotive/content_entry_import_service.rb +107 -0
  40. data/app/services/locomotive/content_entry_service.rb +1 -1
  41. data/app/uploaders/locomotive/picture_uploader.rb +1 -1
  42. data/app/uploaders/locomotive/theme_asset_uploader.rb +1 -1
  43. data/app/views/locomotive/content_assets/_dropzone.html.slim +5 -1
  44. data/app/views/locomotive/content_assets/_list.html.slim +2 -2
  45. data/app/views/locomotive/content_entries/index.html.slim +8 -0
  46. data/app/views/locomotive/content_entry_imports/new.html.slim +23 -0
  47. data/app/views/locomotive/content_entry_imports/show.html.slim +54 -0
  48. data/app/views/locomotive/current_site/form/_advanced.html.slim +2 -0
  49. data/app/views/locomotive/page_content/edit.html.erb +1 -0
  50. data/app/views/locomotive/shared/account/_head.html.slim +2 -0
  51. data/app/views/locomotive/shared/account/_main_app_head.html.slim +1 -0
  52. data/config/locales/editor.en.yml +22 -0
  53. data/config/locales/editor.fr.yml +22 -0
  54. data/config/locales/en.yml +19 -0
  55. data/config/locales/es.yml +2 -0
  56. data/config/locales/flash.en.yml +6 -0
  57. data/config/locales/mongoid.en.yml +5 -1
  58. data/config/locales/mongoid.es.yml +4 -0
  59. data/config/locales/simple_form.en.yml +13 -1
  60. data/config/locales/simple_form.es.yml +2 -0
  61. data/config/routes.rb +3 -2
  62. data/lib/generators/locomotive/install/templates/carrierwave_aws.rb +5 -0
  63. data/lib/generators/locomotive/install/templates/locomotive.rb +5 -1
  64. data/lib/locomotive/configuration.rb +3 -0
  65. data/lib/locomotive/core_ext.rb +21 -0
  66. data/lib/locomotive/dragonfly.rb +6 -4
  67. data/lib/locomotive/steam_adaptor.rb +9 -5
  68. data/lib/locomotive/version.rb +1 -1
  69. metadata +37 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 672ca536536dc4908f0b030a252694762d02434416aec61a8e6d0e1986b5b832
4
- data.tar.gz: 1efea0ba4eb61120459bb3f46c2ac7d31b8b8c0ef987331981f93ab19de79d28
3
+ metadata.gz: f262308ca535c2fab8094e923bcfa830cccd8d47412c017354d3d41698545af0
4
+ data.tar.gz: 2dfc9cee2bb9d8543abb64ad496a5659baa8cbe7d47f22f7b74dabb7a0e79cdc
5
5
  SHA512:
6
- metadata.gz: b5a7cae22c14e129b85db97c40d2f767c2f09cac7c23f74d0bbd9d5691ef083bd18f7d307d6ed006b343c14cd58f7f3ffbdc732eda3f714c6bdabf8a4d4f96e0
7
- data.tar.gz: ebb9837c7b16a9d26527f7019112297507b9105124d409cf31757f8bb075c1060ef97cc3e3855988376c56a2193b0b321db1b6a072da1f10b1f06c8c665256a5
6
+ metadata.gz: 42b05ebe723bd5b2e84ab6a8b405677e7dec0e17f33702eafae56d4882dc9ad7691be902a17d273193e8199cf8311579f178c5a8791e0fcf2bb5fd95e2f0f068
7
+ data.tar.gz: 9aea9657f2b6a396e6fc749273c223b480d775add9827ff418760cbcebb037af3adfa7bdc117dca1d9eca78c6252216acde6da435c1e2d9f4982ae18a649666a
data/Rakefile CHANGED
@@ -24,6 +24,9 @@ begin
24
24
  rescue LoadError
25
25
  end
26
26
 
27
+ require 'webdrivers'
28
+ load 'webdrivers/Rakefile'
29
+
27
30
  # === Travis ===
28
31
  task :travis do
29
32
  puts "Install Yarn packages"
@@ -9,7 +9,7 @@ module Locomotive
9
9
  :public_submission_accounts,
10
10
  :public_submission_title_template,
11
11
  :recaptcha_required,
12
- :entry_template, :display_settings, :filter_fields
12
+ :entry_template, :display_settings, :filter_fields, :import_enabled
13
13
 
14
14
  expose :fields, using: ContentTypeFieldEntity do |content_type, _|
15
15
  content_type.ordered_entries_custom_fields || []
@@ -8,6 +8,7 @@ module Locomotive
8
8
  :robots_txt, :cache_enabled, :private_access
9
9
 
10
10
  expose :locales, :prefix_default_locale, :bypass_browser_locale, :domains, :asset_host, :url_redirections
11
+ expose :overwrite_same_content_assets, :allow_dots_in_slugs
11
12
 
12
13
  expose :memberships, using: MembershipEntity
13
14
 
@@ -17,7 +17,8 @@ module Locomotive
17
17
  :entry_template,
18
18
  :entries_custom_fields_attributes,
19
19
  :display_settings,
20
- :filter_fields
20
+ :filter_fields,
21
+ :import_enabled
21
22
 
22
23
  # @param [ Site ] the current site, or site to scope to
23
24
  def initialize(site, attributes = {})
@@ -10,6 +10,8 @@ module Locomotive
10
10
  attrs :seo_title, :meta_keywords, :meta_description, localized: true
11
11
  attrs :cache_enabled, :cache_control, :cache_vary
12
12
  attrs :sections_content
13
+ attrs :overwrite_same_content_assets
14
+ attrs :allow_dots_in_slugs
13
15
 
14
16
  # Make sure locales and domains are in arrays.
15
17
  def locales
@@ -118,7 +118,7 @@ module Locomotive
118
118
  def setup_singular_getter_method
119
119
  self.class.send(:define_method, singular) do
120
120
  instance_variable = "@#{singular}"
121
- if instance_variable_defined?(instance_variable)
121
+ if instance_variable_defined?(instance_variable)
122
122
  instance_variable_get(instance_variable)
123
123
  else
124
124
  if params[:id]
@@ -40,7 +40,13 @@ module Locomotive
40
40
  end
41
41
  post do
42
42
  authorize ContentAsset, :create?
43
+
43
44
  form = form_klass.new(content_asset_params)
45
+
46
+ if current_site.overwrite_same_content_assets?
47
+ self.content_asset = content_assets.by_exact_filename(form.source['filename']).first || content_assets.new
48
+ end
49
+
44
50
  persist_from_form(form)
45
51
 
46
52
  present content_asset, with: entity_klass
@@ -70,6 +70,7 @@ module Locomotive
70
70
  optional :public_submission_account_emails
71
71
  optional :public_submission_title_template
72
72
  optional :public_submission_email_attachments
73
+ optional :import_enabled
73
74
  end
74
75
  end
75
76
  post do
@@ -121,6 +122,7 @@ module Locomotive
121
122
  optional :public_submission_title_template
122
123
  optional :public_submission_email_attachments
123
124
  optional :recaptcha_required
125
+ optional :import_enabled
124
126
  end
125
127
  end
126
128
  put ':id' do
@@ -47,6 +47,8 @@ module Locomotive
47
47
  optional :asset_host
48
48
  optional :sections_content
49
49
  optional :routes
50
+ optional :overwrite_same_content_assets
51
+ optional :allow_dots_in_slugs
50
52
  end
51
53
  end
52
54
  put do
@@ -58,7 +60,6 @@ module Locomotive
58
60
  present current_site, with: entity_klass
59
61
  end
60
62
 
61
-
62
63
  desc "Delete current site"
63
64
  delete do
64
65
  authorize current_site, :destroy?
@@ -76,6 +76,8 @@ module Locomotive
76
76
  optional :asset_host
77
77
  optional :sections_content
78
78
  optional :routes
79
+ optional :overwrite_same_content_assets
80
+ optional :allow_dots_in_slugs
79
81
  end
80
82
  end
81
83
  post do
@@ -113,11 +115,13 @@ module Locomotive
113
115
  optional :asset_host
114
116
  optional :sections_content
115
117
  optional :routes
118
+ optional :overwrite_same_content_assets
119
+ optional :allow_dots_in_slugs
116
120
  end
117
121
  end
118
122
  put ':id' do
119
123
  site = load_site
120
- authorize site, :update?
124
+ authorize site, :update?
121
125
 
122
126
  site_form = Forms::SiteForm.new(permitted_params_from_policy(site, :site, [:picture], [:metafields_ui, :metafields_schema, :metafields, :routes, :sections_content]))
123
127
  service.update!(site, site_form.serializable_hash)