X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9daab730fefab219c707fcc15f5e7e599b8b716a..57f1fd52bb98ac58751e8c9a8f874eca1668b65b:/apps/workbench/app/helpers/application_helper.rb diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb index 92d1a6357d..11c55c3f77 100644 --- a/apps/workbench/app/helpers/application_helper.rb +++ b/apps/workbench/app/helpers/application_helper.rb @@ -1,6 +1,4 @@ module ApplicationHelper - include VersionHelper - def current_user controller.current_user end @@ -162,10 +160,10 @@ module ApplicationHelper end input_type = 'text' - case object.class.attribute_info[attr.to_sym].andand[:type] - when 'text' + attrtype = object.class.attribute_info[attr.to_sym].andand[:type] + if attrtype == 'text' or attr == 'description' input_type = 'textarea' - when 'datetime' + elsif attrtype == 'datetime' input_type = 'date' else input_type = 'text' @@ -309,20 +307,17 @@ module ApplicationHelper end end - if dataclass.andand.is_a?(Class) - datatype = 'select' - elsif dataclass == 'number' - datatype = 'number' - elsif attrvalue.is_a? Array - # TODO: find a way to edit arrays with x-editable - return attrvalue - elsif attrvalue.is_a? Fixnum or attrvalue.is_a? Float + if dataclass == 'number' or attrvalue.is_a? Fixnum or attrvalue.is_a? Float datatype = 'number' elsif attrvalue.is_a? String datatype = 'text' + elsif attrvalue.is_a?(Array) or dataclass.andand.is_a?(Class) + # TODO: find a way to edit with x-editable + return attrvalue end - lt = link_to attrtext, '#', { + # When datatype is a String or Fixnum, link_to the attrvalue + lt = link_to attrvalue, '#', { "data-emptytext" => "none", "data-placement" => "bottom", "data-type" => datatype,