aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpl2016-11-20 14:26:38 +0100
committerjpl2016-11-20 14:26:38 +0100
commit31e0170480c68744a61e7211b5b7c7a5f1259096 (patch)
tree06148cd210a96cb617dfb49b6e199d98aad9ae8c
parent648b07edfa35ddc8ecaf4f9b3eea84b92b2e40a2 (diff)
downloadchouette-core-31e0170480c68744a61e7211b5b7c7a5f1259096.tar.bz2
Refs #1995: update route#new & route#edit
-rw-r--r--app/assets/javascripts/es6_browserified/components/BSelect2.js1
-rw-r--r--app/assets/javascripts/es6_browserified/components/Todo.js90
-rw-r--r--app/assets/javascripts/es6_browserified/containers/AddTodo.js1
-rw-r--r--app/views/referential_lines/_reflines_routes.html.slim59
-rw-r--r--app/views/referential_lines/show.html.slim21
-rw-r--r--app/views/routes/_form.html.slim33
-rw-r--r--config/locales/routes.en.yml6
-rw-r--r--config/locales/routes.fr.yml46
8 files changed, 122 insertions, 135 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/views/referential_lines/_reflines_routes.html.slim b/app/views/referential_lines/_reflines_routes.html.slim
index 43cc908b4..de4f707c6 100644
--- a/app/views/referential_lines/_reflines_routes.html.slim
+++ b/app/views/referential_lines/_reflines_routes.html.slim
@@ -1,30 +1,33 @@
-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
+- if @routes.any?
+ h3 = t('.itineraries')
+
+ 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é"
- = link_to edit_referential_line_route_path(@referential, @line, route), class: 'btn btn-default' do
- span.fa.fa-pencil
+ 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
+ = 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 07143488b..85dc2756d 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/routes/_form.html.slim b/app/views/routes/_form.html.slim
index 3dd813fc2..9073d59b6 100644
--- a/app/views/routes/_form.html.slim
+++ b/app/views/routes/_form.html.slim
@@ -1,46 +1,21 @@
= 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 :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/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'