aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/main/exports.css.scss7
-rw-r--r--app/assets/stylesheets/main/imports.css.scss9
-rw-r--r--app/assets/stylesheets/modules/index_item.css.scss3
-rw-r--r--app/assets/stylesheets/modules/links.css.scss7
-rw-r--r--app/assets/stylesheets/partials/ie_report.css.scss5
-rw-r--r--app/helpers/application_helper.rb9
-rw-r--r--app/helpers/job_status_icon_helper.rb6
-rw-r--r--app/models/concerns/report_concern.rb26
-rw-r--r--app/models/export.rb8
-rw-r--r--app/models/gtfs_import.rb1
-rw-r--r--app/models/hub_export.rb3
-rw-r--r--app/models/import.rb39
-rw-r--r--app/models/neptune_export.rb3
-rw-r--r--app/views/export_tasks/_fields_gtfs_export.html.erb4
-rw-r--r--app/views/export_tasks/_fields_hub_export.html.erb4
-rw-r--r--app/views/export_tasks/_fields_neptune_export.html.erb4
-rw-r--r--app/views/exports/_export.erb2
-rw-r--r--app/views/exports/show.html.erb2
-rw-r--r--app/views/imports/_import.erb6
-rw-r--r--app/views/imports/show.html.erb6
-rw-r--r--app/views/shared/_ie_report.html.erb11
21 files changed, 111 insertions, 54 deletions
diff --git a/app/assets/stylesheets/main/exports.css.scss b/app/assets/stylesheets/main/exports.css.scss
index d8ed70b50..4c02738b8 100644
--- a/app/assets/stylesheets/main/exports.css.scss
+++ b/app/assets/stylesheets/main/exports.css.scss
@@ -9,9 +9,10 @@
#workspace.exports.show {
@import "../partials/ie_report";
@import "../modules/job_status_colors";
+ @import "../modules/links";
- .links{
- margin: 0 0 20px 0;
- img{ margin: 0 5px 0 15px; }
+ h2{
+ i{ margin: 0 5px 0 0; }
}
+
}
diff --git a/app/assets/stylesheets/main/imports.css.scss b/app/assets/stylesheets/main/imports.css.scss
index 9fc6d300c..c45d5361c 100644
--- a/app/assets/stylesheets/main/imports.css.scss
+++ b/app/assets/stylesheets/main/imports.css.scss
@@ -5,11 +5,10 @@
#workspace.imports.show {
@import "../partials/ie_report";
@import "../modules/job_status_colors";
-
- .links{
- margin: 0 0 20px 0;
- img{ margin: 0 5px 0 15px; }
- }
+ @import "../modules/links";
+ h2{
+ i{ margin: 0 5px 0 0; }
+ }
}
diff --git a/app/assets/stylesheets/modules/index_item.css.scss b/app/assets/stylesheets/modules/index_item.css.scss
index 968eb12c4..fe0ba8940 100644
--- a/app/assets/stylesheets/modules/index_item.css.scss
+++ b/app/assets/stylesheets/modules/index_item.css.scss
@@ -56,7 +56,8 @@
}
i{
- margin-right: 5px;
+ color: $gray;
+ margin-right: 5px;
}
span.included_day_type {
diff --git a/app/assets/stylesheets/modules/links.css.scss b/app/assets/stylesheets/modules/links.css.scss
new file mode 100644
index 000000000..ab9e1fbaf
--- /dev/null
+++ b/app/assets/stylesheets/modules/links.css.scss
@@ -0,0 +1,7 @@
+.links{
+ margin: 0 0 20px 0;
+ i{
+ color: $gray;
+ margin: 0 3px 0 15px;
+ }
+}
diff --git a/app/assets/stylesheets/partials/ie_report.css.scss b/app/assets/stylesheets/partials/ie_report.css.scss
index 0015746b2..a254b788b 100644
--- a/app/assets/stylesheets/partials/ie_report.css.scss
+++ b/app/assets/stylesheets/partials/ie_report.css.scss
@@ -39,7 +39,7 @@
}
}
- div.files_error{
+ .files_error{
color: #e22b1b;
display: none;
}
@@ -60,6 +60,9 @@
th, td{
text-align: center;
}
+
+ .fa-check{ color: $brand-success; }
+ .fa-times{ color: $brand-danger; }
}
}
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index eee3e1864..df2cb696b 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,4 +1,13 @@
module ApplicationHelper
+
+ def font_awesome_classic_tag(name, size = "")
+ if name == "fa-file-csv-o"
+ name = "fa-file-text-o"
+ elsif name == "fa-file-xml-o"
+ name = "fa-file-code-o"
+ end
+ "<i class='fa #{name} #{size}'></i>".html_safe
+ end
def stop_area_picture_url(stop_area)
image_path("map/#{stop_area.area_type.underscore}.png")
diff --git a/app/helpers/job_status_icon_helper.rb b/app/helpers/job_status_icon_helper.rb
index b7648536a..7dc325d30 100644
--- a/app/helpers/job_status_icon_helper.rb
+++ b/app/helpers/job_status_icon_helper.rb
@@ -6,11 +6,11 @@ module JobStatusIconHelper
title = ""
if %w{ aborted canceled }.include?(status)
- title += "<span class='name aborted'><i class='fa fa-times'></i>"
+ title += "<span class='aborted'><i class='fa fa-times'></i>"
elsif %w{ created scheduled }.include?(status)
- title += "<span class='name processed'><i class='fa fa-spinner fa-spin'></i>"
+ title += "<span class='processed'><i class='fa fa-spinner fa-spin'></i>"
elsif %w{ terminated}.include?(status)
- title += "<span class='name terminated'><i class='fa fa-check'></i>"
+ title += "<span class='terminated'><i class='fa fa-check'></i>"
end
title += "#{truncate(name, :length => 20)}</span>"
diff --git a/app/models/concerns/report_concern.rb b/app/models/concerns/report_concern.rb
index 2c4901566..7d3efff24 100644
--- a/app/models/concerns/report_concern.rb
+++ b/app/models/concerns/report_concern.rb
@@ -101,13 +101,31 @@ module ReportConcern
class LineItem
- attr_reader :name, :status, :stats
+ attr_reader :options
def initialize( options )
- @name = options.name if options.name?
- @status = options.status if options.status?
- @stats = options.stats if options.stats?
+ @options = options
end
+
+ def name
+ @name ||= options.name if options.name?
+ end
+
+ def stats
+ @stats ||= options.stats if options.stats?
+ end
+
+ def status
+ @status ||= if options.status?
+ if %w{ok warning}.include? options.status.downcase
+ true
+ else
+ false
+ end
+ else
+ false
+ end
+ end
def routes
stats ? stats.route_count : 0
diff --git a/app/models/export.rb b/app/models/export.rb
index ee008d590..c3895ffc5 100644
--- a/app/models/export.rb
+++ b/app/models/export.rb
@@ -1,5 +1,9 @@
class Export
include JobConcern
+
+ def report?
+ links["action_report"].present?
+ end
def report
Rails.cache.fetch("#{cache_key}/action_report", expires_in: cache_expiration) do
@@ -26,6 +30,10 @@ class Export
end
end
+ def file_path?
+ links["data"].present?
+ end
+
def file_path
links["data"]
end
diff --git a/app/models/gtfs_import.rb b/app/models/gtfs_import.rb
index a0e5ee10b..25eb670df 100644
--- a/app/models/gtfs_import.rb
+++ b/app/models/gtfs_import.rb
@@ -5,7 +5,6 @@ class GtfsImport < ImportTask
attr_accessor :object_id_prefix, :max_distance_for_commercial, :ignore_last_word, :ignore_end_chars, :max_distance_for_connection_link, :references_type
validates_presence_of :object_id_prefix
- validates_presence_of :references_type
def references_types
self.references_type.values
diff --git a/app/models/hub_export.rb b/app/models/hub_export.rb
index c0709cc1d..dcbfc01a1 100644
--- a/app/models/hub_export.rb
+++ b/app/models/hub_export.rb
@@ -2,9 +2,6 @@ class HubExport < ExportTask
attr_accessor :start_date, :end_date
enumerize :references_type, in: %w( network line company group_of_line )
-
- validates :start_date, presence: true , if: "end_date.present?"
- validates :end_date, presence: true, if: "start_date.present?"
after_initialize :init_period
diff --git a/app/models/import.rb b/app/models/import.rb
index be469d282..733795bd8 100644
--- a/app/models/import.rb
+++ b/app/models/import.rb
@@ -2,17 +2,24 @@ require 'open-uri'
class Import
include JobConcern
+
+ # def compliance_check_validation_report?
+ # end
- def compliance_check_validation_report
- Rails.cache.fetch("#{cache_key}/validation_report", expires_in: cache_expiration) do
- report_path = links["validation_report"]
- if report_path
- response = Ievkit.get(report_path)
- ComplianceCheckResult.new(response)
- else
- raise Ievkit::IevError("Impossible to access report path link for validation of import")
- end
- end
+ # def compliance_check_validation_report
+ # Rails.cache.fetch("#{cache_key}/validation_report", expires_in: cache_expiration) do
+ # report_path = links["validation_report"]
+ # if report_path
+ # response = Ievkit.get(report_path)
+ # ComplianceCheckResult.new(response)
+ # else
+ # raise Ievkit::IevError("Impossible to access report path link for validation of import")
+ # end
+ # end
+ # end
+
+ def report?
+ links["action_report"].present?
end
def report
@@ -27,6 +34,10 @@ class Import
end
end
+ def rule_parameter_set?
+ links["validation_params"].present?
+ end
+
def rule_parameter_set
Rails.cache.fetch("#{cache_key}/validation_params", expires_in: cache_expiration) do
rule_parameter_set_path = links["validation_params"]
@@ -37,6 +48,10 @@ class Import
end
end
end
+
+ def compliance_check?
+ links["validation_report"].present?
+ end
def compliance_check
Rails.cache.fetch("#{cache_key}/validation_report", expires_in: cache_expiration) do
@@ -62,6 +77,10 @@ class Import
end
end
+ def file_path?
+ links["data"].present?
+ end
+
def file_path
links["data"]
end
diff --git a/app/models/neptune_export.rb b/app/models/neptune_export.rb
index 45c2aa4ea..8e9d91557 100644
--- a/app/models/neptune_export.rb
+++ b/app/models/neptune_export.rb
@@ -2,9 +2,6 @@ class NeptuneExport < ExportTask
attr_accessor :start_date, :end_date, :extensions, :export_type
enumerize :references_type, in: %w( network line company group_of_line )
-
- validates :start_date, presence: true , if: "end_date.present?"
- validates :end_date, presence: true, if: "start_date.present?"
def action_params
{
diff --git a/app/views/export_tasks/_fields_gtfs_export.html.erb b/app/views/export_tasks/_fields_gtfs_export.html.erb
index 3ec95c181..b5dca732b 100644
--- a/app/views/export_tasks/_fields_gtfs_export.html.erb
+++ b/app/views/export_tasks/_fields_gtfs_export.html.erb
@@ -1,2 +1,2 @@
-<%= form.input :time_zone, :as => :time_zone, :input_html => { :title => t("formtastic.titles.export.time_zone")} %>
-<%= form.input :object_id_prefix, :input_html => { :value => @referential.prefix ,:title => t("formtastic.titles.export.object_id_prefix")} %> \ No newline at end of file
+<%= form.input :time_zone, :as => :time_zone, :input_html => { :title => t("formtastic.titles.export_task.time_zone")} %>
+<%= form.input :object_id_prefix, :input_html => { :value => @referential.prefix ,:title => t("formtastic.titles.export_task.object_id_prefix")} %>
diff --git a/app/views/export_tasks/_fields_hub_export.html.erb b/app/views/export_tasks/_fields_hub_export.html.erb
index fc7cf7112..48e9ef172 100644
--- a/app/views/export_tasks/_fields_hub_export.html.erb
+++ b/app/views/export_tasks/_fields_hub_export.html.erb
@@ -1,2 +1,2 @@
-<%= form.input :start_date, :as => :date_picker, :input_html => { :title => t("formtastic.titles.export.start_date")} %>
-<%= form.input :end_date, :as => :date_picker, :input_html => { :title => t("formtastic.titles.export.end_date")} %>
+<%= form.input :start_date, :as => :date_picker, :input_html => { :title => t("formtastic.titles.export_task.start_date")} %>
+<%= form.input :end_date, :as => :date_picker, :input_html => { :title => t("formtastic.titles.export_task.end_date")} %>
diff --git a/app/views/export_tasks/_fields_neptune_export.html.erb b/app/views/export_tasks/_fields_neptune_export.html.erb
index 57826d972..e1ef631a5 100644
--- a/app/views/export_tasks/_fields_neptune_export.html.erb
+++ b/app/views/export_tasks/_fields_neptune_export.html.erb
@@ -1,4 +1,4 @@
-<%= form.input :start_date, :as => :date_picker, :input_html => { :title => t("formtastic.titles.export.start_date")} %>
-<%= form.input :end_date, :as => :date_picker, :input_html => { :title => t("formtastic.titles.export.end_date")} %>
+<%= form.input :start_date, :as => :date_picker, :input_html => { :title => t("formtastic.titles.export_task.start_date")} %>
+<%= form.input :end_date, :as => :date_picker, :input_html => { :title => t("formtastic.titles.export_task.end_date")} %>
<%= form.input :projection_type, :as => :hidden, :input_html => { :value => @referential.projection_type || "" } %>
<%= form.input :extensions , :as => :boolean%>
diff --git a/app/views/exports/_export.erb b/app/views/exports/_export.erb
index 5cf924960..7d8e24e39 100644
--- a/app/views/exports/_export.erb
+++ b/app/views/exports/_export.erb
@@ -14,7 +14,7 @@
</div>
</div>
<div class="panel-body">
- <p><%= link_to( image_tag("icons/file_#{export.filename_extension}.png") + t("exports.show.exported_file"), exported_file_referential_export_path(@referential, export.id) ) if export.file_path %></p>
+ <p><%= link_to( font_awesome_classic_tag("fa-file-#{export.filename_extension}-o") + t("exports.show.exported_file"), exported_file_referential_export_path(@referential, export.id) ) if export.file_path %></p>
</div>
<div class="panel-footer">
<div class="history">
diff --git a/app/views/exports/show.html.erb b/app/views/exports/show.html.erb
index 7852635aa..d79b3f3cf 100644
--- a/app/views/exports/show.html.erb
+++ b/app/views/exports/show.html.erb
@@ -4,7 +4,7 @@
<div class="export_show">
<div class="links">
- <%= link_to( image_tag("icons/file_#{@export.filename_extension}.png") + t("exports.show.exported_file"), exported_file_referential_export_path(@referential, @export.id) ) if @export.file_path %>
+ <%= link_to( font_awesome_classic_tag("fa-file-#{@export.filename_extension}-o") + t("exports.show.exported_file"), exported_file_referential_export_path(@referential, @export.id) ) if @export.file_path %>
</div>
<%= render( :partial => "shared/ie_report.html", :locals => { :referential => @referential, :job => @export} ) %>
</div>
diff --git a/app/views/imports/_import.erb b/app/views/imports/_import.erb
index 717e51b75..b74c59e17 100644
--- a/app/views/imports/_import.erb
+++ b/app/views/imports/_import.erb
@@ -14,9 +14,9 @@
</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) if import.file_path %></p>
- <p><%= link_to image_tag("icons/link_page.png") + t("imports.show.rule_parameter_set"), rule_parameter_set_referential_import_path(@referential, import.id) if import.rule_parameter_set %></p>
- <p><%= link_to image_tag("icons/link_page.png") + t("imports.show.compliance_check"), compliance_check_referential_import_path(@referential, import.id) if import.compliance_check %></p>
+ <p><%= link_to font_awesome_classic_tag("fa-file-#{import.filename_extension}-o") + t("imports.show.imported_file"), imported_file_referential_import_path(@referential, import.id) if import.file_path? %></p>
+ <p><%= link_to font_awesome_classic_tag("fa-external-link") + t("imports.show.rule_parameter_set"), rule_parameter_set_referential_import_path(@referential, import.id) if import.rule_parameter_set? %></p>
+ <p><%= link_to font_awesome_classic_tag("fa-external-link") + t("imports.show.compliance_check"), compliance_check_referential_import_path(@referential, import.id) if import.compliance_check? %></p>
</div>
<div class="panel-footer">
<div class="history">
diff --git a/app/views/imports/show.html.erb b/app/views/imports/show.html.erb
index 4e94f111d..025580c34 100644
--- a/app/views/imports/show.html.erb
+++ b/app/views/imports/show.html.erb
@@ -4,9 +4,9 @@
<div class="import_show">
<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.file_path %>
- <%= link_to image_tag("icons/link_page.png") + t("imports.show.rule_parameter_set"), rule_parameter_set_referential_import_path(@referential, @import.id) if @import.rule_parameter_set %>
- <%= link_to image_tag("icons/link_page.png") + t("imports.show.compliance_check"), compliance_check_referential_import_path(@referential, @import.id) if @import.compliance_check %>
+ <%= link_to font_awesome_classic_tag("fa-file-#{@import.filename_extension}-o") + t("imports.show.imported_file"), imported_file_referential_import_path(@referential, @import.id) if @import.file_path? %>
+ <%= link_to font_awesome_classic_tag("fa-external-link") + t("imports.show.rule_parameter_set"), rule_parameter_set_referential_import_path(@referential, @import.id) if @import.rule_parameter_set? %>
+ <%= link_to font_awesome_classic_tag("fa-external-link") + t("imports.show.compliance_check"), compliance_check_referential_import_path(@referential, @import.id) if @import.compliance_check? %>
</div>
<%= render( :partial => "shared/ie_report.html", :locals => { :referential => @referential, :job => @import} ) %>
</div>
diff --git a/app/views/shared/_ie_report.html.erb b/app/views/shared/_ie_report.html.erb
index b8d09ccd4..51cb51706 100644
--- a/app/views/shared/_ie_report.html.erb
+++ b/app/views/shared/_ie_report.html.erb
@@ -35,8 +35,8 @@
<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="save"><%= t(".table.line.save") %></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>
@@ -47,11 +47,10 @@
</tr>
</thead>
<tbody>
- <% job.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(".table.line." + line_item.status ) %></td>
+ <% 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>