aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorcedricnjanga2017-11-22 00:45:48 +0100
committercedricnjanga2017-11-22 00:45:48 +0100
commit510afa8b86fb6f5e4b7d9c39e3a6d3b071cd8ce9 (patch)
tree1b3a162722389df4f6b2e444d03e91131032f0d5 /app/helpers
parentbe2bd2e4f902ef12a21425ebe7dcf5699768762a (diff)
parent96afaed78fa043449c0264ea09f0106147755c8e (diff)
downloadchouette-core-510afa8b86fb6f5e4b7d9c39e3a6d3b071cd8ce9.tar.bz2
Merge branch 'master' into 4941-refactoring_object_id
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/helpers/compliance_control_sets_helper.rb34
-rw-r--r--app/helpers/route_section_selectors_helper.rb23
3 files changed, 33 insertions, 26 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 5edb8c3bf..9f2e2765f 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -73,8 +73,6 @@ module ApplicationHelper
"time_tables"
when path.include?("/timebands")
"timebands"
- when path.include?("/route_sections")
- "route_sections"
when path.include?("/rule_parameter_set")
"parametersets"
when path.include?("/import_tasks")
diff --git a/app/helpers/compliance_control_sets_helper.rb b/app/helpers/compliance_control_sets_helper.rb
index 6ba4bed4f..bb2a72623 100644
--- a/app/helpers/compliance_control_sets_helper.rb
+++ b/app/helpers/compliance_control_sets_helper.rb
@@ -4,4 +4,36 @@ module ComplianceControlSetsHelper
[current_organisation, Organisation.find_by_name("STIF")].uniq
end
-end
+ def flotted_links ccs_id = @compliance_control_set
+ links = [new_control(ccs_id), new_block(ccs_id)]
+ unless links.all? &:nil?
+ content_tag :div, class: 'select_toolbox' do
+ content_tag :ul do
+ links.collect {|link| concat content_tag(:li, link, class: 'st_action with_text') unless link.nil?}
+ end
+ end
+ end
+ end
+
+ def new_control ccs_id
+ if policy(ComplianceControl).create?
+ link_to select_type_compliance_control_set_compliance_controls_path(ccs_id) do
+ concat content_tag :span, nil, class: 'fa fa-plus'
+ concat content_tag :span, t('compliance_control_sets.actions.add_compliance_control')
+ end
+ else
+ nil
+ end
+ end
+
+ def new_block ccs_id
+ if policy(ComplianceControlBlock).create?
+ link_to new_compliance_control_set_compliance_control_block_path(ccs_id) do
+ concat content_tag :span, nil, class: 'fa fa-plus'
+ concat content_tag :span,t('compliance_control_sets.actions.add_compliance_control_block')
+ end
+ else
+ nil
+ end
+ end
+end \ No newline at end of file
diff --git a/app/helpers/route_section_selectors_helper.rb b/app/helpers/route_section_selectors_helper.rb
deleted file mode 100644
index 1be30066b..000000000
--- a/app/helpers/route_section_selectors_helper.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-module RouteSectionSelectorsHelper
-
- def link_to_edit_route_section(route_section)
- classes = [ 'edit-route-section' ]
- link ='#'
-
- if route_section.present?
- return_to = edit_referential_line_route_journey_pattern_route_sections_selector_path(@referential, @line, @route, @journey_pattern)
- link = edit_referential_route_section_path(@referential, route_section, return_to: return_to)
- else
- classes << 'disabled'
- end
-
- link_to "Edit", link, class: classes, title: t('route_sections_selectors.edit.route_section.edit')
- end
-
- def link_to_create_route_section(departure, arrival)
- return_to = edit_referential_line_route_journey_pattern_route_sections_selector_path(@referential, @line, @route, @journey_pattern)
- link_to t('route_sections_selectors.edit.route_section.new'),
- create_to_edit_referential_route_sections_path(@referential, route_section: {departure_id:departure.id, arrival_id: arrival.id}, return_to: return_to)
- end
-
-end