diff options
| -rw-r--r-- | app/assets/javascripts/partials/ie_report.js.coffee.erb | 23 | ||||
| -rw-r--r-- | app/assets/stylesheets/partials/ie_report.css.scss | 2 | ||||
| -rw-r--r-- | app/views/shared/_ie_report.html.erb | 92 | ||||
| -rw-r--r-- | app/views/shared/_ie_report_file.html.erb | 26 | ||||
| -rw-r--r-- | app/views/shared/_ie_report_line.html.erb | 37 | ||||
| -rw-r--r-- | config/locales/ie_report.en.yml | 53 | ||||
| -rw-r--r-- | config/locales/ie_report.fr.yml | 44 |
7 files changed, 128 insertions, 149 deletions
diff --git a/app/assets/javascripts/partials/ie_report.js.coffee.erb b/app/assets/javascripts/partials/ie_report.js.coffee.erb index bff2ae315..8087071cb 100644 --- a/app/assets/javascripts/partials/ie_report.js.coffee.erb +++ b/app/assets/javascripts/partials/ie_report.js.coffee.erb @@ -1,6 +1,6 @@ $(".imports.show, .exports.show, .compliance_checks.show").ready -> - get_export_results = (html_container, html_element) -> + getFileResults = (html_container, html_element) -> html_container.children().each -> if($(this).is(html_element)) $(this).show() @@ -27,28 +27,15 @@ $(".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 getFileResults($(".results"), $(".files_error")) + when 1 then getFileResults($(".results"), $(".files_ignored")) + when 2 then getFileResults($(".results"), $(".files_ok")) ) - get_export_results($(".report"), $(".files_error")) + getFileResults($(".results"), $(".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")) - - $('#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 reloadPage = () -> window.location.reload() diff --git a/app/assets/stylesheets/partials/ie_report.css.scss b/app/assets/stylesheets/partials/ie_report.css.scss index 20a7757ee..b8b37f918 100644 --- a/app/assets/stylesheets/partials/ie_report.css.scss +++ b/app/assets/stylesheets/partials/ie_report.css.scss @@ -21,7 +21,7 @@ .caption { text-align :center; - font-weight: bold; + font-weight: bold; } } diff --git a/app/views/shared/_ie_report.html.erb b/app/views/shared/_ie_report.html.erb index 9aea46f79..9c799ef1c 100644 --- a/app/views/shared/_ie_report.html.erb +++ b/app/views/shared/_ie_report.html.erb @@ -1,12 +1,11 @@ -<div class="resume row"> - <ul class="nav nav-tabs" role="tablist" id="ie_tab"> - <% if job.respond_to?(:file_path) %> +<div class="resume"> + <% if job.respond_to?(:file_path) %> + <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"> - <a href="#ie_tab_file" class="ie_tab_file" aria-controls="ie_tabe_file" role="tab" data-toggle="tab"> + <a href="#ie_tab_file" class="ie_tab_file" aria-controls="ie_tab_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')%> @@ -15,85 +14,14 @@ </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 role="tabpanel" class="tab-pane active" id="ie_tab_file"> + <%= render partial: 'shared/ie_report_file', locals: { job: job } %> </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> + <%= render partial: 'shared/ie_report_line', locals: { job: job } %> </div> </div> -</div> - -<div class="report" data-refresh-interval="<%= job_refresh_interval(job) %>"> - <div class="files files_error" data-label="<%= t('.graph.files.error') %>"> - <% job.report.error_files.each_with_index do |file, index| %> - <div class="col-md-6"> - <%= image_tag "icons/file_xml_md.png" %><span class="file_name" title='<%= file.name %>'><%= truncate(file.name, :length => 40) %></span> - </div> - <% end %> - </div> - <div class="files files_ignored" data-label="<%= t('.graph.files.ignored') %>"> - <% job.report.ignored_files.each_with_index do |file, index| %> - <div class="col-md-6"> - <%= image_tag "icons/file_xml_md.png" %><span class="file_name" title='<%= file.name %>'><%= truncate(file.name, :length => 40) %></span> - </div> - <% end %> - </div> - <div class="files files_ok" data-label="<%= t('.graph.files.ok') %>"> - <% job.report.ok_files.each_with_index do |file, index| %> - <div class="col-md-6"> - <%= image_tag "icons/file_xml_md.png" %><span class="file_name" title='<%= file.name %>'><%= truncate(file.name, :length => 40) %></span> - </div> - <% end %> - </div> - <div class="lines"> - <table class="table table-hover table-striped" data-label="<%= t('.graph.lines.objects_label') %>" data-total-lines="<%= job.report.lines %>" data-total-routes="<%= job.report.routes %>" data-total-connection_links="<%= job.report.connection_links %>", data-total-time_tables="<%= job.report.time_tables %>" data-total-stop_areas="<%= job.report.stop_areas %>" data-total-access_points="<%= job.report.access_points %>" data-total-vehicle_journeys="<%= job.report.vehicle_journeys %>" data-total-journey_patterns="<%= job.report.journey_patterns %>" > - <thead> - <tr> - <th class="save"><%= t(".table.line.save") %></th> - <th class="lines"><%= t(".table.line.lines") %></th> - <th class="routes"><%= t(".table.line.routes") %></th> - <th class="connection_links"><%= t(".table.line.connection_links") %></th> - <th class="time_tables"><%= t(".table.line.time_tables") %></th> - <th class="stop_areas"><%= t(".table.line.stop_areas") %></th> - <th class="access_points"><%= t(".table.line.access_points") %></th> - <th class="vehicle_journeys"><%= t(".table.line.vehicle_journeys") %></th> - <th class="journey_patterns"><%= t(".table.line.journey_patterns") %></th> - </tr> - </thead> - <tbody> - <% job.report.line_items.each_with_index do |line_item, index| %> - <tr> - <td><%= line_item.status ? font_awesome_classic_tag("fa-check") : font_awesome_classic_tag("fa-times") %></td> - <td><%= line_item.name %></td> - <td><%= line_item.routes %></td> - <td><%= line_item.connection_links %></td> - <td><%= line_item.time_tables %></td> - <td><%= line_item.stop_areas %></td> - <td><%= line_item.access_points %></td> - <td><%= line_item.vehicle_journeys %></td> - <td><%= line_item.journey_patterns %></td> - </tr> - <% end %> - </tbody> - </table> - </div> + <% else %> + <%= render partial: 'shared/ie_report_line', locals: { job: job } %> + <% end %> </div> diff --git a/app/views/shared/_ie_report_file.html.erb b/app/views/shared/_ie_report_file.html.erb new file mode 100644 index 000000000..78c363446 --- /dev/null +++ b/app/views/shared/_ie_report_file.html.erb @@ -0,0 +1,26 @@ +<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 class="report results" data-refresh-interval="<%= job_refresh_interval(job) %>"> + <div class="files files_error" data-label="<%= t('.graph.files.error') %>"> + <% job.report.error_files.each_with_index do |file, index| %> + <div class="col-md-6"> + <%= image_tag "icons/file_xml_md.png" %><span class="file_name" title='<%= file.name %>'><%= truncate(file.name, :length => 40) %></span> + </div> + <% end %> + </div> + <div class="files files_ignored" data-label="<%= t('.graph.files.ignored') %>"> + <% job.report.ignored_files.each_with_index do |file, index| %> + <div class="col-md-6"> + <%= image_tag "icons/file_xml_md.png" %><span class="file_name" title='<%= file.name %>'><%= truncate(file.name, :length => 40) %></span> + </div> + <% end %> + </div> + <div class="files files_ok" data-label="<%= t('.graph.files.ok') %>"> + <% job.report.ok_files.each_with_index do |file, index| %> + <div class="col-md-6"> + <%= image_tag "icons/file_xml_md.png" %><span class="file_name" title='<%= file.name %>'><%= truncate(file.name, :length => 40) %></span> + </div> + <% end %> + </div> +</div> diff --git a/app/views/shared/_ie_report_line.html.erb b/app/views/shared/_ie_report_line.html.erb new file mode 100644 index 000000000..3fa40f641 --- /dev/null +++ b/app/views/shared/_ie_report_line.html.erb @@ -0,0 +1,37 @@ +<p class="lead"> + <p><b><%=t('.read_lines') %></b> : <%= job.report.lines %></p> + <p><b><%=t('.saved_lines') %></b> : <%= job.report.saved_lines %></p> + <p><b><%=t('.unsaved_lines') %></b> : <%= job.report.unsaved_lines %></p> +</p> +<div class="report" data-refresh-interval="<%= job_refresh_interval(job) %>"> + <table class="table table-hover table-striped"> + <thead> + <tr> + <th class="save"><%= t(".table.line.save") %></th> + <th class="lines"><%= t(".table.line.lines") %></th> + <th class="routes"><%= t(".table.line.routes") %></th> + <th class="connection_links"><%= t(".table.line.connection_links") %></th> + <th class="time_tables"><%= t(".table.line.time_tables") %></th> + <th class="stop_areas"><%= t(".table.line.stop_areas") %></th> + <th class="access_points"><%= t(".table.line.access_points") %></th> + <th class="vehicle_journeys"><%= t(".table.line.vehicle_journeys") %></th> + <th class="journey_patterns"><%= t(".table.line.journey_patterns") %></th> + </tr> + </thead> + <tbody> + <% job.report.line_items.each_with_index do |line_item, index| %> + <tr> + <td><%= line_item.status ? font_awesome_classic_tag("fa-check") : font_awesome_classic_tag("fa-times") %></td> + <td><%= line_item.name %></td> + <td><%= line_item.routes %></td> + <td><%= line_item.connection_links %></td> + <td><%= line_item.time_tables %></td> + <td><%= line_item.stop_areas %></td> + <td><%= line_item.access_points %></td> + <td><%= line_item.vehicle_journeys %></td> + <td><%= line_item.journey_patterns %></td> + </tr> + <% end %> + </tbody> + </table> +</div> diff --git a/config/locales/ie_report.en.yml b/config/locales/ie_report.en.yml index 4a6a3bcac..af12e35d6 100644 --- a/config/locales/ie_report.en.yml +++ b/config/locales/ie_report.en.yml @@ -1,30 +1,31 @@ en: shared: ie_report: - html: tab: - file: 'file' - line: 'line' - graph: - files: - title_default: "%{job} result for %{extension} file" - error: "Errors" - ignored: "Ignored" - ok: "Success" - lines: - title: "Data size by object types" - objects_label: "Objects count" - table: - line: - save: "Save" - routes: "Routes" - lines: "Lines" - connection_links: "Connection links" - time_tables: "Timetables" - stop_areas: "Stop Areas" - access_points: "Access Points" - vehicle_journeys: "Vehicle Journeys" - journey_patterns: "Journey Patterns" - not_saved: "Not saved" - saved: "Saved" - save_error: "Save error" + file: 'File' + line: 'Line' + ie_report_line: + read_lines: 'Read lines' + saved_lines: 'Saved lines' + unsaved_lines: 'Unsaved lines' + table: + line: + save: "Save" + routes: "Routes" + lines: "Lines" + connection_links: "Connection links" + time_tables: "Timetables" + stop_areas: "Stop Areas" + access_points: "Access Points" + vehicle_journeys: "Vehicle Journeys" + journey_patterns: "Journey Patterns" + not_saved: "Not saved" + saved: "Saved" + save_error: "Save error" + ie_report_file: + graph: + files: + title_default: "%{job} result for %{extension} file" + error: "Errors" + ignored: "Ignored" + ok: "Success" diff --git a/config/locales/ie_report.fr.yml b/config/locales/ie_report.fr.yml index ffdba6663..c02c4dd32 100644 --- a/config/locales/ie_report.fr.yml +++ b/config/locales/ie_report.fr.yml @@ -1,31 +1,31 @@ fr: shared: ie_report: - html: - tab: - file: 'file' - line: 'line' + tab: + file: 'File' + line: 'Line' + ie_report_line: + read_lines: 'Lignes lues' + saved_lines: 'Lignes sauvegardés' + unsaved_lines: 'Lignes non-sauvegardés' + table: + line: + save: "Sauvegarde" + routes: "Séquences d'arrêts" + lines: "Lignes" + connection_links: "Correspondances" + time_tables: "Calendriers" + stop_areas: "Arrèts" + access_points: "Accès" + vehicle_journeys: "Courses" + journey_patterns: "Missions" + not_saved: "Non Sauvé" + saved: "Sauvé" + save_error: "Sauvegarde en erreur" + ie_report_file: graph: files: title_default: "Résultat d'%{job} du fichier %{extension}" error: "Erreurs" ignored: "Ignorés" ok: "Succès" - lines: - title: "Volume de données lues par type de donnée" - objects_label: "Quantité lue" - table: - line: - save: "Sauvegarde" - routes: "Séquences d'arrêts" - lines: "Lignes" - connection_links: "Correspondances" - time_tables: "Calendriers" - stop_areas: "Arrèts" - access_points: "Accès" - vehicle_journeys: "Courses" - journey_patterns: "Missions" - not_saved: "Non Sauvé" - saved: "Sauvé" - save_error: "Sauvegarde en erreur" - |
