locomotivecms 3.0.0.pre.alpha.2 → 3.0.0.pre.alpha.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -2
  3. data/README.md +1 -1
  4. data/app/api/locomotive/api/forms/membership_form.rb +13 -0
  5. data/app/api/locomotive/api/resources/membership_resource.rb +5 -3
  6. data/app/assets/javascripts/locomotive.js +2 -0
  7. data/app/assets/javascripts/locomotive/utils/backbone_patches.js.coffee +15 -1
  8. data/app/assets/javascripts/locomotive/utils/file.js.coffee +20 -0
  9. data/app/assets/javascripts/locomotive/utils/nprogress.js.coffee +5 -0
  10. data/app/assets/javascripts/locomotive/utils/rails_ujs.js.coffee +36 -0
  11. data/app/assets/javascripts/locomotive/utils/wysihtml5.js.coffee +1 -1
  12. data/app/assets/javascripts/locomotive/views/content_assets/picker_view.js.coffee +9 -17
  13. data/app/assets/javascripts/locomotive/views/editable_elements/edit_view.js.coffee +39 -0
  14. data/app/assets/javascripts/locomotive/views/editable_elements/index_view.js.coffee +104 -1
  15. data/app/assets/javascripts/locomotive/views/inputs/file_view.js.coffee +79 -10
  16. data/app/assets/javascripts/locomotive/views/inputs/rte/file_view.js.coffee +24 -4
  17. data/app/assets/javascripts/locomotive/views/inputs/rte_view.js.coffee.erb +18 -0
  18. data/app/assets/javascripts/locomotive/views/pages/new_view.js.coffee +3 -6
  19. data/app/assets/javascripts/locomotive/views/shared/drawer_view.js.coffee +24 -8
  20. data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +21 -148
  21. data/app/assets/stylesheets/locomotive/application.scss +6 -0
  22. data/app/assets/stylesheets/locomotive/base/_form.scss +1 -0
  23. data/app/assets/stylesheets/locomotive/base/form/_base.scss +9 -0
  24. data/app/assets/stylesheets/locomotive/base/form/_file_input.scss +1 -1
  25. data/app/assets/stylesheets/locomotive/base/form/_link.scss +13 -0
  26. data/app/assets/stylesheets/locomotive/base/form/_select2.scss +28 -1
  27. data/app/assets/stylesheets/locomotive/components/_drawer.scss +8 -18
  28. data/app/assets/stylesheets/locomotive/components/_live_editing.scss +83 -0
  29. data/app/assets/stylesheets/locomotive/components/_transitions.scss +63 -1
  30. data/app/assets/stylesheets/locomotive/components/header/_base.scss +5 -1
  31. data/app/assets/stylesheets/locomotive/components/misc/_notify.scss +5 -7
  32. data/app/assets/stylesheets/locomotive/globals/_bootstrap.scss +4 -4
  33. data/app/assets/stylesheets/locomotive/globals/_mixins.scss +16 -0
  34. data/app/assets/stylesheets/locomotive/globals/_nprogress.scss +3 -0
  35. data/app/assets/stylesheets/locomotive/globals/_variables.scss +57 -49
  36. data/app/assets/stylesheets/locomotive/layouts/_live_editing.scss +29 -0
  37. data/app/controllers/locomotive/editable_elements_controller.rb +49 -2
  38. data/app/controllers/locomotive/pages_controller.rb +2 -2
  39. data/app/helpers/locomotive/custom_fields_helper.rb +1 -1
  40. data/app/helpers/locomotive/editable_elements_helper.rb +40 -0
  41. data/app/helpers/locomotive/pages_helper.rb +0 -1
  42. data/app/inputs/locomotive/array_input.rb +1 -1
  43. data/app/inputs/locomotive/file_input.rb +35 -7
  44. data/app/inputs/locomotive/rte_input.rb +2 -1
  45. data/app/inputs/locomotive/toggle_input.rb +1 -1
  46. data/app/models/locomotive/concerns/content_entry/localized.rb +4 -4
  47. data/app/models/locomotive/concerns/content_type/sync.rb +0 -5
  48. data/app/models/locomotive/concerns/page/redirect.rb +1 -1
  49. data/app/models/locomotive/content_entry.rb +5 -11
  50. data/app/models/locomotive/content_type.rb +22 -0
  51. data/app/models/locomotive/editable_control.rb +12 -27
  52. data/app/models/locomotive/editable_element.rb +8 -0
  53. data/app/models/locomotive/editable_file.rb +0 -1
  54. data/app/models/locomotive/editable_text.rb +10 -10
  55. data/app/models/locomotive/page.rb +1 -1
  56. data/app/policies/locomotive/page_policy.rb +1 -1
  57. data/app/services/locomotive/editable_element_service.rb +47 -0
  58. data/app/services/locomotive/page_parsing_service.rb +85 -31
  59. data/app/uploaders/locomotive/editable_file_uploader.rb +5 -1
  60. data/app/views/locomotive/editable_elements/_edit.html.haml +49 -0
  61. data/app/views/locomotive/editable_elements/_edit_with_content_entry.html.haml +21 -0
  62. data/app/views/locomotive/editable_elements/_form.html.haml +23 -0
  63. data/app/views/locomotive/editable_elements/index.html.haml +8 -2
  64. data/app/views/locomotive/editable_elements/index_without_preview.html.haml +33 -0
  65. data/app/views/locomotive/layouts/{preview.html.haml → live_editing.html.haml} +9 -9
  66. data/app/views/locomotive/my_account/form/_main.html.haml +1 -1
  67. data/app/views/locomotive/pages/form/_actions.html.haml +8 -1
  68. data/app/views/locomotive/pages/form/_main.html.haml +1 -1
  69. data/app/views/locomotive/pages/form/_tabs.html.haml +2 -2
  70. data/app/views/locomotive/pages/new.html.haml +1 -1
  71. data/app/views/locomotive/shared/header/_site.html.haml +1 -1
  72. data/app/views/locomotive/shared/rte/_image_popover.html.haml +2 -2
  73. data/app/views/locomotive/shared/rte/_link_popover.html.haml +1 -1
  74. data/app/views/locomotive/shared/sidebar/_page.html.haml +5 -2
  75. data/config/locales/admin_ui.en.yml +10 -16
  76. data/config/locales/inputs.en.yml +18 -11
  77. data/config/locales/simple_form.en.yml +13 -1
  78. data/config/routes.rb +3 -1
  79. data/lib/locomotive.rb +1 -1
  80. data/lib/locomotive/action_controller/responder.rb +16 -0
  81. data/lib/locomotive/carrierwave/patches.rb +54 -0
  82. data/lib/locomotive/dependencies.rb +1 -0
  83. data/lib/locomotive/engine.rb +9 -3
  84. data/lib/locomotive/middlewares.rb +1 -1
  85. data/lib/locomotive/middlewares/page_editing.rb +41 -0
  86. data/lib/locomotive/middlewares/site.rb +2 -0
  87. data/lib/locomotive/simple_form.rb +6 -5
  88. data/lib/locomotive/steam_adaptor.rb +2 -0
  89. data/lib/locomotive/version.rb +1 -1
  90. data/lib/tasks/development.rake +4 -0
  91. data/spec/dummy/config/environments/production.rb +2 -0
  92. data/spec/dummy/config/initializers/devise.rb +2 -0
  93. data/spec/dummy/config/mongoid.yml +2 -2
  94. data/spec/models/locomotive/content_entry_spec.rb +11 -2
  95. data/spec/support/factories.rb +0 -1
  96. data/vendor/assets/javascripts/locomotive/history.js +2122 -0
  97. data/vendor/assets/javascripts/locomotive/subscribe.js +206 -329
  98. metadata +44 -127
  99. data/lib/locomotive/middlewares/permalink.rb +0 -22
  100. data/lib/locomotive/previous_liquid/asset_host.rb +0 -51
  101. data/lib/locomotive/previous_liquid/drops/base.rb +0 -40
  102. data/lib/locomotive/previous_liquid/drops/content_entry.rb +0 -78
  103. data/lib/locomotive/previous_liquid/drops/content_types.rb +0 -119
  104. data/lib/locomotive/previous_liquid/drops/current_user.rb +0 -21
  105. data/lib/locomotive/previous_liquid/drops/page.rb +0 -115
  106. data/lib/locomotive/previous_liquid/drops/proxy_collection.rb +0 -64
  107. data/lib/locomotive/previous_liquid/drops/session_proxy.rb +0 -16
  108. data/lib/locomotive/previous_liquid/drops/site.rb +0 -29
  109. data/lib/locomotive/previous_liquid/drops/uploader.rb +0 -21
  110. data/lib/locomotive/previous_liquid/errors.rb +0 -8
  111. data/lib/locomotive/previous_liquid/filters/base.rb +0 -61
  112. data/lib/locomotive/previous_liquid/filters/date.rb +0 -82
  113. data/lib/locomotive/previous_liquid/filters/html.rb +0 -117
  114. data/lib/locomotive/previous_liquid/filters/misc.rb +0 -75
  115. data/lib/locomotive/previous_liquid/filters/resize.rb +0 -18
  116. data/lib/locomotive/previous_liquid/filters/text.rb +0 -53
  117. data/lib/locomotive/previous_liquid/filters/translate.rb +0 -38
  118. data/lib/locomotive/previous_liquid/patches.rb +0 -21
  119. data/lib/locomotive/previous_liquid/tags/consume.rb +0 -104
  120. data/lib/locomotive/previous_liquid/tags/csrf.rb +0 -40
  121. data/lib/locomotive/previous_liquid/tags/editable.rb +0 -4
  122. data/lib/locomotive/previous_liquid/tags/editable/base.rb +0 -88
  123. data/lib/locomotive/previous_liquid/tags/editable/control.rb +0 -41
  124. data/lib/locomotive/previous_liquid/tags/editable/file.rb +0 -43
  125. data/lib/locomotive/previous_liquid/tags/editable/text.rb +0 -79
  126. data/lib/locomotive/previous_liquid/tags/extends.rb +0 -47
  127. data/lib/locomotive/previous_liquid/tags/fetch_page.rb +0 -36
  128. data/lib/locomotive/previous_liquid/tags/google_analytics.rb +0 -39
  129. data/lib/locomotive/previous_liquid/tags/hybrid.rb +0 -25
  130. data/lib/locomotive/previous_liquid/tags/inherited_block.rb +0 -31
  131. data/lib/locomotive/previous_liquid/tags/inline_editor.rb +0 -40
  132. data/lib/locomotive/previous_liquid/tags/javascript.rb +0 -16
  133. data/lib/locomotive/previous_liquid/tags/link_to.rb +0 -43
  134. data/lib/locomotive/previous_liquid/tags/locale_switcher.rb +0 -83
  135. data/lib/locomotive/previous_liquid/tags/model_form.rb +0 -75
  136. data/lib/locomotive/previous_liquid/tags/nav.rb +0 -164
  137. data/lib/locomotive/previous_liquid/tags/paginate.rb +0 -114
  138. data/lib/locomotive/previous_liquid/tags/path_helper.rb +0 -85
  139. data/lib/locomotive/previous_liquid/tags/path_to.rb +0 -21
  140. data/lib/locomotive/previous_liquid/tags/seo.rb +0 -72
  141. data/lib/locomotive/previous_liquid/tags/session_assign.rb +0 -39
  142. data/lib/locomotive/previous_liquid/tags/snippet.rb +0 -75
  143. data/lib/locomotive/previous_liquid/tags/with_scope.rb +0 -65
  144. data/spec/fixtures/portfolio/Gemfile +0 -21
  145. data/spec/fixtures/portfolio/app/content_types/messages.yml +0 -57
  146. data/spec/fixtures/portfolio/app/content_types/projects.yml +0 -74
  147. data/spec/fixtures/portfolio/app/views/pages/404.liquid.haml +0 -10
  148. data/spec/fixtures/portfolio/app/views/pages/index.liquid.haml +0 -213
  149. data/spec/fixtures/portfolio/app/views/snippets/footer.liquid.haml +0 -2
  150. data/spec/fixtures/portfolio/config.ru +0 -3
  151. data/spec/fixtures/portfolio/config/deploy.yml +0 -18
  152. data/spec/fixtures/portfolio/config/site.yml +0 -33
  153. data/spec/fixtures/portfolio/config/translations.yml +0 -8
  154. data/spec/fixtures/portfolio/data/messages.yml +0 -1
  155. data/spec/fixtures/portfolio/data/projects.yml +0 -41
  156. data/spec/fixtures/portfolio/icon.png +0 -0
  157. data/spec/fixtures/portfolio/public/javascripts/bootstrap.min.js +0 -6
  158. data/spec/fixtures/portfolio/public/javascripts/cbpAnimatedHeader.js +0 -44
  159. data/spec/fixtures/portfolio/public/javascripts/cbpAnimatedHeader.min.js +0 -11
  160. data/spec/fixtures/portfolio/public/javascripts/classie.js +0 -80
  161. data/spec/fixtures/portfolio/public/javascripts/contact_me.js +0 -65
  162. data/spec/fixtures/portfolio/public/javascripts/freelancer.js +0 -37
  163. data/spec/fixtures/portfolio/public/javascripts/jqBootstrapValidation.js +0 -912
  164. data/spec/fixtures/portfolio/public/samples/portfolio/cabin.png +0 -0
  165. data/spec/fixtures/portfolio/public/samples/portfolio/cake.png +0 -0
  166. data/spec/fixtures/portfolio/public/samples/portfolio/circus.png +0 -0
  167. data/spec/fixtures/portfolio/public/samples/portfolio/game.png +0 -0
  168. data/spec/fixtures/portfolio/public/samples/portfolio/safe.png +0 -0
  169. data/spec/fixtures/portfolio/public/samples/portfolio/submarine.png +0 -0
  170. data/spec/fixtures/portfolio/public/samples/profile.png +0 -0
  171. data/spec/fixtures/portfolio/public/stylesheets/bootstrap.min.css +0 -7
  172. data/spec/fixtures/portfolio/public/stylesheets/freelancer.css +0 -445
  173. data/spec/lib/locomotive/liquid/tags/editable/file_spec.rb +0 -72
  174. data/spec/lib/locomotive/liquid/tags/editable/text_spec.rb +0 -85
  175. data/spec/lib/locomotive/liquid/tags/extends_spec.rb +0 -58
  176. data/vendor/assets/javascripts/locomotive/editable_field.js +0 -50
  177. data/vendor/assets/javascripts/locomotive/form_submit_notification.js +0 -39
  178. data/vendor/assets/javascripts/locomotive/slugify.js +0 -47
