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.
- checksums.yaml +4 -4
- data/Gemfile +4 -3
- data/app/api/locomotive/api.rb +1 -0
- data/app/api/locomotive/api/entities/page_entity.rb +1 -1
- data/app/api/locomotive/api/entities/site_entity.rb +9 -1
- data/app/api/locomotive/api/exception_rescuers.rb +3 -5
- data/app/api/locomotive/api/forms/page_form.rb +1 -1
- data/app/api/locomotive/api/forms/site_form.rb +1 -2
- data/app/api/locomotive/api/helpers/authentication_helper.rb +6 -1
- data/app/api/locomotive/api/helpers/locales_helper.rb +15 -0
- data/app/api/locomotive/api/helpers/params_helper.rb +13 -0
- data/app/api/locomotive/api/middlewares/locale_middleware.rb +6 -1
- data/app/api/locomotive/api/resources/content_entry_resource.rb +2 -0
- data/app/api/locomotive/api/resources/content_type_resource.rb +2 -2
- data/app/api/locomotive/api/resources/current_site_resource.rb +2 -1
- data/app/api/locomotive/api/resources/membership_resource.rb +0 -4
- data/app/api/locomotive/api/resources/page_resource.rb +6 -1
- data/app/api/locomotive/api/resources/site_resource.rb +4 -2
- data/app/assets/javascripts/locomotive.js +1 -0
- data/app/assets/javascripts/locomotive/utils/nprogress.js.coffee +3 -1
- data/app/assets/javascripts/locomotive/views/editable_elements/index_view.js.coffee +10 -3
- data/app/assets/javascripts/locomotive/views/inputs/markdown_view.js.coffee +82 -0
- data/app/assets/javascripts/locomotive/views/inputs/rte/file_view.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/views/inputs/rte/link_view.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/views/inputs/rte_view.js.coffee.erb +1 -1
- data/app/assets/javascripts/locomotive/views/inputs/text_view.js.coffee +4 -1
- data/app/assets/javascripts/locomotive/views/pages/list_view.js.coffee +3 -0
- data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +22 -1
- data/app/assets/javascripts/locomotive/views/shared/header_view.js.coffee +2 -2
- data/app/assets/stylesheets/locomotive/application.scss +2 -0
- data/app/assets/stylesheets/locomotive/base/_form.scss +2 -0
- data/app/assets/stylesheets/locomotive/base/form/_api_key.scss +0 -1
- data/app/assets/stylesheets/locomotive/base/form/_array_input.scss +2 -0
- data/app/assets/stylesheets/locomotive/base/form/_base.scss +13 -2
- data/app/assets/stylesheets/locomotive/base/form/_color_input.scss +12 -0
- data/app/assets/stylesheets/locomotive/base/form/_markdown.scss +292 -0
- data/app/assets/stylesheets/locomotive/base/form/_popover.scss +22 -0
- data/app/assets/stylesheets/locomotive/base/form/_rte.scss +2 -1
- data/app/assets/stylesheets/locomotive/components/_activity_feed.scss +1 -0
- data/app/assets/stylesheets/locomotive/components/_dashboard.scss +29 -0
- data/app/assets/stylesheets/locomotive/components/_live_editing.scss +13 -1
- data/app/assets/stylesheets/locomotive/components/_main.scss +1 -1
- data/app/assets/stylesheets/locomotive/components/_transitions.scss +24 -3
- data/app/assets/stylesheets/locomotive/components/sidebar/_base.scss +1 -0
- data/app/assets/stylesheets/locomotive/globals/_bootstrap.scss +2 -2
- data/app/assets/stylesheets/locomotive/globals/_variables.scss +4 -3
- data/app/assets/stylesheets/locomotive/layouts/_live_editing.scss +4 -0
- data/app/controllers/locomotive/concerns/locale_helpers_controller.rb +1 -0
- data/app/controllers/locomotive/content_entries_controller.rb +10 -2
- data/app/controllers/locomotive/pages_controller.rb +2 -1
- data/app/controllers/locomotive/passwords_controller.rb +17 -1
- data/app/helpers/locomotive/base_helper.rb +19 -0
- data/app/helpers/locomotive/content_types_helper.rb +2 -1
- data/app/helpers/locomotive/custom_fields_helper.rb +14 -1
- data/app/helpers/locomotive/dashboard_helper.rb +12 -0
- data/app/helpers/locomotive/editable_elements_helper.rb +9 -4
- data/app/helpers/locomotive/pages_helper.rb +1 -14
- data/app/helpers/locomotive/shared/pages_helper.rb +17 -0
- data/app/helpers/locomotive/translations_helper.rb +0 -14
- data/app/inputs/locomotive/color_input.rb +18 -0
- data/app/inputs/locomotive/markdown_input.rb +19 -0
- data/app/models/locomotive/account.rb +2 -1
- data/app/models/locomotive/concerns/content_entry/file_size.rb +27 -0
- data/app/models/locomotive/concerns/content_type/group_by.rb +3 -1
- data/app/models/locomotive/concerns/page/layout.rb +63 -19
- data/app/models/locomotive/concerns/shared/site_scope.rb +37 -0
- data/app/models/locomotive/concerns/site/cache.rb +32 -0
- data/app/models/locomotive/concerns/theme_asset/plain_text.rb +85 -0
- data/app/models/locomotive/content_entry.rb +7 -7
- data/app/models/locomotive/content_type.rb +12 -6
- data/app/models/locomotive/page.rb +12 -14
- data/app/models/locomotive/site.rb +9 -3
- data/app/models/locomotive/snippet.rb +6 -4
- data/app/models/locomotive/theme_asset.rb +8 -73
- data/app/models/locomotive/translation.rb +6 -5
- data/app/policies/locomotive/site_policy.rb +2 -2
- data/app/services/locomotive/content_entry_service.rb +7 -6
- data/app/services/locomotive/site_service.rb +1 -0
- data/app/views/locomotive/content_entries/_entry.html.slim +1 -0
- data/app/views/locomotive/content_entries/edit.html.slim +1 -1
- data/app/views/locomotive/content_entries/new.html.slim +1 -1
- data/app/views/locomotive/current_site/_membership.html.slim +1 -0
- data/app/views/locomotive/current_site/edit.html.slim +1 -1
- data/app/views/locomotive/current_site/form/_access_points.html.slim +1 -1
- data/app/views/locomotive/current_site/form/_advanced.html.slim +2 -0
- data/app/views/locomotive/dashboard/_activity.html.slim +26 -0
- data/app/views/locomotive/dashboard/_url.html.slim +9 -0
- data/app/views/locomotive/dashboard/show.html.slim +3 -21
- data/app/views/locomotive/devise_mailer/reset_password_instructions.html.slim +1 -1
- data/app/views/locomotive/editable_elements/_edit.html.slim +8 -1
- data/app/views/locomotive/editable_elements/_form.html.slim +1 -1
- data/app/views/locomotive/editable_elements/index_without_preview.html.slim +24 -17
- data/app/views/locomotive/layouts/application.html.slim +6 -4
- data/app/views/locomotive/layouts/live_editing.html.slim +9 -0
- data/app/views/locomotive/layouts/not_logged_in.html.slim +1 -1
- data/app/views/locomotive/layouts/without_site.html.slim +2 -0
- data/app/views/locomotive/memberships/edit.html.slim +1 -1
- data/app/views/locomotive/memberships/new.html.slim +1 -1
- data/app/views/locomotive/my_account/edit.html.slim +7 -5
- data/app/views/locomotive/pages/_header.html.slim +7 -0
- data/app/views/locomotive/pages/edit.html.slim +2 -4
- data/app/views/locomotive/pages/form/_main.html.slim +4 -1
- data/app/views/locomotive/pages/form/_tabs.html.slim +4 -3
- data/app/views/locomotive/public_submission_accounts/_account.html.slim +1 -1
- data/app/views/locomotive/public_submission_accounts/edit.html.slim +1 -1
- data/app/views/locomotive/shared/_header.html.slim +25 -22
- data/app/views/locomotive/shared/_locale_picker_link.html.slim +3 -0
- data/app/views/locomotive/shared/_main_app_header.html.slim +1 -1
- data/app/views/locomotive/shared/_sidebar.html.slim +15 -11
- data/app/views/locomotive/shared/rte/_markdown_toolbar.html.slim +42 -0
- data/config/locales/admin_ui.en.yml +9 -4
- data/config/locales/default.en.yml +4 -0
- data/config/locales/devise.en.yml +1 -0
- data/config/locales/simple_form.en.yml +6 -2
- data/lib/locomotive/action_controller/responder.rb +5 -0
- data/lib/locomotive/engine.rb +5 -0
- data/lib/locomotive/middlewares/site.rb +39 -21
- data/lib/locomotive/simple_form.rb +3 -31
- data/lib/locomotive/steam/middlewares/cache.rb +62 -0
- data/lib/locomotive/steam/middlewares/page_editing.rb +9 -3
- data/lib/locomotive/steam/services/api_entry_submission_service.rb +6 -3
- data/lib/locomotive/steam/services/liquid_parser_with_cache_service.rb +74 -0
- data/lib/locomotive/steam_adaptor.rb +7 -1
- data/lib/locomotive/version.rb +1 -1
- data/lib/tasks/development.rake +4 -0
- data/lib/tasks/locomotive.rake +14 -0
- data/spec/lib/locomotive/steam/services/api_entry_submission_service_spec.rb +10 -1
- data/spec/lib/locomotive/steam/services/liquid_parser_with_cache_service_spec.rb +53 -0
- data/spec/models/locomotive/concerns/content_entry/file_size_spec.rb +40 -0
- data/spec/models/locomotive/concerns/page/layout_spec.rb +122 -17
- data/spec/models/locomotive/concerns/site/cache_spec.rb +60 -0
- data/spec/models/locomotive/content_entry_spec.rb +7 -0
- data/spec/models/locomotive/content_type_spec.rb +18 -11
- data/spec/models/locomotive/page_spec.rb +32 -8
- data/spec/models/locomotive/snippet_spec.rb +13 -4
- data/spec/models/locomotive/theme_asset_spec.rb +10 -3
- data/spec/models/locomotive/translation_spec.rb +28 -0
- data/spec/requests/locomotive/steam/cache_spec.rb +83 -0
- data/spec/requests/site_spec.rb +24 -0
- data/spec/support/capybara.rb +5 -13
- data/spec/support/factories.rb +9 -0
- data/spec/support/features/session_helpers.rb +19 -3
- data/spec/support/features/site_helpers.rb +27 -0
- data/spec/support/shared_examples/site_scope_examples.rb +27 -0
- data/vendor/assets/images/locomotive/bootstrap-colorpicker/alpha-horizontal.png +0 -0
- data/vendor/assets/images/locomotive/bootstrap-colorpicker/alpha.png +0 -0
- data/vendor/assets/images/locomotive/bootstrap-colorpicker/hue-horizontal.png +0 -0
- data/vendor/assets/images/locomotive/bootstrap-colorpicker/hue.png +0 -0
- data/vendor/assets/images/locomotive/bootstrap-colorpicker/saturation.png +0 -0
- data/vendor/assets/javascripts/locomotive/bootstrap-colorpicker.js +1 -0
- data/vendor/assets/javascripts/locomotive/datepicker_i18n.js.erb +6 -6
- data/vendor/assets/javascripts/locomotive/kramed.min.js +11 -0
- data/vendor/assets/stylesheets/locomotive/bootstrap-colorpicker.scss +9 -0
- metadata +59 -44
- data/app/controllers/locomotive/api/accounts_controller.rb +0 -60
- data/app/controllers/locomotive/api/base_controller.rb +0 -35
- data/app/controllers/locomotive/api/content_assets_controller.rb +0 -51
- data/app/controllers/locomotive/api/content_entries_controller.rb +0 -71
- data/app/controllers/locomotive/api/content_types_controller.rb +0 -52
- data/app/controllers/locomotive/api/current_site_controller.rb +0 -34
- data/app/controllers/locomotive/api/memberships_controller.rb +0 -52
- data/app/controllers/locomotive/api/my_account_controller.rb +0 -46
- data/app/controllers/locomotive/api/pages_controller.rb +0 -53
- data/app/controllers/locomotive/api/sites_controller.rb +0 -58
- data/app/controllers/locomotive/api/snippets_controller.rb +0 -52
- data/app/controllers/locomotive/api/theme_assets_controller.rb +0 -51
- data/app/controllers/locomotive/api/tokens_controller.rb +0 -36
- data/app/controllers/locomotive/api/translations_controller.rb +0 -51
- data/app/controllers/locomotive/api/version_controller.rb +0 -11
- data/spec/models/locomotive/editable_control_spec.rb +0 -79
- data/spec/models/locomotive/editable_file_spec.rb +0 -94
- data/spec/models/locomotive/editable_text_spec.rb +0 -219
- data/vendor/assets/images/select2-spinner.gif +0 -0
- data/vendor/assets/images/select2.png +0 -0
- 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
|