module Cortex
  module FieldTypes
    module Core
      module User
        class UserCell < FieldCell

          def dropdown
            render
          end

          private

          def value
            if data
              data['user_id'] || @options[:default_value]
            else
              @options[:default_value]
            end
          end

          def render_select_options
            options = ""
            @options[:user_data].each do |user_info|
              options += "<option value='#{user_info[1]}'>#{user_info[0]}</option>"
            end
            options.html_safe
          end

        end
      end
    end
  end
end

module Cortex
  module FieldTypes
    module Core
      module User
        class UserCell < FieldCell
          def dropdown
            render
          end

          private

          def value
            if data
              data['user_id'] || @options[:default_value]
            else
              @options[:default_value]
            end
          end

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

          def user_data_for_select
            @options[:user_data].map{ |user| [user.fullname, user.id] }
          end
        end
      end
    end
  end
end

Refactor FieldItem New form to no longer use uninstantiated Fields to generate FieldItem form, remove author from ContentItem grids, extract user_data_for_select from ContentItem New view, fix some autoloading issues caused by newline in application config
Refactor FieldItem New form to no longer use uninstantiated Fields to generate FieldItem form, remove author from ContentItem grids, extract user_data_for_select from ContentItem New view, fix some autoloading issues caused by newline in application config
