Class: CmsAdmin::SitesController
- Inherits:
-
BaseController
- Object
- BaseController
- CmsAdmin::SitesController
- Defined in:
- app/controllers/cms_admin/sites_controller.rb
Instance Method Summary collapse
Instance Method Details
#blank ⇒ Object
57 58 59 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 57 def blank render end |
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 20 def create @cms_site = CmsSite.new(params[:cms_site]) if @cms_site.authentication != 'LDAP' @cms_site.ldap_hostname = '' @cms_site.ldap_base_DN = '' @cms_site.ldap_uid = '' end if @cms_site.save redirect_to :controller => 'cms_admin/pages', :action => :new else flash[:error] = 'Not able to save setup' render :action => :new end end |
#destroy ⇒ Object
51 52 53 54 55 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 51 def destroy @cms_site.destroy flash[:notice] = 'Site deleted' redirect_to :action => :index end |
#edit ⇒ Object
16 17 18 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 16 def edit render end |
#new ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 6 def new if CmsSite.count > 0 flash[:error] = 'You can only have one site' redirect_to :action => :edit else @cms_site = CmsSite.new render end end |
#update ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 35 def update @cms_site.update_attributes(params[:cms_site]) if @cms_site.authentication != 'LDAP' @cms_site.ldap_hostname = '' @cms_site.ldap_base_DN = '' @cms_site.ldap_uid = '' end if @cms_site.save flash[:notice] = 'Site updated' redirect_to :action => :edit, :id => @cms_site else flash.now[:error] = 'Failed to update site' render :action => :edit end end |