Sha256: 3c226b539371aff2a8151e70cd531e3a9ab7ce699323f8f174fc2fd454bc4731

Contents?: true

Size: 484 Bytes

Versions: 4

Compression:

Stored size: 484 Bytes

Contents

module Plugins
  module Core
    class UserCell < Plugins::Core::Cell
      def dropdown
        render
      end

      private

      def value
        data&.[]('user_id') || @options[:default_value]
      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

4 entries across 4 versions & 1 rubygems

Version Path
cortex-plugins-core-0.10.1 app/cells/plugins/core/user_cell.rb
cortex-plugins-core-0.10.0 app/cells/plugins/core/user_cell.rb
cortex-plugins-core-0.9.1 app/cells/plugins/core/user_cell.rb
cortex-plugins-core-0.9.0 app/cells/plugins/core/user_cell.rb