diff options
| author | cedricnjanga | 2018-01-23 22:46:16 -0800 | 
|---|---|---|
| committer | cedricnjanga | 2018-01-31 07:18:19 -0800 | 
| commit | 6632217117a66bd09b2e8261e4351add9971d47c (patch) | |
| tree | 2d30ea8b65c6a526daa0014c0fb5d32128ee1119 /app | |
| parent | 2dd90cb38b4da66cdcc008beed6b15d073d1f4be (diff) | |
| download | chouette-core-6632217117a66bd09b2e8261e4351add9971d47c.tar.bz2 | |
First draft for including calendars into workgroup for having appropriate scoping
Diffstat (limited to 'app')
| -rw-r--r-- | app/decorators/calendar_decorator.rb | 10 | ||||
| -rw-r--r-- | app/helpers/table_builder_helper.rb | 10 | ||||
| -rw-r--r-- | app/helpers/table_builder_helper/url.rb | 6 | ||||
| -rw-r--r-- | app/views/calendars/index.html.slim | 4 | 
4 files changed, 29 insertions, 1 deletions
| diff --git a/app/decorators/calendar_decorator.rb b/app/decorators/calendar_decorator.rb index 0a7cbc312..1b2a085b7 100644 --- a/app/decorators/calendar_decorator.rb +++ b/app/decorators/calendar_decorator.rb @@ -5,11 +5,21 @@ class CalendarDecorator < AF83::Decorator    create_action_link +<<<<<<< HEAD    with_instance_decorator do |instance_decorator|      instance_decorator.show_action_link      instance_decorator.edit_action_link      instance_decorator.destroy_action_link do |l|        l.data {{ confirm: h.t('calendars.actions.destroy_confirm') }} +======= +    if h.policy(object).destroy? +      links << Link.new( +        content: h.destroy_link_content, +        href: h.workgroup_calendar_path(context[:workgroup], object), +        method: :delete, +        data: { confirm: h.t('calendars.actions.destroy_confirm') } +      ) +>>>>>>> First draft for including calendars into workgroup for having appropriate scoping      end    end  end diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb index 2068dd23c..245843eab 100644 --- a/app/helpers/table_builder_helper.rb +++ b/app/helpers/table_builder_helper.rb @@ -316,6 +316,7 @@ module TableBuilderHelper        content_tag :span, '', class: 'fa fa-cog'      end +<<<<<<< HEAD      action_links = item.action_links      if action_links.is_a?(AF83::Decorator::ActionLinks)        menu = content_tag :div, class: 'dropdown-menu' do @@ -336,6 +337,15 @@ module TableBuilderHelper            gear_menu_link(link)          end.join.html_safe        end +======= +    menu = content_tag :ul, class: 'dropdown-menu' do +      ( +        CustomLinks.new(item, pundit_user, links, referential, workgroup).links + +        item.action_links.select { |link| link.is_a?(Link) } +      ).map do |link| +        gear_menu_link(link) +      end.join.html_safe +>>>>>>> First draft for including calendars into workgroup for having appropriate scoping      end      content_tag :div, trigger + menu, class: 'btn-group' diff --git a/app/helpers/table_builder_helper/url.rb b/app/helpers/table_builder_helper/url.rb index 0e3dce0aa..550b1e9d4 100644 --- a/app/helpers/table_builder_helper/url.rb +++ b/app/helpers/table_builder_helper/url.rb @@ -3,7 +3,7 @@ module TableBuilderHelper      def self.polymorphic_url_parts(item, referential, workgroup)        polymorph_url = [] -      unless item.is_a?(Calendar) || item.is_a?(Referential) || item.is_a?(ComplianceControlSet) +      unless item.is_a?(Referential) || item.is_a?(ComplianceControlSet)          if referential            polymorph_url << referential            polymorph_url << item.line if item.respond_to? :line @@ -20,7 +20,11 @@ module TableBuilderHelper            end          end        else +<<<<<<< HEAD          polymorph_url << item.workgroup if item.respond_to? :workgroup +======= +        polymorph_url << item.workgroup if item.is_a?(Calendar) +>>>>>>> First draft for including calendars into workgroup for having appropriate scoping          polymorph_url << item        end diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim index 0b58c0c72..a2d6b4731 100644 --- a/app/views/calendars/index.html.slim +++ b/app/views/calendars/index.html.slim @@ -1,4 +1,8 @@  - breadcrumb :calendars, workgroup +- content_for :page_header_actions do +  - if policy(Calendar).create? +    = link_to(t('actions.add'), new_workgroup_calendar_path(current_workgroup), class: 'btn btn-default') +  .page_content    .container-fluid | 
