Class: Workarea::Admin::ApplicationController
- Inherits:
-
Workarea::ApplicationController
- Object
- Workarea::ApplicationController
- Workarea::Admin::ApplicationController
show all
- Includes:
- Authentication, Authorization, CurrentRelease, Impersonation, Turbolinks::Controller, Publishing, Visiting
- Defined in:
- app/controllers/workarea/admin/application_controller.rb
Direct Known Subclasses
ActivitiesController, BookmarksController, BulkActionDeletionsController, BulkActionProductEditsController, BulkActionSequentialProductEditsController, BulkActionsController, CatalogCategoriesController, CatalogProductCopiesController, CatalogProductImagesController, CatalogProductsController, CatalogVariantsController, CategorizationsController, ChangesetsController, CommentsController, ConfigurationsController, ContentAssetsController, ContentBlockDraftsController, ContentBlocksController, ContentController, ContentEmailsController, ContentPagesController, ContentPresetsController, CreateCatalogCategoriesController, CreateCatalogProductsController, CreateContentPagesController, CreatePricingDiscountsController, CreateReleaseUndosController, CreateReleasesController, CreateSegmentsController, CreateUsersController, CustomEventsController, DashboardsController, DataFileExportsController, DataFileImportsController, DataFileTaxImportsController, DataFilesController, DirectUploadsController, EmailSignupsController, FeaturedProductsController, FulfillmentSkusController, FulfillmentTokensController, FulfillmentsController, GuestBrowsingsController, HelpAssetsController, HelpController, ImpersonationsController, InventorySkusController, JumpToController, NavigationMenusController, NavigationRedirectsController, NavigationTaxonsController, OrdersController, PaymentTransactionsController, PaymentsController, PricesController, PricingDiscountCodeListsController, PricingDiscountRedemptionsController, PricingDiscountsController, PricingOverridesController, PricingSkusController, ProductRulesController, RecommendationsController, ReleasablesController, ReleaseSessionsController, ReleasesController, ReportsController, SearchCustomizationsController, SearchSettingsController, SearchesController, SegmentOverridesController, SegmentRulesController, SegmentablesController, SegmentsController, ShippingServicesController, ShippingsController, StyleGuidesController, TaxCategoriesController, TaxRatesController, TimelineController, ToolbarController, TrashController, UnsubscribesController, UsersController
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Publishing
#allow_publishing!, #allow_publishing?, #set_publishing_options
Methods included from Visiting
#most_visited
Class Method Details
.wrap_in_view_model(model, options = {}) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/workarea/admin/application_controller.rb', line 26
def self.wrap_in_view_model(model, options = {})
prefixes = [
model.model_name.name.demodulize,
model.model_name.param_key.camelize
]
prefixes.each do |prefix|
begin
view_model_class_name = "Workarea::Admin::#{prefix}ViewModel"
klass = view_model_class_name.constantize
return klass.new(model, options)
rescue NameError
model
end
end
model
end
|
Instance Method Details
#current_user ⇒ Object
61
62
63
64
65
66
67
|
# File 'app/controllers/workarea/admin/application_controller.rb', line 61
def current_user
if impersonating? || admin_browsing_as_guest?
current_admin
else
super
end
end
|
#find_sort(klass) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
|
# File 'app/controllers/workarea/admin/application_controller.rb', line 49
def find_sort(klass)
result = params[:sort].presence || klass.sorts.first.to_s
klass.sorts.map do |sortable|
if sortable.to_s == result
return [sortable.field, sortable.direction]
end
end
[:created_at, :desc]
end
|
#wrap_in_view_model(*args) ⇒ Object
45
46
47
|
# File 'app/controllers/workarea/admin/application_controller.rb', line 45
def wrap_in_view_model(*args)
self.class.wrap_in_view_model(*args)
end
|