diff options
| author | Marc Florisson | 2014-01-22 17:41:04 +0100 |
|---|---|---|
| committer | Marc Florisson | 2014-01-22 17:41:04 +0100 |
| commit | c9437fc2e96f415e38c1e72fa10337769381f289 (patch) | |
| tree | 199b39a7c8c5cc2cfef539f73f73c1b5fbea8a72 /app/views | |
| parent | 4e71abdc01f9f04ce6eec1989fa756ffc823fd65 (diff) | |
| download | chouette-core-c9437fc2e96f415e38c1e72fa10337769381f289.tar.bz2 | |
merge branch validation
Diffstat (limited to 'app/views')
44 files changed, 679 insertions, 366 deletions
diff --git a/app/views/compliance_check_results/_compliance_check_result.erb b/app/views/compliance_check_results/_compliance_check_result.erb new file mode 100644 index 000000000..afd94f62e --- /dev/null +++ b/app/views/compliance_check_results/_compliance_check_result.erb @@ -0,0 +1,21 @@ + <div class="severity_<%= compliance_check_result.severity %> status_<%= compliance_check_result.status %>"> + <div class="status_icon"> + <%= image_tag "icons/status_#{compliance_check_result.status}.png", :class => "status" %> + </div> + <div class="status_text"> + <div class="code"> + <%= compliance_check_result.rule_code %> + </div> + <div class="severity"> + [ <%= ComplianceCheckResult.human_attribute_name(:severity) %> : <%= t compliance_check_result.severity, :scope => "compliance_check_result.severities" %> ] + </div> + <div class="explanation"> + <%= ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) %> + </div> + <div class="attributes"> + <% if compliance_check_result.violation_count > 0 %> + <%= ComplianceCheckResult.human_attribute_name(:violation_count) %> : + <% end %> + </div> + </div> +</div> diff --git a/app/views/compliance_check_results/index.html.erb b/app/views/compliance_check_results/index.html.erb new file mode 100644 index 000000000..886664857 --- /dev/null +++ b/app/views/compliance_check_results/index.html.erb @@ -0,0 +1,56 @@ +<table class="table table-hover"> + <thead> + <tr> + <th>#</th> + <th><%= ComplianceCheckResult.human_attribute_name(:status) %></th> + <th><%= ComplianceCheckResult.human_attribute_name(:severity) %></th> + <th><%= ComplianceCheckResult.human_attribute_name(:rule_level) %></th> + <th><%= ComplianceCheckResult.human_attribute_name(:rule_code) %></th> + <% if @compliance_check_results && @compliance_check_results.first.status == "nok" %> + <th><%= ComplianceCheckResult.human_attribute_name(:detail) %></th> + <% end %> + </tr> + </thead> + <tbody> + <% @compliance_check_results.each_with_index do |compliance_check_result, index| %> + <tr> + <td><%= index + 1 %></td> + <td><%= image_tag "icons/status_#{compliance_check_result.status}.png" %></td> + <td><%= t compliance_check_result.severity, :scope => "compliance_check_result.severities" %></td> + <td><%= compliance_check_result.rule_level %></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 compliance_check_result.rule_code, "#", :title => ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) %></td> + <% if @compliance_check_results && @compliance_check_results.first.status == "nok" %> + <td class="td_error"> + <% if compliance_check_result.detail.present? %> + <span class="title_error"> + <i class="fa fa-plus-square"></i><%= compliance_check_result.violation_count.to_s + " " + ComplianceCheckResult.human_attribute_name(:violation_count) %> + </span> + <div class="details_error"> + <% 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) + "<br>" + t("compliance_check_result.details." + error["messageKey"], error["messageArgs"].symbolize_keys ), :"data-title" => t("activerecord.attributes.compliance_check_result.detail"), :class =>"notice" %> + <% else %> + |- <%= image_tag "icons/notice.png", :"data-content" => ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) + "<br>" + t("compliance_check_result.details." + error["messageKey"]), :"data-title" => t("activerecord.attributes.compliance_check_result.detail"), :class =>"notice" %> + <% end %> + <% if error["location"]["url"].present? %> + <%= link_to error["objectId"], referential_path(@referential) + "/" + error["location"]["url"] %> + <% elsif error["location"]["filename"].present? %> + <%= error["objectId"] %><br> + <span class="file_error"> <%= File.basename(error["location"]["filename"]) %> + <%= t("compliance_check_results.index.column") %>: <%= error["location"]["columnNumber"] %>, <%= t("compliance_check_results.index.line") %>: <%= error["location"]["lineNumber"] %></span> + <% end %> + </p> + <% end %> + </div> + <% end %> + </td> + <% end %> + </tr> + <% end %> + </tbody> +</table> +<%= javascript_include_tag referential_compliance_check_task_compliance_check_results_path(@compliance_check_task.referential, @compliance_check_task, :format => :js) %> + diff --git a/app/views/compliance_check_results/index.js.coffee b/app/views/compliance_check_results/index.js.coffee new file mode 100644 index 000000000..c73676d88 --- /dev/null +++ b/app/views/compliance_check_results/index.js.coffee @@ -0,0 +1,8 @@ +jQuery -> + $("body").popover({ selector: '.notice', container: "body", trigger: "click", html: true, placement: "bottom" }) + + # Hide and show error details + $(".title_error").each -> + $( this ).click -> + $(this).next(".details_error").toggle() + $(this).children("i").toggleClass("fa-plus-square fa-minus-square")
\ No newline at end of file diff --git a/app/views/compliance_check_tasks/_compliance_check_task.erb b/app/views/compliance_check_tasks/_compliance_check_task.erb new file mode 100644 index 000000000..3c5388b00 --- /dev/null +++ b/app/views/compliance_check_tasks/_compliance_check_task.erb @@ -0,0 +1,22 @@ +<%= div_for(compliance_check_task, :class => :compliance_check_task) do %> + <div class="icon"> + <%= link_to image_tag("compliance_check_task-#{compliance_check_task.status}.png"), referential_compliance_check_task_path(@referential, compliance_check_task) %> + </div> + <div class="resume"> + <ul class="header clearfix"> + <li class="title"><%= link_to(compliance_check_task.name, referential_compliance_check_task_path(@referential, compliance_check_task)) %></li> + <li class="remove"><%= link_to "<i class='fa fa-trash-o'></i>".html_safe, referential_compliance_check_task_path(@referential, compliance_check_task), :method => :delete, :class => "delete", :data => {:confirm => t('compliance_check_tasks.actions.destroy_confirm')} %></li> + </ul> + <div class="links"> + <% if compliance_check_task.import_task.present? %> + <p><%= link_to( image_tag('icons/link_page.png') + t("compliance_check_tasks.import_task"), referential_import_task_path(@referential, compliance_check_task.import_task)) %></p> + <% end %> + <% if compliance_check_task.parameter_set %> + <p><%= link_to( image_tag('icons/link_page.png') + t("compliance_check_tasks.actions.rule_parameter_set"), rule_parameter_set_referential_compliance_check_task_path(@referential, compliance_check_task)) %></p> + <% end %> + </div> + <div class="history"> + <%= l compliance_check_task.created_at, :format => "%d/%m/%Y %H:%M" %> | <%= compliance_check_task.user_name %> + </div> + </div> +<% end %> diff --git a/app/views/file_validations/_test_sheet_toc.html.erb b/app/views/compliance_check_tasks/_test_sheet_toc.html.erb index 0605510b4..0605510b4 100644 --- a/app/views/file_validations/_test_sheet_toc.html.erb +++ b/app/views/compliance_check_tasks/_test_sheet_toc.html.erb diff --git a/app/views/compliance_check_tasks/index.html.erb b/app/views/compliance_check_tasks/index.html.erb new file mode 100644 index 000000000..e28d98f1a --- /dev/null +++ b/app/views/compliance_check_tasks/index.html.erb @@ -0,0 +1,18 @@ +<%= title_tag t('.title') %> +<div class="warning"><%= t('.warning') %> </div> +<div class="page_info"> + <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @compliance_check_tasks %> +</div> +<div class="compliance_check_tasks paginated_content"> + <%= render :partial => "compliance_check_task", :collection => @compliance_check_tasks %> +</div> +<div class="pagination"> + <%= will_paginate @compliance_check_tasks, :container => false %> +</div> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('compliance_check_tasks.actions.new'), new_referential_compliance_check_task_path(), :class => "add" %></li> + <li><%= link_to t('rule_parameter_sets.actions.index'), referential_rule_parameter_sets_path(@referential), :class => "link" %></li> +</ul> +<% end %> diff --git a/app/views/compliance_check_tasks/new.html.erb b/app/views/compliance_check_tasks/new.html.erb new file mode 100644 index 000000000..1d15377e4 --- /dev/null +++ b/app/views/compliance_check_tasks/new.html.erb @@ -0,0 +1,22 @@ +<%= title_tag t(".title") %> + +<%= semantic_form_for [@referential, @compliance_check_task] do |form| %> + <%= form.inputs do %> + <%= form.input :rule_parameter_set_id, :as => :select, + :collection => @referential.rule_parameter_sets.map { |rps| [ rps.name, rps.id ] }, :include_blank => false %> + + <%= form.input :references_type, :as => :select, :collection => ComplianceCheckTask.references_types.map { |c| [ c.model_name.human.capitalize.pluralize, c.name ] }, :include_blank => t(".all") %> + + <% ComplianceCheckTask.references_types.each do |type| %> + <%= type_ids_model_references_input(form, @compliance_check_task, ComplianceCheckTask, type).input %> + <% end %> + <% end %> + + <%= form.actions do %> + <%= form.action :submit, :as => :button , :label => t( 'formtastic.validate' ) %> + <%= form.action :cancel, :as => :link %> + <% end %> +<% end %> + +<%= javascript_include_tag new_referential_compliance_check_task_path(@referential, :format => :js) %> + diff --git a/app/views/compliance_check_tasks/new.js.coffee b/app/views/compliance_check_tasks/new.js.coffee new file mode 100644 index 000000000..f8f60ac79 --- /dev/null +++ b/app/views/compliance_check_tasks/new.js.coffee @@ -0,0 +1,4 @@ +jQuery -> + <% ComplianceCheckTask.references_types.map { |type| type_ids_model_references_type( ComplianceCheckTask, type)}.each do |rt| %> + $("textarea.<%= rt.input_class %>").tokenInput('<%= references_referential_compliance_check_tasks_path(@referential, :type => rt.relation_name, :format => :json) %>', { prePopulate: $('#').data('pre'), minChars: 1 }); + <% end %> diff --git a/app/views/compliance_check_tasks/show.html.erb b/app/views/compliance_check_tasks/show.html.erb new file mode 100644 index 000000000..239cea7dc --- /dev/null +++ b/app/views/compliance_check_tasks/show.html.erb @@ -0,0 +1,38 @@ +<%= title_tag "#{@compliance_check_task.name} <span class='status status_#{@compliance_check_task.status}'>#{ t('compliance_check_tasks.show.'+@compliance_check_task.status) }</span>" %> + +<div class="compliance_check_task_show"> + <div class="links"> + <% if @compliance_check_task.import_task %> + <%= link_to t("compliance_check_tasks.import_task"), referential_import_task_path(@compliance_check_task.referential, @compliance_check_task.import_task), :class => "btn btn-default" %> + <% end %> + <% if @compliance_check_task.rule_parameter_set_archived %> + <%= link_to t("compliance_check_tasks.rule_parameter_set"), rule_parameter_set_referential_compliance_check_task_path(@compliance_check_task.referential, @compliance_check_task), :class => "btn btn-default" %> + <% end %> + </div> + <% if @compliance_check_task.status == 'completed'%> + <div class="resume"> + <div class="col1"> + <div class="caption"><%= t "error", :scope => "compliance_check_result.severities" %></div> + <div class="graph" id="error"></div> + </div> + <div class="col2"> + <div class="caption"><%= t "warning", :scope => "compliance_check_result.severities" %></div> + <div class="graph" id="warning"></div> + </div> + </div> + <div class="order" style="display: none;"> + Filtre : <%= select_tag "order", ("<option value='severity'>" + ComplianceCheckResult.human_attribute_name(:severity) +"</option><option value='status'>" + ComplianceCheckResult.human_attribute_name(:status) + "</option>").html_safe, :include_blank => false %> + </div> + + <div class="report"></div> + <% end %> + <%= javascript_include_tag referential_compliance_check_task_path(@compliance_check_task.referential, @compliance_check_task,:format => :js) %> +</div> +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('compliance_check_tasks.actions.destroy'), referential_compliance_check_task_path(@referential, @compliance_check_task), :method => :delete, :data => {:confirm => t('compliance_check_tasks.actions.destroy_confirm')}, :class => "remove" %></li> +</ul> + +<%= history_tag(@compliance_check_task) %> + +<% end %> diff --git a/app/views/compliance_check_tasks/show.js.coffee b/app/views/compliance_check_tasks/show.js.coffee new file mode 100644 index 000000000..ffcc6dc5b --- /dev/null +++ b/app/views/compliance_check_tasks/show.js.coffee @@ -0,0 +1,62 @@ +jQuery -> + + get_compliance_check_results = (html_container, status, severity) -> + h = new Object() + h["status"] = status if status + h["severity"] = severity if severity + $.get( + "<%= @compliance_check_task.id %>/compliance_check_results", + h, + update = (data) -> + html_container.append(data) + ) + + order_change = (event) -> + console.log "order change" + + $('.compliance_check_tasks.show .order').change(order_change) + + Morris.Donut({ + element: 'error', + data: [ + {label: "<%= t 'nok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.nok.error.count %>}, + {label: "<%= t 'na', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.na.error.count %>}, + {label: "<%= t 'ok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.ok.error.count %>} + ] + colors: [ "#e22b1b", "#ffbd2b", "#8fc861" ] + }).on('click', update = (i, row) -> + $(".report").empty() + switch i + when 0 then get_compliance_check_results( $(".report"), "nok", "error") + when 1 then get_compliance_check_results( $(".report"), "na", "error") + when 2 then get_compliance_check_results( $(".report"), "ok", "error") + else console.log "Error no other value for donut chart") + + Morris.Donut({ + element: 'warning', + data: [ + {label: "<%= t 'nok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.nok.warning.count %>}, + {label: "<%= t 'na', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.na.warning.count %>}, + {label: "<%= t 'ok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.ok.warning.count %>} + ] + colors: [ "#e22b1b", "#ffbd2b", "#8fc861" ] + }).on('click', update = (i, row) -> + $(".report").empty() + switch i + when 0 then get_compliance_check_results( $(".report"), "nok", "warning") + when 1 then get_compliance_check_results( $(".report"), "na", "warning") + when 2 then get_compliance_check_results( $(".report"), "ok", "warning") + else console.log "Error no other value for donut chart") + + $(".resume .col1 .caption").click -> + $(".report").empty() + get_compliance_check_results( $(".report"), null, "error") + + $(".resume .col2 .caption").click -> + $(".report").empty() + get_compliance_check_results( $(".report"), null, "warning") + + $('img[title]').tipsy({gravity: 'w'}) + $('a[title]').tipsy({gravity: 'w'}) + + diff --git a/app/views/connection_links/_connection_link.erb b/app/views/connection_links/_connection_link.erb index 01128051a..0cdcd6f34 100644 --- a/app/views/connection_links/_connection_link.erb +++ b/app/views/connection_links/_connection_link.erb @@ -1,21 +1,21 @@ <%= div_for(connection_link) do %> - <%= link_to truncate(connection_link.name, :length => 30), [@referential, connection_link], :title => "#{Chouette::TimeTable.model_name.human} #{connection_link.name}" %> + <%= link_to truncate(connection_link.name, :length => 35), [@referential, connection_link], :title => "#{Chouette::TimeTable.model_name.human} #{connection_link.name}" %> <div class="info"> <%= t('.from') %> - <% if connection_link.departure.present? %> - <%= link_to_if connection_link.departure, connection_link.departure.name, referential_stop_area_path(@referential, connection_link.departure), :title => "#{connection_link.human_attribute_name('departure')} #{connection_link.departure.name}" %> + <% if connection_link.departure.present? %> + <%= link_to_if connection_link.departure, truncate(connection_link.departure.name, :length => 15) , referential_stop_area_path(@referential, connection_link.departure), :title => "#{connection_link.human_attribute_name('departure')} #{connection_link.departure.name}" %> <% else %> - <%= connection_link.human_attribute_name('undefined') %> + <%= connection_link.human_attribute_name('undefined') %> <% end %> <%= t('.to') %> - <% if connection_link.arrival.present? %> - <%= link_to_if( connection_link.arrival, connection_link.arrival.name, referential_stop_area_path(@referential, connection_link.arrival), :title => "#{connection_link.human_attribute_name('arrival')} #{connection_link.arrival.name}" ) %> + <% if connection_link.arrival.present? %> + <%= link_to_if( connection_link.arrival, truncate(connection_link.arrival.name, :length => 15), referential_stop_area_path(@referential, connection_link.arrival), :title => "#{connection_link.human_attribute_name('arrival')} #{connection_link.arrival.name}" ) %> <% else %> <%= connection_link.human_attribute_name("undefined") %> - <% end %> - - <%= connection_link.human_attribute_name('default_duration').capitalize %>: <%= connection_link.default_duration ? connection_link.default_duration.strftime('%Mm %Ss') : connection_link.human_attribute_name("undefined") %> + <% end %> - + <%= connection_link.human_attribute_name('default_duration').capitalize %>: <%= connection_link.default_duration ? connection_link.default_duration.strftime('%Mm %Ss') : connection_link.human_attribute_name("undefined") %> - <div class="actions"> + <div class="actions"> <%= link_to t("actions.edit"), edit_referential_connection_link_path(@referential, connection_link), :class => "edit" %> | <%= link_to t("actions.destroy"), referential_connection_link_path(@referential, connection_link), :method => :delete, :data => {:confirm => t('connection_links.actions.destroy_confirm')}, :class => "remove" %> </div> diff --git a/app/views/exports/new.html.erb b/app/views/exports/new.html.erb index 60c1cff48..553ebe4a2 100644 --- a/app/views/exports/new.html.erb +++ b/app/views/exports/new.html.erb @@ -8,7 +8,7 @@ <% @available_exports.each do |export| %> <%= semantic_form_for [@referential, export], :as => :export, :url => referential_exports_path(@referential), :html => { :id => "#{export.type}_new", :style => ('display: none' unless @export == export)} do |form| %> - <%= form.inputs do %> + <%= form.inputs do %> <%= fields_for_export_type form %> <% end %> <%= form.inputs do %> @@ -17,7 +17,7 @@ <%= form.input :references_type, :as => :select, :collection => Export.references_types.map { |c| [ c.model_name.human.capitalize.pluralize, c.name ] }, :include_blank => t(".all") %> <% Export.references_types.each do |type| %> - <%= export_references_input(form, @export, type).input %> + <%= type_ids_model_references_input(form, @export, Export, type).input %> <% end %> <% end %> diff --git a/app/views/exports/new.js.coffee b/app/views/exports/new.js.coffee index f3d815d82..01835f404 100644 --- a/app/views/exports/new.js.coffee +++ b/app/views/exports/new.js.coffee @@ -1,4 +1,4 @@ jQuery -> - <% Export.references_types.each do |type| %> - $("textarea.<%= export_references_type(type).input_class %>").tokenInput('<%= references_referential_exports_path(@referential, :type => export_references_type(type).relation_name, :format => :json) %>', { prePopulate: $('#').data('pre'), minChars: 1 }); + <% Export.references_types.map { |type| type_ids_model_references_type( Export, type)}.each do |rt| %> + $("textarea.<%= rt.input_class %>").tokenInput('<%= references_referential_compliance_check_tasks_path(@referential, :type => rt.relation_name, :format => :json) %>', { prePopulate: $('#').data('pre'), minChars: 1 }); <% end %> diff --git a/app/views/file_validations/_file_validation.erb b/app/views/file_validations/_file_validation.erb deleted file mode 100644 index 7ffed1417..000000000 --- a/app/views/file_validations/_file_validation.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%= div_for(file_validation, :class => :file_validation) do %> - <%= link_to(file_validation_path(file_validation), :class => "preview") do %> - <%= image_tag "file-validation-#{file_validation.status}.png" %> - <% end %> - <%= link_to(file_validation.name, file_validation_path(file_validation)) %> - <div class="info"> - <%= l file_validation.created_at %><br/> - <%= file_validation.file_name %> - <div class="actions"> - <%= link_to t("actions.destroy"), file_validation_path(file_validation), :method => :delete, :data => {:confirm => t('file_validations.actions.destroy_confirm')}, :class => "remove" %> - </div> - </div> -<% end %> diff --git a/app/views/file_validations/index.html.erb b/app/views/file_validations/index.html.erb deleted file mode 100644 index 2e0cefbe8..000000000 --- a/app/views/file_validations/index.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<%= title_tag t('.title') %> -<div class="warning"><%= t('.warning') %> </div> -<div class="pagination"> - <div class="page_info"> - <%= page_entries_info @file_validations %> - </div> - <%= will_paginate @file_validations, :container => false %> -</div> -<div class="file_validations paginated_content"> - <%= render :partial => "file_validation", :collection => @file_validations %> -</div> -<div class="pagination"> - <%= will_paginate @file_validations, :container => false %> -</div> - -<% content_for :sidebar do %> -<ul class="actions"> - <li><%= link_to t('file_validations.actions.new'), new_file_validation_path(), :class => "add" %></li> -</ul> -<% end %> diff --git a/app/views/file_validations/new.html.erb b/app/views/file_validations/new.html.erb deleted file mode 100644 index 3a86cfac9..000000000 --- a/app/views/file_validations/new.html.erb +++ /dev/null @@ -1,51 +0,0 @@ -<%= title_tag t(".title") %> - -<%= semantic_form_for @file_validation do |form| %> - <%= form.inputs do %> - <%= form.input :resources, :as => :file %> - <%= form.input :test3_1_minimal_distance, :as => :number,:input_html => { :value => '10.0' }, :wrapper_html => { :class => 'fl' } %> - <%= form.input :test3_2_minimal_distance, :as => :number,:input_html => { :value => '10.0' }, :wrapper_html => { :class => 'fl' } %> - <%= form.input :test3_2_polygon_points , :as => :text ,:input_html => { :rows => '4', :value => '2.303466,51.399206 8.411865,49.05227 7.950439,43.34116 3.138427,41.869561 -2.376709,43.2932 -5.848389,48.705463' }%> - <%= form.input :test3_7_minimal_distance, :as => :number ,:input_html => { :value => '50.0' }, :wrapper_html => { :class => 'fl1' } %> - <%= form.input :test3_7_maximal_distance, :as => :number ,:input_html => { :value => '15000.0' },:wrapper_html => { :class => 'fl2' } %> - <%= form.input :test3_8a_minimal_speed, :as => :number ,:input_html => { :value => '3.0' }, :wrapper_html => { :class => 'fl1' } %> - <%= form.input :test3_8a_maximal_speed, :as => :number ,:input_html => { :value => '6.0' }, :wrapper_html => { :class => 'fl2' } %> - <%= form.input :test3_8b_minimal_speed, :as => :number ,:input_html => { :value => '4.0' }, :wrapper_html => { :class => 'fl1' } %> - <%= form.input :test3_8b_maximal_speed, :as => :number ,:input_html => { :value => '7.0' }, :wrapper_html => { :class => 'fl2' } %> - <%= form.input :test3_8c_minimal_speed, :as => :number ,:input_html => { :value => '2.0' }, :wrapper_html => { :class => 'fl1' } %> - <%= form.input :test3_8c_maximal_speed, :as => :number ,:input_html => { :value => '5.0' }, :wrapper_html => { :class => 'fl2' } %> - <%= form.input :test3_8d_minimal_speed, :as => :number ,:input_html => { :value => '1.0' }, :wrapper_html => { :class => 'fl1' } %> - <%= form.input :test3_8d_maximal_speed, :as => :number ,:input_html => { :value => '4.0' }, :wrapper_html => { :class => 'fl2' } %> - <%= form.input :test3_9_minimal_speed, :as => :number ,:input_html => { :value => '5.0' }, :wrapper_html => { :class => 'fl1' } %> - <%= form.input :test3_9_maximal_speed, :as => :number ,:input_html => { :value => '45.0' }, :wrapper_html => { :class => 'fl2' } %> - <% end %> - <%= form.inputs do %> - <%= form.input :test3_10_minimal_distance, :as => :number ,:input_html => { :value => '50.0' }, :wrapper_html => { :class => 'fl' } %> - <%= form.input :test3_15_minimal_time, :as => :number,:input_html => { :value => '1' }, :wrapper_html => { :class => 'fl' } %> - <%= form.input :test3_16_1_maximal_time, :as => :number,:input_html => { :value => '120' }, :wrapper_html => { :class => 'fl' } %> - <%= form.input :test3_16_3a_maximal_time, :as => :number ,:input_html => { :value => '600' }, :wrapper_html => { :class => 'fl' } %> - <%= form.input :test3_16_3b_maximal_time, :as => :number ,:input_html => { :value => '300' }, :wrapper_html => { :class => 'fl' } %> - <%= form.input :test3_21a_minimal_speed, :as => :number ,:input_html => { :value => '3.0' }, :wrapper_html => { :class => 'fl1' } %> - <%= form.input :test3_21a_maximal_speed, :as => :number ,:input_html => { :value => '6.0' }, :wrapper_html => { :class => 'fl2' } %> - <%= form.input :test3_21b_minimal_speed, :as => :number ,:input_html => { :value => '4.0' }, :wrapper_html => { :class => 'fl1' } %> - <%= form.input :test3_21b_maximal_speed, :as => :number ,:input_html => { :value => '7.0' }, :wrapper_html => { :class => 'fl2' } %> - <%= form.input :test3_21c_minimal_speed, :as => :number ,:input_html => { :value => '2.0' }, :wrapper_html => { :class => 'fl1' } %> - <%= form.input :test3_21c_maximal_speed, :as => :number ,:input_html => { :value => '2.0' }, :wrapper_html => { :class => 'fl2' } %> - <%= form.input :test3_21d_minimal_speed, :as => :number ,:input_html => { :value => '1.0' }, :wrapper_html => { :class => 'fl1' } %> - <%= form.input :test3_21d_maximal_speed, :as => :number ,:input_html => { :value => '4.0' }, :wrapper_html => { :class => 'fl2' } %> - <% end %> - <%= form.inputs do %> - <%= form.input :projection_reference ,:input_html => { :value => 'WGS84' }, :wrapper_html => { :class => 'fl' } %> - <% end %> - - <%= form.actions do %> - <%= form.action :submit, :as => :button , :label => t( 'formtastic.validate' ) %> - <%= form.action :cancel, :as => :link %> - <% end %> -<% end %> - -<% content_for :sidebar do %> -<%= render :partial => "test_sheet_toc" %> -<% end %> - - diff --git a/app/views/file_validations/show.html.erb b/app/views/file_validations/show.html.erb deleted file mode 100644 index d3d53fde5..000000000 --- a/app/views/file_validations/show.html.erb +++ /dev/null @@ -1,151 +0,0 @@ -<%= title_tag @file_validation.name %> - -<div class="file_validation_show"> - <div class="panelDataSection"><%= t(".summary") %></div> - - <div class="neptune-panel"> - <label><%= FileValidation.human_attribute_name(:created_at) %>: </label> - <%= l @file_validation.created_at %><br/> - <label><%= FileValidation.human_attribute_name(:status) %>: </label> - <%= t @file_validation.status, :scope => "file_validations.statuses" %><br/> - <label><%= FileValidation.human_attribute_name(:file_name) %>: </label> - <%= @file_validation.file_name %><br/> - <br/> - <br/> - <% if @file_validation.status == 'completed' %> - <table> - <tbody> - <tr> - <td><%= image_tag "severity-uncheck.png" , :alt => t("uncheck", :scope => "file_validation_log_messages.severities") %> - <%= t( "file_validations.uncheck_count" , :count => @file_validation.uncheck_count )%> - </td> - <td><%= image_tag "severity-ok.png" , :alt => t("ok", :scope => "file_validation_log_messages.severities") %> - <%= t( "file_validations.ok_count" , :count => @file_validation.ok_count )%> - </td> - <td><%= image_tag "severity-warning.png" , :alt => t("warning", :scope => "file_validation_log_messages.severities") %> - <%= t( "file_validations.warning_count" , :count => @file_validation.warning_count )%> - </td> - <td><%= image_tag "severity-error.png" , :alt => t("error", :scope => "file_validation_log_messages.severities") %> - <%= t( "file_validations.error_count" , :count => @file_validation.error_count )%> - </td> - <td><%= image_tag "severity-fatal.png" , :alt => t("fatal", :scope => "file_validation_log_messages.severities") %> - <%= t( "file_validations.fatal_count" , :count => @file_validation.fatal_count )%> - </td> - </tr> - </tbody> - </table> - <% end %> - </div> -<% if @file_validation.status == 'completed' %> - <h3><%= t(".details") %></h3> - <% @file_validation.log_message_tree.each do |message1| %> - <label class="category"><%= message1.full_message %></label> - <div id="<%= message1.key %>" style="margin-left: 40px;"> - <% message1.children.each do |message2| %> - <div class="panelDataSection"><%= message2.full_message %></div> - <div id="<%= message2.severity %>" class="neptune-panel"> - <% message2.children.each do |message3| %> - <div class="<%= message3.severity %>"> - <div> - <label id=""><%= message3.label %></label> - </div> - <div id="" class="step"> - <%= message3.full_message %> - </div> - </div> - <% if !message3.children.nil? %> - <div id="" class="detail"> </div> - <div id="detail_0_4_0" class="neptune-panel-inSide"> - <ol> - <% message3.children.each do |message4| %> - <li> <%= message4.full_message %> </li> - <br> - <% end %> - </ol> - </div> - <% end %> - <% end %> - </div> - <% end %> - </div> - <% end %> - <div class="panelDataSection"><%= t(".parameters") %></div> - <div class="neptune-panel"> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_1_minimal_distance") %> :</label> - <label><%= @file_validation.test3_1_minimal_distance %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_2_minimal_distance") %> :</label> - <label><%= @file_validation.test3_2_minimal_distance %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_2_polygon_points") %> :</label> - <label><%= @file_validation.test3_2_polygon_points %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_7_minimal_distance") %> :</label> - <label><%= @file_validation.test3_7_minimal_distance %></label> / - <label><%= @file_validation.test3_7_maximal_distance %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_8a_minimal_speed") %> :</label> - <label><%= @file_validation.test3_8a_minimal_speed %></label> / - <label><%= @file_validation.test3_8a_maximal_speed %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_8b_minimal_speed") %> :</label> - <label><%= @file_validation.test3_8b_minimal_speed %></label> / - <label><%= @file_validation.test3_8b_maximal_speed %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_8c_minimal_speed") %> :</label> - <label><%= @file_validation.test3_8c_minimal_speed %></label> / - <label><%= @file_validation.test3_8c_maximal_speed %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_8d_minimal_speed") %> :</label> - <label><%= @file_validation.test3_8d_minimal_speed %></label> / - <label><%= @file_validation.test3_8d_maximal_speed %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_9_minimal_speed") %> :</label> - <label><%= @file_validation.test3_9_minimal_speed %></label> / - <label><%= @file_validation.test3_9_maximal_speed %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_10_minimal_distance") %> :</label> - <label><%= @file_validation.test3_10_minimal_distance %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_15_minimal_time") %> :</label> - <label><%= @file_validation.test3_15_minimal_time %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_16_1_maximal_time") %> :</label> - <label><%= @file_validation.test3_16_1_maximal_time %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_16_3a_maximal_time") %> :</label> - <label><%= @file_validation.test3_16_3a_maximal_time %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_16_3b_maximal_time") %> :</label> - <label><%= @file_validation.test3_16_3b_maximal_time %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_21a_minimal_speed") %> :</label> - <label><%= @file_validation.test3_21a_minimal_speed %></label> / - <label><%= @file_validation.test3_21a_maximal_speed %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_21b_minimal_speed") %> :</label> - <label><%= @file_validation.test3_21b_minimal_speed %></label> / - <label><%= @file_validation.test3_21b_maximal_speed %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_21c_minimal_speed") %> :</label> - <label><%= @file_validation.test3_21c_minimal_speed %></label> / - <label><%= @file_validation.test3_21c_maximal_speed %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.test3_21d_minimal_speed") %> :</label> - <label><%= @file_validation.test3_21d_minimal_speed %></label> / - <label><%= @file_validation.test3_21d_maximal_speed %></label> - <br> - <label class="label"><%= t("activerecord.attributes.file_validation.projection_reference") %> :</label> - <label><%= @file_validation.projection_reference %></label> - - </div> - - <% end %> -</div> -<% content_for :sidebar do %> -<ul class="actions"> - <li><%= link_to t('file_validations.actions.destroy'), file_validation_path(@file_validation), :method => :delete, :data => {:confirm => t('file_validations.actions.destroy_confirm')}, :class => "remove" %></li> -</ul> -<%= render :partial => "test_sheet_toc" %> - -<% end %> diff --git a/app/views/import_tasks/_fields_csv_import.erb b/app/views/import_tasks/_fields_csv_import.erb new file mode 100644 index 000000000..b4ae719a5 --- /dev/null +++ b/app/views/import_tasks/_fields_csv_import.erb @@ -0,0 +1 @@ +<%= form.input :object_id_prefix, :input_html => { :value => @referential.prefix } %> diff --git a/app/views/import_tasks/_fields_gtfs_import.erb b/app/views/import_tasks/_fields_gtfs_import.erb new file mode 100644 index 000000000..842a24ab7 --- /dev/null +++ b/app/views/import_tasks/_fields_gtfs_import.erb @@ -0,0 +1,7 @@ +<%= form.input :object_id_prefix, :input_html => { :value => @referential.prefix } %> +<%= form.input :max_distance_for_commercial , :as => :number , :input_html => { :title => t("tipsy.hints.import_task.max_distance_for_commercial"), :value => 50 } %> +<%= form.input :ignore_last_word , :as => :boolean , :input_html => { :title => t("tipsy.hints.import_task.ignore_last_word"), :value => false }%> +<%= form.input :ignore_end_chars , :as => :number , :input_html => { :title => t("tipsy.hints.import_task.ignore_end_chars"), :value => 0 }%> +<%= form.input :max_distance_for_connection_link , :as => :number , :input_html => { :title => t("tipsy.hints.import_task.max_distance_for_connection_link"), :value => 100 }%> + + diff --git a/app/views/import_tasks/_import_task.erb b/app/views/import_tasks/_import_task.erb new file mode 100644 index 000000000..afa235d4d --- /dev/null +++ b/app/views/import_tasks/_import_task.erb @@ -0,0 +1,20 @@ +<%= div_for import_task do %> + <div class="icon"> + <%= link_to image_tag("import_task-#{import_task.status}.png"), referential_import_task_path(@referential, import_task) %> + </div> + <div class="resume"> + <ul class="header clearfix"> + <li class="title"><%= link_to(import_task.name, referential_import_task_path(@referential, import_task)) %></li> + <li class="remove"><%= link_to "<i class='fa fa-trash-o'></i>".html_safe, referential_import_task_path(@referential, import_task), :method => :delete, :class => "delete", :data => {:confirm => t('import_tasks.actions.destroy_confirm')} %></li> + </ul> + <div class="links"> + <p><%= link_to image_tag("icons/file_#{import_task.file_path_extension}.png") + t("import_tasks.index.imported_file"), file_to_import_referential_import_task_path(@referential, import_task) %></p> + <% if import_task.compliance_check_task.present? %> + <p><%= link_to image_tag('icons/link_page.png') + t("import_tasks.compliance_check_task"), referential_compliance_check_task_path(@referential, import_task.compliance_check_task) %></p> + <% end %> + </div> + <div class="history"> + <%= l import_task.created_at, :format => "%d/%m/%Y %H:%M" %> | <%= import_task.user_name %> + </div> + </div> +<% end %> diff --git a/app/views/import_tasks/_results_dashboard.html.erb b/app/views/import_tasks/_results_dashboard.html.erb new file mode 100644 index 000000000..d1e674964 --- /dev/null +++ b/app/views/import_tasks/_results_dashboard.html.erb @@ -0,0 +1,67 @@ + <div class="resume"> + <div class="col1"> + <% file_title = (@import_task.file_path_extension=="zip") ? t( "import_tasks.show.graph.files.title_zip") : t( "import_tasks.show.graph.files.title_default", :extension => @import_task.file_path_extension)%> + <div class="caption"><%= file_title %></div> + <div id="files_statistics"></div> + </div> + <div class="col2"> + <div class="caption"><%= t "import_tasks.show.graph.lines.title" %></div> + <div id="objects_statistics"></div> + </div> + </div> + <div class="report"> + <div class="files files_error"> + <% @files_list["error"].each_with_index do |error, index| %> + <% index += 1 %> + <%= image_tag "icons/file_xml_md.png" %><span class="file_name"><%= truncate(error["name"], :length => 20) %></span> <% if index%4 == 0 %><br><% end %> + <% end %> + </div> + <div class="files files_ignored"> + <% @files_list["ignored"].each_with_index do |ignored, index| %> + <% index += 1 %> + <%= image_tag "icons/file_xml_md.png" %><span class="file_name"><%= truncate(ignored["name"], :length => 20) %></span> <% if index%4 == 0 %><br><% end %> + <% end %> + </div> + <div class="files files_ok"> + <% @files_list["ok"].each_with_index do |ok, index| %> + <% index += 1 %> + <%= image_tag "icons/file_xml_md.png" %><span class="file_name"><%= truncate(ok["name"], :length => 20) %></span> <% if index%4 == 0 %><br><% end %> + <% end %> + </div> + <div class="lines"> + <table class="table table-hover"> + <thead> + <tr> + <th>#</th> + <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> + <% @lines_list.each_with_index do |line, index| %> + <tr> + <td><%= index + 1 %></td> + <td><%= line["name"] %></td> + <td><%= t("import_tasks.show.table.line." + line["status"] ) %></td> + <td><%= line["stats"]["route_count"] %></td> + <td><%= line["stats"]["connection_link_count"] %></td> + <td><%= line["stats"]["time_table_count"] %></td> + <td><%= line["stats"]["stop_area_count"] %></td> + <td><%= line["stats"]["acces_point_count"] %></td> + <td><%= line["stats"]["vehicle_journey_count"] %></td> + <td><%= line["stats"]["journey_pattern_count"] %></td> + </tr> + <% end %> + </tbody> + </table> + </div> + </div> + <%= javascript_include_tag referential_import_task_path(@import_task.referential, @import_task,:format => :js) %> + diff --git a/app/views/import_tasks/index.html.erb b/app/views/import_tasks/index.html.erb new file mode 100644 index 000000000..df70120b5 --- /dev/null +++ b/app/views/import_tasks/index.html.erb @@ -0,0 +1,18 @@ +<%= title_tag t('.title') %> +<div class="warning"><%= t('.warning') %> </div> +<div class="page_info"> + <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @import_tasks %> +</div> +<div class="import_tasks paginated_content"> + <%= render :partial => "import_task", :collection => @import_tasks %> +</div> +<div class="pagination"> + <%= will_paginate @import_tasks, :container => false %> +</div> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('import_tasks.actions.new'), new_referential_import_task_path(@referential), :class => "add" %></li> + <li><%= link_to t('rule_parameter_sets.actions.index'), referential_rule_parameter_sets_path(@referential), :class => "link" %></li> +</ul> +<% end %> diff --git a/app/views/import_tasks/new.html.erb b/app/views/import_tasks/new.html.erb new file mode 100644 index 000000000..13888ad39 --- /dev/null +++ b/app/views/import_tasks/new.html.erb @@ -0,0 +1,31 @@ +<%= title_tag t(".title") %> + +<%= semantic_form_for([@referential, @import_task], :as => :import_task, :url => new_referential_import_task_path(@referential), :method => :get) do |form| %> + <%= form.inputs do %> + <%= form.input :format, :as => :radio, :collection => ImportTask.formats, :required => true, :include_blank => false %> + <% end %> +<% end %> + +<% @available_imports.each do |import_task| %> + <%= semantic_form_for [@referential, import_task], :as => :import_task, :url => referential_import_tasks_path(@referential), :html => { :id => "#{import_task.format}_new", :style => ('display: none' unless @import_task == import_task)} do |form| %> + + <%= form.inputs do %> + <%= fields_for_import_task_format form %> + <% end %> + + <%= form.inputs do %> + <%= form.input :format, :as => :hidden %> + <%= form.input :no_save, :as => :boolean, :collection => [true, false] %> + <%= form.input :rule_parameter_set_id, :as => :select, + :collection => @referential.rule_parameter_sets.map { |rps| [ rps.name, rps.id ] }, :include_blank => true %> + <%= form.input :resources, :as => :file %> + <% end %> + + <%= form.actions do %> + <%= form.action :submit, :as => :button , :label => t( 'formtastic.import' ) %> + <%= form.action :cancel, :as => :link %> + <% end %> + <% end %> +<% end %> + + diff --git a/app/views/import_tasks/show.html.erb b/app/views/import_tasks/show.html.erb new file mode 100644 index 000000000..781b9b07e --- /dev/null +++ b/app/views/import_tasks/show.html.erb @@ -0,0 +1,20 @@ +<%= title_tag "#{@import_task.full_name} <span class='status status_#{@import_task.status}'>#{ t('import_tasks.show.'+@import_task.status) }</span>" %> + +<div class="import_task_show"> + <div class="links"> + <%= link_to t("import_tasks.show.imported_file"), file_to_import_referential_import_task_path(@import_task.referential, @import_task), :class => "btn btn-default" %> + <% if @import_task.compliance_check_task %> + <%= link_to t("import_tasks.compliance_check_task"), referential_compliance_check_task_path(@import_task.referential, @import_task.compliance_check_task), :class => "btn btn-default" %> + <% end %> + </div> + <%= render( :partial => "results_dashboard") if @import_task.completed? %> +</div> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('import_tasks.actions.destroy'), referential_import_task_path(@referential, @import_task), :method => :delete, :data => {:confirm => t('import_tasks.actions.destroy_confirm')}, :class => "remove" %></li> +</ul> + +<%= history_tag(@import_task) %> + +<% end %> diff --git a/app/views/import_tasks/show.js.coffee b/app/views/import_tasks/show.js.coffee new file mode 100644 index 000000000..accd8e720 --- /dev/null +++ b/app/views/import_tasks/show.js.coffee @@ -0,0 +1,41 @@ +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 'import_tasks.show.graph.files.error' %>", value: <%= @files_stats["error_count"] %> }, + {label: "<%= t 'import_tasks.show.graph.files.ignored' %>", value: <%= @files_stats["ignored_count"] %> }, + {label: "<%= t 'import_tasks.show.graph.files.ok' %>", value: <%= @files_stats["ok_count"] %> } + ] + colors: [ "#e22b1b", "#ffbd2b", "#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("import_tasks.show.graph.lines.lines_stats") %>", value: <%= @lines_stats["line_count"] %> }, + { object: "<%= t("import_tasks.show.graph.lines.routes_stats") %>", value: <%= @lines_stats["route_count"] %> }, + { object: "<%= t("import_tasks.show.graph.lines.connection_links_stats") %>", value: <%= @lines_stats["connection_link_count"] %> }, + { object: "<%= t("import_tasks.show.graph.lines.time_tables_stats") %>", value: <%= @lines_stats["time_table_count"] %> }, + { object: "<%= t("import_tasks.show.graph.lines.stop_areas_stats") %>", value: <%= @lines_stats["stop_area_count"] %> }, + { object: "<%= t("import_tasks.show.graph.lines.access_points_stats") %>", value: <%= @lines_stats["access_point_count"] %> }, + { object: "<%= t("import_tasks.show.graph.lines.vehicle_journeys_stats") %>", value: <%= @lines_stats["vehicle_journey_count"] %> }, + { object: "<%= t("import_tasks.show.graph.lines.journey_patterns_stats") %>", value: <%= @lines_stats["journey_pattern_count"] %> }, + ], + xkey: 'object', + ykeys: ['value'], + labels: ['<%= t "import_tasks.show.graph.lines.objects_label" %>'] + }).on('click', update = (i, row) -> + get_import_results( $(".report"), $(".lines")) )
\ No newline at end of file diff --git a/app/views/imports/_fields_csv_import.erb b/app/views/imports/_fields_csv_import.erb deleted file mode 100644 index 2ab96acf7..000000000 --- a/app/views/imports/_fields_csv_import.erb +++ /dev/null @@ -1 +0,0 @@ -<%= form.input :objectid_prefix, :input_html => { :value => @referential.prefix } %> diff --git a/app/views/imports/_fields_gtfs_import.erb b/app/views/imports/_fields_gtfs_import.erb deleted file mode 100644 index dd75a41a5..000000000 --- a/app/views/imports/_fields_gtfs_import.erb +++ /dev/null @@ -1,7 +0,0 @@ -<%= form.input :objectid_prefix, :input_html => { :value => @referential.prefix } %> -<%= form.input :max_distance_for_commercial , :as => :number , :input_html => { :value => 50 } %> -<%= form.input :ignore_last_word , :as => :boolean , :input_html => { :value => false }%> -<%= form.input :ignore_end_chars , :as => :number , :input_html => { :value => 0 }%> -<%= form.input :max_distance_for_connection_link , :as => :number , :input_html => { :value => 100 }%> - - diff --git a/app/views/imports/_import.erb b/app/views/imports/_import.erb deleted file mode 100644 index 87e7c3190..000000000 --- a/app/views/imports/_import.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%= div_for(import, :class => :import) do %> - <%= link_to(referential_import_path(@referential, import), :class => "preview") do %> - <%= image_tag "import-#{import.status}.png" %> - <% end %> - <%= link_to(import.name, referential_import_path(@referential, import)) %> - <div class="info"> - <%= l import.created_at %> - - <div class="actions"> - <%= link_to t("actions.destroy"), referential_import_path(@referential, import), :method => :delete, :data => {:confirm => t('imports.actions.destroy_confirm')}, :class => "remove" %> - </div> - </div> -<% end %> diff --git a/app/views/imports/index.html.erb b/app/views/imports/index.html.erb deleted file mode 100644 index 8469fbd7b..000000000 --- a/app/views/imports/index.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<%= title_tag t('.title') %> -<div class="warning"><%= t('.warning') %> </div> -<div class="page_info"> - <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @imports %> -</div> -<div class="imports paginated_content"> - <%= render :partial => "import", :collection => @imports %> -</div> -<div class="pagination"> - <%= will_paginate @imports, :container => false %> -</div> - -<% content_for :sidebar do %> -<ul class="actions"> - <li><%= link_to t('imports.actions.new'), new_referential_import_path(@referential), :class => "add" %></li> -</ul> -<% end %> diff --git a/app/views/imports/new.html.erb b/app/views/imports/new.html.erb deleted file mode 100644 index f99ca9062..000000000 --- a/app/views/imports/new.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -<%= title_tag t(".title") %> - -<%= semantic_form_for([@referential, @import], :as => :import, :url => new_referential_import_path(@referential), :method => :get) do |form| %> - <%= form.inputs do %> - <%= form.input :type, :as => :radio, :collection => Import.types.map { |format| [ Import.format_name(format), format]}, :required => true, :include_blank => false %> - <% end %> -<% end %> - -<% @available_imports.each do |import| %> - <%= semantic_form_for [@referential, import], :as => :import, :url => referential_imports_path(@referential), :html => { :id => "#{import.type}_new", :style => ('display: none' unless @import == import)} do |form| %> - - <%= form.inputs do %> - <%= fields_for_import_type form %> - <% end %> - - <%= form.inputs do %> - <%= form.input :type, :as => :hidden %> - <%= form.input :resources, :as => :file %> - <% end %> - - <%= form.actions do %> - <%= form.action :submit, :as => :button , :label => t( 'formtastic.import' ) %> - <%= form.action :cancel, :as => :link %> - <% end %> - <% end %> -<% end %> diff --git a/app/views/imports/show.html.erb b/app/views/imports/show.html.erb deleted file mode 100644 index 15c595e95..000000000 --- a/app/views/imports/show.html.erb +++ /dev/null @@ -1,42 +0,0 @@ -<%= title_tag @import.name %> - -<div class="import_show"> - <div class="summary"> - <p> - <label><%= Import.human_attribute_name(:created_at) %>: </label> - <%= l @import.created_at %> - </p> - <p> - <label><%= Import.human_attribute_name(:status) %>: </label> - <%= t @import.status, :scope => "imports.statuses" %> - </p> - </div> - - <% if @import.log_messages.empty? %> - <p> <%= t(".not_yet_started") %> </p> - <% else %> - <h3><%= t(".report") %></h3> - <table> - <tr> - <th class="severity"></th> - <th class="created_at"><%= ImportLogMessage.human_attribute_name(:created_at) %></th> - <th class="position"><%= ImportLogMessage.human_attribute_name(:position) %></th> - <th class="message"><%= ImportLogMessage.human_attribute_name(:full_message) %></th> - </tr> - <% @import.log_messages.each do |message| %> - <tr> - <td class="severity"><%= image_tag "severity-#{message.severity}.png", :alt => t(message.severity, :scope => "import_log_messages.severities") %></td> - <td class="created_at"><%= l message.created_at, :format => :short %></td> - <td class="position"><%= message.position %></td> - <td class="message"><%= message.full_message %></td> - </tr> - <% end %> - </table> - <% end %> -</div> - -<% content_for :sidebar do %> -<ul class="actions"> - <li><%= link_to t('imports.actions.destroy'), referential_import_path(@referential, @import), :method => :delete, :data => {:confirm => t('imports.actions.destroy_confirm')}, :class => "remove" %></li> -</ul> -<% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 81a87f5ae..e13a130e8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -44,7 +44,6 @@ <% elsif ! selected_referential? %> <% if user_signed_in? %> <li><%= link_to Referential.model_name.human(:count=>2), referentials_path, :class => ("current" if current_page?(referentials_path) || current_page?(root_url)) %></li> - <li><%= tab_link_to FileValidation.model_name.human(:count=>2), file_validations_path %></li> <li class="admin"><%= tab_link_to Organisation.model_name.human, organisation_path %></li> <% end %> <% else %> @@ -56,18 +55,16 @@ <li><%= tab_link_to Chouette::StopArea, referential_stop_areas_path(@referential) %></li> <li><%= tab_link_to Chouette::ConnectionLink, referential_connection_links_path(@referential) %></li> <li><%= tab_link_to Chouette::TimeTable, referential_time_tables_path(@referential) %></li> - - <li><%= tab_link_to Import, referential_imports_path(@referential) %></li> + <li><%= tab_link_to ImportTask, referential_import_tasks_path(@referential) %></li> <li><%= tab_link_to Export, referential_exports_path(@referential) %></li> + <li><%= tab_link_to ComplianceCheckTask, referential_compliance_check_tasks_path(@referential) %></li> <% end %> </ul> </div> </div> <div id="body"> - <div id="flash"> - <%= flash_tag flash %> - </div> <div id="workspace" class="<%= controller_name %> <%= action_name %>"> + <%= render partial: "shared/flash_messages", flash: flash %> <%= yield %> </div> <div id="sidebar"> diff --git a/app/views/lines/_line.erb b/app/views/lines/_line.erb index 88e222686..69baacd75 100644 --- a/app/views/lines/_line.erb +++ b/app/views/lines/_line.erb @@ -1,5 +1,5 @@ <%= div_for(line) do %> - <%= link_to([@referential, line], :class => "preview", :title => "#{Chouette::Line.model_name.human.capitalize} #{line.number}") do %> + <div><%= link_to([@referential, line], :class => "preview", :title => "#{Chouette::Line.model_name.human.capitalize} #{line.number}") do %></div> <div class="color"> <% if line.number and line.number.length <= 3 %> <div class="number"><%= line.number %></div> @@ -14,7 +14,7 @@ <% if line.network.nil? %> <%= line.human_attribute_name('network') %> <%= t('lines.index.unset') %> <% else %> - <%= line.human_attribute_name('network') %> <%= link_to_if line.network, line.network.name, referential_network_path(@referential, line.network), :title => "#{line.human_attribute_name('network')} #{line.network.name}" %> - + <%= line.human_attribute_name('network') %> <%= link_to_if line.network, line.network.name, referential_network_path(@referential, line.network), :title => "#{line.human_attribute_name('network')} #{line.network.name}" %><br> <% end %> <% if line.company.nil? %> <%= line.human_attribute_name('company') %> <%= t('lines.index.unset') %> diff --git a/app/views/lines/index.html.erb b/app/views/lines/index.html.erb index ff14e8749..0eed3e63b 100644 --- a/app/views/lines/index.html.erb +++ b/app/views/lines/index.html.erb @@ -45,10 +45,6 @@ <li><%= link_to t('lines.actions.new'), new_referential_line_path(@referential), :class => "add" %></li> </ul> -<ul class="actions"> - <li><%= link_to t('lines.actions.import'), new_referential_import_path(@referential), :class => "import" %></li> -</ul> - <h3><%= t(".selection") %></h3> <h4><%= Chouette::Company.model_name.human.pluralize %></h4> diff --git a/app/views/rule_parameter_sets/_form.html.erb b/app/views/rule_parameter_sets/_form.html.erb new file mode 100644 index 000000000..1f12d6b14 --- /dev/null +++ b/app/views/rule_parameter_sets/_form.html.erb @@ -0,0 +1,27 @@ +<%= semantic_form_for [@referential, @rule_parameter_set] do |form| %> + <%= form.inputs do %> + <%= form.input :name %> + <%= form.input :inter_stop_area_distance_min, :as => :number %> + <%= form.input :parent_stop_area_distance_max, :as => :number %> + <%= form.input :stop_areas_area %> + <%= form.input :inter_access_point_distance_min, :as => :number %> + <%= form.input :inter_connection_link_distance_max, :as => :number %> + <%= form.input :walk_default_speed_max, :as => :number %> + <%= form.input :walk_occasional_traveller_speed_max, :as => :number %> + <%= form.input :walk_frequent_traveller_speed_max, :as => :number %> + <%= form.input :walk_mobility_restricted_traveller_speed_max, :as => :number %> + + <%= form.input :inter_access_link_distance_max, :as => :number %> + <%= form.input :inter_stop_duration_max, :as => :number %> + <%= form.input :facility_stop_area_distance_max, :as => :number %> + + <% Chouette::Line.transport_modes.map(&:to_s).each do |mode| %> + <%= render :partial => "mode_fields", :locals => { :f => form, :mode => mode} %> + <% end %> + <% end %> + + <%= form.actions do %> + <%= form.action :submit, :as => :button %> + <%= form.action :cancel, :as => :link %> + <% end %> +<% end %> diff --git a/app/views/rule_parameter_sets/_mode_fields.html.erb b/app/views/rule_parameter_sets/_mode_fields.html.erb new file mode 100644 index 000000000..0a17b4d82 --- /dev/null +++ b/app/views/rule_parameter_sets/_mode_fields.html.erb @@ -0,0 +1,5 @@ +<%= f.inputs t("transport_modes.label.#{mode}"), :id => "specific_parameters_#{mode}" do %> + <% RuleParameterSet.mode_attribute_prefixes.each do |prefix| %> + <%= f.input "#{prefix}_mode_#{mode}".to_sym, :as => :number, :label => RuleParameterSet.human_attribute_name(prefix), :wrapper_html => { :class => "special"} %> + <% end %> +<% end %> diff --git a/app/views/rule_parameter_sets/_mode_selection.html.erb b/app/views/rule_parameter_sets/_mode_selection.html.erb new file mode 100644 index 000000000..56d1c05bb --- /dev/null +++ b/app/views/rule_parameter_sets/_mode_selection.html.erb @@ -0,0 +1,6 @@ +<select class="undescribed_modes"> + <% Chouette::TransportMode.all.map { |m| m.name.downcase}.each do |mode| %> + <option value='<%= mode %>'><%= t("transport_modes.label.#{mode}") %></option> + <% end %> +</select> + diff --git a/app/views/rule_parameter_sets/_transport_mode_parameter_set_fields.html.erb b/app/views/rule_parameter_sets/_transport_mode_parameter_set_fields.html.erb new file mode 100644 index 000000000..3d2bcd3d2 --- /dev/null +++ b/app/views/rule_parameter_sets/_transport_mode_parameter_set_fields.html.erb @@ -0,0 +1,10 @@ +<%= f.inputs :class => 'transport_mode_parameter_sets nested-fields' do %> + <%= f.input :transport_mode, :as => :select, :collection => Chouette::TransportMode.all, :include_blank => false, :member_label => Proc.new { |mode| t("transport_modes.label.#{mode}") }, :label => "transport_mode", :wrapper_html => { :class => 'fl1' } %> + <%= f.input :inter_stop_area_distance_min, :as => :number, :label => "inter_stop_area_distance_min", :wrapper_html => { :class => 'fl1' } %> + <%= f.input :inter_stop_area_distance_max, :as => :number, :label => "inter_stop_area_distance_max", :wrapper_html => { :class => 'fl2' } %> + <%= f.input :speed_min, :as => :number, :label => "speed_min", :wrapper_html => { :class => 'fl2' } %> + <%= f.input :speed_max, :as => :number, :label => "speed_max", :wrapper_html => { :class => 'fl2' } %> + <%= f.input :inter_stop_duration_variation_max, :as => :number, :label => "inter_stop_duration_variation_max", :wrapper_html => { :class => 'fl2' } %> + <%= link_to_remove_association t('actions.destroy'), f %> +<% end %> + diff --git a/app/views/rule_parameter_sets/edit.html.erb b/app/views/rule_parameter_sets/edit.html.erb new file mode 100644 index 000000000..eb2ca466f --- /dev/null +++ b/app/views/rule_parameter_sets/edit.html.erb @@ -0,0 +1,4 @@ +<%= title_tag t('rule_parameter_sets.edit.title', :rule_parameter_set => @rule_parameter_set.name ) %> + +<%= render "form" %> + diff --git a/app/views/rule_parameter_sets/index.html.erb b/app/views/rule_parameter_sets/index.html.erb new file mode 100644 index 000000000..c03ff0d15 --- /dev/null +++ b/app/views/rule_parameter_sets/index.html.erb @@ -0,0 +1,21 @@ +<%= 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 %> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('rule_parameter_sets.actions.new'), new_referential_rule_parameter_set_path(@referential), :class => "add" %></li> +</ul> +<% end %> diff --git a/app/views/rule_parameter_sets/mode.js.erb b/app/views/rule_parameter_sets/mode.js.erb new file mode 100644 index 000000000..22b70830e --- /dev/null +++ b/app/views/rule_parameter_sets/mode.js.erb @@ -0,0 +1,13 @@ +if ( $('#specific_parameters_<%= @mode %>').length == 0) { + <% form_content = "" %> + <% semantic_form_for [@referential, @rule_parameter_set] do |form| %> + <% form_content += render(:partial => 'mode_fields', :locals => { :mode => @mode, :f => form }) %> + <% end %> + $('#added_mode_parameter_set').before('<%= escape_javascript( form_content).html_safe %>'); +} +else { + $('#_destroy_mode_<%= @mode %>').attr( "value", false); + $('#specific_parameters_<%= @mode %>').toggle(); +} + + diff --git a/app/views/rule_parameter_sets/new.html.erb b/app/views/rule_parameter_sets/new.html.erb new file mode 100644 index 000000000..228a2da7a --- /dev/null +++ b/app/views/rule_parameter_sets/new.html.erb @@ -0,0 +1,4 @@ +<%= title_tag t('rule_parameter_sets.new.title') %> + +<%= render "form" %> + diff --git a/app/views/rule_parameter_sets/show.html.erb b/app/views/rule_parameter_sets/show.html.erb new file mode 100644 index 000000000..f2427e36e --- /dev/null +++ b/app/views/rule_parameter_sets/show.html.erb @@ -0,0 +1,109 @@ +<%= title_tag t('rule_parameter_sets.show.title', :rule_parameter_set => @rule_parameter_set.name ) %> + +<div class="rule_parameter_set_show"> + + <div class="summary"> + <p> + <label><%= RuleParameterSet.human_attribute_name("name") %>: </label> + <%= @rule_parameter_set.name %> + </p> + <p> + <label><%= RuleParameterSet.human_attribute_name("stop_areas_area") %>: </label> + <%= @rule_parameter_set.stop_areas_area %> + </p> + <div class="attributes_group" > + <span class="title"><%= t(".min_distance") %></span> + <div class="columns"> + <div class="two_columns"> + <label><%= t(".inter_stop_area_distance_min") %> : </label> + <span class="value"><%= @rule_parameter_set.inter_stop_area_distance_min %></span> + </div> + <div class="two_columns"> + <label><%= t(".inter_access_point_distance_min") %> : </label> + <span class="value"><%= @rule_parameter_set.inter_access_point_distance_min %></span> + </div> + </div> + </div> + <div class="attributes_group" > + <span class="title"><%= t(".max_distance") %></span> + <div class="columns"> + <div class="two_columns"> + <label><%= t(".parent_stop_area_distance_max") %>: </label> + <span class="value"><%= @rule_parameter_set.parent_stop_area_distance_max %></span> + </div> + <div class="two_columns"> + <label><%= t(".inter_connection_link_distance_max") %>: </label> + <span class="value"><%= @rule_parameter_set.inter_connection_link_distance_max %></span> + </div> + </div> + <div class="columns"> + <div class="two_columns"> + <label><%= t(".inter_access_link_distance_max") %>: </label> + <span class="value"><%= @rule_parameter_set.inter_access_link_distance_max %></span> + </div> + <div class="two_columns"> + <label><%= t(".facility_stop_area_distance_max") %>: </label> + <span class="value"><%= @rule_parameter_set.facility_stop_area_distance_max %></span> + </div> + </div> + </div> + <div class="attributes_group" > + <span class="title"><%= t(".walk_speed") %></span> + <div class="columns"> + <div class="four_columns"> + <label><%= t(".walk_default_speed_max") %>: </label> + <span class="value"><%= @rule_parameter_set.walk_default_speed_max %></span> + </div> + <div class="four_columns"> + <label><%= t(".walk_occasional_traveller_speed_max") %>: </label> + <span class="value"><%= @rule_parameter_set.walk_occasional_traveller_speed_max %></span> + </div> + <div class="four_columns"> + <label><%= t(".walk_frequent_traveller_speed_max") %>: </label> + <span class="value"><%= @rule_parameter_set.walk_frequent_traveller_speed_max %></span> + </div> + <div class="four_columns"> + <label><%= t(".walk_mobility_restricted_traveller_speed_max") %>: </label> + <span class="value"><%= @rule_parameter_set.walk_mobility_restricted_traveller_speed_max %></span> + </div> + </div> + </div> + <p> + <label><%= t(".inter_stop_duration_max") %>: </label> + <%= @rule_parameter_set.inter_stop_duration_max %> + </p> + <div class="rule_parameter_by_mode"> + <label><%= t(".rule_parameter_by_mode") %>: </label> + <select id="mode" > + <%= options_for_select( Chouette::Line.transport_modes.map(&:to_s).map { |s| [ I18n.t("transport_modes.label.#{s}"), s]}, 1) %> + </select> + <% Chouette::Line.transport_modes.map(&:to_s).each_with_index do |mode, index| %> + <% selected_class = (index==0) ? 'selected' : '' %> + <% style = (index==0) ? "style='display: block;'" : '' %> + <div class='<%= "#{mode} mode_specific #{selected_class}" %>' <%= style %> > + <% RuleParameterSet.mode_attribute_prefixes.each do |prefix| %> + <% unless @rule_parameter_set.send("#{prefix}_mode_#{mode}" ).blank? %> + <p> + <label><%= RuleParameterSet.human_attribute_name( prefix) %>: </label> + <%= @rule_parameter_set.send "#{prefix}_mode_#{mode}" %> + </p> + <% end %> + <% end %> + </div> + <% end %> + </div> + </div> +</div> + +<% content_for :sidebar do %> +<ul class="actions"> + <% if @rule_parameter_set.persisted? %> + <li><%= link_to t('rule_parameter_sets.actions.index'), referential_rule_parameter_sets_path(@referential), :class => "link" %></li> + <li><%= link_to t('rule_parameter_sets.actions.edit'), edit_referential_rule_parameter_set_path(@referential, @rule_parameter_set), :class => "edit" %></li> + <% if @referential.rule_parameter_sets.size > 1 %> + <li><%= link_to t('rule_parameter_sets.actions.destroy'), referential_rule_parameter_set_path(@referential, @rule_parameter_set), :method => :delete, :data => {:confirm => t('rule_parameter_sets.actions.destroy_confirm')}, :class => "remove" %></li> + <% end %> + <li><%= link_to t('rule_parameter_sets.actions.new'), new_referential_rule_parameter_set_path(@referential), :class => "add" %></li> + <% end %> +</ul> +<% end %> diff --git a/app/views/shared/_flash_messages.erb b/app/views/shared/_flash_messages.erb new file mode 100644 index 000000000..bad859aa9 --- /dev/null +++ b/app/views/shared/_flash_messages.erb @@ -0,0 +1,6 @@ +<% flash.each do |type, message| %> + <div class="alert <%= bootstrap_class_for(type) %> fade in"> + <button class="close" data-dismiss="alert">×</button> + <%= flash_message_for type, message %> + </div> +<% end %> |
