locomotivecms 3.0.0.pre.beta.1 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -3
  3. data/app/api/locomotive/api.rb +1 -0
  4. data/app/api/locomotive/api/entities/page_entity.rb +1 -1
  5. data/app/api/locomotive/api/entities/site_entity.rb +9 -1
  6. data/app/api/locomotive/api/exception_rescuers.rb +3 -5
  7. data/app/api/locomotive/api/forms/page_form.rb +1 -1
  8. data/app/api/locomotive/api/forms/site_form.rb +1 -2
  9. data/app/api/locomotive/api/helpers/authentication_helper.rb +6 -1
  10. data/app/api/locomotive/api/helpers/locales_helper.rb +15 -0
  11. data/app/api/locomotive/api/helpers/params_helper.rb +13 -0
  12. data/app/api/locomotive/api/middlewares/locale_middleware.rb +6 -1
  13. data/app/api/locomotive/api/resources/content_entry_resource.rb +2 -0
  14. data/app/api/locomotive/api/resources/content_type_resource.rb +2 -2
  15. data/app/api/locomotive/api/resources/current_site_resource.rb +2 -1
  16. data/app/api/locomotive/api/resources/membership_resource.rb +0 -4
  17. data/app/api/locomotive/api/resources/page_resource.rb +6 -1
  18. data/app/api/locomotive/api/resources/site_resource.rb +4 -2
  19. data/app/assets/javascripts/locomotive.js +1 -0
  20. data/app/assets/javascripts/locomotive/utils/nprogress.js.coffee +3 -1
  21. data/app/assets/javascripts/locomotive/views/editable_elements/index_view.js.coffee +10 -3
  22. data/app/assets/javascripts/locomotive/views/inputs/markdown_view.js.coffee +82 -0
  23. data/app/assets/javascripts/locomotive/views/inputs/rte/file_view.js.coffee +1 -1
  24. data/app/assets/javascripts/locomotive/views/inputs/rte/link_view.js.coffee +1 -1
  25. data/app/assets/javascripts/locomotive/views/inputs/rte_view.js.coffee.erb +1 -1
  26. data/app/assets/javascripts/locomotive/views/inputs/text_view.js.coffee +4 -1
  27. data/app/assets/javascripts/locomotive/views/pages/list_view.js.coffee +3 -0
  28. data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +22 -1
  29. data/app/assets/javascripts/locomotive/views/shared/header_view.js.coffee +2 -2
  30. data/app/assets/stylesheets/locomotive/application.scss +2 -0
  31. data/app/assets/stylesheets/locomotive/base/_form.scss +2 -0
  32. data/app/assets/stylesheets/locomotive/base/form/_api_key.scss +0 -1
  33. data/app/assets/stylesheets/locomotive/base/form/_array_input.scss +2 -0
  34. data/app/assets/stylesheets/locomotive/base/form/_base.scss +13 -2
  35. data/app/assets/stylesheets/locomotive/base/form/_color_input.scss +12 -0
  36. data/app/assets/stylesheets/locomotive/base/form/_markdown.scss +292 -0
  37. data/app/assets/stylesheets/locomotive/base/form/_popover.scss +22 -0
  38. data/app/assets/stylesheets/locomotive/base/form/_rte.scss +2 -1
  39. data/app/assets/stylesheets/locomotive/components/_activity_feed.scss +1 -0
  40. data/app/assets/stylesheets/locomotive/components/_dashboard.scss +29 -0
  41. data/app/assets/stylesheets/locomotive/components/_live_editing.scss +13 -1
  42. data/app/assets/stylesheets/locomotive/components/_main.scss +1 -1
  43. data/app/assets/stylesheets/locomotive/components/_transitions.scss +24 -3
  44. data/app/assets/stylesheets/locomotive/components/sidebar/_base.scss +1 -0
  45. data/app/assets/stylesheets/locomotive/globals/_bootstrap.scss +2 -2
  46. data/app/assets/stylesheets/locomotive/globals/_variables.scss +4 -3
  47. data/app/assets/stylesheets/locomotive/layouts/_live_editing.scss +4 -0
  48. data/app/controllers/locomotive/concerns/locale_helpers_controller.rb +1 -0
  49. data/app/controllers/locomotive/content_entries_controller.rb +10 -2
  50. data/app/controllers/locomotive/pages_controller.rb +2 -1
  51. data/app/controllers/locomotive/passwords_controller.rb +17 -1
  52. data/app/helpers/locomotive/base_helper.rb +19 -0
  53. data/app/helpers/locomotive/content_types_helper.rb +2 -1
  54. data/app/helpers/locomotive/custom_fields_helper.rb +14 -1
  55. data/app/helpers/locomotive/dashboard_helper.rb +12 -0
  56. data/app/helpers/locomotive/editable_elements_helper.rb +9 -4
  57. data/app/helpers/locomotive/pages_helper.rb +1 -14
  58. data/app/helpers/locomotive/shared/pages_helper.rb +17 -0
  59. data/app/helpers/locomotive/translations_helper.rb +0 -14
  60. data/app/inputs/locomotive/color_input.rb +18 -0
  61. data/app/inputs/locomotive/markdown_input.rb +19 -0
  62. data/app/models/locomotive/account.rb +2 -1
  63. data/app/models/locomotive/concerns/content_entry/file_size.rb +27 -0
  64. data/app/models/locomotive/concerns/content_type/group_by.rb +3 -1
  65. data/app/models/locomotive/concerns/page/layout.rb +63 -19
  66. data/app/models/locomotive/concerns/shared/site_scope.rb +37 -0
  67. data/app/models/locomotive/concerns/site/cache.rb +32 -0
  68. data/app/models/locomotive/concerns/theme_asset/plain_text.rb +85 -0
  69. data/app/models/locomotive/content_entry.rb +7 -7
  70. data/app/models/locomotive/content_type.rb +12 -6
  71. data/app/models/locomotive/page.rb +12 -14
  72. data/app/models/locomotive/site.rb +9 -3
  73. data/app/models/locomotive/snippet.rb +6 -4
  74. data/app/models/locomotive/theme_asset.rb +8 -73
  75. data/app/models/locomotive/translation.rb +6 -5
  76. data/app/policies/locomotive/site_policy.rb +2 -2
  77. data/app/services/locomotive/content_entry_service.rb +7 -6
  78. data/app/services/locomotive/site_service.rb +1 -0
  79. data/app/views/locomotive/content_entries/_entry.html.slim +1 -0
  80. data/app/views/locomotive/content_entries/edit.html.slim +1 -1
  81. data/app/views/locomotive/content_entries/new.html.slim +1 -1
  82. data/app/views/locomotive/current_site/_membership.html.slim +1 -0
  83. data/app/views/locomotive/current_site/edit.html.slim +1 -1
  84. data/app/views/locomotive/current_site/form/_access_points.html.slim +1 -1
  85. data/app/views/locomotive/current_site/form/_advanced.html.slim +2 -0
  86. data/app/views/locomotive/dashboard/_activity.html.slim +26 -0
  87. data/app/views/locomotive/dashboard/_url.html.slim +9 -0
  88. data/app/views/locomotive/dashboard/show.html.slim +3 -21
  89. data/app/views/locomotive/devise_mailer/reset_password_instructions.html.slim +1 -1
  90. data/app/views/locomotive/editable_elements/_edit.html.slim +8 -1
  91. data/app/views/locomotive/editable_elements/_form.html.slim +1 -1
  92. data/app/views/locomotive/editable_elements/index_without_preview.html.slim +24 -17
  93. data/app/views/locomotive/layouts/application.html.slim +6 -4
  94. data/app/views/locomotive/layouts/live_editing.html.slim +9 -0
  95. data/app/views/locomotive/layouts/not_logged_in.html.slim +1 -1
  96. data/app/views/locomotive/layouts/without_site.html.slim +2 -0
  97. data/app/views/locomotive/memberships/edit.html.slim +1 -1
  98. data/app/views/locomotive/memberships/new.html.slim +1 -1
  99. data/app/views/locomotive/my_account/edit.html.slim +7 -5
  100. data/app/views/locomotive/pages/_header.html.slim +7 -0
  101. data/app/views/locomotive/pages/edit.html.slim +2 -4
  102. data/app/views/locomotive/pages/form/_main.html.slim +4 -1
  103. data/app/views/locomotive/pages/form/_tabs.html.slim +4 -3
  104. data/app/views/locomotive/public_submission_accounts/_account.html.slim +1 -1
  105. data/app/views/locomotive/public_submission_accounts/edit.html.slim +1 -1
  106. data/app/views/locomotive/shared/_header.html.slim +25 -22
  107. data/app/views/locomotive/shared/_locale_picker_link.html.slim +3 -0
  108. data/app/views/locomotive/shared/_main_app_header.html.slim +1 -1
  109. data/app/views/locomotive/shared/_sidebar.html.slim +15 -11
  110. data/app/views/locomotive/shared/rte/_markdown_toolbar.html.slim +42 -0
  111. data/config/locales/admin_ui.en.yml +9 -4
  112. data/config/locales/default.en.yml +4 -0
  113. data/config/locales/devise.en.yml +1 -0
  114. data/config/locales/simple_form.en.yml +6 -2
  115. data/lib/locomotive/action_controller/responder.rb +5 -0
  116. data/lib/locomotive/engine.rb +5 -0
  117. data/lib/locomotive/middlewares/site.rb +39 -21
  118. data/lib/locomotive/simple_form.rb +3 -31
  119. data/lib/locomotive/steam/middlewares/cache.rb +62 -0
  120. data/lib/locomotive/steam/middlewares/page_editing.rb +9 -3
  121. data/lib/locomotive/steam/services/api_entry_submission_service.rb +6 -3
  122. data/lib/locomotive/steam/services/liquid_parser_with_cache_service.rb +74 -0
  123. data/lib/locomotive/steam_adaptor.rb +7 -1
  124. data/lib/locomotive/version.rb +1 -1
  125. data/lib/tasks/development.rake +4 -0
  126. data/lib/tasks/locomotive.rake +14 -0
  127. data/spec/lib/locomotive/steam/services/api_entry_submission_service_spec.rb +10 -1
  128. data/spec/lib/locomotive/steam/services/liquid_parser_with_cache_service_spec.rb +53 -0
  129. data/spec/models/locomotive/concerns/content_entry/file_size_spec.rb +40 -0
  130. data/spec/models/locomotive/concerns/page/layout_spec.rb +122 -17
  131. data/spec/models/locomotive/concerns/site/cache_spec.rb +60 -0
  132. data/spec/models/locomotive/content_entry_spec.rb +7 -0
  133. data/spec/models/locomotive/content_type_spec.rb +18 -11
  134. data/spec/models/locomotive/page_spec.rb +32 -8
  135. data/spec/models/locomotive/snippet_spec.rb +13 -4
  136. data/spec/models/locomotive/theme_asset_spec.rb +10 -3
  137. data/spec/models/locomotive/translation_spec.rb +28 -0
  138. data/spec/requests/locomotive/steam/cache_spec.rb +83 -0
  139. data/spec/requests/site_spec.rb +24 -0
  140. data/spec/support/capybara.rb +5 -13
  141. data/spec/support/factories.rb +9 -0
  142. data/spec/support/features/session_helpers.rb +19 -3
  143. data/spec/support/features/site_helpers.rb +27 -0
  144. data/spec/support/shared_examples/site_scope_examples.rb +27 -0
  145. data/vendor/assets/images/locomotive/bootstrap-colorpicker/alpha-horizontal.png +0 -0
  146. data/vendor/assets/images/locomotive/bootstrap-colorpicker/alpha.png +0 -0
  147. data/vendor/assets/images/locomotive/bootstrap-colorpicker/hue-horizontal.png +0 -0
  148. data/vendor/assets/images/locomotive/bootstrap-colorpicker/hue.png +0 -0
  149. data/vendor/assets/images/locomotive/bootstrap-colorpicker/saturation.png +0 -0
  150. data/vendor/assets/javascripts/locomotive/bootstrap-colorpicker.js +1 -0
  151. data/vendor/assets/javascripts/locomotive/datepicker_i18n.js.erb +6 -6
  152. data/vendor/assets/javascripts/locomotive/kramed.min.js +11 -0
  153. data/vendor/assets/stylesheets/locomotive/bootstrap-colorpicker.scss +9 -0
  154. metadata +59 -44
  155. data/app/controllers/locomotive/api/accounts_controller.rb +0 -60
  156. data/app/controllers/locomotive/api/base_controller.rb +0 -35
  157. data/app/controllers/locomotive/api/content_assets_controller.rb +0 -51
  158. data/app/controllers/locomotive/api/content_entries_controller.rb +0 -71
  159. data/app/controllers/locomotive/api/content_types_controller.rb +0 -52
  160. data/app/controllers/locomotive/api/current_site_controller.rb +0 -34
  161. data/app/controllers/locomotive/api/memberships_controller.rb +0 -52
  162. data/app/controllers/locomotive/api/my_account_controller.rb +0 -46
  163. data/app/controllers/locomotive/api/pages_controller.rb +0 -53
  164. data/app/controllers/locomotive/api/sites_controller.rb +0 -58
  165. data/app/controllers/locomotive/api/snippets_controller.rb +0 -52
  166. data/app/controllers/locomotive/api/theme_assets_controller.rb +0 -51
  167. data/app/controllers/locomotive/api/tokens_controller.rb +0 -36
  168. data/app/controllers/locomotive/api/translations_controller.rb +0 -51
  169. data/app/controllers/locomotive/api/version_controller.rb +0 -11
  170. data/spec/models/locomotive/editable_control_spec.rb +0 -79
  171. data/spec/models/locomotive/editable_file_spec.rb +0 -94
  172. data/spec/models/locomotive/editable_text_spec.rb +0 -219
  173. data/vendor/assets/images/select2-spinner.gif +0 -0
  174. data/vendor/assets/images/select2.png +0 -0
  175. data/vendor/assets/images/select2x2.png +0 -0
