Explication: style in edit page
This commit is contained in:
parent
d250cafccc
commit
fb2aef1810
5 changed files with 44 additions and 19 deletions
|
@ -23,6 +23,10 @@
|
|||
}
|
||||
|
||||
#liste_champ{
|
||||
.form-inline {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.show_inline {
|
||||
display: inline-block !important;
|
||||
}
|
||||
|
@ -30,4 +34,16 @@
|
|||
.form-group.drop_down_list{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.form-group {
|
||||
vertical-align: top;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.description {
|
||||
padding: 0;
|
||||
textarea {
|
||||
padding: 6px 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,19 @@ class TypeDeChampDecorator < Draper::Decorator
|
|||
delegate_all
|
||||
|
||||
def button_up params
|
||||
h.link_to '', params[:url], class: up_classes, id: "btn_up_#{params[:index]}", remote: true, method: :post if display_up_button?(params[:index], params[:private])
|
||||
h.link_to '', params[:url], class: up_classes,
|
||||
id: "btn_up_#{params[:index]}",
|
||||
remote: true,
|
||||
method: :post,
|
||||
style: display_up_button?(params[:index], params[:private]) ? '' : 'visibility: hidden;'
|
||||
end
|
||||
|
||||
def button_down params
|
||||
h.link_to '', params[:url], class: down_classes, id: "btn_down_#{params[:index]}", remote: true, method: :post if display_down_button?(params[:index], params[:private])
|
||||
h.link_to '', params[:url], class: down_classes,
|
||||
id: "btn_down_#{params[:index]}",
|
||||
remote: true,
|
||||
method: :post,
|
||||
style: display_down_button?(params[:index], params[:private]) ? '' : 'visibility: hidden;'
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -16,8 +16,8 @@ describe TypeDeChampDecorator do
|
|||
subject { type_de_champ_0.decorate }
|
||||
let(:button_up) { type_de_champ_.decorate }
|
||||
|
||||
it 'returns a button up' do
|
||||
expect(subject.button_up(params)).to be(nil)
|
||||
it 'hide a button up' do
|
||||
expect(subject.button_up(params)).to include('visibility: hidden')
|
||||
end
|
||||
it 'returns a button down' do
|
||||
expect(subject.button_down(params)).to match(/fa-chevron-down/)
|
||||
|
@ -45,11 +45,12 @@ describe TypeDeChampDecorator do
|
|||
it 'returns a button up' do
|
||||
expect(subject.button_up(params)).to match(/fa-chevron-up/)
|
||||
end
|
||||
it 'returns a button down' do
|
||||
expect(subject.button_down(params)).to be(nil)
|
||||
|
||||
it 'hide a button down' do
|
||||
expect(subject.button_down(params)).to include('visibility: hidden')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,8 +33,8 @@ describe 'admin/types_de_champ/show.html.haml', type: :view do
|
|||
end
|
||||
context 'when there is only one field in database' do
|
||||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 0) }
|
||||
it { expect(subject).not_to have_css('#btn_down_0') }
|
||||
it { expect(subject).not_to have_css('#btn_up_0') }
|
||||
it { expect(subject).to have_css('#btn_down_0[style*="visibility: hidden"]') }
|
||||
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
||||
it { expect(subject).not_to have_css('#btn_up_1') }
|
||||
it { expect(subject).not_to have_css('#btn_down_1') }
|
||||
end
|
||||
|
@ -42,9 +42,9 @@ describe 'admin/types_de_champ/show.html.haml', type: :view do
|
|||
let!(:type_de_champ_0) { create(:type_de_champ_public, procedure: procedure, order_place: 0) }
|
||||
let!(:type_de_champ_1) { create(:type_de_champ_public, procedure: procedure, order_place: 1) }
|
||||
it { expect(subject).to have_css('#btn_down_0') }
|
||||
it { expect(subject).not_to have_css('#btn_up_0') }
|
||||
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
||||
it { expect(subject).to have_css('#btn_up_1') }
|
||||
it { expect(subject).not_to have_css('#btn_down_1') }
|
||||
it { expect(subject).to have_css('#btn_down_1[style*="visibility: hidden"]') }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ describe 'admin/types_de_champ/show.html.haml', type: :view do
|
|||
|
||||
describe 'mandatory checkbox' do
|
||||
it 'no mandatory checkbox are present' do
|
||||
expect(subject).not_to have_css('.form-group.mandatory')
|
||||
expect(subject).to have_css('.form-group.mandatory[style*="visibility: hidden"]')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -41,8 +41,8 @@ describe 'admin/types_de_champ/show.html.haml', type: :view do
|
|||
end
|
||||
context 'when there is only one field in database' do
|
||||
let!(:type_de_champ_0) { create(:type_de_champ_private, procedure: procedure, order_place: 0) }
|
||||
it { expect(subject).not_to have_css('#btn_down_0') }
|
||||
it { expect(subject).not_to have_css('#btn_up_0') }
|
||||
it { expect(subject).to have_css('#btn_down_0[style*="visibility: hidden"]') }
|
||||
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
||||
it { expect(subject).not_to have_css('#btn_up_1') }
|
||||
it { expect(subject).not_to have_css('#btn_down_1') }
|
||||
end
|
||||
|
@ -50,10 +50,10 @@ describe 'admin/types_de_champ/show.html.haml', type: :view do
|
|||
let!(:type_de_champ_0) { create(:type_de_champ_private, procedure: procedure, order_place: 0) }
|
||||
let!(:type_de_champ_1) { create(:type_de_champ_private, procedure: procedure, order_place: 1) }
|
||||
it { expect(subject).to have_css('#btn_down_0') }
|
||||
it { expect(subject).not_to have_css('#btn_up_0') }
|
||||
it { expect(subject).to have_css('#btn_up_0[style*="visibility: hidden"]') }
|
||||
it { expect(subject).to have_css('#btn_up_1') }
|
||||
it { expect(subject).not_to have_css('#btn_down_1') }
|
||||
it { expect(subject).to have_css('#btn_down_1[style*="visibility: hidden"]') }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue