Skip to content

Instantly share code, notes, and snippets.

@Heavyblade
Created August 20, 2021 15:51
Show Gist options
  • Save Heavyblade/d2d194a1803f718ed543a498539f8551 to your computer and use it in GitHub Desktop.
Save Heavyblade/d2d194a1803f718ed543a498539f8551 to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
module Setup::React
def activities_links
[
channels_link,
activity_series_nav_link,
campaign_templates_nav_link,
campaigns_nav_link,
achievers_link,
idea_boards_nav_link,
bulk_volunteer_hours_nav_link,
participation_events_link,
giving_link
].compact
end
private
def channels_link
if current_user.can?(:manage_channels)
navbar_link_to(t('.channels'), setup_channels_path, page_ids: ['setup-channels'])
end
end
def activity_series_nav_link
if switched_brand&.config&.activity_series_enabled?
navbar_link_to t('.activity_series_nav'), setup_activity_series_index_path, page_ids: ['setup-activity-series']
end
end
def campaign_templates_nav_link
if policy([:setup, CampaignTemplate]).index? || current_user.group_leader?
navbar_link_to t('.campaign_templates_nav'), setup_campaign_templates_path, page_ids: ['setup-campaign-templates']
end
end
def campaigns_nav_link
if policy([:setup, CampaignTemplate]).index? || current_user.group_leader?
navbar_link_to t('.campaigns_nav'), setup_campaigns_path, page_ids: campaign_page_ids
end
end
def achievers_link
if current_user.can?(:manage_achievers_integration)
navbar_link_to t('.achievers'), edit_setup_achievers_config_path, page_ids: ['setup-achievers']
end
end
def idea_boards_nav_link
if policy([:setup, CampaignTemplate]).index? || current_user.group_leader?
navbar_link_to t('.idea_boards_nav'), setup_idea_boards_path, page_ids: ['setup-idea-boards', 'setup-react']
end
end
def giving_link
if policy([:setup, GivingActivity]).index? && switched_brand_giving_enabled?
navbar_link_to t('.giving'), setup_giving_activities_path, page_ids: ['setup-giving-activities']
end
end
def participation_events_link
if policy([:setup, ParticipationEvent]).index? || current_user.group_leader?
navbar_link_to t('.participation_events'), setup_participation_events_path, page_ids: ['setup-participation-events', 'setup-shift-email-customizations']
end
end
def bulk_volunteer_hours_nav_link
if policy([:setup, ParticipationEvent]).bulk_hours?
navbar_link_to t('.bulk_volunteer_hours_nav'), setup_participation_event_bulk_hours_path, page_ids: ['setup-participation-event-bulk-hours']
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment