Adapt configuration email view to the new UI
This commit is contained in:
parent
759298ddfa
commit
9b66c894b2
5 changed files with 35 additions and 12 deletions
|
@ -2,6 +2,10 @@ module NewAdministrateur
|
|||
class MailTemplatesController < AdministrateurController
|
||||
include ActionView::Helpers::SanitizeHelper
|
||||
|
||||
def index
|
||||
@mail_templates = mail_templates
|
||||
end
|
||||
|
||||
def preview
|
||||
mail_template = find_mail_template_by_slug(params[:id])
|
||||
dossier = Dossier.new(id: '1', procedure: procedure)
|
||||
|
|
13
app/views/new_administrateur/mail_templates/index.html.haml
Normal file
13
app/views/new_administrateur/mail_templates/index.html.haml
Normal file
|
@ -0,0 +1,13 @@
|
|||
= render partial: 'new_administrateur/breadcrumbs',
|
||||
locals: { steps: [link_to('Démarches', admin_procedures_path),
|
||||
link_to("#{@procedure.libelle}", admin_procedure_path(@procedure)), "Configuration des emails"] }
|
||||
|
||||
.container
|
||||
- @mail_templates.each do |mail_template|
|
||||
.card
|
||||
.flex.justify-between
|
||||
%div
|
||||
.card-title= mail_template.class.const_get(:DISPLAYED_NAME)
|
||||
%p.notice= mail_template.class.const_get(:DISPLAYED_NAME) === 'Accusé de réception' ? 'Personnalisé' : 'Modèle standard'
|
||||
%div
|
||||
= link_to 'Modifier', edit_admin_procedure_mail_template_path(@procedure, mail_template.class.const_get(:SLUG)), class: 'button'
|
|
@ -189,7 +189,7 @@ Rails.application.routes.draw do
|
|||
delete :delete_notice
|
||||
end
|
||||
|
||||
resources :mail_templates, only: [:index, :edit, :update]
|
||||
resources :mail_templates, only: [:edit, :update]
|
||||
|
||||
put 'archive' => 'procedures#archive', as: :archive
|
||||
get 'publish_validate' => 'procedures#publish_validate', as: :publish_validate
|
||||
|
@ -394,7 +394,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
resources :mail_templates, only: [] do
|
||||
resources :mail_templates, only: [:index] do
|
||||
get 'preview', on: :member
|
||||
end
|
||||
|
||||
|
|
|
@ -6,16 +6,6 @@ describe Admin::MailTemplatesController, type: :controller do
|
|||
sign_in(procedure.administrateurs.first.user)
|
||||
end
|
||||
|
||||
describe 'GET index' do
|
||||
render_views
|
||||
|
||||
subject { get :index, params: { procedure_id: procedure.id } }
|
||||
|
||||
it { expect(subject.status).to eq 200 }
|
||||
it { expect(subject.body).to include("E-mails personnalisables") }
|
||||
it { expect(subject.body).to include(Mails::InitiatedMail::DISPLAYED_NAME) }
|
||||
end
|
||||
|
||||
describe 'PATCH update' do
|
||||
let(:mail_subject) { 'plop modif' }
|
||||
let(:mail_body) { 'plip modif' }
|
||||
|
|
|
@ -1,8 +1,24 @@
|
|||
describe NewAdministrateur::MailTemplatesController, type: :controller do
|
||||
render_views
|
||||
let(:procedure) { create :procedure }
|
||||
let(:initiated_mail) { Mails::InitiatedMail.default_for_procedure(procedure) }
|
||||
|
||||
let(:admin) { create(:administrateur) }
|
||||
|
||||
before do
|
||||
sign_in(procedure.administrateurs.first.user)
|
||||
end
|
||||
|
||||
describe 'GET index' do
|
||||
render_views
|
||||
|
||||
subject { get :index, params: { procedure_id: procedure.id } }
|
||||
|
||||
it { expect(subject.status).to eq 200 }
|
||||
it { expect(subject.body).to include("Configuration des emails") }
|
||||
it { expect(subject.body).to include(Mails::InitiatedMail::DISPLAYED_NAME) }
|
||||
end
|
||||
|
||||
describe '#preview' do
|
||||
let(:procedure) { create(:procedure, :with_logo, :with_service, administrateur: admin) }
|
||||
|
||||
|
|
Loading…
Reference in a new issue