Merge branch 'master' into 4232-slow-pipes-n-jobs
[arvados.git] / apps / workbench / app / helpers / application_helper.rb
index 5e6d574a4cf7a52ff823ebe83611ff09efa420f8..ef2830cd7e3fcc667719e0b442019e87de83715b 100644 (file)
@@ -133,7 +133,7 @@ module ApplicationHelper
         end
       end
       style_opts[:class] = (style_opts[:class] || '') + ' nowrap'
-      if opts[:no_link]
+      if opts[:no_link] or (resource_class == User && !current_user)
         raw(link_name)
       else
         (link_to raw(link_name), { controller: resource_class.to_s.tableize, action: 'show', id: ((opts[:name_link].andand.uuid) || link_uuid) }, style_opts) + raw(tags)
@@ -160,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'
@@ -188,9 +188,6 @@ module ApplicationHelper
     @unique_id ||= (Time.now.to_f*1000000).to_i
     span_id = object.uuid.to_s + '-' + attr.to_s + '-' + (@unique_id += 1).to_s
 
-    if attr == 'description'
-      input_type = 'textarea'
-    end
     span_tag = content_tag 'span', rendervalue, {
       "data-emptytext" => '(none)',
       "data-placement" => "bottom",
@@ -310,9 +307,7 @@ module ApplicationHelper
       end
     end
 
-    if dataclass == 'number' or attrvalue.is_a? Fixnum or attrvalue.is_a? Float
-      datatype = 'number'
-    elsif attrvalue.is_a? String
+    if 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