Class: IshLibManager::GalleriesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshLibManager::GalleriesController
- Defined in:
- app/controllers/ish_lib_manager/galleries_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #index_mini ⇒ Object
- #index_thumb ⇒ Object
- #index_title ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/ish_lib_manager/galleries_controller.rb', line 33 def create :create, Gallery @gallery = Gallery.new(params[:gallery].permit(:name, :city, :tag, :is_public, :is_done, :is_feature)) @gallery.user = current_user @gallery.site = @site :create, @gallery if @gallery.save # expire_page :controller => 'galleries', :action => 'index', :domainname => @site.domain # expire_page :controller => 'sites', :action => 'show', :domainname => @site.domain flash[:notice] = 'Success' redirect_to manager_galleries_path else flash[:error] = 'No Luck. ' + @gallery.errors.inspect @cities_list = City.list @tags_list = Tag.list render :action => 'new' end end |
#destroy ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'app/controllers/ish_lib_manager/galleries_controller.rb', line 79 def destroy @gallery = Gallery.unscoped.find params[:id] :destroy, @gallery @gallery.is_trash = true @gallery.save flash[:notice] = 'Logically deleted gallery.' redirect_to manager_galleries_title_path end |
#edit ⇒ Object
53 54 55 56 |
# File 'app/controllers/ish_lib_manager/galleries_controller.rb', line 53 def edit @gallery = Gallery.unscoped.find params[:id] :edit, @gallery end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/ish_lib_manager/galleries_controller.rb', line 6 def index :index, Gallery redirect_to galleries_thumb_path end |
#index_mini ⇒ Object
21 22 23 24 |
# File 'app/controllers/ish_lib_manager/galleries_controller.rb', line 21 def index_mini :index, Gallery @galleries = Gallery.all end |
#index_thumb ⇒ Object
16 17 18 19 |
# File 'app/controllers/ish_lib_manager/galleries_controller.rb', line 16 def index_thumb :index, Gallery @galleries = Gallery.unscoped.where( :is_trash => false ).order_by( :created_at => :desc ).page( params[:galleries_page] ).per( 10 ) end |
#index_title ⇒ Object
11 12 13 14 |
# File 'app/controllers/ish_lib_manager/galleries_controller.rb', line 11 def index_title :index, Gallery @galleries = Gallery.unscoped.where( :is_trash => false ).order_by( :created_at => :desc ) end |
#new ⇒ Object
26 27 28 29 30 31 |
# File 'app/controllers/ish_lib_manager/galleries_controller.rb', line 26 def new :new, Gallery @gallery = Gallery.new @cities_list = City.list @tags_list = Tag.list end |
#show ⇒ Object
73 74 75 76 77 |
# File 'app/controllers/ish_lib_manager/galleries_controller.rb', line 73 def show @gallery = Gallery.unscoped.find params[:id] :show, @gallery @photos = @gallery.photos.unscoped.where({ :is_trash => false }) end |
#update ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/controllers/ish_lib_manager/galleries_controller.rb', line 58 def update @gallery = Gallery.unscoped.find params[:id] :update, @gallery if @gallery.update_attributes( params[:gallery].permit( :username, :name, :galleryname, :subhead, :descr, :lang, :is_trash, :is_public, :is_done, :is_feature, :tag_id, :city_id, :venue_id, :site_id, :user_id, :site_id ) ) flash[:notice] = 'Success.' redirect_to manager_galleries_path else flash[:error] = 'No Luck. ' + @gallery.errors render :action => :edit end end |