aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorThomas Haddad2017-01-04 11:10:15 +0100
committerThomas Haddad2017-01-04 11:10:15 +0100
commit9c08e8f9f42906f9be17a8fbce7fcd83dbd51179 (patch)
tree65e132910ffadab7534f4b5ad2257539f06b309b /app/views
parent9560056852d1d48767c5ed150bce4e3abffcca00 (diff)
parent66dc68487a6e8a826ec4d4ffcee2f34456488dea (diff)
downloadchouette-core-9c08e8f9f42906f9be17a8fbce7fcd83dbd51179.tar.bz2
Merge branch 'mission_redux'
Diffstat (limited to 'app/views')
-rw-r--r--app/views/api/v1/routes/short_description.rabl7
-rw-r--r--app/views/api/v1/stop_areas/short_description.rabl6
-rw-r--r--app/views/journey_patterns_collections/show.html.slim4
-rw-r--r--app/views/journey_patterns_collections/show.rabl3
-rw-r--r--app/views/journey_patterns_collections/update.rabl2
-rw-r--r--app/views/routes/_form.html.slim2
-rw-r--r--app/views/routes/show.html.slim35
7 files changed, 47 insertions, 12 deletions
diff --git a/app/views/api/v1/routes/short_description.rabl b/app/views/api/v1/routes/short_description.rabl
index ae149167d..900096ac5 100644
--- a/app/views/api/v1/routes/short_description.rabl
+++ b/app/views/api/v1/routes/short_description.rabl
@@ -5,3 +5,10 @@ extends "api/v1/trident_objects/short_description"
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
+child :stop_points => :stop_points do |stop_points|
+ node do |stop_point|
+ partial("api/v1/stop_areas/short_description", :object => stop_point.stop_area).merge(position: stop_point.position)
+ end
+end
+
+
diff --git a/app/views/api/v1/stop_areas/short_description.rabl b/app/views/api/v1/stop_areas/short_description.rabl
index 73627c5a1..fb0213510 100644
--- a/app/views/api/v1/stop_areas/short_description.rabl
+++ b/app/views/api/v1/stop_areas/short_description.rabl
@@ -1,10 +1,10 @@
object @stop_area
-extends "api/v1/trident_objects/short_description"
+extends "api/v1/trident_objects/short_description"
-[ :name, :area_type, :longitude, :latitude, :long_lat_type].each do |attr|
+[ :id, :name, :area_type, :longitude, :latitude, :long_lat_type].each do |attr|
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
node(:parent_object_id) do |stop_area|
- stop_area.parent.objectid
+ stop_area.parent.objectid
end unless root_object.parent.nil?
diff --git a/app/views/journey_patterns_collections/show.html.slim b/app/views/journey_patterns_collections/show.html.slim
new file mode 100644
index 000000000..7b6f7ae7a
--- /dev/null
+++ b/app/views/journey_patterns_collections/show.html.slim
@@ -0,0 +1,4 @@
+#journey_patterns
+= javascript_tag do
+ | window.journeyPatternLength = #{@journey_patterns.total_entries()}
+= javascript_include_tag 'es6_browserified/journey_patterns/index.js'
diff --git a/app/views/journey_patterns_collections/show.rabl b/app/views/journey_patterns_collections/show.rabl
new file mode 100644
index 000000000..c241a9c0e
--- /dev/null
+++ b/app/views/journey_patterns_collections/show.rabl
@@ -0,0 +1,3 @@
+collection @journey_patterns
+extends "api/v1/journey_patterns/show"
+
diff --git a/app/views/journey_patterns_collections/update.rabl b/app/views/journey_patterns_collections/update.rabl
new file mode 100644
index 000000000..13ced5655
--- /dev/null
+++ b/app/views/journey_patterns_collections/update.rabl
@@ -0,0 +1,2 @@
+collection @journey_patterns
+extends "api/v1/journey_patterns/show"
diff --git a/app/views/routes/_form.html.slim b/app/views/routes/_form.html.slim
index 9893e4ed7..ae07d41de 100644
--- a/app/views/routes/_form.html.slim
+++ b/app/views/routes/_form.html.slim
@@ -29,4 +29,4 @@
| window.itinerary_stop = "#{URI.escape(route_json_for_edit(@route))}"
/ StopPoints Reactux component
-= javascript_include_tag 'es6_browserified/stop_points.js'
+= javascript_include_tag 'es6_browserified/itineraries/stop_points.js'
diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim
index c914030c9..3f0e22006 100644
--- a/app/views/routes/show.html.slim
+++ b/app/views/routes/show.html.slim
@@ -63,14 +63,32 @@ p.after_map
div style='display: inline-block;width: 90%;vertical-align: middle;'
= linktxt
-/ .panel.panel-default
-/ .panel-heading
-/ h4.panel-title
-/ strong = t('.journey_patterns')
-/
-/ .panel-body
-/ .journey_patterns.paginated_content
-/ = paginated_content( @route.journey_patterns, "journey_patterns/journey_pattern")
+.panel.panel-default#journey_patterns
+ .panel-heading
+ h4.panel-title
+ strong = t('.journey_patterns')
+
+ .list-group
+ - @route.journey_patterns.each do |journey_pattern|
+ .list-group-item.clearfix title="#{t('journey_patterns.journey_pattern.stop_count', count: journey_pattern.stop_points.count, route_count: @route.stop_points.count)} | #{t('journey_patterns.journey_pattern.vehicle_journeys_count', count: journey_pattern.vehicle_journeys.count)}"
+ span.label.label-default style='margin-right: 10px;' = journey_pattern.objectid.local_id
+ strong = "#{journey_name(journey_pattern)} "
+
+ - unless journey_pattern.stop_points.empty?
+ em.small
+ = t('journey_patterns.journey_pattern.from_to', departure: journey_pattern.stop_points.first.stop_area.name, arrival: journey_pattern.stop_points.last.stop_area.name)
+
+ .btn-group.btn-group-xs.pull-right
+ .btn.btn-primary.dropdown-toggle data-toggle='dropdown'
+ span.fa.fa-bars
+ span.caret
+ ul.dropdown-menu
+ li = link_to 'Voir', [@referential, @line, @route, journey_pattern], title: "#{Chouette::JourneyPattern.model_name.human.capitalize} #{journey_name(journey_pattern)}"
+ li = link_to 'Supprimer', referential_line_route_journey_pattern_path(@referential, @line, @route, journey_pattern), method: :delete, data: {confirm: t('journey_patterns.actions.destroy_confirm')}
+
+ / .panel-body
+ / .journey_patterns.paginated_content
+ / = paginated_content( @route.journey_patterns, "journey_patterns/journey_pattern")
- content_for :sidebar do
ul.actions
@@ -86,6 +104,7 @@ p.after_map
/ li = link_to t('routes.actions.edit_boarding_alighting'), edit_boarding_alighting_referential_line_route_path(@referential, @line, @route), class: 'edit'
- if @route.journey_patterns.size > 0
+ li = link_to t('journey_patterns.actions.edit_journey_patterns_collection'), [@referential, @line, @route, :journey_patterns_collection], class: 'edit'
li = link_to t('vehicle_journeys.actions.index'), [@referential, @line, @route, :vehicle_journeys], class: 'clock'
/ ul.actions