sufia 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/Gemfile +1 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascripts/sufia.js +5 -312
  4. data/app/assets/javascripts/sufia/permissions.js +216 -0
  5. data/app/assets/javascripts/sufia/tabs.js +58 -0
  6. data/app/assets/stylesheets/generic_files.css +4 -0
  7. data/app/assets/stylesheets/jquery-ui.css +474 -0
  8. data/app/assets/stylesheets/{sufia.css → sufia.css.scss} +4 -1
  9. data/app/controllers/directory_controller.rb +17 -11
  10. data/app/controllers/users_controller.rb +5 -3
  11. data/app/models/datastreams/file_content_datastream.rb +2 -53
  12. data/app/views/batch/_metadata.html.erb +0 -1
  13. data/app/views/batch_edits/_metadata.html.erb +0 -1
  14. data/app/views/batch_edits/edit.html.erb +0 -1
  15. data/app/views/dashboard/_facet_pagination.html.erb +20 -39
  16. data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +1 -1
  17. data/app/views/dashboard/facet.html.erb +29 -34
  18. data/app/views/generic_files/_descriptions.html.erb +0 -1
  19. data/app/views/generic_files/_groups_description.html.erb +5 -0
  20. data/app/views/generic_files/_multiple_upload.html.erb +135 -0
  21. data/app/views/generic_files/_permission.html.erb +2 -5
  22. data/app/views/generic_files/_versioning.html.erb +0 -1
  23. data/app/views/generic_files/edit.html.erb +0 -3
  24. data/app/views/generic_files/new.html.erb +2 -138
  25. data/app/views/layouts/hydra-head.html.erb +1 -0
  26. data/app/views/users/index.html.erb +6 -4
  27. data/config/locales/sufia.en.yml +2 -0
  28. data/lib/sufia.rb +1 -1
  29. data/lib/sufia/file_content.rb +8 -0
  30. data/lib/sufia/file_content/extract_metadata.rb +53 -0
  31. data/lib/sufia/file_content/versions.rb +23 -0
  32. data/lib/sufia/files_controller_behavior.rb +17 -33
  33. data/lib/sufia/generic_file.rb +0 -8
  34. data/lib/sufia/generic_file/characterization.rb +0 -1
  35. data/lib/sufia/generic_file/thumbnail.rb +2 -4
  36. data/lib/sufia/jobs/unzip_job.rb +0 -1
  37. data/lib/sufia/user.rb +0 -3
  38. data/lib/sufia/version.rb +1 -1
  39. data/spec/controllers/batch_controller_spec.rb +11 -12
  40. data/spec/controllers/catalog_controller_spec.rb +2 -3
  41. data/spec/controllers/generic_files_controller_spec.rb +14 -16
  42. data/spec/controllers/single_use_link_controller_spec.rb +0 -1
  43. data/spec/models/batch_update_job_spec.rb +2 -3
  44. data/spec/models/checksum_audit_log_spec.rb +1 -2
  45. data/spec/models/file_content_datastream_spec.rb +1 -6
  46. data/spec/models/generic_file_spec.rb +2 -9
  47. data/spec/models/single_use_link_spec.rb +0 -2
  48. data/spec/models/transcode_video_job_spec.rb +1 -1
  49. data/spec/support/Gemfile +3 -5
  50. data/sufia.gemspec +2 -2
  51. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect-highlight.js +50 -0
  52. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect.js +1276 -0
  53. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.position.js +498 -0
  54. metadata +26 -21
  55. data/app/assets/stylesheets/font-awesome-ie7.css +0 -645
  56. data/app/assets/stylesheets/font-awesome.css +0 -303
  57. data/app/views/catalog/_facet_pagination.html.erb +0 -28
  58. data/app/views/catalog/facet.html.erb +0 -27
  59. data/public/robots.txt +0 -4
  60. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
@@ -1,10 +1,13 @@
1
1
  /* ...
2
2
  *= require_self
3
3
  *= require bootstrap.min
4
- *= require font-awesome
5
4
  *= require scholarsphere-bootstrap
6
5
  *= require blacklight_more_facets
7
6
  *= require batch_edit
8
7
  *= require generic_files
9
8
  *= require video-js
9
+ *= require jquery-ui
10
10
  */
