Sha256: 4ad05cc994e3f2922f7c44755b87d5c37a78f801b38daca27158fcc73e8f88e6

Contents?: true

Size: 2 KB

Versions: 17

Compression:

Stored size: 2 KB

Contents

# frozen_string_literal: true

module EacRailsBase0
  module MainMenuHelper
    APP_MAIN_MENU_ENTRIES_METHOD = 'app_main_menu_entries'
    ADMIN_ENTRIES = %w[eac_users_support tasks_scheduler aranha br_railties mailer].freeze

    def base0_app_main_menu_entries
      if respond_to?(APP_MAIN_MENU_ENTRIES_METHOD)
        send(APP_MAIN_MENU_ENTRIES_METHOD, base0_app_main_menu_default_entries)
      else
        base0_app_main_menu_default_entries
      end
    end

    def base0_app_main_menu_default_entries
      {
        'AdministraĆ§Ć£o' => base0_app_main_menu_admin_entries
      }
    end

    def base0_app_main_menu_admin_entries
      ADMIN_ENTRIES.map do |identifier|
        [::I18n.t("eac_rails_base0.main_menu.admin.#{identifier}"),
         send("#{identifier}_main_menu_admin_entries")]
      end.to_h
    end

    def mailer_main_menu_admin_entries
      %w[info send_test].map do |action|
        [
          t("eac_rails_base0.mailer.#{action}"),
          main_app.send("#{action}_eac_rails_base0_mailer_index_path")
        ]
      end.to_h
    end

    def eac_users_support_main_menu_admin_entries
      {
        ::EacUsersSupport::User.model_name.human(count: 2) => [eac_users_support.admin_users_path]
      }
    end

    def tasks_scheduler_main_menu_admin_entries
      {
        t('activerecord.models.scheduled_task.other') => [main_app.status_scheduled_tasks_path]
      }
    end

    def aranha_main_menu_admin_entries
      {
        ::Aranha::Address.model_name.human(count: 2) => [aranha.addresses_path],
        ::Aranha::ProcessorConfiguration.model_name.human(count: 2) =>
          [aranha.processor_configurations_path],
        ::Aranha::StartPoint.model_name.human(count: 2) => [aranha.start_points_path]
      }
    end

    def br_railties_main_menu_admin_entries
      {
        ::BrRailties::FederalUnit.model_name.human(count: 2) => [br_railties.federal_units_path],
        ::BrRailties::Municipality.model_name.human(count: 2) => [br_railties.municipalities_path]
      }
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
eac_rails_base0-0.62.0 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.61.1 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.61.0 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.60.4 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.60.3 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.60.2 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.60.1 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.60.0 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.59.0 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.58.0 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.57.0 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.56.0 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.55.3 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.55.2 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.55.1 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.55.0 app/helpers/eac_rails_base0/main_menu_helper.rb
eac_rails_base0-0.54.0 app/helpers/eac_rails_base0/main_menu_helper.rb