$(document).
on('ready ajax:complete', function() {
- $('#editable-submit').click(function() {
- console.log($(this));
- });
$('.editable').
+ not('.editable-done-setup').
+ addClass('editable-done-setup').
editable({
success: function(response, newValue) {
// If we just created a new object, stash its UUID
});
}).
on('ready ajax:complete', function() {
- $("[data-toggle~='x-editable']").click(function(e) {
- e.stopPropagation();
- $($(this).attr('data-toggle-selector')).editable('toggle');
- });
+ $("[data-toggle~='x-editable']").
+ not('.editable-done-setup').
+ addClass('editable-done-setup').
+ click(function(e) {
+ e.stopPropagation();
+ $($(this).attr('data-toggle-selector')).editable('toggle');
+ });
});
$.fn.editabletypes.text.defaults.tpl = '<input type="text" name="editable-text">'
font-size: .8em;
color: #888;
}
+.arvados-filename,
.arvados-uuid {
font-size: .8em;
font-family: monospace;
}
.arv-description-in-table {
max-height: 3.5em;
+ overflow-x: hidden;
overflow-y: hidden;
}
.arv-description-in-table:hover {
.arv-folder-list > .row.folder:hover {
background: #d9edf7;
}
+div.scroll-20em {
+ height: 20em;
+ overflow-y: scroll;
+}
end
def update
- @updates ||= params[@object.class.to_s.underscore.singularize.to_sym]
+ @updates ||= params[@object.resource_param_name.to_sym]
@updates.keys.each do |attr|
if @object.send(attr).is_a? Hash
if @updates[attr].is_a? String
end
end
- if !object.attribute_editable?(attr, :ever) or
+ if !object or
+ !object.attribute_editable?(attr, :ever) or
(!object.editable? and
!object.owner_uuid.in?(my_folders.collect(&:uuid)))
return link_to_if_arvados_object attrvalue
end
end
+ def render_controller_partial partial, opts
+ cname = opts.delete :controller_name
+ begin
+ render opts.merge(partial: "#{cname}/#{partial}")
+ rescue ActionView::MissingTemplate
+ render opts.merge(partial: "application/#{partial}")
+ end
+ end
+
def fa_icon_class_for_object object
case object.class.to_s.to_sym
when :User
'fa-clipboard'
when :Human
'fa-male'
+ when :VirtualMachine
+ 'fa-terminal'
+ when :Repository
+ 'fa-code-fork'
+ when :Link
+ 'fa-arrows-h'
+ when :User
+ 'fa-user'
+ when :Node
+ 'fa-cloud'
+ when :KeepService
+ 'fa-exchange'
+ when :KeepDisk
+ 'fa-hdd-o'
+ else
+ 'fa-cube'
end
end
end
resource_class
end
+ def resource_param_name
+ self.class.to_s.underscore
+ end
+
def friendly_link_name
(name if self.respond_to? :name) || default_name
end
self.to_s.underscore.humanize
end
+ def controller
+ (self.class.to_s.pluralize + 'Controller').constantize
+ end
+
+ def controller_name
+ self.class.to_s.tableize
+ end
+
# Placeholder for name when name is missing or empty
def default_name
if self.respond_to? :name
+<% content_for :content_top do %>
+ <% if @object and not @object.is_a?(Group) and @object.class.goes_in_folders? and @object.owner_uuid == current_user.uuid %>
+ <div class="pull-right" style="width: 40%">
+ <div class="alert alert-warning alert-dismissable">
+ <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
+ <strong>Hey.</strong> This <%= @object.class_for_display.downcase %> belongs to your account, but it's not in any of your folders. If you want it to be easy to find in the future, you should move it to a folder.<br />
+ <%= button_to(choose_folders_path(
+ title: 'Move to...',
+ editable: true,
+ action_name: 'Move',
+ action_href: url_for(action: :update),
+ action_method: 'patch',
+ action_data: {selection_param: @object.resource_param_name+'[owner_uuid]', success: 'page-refresh'}.to_json),
+ { class: "btn btn-primary btn-sm", remote: true, method: 'get' }) do %>
+ <i class="fa fa-fw fa-folder"></i> Choose a folder...
+ <% end %>
+ </div>
+ </div>
+ <% end %>
+<% end %>
+
<% content_for :tab_panes do %>
<% comparable = controller.respond_to? :compare %>
<%= content_for :content_top %>
+<br clear="all" />
<div class="pull-right">
<%= content_for :tab_line_buttons %>
</div>
<% htmloptions = {class: ''}.merge(htmloptions || {})
htmloptions[:class] += " btn-#{size}" rescue nil %>
-<%= link_to_if_arvados_object object, { link_text: raw('<i class="glyphicon glyphicon-zoom-in"></i>') }, { data: {toggle: 'tooltip', placement: 'top'}, title: 'show', class: 'btn btn-default btn-nodecorate ' + htmloptions[:class] } %>
+<%= link_to_if_arvados_object object, {
+ link_text: raw('<i class="fa fa-fw ' + fa_icon_class_for_object(object) + '"></i>')
+ }, {
+ data: {
+ toggle: 'tooltip',
+ placement: 'top'
+ },
+ title: 'show',
+ class: 'btn btn-default btn-nodecorate ' + htmloptions[:class]
+ } %>
--- /dev/null
+<%= object.content_summary %>
+
--- /dev/null
+<div class="nowrap">
+ <div>
+ <% Link.filter([['link_class','=','tag'],['head_uuid','=',object.uuid]]).collect(&:name).each do |tagname| %>
+ <span class="label label-info"><%= tagname %></span>
+ <% end %>
+ </div>
+ <span class="deemphasize">
+ Files (<%= human_readable_bytes_html(object.total_bytes) %>):
+ </span><span class="arvados-filename">
+ <% object.files.each do |path, file, size| %>
+ <%= file %>
+ <% end %>
+ </span>
+</div>
--- /dev/null
+<div class="container-fluid arv-folder-list">
+ <% tree.each do |foldernode| %>
+ <% rowtype = foldernode[:object].class %>
+ <% next if rowtype != Group and !show_root_node %>
+ <div class="<%= 'folder' if rowtype == Group %> row">
+ <div class="col-md-12" style="padding-left: <%= foldernode[:depth] - (show_root_node ? 0 : 1) %>em;">
+ <% if show_root_node and rowtype == String %>
+ <i class="fa fa-fw fa-folder-open-o"></i>
+ <%= foldernode[:object] %>
+ <% elsif show_root_node and rowtype == User %>
+ <% if foldernode[:object].uuid == current_user.andand.uuid %>
+ <i class="fa fa-fw fa-folder-open-o"></i>
+ My Folders
+ <% else %>
+ <i class="fa fa-fw fa-folder-o"></i>
+ <%= foldernode[:object].friendly_link_name %>
+ <% end %>
+ <% elsif rowtype == Group %>
+ <i class="fa fa-fw fa-folder-o"></i>
+ <% opts = {} %>
+ <% opts[:title] = foldernode[:object].description %>
+ <% opts[:'data-toggle'] = 'tooltip' %>
+ <% opts[:'data-placement'] = 'bottom' %>
+ <%= link_to foldernode[:object], opts do %>
+ <%= foldernode[:object].friendly_link_name %>
+ <% end %>
+ <% end %>
+ </div>
+ </div>
+ <% end %>
+</div>
</div>
</div>
-<table class="table table-condensed arv-index arv-folder-contents">
+<table class="table table-condensed table-fixedlayout arv-index arv-folder-contents" style="overflow-x: hidden">
<colgroup>
<col width="40%" />
<col width="60%" />
>
<td>
<% if folder.editable? %>
- <%= link_to({action: 'remove_item', id: folder.uuid, item_uuid: ((name_link && name_link.uuid) || object.uuid)}, method: :delete, remote: true, data: {confirm: "Remove #{object.class_for_display.downcase} #{name_object.name rescue object.uuid} from this folder?", toggle: 'tooltip', placement: 'top'}, class: 'btn btn-xs btn-default btn-nodecorate', title: 'remove') do %>
+ <%= link_to({action: 'remove_item', id: folder.uuid, item_uuid: ((name_link && name_link.uuid) || object.uuid)}, method: :delete, remote: true, data: {confirm: "Remove #{object.class_for_display.downcase} #{name_object.name rescue object.uuid} from this folder?", toggle: 'tooltip', placement: 'top'}, class: 'btn btn-sm btn-default btn-nodecorate', title: 'remove') do %>
<i class="fa fa-fw fa-ban"></i>
<% end %>
<% else %>
<i class="fa fa-fw"></i><%# placeholder %>
<% end %>
- <%= render :partial => "show_object_button", :locals => {object: object, size: 'xs'} %>
-
- <i class="fa fa-fw <%= fa_icon_class_for_object(object) %>"></i>
+ <%= render :partial => "show_object_button", :locals => {object: object, size: 'sm'} %>
<%= render_editable_attribute name_object, 'name', nil %>
</td>
- <td>
- <%= object.content_summary %>
+ <td class="arv-description-in-table">
+ <%= render_controller_partial(
+ 'show_object_description_cell.html',
+ controller_name: object.controller_name,
+ locals: {object: object})
+ %>
</td>
</tr>
<% end %>
+++ /dev/null
-<div class="container-fluid arv-folder-list">
- <% [@my_folder_tree, @shared_folder_tree].each do |tree| %>
- <% tree.each do |foldernode| %>
- <% rowtype = foldernode[:object].class %>
- <div class="<%= 'folder' if rowtype == Group %> row">
- <div class="col-lg-4" style="padding-left: <%= 1 + foldernode[:depth] %>em;">
- <% if rowtype == String %>
- <i class="fa fa-fw fa-folder-open-o"></i>
- <%= foldernode[:object] %>
- <% elsif rowtype == User %>
- <% if foldernode[:object].uuid == current_user.andand.uuid %>
- <i class="fa fa-fw fa-folder-open-o"></i>
- My Folders
- <% else %>
- <i class="fa fa-fw fa-folder-o"></i>
- <%= foldernode[:object].friendly_link_name %>
- <% end %>
- <% else %>
- <i class="fa fa-fw fa-folder-o"></i>
- <%= link_to foldernode[:object] do %>
- <%= foldernode[:object].friendly_link_name %>
- <% end %>
- <% end %>
- </div>
- <div class="col-lg-8 arv-description-in-table">
- <% if rowtype == Group %>
- <%= foldernode[:object].description %>
- <% end %>
- </div>
- </div>
- <% end %>
- <% end %>
-</div>
--- /dev/null
+<% content_for :breadcrumbs do %>
+<li class="nav-separator"><span class="glyphicon glyphicon-arrow-right"></span></li>
+<li><a href="#">Home</a></li>
+<% end %>
+
+<div class="container-fluid">
+ <div class="row">
+ <div class="col-sm-6">
+ <% if my_folders.empty? %>
+ <div class="panel panel-info">
+ <div class="panel-heading">
+ <h3 class="panel-title">
+ Welcome to <b><%= Rails.configuration.site_name %></b>.
+ </h3>
+ </div>
+ <div class="panel-body">
+ <img src="/favicon.ico" class="pull-right" alt="" style="opacity: 0.3"/>
+ <p>
+ This site runs Arvados, the open source biomedical analysis platform. <a href="https://arvados.org" target="_blank">Learn more…</a>
+ </p>
+ <p>
+ <b>To get started,</b> create a folder using the "Add new folder" button below.
+ </p>
+ </div>
+ </div>
+ <% end %>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <div class="pull-right">
+ <%= button_to folders_path(method: 'post'), class: 'btn btn-xs btn-primary' do %>
+ <i class="fa fa-fw fa-plus"></i>
+ Add new folder
+ <% end %>
+ </div>
+ <h3 class="panel-title">
+ My folders
+ </h3>
+ </div>
+ <div class="panel-body scroll-20em">
+ <%= render partial: 'index_folders', locals: {tree: @my_folder_tree, show_root_node: false} %>
+ </div>
+ </div>
+ </div>
+ <div class="col-sm-6">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">
+ Shared folders
+ </h3>
+ </div>
+ <div class="panel-body scroll-20em">
+ <%= render partial: 'index_folders', locals: {tree: @shared_folder_tree, show_root_node: false} %>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
<span class="glyphicon glyphicon-cog"></span><span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
- <li role="presentation" class="dropdown-header">System objects</li>
+ <li role="presentation" class="dropdown-header">
+ <i class="fa fa-lg fa-fw"></i>
+ System tools
+ </li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a href="/repositories">
<i class="fa fa-lg fa-code-fork fa-fw"></i> Repositories
<%= render_editable_attribute @object, 'name', nil %>
</h2>
<% if template %>
- <h4>
- From template:
+ <blockquote><span class="deemphasize">From template:</span><br />
<%= link_to_if_arvados_object template, friendly_name: true %>
- </h4>
+ </blockquote>
<% end %>
<% end %>