Merge pull request #19 from sgmap/clickable-links-in-champs-description
Add clickable links in champ description and use bootstrap layout for…
This commit is contained in:
commit
7bc6e67e15
16 changed files with 83 additions and 110 deletions
|
@ -1,4 +0,0 @@
|
||||||
exit
|
|
||||||
xit
|
|
||||||
xtei
|
|
||||||
cniuecniu
|
|
3
Gemfile
3
Gemfile
|
@ -119,11 +119,8 @@ end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
# Access an IRB console on exception pages or by using <%= console %> in views
|
# Access an IRB console on exception pages or by using <%= console %> in views
|
||||||
|
|
||||||
gem 'web-console'
|
gem 'web-console'
|
||||||
|
|
||||||
gem 'rack-handlers'
|
gem 'rack-handlers'
|
||||||
|
|
||||||
gem 'xray-rails'
|
gem 'xray-rails'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,6 @@ $(document).on('page:load', wysihtml5_active);
|
||||||
|
|
||||||
function wysihtml5_active (){
|
function wysihtml5_active (){
|
||||||
$('.wysihtml5').each(function(i, elem) {
|
$('.wysihtml5').each(function(i, elem) {
|
||||||
$(elem).wysihtml5({ toolbar:{ "fa": true, "link": false, "color": true }, "locale": "fr-FR" });
|
$(elem).wysihtml5({ toolbar:{ "fa": true, "link": false, "color": false }, "locale": "fr-FR" });
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -18,14 +18,6 @@ function action_type_de_champs() {
|
||||||
toggleErrorClass(this, validatePhone(val));
|
toggleErrorClass(this, validatePhone(val));
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#liste_champs input").on('focus', function () {
|
|
||||||
$("#description_" + this.id).slideDown();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#liste_champs input").on('blur', function () {
|
|
||||||
$("#description_" + this.id).slideUp();
|
|
||||||
});
|
|
||||||
|
|
||||||
address_type_init();
|
address_type_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,10 +144,6 @@ textarea#description {
|
||||||
max-width: 27px;
|
max-width: 27px;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.pagination {
|
div.pagination {
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
@ -7,9 +7,7 @@
|
||||||
.show-block {
|
.show-block {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
.body{
|
.body{
|
||||||
padding-left: 35px;
|
padding: 15px;
|
||||||
padding-right: 35px;
|
|
||||||
padding-bottom: 35px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,10 +132,3 @@
|
||||||
width: 160px;
|
width: 160px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.description_div {
|
|
||||||
margin-top: 5px;
|
|
||||||
margin-left: 5px;
|
|
||||||
color: dimgrey;
|
|
||||||
display: none;
|
|
||||||
}
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
.twitter-typeahead {
|
||||||
|
width: 100%; // http://stackoverflow.com/questions/17957513/extending-the-width-of-bootstrap-typeahead-to-match-input-field
|
||||||
|
}
|
||||||
|
|
||||||
.tt-menu {
|
.tt-menu {
|
||||||
padding: 8px 0;
|
padding: 8px 0;
|
||||||
|
|
|
@ -7,4 +7,9 @@ class ChampDecorator < Draper::Decorator
|
||||||
end
|
end
|
||||||
object.value
|
object.value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def description_with_links
|
||||||
|
description.gsub(URI.regexp, '<a target="_blank" href="\0">\0</a>').html_safe if description
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -15,7 +15,7 @@
|
||||||
= @dossier.procedure.libelle
|
= @dossier.procedure.libelle
|
||||||
|
|
||||||
-#TODO use form_for
|
-#TODO use form_for
|
||||||
= form_tag(url_for({controller: 'users/description', action: :create, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST', multipart: true) do
|
= form_tag(url_for({controller: 'users/description', action: :create, dossier_id: @dossier.id}), class: 'form', method: 'POST', multipart: true) do
|
||||||
-unless @champs.nil?
|
-unless @champs.nil?
|
||||||
#liste_champs
|
#liste_champs
|
||||||
=render partial: 'users/description/champs', locals:{private: false}
|
=render partial: 'users/description/champs', locals:{private: false}
|
||||||
|
|
|
@ -1,6 +1,2 @@
|
||||||
%h4{style:'margin-left:15px;'}
|
%input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
|
||||||
= champ.libelle
|
%input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
|
||||||
- if champ.mandatory?
|
|
||||||
= '*'
|
|
||||||
%input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
|
|
||||||
%input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
%label.radio-inline
|
%div
|
||||||
= radio_button_tag "champs['#{champ.id}']", "M.", champ.value == 'Mme' ? false : true
|
%label.radio-inline
|
||||||
Monsieur
|
= radio_button_tag "champs['#{champ.id}']", "M.", champ.value == 'Mme' ? false : true
|
||||||
|
Monsieur
|
||||||
|
|
||||||
%label.radio-inline
|
%label.radio-inline
|
||||||
= radio_button_tag "champs['#{champ.id}']", "Mme", champ.value == 'Mme'
|
= radio_button_tag "champs['#{champ.id}']", "Mme", champ.value == 'Mme'
|
||||||
Madame
|
Madame
|
|
@ -1,8 +1,2 @@
|
||||||
%h4{style:'margin-left:15px;'}
|
%input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
|
||||||
= champ.libelle
|
%input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
|
||||||
- if champ.mandatory?
|
|
||||||
= '*'
|
|
||||||
%input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
|
|
||||||
%input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
|
|
||||||
%div{style:'margin-left: 5%; margin-right: 5%; text-align: justify; text-justify: inter-word;'}
|
|
||||||
= champ.description.gsub(/\r\n/, '<br>').html_safe
|
|
||||||
|
|
|
@ -1,54 +1,55 @@
|
||||||
-champs.each do |champ|
|
- champs.decorate.each do |champ|
|
||||||
- if champ.order_place > order_place
|
- if champ.order_place > order_place
|
||||||
- if champ.type_champ == 'header_section'
|
- if champ.type_champ == 'header_section'
|
||||||
- break
|
- break
|
||||||
|
|
||||||
- unless champ.type_champ == 'checkbox' || champ.type_champ == 'engagement'
|
|
||||||
%h4
|
|
||||||
= champ.libelle
|
|
||||||
- if champ.mandatory?
|
|
||||||
= '*'
|
|
||||||
|
|
||||||
-if champ.type_champ == 'textarea'
|
|
||||||
=render partial: 'users/description/champs/textarea', locals: {champ: champ}
|
|
||||||
|
|
||||||
-elsif champ.type_champ == 'checkbox'
|
|
||||||
= render partial: 'users/description/champs/checkbox', locals: {champ: champ}
|
|
||||||
|
|
||||||
-elsif champ.type_champ == 'civilite'
|
|
||||||
=render partial: 'users/description/champs/civilite', locals: {champ: champ}
|
|
||||||
|
|
||||||
- elsif champ.type_champ == 'datetime'
|
|
||||||
=render partial: 'users/description/champs/datetime', locals: {champ: champ}
|
|
||||||
|
|
||||||
- elsif champ.type_champ == 'yes_no'
|
|
||||||
=render partial: 'users/description/champs/yes_no', locals: {champ: champ}
|
|
||||||
|
|
||||||
- elsif champ.type_champ == 'drop_down_list'
|
|
||||||
=render partial: 'users/description/champs/drop_down_list', locals: {champ: champ}
|
|
||||||
|
|
||||||
- elsif champ.type_champ == 'pays'
|
|
||||||
=render partial: 'users/description/champs/pays', locals: {champ: champ}
|
|
||||||
|
|
||||||
- elsif champ.type_champ == 'regions'
|
|
||||||
=render partial: 'users/description/champs/regions', locals: {champ: champ}
|
|
||||||
|
|
||||||
- elsif champ.type_champ == 'engagement'
|
|
||||||
=render partial: 'users/description/champs/engagement', locals: {champ: champ}
|
|
||||||
|
|
||||||
- elsif champ.type_champ == 'departements'
|
|
||||||
=render partial: 'users/description/champs/departements', locals: {champ: champ}
|
|
||||||
|
|
||||||
-else
|
|
||||||
%input.form-control{name:"champs['#{champ.id}']",
|
|
||||||
placeholder: champ.libelle,
|
|
||||||
id: "champs_#{champ.id}",
|
|
||||||
value: champ.value,
|
|
||||||
type: champ.type_champ,
|
|
||||||
'data-provide' => champ.data_provide,
|
|
||||||
'data-date-format' => champ.data_date_format}
|
|
||||||
|
|
||||||
- unless champ.description.empty? || champ.type_champ == 'engagement'
|
|
||||||
.row
|
.row
|
||||||
.col-lg-8.col-md-8.col-sm-8.col-xs-8{class: 'description_div', id:"description_champs_#{champ.id}"}
|
%div{ class: if champ.type_champ == 'textarea' || champ.type_champ == 'engagement' then 'col-md-12' else 'col-md-6' end }
|
||||||
= champ.description
|
.form-group
|
||||||
|
%label{ for: "champs_#{ champ.id }"}
|
||||||
|
= champ.libelle
|
||||||
|
- if champ.mandatory?
|
||||||
|
*
|
||||||
|
|
||||||
|
- if champ.type_champ == 'textarea'
|
||||||
|
= render partial: 'users/description/champs/textarea', locals: { champ: champ }
|
||||||
|
|
||||||
|
- elsif champ.type_champ == 'checkbox'
|
||||||
|
= render partial: 'users/description/champs/checkbox', locals: { champ: champ }
|
||||||
|
|
||||||
|
- elsif champ.type_champ == 'civilite'
|
||||||
|
= render partial: 'users/description/champs/civilite', locals: { champ: champ }
|
||||||
|
|
||||||
|
- elsif champ.type_champ == 'datetime'
|
||||||
|
= render partial: 'users/description/champs/datetime', locals: { champ: champ }
|
||||||
|
|
||||||
|
- elsif champ.type_champ == 'yes_no'
|
||||||
|
= render partial: 'users/description/champs/yes_no', locals: { champ: champ }
|
||||||
|
|
||||||
|
- elsif champ.type_champ == 'drop_down_list'
|
||||||
|
= render partial: 'users/description/champs/drop_down_list', locals: { champ: champ }
|
||||||
|
|
||||||
|
- elsif champ.type_champ == 'pays'
|
||||||
|
= render partial: 'users/description/champs/pays', locals: { champ: champ }
|
||||||
|
|
||||||
|
- elsif champ.type_champ == 'regions'
|
||||||
|
= render partial: 'users/description/champs/regions', locals: { champ: champ }
|
||||||
|
|
||||||
|
- elsif champ.type_champ == 'engagement'
|
||||||
|
= render partial: 'users/description/champs/engagement', locals: { champ: champ }
|
||||||
|
|
||||||
|
- elsif champ.type_champ == 'departements'
|
||||||
|
= render partial: 'users/description/champs/departements', locals: { champ: champ }
|
||||||
|
|
||||||
|
- else
|
||||||
|
%input.form-control{name:"champs['#{ champ.id }']",
|
||||||
|
placeholder: champ.libelle,
|
||||||
|
id: "champs_#{ champ.id }",
|
||||||
|
value: champ.value,
|
||||||
|
type: champ.type_champ,
|
||||||
|
'data-provide' => champ.data_provide,
|
||||||
|
'data-date-format' => champ.data_date_format}
|
||||||
|
|
||||||
|
- unless champ.description.empty?
|
||||||
|
%div{ id:"description_champs_#{ champ.id }", class: ('help-block' unless champ.type_champ == 'engagement') }
|
||||||
|
= champ.description_with_links
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
placeholder: champ.description,
|
placeholder: champ.description,
|
||||||
id: "champs_#{champ.id}",
|
id: "champs_#{champ.id}",
|
||||||
row: '6'}
|
row: '6'}
|
||||||
=champ.value
|
= champ.value
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
%label.radio-inline
|
%div
|
||||||
= radio_button_tag "champs['#{champ.id}']", "true", champ.value == 'true'
|
%label.radio-inline
|
||||||
Oui
|
= radio_button_tag "champs['#{champ.id}']", "true", champ.value == 'true'
|
||||||
|
Oui
|
||||||
|
|
||||||
%label.radio-inline
|
%label.radio-inline
|
||||||
= radio_button_tag "champs['#{champ.id}']", "false", champ.value == 'false'
|
= radio_button_tag "champs['#{champ.id}']", "false", champ.value == 'false'
|
||||||
Non
|
Non
|
Loading…
Reference in a new issue