Preview procedure logo on edit procedure page for admin
This commit is contained in:
parent
e6b5698008
commit
69f9c52b02
12 changed files with 37 additions and 40 deletions
|
@ -60,7 +60,7 @@ class Admin::ProceduresController < AdminController
|
|||
end
|
||||
|
||||
flash.notice = 'Préocédure modifiée'
|
||||
redirect_to admin_procedures_path
|
||||
redirect_to edit_admin_procedure_path(id: @procedure.id)
|
||||
end
|
||||
|
||||
def archive
|
||||
|
|
|
@ -36,7 +36,7 @@ class ProcedureLogoUploader < CarrierWave::Uploader::Base
|
|||
if Features.remote_storage
|
||||
filename = "#{model.class.to_s.underscore}-#{secure_token}.#{file.extension.downcase}"
|
||||
else
|
||||
filename = "logo.#{file.extension.downcase}"
|
||||
filename = "logo-#{secure_token}.#{file.extension.downcase}"
|
||||
end
|
||||
end
|
||||
filename
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
%h2.text-info
|
||||
=@procedure.libelle
|
||||
%br
|
||||
|
||||
%ul.nav.nav-tabs
|
||||
= render partial: 'admin/procedures/navbar', locals: {active: 'Accompagnateurs'}
|
||||
=render partial: 'admin/procedures/head', locals: {active: 'Accompagnateurs'}
|
||||
|
||||
#accompagnateur_form
|
||||
.row
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
%h2.text-info
|
||||
=@procedure.libelle
|
||||
%br
|
||||
|
||||
%ul.nav.nav-tabs
|
||||
= render partial: 'admin/procedures/navbar', locals: {active: 'Pieces'}
|
||||
=render partial: 'admin/procedures/head', locals: {active: 'Pieces'}
|
||||
|
||||
#piece_justificative_form
|
||||
= render 'form'
|
|
@ -1,9 +1,4 @@
|
|||
%h2.text-info
|
||||
=@procedure.libelle
|
||||
%br
|
||||
|
||||
%ul.nav.nav-tabs
|
||||
= render partial: 'admin/procedures/navbar', locals: {active: 'Prévisualisation'}
|
||||
=render partial: 'admin/procedures/head', locals: {active: 'Prévisualisation'}
|
||||
|
||||
#previsualisation
|
||||
=render 'users/description/show'
|
8
app/views/admin/procedures/_head.html.haml
Normal file
8
app/views/admin/procedures/_head.html.haml
Normal file
|
@ -0,0 +1,8 @@
|
|||
%h2.text-info
|
||||
-unless @procedure.logo.blank?
|
||||
= image_tag @procedure.logo, style: 'width: 30px'
|
||||
=@procedure.libelle
|
||||
%br
|
||||
|
||||
%ul.nav.nav-tabs
|
||||
= render partial: 'admin/procedures/navbar', locals: {active: active}
|
|
@ -14,7 +14,9 @@
|
|||
.row
|
||||
.col-md-6.col-lg-6
|
||||
%h4 Logo de la procédure
|
||||
= f.file_field(:logo, accept: 'image/png, image/jpg,image/jpeg')
|
||||
- unless @procedure.logo.blank?
|
||||
= image_tag @procedure.logo, {style: 'height: 40px; display: inline; margin-right: 6px', id: 'preview_procedure_logo'}
|
||||
= f.file_field(:logo, accept: 'image/png, image/jpg, image/jpeg', style: 'display:inline')
|
||||
|
||||
%div{style:'margin-top:5px'}
|
||||
%i
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
%h2.text-info
|
||||
=@procedure.libelle
|
||||
%br
|
||||
|
||||
%ul.nav.nav-tabs
|
||||
= render partial: 'navbar', locals: {active: 'Description'}
|
||||
= render partial: 'head', locals: {active: 'Description'}
|
||||
|
||||
#procedure_new.section.section-label
|
||||
= form_for @procedure, url: url_for({controller: 'admin/procedures', action: :update, id: @procedure.id}), multipart: true do |f|
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
#procedure_show
|
||||
%h2.text-info
|
||||
=@facade.procedure.libelle
|
||||
%br
|
||||
|
||||
%ul.nav.nav-tabs
|
||||
= render partial: 'navbar', locals: {active: 'Informations'}
|
||||
=render partial: 'head', locals: {active: 'Informations'}
|
||||
|
||||
= form_tag admin_procedure_archive_path(procedure_id: @facade.procedure.id, archive: !@facade.procedure.archived?), method: :put, style:'float: right; margin-top: 10px' do
|
||||
%button#archive.btn.btn-small.btn-default.text-info{type: :button}
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
%h2.text-info
|
||||
=@procedure.libelle
|
||||
%br
|
||||
|
||||
%ul.nav.nav-tabs
|
||||
= render partial: 'admin/procedures/navbar', locals: {active: 'Champs'}
|
||||
=render partial: 'admin/procedures/head', locals: {active: 'Champs'}
|
||||
|
||||
#liste_champ
|
||||
= render partial: 'form'
|
|
@ -192,7 +192,7 @@ describe Admin::ProceduresController, type: :controller do
|
|||
it { expect(subject.cadastre).to be_truthy }
|
||||
end
|
||||
|
||||
it { expect(subject).to redirect_to(admin_procedures_path) }
|
||||
it { expect(subject).to redirect_to(edit_admin_procedure_path id: procedure.id) }
|
||||
it { expect(flash[:notice]).to be_present }
|
||||
end
|
||||
|
||||
|
|
17
spec/views/admin/procedures/edit.html.haml_spec.rb
Normal file
17
spec/views/admin/procedures/edit.html.haml_spec.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'admin/procedures/edit.html.haml', type: :view do
|
||||
let(:logo) { Rack::Test::UploadedFile.new("./spec/support/files/logo_test_procedure.png", 'image/png') }
|
||||
let(:procedure) { create(:procedure, logo: logo) }
|
||||
|
||||
before do
|
||||
assign(:procedure, procedure)
|
||||
render
|
||||
end
|
||||
|
||||
context 'when procedure logo is present' do
|
||||
it 'display on the page' do
|
||||
expect(rendered).to have_selector('#preview_procedure_logo')
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue