locomotivecms 4.0.0.rc0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +1 -1
  4. data/Rakefile +0 -6
  5. data/app/api/locomotive/api/entities/site_entity.rb +1 -1
  6. data/app/api/locomotive/api/forms/content_type_form.rb +1 -0
  7. data/app/api/locomotive/api/forms/page_form.rb +2 -1
  8. data/app/api/locomotive/api/forms/site_form.rb +7 -1
  9. data/app/api/locomotive/api/helpers/persistence_helper.rb +3 -0
  10. data/app/api/locomotive/api/resources/account_resource.rb +15 -3
  11. data/app/api/locomotive/api/resources/content_type_resource.rb +3 -0
  12. data/app/api/locomotive/api/resources/membership_resource.rb +1 -1
  13. data/app/api/locomotive/api/resources/site_resource.rb +6 -0
  14. data/app/assets/javascripts/locomotive/editor.js +1311 -703
  15. data/app/assets/javascripts/locomotive/views/content_entries/edit_view.js.coffee +5 -0
  16. data/app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee +1 -0
  17. data/app/assets/javascripts/locomotive/views/content_entries/new_view.js.coffee +4 -0
  18. data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +6 -0
  19. data/app/assets/javascripts/locomotive/views/page_content/edit_view.js.coffee +1 -0
  20. data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +6 -0
  21. data/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee +4 -0
  22. data/app/assets/javascripts/locomotive/views/pages/list_view.js.coffee +5 -0
  23. data/app/assets/javascripts/locomotive/views/pages/new_view.js.coffee +4 -0
  24. data/app/assets/stylesheets/locomotive/editor.css +390 -127
  25. data/app/assets/stylesheets/locomotive/new/_sidebar.scss +4 -0
  26. data/app/assets/stylesheets/locomotive/old/_list.scss +35 -0
  27. data/app/assets/stylesheets/locomotive/old/_main.scss +6 -6
  28. data/app/controllers/locomotive/concerns/authorization_controller.rb +4 -2
  29. data/app/controllers/locomotive/content_entries_controller.rb +6 -0
  30. data/app/controllers/locomotive/content_entry_impersonations_controller.rb +11 -0
  31. data/app/controllers/locomotive/current_site_controller.rb +0 -1
  32. data/app/controllers/locomotive/dashboard_controller.rb +2 -0
  33. data/app/helpers/locomotive/dashboard_helper.rb +0 -101
  34. data/app/helpers/locomotive/shared/activities_helper.rb +106 -0
  35. data/app/helpers/locomotive/shared/site_metafields_helper.rb +1 -1
  36. data/app/mailers/locomotive/notifications.rb +8 -0
  37. data/app/models/locomotive/account.rb +1 -0
  38. data/app/models/locomotive/concerns/site/cache.rb +2 -0
  39. data/app/models/locomotive/concerns/site/locales.rb +1 -0
  40. data/app/models/locomotive/content_type.rb +8 -7
  41. data/app/models/locomotive/membership.rb +1 -1
  42. data/app/models/locomotive/page.rb +2 -0
  43. data/app/models/locomotive/section.rb +1 -1
  44. data/app/policies/locomotive/account_policy.rb +1 -1
  45. data/app/policies/locomotive/content_asset_policy.rb +11 -3
  46. data/app/policies/locomotive/content_entry_policy.rb +11 -3
  47. data/app/policies/locomotive/page_policy.rb +16 -5
  48. data/app/policies/locomotive/site_policy.rb +18 -4
  49. data/app/policies/locomotive/translation_policy.rb +12 -4
  50. data/app/views/locomotive/content_entries/form/_actions.html.slim +12 -1
  51. data/app/views/locomotive/content_entries/form/_advanced.html.slim +1 -1
  52. data/app/views/locomotive/content_entries/index.html.slim +25 -17
  53. data/app/views/locomotive/current_site/form/_advanced.html.slim +6 -1
  54. data/app/views/locomotive/current_site/form/_url_redirections.html.slim +9 -3
  55. data/app/views/locomotive/layouts/account.html.slim +1 -33
  56. data/app/views/locomotive/pages/form/_main.html.slim +5 -2
  57. data/app/views/locomotive/shared/_head.html.slim +1 -1
  58. data/app/views/locomotive/shared/account/_head.html.slim +33 -0
  59. data/app/views/locomotive/shared/account/_navigation.html.slim +2 -1
  60. data/app/views/locomotive/sites/index.html.slim +4 -3
  61. data/config/locales/en.yml +7 -5
  62. data/config/locales/fr.yml +2 -0
  63. data/config/locales/simple_form.en.yml +3 -0
  64. data/config/webpack/production.js +1 -1
  65. data/lib/generators/locomotive/install/install_generator.rb +15 -2
  66. data/lib/generators/locomotive/install/templates/README +1 -1
  67. data/lib/generators/locomotive/install/templates/mongoid_heroku.yml +1 -1
  68. data/lib/locomotive/steam/middlewares/missing_translations.rb +3 -0
  69. data/lib/locomotive/steam/middlewares/page_editing.rb +7 -0
  70. data/lib/locomotive/steam/services/liquid_parser_with_cache_service.rb +22 -15
  71. data/lib/locomotive/steam_adaptor.rb +1 -1
  72. data/lib/locomotive/version.rb +1 -1
  73. data/lib/tasks/development_tasks.rake +7 -3
  74. data/lib/tasks/locomotive_tasks.rake +10 -0
  75. metadata +43 -16
  76. data/config/initializers/rails_fixes.rb +0 -16
  77. data/lib/locomotive/steam/middlewares/cache.rb +0 -69
