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.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +1 -1
- data/Rakefile +0 -6
- data/app/api/locomotive/api/entities/site_entity.rb +1 -1
- data/app/api/locomotive/api/forms/content_type_form.rb +1 -0
- data/app/api/locomotive/api/forms/page_form.rb +2 -1
- data/app/api/locomotive/api/forms/site_form.rb +7 -1
- data/app/api/locomotive/api/helpers/persistence_helper.rb +3 -0
- data/app/api/locomotive/api/resources/account_resource.rb +15 -3
- data/app/api/locomotive/api/resources/content_type_resource.rb +3 -0
- data/app/api/locomotive/api/resources/membership_resource.rb +1 -1
- data/app/api/locomotive/api/resources/site_resource.rb +6 -0
- data/app/assets/javascripts/locomotive/editor.js +1311 -703
- data/app/assets/javascripts/locomotive/views/content_entries/edit_view.js.coffee +5 -0
- data/app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee +1 -0
- data/app/assets/javascripts/locomotive/views/content_entries/new_view.js.coffee +4 -0
- data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +6 -0
- data/app/assets/javascripts/locomotive/views/page_content/edit_view.js.coffee +1 -0
- data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +6 -0
- data/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee +4 -0
- data/app/assets/javascripts/locomotive/views/pages/list_view.js.coffee +5 -0
- data/app/assets/javascripts/locomotive/views/pages/new_view.js.coffee +4 -0
- data/app/assets/stylesheets/locomotive/editor.css +390 -127
- data/app/assets/stylesheets/locomotive/new/_sidebar.scss +4 -0
- data/app/assets/stylesheets/locomotive/old/_list.scss +35 -0
- data/app/assets/stylesheets/locomotive/old/_main.scss +6 -6
- data/app/controllers/locomotive/concerns/authorization_controller.rb +4 -2
- data/app/controllers/locomotive/content_entries_controller.rb +6 -0
- data/app/controllers/locomotive/content_entry_impersonations_controller.rb +11 -0
- data/app/controllers/locomotive/current_site_controller.rb +0 -1
- data/app/controllers/locomotive/dashboard_controller.rb +2 -0
- data/app/helpers/locomotive/dashboard_helper.rb +0 -101
- data/app/helpers/locomotive/shared/activities_helper.rb +106 -0
- data/app/helpers/locomotive/shared/site_metafields_helper.rb +1 -1
- data/app/mailers/locomotive/notifications.rb +8 -0
- data/app/models/locomotive/account.rb +1 -0
- data/app/models/locomotive/concerns/site/cache.rb +2 -0
- data/app/models/locomotive/concerns/site/locales.rb +1 -0
- data/app/models/locomotive/content_type.rb +8 -7
- data/app/models/locomotive/membership.rb +1 -1
- data/app/models/locomotive/page.rb +2 -0
- data/app/models/locomotive/section.rb +1 -1
- data/app/policies/locomotive/account_policy.rb +1 -1
- data/app/policies/locomotive/content_asset_policy.rb +11 -3
- data/app/policies/locomotive/content_entry_policy.rb +11 -3
- data/app/policies/locomotive/page_policy.rb +16 -5
- data/app/policies/locomotive/site_policy.rb +18 -4
- data/app/policies/locomotive/translation_policy.rb +12 -4
- data/app/views/locomotive/content_entries/form/_actions.html.slim +12 -1
- data/app/views/locomotive/content_entries/form/_advanced.html.slim +1 -1
- data/app/views/locomotive/content_entries/index.html.slim +25 -17
- data/app/views/locomotive/current_site/form/_advanced.html.slim +6 -1
- data/app/views/locomotive/current_site/form/_url_redirections.html.slim +9 -3
- data/app/views/locomotive/layouts/account.html.slim +1 -33
- data/app/views/locomotive/pages/form/_main.html.slim +5 -2
- data/app/views/locomotive/shared/_head.html.slim +1 -1
- data/app/views/locomotive/shared/account/_head.html.slim +33 -0
- data/app/views/locomotive/shared/account/_navigation.html.slim +2 -1
- data/app/views/locomotive/sites/index.html.slim +4 -3
- data/config/locales/en.yml +7 -5
- data/config/locales/fr.yml +2 -0
- data/config/locales/simple_form.en.yml +3 -0
- data/config/webpack/production.js +1 -1
- data/lib/generators/locomotive/install/install_generator.rb +15 -2
- data/lib/generators/locomotive/install/templates/README +1 -1
- data/lib/generators/locomotive/install/templates/mongoid_heroku.yml +1 -1
- data/lib/locomotive/steam/middlewares/missing_translations.rb +3 -0
- data/lib/locomotive/steam/middlewares/page_editing.rb +7 -0
- data/lib/locomotive/steam/services/liquid_parser_with_cache_service.rb +22 -15
- data/lib/locomotive/steam_adaptor.rb +1 -1
- data/lib/locomotive/version.rb +1 -1
- data/lib/tasks/development_tasks.rake +7 -3
- data/lib/tasks/locomotive_tasks.rake +10 -0
- metadata +43 -16
- data/config/initializers/rails_fixes.rb +0 -16
- 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
|