aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2014-10-14 11:38:43 +0200
committerLuc Donnet2014-10-14 11:38:43 +0200
commit2b8c058bc371ce262e53c5ba64cc70f94844c3d7 (patch)
tree7c715b2133381627c85ec4d981f1804d860c425c
parent7b2b09622cb7f9283061dba12855e9805f38efde (diff)
downloadchouette-core-2b8c058bc371ce262e53c5ba64cc70f94844c3d7.tar.bz2
Refactor popover use for chouette Refs #0029200
-rw-r--r--app/assets/javascripts/bootstrap.js.coffee6
-rw-r--r--app/assets/javascripts/vehicle_journeys/index.js.coffee15
-rw-r--r--app/assets/stylesheets/main/compliance_check_tasks.css.scss6
-rw-r--r--app/views/compliance_check_results/index.html.erb6
-rw-r--r--app/views/compliance_check_results/index.js.coffee4
-rw-r--r--app/views/vehicle_journeys/_vehicle_journeys.html.erb10
6 files changed, 19 insertions, 28 deletions
diff --git a/app/assets/javascripts/bootstrap.js.coffee b/app/assets/javascripts/bootstrap.js.coffee
index 246301696..4cd869397 100644
--- a/app/assets/javascripts/bootstrap.js.coffee
+++ b/app/assets/javascripts/bootstrap.js.coffee
@@ -1,7 +1,3 @@
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 6c5d30f79..e89c3f519 100644
--- a/app/assets/javascripts/vehicle_journeys/index.js.coffee
+++ b/app/assets/javascripts/vehicle_journeys/index.js.coffee
@@ -1,12 +1,7 @@
$(".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"))
- $(".route_popover")
- .click(-> false) # cancel click on <a> tag
- .popover({ html : true })
- .on("show.bs.popover", ->
- $(this).data("bs.popover").tip().css(maxWidth: "350px"))
+ $( 'body' ).popover({html: true, trigger: "focus", selector: 'thead th button'})
+ .on("show.bs.popover", (event)->
+ $(event.target).data("bs.popover").tip().css("maxWidth", "350px"))
+
+ \ No newline at end of file
diff --git a/app/assets/stylesheets/main/compliance_check_tasks.css.scss b/app/assets/stylesheets/main/compliance_check_tasks.css.scss
index 663dd6932..13ab1e674 100644
--- a/app/assets/stylesheets/main/compliance_check_tasks.css.scss
+++ b/app/assets/stylesheets/main/compliance_check_tasks.css.scss
@@ -142,9 +142,9 @@
}
.td_error {
- width: 30%;
-
- i { margin-right: 10px; }
+ width: 30%;
+
+ .title_error i { margin-right: 5px; }
div.details_error{
margin: 0px 0px 0px 3px !important;
diff --git a/app/views/compliance_check_results/index.html.erb b/app/views/compliance_check_results/index.html.erb
index 5c37c513f..3abd9cc65 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>
- <%= 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" %>
+ <button 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 btn btn-info btn-xs" ><i class="fa fa-info"></i></button>
<%= 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"] %>
- |- <%= 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" %>
+ |- <button 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 btn btn-info btn-xs"><i class="fa fa-info"></i></button>
<% else %>
- |- <%= 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" %>
+ |- <button 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 btn btn-info btn-xs"><i class="fa fa-info"></i></button>
<% 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 2c288a66f..10821a031 100644
--- a/app/views/compliance_check_results/index.js.coffee
+++ b/app/views/compliance_check_results/index.js.coffee
@@ -1,7 +1,5 @@
jQuery ->
- $(".notice")
- .click(-> false) # cancel click on <a> tag
- .popover({ container: "body", html: false, placement: "bottom" })
+ $(".notice").popover({ container: "body", html: false, trigger: "focus", placement: "bottom" })
# Hide and show error details
$(".title_error").each ->
diff --git a/app/views/vehicle_journeys/_vehicle_journeys.html.erb b/app/views/vehicle_journeys/_vehicle_journeys.html.erb
index 5aee3e2c5..ae748e8ad 100644
--- a/app/views/vehicle_journeys/_vehicle_journeys.html.erb
+++ b/app/views/vehicle_journeys/_vehicle_journeys.html.erb
@@ -8,9 +8,12 @@
<table class="table table-hover table-striped">
<thead>
<tr>
- <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>
+ <th class="title">
+ <button 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"><i class='fa fa-search'></i><%= Chouette::Route.model_name.human.capitalize %></button>
+ </th>
<% @vehicle_journeys.each do |vj| %>
- <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 class="vehicle_journey">
+ <button 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"><i class='fa fa-search'></i></button>
</th>
<% end %>
</tr>
@@ -31,7 +34,6 @@
</div>
<div class="pagination">
<%= will_paginate @vehicle_journeys, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
-</div>
-<%= javascript_include_tag "vehicle_journeys/index" %>
+</div>