diff options
| author | Luc Donnet | 2015-05-07 14:40:37 +0200 |
|---|---|---|
| committer | Luc Donnet | 2015-05-07 14:40:37 +0200 |
| commit | 73abd85f6181e33fe0b2fe31a5c46f2fbc44eb8a (patch) | |
| tree | f284e3994937c1e58a68625dc347a0ad7d557945 /app/views | |
| parent | 46c9cd634a1b2f36df872bd0acbca25884673810 (diff) | |
| download | chouette-core-73abd85f6181e33fe0b2fe31a5c46f2fbc44eb8a.tar.bz2 | |
Fix import
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/imports/_import.erb | 13 | ||||
| -rw-r--r-- | app/views/imports/_results_dashboard.html.erb | 70 | ||||
| -rw-r--r-- | app/views/imports/show.html.erb | 15 | ||||
| -rw-r--r-- | app/views/imports/show.js.coffee | 45 |
4 files changed, 18 insertions, 125 deletions
diff --git a/app/views/imports/_import.erb b/app/views/imports/_import.erb index 6824b9bf7..11dae5638 100644 --- a/app/views/imports/_import.erb +++ b/app/views/imports/_import.erb @@ -8,24 +8,21 @@ </span> <h5> <%= link_to( referential_import_path(@referential, import.id), :class => "preview", :title => "#{ImportTask.model_name.human.capitalize} #{import.name}") do %> - <span class="name"> - <%= truncate(import.name, :length => 20) %> - </span> + <%= job_status_title(import) %> <% end %> </h5> </div> </div> <div class="panel-body"> - <p><%= link_to image_tag("icons/file_#{import.filename_extension}.png") + t("imports.show.imported_file"), imported_file_referential_import_path(@referential, import.id) %></p> - <% if import.rule_parameter_set %> + <p><%= link_to image_tag("icons/file_#{import.filename_extension}.png") + t("imports.show.imported_file"), imported_file_referential_import_path(@referential, import.id) if !import.aborted? %></p> + <% if import.rule_parameter_set && !import.aborted? %> <p><%= link_to image_tag("icons/link_page.png") + t("imports.show.rule_parameter_set"), rule_parameter_set_referential_import_path(@referential, import.id) %></p> <% end %> - <% if import.compliance_check %> + <% if import.compliance_check && !import.aborted? %> <p><%= link_to image_tag("icons/link_page.png") + t("imports.show.compliance_check"), compliance_check_referential_import_path(@referential, import.id) %></p> <% end %> </div> - <div class="panel-footer"> - <%= progress_bar_tag(import) %> + <div class="panel-footer"> <div class="history"> <%= l(import.created_at, :format => "%d/%m/%Y %H:%M") if import.created_at %> | <%= import.user_name %> </div> diff --git a/app/views/imports/_results_dashboard.html.erb b/app/views/imports/_results_dashboard.html.erb deleted file mode 100644 index 8fad7e9fb..000000000 --- a/app/views/imports/_results_dashboard.html.erb +++ /dev/null @@ -1,70 +0,0 @@ -<div class="resume row"> - <div class="col-md-4"> - <% file_title = (@import.filename_extension=="zip") ? t("imports.show.graph.files.title_zip") : t("imports.show.graph.files.title_default", :extension => @import.filename_extension)%> - <div class="caption"><%= file_title %></div> - <div id="files_statistics"></div> - </div> - <div class="col-md-8"> - <div class="caption"><%= t "imports.show.graph.lines.title" %></div> - <div id="objects_statistics"></div> - </div> -</div> - -<div class="report"> - <div class="files files_error"> - <% @import.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"> - <% @import.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"> - <% @import.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"> - <thead> - <tr> - <th><%= t("import_tasks.show.table.line.name") %></th> - <th><%= t("import_tasks.show.table.line.save") %></th> - <th><%= t("import_tasks.show.table.line.routes") %></th> - <th><%= t("import_tasks.show.table.line.connection_links") %></th> - <th><%= t("import_tasks.show.table.line.time_tables") %></th> - <th><%= t("import_tasks.show.table.line.stop_areas") %></th> - <th><%= t("import_tasks.show.table.line.access_points") %></th> - <th><%= t("import_tasks.show.table.line.vehicle_journeys") %></th> - <th><%= t("import_tasks.show.table.line.journey_patterns") %></th> - </tr> - </thead> - <tbody> - <% @import.report.line_items.each_with_index do |line_item, index| %> - <% tr_class = (line_item.status == "saved") ? '' : 'class=\'danger\''%> - <tr <%= tr_class %>> - <td><%= line_item.name %></td> - <td><%= t("import_tasks.show.table.line." + line_item.status ) %></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> -</div> -<%= javascript_include_tag referential_import_path(@referential, @import.id,:format => :js) %> - diff --git a/app/views/imports/show.html.erb b/app/views/imports/show.html.erb index 796f7981e..90524eedc 100644 --- a/app/views/imports/show.html.erb +++ b/app/views/imports/show.html.erb @@ -1,10 +1,21 @@ <div class="test"> - <%= title_tag "#{title} #{@import.name} <span class='status status_#{@import.status}'>#{ t('imports.statuses.'+ @import.status) }</span>" %> + <%= title_tag job_status_title(@import) %> </div> +<% if !@import.aborted? %> <div class="import_show"> - <%= render( :partial => "results_dashboard", :locals => { :referential => @referential} ) %> + <div class="links"> + <%= link_to image_tag("icons/file_#{@import.filename_extension}.png") + t("imports.show.imported_file"), imported_file_referential_import_path(@referential, @import.id) if !@import.aborted? %> + <% if @import.rule_parameter_set %> + <%= link_to image_tag("icons/link_page.png") + t("imports.show.rule_parameter_set"), rule_parameter_set_referential_import_path(@referential, @import.id) %> + <% end %> + <% if @import.compliance_check %> + <%= link_to image_tag("icons/link_page.png") + t("imports.show.compliance_check"), compliance_check_referential_import_path(@referential, @import.id) %> + <% end %> + </div> + <%= render( :partial => "shared/ie_report.html", :locals => { :referential => @referential, :job => @import} ) %> </div> +<% end %> <% content_for :sidebar do %> <ul class="actions"> diff --git a/app/views/imports/show.js.coffee b/app/views/imports/show.js.coffee deleted file mode 100644 index e2416e967..000000000 --- a/app/views/imports/show.js.coffee +++ /dev/null @@ -1,45 +0,0 @@ -jQuery -> - - get_import_results = (html_container, html_element) -> - html_container.children().each -> - if( $( this ).is(html_element) ) - $( this ).show() - else - $( this ).hide() - - Morris.Donut({ - element: 'files_statistics', - data: [ - {label: "<%= t 'imports.show.graph.files.error' %>", value: <%= @import.report.error_files.count %> }, - {label: "<%= t 'imports.show.graph.files.ignored' %>", value: <%= @import.report.ignored_files.count %> }, - {label: "<%= t 'imports.show.graph.files.ok' %>", value: <%= @import.report.ok_files.count %> } - ] - colors: [ "#e22b1b", "#898e7f", "#8fc861" ] - }).on('click', update = (i, row) -> - switch i - when 0 then get_import_results( $(".report"), $(".files_error")) - when 1 then get_import_results( $(".report"), $(".files_ignored")) - when 2 then get_import_results( $(".report"), $(".files_ok")) - else console.log "Error no other value for donut chart") - - Morris.Bar({ - element: 'objects_statistics', - data: [ - { object: "<%= t("imports.show.graph.lines.lines_stats").html_safe %>", value: <%= @import.report.lines %> }, - { object: "<%= t("imports.show.graph.lines.routes_stats").html_safe %>", value: <%= @import.report.routes %> }, - { object: "<%= t("imports.show.graph.lines.connection_links_stats").html_safe %>", value: <%= @import.report.connection_links %> }, - { object: "<%= t("imports.show.graph.lines.time_tables_stats").html_safe %>", value: <%= @import.report.time_tables %> }, - { object: "<%= t("imports.show.graph.lines.stop_areas_stats").html_safe %>", value: <%= @import.report.stop_areas %> }, - { object: "<%= t("imports.show.graph.lines.access_points_stats").html_safe %>", value: <%= @import.report.access_points %> }, - { object: "<%= t("imports.show.graph.lines.vehicle_journeys_stats").html_safe %>", value: <%= @import.report.vehicle_journeys %> }, - { object: "<%= t("imports.show.graph.lines.journey_patterns_stats").html_safe %>", value: <%= @import.report.journey_patterns %> }, - ], - xkey: 'object', - ykeys: ['value'], - labels: ['<%= t "imports.show.graph.lines.objects_label" %>'] - xLabelAngle: 40, - xAxisLabelTopPadding: 7, - padding: 40, - hideHover: true - }).on('click', update = (i, row) -> - get_import_results( $(".report"), $(".lines")) )
\ No newline at end of file |
