limit(10).
order('created_at desc').
where(created_by: current_user.uuid)
+ collection_uuids = @my_collections.collect &:uuid
- Link.limit(1000).where(head_uuid: @my_collections.collect(&:uuid),
- link_class: 'tag').each do |link|
- (@my_tag_links[link.head_uuid] ||= []) << link
+ @persist_state = {}
+ collection_uuids.each do |uuid|
+ @persist_state[uuid] = 'cache'
+ end
+
+ Link.limit(1000).filter([['head_uuid', 'in', collection_uuids],
+ ['link_class', 'in', ['tag', 'resources']]]).
+ each do |link|
+ case link.link_class
+ when 'tag'
+ (@my_tag_links[link.head_uuid] ||= []) << link
+ when 'resources'
+ if link.name == 'wants'
+ @persist_state[link.head_uuid] = 'persistent'
+ end
+ end
end
@my_pipelines = PipelineInstance.
<table class="table table-bordered table-condensed table-fixedlayout">
<colgroup>
<col width="46%" />
- <col width="27%" />
- <col width="27%" />
+ <col width="24%" />
+ <col width="10%" />
+ <col width="20%" />
</colgroup>
<tr>
- <th>Contents</th>
- <th>Tags</th>
- <th>Age</th>
+ <th>Contents</th>
+ <th>Tags</th>
+ <th>Age</th>
+ <th>Storage</th>
</tr>
<% @my_collections[0..6].each do |c| %>
<%= raw(distance_of_time_in_words(c.created_at, Time.now).sub('about ','~').sub(' ',' ')) if c.created_at %>
</small>
</td>
+ <td>
+ <%= render partial: 'collections/toggle_persist', locals: { uuid: c.uuid, current_state: @persist_state[c.uuid] } %>
+ </td>
</tr>
<% end %>
</table>