diff options
| author | Luc Donnet | 2016-11-20 16:11:17 +0100 |
|---|---|---|
| committer | Luc Donnet | 2016-11-20 16:11:17 +0100 |
| commit | 033676f30c687002aadb9555a3bd6c71fadd5b27 (patch) | |
| tree | 5161ea2c5a7b476c314da05c532e55243972f255 | |
| parent | fb8b8b292b09d29eb87b454cece5ec252776dc12 (diff) | |
| parent | 9f9a3627c25ca9e174d794fb80c391d4eb48b03e (diff) | |
| download | chouette-core-033676f30c687002aadb9555a3bd6c71fadd5b27.tar.bz2 | |
Merge branch 'master' of github.com:AF83/stif-boiv
| -rw-r--r-- | app/assets/javascripts/es6_browserified/components/BSelect2.js | 1 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/components/Todo.js | 90 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/containers/AddTodo.js | 1 | ||||
| -rw-r--r-- | app/models/chouette/route.rb | 1 | ||||
| -rw-r--r-- | app/views/referential_lines/_reflines_routes.html.slim | 62 | ||||
| -rw-r--r-- | app/views/referential_lines/show.html.slim | 21 | ||||
| -rw-r--r-- | app/views/referentials/_clean.html.slim | 4 | ||||
| -rw-r--r-- | app/views/routes/_form.html.slim | 41 | ||||
| -rw-r--r-- | app/views/workbenches/_referential.html.slim | 34 | ||||
| -rw-r--r-- | config/locales/clean_ups.en.yml | 6 | ||||
| -rw-r--r-- | config/locales/clean_ups.fr.yml | 6 | ||||
| -rw-r--r-- | config/locales/routes.en.yml | 6 | ||||
| -rw-r--r-- | config/locales/routes.fr.yml | 46 | ||||
| -rw-r--r-- | spec/features/routes_spec.rb | 7 |
14 files changed, 148 insertions, 178 deletions
diff --git a/app/assets/javascripts/es6_browserified/components/BSelect2.js b/app/assets/javascripts/es6_browserified/components/BSelect2.js index a78dc625f..ec0d130d2 100644 --- a/app/assets/javascripts/es6_browserified/components/BSelect2.js +++ b/app/assets/javascripts/es6_browserified/components/BSelect2.js @@ -53,6 +53,7 @@ class BSelect3 extends React.Component{ className='form-control form-control-link' href={origin + path + '/stop_areas/' + this.props.value.stoparea_id} title={"Voir l'arrêt '" + this.props.value.text + "'"} + style={{lineHeight: '22px', overflow: 'hidden'}} > {this.props.value.text} </a> diff --git a/app/assets/javascripts/es6_browserified/components/Todo.js b/app/assets/javascripts/es6_browserified/components/Todo.js index bf60a405e..2a670370f 100644 --- a/app/assets/javascripts/es6_browserified/components/Todo.js +++ b/app/assets/javascripts/es6_browserified/components/Todo.js @@ -2,59 +2,57 @@ var React = require('react') var PropTypes = require('react').PropTypes var BSelect2 = require('./BSelect2') -const Container = {display: 'table', tableLayout: 'fixed', width: '100%'} -const firstBlock = {display: 'table-cell', verticalAlign: 'middle', width: '55%'} -const secondBlock = {display: 'table-cell', verticalAlign: 'middle', textAlign: 'right'} -const thirdBlock = {display: 'table-cell', verticalAlign: 'middle', width: 125, textAlign: 'right'} - const Todo = (props) => { return ( - <div className='list-group-item' style={Container}> - <div style={firstBlock}> - <div style={{display: 'inline-block', width: '10%', verticalAlign: 'middle', textAlign: 'right'}}> - <span className='label label-default' style={{marginRight: 10}}>{props.value.stoparea_id}</span> - </div> + <div className='list-group-item'> + <div className='row'> + <div className='col-lg-5 col-md-5 col-sm-4 col-xs-5'> + <div style={{display: 'inline-block', width: '20%', verticalAlign: 'middle', textAlign: 'right'}}> + <span className='label label-default' style={{marginRight: 10}}>{props.value.stoparea_id}</span> + </div> - <div style={{display: 'inline-block', width: '90%', verticalAlign: 'middle'}}> - <BSelect2 id={'route_stop_points_' + props.id} value={props.value} onChange={props.onChange} index={props.index} /> - </div> - </div> - <div style={secondBlock}> - <div style={{display: 'inline-block', width: '100%', verticalAlign: 'middle'}}> - <select value={props.value.for_boarding} id="for_boarding" onChange={props.onSelectChange}> - <option value="forbidden">interdit</option> - <option value="normal">normal</option> - </select> - </div> - </div> - <div style={secondBlock}> - <div style={{display: 'inline-block', width: '100%', verticalAlign: 'middle'}}> - <select value={props.value.for_alighting} id="for_alighting" onChange={props.onSelectChange}> - <option value="forbidden">interdit</option> - <option value="normal">normal</option> - </select> + <div style={{display: 'inline-block', width: '80%', verticalAlign: 'middle'}}> + <BSelect2 id={'route_stop_points_' + props.id} value={props.value} onChange={props.onChange} index={props.index} /> + </div> </div> - </div> - <div style={thirdBlock}> - <div className='btn-group btn-group-sm'> - <div - className={'btn btn-primary' + (props.first ? ' disabled' : '')} - onClick={props.onMoveUpClick} - > - <span className='fa fa-arrow-up'></span> + <div className='col-lg-2 col-md-2 col-sm-2 col-xs-2'> + <div style={{display: 'inline-block', width: '100%', verticalAlign: 'middle'}}> + <select className='form-control' value={props.value.for_boarding} id="for_boarding" onChange={props.onSelectChange}> + <option value="forbidden">interdit</option> + <option value="normal">normal</option> + </select> </div> - <div - className={'btn btn-primary' + (props.last ? ' disabled' : '')} - onClick={props.onMoveDownClick} - > - <span className='fa fa-arrow-down'></span> + </div> + <div className='col-lg-2 col-md-2 col-sm-2 col-xs-2'> + <div style={{display: 'inline-block', width: '100%', verticalAlign: 'middle'}}> + <select className='form-control' value={props.value.for_alighting} id="for_alighting" onChange={props.onSelectChange}> + <option value="forbidden">interdit</option> + <option value="normal">normal</option> + </select> </div> - <div - className='btn btn-danger' - onClick={props.onDeleteClick} - > - <span className='fa fa-trash'></span> + </div> + + <div className='col-lg-3 col-md-3 col-sm-4 col-xs-3' style={{textAlign: 'right'}}> + <div className='btn-group btn-group-sm'> + <div + className={'btn btn-primary' + (props.first ? ' disabled' : '')} + onClick={props.onMoveUpClick} + > + <span className='fa fa-arrow-up'></span> + </div> + <div + className={'btn btn-primary' + (props.last ? ' disabled' : '')} + onClick={props.onMoveDownClick} + > + <span className='fa fa-arrow-down'></span> + </div> + <div + className='btn btn-danger' + onClick={props.onDeleteClick} + > + <span className='fa fa-trash'></span> + </div> </div> </div> </div> diff --git a/app/assets/javascripts/es6_browserified/containers/AddTodo.js b/app/assets/javascripts/es6_browserified/containers/AddTodo.js index 98904ec21..d0128f16d 100644 --- a/app/assets/javascripts/es6_browserified/containers/AddTodo.js +++ b/app/assets/javascripts/es6_browserified/containers/AddTodo.js @@ -9,6 +9,7 @@ let AddTodo = ({ dispatch }) => { e.preventDefault() dispatch(actions.addStop()) }}> + <label>Séquence d'arrêts</label> <button type="submit" className="btn btn-primary btn-xs pull-right"> <span className="fa fa-plus"></span> Ajouter un arrêt </button> diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb index 446eb5f70..d1e72de20 100644 --- a/app/models/chouette/route.rb +++ b/app/models/chouette/route.rb @@ -67,7 +67,6 @@ class Chouette::Route < Chouette::TridentActiveRecord # validates_presence_of :direction # validates_presence_of :wayback - validates :direction, inclusion: { in: self.direction.values } validates :wayback, inclusion: { in: self.wayback.values } before_destroy :dereference_opposite_route diff --git a/app/views/referential_lines/_reflines_routes.html.slim b/app/views/referential_lines/_reflines_routes.html.slim index 43cc908b4..77b350fa6 100644 --- a/app/views/referential_lines/_reflines_routes.html.slim +++ b/app/views/referential_lines/_reflines_routes.html.slim @@ -1,30 +1,34 @@ -table.table.table-bordered.table-hover - thead - tr - th.text-center = @routes.human_attribute_name(:name) - th.text-center = @routes.human_attribute_name(:published_name) - th.text-center = @routes.human_attribute_name(:wayback) - th.text-center = @routes.human_attribute_name(:opposite_route) - th.text-center = "Actions" - - - @routes.each do |route| - tr - td = truncate(route.name, length: 20) - td = route.published_name - td = route.wayback_text - td - - if route.opposite_route - = route.opposite_route.name - - else - = "Aucune séquence d'arrêts associée en sens opposé" - - td.text-center - .btn.btn-group.btn-group-sm - = link_to [@referential, @line, route], class: 'btn btn-default preview', title: "#{Chouette::Route.model_name.human.capitalize} #{route.name}" do - span.fa.fa-eye - - = link_to edit_referential_line_route_path(@referential, @line, route), class: 'btn btn-default' do - span.fa.fa-pencil +- if @routes.any? + h3 = "Itinéraires" - = link_to referential_line_route_path(@referential, @line, route), method: :delete, :data => {:confirm => t('routes.actions.destroy_confirm')}, class: 'btn btn-danger' do - span.fa.fa-trash-o + table.table.table-bordered.table-hover + thead + tr + th.text-center = @routes.human_attribute_name(:name) + th.text-center = @routes.human_attribute_name(:published_name) + th.text-center = @routes.human_attribute_name(:wayback) + th.text-center = @routes.human_attribute_name(:opposite_route) + th.text-center = "Actions" + + tbody + - @routes.each do |route| + tr + td = truncate(route.name, length: 20) + td = route.published_name + td = route.wayback_text + td + - if route.opposite_route + = route.opposite_route.name + - else + = "Aucune séquence d'arrêts associée en sens opposé" + + td.text-center + .btn.btn-group.btn-group-sm + = link_to [@referential, @line, route], class: 'btn btn-default preview', title: "#{Chouette::Route.model_name.human.capitalize} #{route.name}" do + span.fa.fa-eye + + = link_to edit_referential_line_route_path(@referential, @line, route), class: 'btn btn-default' do + span.fa.fa-pencil + + = link_to referential_line_route_path(@referential, @line, route), method: :delete, :data => {:confirm => t('routes.actions.destroy_confirm')}, class: 'btn btn-danger' do + span.fa.fa-trash-o diff --git a/app/views/referential_lines/show.html.slim b/app/views/referential_lines/show.html.slim index 0f7dea862..afb5903e0 100644 --- a/app/views/referential_lines/show.html.slim +++ b/app/views/referential_lines/show.html.slim @@ -17,33 +17,33 @@ h2 p label = "#{t('lines.index.color')} : " label.color style="#{number_style(@line)}" - = line_sticker(@line) + = " #{line_sticker(@line)}" p label = "#{@line.human_attribute_name(:network)} : " - if @line.network.nil? - = t('lines.index.unset') + = " #{t('lines.index.unset')}" - else - = link_to @line.network.name, [@referential, @line.network] + = link_to " #{@line.network.name}", [@referential, @line.network] p label = "#{@line.human_attribute_name(:company)} : " - if @line.company.nil? - = t('lines.index.unset') + = " #{t('lines.index.unset')}" - else - = link_to @line.company.name, [@referential, @line.company] + = link_to " #{@line.company.name}", [@referential, @line.company] p label = "#{@line.human_attribute_name('number')} : " - = @line.number + = " #{@line.number}" p label = "#{@line.human_attribute_name('published_name')} : " - = @line.published_name + = " #{@line.published_name}" p label = "#{@line.human_attribute_name('registration_number')} : " - = @line.registration_number + = " #{@line.registration_number}" p label = "#{@line.human_attribute_name('transport_mode')} : " @@ -122,11 +122,8 @@ h2 #flexible_service.col-md-6 p.after_map -h3.routes - = t('.itineraries') -.routes.paginated_content - / = paginated_content @routes, "routes/route" +.routes = render 'reflines_routes' - content_for :sidebar do diff --git a/app/views/referentials/_clean.html.slim b/app/views/referentials/_clean.html.slim index a962d5417..4064d77ae 100644 --- a/app/views/referentials/_clean.html.slim +++ b/app/views/referentials/_clean.html.slim @@ -1,7 +1,7 @@ #clean_up = semantic_form_for [@referential, CleanUp.new] do |form| = form.inputs do - = form.input :begin_date, as: :date_picker, :wrapper_html => { class: 'date', title: t('titles.clean_up.begin_date') } - = form.input :end_date, as: :date_picker, :wrapper_html => { class: 'date', title: t('titles.clean_up.end_date') } + = form.input :begin_date, as: :date_picker, label: t('titles.clean_up.begin_date'),:wrapper_html => { class: 'date', title: t('titles.clean_up.begin_date') } + = form.input :end_date, as: :date_picker, label: t('titles.clean_up.end_date'), :wrapper_html => { class: 'date', title: t('titles.clean_up.end_date') } = form.actions do = form.action :submit, as: :button, label: t('clean_ups.actions.clean_up') , :button_html => { data: { confirm: t('clean_ups.actions.confirm') } } diff --git a/app/views/routes/_form.html.slim b/app/views/routes/_form.html.slim index 3dd813fc2..b69b3faf2 100644 --- a/app/views/routes/_form.html.slim +++ b/app/views/routes/_form.html.slim @@ -1,46 +1,27 @@ += params[:controller] + = simple_form_for [@referential, @line, @route] do |f| .row - .col-lg-4.col-md-4.col-sm-4.col-xs-4 + .col-lg-6.col-md-6.col-sm-12.col-xs-12 = f.input :name - .col-lg-4.col-md-4.col-sm-4.col-xs-4 + .col-lg-6.col-md-6.col-sm-12.col-xs-12 = f.input :published_name - .col-lg-4.col-md-4.col-sm-4.col-xs-4 - = f.input :number .row - .col-lg-6.col-md-6.col-sm-5.col-xs-5 - = f.input :comment - .col-lg-6.col-md-6.col-sm-7.col-xs-7 + .col-lg-4.col-md-6.col-sm-8.col-xs-8 = f.input :opposite_route, collection: @line.routes.select { |r| r.id != @route.id } - - .row - .col-lg-4.col-md-4.col-sm-4.col-xs-4 - = f.input :direction, include_blank: false + + / .col-lg-4.col-md-4.col-sm-4.col-xs-4 + / = f.input :direction, include_blank: false + .col-lg-4.col-md-4.col-sm-4.col-xs-4 = f.input :wayback, include_blank: false - .col-lg-4.col-md-4.col-sm-4.col-xs-4 - = f.input :objectid, required: !@route.new_record?, input_html: { title: t("formtastic.titles#{format_restriction_for_locales(@referential)}.route.objectid") } - + .row style="margin-top:20px" .col-lg-12.col-md-12.col-sm-12.col-xs-12 #stop_points - / div.clearfix style="margin-bottom:5px" - / label style="margin:0" Arrêts - / .btn.btn-primary.btn-xs.pull-right data-event="add_stop_point" - / span.fa.fa-plus - / = " #{t('routes.actions.add_stop_point')}" - / - / = link_to_add_association f, :stop_points, class: 'btn btn-primary btn-xs pull-right' do - / span.fa.fa-plus - / = " #{t('routes.actions.add_stop_point')}" - / THIS IS BROKEN - / = link_to t('routes.actions.new_stop_point'), new_referential_stop_area_path(@referential), target: '_blank' - / - / .list-group - / = f.simple_fields_for :stop_points do |point| - / = render 'stop_point_fields', f: point - .row + .row style="margin-top:20px" .col-lg-12.col-md-12.col-sm-12.col-xs-12.text-right = link_to 'Annuler', :back, class: 'btn btn-link' = f.button :submit, class: 'btn btn-danger' diff --git a/app/views/workbenches/_referential.html.slim b/app/views/workbenches/_referential.html.slim deleted file mode 100644 index 7ea9c26f4..000000000 --- a/app/views/workbenches/_referential.html.slim +++ /dev/null @@ -1,34 +0,0 @@ -#index_item.panel.panel-default.referential - .panel-heading - .panel-title.clearfix - span.pull-right - .btn-group.btn-group-sm - = link_to edit_referential_path(referential), class: 'btn btn-default' do - span.fa.fa-pencil - - = link_to referential_path(referential), method: :delete, :data => {:confirm => t('referentials.actions.destroy_confirm')}, class: 'btn btn-danger' do - span.fa.fa-trash-o - - h5 - = link_to [@referential, referential], class: 'preview', title: "#{Referential.model_name.human.capitalize} #{referential.name}" do - span.name - = truncate(referential.name, :length => 30) - - div.panel-body id="referential_#{referential.id}" - p - = "#{referential.human_attribute_name('lines')} : " - span.lines_count - - p - = "#{referential.human_attribute_name('networks')} : " - span.networks_count - - p - = "#{referential.human_attribute_name('vehicle_journeys')} : " - span.vehicle_journeys_count - - p - = "#{referential.human_attribute_name('time_tables')} : " - span.time_tables_count - -= javascript_include_tag referential_path(referential, format: :js) diff --git a/config/locales/clean_ups.en.yml b/config/locales/clean_ups.en.yml index 77b11fec1..148362c35 100644 --- a/config/locales/clean_ups.en.yml +++ b/config/locales/clean_ups.en.yml @@ -16,3 +16,9 @@ en: clean_up: begin_date: "Begin date of clean up" end_date: "End date of clean up" + + formtastic: + titles: + clean_up: + begin_date: "Begin date of clean up" + end_date: "End date of clean up" diff --git a/config/locales/clean_ups.fr.yml b/config/locales/clean_ups.fr.yml index 096b78c89..cb0ce3f1a 100644 --- a/config/locales/clean_ups.fr.yml +++ b/config/locales/clean_ups.fr.yml @@ -16,3 +16,9 @@ fr: clean_up: begin_date: "Début date de la purge" end_date: "Fin date de la purge" + + formtastic: + titles: + clean_up: + begin_date: "Début date de la purge" + end_date: "Fin date de la purge" diff --git a/config/locales/routes.en.yml b/config/locales/routes.en.yml index b78feff0f..073294884 100644 --- a/config/locales/routes.en.yml +++ b/config/locales/routes.en.yml @@ -80,3 +80,9 @@ en: hub: route: objectid: "[prefix]:Route:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 8." + + # simpleform + helpers: + submit: + route: + create: 'Create route' diff --git a/config/locales/routes.fr.yml b/config/locales/routes.fr.yml index f80693b8b..74a07e0c0 100644 --- a/config/locales/routes.fr.yml +++ b/config/locales/routes.fr.yml @@ -1,29 +1,29 @@ fr: routes: actions: - new: "Ajouter une séquence d'arrêts" - edit: "Modifier cette séquence d'arrêts" + new: "Ajouter un itinéraire" + edit: "Modifier cet itinéraire" edit_boarding_alighting: "Contraintes de montée - descente" - destroy: "Supprimer cette séquence d'arrêts" - destroy_confirm: "Etes vous sûr de supprimer cette séquence d'arrêts ?" - export_kml: "Export KML de la séquence d'arrêts" - export_kml_all: "Export KML des séquences d'arrêts" - export_hub: "Export HUB de la séquence d'arrêts" - export_hub_all: "Export HUB des séquences d'arrêts" + destroy: "Supprimer cet itinéraire" + destroy_confirm: "Etes vous sûr de supprimer cet itinéraire ?" + export_kml: "Export KML de l'itinéraire" + export_kml_all: "Export KML des itinéraires" + export_hub: "Export HUB de l'itinéraire" + export_hub_all: "Export HUB des itinéraires" add_stop_point: "Ajouter un arrêt" new_stop_point: "Créer un arrêt pour l'ajouter" new: - title: "Ajouter une séquence d'arrêts" + title: "Ajouter un itinéraire" edit: - title: "Modifier la séquence d'arrêts %{route}" + title: "Modifier l'itinéraire %{route}" show: - title: "Séquence d'arrêts %{route} de la ligne %{line}" - stop_points: "Liste des arrêts de la séquence d'arrêts" + title: "Itinéraire %{route} de la ligne %{line}" + stop_points: "Liste des arrêts de l'itinéraire'" journey_patterns: "Liste des missions" - no_opposite_route: "Aucune séquence d'arrêts associée en sens opposé" + no_opposite_route: "Aucun itinéraire associé en sens opposé" undefined: "Non défini" index: - title: "Séquences d'arrêts" + title: "Itinéraires" selection: "Sélection" selection_all: "Tous" edit_boarding_alighting: @@ -36,14 +36,14 @@ fr: wayback: positive: "Aller" negative: "Retour" - opposite: "Séquence opposée" - no_opposite: "Pas de séquence opposée" + opposite: "Itinéraire opposé" + no_opposite: "Pas d'itinéraire opposé" activerecord: models: route: - zero: "séquence d'arrêts" - one: "séquence d'arrêts" - other: "séquences d'arrêts" + zero: "itinéraire" + one: "itinéraire" + other: "itinéraires" attributes: route: wayback: @@ -58,7 +58,7 @@ fr: comment: "Commentaire" direction: "Direction" wayback: "Sens" - opposite_route: "Séquence d'arrêts associée en sens opposé" + opposite_route: "Itinéraire associé en sens opposé" objectid: "Identifiant Neptune" object_version: "Version" creation_time: "Créé le" @@ -80,3 +80,9 @@ fr: hub: route: objectid: "[prefixe]:Route:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'. Longueur maximale de la clé unique = 8." + + # simpleform + helpers: + submit: + route: + create: 'Créer un itinéraire' diff --git a/spec/features/routes_spec.rb b/spec/features/routes_spec.rb index e76665b31..267e2597b 100644 --- a/spec/features/routes_spec.rb +++ b/spec/features/routes_spec.rb @@ -31,12 +31,11 @@ describe "Routes", :type => :feature do describe "from line's page, create a new route" do it "return to line's page that display new route" do visit referential_line_path(referential,line) - click_link "Ajouter une séquence d'arrêts" + click_link "Ajouter un itinéraire" fill_in "route_name", :with => "A to B" - fill_in "Indice", :with => "AB" - select 'Aller', :from => "route_direction" + # select 'Aller', :from => "route_direction" select 'Aller', :from => "route_wayback" - click_button("Créer un(e) séquence d'arrêts") + click_button("Créer un itinéraire") expect(page).to have_content("A to B") end end |
