aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLuc Donnet2014-09-24 17:28:58 +0200
committerLuc Donnet2014-09-24 17:28:58 +0200
commit7e79e261b6e1e582746935e2a0ecf74f315c6a03 (patch)
tree3b76d3654f8b076b642d00f356dc8d1708b9026d /app
parenta75d5d2924b5e95b2484920e3f623c7f174ad63b (diff)
downloadchouette-core-7e79e261b6e1e582746935e2a0ecf74f315c6a03.tar.bz2
Add popovers for vehicle journeys Refs #0028886 #0026841
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/vehicle_journey.js.coffee2
-rw-r--r--app/assets/javascripts/vehicle_journeys/index.js.coffee16
-rw-r--r--app/assets/stylesheets/application.css.scss.erb1
-rw-r--r--app/assets/stylesheets/main/vehicle_journeys.css.scss8
-rw-r--r--app/assets/stylesheets/vendor/bootstrap_changes.css.scss6
-rw-r--r--app/views/vehicle_journeys/_route_popover.html.erb12
-rw-r--r--app/views/vehicle_journeys/_show_popover.html.erb11
-rw-r--r--app/views/vehicle_journeys/_vehicle_journeys.html.erb20
-rw-r--r--app/views/vehicle_journeys/index.html.erb10
9 files changed, 69 insertions, 17 deletions
diff --git a/app/assets/javascripts/vehicle_journey.js.coffee b/app/assets/javascripts/vehicle_journey.js.coffee
index 39f511468..54b359b7a 100644
--- a/app/assets/javascripts/vehicle_journey.js.coffee
+++ b/app/assets/javascripts/vehicle_journey.js.coffee
@@ -72,4 +72,4 @@ jQuery ->
slide_to( '.departure_time', duration)
slide_to( '.arrival_time', duration)
- $(document).on("click", '.vehicle_journeys a.slide', slide)
+ $(document).on("click", '.vehicle_journeys a.slide', slide) \ No newline at end of file
diff --git a/app/assets/javascripts/vehicle_journeys/index.js.coffee b/app/assets/javascripts/vehicle_journeys/index.js.coffee
new file mode 100644
index 000000000..429544fcb
--- /dev/null
+++ b/app/assets/javascripts/vehicle_journeys/index.js.coffee
@@ -0,0 +1,16 @@
+$(".vehicle_journeys.index").ready ->
+ $('.vehicle_journey_popover')
+ .click(-> false) # cancel click on <a> tag
+ .popover({ html : true })
+ .on("show.bs.popover", ->
+ $(this).data("bs.popover").tip().css(maxWidth: "350px"))
+
+
+ # $(".breadcrumb li a").last()
+ # .click(-> false) # cancel click on <a> tag
+ # .popover({
+ # html : true,
+ # container: 'body',
+ # placement: 'bottom',
+ # content: route_popover_data_content
+ # })
diff --git a/app/assets/stylesheets/application.css.scss.erb b/app/assets/stylesheets/application.css.scss.erb
index 3f493856b..49483d2c9 100644
--- a/app/assets/stylesheets/application.css.scss.erb
+++ b/app/assets/stylesheets/application.css.scss.erb
@@ -32,6 +32,7 @@ $body-bg: #eee;
@import "vendor/map_layers";
@import "vendor/token-input.css";
@import "vendor/typeahead";
+@import "vendor/bootstrap_changes";
// Main css
@import "main/*";
diff --git a/app/assets/stylesheets/main/vehicle_journeys.css.scss b/app/assets/stylesheets/main/vehicle_journeys.css.scss
index fb872738d..ba0de3730 100644
--- a/app/assets/stylesheets/main/vehicle_journeys.css.scss
+++ b/app/assets/stylesheets/main/vehicle_journeys.css.scss
@@ -65,6 +65,14 @@
}
.stop_area{ width: 200px; }
+
+ td.hours{
+ text-align: center;
+ }
+
+ tr th.vehicle_journey{
+ text-align: center;
+ }
}
}
diff --git a/app/assets/stylesheets/vendor/bootstrap_changes.css.scss b/app/assets/stylesheets/vendor/bootstrap_changes.css.scss
new file mode 100644
index 000000000..02056b600
--- /dev/null
+++ b/app/assets/stylesheets/vendor/bootstrap_changes.css.scss
@@ -0,0 +1,6 @@
+.popover{
+
+ li{
+ list-style: inherit !important;
+ }
+} \ No newline at end of file
diff --git a/app/views/vehicle_journeys/_route_popover.html.erb b/app/views/vehicle_journeys/_route_popover.html.erb
new file mode 100644
index 000000000..fbf479d3c
--- /dev/null
+++ b/app/views/vehicle_journeys/_route_popover.html.erb
@@ -0,0 +1,12 @@
+<p>
+ <%= t(".parent_route") %><br>
+ <%= link_to selected_route.name.truncate(30), [@referential, selected_route.line, selected_route] %>
+</p>
+<p>
+ <%= t(".line_routes") %>
+<ul>
+<% (selected_route.line.routes.limit(10).reject{ |route| route == selected_route}).each do |route| %>
+ <li><%= link_to route.name.truncate(30), [@referential, route.line, route] %></li>
+<% end %>
+</ul>
+</p>
diff --git a/app/views/vehicle_journeys/_show_popover.html.erb b/app/views/vehicle_journeys/_show_popover.html.erb
new file mode 100644
index 000000000..f84e7471c
--- /dev/null
+++ b/app/views/vehicle_journeys/_show_popover.html.erb
@@ -0,0 +1,11 @@
+<p>
+ <%= Chouette::JourneyPattern.model_name.human.pluralize %> : <%= link_to journey_name( vehicle_journey.journey_pattern ), [@referential, @line, @route, vehicle_journey.journey_pattern] %>
+</p>
+<p>
+ <%= vehicle_journey.time_tables.size %> <%= Chouette::TimeTable.model_name.human.pluralize %> <small><%= time_tables_shortest_info( vehicle_journey ) %></small> :
+ <ul>
+ <% vehicle_journey.time_tables.limit(10).each do |time_table| %>
+ <li><%= link_to time_table.comment + " " + time_table_bounding( time_table), [@referential, time_table] %></li>
+ <% end %>
+ </ul>
+</p>
diff --git a/app/views/vehicle_journeys/_vehicle_journeys.html.erb b/app/views/vehicle_journeys/_vehicle_journeys.html.erb
index 529b2683b..b91a6b3b2 100644
--- a/app/views/vehicle_journeys/_vehicle_journeys.html.erb
+++ b/app/views/vehicle_journeys/_vehicle_journeys.html.erb
@@ -6,25 +6,12 @@
</div>
<div class="vehicle_journeys paginated_content">
<table class="table table-hover table-striped">
- <thead>
- <tr>
- <th class="title"><%= Chouette::JourneyPattern.model_name.human.pluralize %> :</th>
- <% @vehicle_journeys.map(&:journey_pattern).each do |jp| %>
- <th><%= link_to journey_name( jp), [@referential, @line, @route, jp] %></th>
- <% end %>
- </tr>
- <tr>
- <th class="title"><%= Chouette::TimeTable.model_name.human.pluralize %> :</th>
- <% @vehicle_journeys.each do |vj| %>
- <th title="<%= time_tables_info( vj) %>" class="calendars">
- <%= time_tables_shortest_info( vj) %>
- </th>
- <% end %>
- </tr>
+ <thead>
<tr>
<th class="title"><%= Chouette::VehicleJourney.model_name.human.pluralize %> :</th>
<% @vehicle_journeys.each do |vj| %>
- <th> <%= link_to vehicle_name(vj), [@referential, @line, @route, vj]%></th>
+ <th class="vehicle_journey"> <%= link_to(vehicle_name(vj), '#', :'data-style' => "primary", :'data-container' => "body", :rel => "popover", :'data-toggle' => "popover", :title => vehicle_title(vj), :'data-placement' => "top", :'data-content' => "#{ render( partial: 'show_popover', :locals => { :vehicle_journey => vj })}", :class => "vehicle_journey_popover") %>
+ </th>
<% end %>
</tr>
</thead>
@@ -46,3 +33,4 @@
<%= will_paginate @vehicle_journeys, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>
+
diff --git a/app/views/vehicle_journeys/index.html.erb b/app/views/vehicle_journeys/index.html.erb
index 4b3dcd27a..e520d8093 100644
--- a/app/views/vehicle_journeys/index.html.erb
+++ b/app/views/vehicle_journeys/index.html.erb
@@ -91,5 +91,15 @@
$( '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);
});
+
+ /* TODO : Hack to delete popover on breadcrumb route */
+ $(".breadcrumb li a").last().click(false)
+ .popover({
+ html : true,
+ container: 'body',
+ placement: 'bottom',
+ content: '<%= escape_javascript( render( partial: 'route_popover', :locals => { :selected_route => @route} ) ) %>'
+ }).on("show.bs.popover", function(){
+ $(this).data("bs.popover").tip().css("maxWidth", "350px"); } )
});
</script>