Class: IshManager::SitesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::SitesController
- Defined in:
- app/controllers/ish_manager/sites_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #edit ⇒ Object
- #galleries ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #newsitem_delete ⇒ Object
- #reports ⇒ Object
- #show ⇒ Object
-
#trash ⇒ Object
not trash.
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/ish_manager/sites_controller.rb', line 35 def create :create, Site.new @site = Site.new params[:site].permit! if @site.save flash[:notice] = 'Success' else flash[:alert] = 'No Luck. ' + @site.errors.inspect end redirect_to sites_path end |
#edit ⇒ Object
25 26 27 28 |
# File 'app/controllers/ish_manager/sites_controller.rb', line 25 def edit @site = Site.unscoped.find params[:id] :update, @site end |
#galleries ⇒ Object
78 79 80 81 82 |
# File 'app/controllers/ish_manager/sites_controller.rb', line 78 def galleries @site = Site.find params[:site_id] :galleries_index, @site @galleries = @site.galleries.page( params[:galleries_page] ) end |
#index ⇒ Object
3 4 5 6 |
# File 'app/controllers/ish_manager/sites_controller.rb', line 3 def index :sites_index, ::Manager @site_groups = Site.where( :is_trash => false ).order_by( :lang => :desc ).group_by {|s|s.domain} end |
#new ⇒ Object
30 31 32 33 |
# File 'app/controllers/ish_manager/sites_controller.rb', line 30 def new :new, Site.new @site = Site.new end |
#newsitem_delete ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'app/controllers/ish_manager/sites_controller.rb', line 60 def newsitem_delete @site = Site.find params[:site_id] :update, @site n = @site.newsitems.find( params[:newsitem_id] ) n.delete @site.touch @site.save flash[:notice] = 'Probably successfully deleted a newsitem.' redirect_to site_path( @site.id ) end |
#reports ⇒ Object
71 72 73 74 75 76 |
# File 'app/controllers/ish_manager/sites_controller.rb', line 71 def reports @site = Site.find params[:site_id] :reports_index, @site @reports = @site.reports.page( params[:reports_page] ) render 'ish_manager/reports/index' end |
#show ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/ish_manager/sites_controller.rb', line 14 def show @site = Site.unscoped.find params[:id] :show, @site @galleries = @site.galleries.page( params[:galleries_page] ).per( 10 ) @reports = @site.reports.page( params[:reports_page] ).per( 10 ) @videos = @site.videos.page( params[:videos_page] ).per( 5 ) @tags = Tag.where( :site_id => @site.id, :parent_tag_id => nil ).page( params[:tags_page] ).per( 100 ) @features = @site.features.limit( @site.n_features ) # page( params[:features_page] ).per( 9 ) @newsitems = @site.newsitems.page( params[:newsitems_page] ).per( @site.newsitems_per_page ) end |
#trash ⇒ Object
not trash
9 10 11 12 |
# File 'app/controllers/ish_manager/sites_controller.rb', line 9 def trash @sites = Site.unscoped.where( :is_trash => true ).order_by( :domainname => :desc, :lang => :desc ) render :action => :index end |
#update ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/ish_manager/sites_controller.rb', line 46 def update @site = Site.unscoped.find params[:id] :update, @site params[:site][:private_user_emails] = params[:site][:private_user_emails].gsub(/\s+/m, ' ').strip.split(" ") if @site.update_attributes params[:site].permit! flash[:notice] = 'Success' else flash[:alert] = 'No Luck' end redirect_to sites_path end |