aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert2017-12-14 17:58:57 +0100
committerRobert2017-12-15 08:31:07 +0100
commit4613f02d52e2d8c9159633b6a45b8d0361759332 (patch)
tree46bba58a87f71169a8b5e2578cfd54c9e4bd2477
parent0354c84367cede7d738c79e9c0f116b2c0a178b2 (diff)
downloadchouette-core-4613f02d52e2d8c9159633b6a45b8d0361759332.tar.bz2
Refs: #5006@0.7h; CR changes from #5006 & staring error_messages in imports/show
- Renaming as requested STIF::NetexFile::Frame.get_line_object_id -> get_sgort_id - working on error_messages for imports#show
-rw-r--r--app/services/zip_service.rb2
-rw-r--r--app/views/imports/_import_messages.html.slim9
-rw-r--r--app/views/imports/show.html.slim3
-rw-r--r--lib/stif/netex_file.rb2
-rw-r--r--spec/lib/stif/netex_file/frame_spec.rb4
5 files changed, 16 insertions, 4 deletions
diff --git a/app/services/zip_service.rb b/app/services/zip_service.rb
index 50475f7d3..7166e6448 100644
--- a/app/services/zip_service.rb
+++ b/app/services/zip_service.rb
@@ -84,7 +84,7 @@ class ZipService
end
def is_foreign_line! entry_name
- STIF::NetexFile::Frame.get_line_object_id(entry_name).tap do | line_object_id |
+ STIF::NetexFile::Frame.get_short_id(entry_name).tap do | line_object_id |
return nil unless line_object_id
return nil if line_object_id.in? allowed_lines
foreign_lines << line_object_id
diff --git a/app/views/imports/_import_messages.html.slim b/app/views/imports/_import_messages.html.slim
new file mode 100644
index 000000000..49440a6d3
--- /dev/null
+++ b/app/views/imports/_import_messages.html.slim
@@ -0,0 +1,9 @@
+
+- if import_messages.any?
+ dl
+ - import_messages.each do | import_message |
+ .error_message
+ dt
+ = import_message.criticity
+ dd
+ = t ['imports', import_message.message_key].join('.'), import_message.message_attributes
diff --git a/app/views/imports/show.html.slim b/app/views/imports/show.html.slim
index 5e22e03e0..90c638d78 100644
--- a/app/views/imports/show.html.slim
+++ b/app/views/imports/show.html.slim
@@ -11,6 +11,9 @@
- page_header_content_for @import
+.error_messages
+ = render 'import_messages', import_messages: @import.messages
+
.page_content
.container-fluid
.row
diff --git a/lib/stif/netex_file.rb b/lib/stif/netex_file.rb
index db64ed05e..db0801bbe 100644
--- a/lib/stif/netex_file.rb
+++ b/lib/stif/netex_file.rb
@@ -43,7 +43,7 @@ module STIF
class Frame
class << self
- def get_line_object_id file_name
+ def get_short_id file_name
base_name = File.basename(file_name)
STIF::NetexFile::LINE_FILE_FORMAT.match(base_name).try(:[], 'line_object_id')
end
diff --git a/spec/lib/stif/netex_file/frame_spec.rb b/spec/lib/stif/netex_file/frame_spec.rb
index eb80e7b14..506da2148 100644
--- a/spec/lib/stif/netex_file/frame_spec.rb
+++ b/spec/lib/stif/netex_file/frame_spec.rb
@@ -3,11 +3,11 @@ RSpec.describe STIF::NetexFile::Frame do
context "line object id extraction" do
it "gets the line object id if frame describes a line" do
- expect( described_class.get_line_object_id('offre_C00109_10.xml') ).to eq('C00109')
+ expect( described_class.get_short_id('offre_C00109_10.xml') ).to eq('C00109')
end
it "gets nil if the frame does not describe a line" do
- expect( described_class.get_line_object_id('commun.xml') ).to be_nil
+ expect( described_class.get_short_id('commun.xml') ).to be_nil
end
end
end