diff options
| author | cedricnjanga | 2017-11-13 12:33:15 +0100 |
|---|---|---|
| committer | cedricnjanga | 2017-11-13 12:43:15 +0100 |
| commit | b81cbd6de7944443f9a024acb5fa6cdfdfeaac63 (patch) | |
| tree | d425705f149dfbcf840606570df10c9d1200708e /app/helpers | |
| parent | f74240182d95fd43f4aabc14b6560158dd276b21 (diff) | |
| download | chouette-core-b81cbd6de7944443f9a024acb5fa6cdfdfeaac63.tar.bz2 | |
Refs #4952 Fix bug related to compliance control set action links display
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/compliance_control_sets_helper.rb | 34 |
1 files changed, 33 insertions, 1 deletions
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 |
