browse-everything 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0537c853279c1686cb6da696a32c72ece3ecb9d
4
- data.tar.gz: 79ba0379386ab732db182cffc6f2d45415574bc9
3
+ metadata.gz: 534d8093e331f6d7cdb1267d9daeb07028ea429c
4
+ data.tar.gz: 113173c876354894d06d02e5bb87e8860ef12021
5
5
  SHA512:
6
- metadata.gz: 60207418ff9b7fd8d73e5f566dca07f0f1abb2b906d28a73785d629d4bc05ab1958dd0036148720738a663f11936b4f0f094a5719a77e3293e2c007434f882f0
7
- data.tar.gz: 8beddddc6d2bb71cd29247e1e9bdf7c4d326cd276531950e3875e17239011a88e095754af3512a69e5c0c3d94fdafa8ad13440eb2e35e114d55f62c7b3f210ce
6
+ metadata.gz: bf4801b32d5b067c2a5a17d366070a1dbaf111d6a7a92c5351f4bfbed898c42bd687a8e4b2884241b110d49228c8f05a918b12f53522b54ea23ffbb2f3c9414f
7
+ data.tar.gz: 20d1e90a20b62a30d3e5748add97a1fc8b7209a7b81d382d57fa7fc74dd2b5c0693f8493749f497d87af1c0ea0fadd8b552609dc60db55fa5a1e805e559dbbca
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.8.0 (2015-02-27)
2
+ - Add `max_upload_file_size` option to configuration
3
+ - Disable selection of files that are larger than `max_upload_file_size`
4
+
1
5
  ### 0.7.1 (2014-12-23)
2
6
  - Rails 4.2 support
3
7
 
@@ -1,11 +1,27 @@
1
1
  <% unless file.relative_parent_path? %>
2
+
3
+ <% if file.container? || provider.config[:max_upload_file_size].blank? #never disable a folder or if no maximum is set
4
+ disabled = false
5
+ else
6
+ max_size = provider.config[:max_upload_file_size].to_i
7
+ disabled = file.size > max_size
8
+ end
9
+ %>
10
+
2
11
  <tr role="row" tabindex="-1" data-ev-location="<%= file.location %>" data-tt-id="<%=path%>" data-tt-parent-id="<%=parent%>" data-tt-branch="<%=file.container? ? 'true' : 'false'%>">
3
12
  <td role="gridcell" class="<%=file.container? ? 'ev-container' : 'ev-file'%> ev-file-name">
4
- <%= link_to browse_everything_engine.contents_path(provider_name,file.id), {:class=>'ev-link'} do %>
13
+ <% if disabled %>
14
+ <span title="<%= t('browse_everything.size_disabled', max_size: number_to_human_size(max_size)) %>"class="<%=file.container? ? 'folder' : 'file'%>" aria-hidden="true">
15
+ <%= file.name %>
16
+ </span>
17
+ <span class="sr-only"><%= file.container? ? ', folder' : ', file' %> </span>
18
+ <% else %>
19
+ <%= link_to browse_everything_engine.contents_path(provider_name,file.id), :class=>'ev-link' do %>
5
20
  <span class="<%=file.container? ? 'folder' : 'file'%>" aria-hidden="true"/>
6
21
  <%= file.name %>
7
22
  <span class="sr-only"><%= file.container? ? ', folder' : ', file' %> </span>
8
23
  <% end %>
24
+ <% end %>
9
25
  </td>
10
26
  <td role="gridcell" class="ev-file-size">
11
27
  <%= number_to_human_size(file.size).sub(/Bytes/,'bytes') %>
@@ -11,3 +11,4 @@ en:
11
11
  modal_form:
12
12
  submit: "Submit"
13
13
  cancel: "Cancel"
14
+ size_disabled: "This file can not be uploaded, since it is larger than the maximum file size %{max_size}"
@@ -1,3 +1,3 @@
1
1
  module BrowseEverything
2
- VERSION = "0.7.1"
2
+ VERSION = "0.8.0"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require File.expand_path("config/environment", ENV['RAILS_ROOT'] || File.expand_path("../internal", __FILE__))
2
2
  require 'rspec'
3
+ require 'rspec/rails'
3
4
  require 'rspec/its'
4
5
  require 'webmock/rspec'
5
6
  require 'simplecov'
