Class: Storytime::Dashboard::SitesController
Instance Method Summary
collapse
#authenticate_user!, #current_user, #setup, #user_signed_in?
#current_storytime_site
#content_for, #content_for?, #view_context
Instance Method Details
#create ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'app/controllers/storytime/dashboard/sites_controller.rb', line 23
def create
@site = Site.new(site_params)
authorize @site
if @site.save_with_seeds(current_user)
redirect_to storytime.dashboard_url(host: @site.custom_domain), notice: I18n.t('flash.sites.create.success')
else
render :new
end
end
|
#destroy ⇒ Object
43
44
45
46
47
|
# File 'app/controllers/storytime/dashboard/sites_controller.rb', line 43
def destroy
authorize @site
@site.destroy
redirect_to storytime.dashboard_url(host: Storytime::Site.first.custom_domain), notice: t('flash.sites.destroy.success')
end
|
#edit ⇒ Object
18
19
20
21
|
# File 'app/controllers/storytime/dashboard/sites_controller.rb', line 18
def edit
authorize @site
render :site
end
|
#new ⇒ Object
13
14
15
16
|
# File 'app/controllers/storytime/dashboard/sites_controller.rb', line 13
def new
@site = Site.new
authorize @site
end
|
#update ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'app/controllers/storytime/dashboard/sites_controller.rb', line 34
def update
authorize @site
if @site.update(site_params)
render :site
else
render :site, status: 422
end
end
|