Class: Alchemy::Admin::AttachmentsController
- Inherits:
-
ResourcesController
- Object
- ApplicationController
- BaseController
- BaseController
- ResourcesController
- Alchemy::Admin::AttachmentsController
- Includes:
- ArchiveOverlay, UploaderResponses
- Defined in:
- app/controllers/alchemy/admin/attachments_controller.rb
Constant Summary
Constants included from ResourceFilter
ResourceFilter::COMMON_SEARCH_FILTER_EXCLUDES
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
-
#show ⇒ Object
The resources controller renders the edit form as default for show actions.
- #update ⇒ Object
Methods included from ArchiveOverlay
Methods included from UploaderResponses
#failed_uploader_response, #successful_uploader_response
Methods inherited from ResourcesController
#edit, #new, #resource_handler
Methods included from ResourceName
#controller_path_array, #resource_array, #resource_model_name, #resource_name, #resources_name
Methods included from ResourcesHelper
#contains_relations?, #edit_resource_path, #new_resource_path, #render_attribute, #resource_attribute_field_options, #resource_has_tags, #resource_instance_variable, #resource_model, #resource_path, #resource_relations_names, #resource_scope, #resource_url_proxy, #resource_window_size, #resources_instance_variable, #resources_path
Methods inherited from BaseController
Methods included from Modules
included, #module_definition_for, register_module
Methods included from Alchemy::AbilityHelper
Methods included from ConfigurationMethods
#configuration, #multi_language?, #multi_site?, #prefix_locale?
Instance Method Details
#create ⇒ Object
46 47 48 49 |
# File 'app/controllers/alchemy/admin/attachments_controller.rb', line 46 def create = Attachment.create() handle_uploader_response(status: :created) end |
#destroy ⇒ Object
64 65 66 67 68 |
# File 'app/controllers/alchemy/admin/attachments_controller.rb', line 64 def destroy .destroy flash[:notice] = Alchemy.t("File deleted successfully", name: .name) redirect_to alchemy.(**search_filter_params) end |
#index ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/alchemy/admin/attachments_controller.rb', line 22 def index @query = Attachment.ransack(search_filter_params[:q]) @query.sorts = "name asc" if @query.sorts.empty? = @query.result if search_filter_params[:tagged_with].present? = .tagged_with(search_filter_params[:tagged_with]) end = .page(params[:page] || 1) .per(items_per_page) if end end |
#show ⇒ Object
The resources controller renders the edit form as default for show actions.
41 42 43 44 |
# File 'app/controllers/alchemy/admin/attachments_controller.rb', line 41 def show @assignments = ..joins(element: :page) render :show end |
#update ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/alchemy/admin/attachments_controller.rb', line 51 def update .update() if ["file"].present? handle_uploader_response(status: :accepted) else render_errors_or_redirect( , (search_filter_params), Alchemy.t("File successfully updated") ) end end |