11
+
12
+ @import 'font-awesome';
13
+
@@ -13,27 +13,33 @@
13
13
  # limitations under the License.
14
14
 
15
15
  class DirectoryController < ApplicationController
16
- include Hydra::Controller::ControllerBehavior
17
16
 
18
- # returns true if the user exists and false otherwise
17
+ # Stub method. Override this in your application if you want directory lookups
19
18
  def user
20
- render :json => User.directory_attributes(params[:uid])
19
+ #render :json => User.directory_attributes(params[:uid])
20
+ render :json => ""
21
21
  end
22
22
 
23
+ # Stub method. Override this in your application if you want directory lookups
23
24
  def user_attribute
24
- if params[:attribute] == "groups"
25
- res = User.groups(params[:uid])
26
- else
27
- res = User.directory_attributes(params[:uid], params[:attribute])
28
- end
29
- render :json => res
25
+ # if params[:attribute] == "groups"
26
+ # res = User.groups(params[:uid])
27
+ # else
28
+ # res = User.directory_attributes(params[:uid], params[:attribute])
29
+ # end
30
+ # render :json => res
31
+ render :json => ""
30
32
  end
31
33
 
34
+ # Stub method. Override this in your application if you want directory lookups
32
35
  def user_groups
33
- render :json => User.groups(params[:uid])
36
+ # render :json => User.groups(params[:uid])
37
+ render :json => []
34
38
  end
35
39
 
40
+ # Stub method. Override this in your application if you want directory lookups
36
41
  def group
37
- Group.exists?(params[:cn])
42
+ #render :json => Group.exists?(params[:cn])
43
+ render :json => false
38
44
  end
39
45
  end
@@ -21,9 +21,11 @@ class UsersController < ApplicationController
21
21
  def index
22
22
  sort_val = get_sort
23
23
  query = params[:uq].blank? ? nil : "%"+params[:uq].downcase+"%"
24
- @users = User.where("(login like lower(?) OR display_name like lower(?)) and ldap_available = true ",query,query).paginate(:page => params[:page],
25
- :per_page => 10, :order => sort_val) unless query.blank?
26
- @users = User.where("ldap_available = true").paginate(:page => params[:page], :per_page => 10, :order => sort_val) if query.blank?
24
+ if query.blank?
25
+ @users = User.order(sort_val).page(params[:page]).per(10) if query.blank?
26
+ else
27
+ @users = User.where("(login like lower(?) OR display_name like lower(?))",query,query).order(sort_val).page(params[:page]).per(10)
28
+ end
27
29
  end
28
30
 
29
31
  # Display user profile
@@ -12,58 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require 'open3'
16
15
  class FileContentDatastream < ActiveFedora::Datastream
17
- include Open3
18
-
19
- def to_tempfile &block
20
- return if content.nil?
21
- f = Tempfile.new("#{pid}-#{dsVersionID}")
22
- f.binmode
23
- if content.respond_to? :read
24
- f.write(content.read)
25
- else
26
- f.write(content)
27
- end
28
- f.close
29
- content.rewind if content.respond_to? :rewind
30
- yield(f)
31
- f.unlink
32
-
33
- end
34
-
35
- def extract_metadata
36
- out = nil
37
- to_tempfile do |f|
38
- command = "#{fits_path} -i #{f.path}"
39
- stdin, stdout, stderr = popen3(command)
40
- stdin.close
41
- out = stdout.read
42
- stdout.close
43
- err = stderr.read
44
- stderr.close
45
- raise "Unable to execute command \"#{command}\"\n#{err}" unless err.empty? or err.include? "Error parsing Exiftool XML Output"
46
- end
47
- out
48
- end
49
-
50
- # TODO: All the version functionality here + what's in the GF model should probably move into a mixin
51
- def get_version(version_id)
52
- self.versions.select { |v| v.versionID == version_id}.first
53
- end
54
-
55
- def latest_version
56
- self.versions.first
57
- end
58
-
59
- def version_committer(version)
60
- vc = VersionCommitter.where(:obj_id => version.pid,
61
- :datastream_id => version.dsid,
62
- :version_id => version.versionID)
63
- return vc.empty? ? nil : vc.first.committer_login
64
- end
65
-
66
- def fits_path
67
- Sufia::Engine.config.fits_path
68
- end
16
+ include Sufia::FileContent::ExtractMetadata
17
+ include Sufia::FileContent::Versions
69
18
  end
