Sha256: 889e9f0249cb9539e39d3ccec0e4c449ae45004142818ab6c5806f8c63a9d7ac

Contents?: true

Size: 984 Bytes

Versions: 8

Compression:

Stored size: 984 Bytes

Contents

# frozen_string_literal: true

# generado con pg_rails

class AccountDecorator < PgEngine::BaseRecordDecorator
  delegate_all

  # Define presentation-specific methods here. Helpers are accessed through
  # `helpers` (aka `h`). You can override attributes, for example:
  #
  #   def created_at
  #     helpers.content_tag :span, class: 'time' do
  #       object.created_at.strftime("%a %m/%d/%y")
  #     end
  #   end
  def extra_actions(*)
    return if Current.namespace == :admin

    ua = Current.user.user_account_for(object).decorate
    [ua.ingresar_link,
     ua.accept_invitation_link,
     ua.reject_invitation_link].compact.join.html_safe
  end

  def show_link(text: 'Usuarios', klass: 'btn-secondary')
    return unless Pundit.policy!(Current.user, object).show?

    helpers.content_tag :span do
      helpers.link_to object_url, class: "btn btn-sm #{klass}" do
        helpers.content_tag(:span, nil, class: clase_icono('person')) + text
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pg_rails-7.6.21.pre.11 pg_engine/app/decorators/account_decorator.rb
pg_rails-7.6.21.pre.10 pg_engine/app/decorators/account_decorator.rb
pg_rails-7.6.21.pre.9 pg_engine/app/decorators/account_decorator.rb
pg_rails-7.6.21.pre.8 pg_engine/app/decorators/account_decorator.rb
pg_rails-7.6.21.pre.7 pg_engine/app/decorators/account_decorator.rb
pg_rails-7.6.21.pre.6 pg_engine/app/decorators/account_decorator.rb
pg_rails-7.6.21.pre.5 pg_engine/app/decorators/account_decorator.rb
pg_rails-7.6.21.pre.4 pg_engine/app/decorators/account_decorator.rb