Skip to content
Snippets Groups Projects
Commit 927457f6 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

fix

parent 71e5ac40
No related branches found
No related tags found
No related merge requests found
class Server::BlocksController < Server::ApplicationController class Server::BlocksController < Server::ApplicationController
before_action :load_template, except: [:index]
def index def index
@templates = Communication::Block.template_kinds.keys @templates = Communication::Block.template_kinds.keys
breadcrumb breadcrumb
end end
def show def show
@template = params[:id]
@blocks = Communication::Block.send(@template)
breadcrumb breadcrumb
add_breadcrumb t("enums.communication.block.template_kind.#{@template}") add_breadcrumb t("enums.communication.block.template_kind.#{@template}")
end end
def resave def resave
@template = params[:id]
@blocks = Communication::Block.send(@template)
@blocks.find_each &:save @blocks.find_each &:save
redirect_to server_block_path(@template), notice: "#{@blocks.count} blocks saved" redirect_to server_block_path(@template), notice: "#{@blocks.count} blocks saved"
end end
protected protected
def load_template
@template = params[:id]
@blocks = Communication::Block.where(template_kind: @template)
end
def breadcrumb def breadcrumb
super super
add_breadcrumb Communication::Block.model_name.human(count: 2), server_blocks_path add_breadcrumb Communication::Block.model_name.human(count: 2), server_blocks_path
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment