From 42cda208c4413053c0462aff2eb623b45204be80 Mon Sep 17 00:00:00 2001 From: Luc Donnet Date: Tue, 12 May 2015 12:58:08 +0200 Subject: Fix links and locales for imports and exports Ref #0035502 --- .../main/compliance_check_tasks.css.scss | 32 -- app/controllers/export_tasks_controller.rb | 2 +- app/controllers/import_tasks_controller.rb | 1 + app/models/export_task.rb | 5 - app/views/export_tasks/new.html.erb | 3 +- app/views/exports/_export.erb | 2 +- app/views/exports/show.html.erb | 4 +- app/views/imports/_import.erb | 10 +- app/views/imports/show.html.erb | 12 +- config/locales/compliance_check_tasks.en.yml | 16 + config/locales/compliance_check_tasks.fr.yml | 16 + config/locales/compliance_check_tasks.yml | 19 - config/locales/exports.yml | 470 --------------------- config/locales/import_tasks.yml | 208 --------- config/locales/imports.en.yml | 2 +- config/locales/imports.fr.yml | 2 +- config/locales/imports.yml | 198 --------- 17 files changed, 46 insertions(+), 956 deletions(-) create mode 100644 config/locales/compliance_check_tasks.en.yml create mode 100644 config/locales/compliance_check_tasks.fr.yml delete mode 100644 config/locales/compliance_check_tasks.yml delete mode 100644 config/locales/exports.yml delete mode 100644 config/locales/import_tasks.yml delete mode 100644 config/locales/imports.yml diff --git a/app/assets/stylesheets/main/compliance_check_tasks.css.scss b/app/assets/stylesheets/main/compliance_check_tasks.css.scss index 7fecf0068..64c6a2f94 100644 --- a/app/assets/stylesheets/main/compliance_check_tasks.css.scss +++ b/app/assets/stylesheets/main/compliance_check_tasks.css.scss @@ -1,36 +1,4 @@ #workspace.compliance_check_tasks.new, #workspace.compliance_check_tasks.create { - padding: 0; - margin-top: -0.3em; - margin-bottom: 1em; - - - - .inputs ol { - margin-top: -0.3em; - margin-bottom: 1em; - padding: 0; - width: 100%; - } - .inputs ol li { padding : 0.3em 0; } - - .inputs ol li textarea { - width: 54%; - } - .inputs ol li label { - width: 40%; - margin-top: -0.3em; - } - - .inputs ol li.fl label { width: 40%; margin-top: -0.3em; } - .inputs ol li.fl input { width: 21%; padding: 0; } - - .inputs ol li.fl1 {float: left; width: 70% ;} - .inputs ol li.fl1 label {width: 57%; margin-top: -0.3em; } - .inputs ol li.fl1 input { width: 30%; } - - .inputs ol li.fl2 {float: left; width: 25% ;} - .inputs ol li.fl2 label {width: 10%; margin-top: -0.3em;} - .inputs ol li.fl2 input { width: 85%; } } diff --git a/app/controllers/export_tasks_controller.rb b/app/controllers/export_tasks_controller.rb index d9a43cdc5..ba5104342 100644 --- a/app/controllers/export_tasks_controller.rb +++ b/app/controllers/export_tasks_controller.rb @@ -17,6 +17,7 @@ class ExportTasksController < ChouetteController end def create + @available_exports = available_exports begin create! do |success, failure| success.html { redirect_to referential_exports_path(@referential) } @@ -31,7 +32,6 @@ class ExportTasksController < ChouetteController def references references_type = params[:filter].pluralize references = @referential.send(references_type).where("name ilike ?", "%#{params[:q]}%").select("id, name") - puts references.inspect respond_to do |format| format.json do render :json => references.collect { |child| { :id => child.id, :name => child.name } } diff --git a/app/controllers/import_tasks_controller.rb b/app/controllers/import_tasks_controller.rb index 617721956..8eeafab51 100644 --- a/app/controllers/import_tasks_controller.rb +++ b/app/controllers/import_tasks_controller.rb @@ -18,6 +18,7 @@ class ImportTasksController < ChouetteController end def create + @available_imports = available_imports begin create! do |success, failure| success.html { redirect_to referential_imports_path(@referential) } diff --git a/app/models/export_task.rb b/app/models/export_task.rb index c346d0597..a00b4e4ae 100644 --- a/app/models/export_task.rb +++ b/app/models/export_task.rb @@ -8,10 +8,6 @@ class ExportTask define_model_callbacks :initialize, only: :after - # TODO : Move in configuration - @@root = "#{Rails.root}/tmp/exports" - cattr_accessor :root - enumerize :data_format, in: %w( neptune netex gtfs hub kml ) attr_accessor :referential_id, :user_id, :user_name, :references_type, :data_format, :name, :projection_type, :reference_ids @@ -20,7 +16,6 @@ class ExportTask validates_presence_of :user_name validates_presence_of :name validates_presence_of :data_format - validates_presence_of :references_type def initialize( params = {} ) run_callbacks :initialize do diff --git a/app/views/export_tasks/new.html.erb b/app/views/export_tasks/new.html.erb index 6e5397f0e..6cb34665f 100644 --- a/app/views/export_tasks/new.html.erb +++ b/app/views/export_tasks/new.html.erb @@ -9,7 +9,8 @@ <% @available_exports.each do |export_task| %> <%= semantic_form_for [@referential, export_task], :as => :export_task, :url => referential_export_tasks_path(@referential), :namespace => export_task.data_format ,:html => { :id => "#{export_task.data_format}", :class => "tab-pane highlight"} do |form| %> <%= form.inputs do %> - <%= form.input :user_name, :as => :hidden, :input_html => { :value => current_user.name } %> <%= form.input :user_id, :as => :hidden, :input_html => { :value => current_user.id } %> + <%= form.input :user_name, :as => :hidden, :input_html => { :value => current_user.name } %> + <%= form.input :user_id, :as => :hidden, :input_html => { :value => current_user.id } %> <%= form.input :data_format, :as => :hidden %> <%= form.input :referential_id, :as => :hidden, :input_html => { :value => @referential.id } %> <%= form.input :name %> diff --git a/app/views/exports/_export.erb b/app/views/exports/_export.erb index 71ab1e0d9..5cf924960 100644 --- a/app/views/exports/_export.erb +++ b/app/views/exports/_export.erb @@ -14,7 +14,7 @@
<%= 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.aborted? %>
+<%= 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 image_tag("icons/file_#{import.filename_extension}.png") + t("imports.show.imported_file"), imported_file_referential_import_path(@referential, import.id) if !import.aborted? %>
- <% if import.rule_parameter_set && !import.aborted? %> -<%= link_to image_tag("icons/link_page.png") + t("imports.show.rule_parameter_set"), rule_parameter_set_referential_import_path(@referential, import.id) %>
- <% end %> - <% if import.compliance_check && !import.aborted? %> -<%= link_to image_tag("icons/link_page.png") + t("imports.show.compliance_check"), compliance_check_referential_import_path(@referential, import.id) %>
- <% end %> +<%= 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 %>