aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorThomas Haddad2017-03-09 18:06:30 +0100
committerThomas Haddad2017-03-09 18:06:30 +0100
commitf14fbad37c0daa0b79aaf12b234168e917b29cee (patch)
treee5149f670c704b5cc7b11f5063bad16125d8ae5e /app/views
parentf4c5751a4037f52ab1d73fc201e81ba07798ecd4 (diff)
parent3ec5c7bf65b267ce96431906feb6025cfbff347a (diff)
downloadchouette-core-f14fbad37c0daa0b79aaf12b234168e917b29cee.tar.bz2
Merge branch '2498_vehicle_journeys'
Diffstat (limited to 'app/views')
-rw-r--r--app/views/api/v1/journey_patterns/show.rabl2
-rw-r--r--app/views/autocomplete_time_tables/index.rabl2
-rw-r--r--app/views/journey_patterns/show.html.slim2
-rw-r--r--app/views/line_footnotes/show.rabl9
-rw-r--r--app/views/vehicle_journeys/index.html.slim147
-rw-r--r--app/views/vehicle_journeys/show.rabl59
6 files changed, 100 insertions, 121 deletions
diff --git a/app/views/api/v1/journey_patterns/show.rabl b/app/views/api/v1/journey_patterns/show.rabl
index 808808462..21f25e480 100644
--- a/app/views/api/v1/journey_patterns/show.rabl
+++ b/app/views/api/v1/journey_patterns/show.rabl
@@ -1,7 +1,7 @@
object @journey_pattern
extends "api/v1/trident_objects/show"
-[:name, :published_name, :registration_number, :comment].each do |attr|
+[:id, :name, :published_name, :registration_number, :comment].each do |attr|
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
diff --git a/app/views/autocomplete_time_tables/index.rabl b/app/views/autocomplete_time_tables/index.rabl
index 0389c26b0..8ec7b314e 100644
--- a/app/views/autocomplete_time_tables/index.rabl
+++ b/app/views/autocomplete_time_tables/index.rabl
@@ -1,7 +1,7 @@
collection @time_tables, :object_root => false
node do |time_table|
- { :id => time_table.id, :comment => time_table.comment,
+ { :id => time_table.id, :comment => time_table.comment, :objectid => time_table.objectid,
:time_table_bounding => time_table.presenter.time_table_bounding,
:composition_info => time_table.presenter.composition_info,
:tags => time_table.tags.join(','),
diff --git a/app/views/journey_patterns/show.html.slim b/app/views/journey_patterns/show.html.slim
index 85ba4e7a5..823252480 100644
--- a/app/views/journey_patterns/show.html.slim
+++ b/app/views/journey_patterns/show.html.slim
@@ -45,6 +45,6 @@ h3.journey_pattern_stop_points = t('.stop_points')
i.fa.fa-exclamation-triangle
li
- = link_to t('journey_patterns.journey_pattern.vehicle_journey_at_stops'), referential_line_route_vehicle_journeys_path(@referential, @line, @route, :q => {:journey_pattern_id_eq => @journey_pattern.id}), class: 'clock'
+ = link_to t('journey_patterns.journey_pattern.vehicle_journey_at_stops'), referential_line_route_vehicle_journeys_path(@referential, @line, @route, :q => {:journey_pattern_id_eq => @journey_pattern.id, :journey_pattern_object_id => @journey_pattern.objectid}), class: 'clock'
= creation_tag(@journey_pattern)
diff --git a/app/views/line_footnotes/show.rabl b/app/views/line_footnotes/show.rabl
new file mode 100644
index 000000000..5cec1ceb5
--- /dev/null
+++ b/app/views/line_footnotes/show.rabl
@@ -0,0 +1,9 @@
+collection @footnotes
+
+node do |footnote|
+ {
+ :id => footnote.id,
+ :code => footnote.code,
+ :label => footnote.label
+ }
+end
diff --git a/app/views/vehicle_journeys/index.html.slim b/app/views/vehicle_journeys/index.html.slim
index aa18a120f..dfd27b24b 100644
--- a/app/views/vehicle_journeys/index.html.slim
+++ b/app/views/vehicle_journeys/index.html.slim
@@ -1,93 +1,54 @@
-= title_tag t('vehicle_journeys.index.title', route: @route.name )
-
-= search_form_for @q, :url => referential_line_route_vehicle_journeys_path(@referential,@line,@route), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f|
- .panel.panel-default
- .panel-heading
- = f.label :journey_pattern_id_eq, "Missions"
- = f.text_field(:journey_pattern_id_eq, class: "form-control")
-
- button.btn.btn-default type="submit"
- i.fa.fa-search
-
- a.advanced_search data-toggle="collapse" data-parent="#search" href="#advanced_search"
- i.fa.fa-plus
- = "#{t('.advanced_search')}"
-
- #advanced_search.panel-collapse.collapse
- .panel-body
- div
- = f.label :time_tables_id_not_eq, "Sans calendrier"
- = f.check_box :time_tables_id_not_eq
-
- span.time_tables_id_eq
- = f.label :time_tables_id_eq, "Sélectionner calendriers"
- = f.text_field :time_tables_id_eq, :input_html => { :"data-pre" => [].to_json}
-
- / - if controller_name != 'vehicle_journey_frequencies'
- / div
- / = f.label :vehicle_journey_at_stops_departure_time_not_eq, "Sans horaire"
- / = f.check_box :vehicle_journey_at_stops_departure_time_not_eq
-
- / span.vehicle_journey_at_stops_departure_time_gt
- / input name="#{q[vehicle_journey_at_stops_departure_time_gt(3i)]}" type="hidden" value="1"
- / input name="#{q[vehicle_journey_at_stops_departure_time_gt(2i)]}" type="hidden" value="1"
- / input name="#{q[vehicle_journey_at_stops_departure_time_gt(1i)]}" type="hidden" value="2000"
-
- / = f.label :vehicle_journey_at_stops_departure_time_gt, t('.time_range')
- / = select_hour(@q.send( "vehicle_journey_at_stops_departure_time_gt") ? @q.send( "vehicle_journey_at_stops_departure_time_gt").hour : 0, :prefix => "q", :field_name => "vehicle_journey_at_stops_departure_time_gt(4i)")
- / = select_minute(@q.send( "vehicle_journey_at_stops_departure_time_gt") ? @q.send( "vehicle_journey_at_stops_departure_time_gt").min : 0, :prefix => "q", :field_name => "vehicle_journey_at_stops_departure_time_gt(5i)")
-
-#vehicle_journeys
- == render "vehicle_journeys"
-
-- content_for :sidebar do
- == render "sidebar"
-
-javascript:
- $(function() {
- var time_tables_url = function(){
- return "#{referential_autocomplete_time_tables_path(@referential, :format => :json)}?route_id=#{@route.id}";
- };
-
- var time_table_formatter = function(item){
- var day_types = '';
- if ( item.day_types.length >0 ){
- day_types = '<span class=\"day_types\">' + item.day_types + '</span>' ;
- }
- var tags = '';
- if ( item.tags.length >0 ){
- tags = '<div class=\"info\">' + item.tags + '</div>' ;
- }
- return '<li><div class=\"comment\">' + item.comment +
- '</div><div class=\"info\">' + item.time_table_bounding + ' ' + day_types + '</div>' +
- tags + '</li>';
- };
- $( "#q_time_tables_id_eq" ).tokenInput( time_tables_url, {
- crossDomain: false,
- prePopulate: $('#q_time_tables_id_eq').data('pre'),
- minChars: 2,
- propertyToSearch: 'comment',
- hintText: "#{t('search_hint')}",
- noResultsText: "#{t('no_result_text')}",
- searchingText: "#{t('searching_term')}",
- resultsFormatter: time_table_formatter,
- tokenFormatter: time_table_formatter
- });
- $( "#q_journey_pattern_id_eq" ).tokenInput("#{referential_line_route_journey_patterns_path(@referential, @line, @route, :format => :json)}", {
- crossDomain: false,
- prePopulate: $('#q_journey_pattern_id_eq').data('pre'),
- minChars: 1,
- queryParam: 'q[name_cont]',
- propertyToSearch: 'name',
- hintText: "#{t('search_hint')}",
- noResultsText: "#{t('no_result_text')}",
- searchingText: "#{t('searching_term')}",
- resultsFormatter: function(item){ return '<li><div class=\"name\">' + item.name + ', (' + item.id + ') </div></li>' },
- });
- $( 'input[name="q[time_tables_id_not_eq]"]').change( function(){
- $('span.time_tables_id_eq').toggle( $(this).filter(":checked").val()==undefined);
- });
- $( 'input[name="q[vehicle_journey_at_stops_departure_time_not_eq]"]').change( function(){
- $('span.vehicle_journey_at_stops_departure_time_gt').toggle( $(this).filter(":checked").val()==undefined);
- });
- });
+/ PageHeader
+= pageheader 'map-marker',
+ t('vehicle_journeys.index.title', route: @route.name ),
+ 'Lorem ipsum dolor sit amet',
+ t('last_update', time: l(@vehicle_journeys.last.updated_at, format: :short)) do
+
+/ PageContent
+.page_content
+ .container-fluid
+ .row
+ .col-lg-12
+ / = @perms.inspect
+ / = search_form_for @q, :url => referential_line_route_vehicle_journeys_path(@referential,@line,@route), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f|
+ / .panel.panel-default
+ / .panel-heading
+ / = f.label :journey_pattern_id_eq, "Missions"
+ / = f.text_field(:journey_pattern_id_eq, class: "form-control")
+ /
+ / button.btn.btn-default type="submit"
+ / i.fa.fa-search
+ /
+ / a.advanced_search data-toggle="collapse" data-parent="#search" href="#advanced_search"
+ / i.fa.fa-plus
+ / = "#{t('.advanced_search')}"
+ /
+ / #advanced_search.panel-collapse.collapse
+ / .panel-body
+ / div
+ / = f.label :time_tables_id_not_eq, "Sans calendrier"
+ / = f.check_box :time_tables_id_not_eq
+ /
+ / span.time_tables_id_eq
+ / = f.label :time_tables_id_eq, "Sélectionner calendriers"
+ / = f.text_field :time_tables_id_eq, :input_html => { :"data-pre" => [].to_json}
+ /
+ /
+ / #vehicle_journeys
+ / == render "vehicle_journeys"
+ /
+ / - content_for :sidebar do
+ / == render "sidebar"
+
+ #vehicle_journeys_wip
+
+= javascript_tag do
+ | window.route_id = #{params[:route_id]};
+ | window.stopPoints = #{(@stop_points_list.to_json).html_safe};
+ | window.journeyPatternId = #{params[:q].present? ? ('"' + params[:q].values[1] + '"').html_safe : false};
+ | window.vehicleJourneysLength = #{@vehicle_journeys.total_entries()};
+ | window.vehicleJourneysPerPage = #{@ppage};
+ | window.line_footnotes = #{raw @footnotes};
+ | window.perms = #{raw @perms}
+
+= javascript_include_tag 'es6_browserified/vehicle_journeys/index.js'
diff --git a/app/views/vehicle_journeys/show.rabl b/app/views/vehicle_journeys/show.rabl
index 09375f5d5..f973ccbaa 100644
--- a/app/views/vehicle_journeys/show.rabl
+++ b/app/views/vehicle_journeys/show.rabl
@@ -1,39 +1,48 @@
object @vehicle_journey
-[ :objectid, :published_journey_name, :journey_pattern_id].each do |attr|
+[:objectid, :published_journey_name, :published_journey_identifier, :company_id].each do |attr|
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
-child(:time_tables) do |time_tables|
- node do |tt|
- [:objectid, :start_date, :end_date].map do |att|
- node(att) { tt.send(att) }
- end
- node :calendar do |tt|
- {
- id: tt.calendar.id,
- name: tt.calendar.name,
- date_ranges: tt.calendar.date_ranges,
- dates: tt.calendar.dates,
- shared: tt.calendar.shared
- }
- end
- end
+child(:journey_pattern) do |journey_pattern|
+ attributes :id, :objectid, :name, :published_name
end
-child :footnotes do |footnotes|
- node do |footnote|
- node(:id) { footnote.id }
+child(:time_tables, :object_root => false) do |time_tables|
+ attributes :id, :objectid, :comment
+ child(:calendar) do
+ attributes :id, :name, :date_ranges, :dates, :shared
end
end
-child :vehicle_journey_at_stops do |vehicle_stops|
+child :footnotes, :object_root => false do |footnotes|
+ attributes :id, :code, :label
+end
+
+child(:vehicle_journey_at_stops_matrix, :object_root => false) do |vehicle_stops|
node do |vehicle_stop|
- node(:stop_area_object_id) { vehicle_stop.stop_point.stop_area.objectid }
- [ :connecting_service_id, :arrival_time, :departure_time, :boarding_alighting_possibility].each do |attr|
- node( attr) do
- vehicle_stop.send(attr)
- end unless vehicle_stop.send(attr).nil?
+ node(:dummy) { !vehicle_stop.stop_point_id? }
+ node(:stop_area_object_id) do
+ vehicle_stop.stop_point ? vehicle_stop.stop_point.stop_area.objectid : nil
+ end
+ node(:stop_area_name) do
+ vehicle_stop.stop_point ? vehicle_stop.stop_point.stop_area.name : nil
+ end
+ node(:stop_area_cityname) do
+ vehicle_stop.stop_point ? vehicle_stop.stop_point.stop_area.city_name : nil
+ end
+
+ [:id, :connecting_service_id, :boarding_alighting_possibility].map do |att|
+ node(att) { vehicle_stop.send(att) ? vehicle_stop.send(att) : nil }
+ end
+
+ [:arrival_time, :departure_time].map do |att|
+ node(att) do |vs|
+ {
+ hour: vs.send(att).try(:strftime, '%H'),
+ minute: vs.send(att).try(:strftime, '%M')
+ }
+ end
end
end
end