aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/forms.coffee5
-rw-r--r--app/assets/stylesheets/_layout.sass2
-rw-r--r--app/assets/stylesheets/components/_forms.sass34
-rw-r--r--app/assets/stylesheets/components/_page_header.sass4
-rw-r--r--app/helpers/newapplication_helper.rb4
-rw-r--r--app/views/referentials/_form.html.slim117
-rw-r--r--app/views/referentials/_period_fields.html.slim11
-rw-r--r--app/views/referentials/new.html.slim13
-rw-r--r--config/initializers/simple_form_bootstrap.rb4
-rw-r--r--config/locales/referentials.fr.yml4
-rw-r--r--spec/features/referentials_spec.rb2
11 files changed, 100 insertions, 100 deletions
diff --git a/app/assets/javascripts/forms.coffee b/app/assets/javascripts/forms.coffee
index 49858eb52..153a53c66 100644
--- a/app/assets/javascripts/forms.coffee
+++ b/app/assets/javascripts/forms.coffee
@@ -3,4 +3,9 @@
$(this).siblings().removeClass 'open'
$(this).toggleClass 'open'
+@submitMover = ->
+ $('.formSubmitr').appendTo('.page-action')
+
+
$(document).on 'ready page:load', togglableFilter
+$(document).on 'ready page:load', submitMover
diff --git a/app/assets/stylesheets/_layout.sass b/app/assets/stylesheets/_layout.sass
index 0a5006333..6186d5ca1 100644
--- a/app/assets/stylesheets/_layout.sass
+++ b/app/assets/stylesheets/_layout.sass
@@ -20,4 +20,4 @@ body
padding: 40px 35px 0 35px
.page_content
- padding: 20px 35px 0 35px
+ padding: 20px 35px 20px 35px
diff --git a/app/assets/stylesheets/components/_forms.sass b/app/assets/stylesheets/components/_forms.sass
index ed070146f..659aa04a8 100644
--- a/app/assets/stylesheets/components/_forms.sass
+++ b/app/assets/stylesheets/components/_forms.sass
@@ -2,6 +2,12 @@
// FORMS //
//-------//
+.page_content
+ > .container-fluid > .row > [class*='col']
+ > form
+ margin-top: 15px
+ margin-bottom: 15px
+
.control-label.required
abbr[title], abbr[data-original-title]
border: none
@@ -319,14 +325,14 @@ $cbx-size: 20px
border-radius: 0
border-right: none
border-left: none
- width: 45%
+ width: 40%
&:first-child
border-top-left-radius: 4px
border-bottom-left-radius: 4px
border-left: 1px solid #ccc
border-right: 1px dashed #ccc
- width: 20%
+ width: 25%
&:last-child
border-top-right-radius: 4px
@@ -334,3 +340,27 @@ $cbx-size: 20px
border-right: 1px solid #ccc
border-left: 1px dashed #ccc
width: 35%
+
+// Nested fields
+.nested-fields
+ margin: 0 0 15px 0
+ padding: 15px
+ border: 1px solid #ccc
+ border-radius: 4px
+
+ .form-group
+ margin-left: 0
+ margin-right: 0
+ margin-bottom: 5px
+
+ .control-label
+ text-align: left
+ margin-bottom: 5px
+ padding: 0
+
+ .remove_fields
+ margin-top: 24px
+
+.nested-linker
+ margin: 0 0 15px 0
+ text-align: right
diff --git a/app/assets/stylesheets/components/_page_header.sass b/app/assets/stylesheets/components/_page_header.sass
index f94d886ca..9329b2171 100644
--- a/app/assets/stylesheets/components/_page_header.sass
+++ b/app/assets/stylesheets/components/_page_header.sass
@@ -2,6 +2,10 @@
background-color: $blue
color: #fff
+ .container-fluid > .row:first-child
+ &:last-child
+ margin-bottom: 15px
+
.page-icon
display: inline-block
vertical-align: middle
diff --git a/app/helpers/newapplication_helper.rb b/app/helpers/newapplication_helper.rb
index 18e0cb393..c13d64197 100644
--- a/app/helpers/newapplication_helper.rb
+++ b/app/helpers/newapplication_helper.rb
@@ -197,7 +197,7 @@ module NewapplicationHelper
end
# PageHeader builder
- def pageheader pageicon, pagetitle, desc, meta, mainaction = nil, &block
+ def pageheader pageicon, pagetitle, desc = nil, meta = nil, mainaction = nil, &block
firstRow = content_tag :div, '', class: 'row' do
# Left part with pageicon & pagetitle & desc
@@ -214,7 +214,7 @@ module NewapplicationHelper
# Right part with meta & mainaction
right = content_tag :div, '', class: 'col-lg-3 col-md-4 col-sm-5 col-xs-5 text-right' do
content_tag :div, '', class: 'page-action' do
- a = content_tag :div, meta.html_safe, class: 'small'
+ a = content_tag :div, meta.try(:html_safe), class: 'small'
b = mainaction.try(:html_safe)
a + b
diff --git a/app/views/referentials/_form.html.slim b/app/views/referentials/_form.html.slim
index 5b0c0d3c3..74d001da1 100644
--- a/app/views/referentials/_form.html.slim
+++ b/app/views/referentials/_form.html.slim
@@ -1,69 +1,31 @@
-= simple_form_for @referential, class: 'form' do |form|
- .row
- .col-lg-8.col-md-8.col-sm-8.col-xs-8
- = form.input :name
-
- - if @referential.new_record?
- - if @referential.created_from
- .col-lg-4.col-md-4.col-sm-4.col-xs-4
- = form.input :slug, :input_html => { title: t("formtastic.titles.referential.slug") }
-
- - else
- .col-lg-4.col-md-4.col-sm-4.col-xs-4
- = form.input :slug, :input_html => { title: t("formtastic.titles.referential.slug") }
-
- - else
- - if @referential.created_from
- .col-lg-4.col-md-4.col-sm-4.col-xs-4
- label.control-label = @referential.human_attribute_name('slug')
- br
- = @referential.slug
-
- - else
- .col-lg-4.col-md-4.col-sm-4.col-xs-4
- label.control-label = @referential.human_attribute_name('slug')
- br
- = @referential.slug
-
- .row
- - if @referential.new_record?
- - if @referential.created_from
- .col-lg-6.col-md-6.col-sm-6.col-xs-6
- = form.input :created_from, disabled: true, input_html: { value: Referential.find(@referential.created_from_id).name }
- = form.input :created_from_id, as: :hidden
-
- .col-lg-6.col-md-6.col-sm-6.col-xs-6
- = form.input :prefix, input_html: { title: t("formtastic.titles.referential.prefix") }
-
- - else
- .col-lg-12.col-md-12.col-sm-12.col-xs-12
- = form.input :prefix, input_html: { title: t("formtastic.titles.referential.prefix") }
-
- - else
- - if @referential.created_from
- .col-lg-6.col-md-6.col-sm-6.col-xs-6
- label.control-label = @referential.human_attribute_name('created_from')
- br
- = @referential.created_from.name
-
- .col-lg-6.col-md-6.col-sm-6.col-xs-6
- = form.input :prefix, input_html: { title: t("formtastic.titles.referential.prefix") }
-
- - else
- .col-lg-12.col-md-12.col-sm-12.col-xs-12
- = form.input :prefix, input_html: { title: t("formtastic.titles.referential.prefix") }
-
- .row
- .col-lg-6.col-md-6.col-sm-6.col-xs-6
- = form.input :projection_type, as: :select, collection: Referential.available_srids
- .col-lg-6.col-md-6.col-sm-6.col-xs-6
- = form.input :time_zone
-
- .row style='margin-bottom:20px'
- .col-lg-6.col-md-6.col-sm-6.col-xs-6
- = form.input :upper_corner, input_html: {title: t("formtastic.titles.referential.upper_corner")}
- .col-lg-6.col-md-6.col-sm-6.col-xs-6
- = form.input :lower_corner, input_html: {title: t("formtastic.titles.referential.lower_corner")}
+= simple_form_for @referential, html: {class: 'form-horizontal'}, wrapper: :horizontal_form do |form|
+
+ = form.input :name
+
+ - if @referential.new_record?
+ = form.input :slug, input_html: { title: t('formtastic.titles.referential.slug') }
+ - else
+ = form.input :slug, disabled: true, input_html: { title: t('formtastic.titles.referential.slug') }
+
+ - if @referential.new_record?
+ - if @referential.created_from
+ = form.input :created_from, disabled: true, input_html: { value: Referential.find(@referential.created_from_id).name }
+ .hidden = form.input :created_from_id, as: :hidden
+
+ = form.input :prefix, input_html: { title: t("formtastic.titles.referential.prefix") }
+
+ - else
+ - if @referential.created_from
+ = form.input :created_from, disabled: true, input_html: { value: Referential.find(@referential.created_from_id).name }
+
+ = form.input :prefix, input_html: { title: t("formtastic.titles.referential.prefix") }
+
+ = form.input :projection_type, as: :select, collection: Referential.available_srids
+ = form.input :time_zone
+
+
+ = form.input :upper_corner, input_html: {title: t("formtastic.titles.referential.upper_corner")}
+ = form.input :lower_corner, input_html: {title: t("formtastic.titles.referential.lower_corner")}
- if @referential.errors.has_key? :metadatas
.row
@@ -71,23 +33,18 @@
.alert.alert-danger
- @referential.errors[:metadatas].each do |msg|
p.small = "- #{msg}"
+
= form.simple_fields_for :metadatas do |subform|
= subform.simple_fields_for :periods do |period_form|
- .row
- = render 'period_fields', f: period_form
+ = render 'period_fields', f: period_form
+
+ .links.nested-linker
+ = link_to_add_association 'Ajouter une période', subform, :periods, class: 'btn btn-primary'
- .row style='margin-top:20px'
- .links.pull-right style='margin-right:15px'
- = link_to_add_association 'Ajouter une période', subform, :periods, class: 'btn btn-primary'
+ = subform.input :lines, as: :select, collection: @referential.workbench.lines.includes(:company).order(:name), selected: subform.object.line_ids, label_method: :display_name, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': 'Sélection de lignes', 'multiple': 'multiple', style: 'width: 100%' }
- .row style='margin-top:20px'
- .col-lg-8.col-md-12.col-sm-12.col-xs-12
- = subform.input :lines, as: :select, collection: @referential.workbench.lines.includes(:company).order(:name), selected: subform.object.line_ids, label_method: :display_name, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': 'Sélection de lignes', 'multiple': 'multiple', style: 'width: 100%' }
+ .hidden = form.input :workbench_id, as: :hidden
- = form.input :workbench_id, as: :hidden
- / Actions
- .row
- .col-lg-12.text-center
- = link_to 'Annuler', @referential, class: 'btn btn-link'
- = form.button :submit, class: 'btn btn-danger'
+ / = link_to 'Annuler', @referential, class: 'btn btn-link'
+ = form.button :submit, 'Enregistrer', class: 'btn btn-default formSubmitr'
diff --git a/app/views/referentials/_period_fields.html.slim b/app/views/referentials/_period_fields.html.slim
index 6658cd4aa..557bdd46e 100644
--- a/app/views/referentials/_period_fields.html.slim
+++ b/app/views/referentials/_period_fields.html.slim
@@ -5,13 +5,12 @@
.alert.alert-danger
- f.object.errors[:base].each do |message|
p.small = message
+
.row
.col-lg-5.col-md-5.col-sm-5.col-xs-5
- = f.input :begin, as: :date, html5: true, input_html: { style: 'width: 100%' }
+ = f.input :begin, as: :date, wrapper_html: { class: 'date' }
.col-lg-5.col-md-5.col-sm-5.col-xs-5
- = f.input :end, as: :date, html5: true, input_html: { style: 'width: 100%' }
-
- .col-lg-2.col-md-2.col-sm-2.col-xs-2.text-right style='margin-top:23px'
- = link_to_remove_association f, class: 'btn btn-danger', data: { confirm: 'Etes-vous sûr(e) ?' } do
+ = f.input :end, as: :date, wrapper_html: { class: 'date' }
+ .col-lg-2.col-md-2.col-sm-2.col-xs-2
+ = link_to_remove_association f, class: 'btn btn-block btn-danger', data: { confirm: 'Etes-vous sûr(e) ?' } do
span.fa.fa-trash
-
diff --git a/app/views/referentials/new.html.slim b/app/views/referentials/new.html.slim
index 12b5e23c9..ab13ffcf1 100644
--- a/app/views/referentials/new.html.slim
+++ b/app/views/referentials/new.html.slim
@@ -1,5 +1,10 @@
-= title_tag t('.title')
+/ PageHeader
+= pageheader 'map-marker',
+ t('.title')
-.row
- .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-8.col-sm-offset-2
- == render 'form'
+/ PageContent
+.page_content
+ .container-fluid
+ .row
+ .col-lg-8.col-lg-offset-2
+ == render 'form'
diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb
index be0f4bf55..67dfe1ceb 100644
--- a/config/initializers/simple_form_bootstrap.rb
+++ b/config/initializers/simple_form_bootstrap.rb
@@ -58,9 +58,9 @@ SimpleForm.setup do |config|
b.optional :pattern
b.optional :min_max
b.optional :readonly
- b.use :label, class: 'col-sm-3 control-label'
+ b.use :label, class: 'col-sm-4 control-label'
- b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
+ b.wrapper tag: 'div', class: 'col-sm-8' do |ba|
ba.use :input, class: 'form-control'
ba.use :error, wrap_with: { tag: 'span', class: 'help-block small' }
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block small' }
diff --git a/config/locales/referentials.fr.yml b/config/locales/referentials.fr.yml
index 2eee9fafa..ab35f4024 100644
--- a/config/locales/referentials.fr.yml
+++ b/config/locales/referentials.fr.yml
@@ -22,8 +22,8 @@ fr:
validity_out_time_tables: "Calendriers échus"
validity_out_soon_time_tables: "Calendriers à échoir dans %{count} jours"
new:
- title: "Créer un nouveau jeu de données"
- submit: "Créer un jeu de données"
+ title: "Créer un nouveau JDD"
+ submit: "Enregistrer"
actions:
new: "Ajouter un jeu de données"
destroy_confirm: "Etes vous sûr de vouloir supprimer ce jeu de données ?"
diff --git a/spec/features/referentials_spec.rb b/spec/features/referentials_spec.rb
index 9d85dc1c1..65f895a9c 100644
--- a/spec/features/referentials_spec.rb
+++ b/spec/features/referentials_spec.rb
@@ -41,7 +41,7 @@ describe "Referentials", :type => :feature do
fill_in "Code", :with => "test"
fill_in "Point haut/droite de l'emprise par défaut", :with => "0.0, 0.0"
fill_in "Point bas/gauche de l'emprise par défaut", :with => "1.0, 1.0"
- click_button "Créer un(e) Jeu de Données"
+ click_button "Enregistrer"
expect(Referential.where(:name => "Test")).not_to be_nil
# CREATE SCHEMA