@@ -1,78 +0,0 @@
1
- module Locomotive
2
- module Liquid
3
- module Drops
4
- class ContentEntry < Base
5
-
6
- delegate :_slug, :_permalink, :_translated, :seo_title, :meta_keywords, :meta_description, to: :@_source
7
-
8
- def _id
9
- @_source._id.to_s
10
- end
11
-
12
- def _label
13
- @_label ||= @_source._label
14
- end
15
-
16
- # Returns the next content for the parent content type.
17
- # If no content is found, nil is returned.
18
- #
19
- # Usage:
20
- #
21
- # {% if article.next %}
22
- # <a href="/articles/{{ article.next._permalink }}">Read next article</a>
23
- # {% endif %}
24
- #
25
- def next
26
- @next ||= @_source.next.to_liquid
27
- end
28
-
29
- # Returns the previous content for the parent content type.
30
- # If no content is found, nil is returned.
31
- #
32
- # Usage:
33
- #
34
- # {% if article.previous %}
35
- # <a href="/articles/{{ article.previous._permalink }}">Read previous article</a>
36
- # {% endif %}
37
- #
38
- def previous
39
- @previous ||= @_source.previous.to_liquid
40
- end
41
-
42
- def errors
43
- @_source.errors.messages.to_hash.stringify_keys
44
- end
45
-
46
- def before_method(meth)
47
- return '' if @_source.nil?
48
-
49
- if not @@forbidden_attributes.include?(meth.to_s)
50
- value = @_source.send(meth)
51
-
52
- if value.respond_to?(:all) # check for an association
53
- filter_and_order_list(value)
54
- else
55
- value
56
- end
57
- else
58
- nil
59
- end
60
- end
61
-
62
- protected
63
-
64
- def filter_and_order_list(list)
65
- conditions, order_by = HashWithIndifferentAccess.new(_visible: true), nil
66
-
67
- if @context['with_scope']
68
- conditions.merge!(@context['with_scope'])
69
- order_by = conditions.delete(:order_by).try(:split)
70
- end
71
-
72
- list.filtered(conditions, order_by)
73
- end
74
-
75
- end
76
- end
77
- end
78
- end
@@ -1,119 +0,0 @@
1
- module Locomotive
2
- module Liquid
3
- module Drops
4
- class ContentTypes < ::Liquid::Drop
5
-
6
- def before_method(meth)
7
- type = @context.registers[:site].content_types.where(slug: meth.to_s).first
8
- ContentTypeProxyCollection.new(type)
9
- end
10
-
11
- end
12
-
13
- class ContentTypeProxyCollection < ProxyCollection
14
-
15
- def initialize(content_type)
16
- @content_type = content_type
17
- @collection = nil
18
- end
19
-
20
- def public_submission_url
21
- site = @context.registers[:controller].send(:current_site)
22
- @context.registers[:controller].locomotive_entry_submissions_path(site, @content_type.slug)
23
- end
24
-
25
- def api
26
- Locomotive.log :warn, "[Liquid template] the api for content_types has been deprecated and replaced by public_submission_url instead."
27
- { 'create' => public_submission_url }
28
- end
29
-
30
- def before_method(meth)
31
- klass = @content_type.entries.klass # delegate to the proxy class
32
-
33
- if (meth.to_s =~ /^group_by_(.+)$/) == 0
34
- klass.send(:group_by_select_option, $1, @content_type.order_by_definition)
35
- elsif (meth.to_s =~ /^(.+)_options$/) == 0
36
- klass.send(:"#{$1}_options").map { |option| option['name'] }
37
- else
38
- Locomotive.log :warn, "[Liquid template] trying to call #{meth} on a content_type object"
39
- end
40
- end
41
-
42
- protected
43
-
44
- def collection
45
- options = {}
46
-
47
- if @context['with_scope']
48
- self.modify_with_scope
49
-
50
- options = { where: @context['with_scope'] }
51
-
52
- options[:order_by] = options[:where].delete(:order_by)
53
- end
54
-
55
- @collection ||= @content_type.ordered_entries(options).visible
56
- end
57
-
58
- # Modify the attributes of the with_scope tag so that
59
- # they can be resolved by MongoDB.
60
- #
61
- def modify_with_scope
62
- @context['with_scope'].dup.each do |key, value|
63
- field = @content_type.find_entries_custom_field(key.to_s)
64
-
65
- next if field.nil?
66
-
67
- case field.type.to_sym
68
- when :belongs_to
69
- self.modify_with_scope_key(key, "#{key.to_s}_id", self.object_to_id(field, value))
70
- when :many_to_many
71
- self.modify_with_scope_key(key, "#{key.to_s.singularize}_ids", self.object_to_id(field, value))
72
- when :select
73
- option = field.select_options.detect { |option| [option.name, option._id.to_s].include?(value) }
74
- self.modify_with_scope_key(key, "#{key.to_s}_id", option.try(:_id))
75
- end
76
- end
77
- end
78
-
79
- # Change the value of a key of the with_scope depending of its type.
80
- # If the key is a Origin::Key, we only change the name.
81
- # If the key is a String, we replace it.
82
- #
83
- # @param [ Object ] key Either a String or a Origin::Key
84
- # @param [ String ] name The new name of the key
85
- # @param [ String ] value The new value associated to the key
86
- #
87
- def modify_with_scope_key(key, name, value)
88
- if key.respond_to?(:operator)
89
- key.instance_variable_set :@name, name
90
- @context['with_scope'][key] = value
91
- else
92
- @context['with_scope'].delete(key)
93
- @context['with_scope'][name] = value
94
- end
95
- end
96
-
97
- # Get the _id attribute of a object or a list of objects which
98
- # can include String (needed to retrieve a model
99
- # based on its permalink or its label field) or ContentEntry instances.
100
- #
101
- # @param [ Object ] field The custom field
102
- # @param [ Object ] value An object (content entry or label) or a list of objects
103
- #
104
- def object_to_id(field, value)
105
- if value.respond_to?(:map)
106
- value.map { |el| self.object_to_id(field, el) }
107
- elsif value.respond_to?(:_id)
108
- value._id
109
- else
110
- model = Locomotive::ContentType.class_name_to_content_type(field.class_name, @content_type.site)
111
- model.entries.or({ _slug: value }, { model.label_field_name => value }).first.try(:_id)
112
- end
113
- end
114
-
115
- end
116
-
117
- end
118
- end
119
- end
@@ -1,21 +0,0 @@
1
- module Locomotive
2
- module Liquid
3
- module Drops
4
- class CurrentUser < Base
5
-
6
- def logged_in?
7
- @_source.present?
8
- end
9
-
10
- def name
11
- @_source.name if logged_in?
12
- end
13
-
14
- def email
15
- @_source.email if logged_in?
16
- end
17
-
18
- end
19
- end
20
- end
21
- end
@@ -1,115 +0,0 @@
1
- module Locomotive
2
- module Liquid
3
- module Drops
4
- class Page < Base
5
-
6
- delegate :seo_title, :meta_keywords, :meta_description, :redirect_url, :handle, to: :@_source
7
-
8
- def title
9
- title = @_source.templatized? ? @context['entry'].try(:_label) : nil
10
- title || @_source.title
11
- end
12
-
13
- def slug
14
- slug = @_source.templatized? ? @context['entry'].try(:_slug).try(:singularize) : nil
15
- slug || @_source.slug
16
- end
17
-
18
- def original_title
19
- @_source.title
20
- end
21
-
22
- def original_slug
23
- @_source.slug
24
- end
25
-
26
- def parent
27
- @parent ||= @_source.parent.to_liquid
28
- end
29
-
30
- def breadcrumbs
31
- @breadcrumbs ||= liquify(*@_source.ancestors_and_self)
32
- end
33
-
34
- def children
35
- @children ||= liquify(*@_source.children)
36
- end
37
-
38
- def fullpath
39
- @fullpath ||= @_source.fullpath
40
- end
41
-
42
- def depth
43
- @_source.depth
44
- end
45
-
46
- def listed?
47
- @_source.listed?
48
- end
49
-
50
- def published?
51
- @_source.published?
52
- end
53
-
54
- def redirect?
55
- @_source.redirect?
56
- end
57
-
58
- def is_layout?
59
- @_source.is_layout?
60
- end
61
-
62
- def templatized?
63
- @_source.templatized?
64
- end
65
-
66
- def content_type
67
- if @_source.content_type
68
- ContentTypeProxyCollection.new(@_source.content_type)
69
- else
70
- nil
71
- end
72
- end
73
-
74
- def editable_elements
75
- @editable_elements_hash ||= build_editable_elements_hash
76
- end
77
-
78
- def before_method(meth)
79
- # @deprecated
80
- @_source.editable_elements.where(slug: meth).try(:first).try(:content)
81
- end
82
-
83
- private
84
-
85
- def build_editable_elements_hash
86
- {}.tap do |hash|
87
- @_source.editable_elements.each do |el|
88
- safe_slug = el.slug.parameterize.underscore
89
- keys = el.block.try(:split, '/').try(:compact) || []
90
-
91
- _hash = _build_editable_elements_hashes(hash, keys)
92
-
93
- _hash[safe_slug] = el.content
94
- end
95
- end
96
- end
97
-
98
- def _build_editable_elements_hashes(hash, keys)
99
- _hash = hash
100
-
101
- keys.each do |key|
102
- safe_key = key.parameterize.underscore
103
-
104
- _hash[safe_key] = {} if _hash[safe_key].nil?
105
-
106
- _hash = _hash[safe_key]
107
- end
108
-
109
- _hash
110
- end
111
-
112
- end
113
- end
114
- end
115
- end
@@ -1,64 +0,0 @@
1
- module Locomotive
2
- module Liquid
3
- module Drops
4
-
5
- class ProxyCollection < ::Liquid::Drop
6
-
7
- def initialize(collection)
8
- @collection = collection
9
- end
10
-
11
- def first
12
- self.collection.first
13
- end
14
-
15
- def last
16
- self.collection.last
17
- end
18
-
19
- def each(&block)
20
- self.collection.each(&block)
21
- end
22
-
23
- def each_with_index(&block)
24
- self.collection.each_with_index(&block)
25
- end
26
-
27
- def count
28
- @count ||= self.collection.count
29
- end
30
-
31
- def all
32
- self.collection
33
- end
34
-
35
- alias :size :count
36
- alias :length :count
37
-
38
- def empty
39
- self.collection.empty?
40
- end
41
-
42
- def any
43
- self.collection.any?
44
- end
45
-
46
- def content_type
47
-
48
- end
49
-
50
- protected
51
-
52
- def paginate(options = {})
53
- @collection = collection.page(options[:page]).per(options[:per_page])
54
- end
55
-
56
- def collection
57
- @collection
58
- end
59
-
60
- end
61
-
62
- end
63
- end
64
- end
@@ -1,16 +0,0 @@
1
- module Locomotive
2
- module Liquid
3
- module Drops
4
-
5
- class SessionProxy < ::Liquid::Drop
6
-
7
- def before_method(meth)
8
- controller = @context.registers[:controller]
9
- controller.session[meth.to_sym]
10
- end
11
-
12
- end
13
-
14
- end
15
- end
16
- end
@@ -1,29 +0,0 @@
1
- module Locomotive
2
- module Liquid
3
- module Drops
4
- class Site < Base
5
-
6
- delegate :name, :seo_title, :meta_keywords, :meta_description, to: :@_source
7
-
8
- def index
9
- @index ||= @_source.pages.root.first
10
- end
11
-
12
- def pages
13
- liquify(*self.scoped_pages)
14
- end
15
-
16
- def domains
17
- @_source.domains
18
- end
19
-
20
- protected
21
-
22
- def scoped_pages
23
- @_source.ordered_pages(@context['with_scope'])
24
- end
25
-
26
- end
27
- end
28
- end
29
- end