Class: IshLibEngine::Manager::GalleriesController
- Inherits:
-
Manager::ManagerController
- Object
- Manager::ManagerController
- IshLibEngine::Manager::GalleriesController
- Defined in:
- app/controllers/ish_lib_engine/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
Instance Method Details
#create ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/ish_lib_engine/manager/galleries_controller.rb', line 28 def create @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 = Tag.list render :action => 'new' end end |
#destroy ⇒ Object
69 70 71 72 73 74 75 |
# File 'app/controllers/ish_lib_engine/manager/galleries_controller.rb', line 69 def destroy @gallery = Gallery.unscoped.find params[:id] @gallery.is_trash = true @gallery.save flash[:notice] = 'Logically deleted gallery.' redirect_to manager_galleries_title_path end |
#edit ⇒ Object
47 48 49 |
# File 'app/controllers/ish_lib_engine/manager/galleries_controller.rb', line 47 def edit @gallery = Gallery.unscoped.find params[:id] end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/ish_lib_engine/manager/galleries_controller.rb', line 6 def index redirect_to manager_galleries_thumb_path end |
#index_mini ⇒ Object
18 19 20 |
# File 'app/controllers/ish_lib_engine/manager/galleries_controller.rb', line 18 def index_mini @galleries = Gallery.all end |
#index_thumb ⇒ Object
14 15 16 |
# File 'app/controllers/ish_lib_engine/manager/galleries_controller.rb', line 14 def index_thumb @galleries = Gallery.unscoped.where( :is_trash => false ).order_by( :created_at => :desc ).page( params[:galleries_page] ).per( 10 ) end |
#index_title ⇒ Object
10 11 12 |
# File 'app/controllers/ish_lib_engine/manager/galleries_controller.rb', line 10 def index_title @galleries = Gallery.unscoped.where( :is_trash => false ).order_by( :created_at => :desc ) end |
#new ⇒ Object
22 23 24 25 26 |
# File 'app/controllers/ish_lib_engine/manager/galleries_controller.rb', line 22 def new @gallery = Gallery.new @cities_list = City.list = Tag.list end |
#show ⇒ Object
64 65 66 67 |
# File 'app/controllers/ish_lib_engine/manager/galleries_controller.rb', line 64 def show @gallery = Gallery.unscoped.find params[:id] @photos = @gallery.photos.unscoped.where({ :is_trash => false }) end |
#update ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/ish_lib_engine/manager/galleries_controller.rb', line 51 def update @gallery = Gallery.unscoped.find params[:id] 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 |