aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haddad2017-04-28 12:04:53 +0200
committerXinhui2017-04-28 14:48:23 +0200
commit155ac7aeb717fc3c866cb07d0d565f6249e50d4a (patch)
treeacfef75f8b95f7ef036fe8e4685a1299385026f6
parente408bcc3a5cb3ba13d51d5993cb77cccdaf669b5 (diff)
downloadchouette-core-155ac7aeb717fc3c866cb07d0d565f6249e50d4a.tar.bz2
Add color style to timetable links in VJ
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js3
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js8
-rw-r--r--app/views/vehicle_journeys/show.rabl2
3 files changed, 7 insertions, 6 deletions
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js
index 7e4665e57..65576f094 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js
+++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js
@@ -297,7 +297,8 @@ const actions = {
timeTables.push({
objectid: tt.objectid,
comment: tt.comment,
- id: tt.id
+ id: tt.id,
+ color: tt.color
})
}
let vjasWithDelta = val.vehicle_journey_at_stops.map((vjas, i) => {
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js
index 49f0e6d18..d795d76e3 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js
+++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js
@@ -17,12 +17,12 @@ class VehicleJourney extends Component {
return bool
}
- timeTableURL(id) {
+ timeTableURL(tt) {
let refURL = window.location.pathname.split('/', 3).join('/')
- let ttURL = refURL + '/time_tables/' + id
+ let ttURL = refURL + '/time_tables/' + tt.id
return (
- <a href={ttURL} title='Voir le calendrier'><span className='fa fa-calendar'></span></a>
+ <a href={ttURL} title='Voir le calendrier'><span className='fa fa-calendar' style={{color: (tt.color ? tt.color : '')}}></span></a>
)
}
@@ -51,7 +51,7 @@ class VehicleJourney extends Component {
<div className='strong mb-xs'>{this.props.value.objectid ? this.props.value.objectid : '-'}</div>
<div>{this.props.value.journey_pattern.objectid}</div>
{this.props.value.time_tables.map((tt, i)=>
- <div key={i}>{this.timeTableURL(tt.id)}</div>
+ <div key={i}>{this.timeTableURL(tt)}</div>
)}
{(this.props.filters.policy['vehicle_journeys.edit'] == true) &&
diff --git a/app/views/vehicle_journeys/show.rabl b/app/views/vehicle_journeys/show.rabl
index 6b7608342..7db9b531d 100644
--- a/app/views/vehicle_journeys/show.rabl
+++ b/app/views/vehicle_journeys/show.rabl
@@ -19,7 +19,7 @@ child(:journey_pattern) do |journey_pattern|
end
child(:time_tables, :object_root => false) do |time_tables|
- attributes :id, :objectid, :comment
+ attributes :id, :objectid, :comment, :color
child(:calendar) do
attributes :id, :name, :date_ranges, :dates, :shared
end