-$.fn.editable.defaults.ajaxOptions = {type: 'put', dataType: 'json'};
+$.fn.editable.defaults.ajaxOptions = {type: 'post', dataType: 'json'};
$.fn.editable.defaults.send = 'always';
// Default for editing is popup. I experimented with inline which is a little
var a = {};
var key = params.pk.key;
a.id = params.pk.id;
- a[key] = {};
+ a[key] = params.pk.defaults || {};
a[key][params.name] = params.value;
+ if (params.pk._method) {
+ a['_method'] = params.pk._method;
+ } else {
+ a['_method'] = 'put';
+ }
return a;
};
}
}
+$(document).
+ on('ready ajax:complete', function() {
+ $('#editable-submit').click(function() {
+ console.log($(this));
+ });
+ });
+
$.fn.editabletypes.text.defaults.tpl = '<input type="text" name="editable-text">'
$.fn.editableform.buttons = '\
font-size: .8em;
color: #888;
}
+.arvados-uuid {
+ font-size: .8em;
+ font-family: monospace;
+}
table .data-size, .table .data-size {
text-align: right;
}
--- /dev/null
+.card {
+ padding-top: 20px;
+ margin: 10px 0 20px 0;
+ background-color: #ffffff;
+ border: 1px solid #d8d8d8;
+ border-top-width: 0;
+ border-bottom-width: 2px;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+ -webkit-box-shadow: none;
+ -moz-box-shadow: none;
+ box-shadow: none;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+.card.arvados-object {
+ position: relative;
+ display: inline-block;
+ width: 170px;
+ height: 175px;
+ padding-top: 0;
+ margin-left: 20px;
+ overflow: hidden;
+ vertical-align: top;
+}
+.card.arvados-object .card-top.green {
+ background-color: #53a93f;
+}
+.card.arvados-object .card-top.blue {
+ background-color: #427fed;
+}
+.card.arvados-object .card-top {
+ position: absolute;
+ top: 0;
+ left: 0;
+ display: inline-block;
+ width: 170px;
+ height: 25px;
+ background-color: #ffffff;
+}
+.card.arvados-object .card-info {
+ position: absolute;
+ top: 25px;
+ display: inline-block;
+ width: 100%;
+ height: 101px;
+ overflow: hidden;
+ background: #ffffff;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+.card.arvados-object .card-info .title {
+ display: block;
+ margin: 8px 14px 0 14px;
+ overflow: hidden;
+ font-size: 16px;
+ font-weight: bold;
+ line-height: 18px;
+ color: #404040;
+}
+.card.arvados-object .card-info .desc {
+ display: block;
+ margin: 8px 14px 0 14px;
+ overflow: hidden;
+ font-size: 12px;
+ line-height: 16px;
+ color: #737373;
+ text-overflow: ellipsis;
+}
+.card.arvados-object .card-bottom {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ display: inline-block;
+ width: 100%;
+ padding: 10px 20px;
+ line-height: 29px;
+ text-align: center;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
end
def create
- @object ||= model_class.new params[model_class.to_s.underscore.singularize]
+ new_resource_attrs = params[model_class.to_s.underscore.singularize].
+ reject { |k,v| k.to_s == 'uuid' }
+ @object ||= model_class.new new_resource_attrs
@object.save!
respond_to do |f|
@links_from = Link.where link_class: 'permission', tail_uuid: @group_uuids
@links_to = Link.where link_class: 'permission', head_uuid: @group_uuids
end
+
+ def show
+ @objects = @object.owned_items include_linked: true
+ super
+ end
end
attrvalue = attrvalue.to_json if attrvalue.is_a? Hash or attrvalue.is_a? Array
+ ajax_options = {
+ "data-pk" => {
+ id: object.uuid,
+ key: object.class.to_s.underscore
+ }
+ }
+ if object.uuid
+ ajax_options['data-url'] = url_for(action: "update", id: object.uuid, controller: object.class.to_s.pluralize.underscore)
+ 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, '#', {
"data-emptytext" => "none",
"data-placement" => "bottom",
"data-type" => input_type,
- "data-url" => url_for(action: "update", id: object.uuid, controller: object.class.to_s.pluralize.underscore),
"data-title" => "Update #{attr.gsub '_', ' '}",
"data-name" => attr,
- "data-pk" => "{id: \"#{object.uuid}\", key: \"#{object.class.to_s.underscore}\"}",
:class => "editable"
- }.merge(htmloptions)
+ }.merge(htmloptions).merge(ajax_options)
end
def render_pipeline_component_attribute(object, attr, subattr, value_info, htmloptions={})
(name if self.respond_to? :name) || uuid
end
+ def content_summary
+ self.class.to_s
+ end
+
def selection_label
friendly_link_name
end
end
def name_for item_or_uuid
- links_for(item_or_uuid, 'name').first.name
+ links_for(item_or_uuid, 'name').first.andand.name
end
end
class Collection < ArvadosBase
+ include ApplicationHelper
MD5_EMPTY = 'd41d8cd98f00b204e9800998ecf8427e'
!!locator.to_s.match("^#{MD5_EMPTY}(\\+.*)?\$")
end
+ def content_summary
+ human_readable_bytes_html(total_bytes) + " " + super
+ end
+
def total_bytes
if files
tot = 0
.arvados-nav-container {
display:none;
}
-.card {
- padding-top: 20px;
- margin: 10px 0 20px 0;
- background-color: #ffffff;
- border: 1px solid #d8d8d8;
- border-top-width: 0;
- border-bottom-width: 2px;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
-}
-.card.arvados-object {
- position: relative;
- display: inline-block;
- width: 170px;
- height: 175px;
- padding-top: 0;
- margin-left: 20px;
- overflow: hidden;
- vertical-align: top;
-}
-.card.arvados-object .card-top.green {
- background-color: #53a93f;
-}
-.card.arvados-object .card-top.blue {
- background-color: #427fed;
-}
-.card.arvados-object .card-top {
- position: absolute;
- top: 0;
- left: 0;
- display: inline-block;
- width: 170px;
- height: 25px;
- background-color: #ffffff;
-}
-.card.arvados-object .card-info {
- position: absolute;
- top: 25px;
- display: inline-block;
- width: 100%;
- height: 101px;
- overflow: hidden;
- background: #ffffff;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
-}
-.card.arvados-object .card-info .title {
- display: block;
- margin: 8px 14px 0 14px;
- overflow: hidden;
- font-size: 16px;
- font-weight: bold;
- line-height: 18px;
- color: #404040;
-}
-.card.arvados-object .card-info .desc {
- display: block;
- margin: 8px 14px 0 14px;
- overflow: hidden;
- font-size: 12px;
- line-height: 16px;
- color: #737373;
- text-overflow: ellipsis;
-}
-.card.arvados-object .card-bottom {
- position: absolute;
- bottom: 0;
- left: 0;
- display: inline-block;
- width: 100%;
- padding: 10px 20px;
- line-height: 29px;
- text-align: center;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
-}
<% end %>
<% content_for :above_left_nav do %>
</div>
<div class="panel-body">
<p>
- </p><table class="table">
+ </p>
+ <table class="table">
<tbody>
+ <colgroup>
+ <col width="30%" />
+ <col width="20%" />
+ <col width="20%" />
+ <col width="30%" />
+ </colgroup>
+ <% @objects.each do |object| %>
<tr>
<td>
- Some Subfolder
- </td>
- <td>
- 12 items
- </td>
- <td>
- 2014-04-01
- </td>
- </tr>
- <tr>
- <td>
- Test Dataset
+ <% name_link = @objects.links_for(object, 'name').first || Link.new(link_class: "name", owner_uuid: @object.uuid, tail_uuid: @object.uuid, head_uuid: object.uuid, name: "") %>
+ <%= render_editable_attribute name_link, 'name', nil, { 'data-emptytext' => "Unnamed #{object.class}" } %>
</td>
<td>
- 4 GiB
+ <%= object.content_summary %>
</td>
- <td>
- 2014-04-01
+ <td title="<%= object.modified_at %>">
+ <span>
+ <%= raw distance_of_time_in_words(object.modified_at, Time.now).sub('about ','~').sub(' ',' ') + ' ago' %>
+ </span>
</td>
- </tr>
- <tr>
- <td>
- Test Dataset 2
- </td>
- <td>
- 4 GiB
- </td>
- <td>
- 2014-04-01
- </td>
- </tr>
- <tr>
- <td>
- GATK Exome Pipeline
- </td>
- <td>
- 7 components
- </td>
- <td>
- 2014-03-21
- </td>
- </tr>
- <tr>
- <td>
- Reference result
- </td>
- <td>
- 250 MiB
- </td>
- <td>
- 2014-03-22
- </td>
- </tr>
- <tr>
- <td>
- Some other thing
- </td>
- <td>
- 1.2 TiB
- </td>
- <td>
- 2014-01-01
+ <td class="arvados-uuid">
+ <%= link_to_if_arvados_object(object, {no_tags: true}) %>
</td>
</tr>
+ <% end %>
</tbody>
<thead>
<tr>
<th>
Modified
</th>
+ <th>
+ UUID
+ </th>
</tr>
</thead>
</table>