locomotivecms 4.0.0 → 4.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +1 -1
  4. data/Rakefile +3 -0
  5. data/app/api/locomotive/api/entities/content_type_entity.rb +1 -1
  6. data/app/api/locomotive/api/entities/site_entity.rb +1 -1
  7. data/app/api/locomotive/api/forms/content_type_form.rb +2 -1
  8. data/app/api/locomotive/api/forms/site_form.rb +1 -0
  9. data/app/api/locomotive/api/helpers/persistence_helper.rb +1 -1
  10. data/app/api/locomotive/api/resources/content_asset_resource.rb +6 -0
  11. data/app/api/locomotive/api/resources/content_type_resource.rb +2 -0
  12. data/app/api/locomotive/api/resources/current_site_resource.rb +1 -1
  13. data/app/api/locomotive/api/resources/site_resource.rb +3 -1
  14. data/app/assets/javascripts/locomotive/editor.js +2541 -1196
  15. data/app/assets/javascripts/locomotive/views/content_entry_imports/new_view.js.coffee +12 -0
  16. data/app/assets/javascripts/locomotive/views/content_entry_imports/show_view.js.coffee +8 -0
  17. data/app/assets/stylesheets/locomotive/application.scss +2 -0
  18. data/app/assets/stylesheets/locomotive/editor.css +105 -12
  19. data/app/assets/stylesheets/locomotive/new/_dashboard.scss +20 -0
  20. data/app/assets/stylesheets/locomotive/old/_content_assets.scss +1 -1
  21. data/app/controllers/locomotive/content_assets_controller.rb +2 -1
  22. data/app/controllers/locomotive/content_entry_imports_controller.rb +50 -0
  23. data/app/controllers/locomotive/custom_fields/select_options_controller.rb +1 -0
  24. data/app/helpers/locomotive/base_helper.rb +1 -1
  25. data/app/helpers/locomotive/content_entries_helper.rb +9 -3
  26. data/app/helpers/locomotive/shared/pages_helper.rb +1 -1
  27. data/app/jobs/locomotive/import_content_entry_job.rb +12 -0
  28. data/app/jobs/locomotive/send_pony_email_job.rb +4 -3
  29. data/app/mailers/locomotive/notifications.rb +37 -11
  30. data/app/models/locomotive/account.rb +1 -0
  31. data/app/models/locomotive/concerns/asset/vignette.rb +7 -5
  32. data/app/models/locomotive/concerns/content_type/group_by.rb +6 -1
  33. data/app/models/locomotive/concerns/content_type/import.rb +124 -0
  34. data/app/models/locomotive/concerns/site/metafields.rb +26 -0
  35. data/app/models/locomotive/content_asset.rb +9 -2
  36. data/app/models/locomotive/content_type.rb +1 -0
  37. data/app/models/locomotive/section.rb +3 -1
  38. data/app/models/locomotive/site.rb +2 -0
  39. data/app/policies/locomotive/content_entry_policy.rb +1 -2
  40. data/app/policies/locomotive/content_type_policy.rb +3 -0
  41. data/app/policies/locomotive/site_policy.rb +5 -3
  42. data/app/services/locomotive/content_asset_service.rb +27 -4
  43. data/app/services/locomotive/content_entry_import_service.rb +107 -0
  44. data/app/services/locomotive/content_entry_service.rb +1 -1
  45. data/app/uploaders/locomotive/picture_uploader.rb +1 -1
  46. data/app/uploaders/locomotive/theme_asset_uploader.rb +1 -1
  47. data/app/views/locomotive/content_assets/_dropzone.html.slim +5 -1
  48. data/app/views/locomotive/content_entries/index.html.slim +8 -0
  49. data/app/views/locomotive/content_entry_imports/new.html.slim +23 -0
  50. data/app/views/locomotive/content_entry_imports/show.html.slim +54 -0
  51. data/app/views/locomotive/current_site/form/_advanced.html.slim +2 -0
  52. data/app/views/locomotive/page_content/edit.html.erb +1 -0
  53. data/app/views/locomotive/shared/account/_navigation.html.slim +1 -1
  54. data/config/locales/editor.en.yml +22 -0
  55. data/config/locales/editor.fr.yml +22 -0
  56. data/config/locales/en.yml +21 -0
  57. data/config/locales/es.yml +2 -0
  58. data/config/locales/flash.en.yml +6 -0
  59. data/config/locales/fr.yml +2 -0
  60. data/config/locales/mongoid.en.yml +5 -1
  61. data/config/locales/mongoid.es.yml +4 -0
  62. data/config/locales/simple_form.en.yml +13 -1
  63. data/config/locales/simple_form.es.yml +2 -0
  64. data/config/routes.rb +3 -2
  65. data/lib/generators/locomotive/install/install_generator.rb +1 -0
  66. data/lib/generators/locomotive/install/templates/carrierwave_aws.rb +5 -0
  67. data/lib/locomotive/configuration.rb +1 -0
  68. data/lib/locomotive/dragonfly.rb +6 -4
  69. data/lib/locomotive/steam/services/liquid_parser_with_cache_service.rb +1 -1
  70. data/lib/locomotive/version.rb +1 -1
  71. metadata +50 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42e44478ad65f5c3ed412bfa33169edd54c95ee256b88224485a934bd41c702f
4
- data.tar.gz: 6a8285d529f10e0ee1298213306d81bd2fc7a03f5726948eb771953704fb60e9
3
+ metadata.gz: 9ac2bdf950937bd4a07418b142bb21eea251c24db4b5682b8412a9c718374343
4
+ data.tar.gz: 1546625baf49879c2c70209e5f3df46f0290b689f28c141135e8d52019c3b065
5
5
  SHA512:
6
- metadata.gz: 948187a1114e707c6450d0510cee335d490ae39e6ab84bec0de55b6432b9576dfe2f1194f6799d9e434ee36f8bccbef564f26e33f72093b2534e5a8b14bd3a21
7
- data.tar.gz: 17f992ee3fff40aa94739eba999fd7900cf17c1c4c4a10bebc9879e8e59fa365ddb87dac62803e88d852f12341581aeded7886312f23288242fa285b4d44da5f
6
+ metadata.gz: d2e672fcec21c3eecba19c80fc7d1bc35f56488d57bc59f43cd2cde49946e71f900b826bef17c5255037b598f1ce4bdc912623d9b09fc477c95112e1d8ac2380
7
+ data.tar.gz: 9226f4e89892f1e2d66b6f6b74d71981462f53e4969de3a5b09042316e2de20ac578dc9286165055b87066978b37b6a1883bb6da62f5de26173e603d6f3ba3b6
data/MIT-LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  == MIT License
2
2
 
3
- Copyright (c) 2010-2019, NoCoffee.
3
+ Copyright (c) 2010-2020, NoCoffee.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -71,4 +71,4 @@ Locomotive is an open source project, we encourage contributions. If you have fo
71
71
 
72
72
  Feel free to contact me at didier at nocoffee dot fr.
73
73
 
74
- Copyright (c) 2019 NoCoffee, released under the MIT license
74
+ Copyright (c) 2020 NoCoffee, released under the MIT license
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)