def human_readable_bytes_html(n)
return h(n) unless n.is_a? Fixnum
+ return "0 bytes" if (n == 0)
orders = {
1 => "bytes",
else
ajax_options['data-url'] = url_for(action: "create", controller: object.class.to_s.pluralize.underscore)
ajax_options['data-pk'][:defaults] = object.attributes
- ajax_options['data-pk'][:_method] = 'post'
end
ajax_options['data-pk'] = ajax_options['data-pk'].to_json
- link_to attrvalue.to_s, '#', {
+ content_tag 'span', attrvalue.to_s, {
"data-emptytext" => "none",
"data-placement" => "bottom",
"data-type" => input_type,
"data-title" => "Update #{attr.gsub '_', ' '}",
"data-name" => attr,
+ "data-object-uuid" => object.uuid,
:class => "editable"
}.merge(htmloptions).merge(ajax_options)
end
"data-pk" => "{id: \"#{object.uuid}\", key: \"#{object.class.to_s.underscore}\"}",
"data-showbuttons" => "false",
"data-value" => attrvalue,
- :class => "editable #{'required' if required}",
+ :class => "editable #{'required' if required} form-control",
:id => id
}.merge(htmloptions)
lt += raw("add_form_selection_sources(#{selectables.to_json});\n")
end
- lt += raw("$('##{id}').editable({source: function() { return select_form_sources('#{dataclass}'); } });\n")
+ lt += raw("$('[data-name=\"#{dn}\"]').editable({source: function() { return select_form_sources('#{dataclass}'); } });\n")
lt += raw("</script>")
lt
end
+
+ def render_arvados_object_list_start(list, button_text, button_href,
+ params={}, *rest, &block)
+ show_max = params.delete(:show_max) || 3
+ params[:class] ||= 'btn btn-xs btn-default'
+ list[0...show_max].each { |item| yield item }
+ unless list[show_max].nil?
+ link_to(h(button_text) +
+ raw(' <i class="fa fa-fw fa-arrow-circle-right"></i>'),
+ button_href, params, *rest)
+ end
+ end
end