@@ -1,60 +0,0 @@
1
- # module Locomotive
2
- # module Api
3
- # class AccountsController < Api::BaseController
4
-
5
- # account_required
6
-
7
- # before_filter :load_account, only: [:show, :update, :destroy]
8
- # before_filter :load_accounts, only: [:index]
9
-
10
- # def index
11
- # authorize Locomotive::Account
12
- # @accounts = @accounts.ordered
13
- # respond_with @accounts
14
- # end
15
-
16
- # def show
17
- # authorize @account
18
- # respond_with @account
19
- # end
20
-
21
- # def create
22
- # @account = Account.new
23
- # @account.from_presenter(account_params_on_create).save
24
- # respond_with @account, location: -> { main_app.locomotive_api_account_url(@account) }
25
- # end
26
-
27
- # def update
28
- # authorize @account
29
- # @account.from_presenter(params[:account]).save
30
- # respond_with @account, location: main_app.locomotive_api_account_url(@account)
31
- # end
32
-
33
- # def destroy
34
- # authorize @account
35
- # @account.destroy
36
- # respond_with @account, location: main_app.locomotive_api_accounts_url
37
- # end
38
-
39
- # private
40
-
41
- # def load_account
42
- # @account = Locomotive::Account.find(params[:id])
43
- # end
44
-
45
- # def load_accounts
46
- # @accounts = Locomotive::Account.all
47
- # end
48
-
49
- # def current_membership
50
- # Locomotive::Membership.new(account: current_locomotive_account)
51
- # end
52
-
53
- # def account_params_on_create
54
- # params.require(:account).permit(:name, :email, :password, :password_confirmation)
55
- # end
56
-
57
- # end
58
-
59
- # end
60
- # end
@@ -1,35 +0,0 @@
1
- # module Locomotive
2
- # module Api
3
- # class BaseController < ApplicationController
4
-
5
- # include Locomotive::Concerns::TokenAuthenticationController
6
- # include Locomotive::Concerns::ExceptionController
7
- # include Locomotive::Concerns::AuthorizationController
8
-
9
- # include Locomotive::Concerns::WithinSiteController
10
-
11
- # skip_before_filter :verify_authenticity_token
12
-
13
- # before_filter :set_locale
14
-
15
- # self.responder = Locomotive::ActionController::Responder # custom responder
16
-
17
- # respond_to :json, :xml
18
-
19
- # private
20
-
21
- # def set_locale
22
- # locale = params[:locale] ||
23
- # current_site.try(:default_locale) ||
24
- # current_locomotive_account.try(:locale) ||
25
- # Locomotive.config.default_locale
26
-
27
- # ::Mongoid::Fields::I18n.locale = locale
28
- # ::I18n.locale = ::Mongoid::Fields::I18n.locale
29
-
30
- # self.setup_i18n_fallbacks if current_site
31
- # end
32
-
33
- # end
34
- # end
35
- # end
@@ -1,51 +0,0 @@
1
- # module Locomotive
2
- # module Api
3
- # class ContentAssetsController < Api::BaseController
4
-
5
- # account_required & within_site
6
-
7
- # before_filter :load_content_asset, only: [:show, :update, :destroy]
8
- # before_filter :load_content_assets, only: [:index]
9
-
10
- # def index
11
- # authorize Locomotive::ContentAsset
12
- # respond_with @content_assets
13
- # end
14
-
15
- # def show
16
- # authorize @content_asset
17
- # respond_with @content_asset
18
- # end
19
-
20
- # def create
21
- # authorize Locomotive::ContentAsset
22
- # @content_asset = current_site.content_assets.build
23
- # @content_asset.from_presenter(params[:content_asset]).save
24
- # respond_with @content_asset, location: -> { main_app.locomotive_api_content_asset_url(@content_asset) }
25
- # end
26
-
27
- # def update
28
- # authorize @content_asset
29
- # @content_asset.from_presenter(params[:content_asset]).save
30
- # respond_with @content_asset, location: main_app.locomotive_api_content_asset_url(@content_asset)
31
- # end
32
-
33
- # def destroy
34
- # authorize @content_asset
35
- # @content_asset.destroy
36
- # respond_with @content_asset, location: main_app.locomotive_api_content_assets_url
37
- # end
38
-
39
- # private
40
-
41
- # def load_content_asset
42
- # @content_asset = self.current_site.content_assets.find(params[:id])
43
- # end
44
-
45
- # def load_content_assets
46
- # @content_assets = self.current_site.content_assets
47
- # end
48
-
49
- # end
50
- # end
51
- # end
@@ -1,71 +0,0 @@
1
- # module Locomotive
2
- # module Api
3
- # class ContentEntriesController < Api::BaseController
4
-
5
- # account_required & within_site
6
-
7
- # before_filter :load_content_type
8
- # before_filter :load_content_entry, only: [:show, :update, :destroy]
9
- # before_filter :load_content_entries, only: [:index]
10
-
11
- # def index
12
- # authorize Locomotive::ContentEntry
13
- # @content_entries = service.all(params.slice(:page, :per_page, :order_by, :where))
14
- # respond_with @content_entries
15
- # end
16
-
17
- # def show
18
- # authorize @content_entry
19
- # respond_with @content_entry, status: @content_entry ? :ok : :not_found
20
- # end
21
-
22
- # def create
23
- # authorize Locomotive::ContentEntry
24
- # @content_entry = @content_type.entries.build
25
- # @content_entry.from_presenter(content_entry_params).save
26
- # respond_with @content_entry, location: -> { main_app.locomotive_api_content_entry_url(@content_type.slug, @content_entry) }
27
- # end
28
-
29
- # def update
30
- # authorize @content_entry
31
- # @content_entry.from_presenter(content_entry_params).save
32
- # respond_with @content_entry, location: main_app.locomotive_api_content_entry_url(@content_type.slug, @content_entry)
33
- # end
34
-
35
- # def destroy
36
- # authorize @content_entry
37
- # @content_entry.destroy
38
- # respond_with @content_entry, location: main_app.locomotive_api_content_entries_url(@content_type.slug)
39
- # end
40
-
41
- # def destroy_all
42
- # authorize Locomotive::ContentEntry, :destroy?
43
- # service.destroy_all
44
- # respond_with({ success: true }, location: main_app.locomotive_api_content_entries_url(@content_type.slug))
45
- # end
46
-
47
- # private
48
-
49
- # def load_content_type
50
- # @content_type = current_site.content_types.where(slug: params[:slug]).first
51
- # end
52
-
53
- # def load_content_entry
54
- # @content_entry = @content_type.entries.find_by_id_or_permalink(params[:id])
55
- # end
56
-
57
- # def load_content_entries
58
- # @content_entries = @content_type.entries
59
- # end
60
-
61
- # def service
62
- # @service ||= Locomotive::ContentEntryService.new(@content_type)
63
- # end
64
-
65
- # def content_entry_params
66
- # params[:content_entry] || params[:entry]
67
- # end
68
-
69
- # end
70
- # end
71
- # end
@@ -1,52 +0,0 @@
1
- # module Locomotive
2
- # module Api
3
- # class ContentTypesController < Api::BaseController
4
-
5
- # account_required & within_site
6
-
7
- # before_filter :load_content_type, only: [:show, :update, :destroy]
8
- # before_filter :load_content_types, only: [:index]
9
-
10
- # def index
11
- # authorize Locomotive::ContentType
12
- # @content_types = @content_types.order_by(:name.asc)
13
- # respond_with @content_types
14
- # end
15
-
16
- # def show
17
- # authorize @content_type
18
- # respond_with @content_type
19
- # end
20
-
21
- # def create
22
- # authorize Locomotive::ContentType
23
- # @content_type = current_site.content_types.build
24
- # @content_type.from_presenter(params[:content_type]).save
25
- # respond_with @content_type, location: -> { main_app.locomotive_api_content_type_url(@content_type) }
26
- # end
27
-
28
- # def update
29
- # authorize @content_type
30
- # @content_type.from_presenter(params[:content_type]).save
31
- # respond_with @content_type, location: main_app.locomotive_api_content_type_url(@content_type)
32
- # end
33
-
34
- # def destroy
35
- # authorize @content_type
36
- # @content_type.destroy
37
- # respond_with @content_type, location: -> { main_app.locomotive_api_content_types_url }
38
- # end
39
-
40
- # private
41
-
42
- # def load_content_type
43
- # @content_type = current_site.content_types.find(params[:id])
44
- # end
45
-
46
- # def load_content_types
47
- # @content_types = current_site.content_types
48
- # end
49
-
50
- # end
51
- # end
52
- # end
@@ -1,34 +0,0 @@
1
- # module Locomotive
2
- # module Api
3
- # class CurrentSiteController < Api::BaseController
4
-
5
- # account_required & within_site
6
-
7
- # before_filter :load_current_site
8
-
9
- # def show
10
- # authorize @site
11
- # respond_with @site
12
- # end
13
-
14
- # def update
15
- # authorize @site
16
- # @site.from_presenter(params[:site]).save
17
- # respond_with @site, location: main_app.locomotive_api_current_site_url
18
- # end
19
-
20
- # def destroy
21
- # authorize @site
22
- # @site.destroy
23
- # respond_with @site, location: main_app.locomotive_api_my_account_url
24
- # end
25
-
26
- # private
27
-
28
- # def load_current_site
29
- # @site = current_site
30
- # end
31
-
32
- # end
33
- # end
34
- # end
@@ -1,52 +0,0 @@
1
- # module Locomotive
2
- # module Api
3
- # class MembershipsController < Api::BaseController
4
-
5
- # account_required & within_site
6
-
7
- # before_filter :load_membership, only: [:show, :update, :destroy]
8
- # before_filter :load_memberships, only: [:index]
9
-
10
- # def index
11
- # authorize Locomotive::Membership
12
- # respond_with @memberships
13
- # end
14
-
15
- # def show
16
- # authorize @membership
17
- # respond_with @membership
18
- # end
19
-
20
- # def create
21
- # authorize Locomotive::Membership
22
- # @membership = current_site.memberships.build
23
- # @membership.from_presenter(params[:membership]).save
24
- # respond_with @membership, location: -> { main_app.locomotive_api_membership_url(@membership) }
25
- # end
26
-
27
- # def update
28
- # authorize @membership
29
- # @membership.from_presenter(params[:membership]).save
30
- # respond_with @membership, location: main_app.locomotive_api_membership_url(@membership)
31
- # end
32
-
33
- # def destroy
34
- # authorize @membership
35
- # @membership.destroy
36
- # respond_with @membership, location: main_app.locomotive_api_memberships_url
37
- # end
38
-
39
- # private
40
-
41
- # def load_membership
42
- # @membership = current_site.memberships.find(params[:id])
43
- # end
44
-
45
- # def load_memberships
46
- # @memberships = current_site.memberships
47
- # end
48
-
49
- # end
50
-
51
- # end
52
- # end
@@ -1,46 +0,0 @@
1
- # module Locomotive
2
- # module Api
3
- # class MyAccountController < Api::BaseController
4
-
5
- # account_required except: :create
6
-
7
- # before_filter :load_account
8
- # before_filter :must_not_be_logged_in, only: :create
9
-
10
- # def show
11
- # authorize @account
12
- # respond_with @account
13
- # end
14
-
15
- # def create
16
- # @account = Account.new
17
- # @account.from_presenter(params[:account]).save
18
- # respond_with @account, location: main_app.locomotive_api_my_account_url
19
- # end
20
-
21
- # def update
22
- # authorize @account
23
- # @account.from_presenter(params[:account]).save
24
- # respond_with @account, location: main_app.locomotive_api_my_account_url
25
- # end
26
-
27
- # private
28
-
29
- # def load_account
30
- # @account = current_locomotive_account
31
- # end
32
-
33
- # def must_not_be_logged_in
34
- # raise Pundit::NotAuthorizedError.new('You must not be logged in') if current_locomotive_account
35
- # end
36
-
37
- # def current_membership
38
- # if current_locomotive_account
39
- # Locomotive::Membership.new(account: current_locomotive_account)
40
- # end
41
- # end
42
-
43
- # end
44
-
45
- # end
46
- # end
@@ -1,53 +0,0 @@
1
- # module Locomotive
2
- # module Api
3
- # class PagesController < Api::BaseController
4
-
5
- # account_required & within_site
6
-
7
- # before_filter :load_page, only: [:show, :update, :destroy]
8
- # before_filter :load_pages, only: [:index]
9
-
10
- # def index
11
- # authorize Locomotive::Page
12
- # @pages = @pages.order_by(:depth.asc, :position.asc)
13
- # respond_with @pages
14
- # end
15
-
16
- # def show
17
- # authorize @page
18
- # respond_with @page
19
- # end
20
-
21
- # def create
22
- # authorize Locomotive::Page
23
- # @page = current_site.pages.build
24
- # @page.from_presenter(params[:page]).save
25
- # respond_with @page, location: -> { main_app.locomotive_api_page_url(@page) }
26
- # end
27
-
28
- # def update
29
- # authorize @page
30
- # @page.from_presenter(params[:page]).save
31
- # respond_with @page, location: main_app.locomotive_api_page_url(@page)
32
- # end
33
-
34
- # def destroy
35
- # authorize @page
36
- # @page.destroy
37
- # respond_with @page, location: main_app.locomotive_api_pages_url
38
- # end
39
-
40
- # private
41
-
42
- # def load_page
43
- # @page = current_site.pages.find(params[:id])
44
- # end
45
-
46
- # def load_pages
47
- # @pages = current_site.pages
48
- # end
49
-
50
- # end
51
-
52
- # end
53
- # end