aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/helpers/table_builder_helper/url.rb7
-rw-r--r--app/models/import.rb4
-rw-r--r--app/policies/import_policy.rb7
-rw-r--r--app/views/imports/index.html.slim61
4 files changed, 66 insertions, 13 deletions
diff --git a/app/helpers/table_builder_helper/url.rb b/app/helpers/table_builder_helper/url.rb
index 0894df0fe..f7ba703ae 100644
--- a/app/helpers/table_builder_helper/url.rb
+++ b/app/helpers/table_builder_helper/url.rb
@@ -12,7 +12,12 @@ module TableBuilderHelper
polymorph_url << item.stop_area if item.respond_to? :stop_area
polymorph_url << item if item.respond_to?(:stop_points) || item.is_a?(Chouette::TimeTable)
elsif item.respond_to? :referential
- polymorph_url << item.referential
+ if item.respond_to? :workbench
+ polymorph_url << item.workbench
+ polymorph_url << item
+ else
+ polymorph_url << item.referential
+ end
end
else
polymorph_url << item
diff --git a/app/models/import.rb b/app/models/import.rb
index f8702c115..17899cc82 100644
--- a/app/models/import.rb
+++ b/app/models/import.rb
@@ -13,6 +13,10 @@ class Import < ActiveRecord::Base
before_create :initialize_fields
+ def self.model_name
+ ActiveModel::Name.new Import, Import, "Import"
+ end
+
def self.failing_statuses
symbols_with_indifferent_access(%i(failed aborted canceled))
end
diff --git a/app/policies/import_policy.rb b/app/policies/import_policy.rb
new file mode 100644
index 000000000..9e1d99a66
--- /dev/null
+++ b/app/policies/import_policy.rb
@@ -0,0 +1,7 @@
+class ImportPolicy < ApplicationPolicy
+ class Scope < Scope
+ def resolve
+ scope
+ end
+ end
+end
diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim
index 6e2d49f73..a3e06840f 100644
--- a/app/views/imports/index.html.slim
+++ b/app/views/imports/index.html.slim
@@ -1,12 +1,49 @@
-= title_tag t('.title')
-- @imports.each do |import|
- .import
- li = link_to import.name, workbench_import_path(@workbench, import)
- li = import.referential.name if import.referential
- li = link_to import.file.file.filename, import.file.url, target: :_blank
- hr
-
-.warning = t('.warning')
-- content_for :sidebar do
- ul.actions
- li = link_to t('imports.actions.new'), new_workbench_import_path(workbench_id: @workbench), class: 'add'
+/ PageHeader
+= pageheader 'map-marker',
+ t('.title'),
+ '',
+ '',
+ link_to(t('imports.actions.new'), new_workbench_import_path(workbench_id: @workbench), class: 'btn btn-primary')
+
+/ PageContent
+.page_content
+ .container-fluid
+ - if @imports.any?
+ .row
+ .col-lg-12
+ = table_builder_2 @imports,
+ [ \
+ TableBuilderHelper::Column.new( \
+ key: :status, \
+ attribute: 'status' \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :started_at, \
+ attribute: 'started_at' \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :name, \
+ attribute: 'name' \
+ ), \
+ # TableBuilderHelper::Column.new( \
+ # name: 'Opérateur', \
+ # attribute: '' \
+ # ) \
+ ],
+ links: [],
+ cls: 'table has-search'
+
+ / = new_pagination @imports, 'pull-right'
+
+ - unless @imports.any?
+ .row
+ .col-lg-12
+ = replacement_msg t('imports.search_no_results')
+
+ .separator
+
+ .alert.alert-info
+ - @imports.each do |import|
+ .import
+ li = link_to import.file.file.filename, import.file.url, target: '_blank'
+ hr