locomotivecms 4.0.3 → 4.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) 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 -1
  5. data/app/api/locomotive/api/forms/content_type_form.rb +2 -1
  6. data/app/api/locomotive/api/forms/site_form.rb +1 -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 +1 -1
  11. data/app/api/locomotive/api/resources/site_resource.rb +3 -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_type/import.rb +124 -0
  28. data/app/models/locomotive/concerns/site/metafields.rb +26 -0
  29. data/app/models/locomotive/content_asset.rb +9 -2
  30. data/app/models/locomotive/content_type.rb +1 -0
  31. data/app/models/locomotive/section.rb +3 -1
  32. data/app/models/locomotive/site.rb +2 -0
  33. data/app/policies/locomotive/content_entry_policy.rb +1 -2
  34. data/app/policies/locomotive/content_type_policy.rb +3 -0
  35. data/app/policies/locomotive/site_policy.rb +5 -3
  36. data/app/services/locomotive/content_asset_service.rb +27 -4
  37. data/app/services/locomotive/content_entry_import_service.rb +107 -0
  38. data/app/services/locomotive/content_entry_service.rb +1 -1
  39. data/app/uploaders/locomotive/picture_uploader.rb +1 -1
  40. data/app/uploaders/locomotive/theme_asset_uploader.rb +1 -1
  41. data/app/views/locomotive/content_assets/_dropzone.html.slim +5 -1
  42. data/app/views/locomotive/content_entries/index.html.slim +8 -0
  43. data/app/views/locomotive/content_entry_imports/new.html.slim +23 -0
  44. data/app/views/locomotive/content_entry_imports/show.html.slim +54 -0
  45. data/app/views/locomotive/current_site/form/_advanced.html.slim +2 -0
  46. data/app/views/locomotive/page_content/edit.html.erb +1 -0
  47. data/config/locales/editor.en.yml +22 -0
  48. data/config/locales/editor.fr.yml +22 -0
  49. data/config/locales/en.yml +19 -0
  50. data/config/locales/es.yml +2 -0
  51. data/config/locales/flash.en.yml +6 -0
  52. data/config/locales/mongoid.en.yml +5 -1
  53. data/config/locales/mongoid.es.yml +4 -0
  54. data/config/locales/simple_form.en.yml +13 -1
  55. data/config/locales/simple_form.es.yml +2 -0
  56. data/config/routes.rb +3 -2
  57. data/lib/locomotive/configuration.rb +1 -0
  58. data/lib/locomotive/dragonfly.rb +6 -4
  59. data/lib/locomotive/version.rb +1 -1
  60. metadata +38 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 672ca536536dc4908f0b030a252694762d02434416aec61a8e6d0e1986b5b832
4
- data.tar.gz: 1efea0ba4eb61120459bb3f46c2ac7d31b8b8c0ef987331981f93ab19de79d28
3
+ metadata.gz: 9ac2bdf950937bd4a07418b142bb21eea251c24db4b5682b8412a9c718374343
4
+ data.tar.gz: 1546625baf49879c2c70209e5f3df46f0290b689f28c141135e8d52019c3b065
5
5
  SHA512:
6
- metadata.gz: b5a7cae22c14e129b85db97c40d2f767c2f09cac7c23f74d0bbd9d5691ef083bd18f7d307d6ed006b343c14cd58f7f3ffbdc732eda3f714c6bdabf8a4d4f96e0
7
- data.tar.gz: ebb9837c7b16a9d26527f7019112297507b9105124d409cf31757f8bb075c1060ef97cc3e3855988376c56a2193b0b321db1b6a072da1f10b1f06c8c665256a5
6
+ metadata.gz: d2e672fcec21c3eecba19c80fc7d1bc35f56488d57bc59f43cd2cde49946e71f900b826bef17c5255037b598f1ce4bdc912623d9b09fc477c95112e1d8ac2380
7
+ data.tar.gz: 9226f4e89892f1e2d66b6f6b74d71981462f53e4969de3a5b09042316e2de20ac578dc9286165055b87066978b37b6a1883bb6da62f5de26173e603d6f3ba3b6
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 || []
@@ -7,7 +7,7 @@ module Locomotive
7
7
  expose :name, :handle, :seo_title, :meta_keywords, :meta_description,
8
8
  :robots_txt, :cache_enabled, :private_access
9
9
 
10
- expose :locales, :prefix_default_locale, :bypass_browser_locale, :domains, :asset_host, :url_redirections
10
+ expose :locales, :prefix_default_locale, :bypass_browser_locale, :domains, :asset_host, :url_redirections, :overwrite_same_content_assets
11
11
 
12
12
  expose :memberships, using: MembershipEntity
13
13
 
@@ -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,7 @@ 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
13
14
 
14
15
  # Make sure locales and domains are in arrays.
15
16
  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,7 @@ module Locomotive
47
47
  optional :asset_host
48
48
  optional :sections_content
49
49
  optional :routes
50
+ optional :overwrite_same_content_assets
50
51
  end
51
52
  end
52
53
  put do
@@ -58,7 +59,6 @@ module Locomotive
58
59
  present current_site, with: entity_klass
59
60
  end
60
61
 
61
-
62
62
  desc "Delete current site"
63
63
  delete do
64
64
  authorize current_site, :destroy?
@@ -76,6 +76,7 @@ module Locomotive
76
76
  optional :asset_host
77
77
  optional :sections_content
78
78
  optional :routes
79
+ optional :overwrite_same_content_assets
79
80
  end
80
81
  end
81
82
  post do
@@ -113,11 +114,12 @@ module Locomotive
113
114
  optional :asset_host
114
115
  optional :sections_content
115
116
  optional :routes
117
+ optional :overwrite_same_content_assets
116
118
  end
117
119
  end
118
120
  put ':id' do
119
121
  site = load_site
120
- authorize site, :update?
122
+ authorize site, :update?
121
123
 
122
124
  site_form = Forms::SiteForm.new(permitted_params_from_policy(site, :site, [:picture], [:metafields_ui, :metafields_schema, :metafields, :routes, :sections_content]))
123
125
  service.update!(site, site_form.serializable_hash)