diff options
| author | Robert | 2017-12-14 21:10:12 +0100 |
|---|---|---|
| committer | Robert | 2017-12-15 08:32:30 +0100 |
| commit | 85c4735b33aa73ca925c234482bf5b291ff89382 (patch) | |
| tree | 1bb1db2279de5c46a6ca8deac1695b6073894a35 | |
| parent | 4613f02d52e2d8c9159633b6a45b8d0361759332 (diff) | |
| download | chouette-core-85c4735b33aa73ca925c234482bf5b291ff89382.tar.bz2 | |
Refs: #5281@0.5h; Show error messages in view imports/show
- Partial created
- Partial used
- Common Helper
- String Keys => Symbol Keys
- Dead Code eliminated
| -rw-r--r-- | app/helpers/common_helper.rb | 8 | ||||
| -rw-r--r-- | app/helpers/common_helpers.rb | 26 | ||||
| -rw-r--r-- | app/views/imports/_import_messages.html.slim | 4 |
3 files changed, 11 insertions, 27 deletions
diff --git a/app/helpers/common_helper.rb b/app/helpers/common_helper.rb new file mode 100644 index 000000000..b515f681b --- /dev/null +++ b/app/helpers/common_helper.rb @@ -0,0 +1,8 @@ + +module CommonHelper + def string_keys_to_symbols enumerable_pairs + enumerable_pairs.inject({}){ | hashy, (k, v) | + hashy.merge k.to_sym => v + } + end +end diff --git a/app/helpers/common_helpers.rb b/app/helpers/common_helpers.rb deleted file mode 100644 index 29cabddac..000000000 --- a/app/helpers/common_helpers.rb +++ /dev/null @@ -1,26 +0,0 @@ - -module CommonHelpers - # TODO: Needs refactoring, but does not seem to be under test - # so let us refactor this **after** test coverage. - def access_links_pairs(access_links) - hpairs = Hash.new - pairs = Array.new - access_links.each do |link| - key = pair_key(link) - pair = nil - if (hpairs.has_key? key) - pair = hpairs[key] - else - pair = AccessLinkPair.new - pairs << pair - hpairs[key] = pair - end - if (link.link_orientation_type == "access_point_to_stop_area") - pair.from_access_point = link - else - pair.to_access_point = link - end - end - pairs - end -end diff --git a/app/views/imports/_import_messages.html.slim b/app/views/imports/_import_messages.html.slim index 49440a6d3..7c3528184 100644 --- a/app/views/imports/_import_messages.html.slim +++ b/app/views/imports/_import_messages.html.slim @@ -6,4 +6,6 @@ dt = import_message.criticity dd - = t ['imports', import_message.message_key].join('.'), import_message.message_attributes + = t( ['import_messages', + 'compliance_check_messages', + import_message.message_key].join('.'), string_keys_to_symbols(import_message.message_attributes)) |
