Sha256: f4c45d51a88e4fc368615f34f74a6bd2c7d4ec1872e7e5bb5dd4b6b0795f8122

Contents?: true

Size: 469 Bytes

Versions: 5

Compression:

Stored size: 469 Bytes

Contents

module FieldTypes
  module Core
    class UserCell < FieldTypes::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.id] }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cortex-field_types-core-0.2.3 app/cells/field_types/core/user_cell.rb
cortex-field_types-core-0.2.2 app/cells/field_types/core/user_cell.rb
cortex-field_types-core-0.2.1 app/cells/field_types/core/user_cell.rb
cortex-field_types-core-0.1.1 app/cells/field_types/core/user_cell.rb
cortex-field_types-core-0.1.0 app/cells/field_types/core/user_cell.rb