forked from aces/cbrain
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eafabe2
commit a013bd6
Showing
7 changed files
with
525 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
.../cbrain-plugins-base/userfiles/virtual_file_collection/views/_directory_contents.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
|
||
<%- | ||
# | ||
# CBRAIN Project | ||
# | ||
# Copyright (C) 2008-2012 | ||
# The Royal Institution for the Advancement of Learning | ||
# McGill University | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
-%> | ||
why this is shows | ||
<% limit = 500 %> | ||
<% base_dir = base_directory rescue params[:base_directory] %> | ||
<% base_dir = base_dir.presence || "." %> | ||
|
||
<% file_list ||= ( @userfile.list_linked_files(base_dir, [:regular, :directory, :link]) rescue [] ) %> | ||
|
||
<% if file_list.blank? %> | ||
|
||
<tr class="<%= cycle("list-odd", "list-even") %>"> | ||
<td></td> | ||
<td colspan="2"> (<span class="warning">Empty</span>) </td> | ||
<td></td> | ||
</tr> | ||
|
||
<% else %> | ||
|
||
<% for file in file_list[0,limit] %> | ||
<% if file.symbolic_type == :directory %> | ||
<%= on_click_ajax_replace( { :element => "tr", | ||
:url => url_for(:action => :display, | ||
:viewer => "directory_contents", | ||
:viewer_userfile_class => "FileCollection", | ||
:base_directory => file.name.sub(/\A[^\/]+\//, ""), | ||
:apply_div => "false" | ||
), | ||
:position => "after", | ||
:before => "<td colspan='4' class='loading_message'>Loading...</td>" | ||
}, | ||
{ :class => "#{cycle("list-odd", "list-even")}", | ||
:id => file.name.gsub(/\W+/, "_") | ||
} | ||
) do %> | ||
<%= render :file => @viewer.partial_path(:plain_file_list_row), :locals => {:file => file} %> | ||
<% end %> | ||
<% else %> | ||
<tr class="<%= cycle("list-odd", "list-even") %>"> | ||
<%= render :file => @viewer.partial_path(:plain_file_list_row), :locals => {:file => file} %> | ||
</tr> | ||
<% end %> | ||
<% end %> | ||
|
||
<% if file_list.size > limit %> | ||
<tr class="<%= cycle("list-odd", "list-even") %>"> | ||
<td></td> | ||
<td colspan="2" class="left"> <%= (" " * 6 * file_list.first.depth).html_safe %> ... <%= image_tag "/images/lotsa_files_icon.png" %> <%= pluralize(file_list.size-limit, "more entry") %></td> | ||
<td></td> | ||
</tr> | ||
<% end %> | ||
|
||
<% end %> | ||
|
36 changes: 36 additions & 0 deletions
36
...ins/cbrain-plugins-base/userfiles/virtual_file_collection/views/_file_collection.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
<%- | ||
# | ||
# CBRAIN Project | ||
# | ||
# Copyright (C) 2008-2012 | ||
# The Royal Institution for the Advancement of Learning | ||
# McGill University | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
-%> | ||
|
||
<% | ||
# This partial can be invoked directly as a viewer from the display action, | ||
# or rendered as part of another piece of view code. As such it will | ||
# accept a "base_directory" either as a params[] or as a local variable | ||
base_dir = base_directory rescue params[:base_directory] | ||
%> | ||
|
||
<%= render :file => VirtualFileCollection.view_path(:file_collection_form), | ||
:locals => { :base_directory => base_dir } %> | ||
|
||
<div id="sub_viewer_filecollection_cbrain"></div> | ||
|
1 change: 1 addition & 0 deletions
1
...ins/cbrain-plugins-base/userfiles/virtual_file_collection/views/_file_collection.json.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= @userfile.list_linked_files.to_json %> |
58 changes: 58 additions & 0 deletions
58
...brain-plugins-base/userfiles/virtual_file_collection/views/_file_collection_form.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
<%- | ||
# | ||
# CBRAIN Project | ||
# | ||
# Copyright (C) 2008-2012 | ||
# The Royal Institution for the Advancement of Learning | ||
# McGill University | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
-%> | ||
|
||
<% | ||
# This partial requires one local variable: | ||
# | ||
# base_directory : the subdirectory inside the userfile where we start to render the directory content | ||
%> | ||
Debug Virtual File Collection Form 1 | ||
<% if true # @userfile.num_files && @userfile.num_files > 0 %> | ||
|
||
<%= form_for @userfile, :as => :userfile, | ||
:url => { :controller => :userfiles, | ||
:action => :extract_from_collection | ||
}, | ||
:html => { :method => :post, | ||
:id => "userfile_edit_#{@userfile.id}_#{base_directory}" | ||
} do |f| %> | ||
<%= ajax_element(display_userfile_path(@userfile, | ||
:viewer => :file_collection_top_table, | ||
:viewer_userfile_class => :VirtualFileCollection, | ||
:base_directory => base_directory, | ||
), :class => "loading_message") do %> | ||
<br> | ||
Loading... | ||
<br> | ||
<% end %> | ||
|
||
<% if @userfile.is_locally_synced? %> | ||
<P> | ||
<%= submit_tag "Extract Files from Virtual Collection" %> | ||
<% end %> | ||
|
||
<% end %> | ||
|
||
<% end %> | ||
|
48 changes: 48 additions & 0 deletions
48
...-plugins-base/userfiles/virtual_file_collection/views/_file_collection_top_table.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
<%- | ||
# | ||
# CBRAIN Project | ||
# | ||
# Copyright (C) 2008-2012 | ||
# The Royal Institution for the Advancement of Learning | ||
# McGill University | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
-%> | ||
|
||
<% | ||
# This partial requires one params variable: | ||
# params[:base_directory] : a relative path to the subdirectory inside the userfile; we will list from that point. | ||
%> | ||
|
||
<% | ||
base_dir = params[:base_directory].presence || "" | ||
%> | ||
<table class="plain_file_list" class="resource_list"> | ||
<tr class="list-odd"> | ||
<th> | ||
<% if @userfile.is_locally_synced? %> | ||
<%= select_all_checkbox "collection_checkbox" %> | ||
<% end %> | ||
</th> | ||
<th>File</th> | ||
<th title="Download file">DL</th> | ||
<th>Size</th> | ||
</tr> | ||
<%= render :file => VirtualFileCollection.view_path(:directory_contents), | ||
:locals => { :base_directory => base_dir } | ||
%> | ||
</table> | ||
|
75 changes: 75 additions & 0 deletions
75
...cbrain-plugins-base/userfiles/virtual_file_collection/views/_plain_file_list_row.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
|
||
<%- | ||
# | ||
# CBRAIN Project | ||
# | ||
# Copyright (C) 2008-2012 | ||
# The Royal Institution for the Advancement of Learning | ||
# McGill University | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
-%> | ||
|
||
<% | ||
# This partial receives one local variable: | ||
# file : a file structure as returned by the FileCollection listing method | ||
# Note that is contains a full relative path, starting with the @userfile's name itself. | ||
%> | ||
|
||
<td> | ||
<% if @userfile.is_locally_synced? && file.symbolic_type == :regular %> | ||
<%= check_box_tag("file_names[]", file.name, false, :class => "collection_checkbox", :id => nil) %> | ||
<% end %> | ||
</td> | ||
|
||
<td class="left"> | ||
<%= (" " * 6 * file.depth).html_safe %> | ||
|
||
<div style="display: inline-flex"> | ||
<% if file.symbolic_type == :directory %> | ||
<%= image_tag "/images/folder_icon_solid.png" %> | ||
<% else %> | ||
<%= image_tag "/images/file_icon.png" %> | ||
<% end %> | ||
|
||
| ||
|
||
<% if file.size > 0 %> | ||
<%= data_link file.name, @userfile %> | ||
<% else %> | ||
<%= Pathname.new(file.name).basename.to_s %> | ||
<% end %> | ||
|
||
<% if file.symbolic_type == :directory %> | ||
| ||
<span class="ajax_onclick_show_child small warning">Expand</span> | ||
<span class="ajax_onclick_hide_child small warning" style="display:none">Hide</span> | ||
<% end %> | ||
</div> | ||
</td> | ||
|
||
<td> | ||
<% if file.symbolic_type == :regular && file.size > 0 && file.size < UserfilesController::MAX_DOWNLOAD_MEGABYTES.megabytes %> | ||
<%= link_to url_for(:action => :content, :content_loader => :collection_file, :arguments => file.name) do %> | ||
<span title="Download file" id="span" class="ui-button-icon ui-icon ui-icon-arrowthickstop-1-s"></span> | ||
<% end %> | ||
<% end %> | ||
</td> | ||
|
||
<td> | ||
<% if file.symbolic_type != :directory %> | ||
<%= colored_pretty_size(file.size) %> | ||
<% end %> | ||
</td> |
Oops, something went wrong.