al compilar el sitio volver al sitio
This commit is contained in:
parent
d3f21dd150
commit
2c48730750
1 changed files with 19 additions and 22 deletions
|
@ -18,7 +18,6 @@ class SitesController < ApplicationController
|
|||
# No tenemos propiedades de un sitio aún, así que vamos al listado de
|
||||
# artículos
|
||||
def show
|
||||
site = find_site
|
||||
authorize site
|
||||
|
||||
redirect_to site_posts_path(site)
|
||||
|
@ -35,51 +34,47 @@ class SitesController < ApplicationController
|
|||
params: site_params)
|
||||
|
||||
if (@site = service.create).persisted?
|
||||
redirect_to site_path(@site)
|
||||
redirect_to site_posts_path(@site)
|
||||
else
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@site = find_site
|
||||
authorize @site
|
||||
SiteService.new(site: @site).build_deploys
|
||||
authorize site
|
||||
SiteService.new(site: site).build_deploys
|
||||
end
|
||||
|
||||
def update
|
||||
@site = find_site
|
||||
authorize @site
|
||||
authorize site
|
||||
|
||||
service = SiteService.new(site: @site, params: site_params,
|
||||
service = SiteService.new(site: site, params: site_params,
|
||||
usuarie: current_usuarie)
|
||||
|
||||
if service.update.valid?
|
||||
redirect_to site_path(@site)
|
||||
redirect_to site_posts_path(site)
|
||||
else
|
||||
render 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def enqueue
|
||||
site = find_site
|
||||
authorize site
|
||||
|
||||
# XXX: Convertir en una máquina de estados?
|
||||
DeployJob.perform_async site.id if site.enqueue!
|
||||
|
||||
redirect_to sites_path
|
||||
redirect_to site_posts_path(site)
|
||||
end
|
||||
|
||||
def reorder_posts
|
||||
@site = find_site
|
||||
authorize @site
|
||||
authorize site
|
||||
lang = params.require(:posts).require(:lang)
|
||||
|
||||
result = if params[:posts][:force].present?
|
||||
@site.reorder_collection! lang
|
||||
site.reorder_collection! lang
|
||||
else
|
||||
@site
|
||||
site
|
||||
.reorder_collection(lang, params.require(:posts).require(:order))
|
||||
end
|
||||
|
||||
|
@ -89,21 +84,19 @@ class SitesController < ApplicationController
|
|||
flash[:danger] = I18n.t('errors.posts.reorder')
|
||||
end
|
||||
|
||||
redirect_to site_posts_path @site
|
||||
redirect_to site_posts_path(site)
|
||||
end
|
||||
|
||||
def fetch
|
||||
@site = find_site
|
||||
authorize @site
|
||||
authorize site
|
||||
|
||||
@commits = @site.repository.commits
|
||||
@commits = site.repository.commits
|
||||
end
|
||||
|
||||
def merge
|
||||
@site = find_site
|
||||
authorize @site
|
||||
authorize site
|
||||
|
||||
if @site.repository.merge(current_usuarie)
|
||||
if site.repository.merge(current_usuarie)
|
||||
flash[:success] = I18n.t('sites.fetch.merge.success')
|
||||
else
|
||||
flash[:error] = I18n.t('sites.fetch.merge.error')
|
||||
|
@ -114,6 +107,10 @@ class SitesController < ApplicationController
|
|||
|
||||
private
|
||||
|
||||
def site
|
||||
@site ||= find_site
|
||||
end
|
||||
|
||||
def site_params
|
||||
params.require(:site)
|
||||
.permit(:name, :design_id, :licencia_id, :description, :title,
|
||||
|
|
Loading…
Reference in a new issue