diff options
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | app/controllers/imports_controller.rb | 33 | ||||
| -rw-r--r-- | app/helpers/breadcrumb_helper.rb | 10 | ||||
| -rw-r--r-- | app/views/imports/_form.html.slim | 4 | ||||
| -rw-r--r-- | app/views/imports/index.html.slim | 7 | ||||
| -rw-r--r-- | app/views/imports/new.html.slim | 3 | ||||
| -rw-r--r-- | app/views/imports/show.html.slim | 15 | ||||
| -rw-r--r-- | app/views/workbenches/show.html.slim | 3 | ||||
| -rw-r--r-- | config/locales/breadcrumbs.en.yml | 1 | ||||
| -rw-r--r-- | config/locales/breadcrumbs.fr.yml | 1 | 
10 files changed, 53 insertions, 27 deletions
| diff --git a/.gitignore b/.gitignore index 4bd57ce25..1bca870cb 100644 --- a/.gitignore +++ b/.gitignore @@ -31,5 +31,8 @@ coverage  bin/ +# Ignore uploaded files +/public/uploads +  # Ignore node modules  /node_modules diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index 4664bc430..3eab7e66b 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -3,22 +3,27 @@ class ImportsController < BreadcrumbController    respond_to :html    belongs_to :workbench -  # def show -  #   show! do -  #     build_breadcrumb :show -  #   end -  # end +  def show +    show! do +      build_breadcrumb :show +    end +  end -  # def index -  #   index! do -  #     build_breadcrumb :index -  #   end -  # end +  def index +    index! do +      build_breadcrumb :index +    end +  end    def new -    ap params -    ap @workbench -    ap '------------' -    @import = Import.new +    new! do +      build_breadcrumb :new +    end +  end + +  private + +  def import_params +    params.require(:import).permit(:name, :file, :referential_id)    end  end diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb index dc68bd897..7ef418af1 100644 --- a/app/helpers/breadcrumb_helper.rb +++ b/app/helpers/breadcrumb_helper.rb @@ -208,14 +208,10 @@ module BreadcrumbHelper    end    def import_breadcrumb (action) -    referential_breadcrumb -    add_breadcrumb Referential.human_attribute_name("imports"), referential_imports_path(@referential) unless action == :index - -    add_breadcrumb @import.name, referential_import_path(@referential, @import.id) if @import - -    #add_breadcrumb @rule_parameter_set.import.name, compliance_check_referential_import_path(@referential, @rule_parameter_set.import.id) if action == :rule_parameter_set +    add_breadcrumb I18n.t("breadcrumbs.referentials"), referentials_path +    add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench) +    add_breadcrumb I18n.t("breadcrumbs.imports"), workbench_imports_path(@workbench) -    #add_breadcrumb "Tests de conformité", compliance_check_referential_import_path(@referential, @compliance_check.id) if @compliance_check    end    def export_breadcrumb (action) diff --git a/app/views/imports/_form.html.slim b/app/views/imports/_form.html.slim index 2da071f97..693ce6fc4 100644 --- a/app/views/imports/_form.html.slim +++ b/app/views/imports/_form.html.slim @@ -1,5 +1,5 @@ -= simple_form_for import do |f| += simple_form_for [workbench, import] do |f|    = f.input :name    = f.input :file -  = f.input :workbench +  = f.association :referential    = f.button :submit diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim index cc76aad71..fd87de90f 100644 --- a/app/views/imports/index.html.slim +++ b/app/views/imports/index.html.slim @@ -1,5 +1,12 @@  = title_tag t('.title') +- @imports.each do |import| +  .import +    li = link_to import.name, workbench_import_path(@workbench, import) +    li = import.referential.name +    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' diff --git a/app/views/imports/new.html.slim b/app/views/imports/new.html.slim index ae8aad4ee..55b655a85 100644 --- a/app/views/imports/new.html.slim +++ b/app/views/imports/new.html.slim @@ -1,5 +1,4 @@  = title_tag t('.title') -= @import.inspect -= @workbench.inspect  .row    .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-8.col-sm-offset-2 +    = render 'form', import: @import, workbench: @workbench diff --git a/app/views/imports/show.html.slim b/app/views/imports/show.html.slim index d8b5a80e2..b40e11ea4 100644 --- a/app/views/imports/show.html.slim +++ b/app/views/imports/show.html.slim @@ -1 +1,14 @@ -h1 = @import.inspect +.title.row +  .col-md-8 +    = title_tag job_status_title(@import) + +.import_show +  .links +    = link_to font_awesome_classic_tag("fa-file-#{@import.file.file.extension}-o") + t("imports.show.imported_file"), @import.file.url + +- content_for :sidebar do +  ul.actions +    li +      = link_to t('imports.actions.destroy'), workbench_import_path(@workbench, @import.id), method: :delete, data: {confirm: t('imports.actions.destroy_confirm')}, class: 'remove' + +  = history_tag(@import) diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim index 678e6722e..7339a8f14 100644 --- a/app/views/workbenches/show.html.slim +++ b/app/views/workbenches/show.html.slim @@ -72,4 +72,5 @@  - content_for :sidebar do    ul.actions      li = link_to t('referentials.actions.new'), new_referential_path(workbench_id: @workbench), class: 'add' -    li = link_to t('referentials.actions.import'), new_workbench_import_path(workbench_id: @workbench), class: 'add' +    li = link_to t('imports.actions.new'), new_workbench_import_path(workbench_id: @workbench), class: 'add' +    li = link_to t('workbenches.actions.imports_list'), workbench_imports_path(workbench_id: @workbench) diff --git a/config/locales/breadcrumbs.en.yml b/config/locales/breadcrumbs.en.yml index 911c992c3..6fec15b85 100644 --- a/config/locales/breadcrumbs.en.yml +++ b/config/locales/breadcrumbs.en.yml @@ -4,3 +4,4 @@ en:      vehicle_journey_frequencies: "Times bands"      referentials: "Home"      users: "Users" +    imports: Imports diff --git a/config/locales/breadcrumbs.fr.yml b/config/locales/breadcrumbs.fr.yml index ffcba3015..b941138c7 100644 --- a/config/locales/breadcrumbs.fr.yml +++ b/config/locales/breadcrumbs.fr.yml @@ -4,3 +4,4 @@ fr:      vehicle_journey_frequencies: "Créneaux horaires"      referentials: "Accueil"      users: "Utilisateurs" +    imports: Imports | 