@@ -0,0 +1,46 @@
1
+ require File.expand_path('../../../spec_helper',__FILE__)
2
+
3
+ describe 'browse_everything/_file.html.erb', type: :view do
4
+
5
+ let(:file) {
6
+ BrowseEverything::FileEntry.new(
7
+ 'file_id_01234', 'my_provider:/location/pa/th/file.m4v',
8
+ 'file.m4v', 1024*1024*1024, Time.now, false
9
+ )
10
+ }
11
+ let(:provider) { double("provider") }
12
+ let(:page) { Capybara::Node::Simple.new(rendered) }
13
+
14
+
15
+ before do
16
+ allow(view).to receive(:file).and_return(file)
17
+ allow(view).to receive(:provider).and_return(provider)
18
+ allow(view).to receive(:path).and_return("path")
19
+ allow(view).to receive(:parent).and_return("parent")
20
+ allow(view).to receive(:provider_name).and_return("my provider")
21
+ allow(provider).to receive(:config).and_return(config)
22
+ render
23
+ end
24
+
25
+ context "file not too big" do
26
+ let(:config) { { max_upload_file_size: (5*1024*1024*1024) } }
27
+ it "should draw link" do
28
+ expect(page).to have_selector("a.ev-link")
29
+ end
30
+ end
31
+
32
+ context "max not configured" do
33
+ let(:config) { { } }
34
+ it "should draw link" do
35
+ expect(page).to have_selector("a.ev-link")
36
+ end
37
+ end
38
+
39
+ context "file too big" do
40
+ let(:config) { { max_upload_file_size: 1024 } }
41
+ it "should draw link" do
42
+ expect(page).not_to have_selector("a.ev-link")
43
+ end
44
+ end
45
+
46
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browse-everything
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carolyn Cole
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2014-12-23 00:00:00.000000000 Z
16
+ date: 2015-02-27 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rails
@@ -360,7 +360,7 @@ files:
360
360
  - app/.DS_Store
361
361
  - app/assets/javascripts/browse_everything.js
362
362
  - app/assets/javascripts/browse_everything/behavior.js.coffee
363
- - app/assets/stylesheets/browse_everything.css.scss
363
+ - app/assets/stylesheets/browse_everything.scss
364
364
  - app/assets/stylesheets/jquery.treetable.theme.browse.css
365
365
  - app/controllers/browse_everything_controller.rb
366
366
  - app/helpers/bootstrap_version_helper.rb
@@ -401,7 +401,6 @@ files:
401
401
  - spec/fixtures/vcr_cassettes/dropbox.yml
402
402
  - spec/fixtures/vcr_cassettes/retriever.yml
403
403
  - spec/spec_helper.rb
404
- - spec/spec_helper.rb.orig
405
404
  - spec/support/app/controllers/file_handler_controller.rb
406
405
  - spec/support/app/views/file_handler/index.html.erb
407
406
  - spec/support/app/views/file_handler/main.html.erb
@@ -414,6 +413,7 @@ files:
414
413
  - spec/unit/file_system_spec.rb
415
414
  - spec/unit/retriever_spec.rb
416
415
  - spec/unit/sky_drive_spec.rb
416
+ - spec/views/browse_everything/_file.html.erb_spec.rb
417
417
  - tasks/ci.rake
418
418
  - vendor/assets/javascripts/jquery.treetable.js
419
419
  - vendor/assets/stylesheets/jquery.treetable.css
@@ -451,7 +451,6 @@ test_files:
451
451
  - spec/fixtures/vcr_cassettes/dropbox.yml
452
452
  - spec/fixtures/vcr_cassettes/retriever.yml
453
453
  - spec/spec_helper.rb
454
- - spec/spec_helper.rb.orig
455
454
  - spec/support/app/controllers/file_handler_controller.rb
456
455
  - spec/support/app/views/file_handler/index.html.erb
457
456
  - spec/support/app/views/file_handler/main.html.erb
@@ -464,4 +463,4 @@ test_files:
464
463
  - spec/unit/file_system_spec.rb
465
464
  - spec/unit/retriever_spec.rb
466
465
  - spec/unit/sky_drive_spec.rb
467
- has_rdoc:
466
+ - spec/views/browse_everything/_file.html.erb_spec.rb
@@ -1,47 +0,0 @@
1
- require File.expand_path("config/environment", ENV['RAILS_ROOT'] || File.expand_path("../internal", __FILE__))
2
- <<<<<<< HEAD
3
- require 'rspec/rails'
4
- require 'webmock/rspec'
5
- =======
6
- require 'simplecov'
7
- SimpleCov.start do
8
- add_filter "/spec/"
9
- end
10
-
11
- module BrowserConfigHelper
12
- def url_options
13
- {
14
- protocol: 'http://',
15
- host: 'browse-everything.example.edu'
16
- }
17
- end
18
-
19
- def stub_configuration
20
- BrowseEverything.configure({
21
- "file_system" => {
22
- home: File.expand_path('../fixtures/file_system',__FILE__)
23
- },
24
- "box" => {
25
- client_id: "BoxClientId",
26
- client_secret: "BoxClientSecret"
27
- },
28
- "drop_box" => {
29
- app_key: "DropBoxAppKey",
30
- app_secret: "DropBoxAppSecret"
31
- },
32
- "google_drive" => {
33
- client_id: "GoogleClientId",
34
- client_secret: "GoogleClientSecret"
35
- },
36
- "sky_drive" => {
37
- client_id: "SkyDriveClientId",
38
- client_secret: "SkyDriveClientSecret"
39
- }
40
- })
41
- end
42
-
43
- def unstub_configuration
44
- BrowseEverything.configure(nil)
45
- end
46
- end
47
- >>>>>>> Add coverage and configuration stubs