Sha256: 6e94ee38fa75b5cd21cacb4bb3aa21f1c9eabe2b12821b2f15ad6f2eb983e0ca
Contents?: true
Size: 1.18 KB
Versions: 6
Compression:
Stored size: 1.18 KB
Contents
# -*- encoding : utf-8 -*- class RademadeAdmin::GalleryController < RademadeAdmin::AbstractController def upload gallery_service.upload_images(params[:gallery_id], params[:files]) render :json => { :gallery_images_html => gallery_service.gallery_images_html } rescue Exception => e show_error(e) end def crop uploader = gallery_service.crop_image(params[:id], params[:crop]) preview_service = RademadeAdmin::Upload::GalleryPreviewService.new render :json => { :crop_button_html => preview_service.crop_button_html(uploader), :gallery_image_url => preview_service.gallery_image_preview(uploader) } rescue Exception => e show_error(e) end def remove gallery_service.remove_image(params[:id]) render :json => { } rescue Exception => e show_error(e) end def sort gallery_service.sort_images(params[:images]) render :json => { } rescue Exception => e show_error(e) end private def show_error(error) render :json => { :error => error.to_s }, :status => :unprocessable_entity end def gallery_service @gallery_service ||= RademadeAdmin::Gallery::Manager.new(params[:class_name]) end end
Version data entries
6 entries across 6 versions & 1 rubygems