diff options
19 files changed, 56 insertions, 65 deletions
diff --git a/app/assets/javascripts/bootstrap.js.coffee b/app/assets/javascripts/bootstrap.js.coffee new file mode 100644 index 000000000..246301696 --- /dev/null +++ b/app/assets/javascripts/bootstrap.js.coffee @@ -0,0 +1,7 @@ +jQuery -> + + $('[data-toggle="popover"]').click -> + $('[data-toggle="popover"]').not($(this)).popover('hide'); + + $('body').click -> + $('[data-toggle="popover"]').not($(this)).popover('hide'); diff --git a/app/assets/javascripts/vehicle_journeys/index.js.coffee b/app/assets/javascripts/vehicle_journeys/index.js.coffee index 429544fcb..6c5d30f79 100644 --- a/app/assets/javascripts/vehicle_journeys/index.js.coffee +++ b/app/assets/javascripts/vehicle_journeys/index.js.coffee @@ -3,14 +3,10 @@ $(".vehicle_journeys.index").ready -> .click(-> false) # cancel click on <a> tag .popover({ html : true }) .on("show.bs.popover", -> - $(this).data("bs.popover").tip().css(maxWidth: "350px")) + $(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 - # }) + $(".route_popover") + .click(-> false) # cancel click on <a> tag + .popover({ html : true }) + .on("show.bs.popover", -> + $(this).data("bs.popover").tip().css(maxWidth: "350px")) diff --git a/app/views/companies/_company.erb b/app/views/companies/_company.erb index 928bf1d4e..534c4c7a6 100644 --- a/app/views/companies/_company.erb +++ b/app/views/companies/_company.erb @@ -1,4 +1,4 @@ -<div id="index_item" class="panel panel-default"> +<div id="index_item" class="company panel panel-default"> <div class="panel-heading"> <div class="panel-title clearfix"> <span class="pull-right"> diff --git a/app/views/compliance_check_results/index.html.erb b/app/views/compliance_check_results/index.html.erb index 3a73f2146..5c37c513f 100644 --- a/app/views/compliance_check_results/index.html.erb +++ b/app/views/compliance_check_results/index.html.erb @@ -17,7 +17,7 @@ <td><%= status_icon( compliance_check_result.status, compliance_check_result.severity ) %> </td> <td><%= t compliance_check_result.severity, :scope => "compliance_check_result.severities" %></td> <td> - <%= image_tag "icons/notice.png", :"data-content" => ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code), :"data-title" => t("activerecord.attributes.compliance_check_result.detail"), :class =>"notice" %> + <%= link_to image_tag "icons/notice.png", :"data-content" => ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code), :"data-title" => t("activerecord.attributes.compliance_check_result.detail"), :rel => "popover", :'data-toggle' => "popover", :class =>"notice" %> <%= link_to compliance_check_result.rule_code, test_definition(compliance_check_result.rule_code), :title => ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code), :target => "validation" %></td> <% if @compliance_check_results && @compliance_check_results.first.status == "nok" %> <td class="td_error"> @@ -29,9 +29,9 @@ <% compliance_check_result.detail["detail"].first(10).each do |error| %> <p class="detail_error"> <% if error["messageArgs"] %> - |- <%= image_tag "icons/notice.png", :"data-content" => ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) + t("compliance_check_result.details." + error["messageKey"], error["messageArgs"].symbolize_keys ), :"data-title" => t("activerecord.attributes.compliance_check_result.detail"), :class =>"notice" %> + |- <%= link_to image_tag "icons/notice.png", :"data-content" => ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) + t("compliance_check_result.details." + error["messageKey"], error["messageArgs"].symbolize_keys ), :"data-title" => t("activerecord.attributes.compliance_check_result.detail"), :'data-toggle' => "popover", :class =>"notice" %> <% else %> - |- <%= image_tag "icons/notice.png", :"data-content" => ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) + t("compliance_check_result.details." + error["messageKey"]), :"data-title" => t("activerecord.attributes.compliance_check_result.detail"), :class =>"notice" %> + |- <%= link_to image_tag "icons/notice.png", :"data-content" => ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) + t("compliance_check_result.details." + error["messageKey"]), :"data-title" => t("activerecord.attributes.compliance_check_result.detail"), :'data-toggle' => "popover", :class =>"notice" %> <% end %> <% if error["location"]["url"].present? %> <%= link_to error["objectId"], referential_path(@referential) + "/" + error["location"]["url"] %> diff --git a/app/views/compliance_check_results/index.js.coffee b/app/views/compliance_check_results/index.js.coffee index 203e2ca8e..2c288a66f 100644 --- a/app/views/compliance_check_results/index.js.coffee +++ b/app/views/compliance_check_results/index.js.coffee @@ -1,13 +1,7 @@ jQuery -> - $(".notice").popover({ container: "body", trigger: "click", html: false, placement: "bottom" }) - - $("body").click (e) -> - $(".notice").each -> - #the 'is' for buttons that trigger popups - #the 'has' for icons within a button that triggers a popup - if not $(this).is(e.target) and $(this).has(e.target).length is 0 and $(".popover").has(e.target).length is 0 - if( $(this).data('bs.popover').tip().hasClass('in') ) - $(this).popover('toggle') + $(".notice") + .click(-> false) # cancel click on <a> tag + .popover({ container: "body", html: false, placement: "bottom" }) # Hide and show error details $(".title_error").each -> diff --git a/app/views/connection_links/_connection_link.erb b/app/views/connection_links/_connection_link.erb index b9bf0916b..5f7b12ec5 100644 --- a/app/views/connection_links/_connection_link.erb +++ b/app/views/connection_links/_connection_link.erb @@ -1,4 +1,4 @@ -<div id="index_item" class="panel panel-default"> +<div id="index_item" class="panel panel-default connection_link"> <div class="panel-heading"> <div class="panel-title clearfix"> <span class="pull-right"> diff --git a/app/views/lines/_line.erb b/app/views/lines/_line.erb index 3723db775..9c4b816bd 100644 --- a/app/views/lines/_line.erb +++ b/app/views/lines/_line.erb @@ -1,4 +1,4 @@ -<div id="index_item" class="panel panel-default"> +<div id="index_item" class="panel panel-default line"> <div class="panel-heading"> <div class="panel-title clearfix"> <span class="pull-right"> diff --git a/app/views/networks/_network.erb b/app/views/networks/_network.erb index 30897d3fa..618e39b72 100644 --- a/app/views/networks/_network.erb +++ b/app/views/networks/_network.erb @@ -1,4 +1,4 @@ -<div id="index_item" class="panel panel-default"> +<div id="index_item" class="panel panel-default network"> <div class="panel-heading"> <div class="panel-title clearfix"> <span class="pull-right"> diff --git a/app/views/routes/_route.html.erb b/app/views/routes/_route.html.erb index cf875f94f..5a9e1f2a5 100644 --- a/app/views/routes/_route.html.erb +++ b/app/views/routes/_route.html.erb @@ -1,4 +1,4 @@ -<div id="index_item" class="panel panel-default"> +<div id="index_item" class="panel panel-default route"> <div class="panel-heading"> <div class="panel-title clearfix"> <span class="pull-right"> diff --git a/app/views/rule_parameter_sets/_rule_parameter_set.html.erb b/app/views/rule_parameter_sets/_rule_parameter_set.html.erb new file mode 100644 index 000000000..49de4c1a1 --- /dev/null +++ b/app/views/rule_parameter_sets/_rule_parameter_set.html.erb @@ -0,0 +1,23 @@ +<div id="index_item" class="panel panel-default rule_parameter_test"> + <div class="panel-heading"> + <div class="panel-title clearfix"> + <span class="pull-right"> + <%= link_to edit_referential_rule_parameter_set_path(@referential, rule_parameter_set), :class => "btn btn-default btn-sm" do %> + <span class="fa fa-pencil"></span> + <% end %> + <% if @referential.rule_parameter_sets.size > 1 %> + <%= link_to referential_rule_parameter_set_path(@referential, rule_parameter_set), :method => :delete, :data => {:confirm => t('rule_parameter_sets.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %> + <span class="fa fa-trash-o"></span> + <% end %> + <% end %> + </span> + <h5> + <%= link_to([@referential, rule_parameter_set], :class => "preview", :title => "#{RuleParameterSet.model_name.human.capitalize} #{rule_parameter_set.name}") do %> + <span class="name"> + <%= truncate(rule_parameter_set.name, :length => 20) %> + </span> + <% end %> + </h5> + </div> + </div> +</div> diff --git a/app/views/rule_parameter_sets/index.html.erb b/app/views/rule_parameter_sets/index.html.erb index c03ff0d15..a92840529 100644 --- a/app/views/rule_parameter_sets/index.html.erb +++ b/app/views/rule_parameter_sets/index.html.erb @@ -1,18 +1,6 @@ <%= title_tag t('rule_parameter_sets.index.title') %> -<% @rule_parameter_sets.each do |rule_parameter_set| %> - <%= div_for(rule_parameter_set) do %> - <%= link_to( rule_parameter_set.name, [@referential, rule_parameter_set]) %> - <div class="info"> - <div class="actions"> - <%= link_to t("actions.edit"), edit_referential_rule_parameter_set_path(@referential, rule_parameter_set), :class => "edit" %> - <% if @referential.rule_parameter_sets.size > 1 %> - | <%= link_to t("actions.destroy"), referential_rule_parameter_set_path(@referential, rule_parameter_set), :method => :delete, :data => {:confirm => t('rule_parameter_sets.actions.destroy_confirm')}, :class => "remove" %> - <% end %> - </div> - </div> - <% end %> -<% end %> +<%= paginated_content(@rule_parameter_sets) %> <% content_for :sidebar do %> <ul class="actions"> diff --git a/app/views/stop_areas/_stop_area.html.erb b/app/views/stop_areas/_stop_area.html.erb index 9567a7491..2ae61b42d 100644 --- a/app/views/stop_areas/_stop_area.html.erb +++ b/app/views/stop_areas/_stop_area.html.erb @@ -1,4 +1,4 @@ -<div id="index_item" class="panel panel-default"> +<div id="index_item" class="panel panel-default stop_area"> <div class="panel-heading"> <div class="panel-title clearfix"> <span class="pull-right"> diff --git a/app/views/stop_points/_stop_point.html.erb b/app/views/stop_points/_stop_point.html.erb index 519c80fe5..5eb4bb8b9 100644 --- a/app/views/stop_points/_stop_point.html.erb +++ b/app/views/stop_points/_stop_point.html.erb @@ -1,4 +1,4 @@ -<div id="index_item" class="panel panel-default"> +<div id="index_item" class="panel panel-default stop_point"> <div class="panel-heading"> <div class="panel-title clearfix"> <h5> diff --git a/app/views/time_tables/_time_table.html.erb b/app/views/time_tables/_time_table.html.erb index 794b6ade7..e9d02fa38 100644 --- a/app/views/time_tables/_time_table.html.erb +++ b/app/views/time_tables/_time_table.html.erb @@ -1,4 +1,4 @@ -<div id="index_item" class="panel panel-default"> +<div id="index_item" class="panel panel-default time_table"> <div class="panel-heading"> <div class="panel-title clearfix"> <span class="pull-right"> diff --git a/app/views/vehicle_journeys/_route_popover.html.erb b/app/views/vehicle_journeys/_route_popover.html.erb index fbf479d3c..f66c73715 100644 --- a/app/views/vehicle_journeys/_route_popover.html.erb +++ b/app/views/vehicle_journeys/_route_popover.html.erb @@ -1,9 +1,3 @@ -<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> diff --git a/app/views/vehicle_journeys/_show_popover.html.erb b/app/views/vehicle_journeys/_show_popover.html.erb index f84e7471c..828f2900e 100644 --- a/app/views/vehicle_journeys/_show_popover.html.erb +++ b/app/views/vehicle_journeys/_show_popover.html.erb @@ -1,5 +1,5 @@ <p> - <%= Chouette::JourneyPattern.model_name.human.pluralize %> : <%= link_to journey_name( vehicle_journey.journey_pattern ), [@referential, @line, @route, vehicle_journey.journey_pattern] %> + <%= Chouette::JourneyPattern.model_name.human %> : <%= 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> : diff --git a/app/views/vehicle_journeys/_vehicle_journeys.html.erb b/app/views/vehicle_journeys/_vehicle_journeys.html.erb index b91a6b3b2..b92cf21de 100644 --- a/app/views/vehicle_journeys/_vehicle_journeys.html.erb +++ b/app/views/vehicle_journeys/_vehicle_journeys.html.erb @@ -8,9 +8,9 @@ <table class="table table-hover table-striped"> <thead> <tr> - <th class="title"><%= Chouette::VehicleJourney.model_name.human.pluralize %> :</th> + <th class="title"><%= link_to("<i class='fa fa-search'></i> #{Chouette::Route.model_name.human.capitalize}".html_safe, '#', :'data-style' => "primary", :'data-container' => "body", :rel => "popover", :'data-toggle' => "popover", :title => t(".line_routes"), :'data-placement' => "top", :'data-content' => "#{ render( partial: 'route_popover', :locals => { :selected_route => @route })}", :class => "route_popover btn btn-default btn-sm") %></th> <% @vehicle_journeys.each do |vj| %> - <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 class="vehicle_journey"> <%= link_to("<i class='fa fa-search'></i>".html_safe, '#', :'data-style' => "primary", :'data-container' => "body", :rel => "popover", :'data-toggle' => "popover", :title => "#{link_to(vehicle_title(vj), [@referential, @line, @route, vj] )}", :'data-placement' => "top", :'data-content' => "#{ render( partial: 'show_popover', :locals => { :vehicle_journey => vj })}", :class => "vehicle_journey_popover btn btn-default btn-sm") %> </th> <% end %> </tr> diff --git a/app/views/vehicle_journeys/index.html.erb b/app/views/vehicle_journeys/index.html.erb index e520d8093..69fd302fa 100644 --- a/app/views/vehicle_journeys/index.html.erb +++ b/app/views/vehicle_journeys/index.html.erb @@ -92,14 +92,5 @@ $('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> diff --git a/config/locales/vehicle_journeys.yml b/config/locales/vehicle_journeys.yml index a5bf9c195..ff490966b 100644 --- a/config/locales/vehicle_journeys.yml +++ b/config/locales/vehicle_journeys.yml @@ -1,7 +1,6 @@ en: vehicle_journeys: - route_popover: - parent_route: "Parent route" + vehicle_journeys: line_routes: "Line's routes" vehicle_journey: title_stopless: "Vehicle journey %{name}" @@ -102,8 +101,7 @@ en: fr: vehicle_journeys: - route_popover: - parent_route: "Séquence d'arrêt parent" + vehicle_journeys: line_routes: "Séquences d'arrêts de la ligne" vehicle_journey: title_stopless: "Course %{name}" |