@@ -38,7 +38,6 @@ limitations under the License.
38
38
  </div>
39
39
  </div>
40
40
 
41
- <%= hidden_field_tag('generic_file[terms_of_service]', '1') %>
42
41
  <%= hidden_field_tag(:extra_description_count, "1") %>
43
42
  <div id="descriptions_display">
44
43
  <h2 class="non lower">Bulk Descriptions <small>(applied to all files just uploaded)</small> <small class="pull-right"><span class="error">*</span> indicates required fields</small></h2>
@@ -22,7 +22,6 @@
22
22
  </div>
23
23
  </div>
24
24
 
25
- <%= hidden_field_tag('generic_file[terms_of_service]', '1') %>
26
25
  <%= hidden_field_tag(:extra_description_count, "1") %>
27
26
  <div id="descriptions_display">
28
27
  <h2 class="non lower">Bulk Descriptions <small>(applied to all files just uploaded)</small> <small class="pull-right"><span class="error">*</span> indicates required fields</small></h2>
@@ -276,7 +276,6 @@ h2 small {
276
276
 
277
277
  <div id="collapse_<%=key%>" class="accordion-body collapse scrolly">
278
278
  <%= form_for @generic_file, :url=>batch_edits_path, :method=>:put, :remote => true, :html => { :id=>"form_"+key, :class=>"ajax-form"} do |f| %>
279
- <%= hidden_field_tag('generic_file[terms_of_service]', '1') %>
280
279
  <%= hidden_field_tag('update_type', 'update') %>
281
280
  <%= hidden_field_tag('key', key) %>
282
281
  <%= render :partial => "generic_files/field_form", :locals => { :generic_file => @show_file, :f =>f, :render_req => false, :key => key } %>
@@ -1,44 +1,25 @@
1
- <%#
2
- Copyright © 2012 The Pennsylvania State University
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- %>
16
-
17
- <% if @pagination.has_previous? || @pagination.has_next? %>
18
- <div class="prev_next_links">
19
- <% if @pagination.has_previous? -%>
20
- <%= link_to('« Previous', sufia.catalog_facet_path( @pagination.params_for_previous_url( params) ) , :class=>:prev_page) %>
21
- <% else -%>
22
- <span class="disabled ui-state-active prev_page">« Previous</span>
23
- <% end -%>
24
-
25
- <% if @pagination.has_next? -%>
26
- <%= link_to('Next »', sufia.catalog_facet_path( @pagination.params_for_next_url(params)), :class => :next_page ) %>
27
- <% else -%>
28
- <span class="disabled ui-state-active next_page">Next »</span>
29
- <% end -%>
30
-
1
+ <!-- This was copied from https://github.com/projectblacklight/blacklight/blob/master/app/views/catalog/_facet_pagination.html.erb
2
+ It implements the facets in the same manner as blacklight does for the main catalog for the individual's dashbord
3
+ -->
4
+ <div class="prev_next_links btn-group pull-left">
5
+ <%= link_to_previous_page @pagination, raw(t('views.pagination.previous')), :params => params, :param_name => Blacklight::Solr::FacetPaginator.request_keys[:page], :class => 'btn' do %>
6
+ <span class="disabled btn"><%= raw(t('views.pagination.previous')) %></span>
7
+ <% end %>
8
+ <%= link_to_next_page @pagination, raw(t('views.pagination.next')), :params => params, :param_name => Blacklight::Solr::FacetPaginator.request_keys[:page], :class => 'btn' do %>
9
+
10
+ <span class="disabled btn"><%= raw(t('views.pagination.next')) %></span>
11
+ <% end %>
12
+
31
13
  </div>
32
- <% end %>
33
-
34
- <div class="sort_options">
14
+
15
+ <div class="sort_options btn-group pull-right">
35
16
  <% if @pagination.sort == 'index' -%>
36
- <span class="disabled az">A-Z Sort</span><%= link_to_unless(@pagination.sort == 'count', "Numerical Sort",
37
- sufia.url_for(@pagination.params_for_resort_url('count', params)), :class => "sort_change numeric") %>
17
+ <span class="active az btn"><%= t('blacklight.search.facets.sort.index') %></span><%= link_to_unless(@pagination.sort == 'count', t('blacklight.search.facets.sort.count'),
18
+ Sufia::Engine.routes.url_for(@pagination.params_for_resort_url('count', params).symbolize_keys.merge(:only_path=>true)),
19
+ :class => "sort_change numeric btn") %>
38
20
  <% elsif @pagination.sort == 'count' -%>
39
- <%= link_to("A-Z Sort", sufia.url_for(@pagination.params_for_resort_url('index', params)),
40
- :class => "sort_change az") %><span class="disabled numeric">Numerical Sort</span>
21
+ <%= link_to(t('blacklight.search.facets.sort.index'),
22
+ Sufia::Engine.routes.url_for(@pagination.params_for_resort_url('index', params).symbolize_keys.merge(:only_path=>true)),
23
+ :class => "sort_change az btn") %><span class="active numeric btn"><%= t('blacklight.search.facets.sort.count') %></span>
41
24
  <% end -%>
42
25
  </div>
43
-
44
-
@@ -18,7 +18,7 @@ limitations under the License.
18
18
  <%- width = 36 if width.blank? -%>
19
19
  <% if (document['mime_type_t']) %>
20
20
  <% if !(document['mime_type_t'] & ['image/jpeg', 'image/png', 'image/bmp', 'image/gif', 'image/jpg']).empty? %>
21
- <%= link_to image_tag(download_path(document["id"], {:datastream_id => 'thumbnail'}), {:width=>width, :height=>height}), sufia.generic_file_path(document[:noid_s].first) %>
21
+ <%= link_to image_tag(sufia.download_path(document["id"], {:datastream_id => 'thumbnail'}), {:width=>width, :height=>height}), sufia.generic_file_path(document[:noid_s].first) %>
22
22
  <% elsif !(document['mime_type_t'] & ['application/pdf']).empty? %>
23
23
  <%= link_to image_tag(sufia.download_path(document["id"], {:datastream_id => 'thumbnail'}), {:width=>width,:height=>height}),sufia.generic_file_path(document[:noid_s].first) %>
24
24
  <% elsif !(document['mime_type_t'] & ['video/mp4']).empty? %>
@@ -1,42 +1,37 @@
1
- <%#
2
- Copyright © 2012 The Pennsylvania State University
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
1
+ <!-- This was copied from https://github.com/projectblacklight/blacklight/blob/master/app/views/catalog/facet.html.erb
2
+ It implements the facets in the same manner as blacklight does for the main catalog for the individual's dashbord
3
+ -->
4
+ <% sidebar_items << capture do %>
5
+ <p><%= link_back_to_catalog %></p>
6
+ <% end %>
9
7
 
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- %>
8
+ <div class="facet_pagination top">
9
+ <%= render :partial=>'facet_pagination' %>
10
+ </div>
16
11
 
17
- <div class="facet_extended_list">
18
- <% sidebar_items << capture do %>
19
- <p><%= link_back_to_catalog %></p>
20
- <% end %>
12
+ <div class="modal-header">
13
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
14
+ <h3><%= facet_field_labels[params[:id]] %></h3>
15
+ </div>
16
+ <div class="modal-body">
17
+ <div class="facet_extended_list">
21
18
 
22
- <div class="facet_pagination top">
23
- <%= render :partial=>'facet_pagination' %>
19
+ <ul class="facet_extended_list">
20
+ <% @pagination.items.each do |item| %>
21
+ <li>
22
+ <% if facet_in_params?( params[:id], item.value ) %>
23
+ <%= render_selected_facet_value(params[:id], item) %>
24
+ <% else %>
25
+ <%= render_facet_value(params[:id], item) %>
26
+ <% end -%>
27
+ </li>
28
+ <% end %>
29
+ </ul>
24
30
  </div>
31
+ </div>
25
32
 
26
- <h3><%= facet_field_labels[params[:id]] %></h3>
27
-
28
- <ul class="facet_extended_list">
29
- <% @pagination.items.each do |item| %>
30
- <li>
31
- <% if facet_in_params?( params[:id], item.value ) %>
32
- <%= render_selected_facet_value(params[:id], item) %>
33
- <% else %>
34
- <%= render_facet_value(params[:id], item) %>
35
- <% end -%>
36
- </li>
37
- <% end %>
38
- </ul>
39
-
33
+ <div class="modal-footer">
34
+
40
35
  <div class="facet_pagination bottom">
41
36
  <%= render :partial=>'facet_pagination' %>
42
37
  </div>
@@ -15,7 +15,6 @@ limitations under the License.
15
15
  %>
16
16
 
17
17
  <%= form_for @generic_file, :url => sufia.generic_file_path, :html => {:multipart => true, :class => 'form-horizontal'} do |f| %>
18
- <%= hidden_field_tag('generic_file[terms_of_service]', '1') %>
19
18
  <%= hidden_field_tag('redirect_tab', 'descriptions') %>
20
19
  <div id="descriptions_display">
21
20
  <h2 class="non lower">Descriptions <small class="pull-right"><span class="error">*</span> indicates required fields</small> </h2>
@@ -0,0 +1,5 @@
1
+ <p>
2
+ The list of groups in the drop-down marked &quot;Select a group&quot; is a list of User Managed Groups that you are a member of, and are managed by <%=t('sufia.institution_name') %>'s ITS department. You may select a specific group and assign an access
3
+ level for a file within <%=t('sufia.product_name') %>, similarly to adding user access levels. However, management of these groups and their membership is handled centrally at <a href="http://umg.its.psu.edu" target="_blank">umg.its.psu.edu</a>.
4
+ </p>
5
+
@@ -0,0 +1,135 @@
1
+ <div class="alert">
2
+ <strong>Note:</strong> You must agree to <a href='/agreement/' target="_blank"><%= t('sufia.deposit_agreement') %></a> before starting your upload.
3
+ </div>
4
+
5
+ <div class="alert alert-info hide" id="redirect-loc" type="text/x-jquery-tmpl">
6
+ <%=sufia.batch_edit_path(@batch_noid)%>
7
+ </div>
8
+
9
+ <div id="upload_tooltip"><%= t('sufia.upload_tooltip') %></div>
10
+
11
+ <div class="alert alert-info hide" id="success">
12
+ You have successfully uploaded some of your files. Either continue to upload or edit use the links below to abandon the rest of your added files.
13
+ <p>
14
+ <%= link_to 'Add Descriptions', sufia.batch_edit_path(@batch_noid), :class=>'btn' %>
15
+ </p>
16
+ </div>
17
+
18
+ <div class="alert hide" id="fail">
19
+ There was a problem during upload. Please click the &quot;Start Upload&quot; button or <%= link_to 'start over', sufia.new_generic_file_path %>
20
+ </div>
21
+
22
+ <div class="alert hide" id="partial_fail">
23
+ One or more files did not upload successfully. To continue using the files uploaded use one of the links below.<br />
24
+ <%= link_to 'Add Descriptions', sufia.batch_edit_path(@batch_noid), :class=>'btn' %>
25
+ </div>
26
+
27
+ <div class="alert hide" id="errmsg"> </div>
28
+
29
+ <!-- The file upload form used as target for the file upload widget -->
30
+ <%= form_for(@generic_file, :url => sufia.generic_files_path, :html => {:multipart => true, :class => 'form-horizontal well', :id => 'fileupload'}) do |f| %>
31
+ <%= hidden_field_tag(:total_upload_size, 0) %>
32
+ <%= hidden_field_tag(:relative_path) %>
33
+ <%= hidden_field_tag(:batch_id, @batch_noid) %>
34
+ <label class="checkbox">
35
+ <%= check_box_tag 'terms_of_service' %> I have read and do agree
36
+ to <%= link_to t('sufia.deposit_agreement'),
37
+ '/agreement/', :target => "_blank" %>.
38
+ </label>
39
+ <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
40
+ <div class="row fileupload-buttonbar">
41
+ <div class="span70">
42
+ <!-- The fileinput-button span is used to style the file input field as button -->
43
+ <span class="btn btn-success fileinput-button">
44
+ <i class="icon-plus icon-white"></i>
45
+ <span>Select files...</span>
46
+ <input type="file" name="files[]" multiple />
47
+ </span>
48
+ <% ua = request.env['HTTP_USER_AGENT'] %>
49
+ <% if !!(ua =~ /Chrome/) %>
50
+ <span class="btn btn-success fileinput-button">
51
+ <i class="icon-plus icon-white"></i>
52
+ <span>Select folder...</span>
53
+ <input type="file" name="files[]" directory webkitdirectory mozdirectory />
54
+ </span>
55
+ <% end %>
56
+ <span id="main_upload_start_span">
57
+ <button type="submit" class="btn btn-primary start" id='main_upload_start'>
58
+ <i class="icon-upload icon-white"></i>
59
+ <span>Start upload</span>
60
+ </button>
61
+ </span>
62
+ <button type="reset" class="btn btn-warning cancel">
63
+ <i class="icon-ban-circle icon-white"></i>
64
+ <span>Cancel upload</span>
65
+ </button>
66
+ </div>
67
+ <div class="span50">
68
+ <!-- The global progress bar -->
69
+ <div class="progress progress-success progress-striped active fade">
70
+ <div class="bar" style="width:0%;"></div>
71
+ </div>
72
+ </div>
73
+ </div>
74
+ <!-- The loading indicator is shown during image processing -->
75
+ <div class="fileupload-loading"></div>
76
+ <br />
77
+ <!-- The table listing the files available for upload/download -->
78
+ <table id="file-table" class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
79
+ <% end %>
80
+
81
+ <!-- The template to display files available for upload -->
82
+ <script id="template-upload" type="text/x-jquery-tmpl">
83
+ {% for (var i=0, file; file=o.files[i]; i++) { %}
84
+
85
+ <tr class="template-upload fade">
86
+ <td class="preview"><span class="fade"></span></td>
87
+ <td class="name"><span>{%=file.name%}</span></td>
88
+ <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
89
+ {% if (file.error) { %}
90
+ <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
91
+ {% } else if (o.files.valid && !i) { %}
92
+ <td>
93
+ <div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div>
94
+ </td>
95
+ <td class="start">{% if (!o.options.autoUpload) { %}
96
+ <button class="btn btn-primary hide">
97
+ <i class="icon-upload icon-white"></i>
98
+ <span>{%=locale.fileupload.start%}</span>
99
+ </button>
100
+ {% } %}</td>
101
+ {% } else { %}
102
+ <td colspan="2"></td>
103
+ {% } %}
104
+ <td class="cancel">{% if (!i) { %}
105
+ <button class="btn btn-warning">
106
+ <i class="icon-ban-circle icon-white"></i>
107
+ <span>{%=locale.fileupload.cancel%}</span>
108
+ </button>
109
+ {% } %}</td>
110
+ </tr>
111
+ {% } %}
112
+ </script>
113
+ <!-- The template to display files available for download -->
114
+ <script id="template-download" type="text/x-jquery-tmpl">
115
+ {% for (var i=0, file; file=o.files[i]; i++) { %}
116
+ <tr class="template-download fade">
117
+ {% if (file.error) { %}
118
+ <td><span></span></td>
119
+ <td class="name"><span>{%=file.name%}</span></td>
120
+ <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
121
+ <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
122
+ {% } else { %}
123
+ <td class="preview">
124
+ {% if (file.thumbnail_url) { %} <span class="label label-success">Success</span> {% } %}
125
+ </td>
126
+ <td class="name">
127
+ {%=file.name%}
128
+ <!--a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}" target="_blank">{%=file.name%}</a-->
129
+ </td>
130
+ <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
131
+ <td colspan="2"></td>
132
+ {% } %}
133
+ </tr>
134
+ {% } %}
135
+ </script>