Sha256: e3aa4b047a8e397079db764ea59cd9086a6c8e5d66123e11dfe6bd362bf69aaf

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

module Plugins
  module Core
    class UserCell < Plugins::Core::Cell
      include Devise::Controllers::Helpers

      def dropdown
        render
      end

      private

      def value
        data&.[]('user_id') || @options[:default_value] || current_user.id
      end

      def render_select
        @options[:form].select 'data[user_id]', user_data_for_select, {selected: value}
      end

      def user_data_for_select
        @options[:user_data].map{ |user| ["#{user.fullname} (#{user.email})", user.id] }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cortex-plugins-core-0.10.2 app/cells/plugins/core/user_cell.rb