aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authoranicet2015-06-12 17:54:22 +0200
committeranicet2015-06-16 10:45:54 +0200
commitbde2f4c0018ebdc3b9cca5047e61ab517556b78b (patch)
tree12d5dfa76998aaeb07d96020d28594797dfe01d2 /app
parentb7fb1d2685a54f015f7c0f83fb586150872f770f (diff)
downloadchouette-core-bde2f4c0018ebdc3b9cca5047e61ab517556b78b.tar.bz2
Ie Report : split file and line in tabs
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/partials/ie_report.js.coffee.erb54
-rw-r--r--app/assets/stylesheets/partials/ie_report.css.scss8
-rw-r--r--app/views/shared/_ie_report.html.erb49
3 files changed, 68 insertions, 43 deletions
diff --git a/app/assets/javascripts/partials/ie_report.js.coffee.erb b/app/assets/javascripts/partials/ie_report.js.coffee.erb
index 25ea7dfc0..bff2ae315 100644
--- a/app/assets/javascripts/partials/ie_report.js.coffee.erb
+++ b/app/assets/javascripts/partials/ie_report.js.coffee.erb
@@ -2,14 +2,14 @@ $(".imports.show, .exports.show, .compliance_checks.show").ready ->
get_export_results = (html_container, html_element) ->
html_container.children().each ->
- if( $( this ).is(html_element) )
- $( this ).show()
+ if($(this).is(html_element))
+ $(this).show()
else
- $( this ).hide()
+ $(this).hide()
- if $( "#files_statistics" ).length
+ getFileStatistics = (id)->
Morris.Donut({
- element: 'files_statistics',
+ element: id,
data: [
{
label: $(".files_error").data('label'),
@@ -27,31 +27,27 @@ $(".imports.show, .exports.show, .compliance_checks.show").ready ->
colors: [ "#e22b1b", "#898e7f", "#8fc861" ]
}).on('click', update = (i, row) ->
switch i
- when 0 then get_export_results( $(".report"), $(".files_error"))
- when 1 then get_export_results( $(".report"), $(".files_ignored"))
- when 2 then get_export_results( $(".report"), $(".files_ok")) )
+ when 0 then get_export_results($(".report"), $(".files_error"))
+ when 1 then get_export_results($(".report"), $(".files_ignored"))
+ when 2 then get_export_results($(".report"), $(".files_ok"))
+ )
+ get_export_results($(".report"), $(".files_error"))
+
+ if $( "#files_statistics" ).length
+ getFileStatistics('files_statistics')
+
+ $('#ie_tab a.ie_tab_file').click (e) ->
+ e.preventDefault()
+ $('#ie_tab_line').hide()
+ $(this).tab('show')
+ $('#files_statistics, .caption').show()
+ get_export_results($(".report"), $(".files_error"))
- Morris.Bar({
- element: 'objects_statistics',
- data: [
- { object: $("th.lines").text(), value: $(".lines table").data("total-lines") },
- { object: $("th.routes").text(), value: $(".lines table").data("total-routes") },
- { object: $("th.connection_links").text(), value: $(".lines table").data("total-connection_links") },
- { object: $("th.time_tables").text(), value: $(".lines table").data("total-time_tables") },
- { object: $("th.stop_areas").text(), value: $(".lines table").data("total-stop_areas") },
- { object: $("th.access_points").text(), value: $(".lines table").data("total-access_points") },
- { object: $("th.vehicle_journeys").text(), value: $(".lines table").data("total-vehicle_journeys") },
- { object: $("th.journey_patterns").text(), value: $(".lines table").data("total-journey_patterns") },
- ],
- xkey: 'object',
- ykeys: ['value'],
- labels: [$(".lines table").data('label')]
- xLabelAngle: 40,
- xAxisLabelTopPadding: 7,
- padding: 40,
- hideHover: true
- }).on('click', update = (i, row) ->
- get_export_results( $(".report"), $("div.lines")) )
+ $('#ie_tab a.ie_tab_line').click (e) ->
+ e.preventDefault()
+ $(this).tab('show')
+ $('#files_statistics, .caption').hide()
+ get_export_results( $(".report"), $("div.lines"))
refreshInterval = $(".report").data("refresh-interval")
if refreshInterval > 0
diff --git a/app/assets/stylesheets/partials/ie_report.css.scss b/app/assets/stylesheets/partials/ie_report.css.scss
index a254b788b..20a7757ee 100644
--- a/app/assets/stylesheets/partials/ie_report.css.scss
+++ b/app/assets/stylesheets/partials/ie_report.css.scss
@@ -1,6 +1,6 @@
.status {
margin-left: 10px;
-}
+}
.status_aborted,.status_canceled { color: #a94442;}
.status_started { color: #31708f;}
@@ -56,13 +56,11 @@
div.lines{
display: none;
-
th, td{
text-align: center;
}
.fa-check{ color: $brand-success; }
- .fa-times{ color: $brand-danger; }
-
+ .fa-times{ color: $brand-danger; }
}
-}
+}
diff --git a/app/views/shared/_ie_report.html.erb b/app/views/shared/_ie_report.html.erb
index 0b3be8afa..9aea46f79 100644
--- a/app/views/shared/_ie_report.html.erb
+++ b/app/views/shared/_ie_report.html.erb
@@ -1,13 +1,44 @@
<div class="resume row">
- <% if job.respond_to?(:file_path) %>
- <div class="col-md-4">
- <div class="caption"><%= t(".graph.files.title_default", {:job => job.class.model_name.human, :extension => job.filename_extension} ) %></div>
- <div id="files_statistics"></div>
- </div>
- <% end %>
- <div class="col-md-8">
- <div class="caption"><%= t ".graph.lines.title" %></div>
- <div id="objects_statistics"></div>
+ <ul class="nav nav-tabs" role="tablist" id="ie_tab">
+ <% if job.respond_to?(:file_path) %>
+ <li role="presentation" class="active">
+ <a href="#ie_tab_file" class="ie_tab_file" aria-controls="ie_tabe_file" role="tab" data-toggle="tab">
+ <%=t('.tab.file')%>
+ </a>
+ </li>
+ <% end %>
+ <li role="presentation">
+ <a href="#ie_tab_line" class="ie_tab_line" aria-controls="ie_tab_line" role="tab" data-toggle="tab">
+ <%=t('.tab.line')%>
+ </a>
+ </li>
+ </ul>
+
+ <div class="tab-content">
+ <% if job.respond_to?(:file_path) %>
+ <div role="tabpanel" class="tab-pane active" id="ie_tabe_file">
+ <div class="caption"><%= t(".graph.files.title_default", {:job => job.class.model_name.human, :extension => job.filename_extension} ) %></div>
+ <div id="files_statistics"></div>
+ </div>
+ <% end %>
+ <div role="tabpanel" class="tab-pane" id="ie_tab_line">
+ <table class="table">
+ <thead>
+ <tr>
+ <th>nombre de lignes lues</th>
+ <th>nombre de lignes sauvegardés</th>
+ <th>nombre de lignes non-sauvegardées (A-B ...)</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><%= job.report.lines %></td>
+ <td><%= job.report.saved_lines %></td>
+ <td><%= job.report.unsaved_lines %></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
</div>
</div>