Class: Kuppayam::ImagesController
- Inherits:
-
ResourceController
- Object
- ActionController::Base
- BaseController
- ResourceController
- Kuppayam::ImagesController
- Defined in:
- app/controllers/kuppayam/images_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #crop ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from ResourceHelper
#mark_as_featured, #remove_from_featured, #update_status
Methods included from ResourceViewHelper
#delete_link, #display_featurable_buttons, #display_featurable_links, #display_featured, #display_manage_buttons, #display_manage_links, #display_publishable_buttons, #display_publishable_links, #display_publishable_status, #display_readable_buttons, #display_readable_links, #display_readable_status, #display_thumbnail, #edit_link, #serial_number
Methods included from FilterHelper
#configure_filter_param_mapping, #configure_filters, #default_filter_param_mapping, #default_filter_settings, #default_filter_ui_settings, #filter_param_mapping, #filter_settings, #filter_ui_settings, #generate_short_url_filters, #parse_boolean_filter_from_params, #parse_filter_from_variable, #parse_filters, #parse_from_and_to_year_filters, #parse_reference_filter_from_params, #parse_string_filter_from_params, #report_filter, #report_object_filter
Methods included from ImageHelper
#display_image, #edit_image, #image_url, #namify, #placeholdit, #remove_image_link, #upload_image_link, #upload_multiple_image_link
Methods included from KuppayamHelper
#fa_icon, #paginate_kuppayam, #search_form_kuppayam
Methods included from BreadcrumbsHelper
#breadcrumb, #configure_breadcrumbs, #default_breadcrumbs_configuration
Methods included from NavigationHelper
#current_nav, #nav_active?, #nav_class, #nav_include?, #set_nav
Methods included from MetaTagsHelper
#dynamic_meta_tags, #meta_tags, #set_title, #title
Methods included from NotificationHelper
#configure_notification, #default_notification_configuration, #set_notification, #set_resource_notification
Methods included from FlashHelper
#flash_message, #get_flash_message, #set_flash_message
Methods included from RenderHelper
#handle_invalid_authenticity_token, #render_404, #render_accordingly, #render_or_redirect, #render_row, #render_show
Methods included from ParamsParserHelper
#add_query_params, #parse_filter_dates, #parse_pagination_params
Instance Method Details
#create ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/kuppayam/images_controller.rb', line 31 def create @image = @image_class.new get_image_configuration @image.imageable = @resource @image.image = params[:image] # @image.image_type = @image_class.name @image.save if @image.valid? ("Image has been created successfully", :success) render layout: "kuppayam/image_upload" end |
#crop ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'app/controllers/kuppayam/images_controller.rb', line 51 def crop @image = @image_class.find(params[:id]) @image.assign_attributes(permitted_params) @image.image = params[:image] @image.save ("Image has been cropped successfully", :success) render layout: "kuppayam/image_upload" end |
#destroy ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/kuppayam/images_controller.rb', line 60 def destroy @image = @r_object = @image_class.find(params[:id]) @id = @image.id if @image @image.destroy (I18n.t('success.deleted'), :success) set_notification(true, I18n.t('status.success'), I18n.t('success.deleted', item: "Image")) @destroyed = true else set_notification(false, I18n.t('status.error'), I18n.t('status.not_found', item: "Image")) end end |
#edit ⇒ Object
26 27 28 29 |
# File 'app/controllers/kuppayam/images_controller.rb', line 26 def edit @image = @image_class.find(params[:id]) get_image_configuration end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/kuppayam/images_controller.rb', line 7 def index get_collections end |
#new ⇒ Object
21 22 23 24 |
# File 'app/controllers/kuppayam/images_controller.rb', line 21 def new @image = @image_class.new(imageable: @resource) get_image_configuration end |
#show ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/kuppayam/images_controller.rb', line 11 def show @image = Image::Base.find(params[:id]) get_image_configuration @r_object = @image = Image::Base.find(params[:id]) unless @r_object set_notification(false, I18n.t('status.error'), I18n.t('status.not_found', item: "Image")) end render_accordingly end |
#update ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'app/controllers/kuppayam/images_controller.rb', line 42 def update @image = @image_class.find(params[:id]) get_image_configuration @image.image = params[:image] @image.save ("Image has been updated successfully", :success) render layout: "kuppayam/image_upload" end |