Include link to resource in the flash message

This commit is contained in:
Fernando Blat
2017-01-05 17:03:08 +01:00
parent 13c49c1f75
commit 1fbb10ff34
6 changed files with 19 additions and 19 deletions

View File

@@ -8,7 +8,7 @@ class Admin::Legislation::DraftVersionsController < Admin::Legislation::BaseCont
def create def create
if @draft_version.save if @draft_version.save
redirect_to admin_legislation_process_draft_versions_path, notice: t('admin.legislation.draft_versions.create.notice') redirect_to admin_legislation_process_draft_versions_path, notice: t('admin.legislation.draft_versions.create.notice', link: legislation_process_draft_version_path(@process, @draft_version).html_safe)
else else
flash.now[:error] = t('admin.legislation.draft_versions.create.error') flash.now[:error] = t('admin.legislation.draft_versions.create.error')
render :new render :new
@@ -17,7 +17,7 @@ class Admin::Legislation::DraftVersionsController < Admin::Legislation::BaseCont
def update def update
if @draft_version.update(draft_version_params) if @draft_version.update(draft_version_params)
redirect_to edit_admin_legislation_process_draft_version_path(@process, @draft_version), notice: t('admin.legislation.draft_versions.update.notice') redirect_to edit_admin_legislation_process_draft_version_path(@process, @draft_version), notice: t('admin.legislation.draft_versions.update.notice', link: legislation_process_draft_version_path(@process, @draft_version).html_safe)
else else
flash.now[:error] = t('admin.legislation.draft_versions.update.error') flash.now[:error] = t('admin.legislation.draft_versions.update.error')
render :edit render :edit

View File

@@ -9,7 +9,7 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
def create def create
if @process.save if @process.save
redirect_to edit_admin_legislation_process_path(@process), notice: t('admin.legislation.processes.create.notice') redirect_to edit_admin_legislation_process_path(@process), notice: t('admin.legislation.processes.create.notice', link: legislation_process_path(@process).html_safe)
else else
flash.now[:error] = t('admin.legislation.processes.create.error') flash.now[:error] = t('admin.legislation.processes.create.error')
render :new render :new
@@ -18,7 +18,7 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
def update def update
if @process.update(process_params) if @process.update(process_params)
redirect_to edit_admin_legislation_process_path(@process), notice: t('admin.legislation.processes.update.notice') redirect_to edit_admin_legislation_process_path(@process), notice: t('admin.legislation.processes.update.notice', link: legislation_process_path(@process).html_safe)
else else
flash.now[:error] = t('admin.legislation.processes.update.error') flash.now[:error] = t('admin.legislation.processes.update.error')
render :edit render :edit

View File

@@ -13,7 +13,7 @@ class Admin::Legislation::QuestionsController < Admin::Legislation::BaseControll
def create def create
@question.author = current_user @question.author = current_user
if @question.save if @question.save
redirect_to admin_legislation_process_questions_path, notice: t('admin.legislation.questions.create.notice') redirect_to admin_legislation_process_questions_path, notice: t('admin.legislation.questions.create.notice', link: legislation_process_question_path(@process, @question).html_safe)
else else
flash.now[:error] = t('admin.legislation.questions.create.error') flash.now[:error] = t('admin.legislation.questions.create.error')
render :new render :new
@@ -22,7 +22,7 @@ class Admin::Legislation::QuestionsController < Admin::Legislation::BaseControll
def update def update
if @question.update(question_params) if @question.update(question_params)
redirect_to edit_admin_legislation_process_question_path(@process, @question), notice: t('admin.legislation.questions.update.notice') redirect_to edit_admin_legislation_process_question_path(@process, @question), notice: t('admin.legislation.questions.update.notice', link: legislation_process_question_path(@process, @question).html_safe)
else else
flash.now[:error] = t('admin.legislation.questions.update.error') flash.now[:error] = t('admin.legislation.questions.update.error')
render :edit render :edit

View File

@@ -5,7 +5,7 @@
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<div class="notice-text"> <div class="notice-text">
<%= flash_message %> <%= flash_message.html_safe %>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -85,10 +85,10 @@ en:
legislation: legislation:
processes: processes:
create: create:
notice: Process created successfully notice: 'Process created successfully. <a href="%{link}">Click to visit</a>'
error: Process couldn't be created error: Process couldn't be created
update: update:
notice: Process updated successfully notice: 'Process updated successfully. <a href="%{link}">Click to visit</a>'
error: Process couldn't be updated error: Process couldn't be updated
destroy: destroy:
notice: Process deleted successfully notice: Process deleted successfully
@@ -132,10 +132,10 @@ en:
questions: Debate questions: Debate
draft_versions: draft_versions:
create: create:
notice: Draft created successfully notice: 'Draft created successfully. <a href="%{link}">Click to visit</a>'
error: Draft couldn't be created error: Draft couldn't be created
update: update:
notice: Draft updated successfully notice: 'Draft updated successfully. <a href="%{link}">Click to visit</a>'
error: Draft couldn't be updated error: Draft couldn't be updated
destroy: destroy:
notice: Draft deleted successfully notice: Draft deleted successfully
@@ -174,10 +174,10 @@ en:
status: Status status: Status
questions: questions:
create: create:
notice: Question created successfully notice: 'Question created successfully. <a href="%{link}">Click to visit</a>'
error: Question couldn't be created error: Question couldn't be created
update: update:
notice: Question updated successfully notice: 'Question updated successfully. <a href="%{link}">Click to visit</a>'
error: Question couldn't be updated error: Question couldn't be updated
destroy: destroy:
notice: Question deleted successfully notice: Question deleted successfully

View File

@@ -83,10 +83,10 @@ es:
legislation: legislation:
processes: processes:
create: create:
notice: Proceso creado correctamente notice: 'Proceso creado correctamente. <a href="%{link}">Haz click para verlo</a>'
error: No se ha podido crear el proceso error: No se ha podido crear el proceso
update: update:
notice: Proceso actualizado correctamente notice: 'Proceso actualizado correctamente. <a href="%{link}">Haz click para verlo</a>'
error: No se ha podido actualizar el proceso error: No se ha podido actualizar el proceso
destroy: destroy:
notice: Proceso eliminado correctamente notice: Proceso eliminado correctamente
@@ -130,10 +130,10 @@ es:
questions: Debate questions: Debate
draft_versions: draft_versions:
create: create:
notice: Borrador creado correctamente notice: 'Borrador creado correctamente. <a href="%{link}">Haz click para verlo</a>'
error: No se ha podido crear el borrador error: No se ha podido crear el borrador
update: update:
notice: Borrador actualizado correctamente notice: 'Borrador actualizado correctamente. <a href="%{link}">Haz click para verlo</a>'
error: No se ha podido actualizar el borrador error: No se ha podido actualizar el borrador
destroy: destroy:
notice: Borrador eliminado correctamente notice: Borrador eliminado correctamente
@@ -172,10 +172,10 @@ es:
status: Estado status: Estado
questions: questions:
create: create:
notice: Pregunta creada correctamente notice: 'Pregunta creada correctamente. <a href="%{link}">Haz click para verla</a>'
error: No se ha podido crear la pregunta error: No se ha podido crear la pregunta
update: update:
notice: Pregunta actualizada correctamente notice: 'Pregunta actualizada correctamente. <a href="%{link}">Haz click para verla</a>'
error: No se ha podido actualizar la pregunta error: No se ha podido actualizar la pregunta
destroy: destroy:
notice: Pregunta eliminada correctamente notice: Pregunta eliminada correctamente