Skip to content

Commit

Permalink
Merge 167a40a into 78507ae
Browse files Browse the repository at this point in the history
  • Loading branch information
hackartisan committed Sep 7, 2017
2 parents 78507ae + 167a40a commit 6d6bdd8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/uploaders/sufia/avatar_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Sufia::AvatarUploader < CarrierWave::Uploader::Base
process resize_to_limit: [100, 100]
end

def extension_white_list
def extension_whitelist
%w(jpg jpeg png gif bmp tif tiff)
end
end
8 changes: 4 additions & 4 deletions app/uploaders/sufia/uploaded_file_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ class UploadedFileUploader < CarrierWave::Uploader::Base
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
base_path + "#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
configured_upload_path + "#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end

def cache_dir
cache_path + "#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
configured_cache_path + "#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end

private

def base_path
def configured_upload_path
Sufia.config.upload_path.call
end

def cache_path
def configured_cache_path
Sufia.config.cache_path.call
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/uploaders/tinymce_asset_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def store_dir

# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
# def extension_white_list
# def extension_whitelist
# %w(jpg jpeg gif png)
# end

Expand Down
6 changes: 6 additions & 0 deletions config/locales/sufia.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -531,3 +531,9 @@ en:
create: 'Add'
create: 'Save'
update: 'Save'
errors:
messages:
carrierwave_processing_error: "Cannot resize image."
carrierwave_integrity_error: "Not an image."
carrierwave_download_error: "Couldn't download image."
extension_whitelist_error: "You are not allowed to upload %{extension} files, allowed types: %{allowed_types}"
4 changes: 3 additions & 1 deletion spec/views/sufia/admin/admin_sets/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@
let(:solr_doc) { SolrDocument.new(admin_set.to_solr) }
let(:admin_sets) { [solr_doc] }
let(:presenter_class) { Sufia::AdminSetPresenter }
let(:presenter) { instance_double(presenter_class, total_items: 99) }
let(:ability) { instance_double("Ability") }
before do
allow(controller).to receive(:current_ability).and_return(ability)
allow(controller).to receive(:presenter_class).and_return(presenter_class)
allow(presenter_class).to receive(:new).and_return(presenter)
assign(:admin_sets, admin_sets)
end
it "lists admin set" do
render
expect(rendered).to have_content('Example Admin Set')
expect(rendered).to have_content('jdoe@example.com')
expect(rendered).to have_css("td", text: /^0$/)
expect(rendered).to have_css("td", text: /^99$/)
end
end
end
2 changes: 1 addition & 1 deletion sufia.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'json-schema'
spec.add_dependency 'nest', '~> 2.0'
spec.add_dependency 'mailboxer', '~> 0.12'
spec.add_dependency 'carrierwave', '~> 0.9'
spec.add_dependency 'carrierwave', '~> 1.0'
spec.add_dependency 'oauth'
spec.add_dependency 'oauth2', '~> 1.2'
spec.add_dependency 'signet'
Expand Down

0 comments on commit 6d6bdd8

Please sign in to comment.