@@ -1,16 +0,0 @@
1
- # Remove annoying "** ERROR: directory is already being watched! **" errors in development
2
- # https://github.com/guard/listen/wiki/Duplicate-directory-errors
3
- # https://github.com/rails/rails/issues/32700
4
-
5
- if Rails.env.development?
6
- require 'listen/record/symlink_detector'
7
- module Listen
8
- class Record
9
- class SymlinkDetector
10
- def _fail(_, _)
11
- fail Error, "Don't watch locally-symlinked directory twice"
12
- end
13
- end
14
- end
15
- end
16
- end
@@ -1,69 +0,0 @@
1
- module Locomotive
2
- module Steam
3
- module Middlewares
4
-
5
- class Cache
6
-
7
- attr_reader :app
8
-
9
- CACHEABLE_REQUEST_METHODS = %w(GET HEAD).freeze
10
-
11
- def initialize(app)
12
- @app = app
13
- end
14
-
15
- def call(env)
16
- if cacheable?(env)
17
- fetch_cached_response(env)
18
- else
19
- app.call(env)
20
- end
21
- end
22
-
23
- private
24
-
25
- def fetch_cached_response(env)
26
- key = cache_key(env)
27
-
28
- if marshaled = Rails.cache.read(key)
29
- Marshal.load(marshaled)
30
- else
31
- app.call(env).tap do |response|
32
- Rails.cache.write(key, marshal(response))
33
- end
34
- end
35
- end
36
-
37
- def marshal(response)
38
- code, headers, body = response
39
-
40
- # only keep string value headers
41
- _headers = headers.reject { |key, val| !val.respond_to?(:to_str) }
42
-
43
- Marshal.dump([code, _headers, body])
44
- end
45
-
46
- def cacheable?(env)
47
- CACHEABLE_REQUEST_METHODS.include?(env['REQUEST_METHOD']) &&
48
- !env['steam.live_editing'] &&
49
- env['steam.site'].try(:cache_enabled) &&
50
- env['steam.page'].try(:cache_enabled) &&
51
- is_redirect_url?(env['steam.page'])
52
- end
53
-
54
- def cache_key(env)
55
- site, path, query = env['steam.site'], env['PATH_INFO'], env['QUERY_STRING']
56
- key = "#{Locomotive::VERSION}/site/#{site._id}/#{site.last_modified_at.to_i}/page/#{path}/#{query}"
57
- Digest::MD5.hexdigest(key)
58
- end
59
-
60
- def is_redirect_url?(page)
61
- return false if page.nil?
62
- page.try(:redirect_url).blank?
63
- end
64
-
65
- end
66
-
67
- end
68
- end
69
- end