X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/040fdf6da00318b5b8e8e83eceeec783680ecb1c..7e773735e9d547381a77baeeb139696dfa66a7a6:/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 a8b88a351f..14b1c34d11 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -222,7 +222,10 @@ module ApplicationHelper
return_value
end
- def render_editable_attribute(object, attr, attrvalue=nil, htmloptions={})
+ # Render an editable attribute with the attrvalue of the attr.
+ # The htmloptions are added to the editable element's list of attributes.
+ # The nonhtml_options are only used to customize the display of the element.
+ def render_editable_attribute(object, attr, attrvalue=nil, htmloptions={}, nonhtml_options={})
attrvalue = object.send(attr) if attrvalue.nil?
if not object.attribute_editable?(attr)
if attrvalue && attrvalue.length > 0
@@ -274,11 +277,16 @@ module ApplicationHelper
"id" => span_id,
:class => "editable #{is_textile?( object, attr ) ? 'editable-textile' : ''}"
}.merge(htmloptions).merge(ajax_options)
+
edit_tiptitle = 'edit'
edit_tiptitle = 'Warning: do not use hyphens in the repository name as they will be stripped' if (object.class.to_s == 'Repository' and attr == 'name')
- edit_button = raw('')
- if htmloptions[:btnplacement] == :left
+
+ edit_button = raw('' + (nonhtml_options[:btntext] || '') + '')
+
+ if nonhtml_options[:btnplacement] == :left
edit_button + ' ' + span_tag
+ elsif nonhtml_options[:btnplacement] == :top
+ edit_button + raw('
') + span_tag
else
span_tag + ' ' + edit_button
end
@@ -368,11 +376,11 @@ module ApplicationHelper
success: 'page-refresh'
}.to_json,
})
- is_readable_input = attrvalue.present? and object_readable attrvalue, Collection
+
return content_tag('div', :class => 'input-group') do
html = text_field_tag(dn, display_value,
:class =>
- "form-control #{'required' if required} #{'unreadable-input' if !attrvalue.andand.empty? and !is_readable_input}")
+ "form-control #{'required' if required} #{'unreadable-input' if attrvalue.present? and !object_readable(attrvalue, Collection)}")
html + content_tag('span', :class => 'input-group-btn') do
link_to('Choose',
modal_path,