refinerycms-resources 2.0.10 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bbae7040b6b5a8a157a30e87ecf120c2d8f2f76
4
- data.tar.gz: ad53f0118bf9c83996504cbd615583cc4086f0ac
3
+ metadata.gz: dadf5449e1ace4d6ed915d01f3b44b16a9c82852
4
+ data.tar.gz: cb9f0e23cd5ce7cb3c9f85a49fd87651b4e0b288
5
5
  SHA512:
6
- metadata.gz: 11717491a83593f2d26ec90f0e33baf698ef8983412396d32af296412e2006590942139973a15502a3ac6ca092024b12a6d3439ce59b71d96a6eb28870fd1b1c
7
- data.tar.gz: 944174054ca9a3579436aedd88cedc653fc36e63e56e93486c71b7f6e8e0a2dcddada209843630a1679bacd60edcd73ec2d5e1c1c2ab47a862ae07f52b8c44e1
6
+ metadata.gz: 0d1236dcf3bec03856376b3ea671e151063692984777c390f814fd5a56f5355494aab2dfcd68daa216c478f8dce596fa6e330ca16cc0eacd29fbfeffe7432ae8
7
+ data.tar.gz: 7d5a8d458f9f88bab350b140c012f406c9a47a571abd344f51168f2cb70f775fc7f4bc1cd2739e0c0cc0e76535d4a798bcaa363a280180651d1ba220ab26b74b
@@ -21,11 +21,11 @@ module Refinery
21
21
  unless params[:insert]
22
22
  if @resources.all?(&:valid?)
23
23
  flash.notice = t('created', :scope => 'refinery.crudify', :what => "'#{@resources.map(&:title).join("', '")}'")
24
- unless from_dialog?
25
- redirect_to refinery.admin_resources_path
26
- else
24
+ if from_dialog?
27
25
  @dialog_successful = true
28
26
  render :nothing => true, :layout => true
27
+ else
28
+ redirect_to refinery.admin_resources_path
29
29
  end
30
30
  else
31
31
  self.new # important for dialogs
@@ -52,7 +52,7 @@ module Refinery
52
52
  extra_condition[1] = true if extra_condition[1] == "true"
53
53
  extra_condition[1] = false if extra_condition[1] == "false"
54
54
  extra_condition[1] = nil if extra_condition[1] == "nil"
55
- paginate_resources({extra_condition[0].to_sym => extra_condition[1]})
55
+ paginate_resources({extra_condition[0] => extra_condition[1]})
56
56
  else
57
57
  paginate_resources
58
58
  end
@@ -13,9 +13,6 @@ module Refinery
13
13
  validates :file, :presence => true
14
14
  validates_with FileSizeValidator
15
15
 
16
- # Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
17
- acts_as_indexed :fields => [:file_name, :title, :type_of_content]
18
-
19
16
  delegate :ext, :size, :mime_type, :url, :to => :file
20
17
 
21
18
  # used for searching
@@ -42,7 +39,7 @@ module Refinery
42
39
  resources << create(params)
43
40
  else
44
41
  params[:file].each do |resource|
45
- resources << create(:file => resource)
42
+ resources << create({:file => resource}.merge(params.except(:file)))
46
43
  end
47
44
  end
48
45
 
@@ -1,6 +1,4 @@
1
- <% if searching? %>
2
- <h2><%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %></h2>
3
- <% end %>
1
+ <%= render 'refinery/admin/search_header', :url => refinery.admin_resources_path %>
4
2
  <div class="pagination_container">
5
3
  <% if @resources.any? %>
6
4
  <%= render 'resources' %>
@@ -50,4 +50,4 @@
50
50
  resource_picker.init(<%= @callback.present? ? "self.parent.#{@callback}" : 'null' %>);
51
51
  });
52
52
  </script>
53
- <% end %>
53
+ <% end %>
@@ -0,0 +1,36 @@
1
+ hu:
2
+ refinery:
3
+ plugins:
4
+ refinery_files:
5
+ title: Fájlok
6
+ description: Fájlok feltöltésének kezelése
7
+ admin:
8
+ resources:
9
+ delete: Fájl végleges eltávolítása
10
+ edit: Fájl szerkesztése
11
+ form:
12
+ download_current: Jelenlegi fájl letöltése
13
+ or: vagy
14
+ replace: " lecserélése a következőre..."
15
+ maximum_file_size: 'A maximum fájl méret: %{bytes}.'
16
+ resource:
17
+ download: Fájl letöltése (%{size})
18
+ actions:
19
+ upload_new: Új fájl feltöltése
20
+ records:
21
+ no_files_yet: 'Még nincsenek fájlok. Kattints az "Új fájl feltöltése"-re, hogy hozzáadd az elsőt.'
22
+ insert:
23
+ existing: Létező Fájl
24
+ new: Új Fájl
25
+ no_files: Nincsenek fájlok.
26
+ existing_resource:
27
+ link_to_file: Link erre a fájlra
28
+ button_text: Beszúrás
29
+ activerecord:
30
+ models:
31
+ refinery/resource: fájl
32
+ errors:
33
+ models:
34
+ refinery/resource:
35
+ blank: Meg kell adnod egy feltöltendő fájlt
36
+ too_big: 'A fájlnak kisebbnek kell lennie mint %{size} bájt'
@@ -3,25 +3,26 @@ nl:
3
3
  plugins:
4
4
  refinery_files:
5
5
  title: Bestanden
6
+ description: Bestanden beheren
6
7
  admin:
7
8
  resources:
8
- delete: Verwijder dit bestand voorgoed
9
- edit: Bewerk dit bestand
9
+ delete: Dit bestand definitief verwijderen
10
+ edit: Dit bestand bewerken
10
11
  form:
11
- download_current: Download het huidige bestand
12
+ download_current: Het huidige bestand downloaden
12
13
  or: of
13
- replace: ", vervang het door dit..."
14
- maximum_file_size: "The maximum file size is %{bytes}."
14
+ replace: " vervangen door dit bestand..."
15
+ maximum_file_size: De maximale bestandsgrootte is %{bytes}.
15
16
  resource:
16
- download: Download dit bestand (%{size})
17
+ download: Dit bestand downloaden (%{size})
17
18
  actions:
18
- upload_new: Upload een nieuw bestand.
19
+ upload_new: Nieuw bestand uploaden
19
20
  records:
20
- no_files_yet: Er zijn nog geen bestanden. Klik op "Upload een nieuw bestand" om uw eerste bestand toe te voegen.
21
+ no_files_yet: Er zijn nog geen bestanden. Klik op "Nieuw bestand uploaden" om uw eerste bestand toe te voegen.
21
22
  insert:
22
23
  existing: Bestaand bestand
23
24
  new: Nieuw bestand
24
- no_files: Er zijn geen bestanden
25
+ no_files: Er zijn geen bestanden.
25
26
  existing_resource:
26
27
  link_to_file: Link naar dit bestand
27
28
  button_text: Invoegen
@@ -31,5 +32,5 @@ nl:
31
32
  errors:
32
33
  models:
33
34
  refinery/resource:
34
- blank: U moet een bestand kiezen dat u wilt uploaden.
35
- too_big: Bestanden mogen niet groter dan %{size} bytes zijn.
35
+ blank: U moet een bestand kiezen om te uploaden
36
+ too_big: Bestanden mogen niet groter dan %{size} bytes zijn
@@ -0,0 +1,36 @@
1
+ pt:
2
+ refinery:
3
+ plugins:
4
+ refinery_files:
5
+ title: Ficheiros
6
+ description: Carregar ficheiros
7
+ admin:
8
+ resources:
9
+ delete: Apagar ficheiro definitivamente
10
+ edit: Editar este ficheiro
11
+ form:
12
+ download_current: Download ficheiro actual
13
+ or: ou
14
+ replace: " substituir por..."
15
+ maximum_file_size: O tamanho máximo é %{bytes}.
16
+ resource:
17
+ download: Download deste ficheiro (%{size})
18
+ actions:
19
+ upload_new: Carregar novo ficheiro
20
+ records:
21
+ no_files_yet: Não existem ficheiros ainda. Clique em "Carregar novo ficheiro" para adicionar o primeiro.
22
+ insert:
23
+ existing: Ficheiros existentes
24
+ new: Novo ficheiro
25
+ no_files: Não existem ficheiros.
26
+ existing_resource:
27
+ link_to_file: Link para este ficheiro
28
+ button_text: Inserir
29
+ activerecord:
30
+ models:
31
+ refinery/resource: ficheiro
32
+ errors:
33
+ models:
34
+ refinery/resource:
35
+ blank: É necessário You must especificar um ficheiro para carregar
36
+ too_big: O ficheiro precisa de ser mais pequeno que %{size} bytes de tamanho
@@ -0,0 +1,36 @@
1
+ tr:
2
+ refinery:
3
+ plugins:
4
+ refinery_files:
5
+ title: Dosyalar
6
+ description: Bir baglanti ve dosya yukle
7
+ admin:
8
+ resources:
9
+ delete: Bunu sonsuza dek sil
10
+ edit: Bu dosyayi duzenle
11
+ form:
12
+ download_current: Guncel dosyayi indir
13
+ or: or
14
+ replace: " bunu sununla degistir..."
15
+ maximum_file_size: "Maksimum dosya boyutu %{bytes}."
16
+ resource:
17
+ download: "Bu dosyayi indir (%{size})"
18
+ actions:
19
+ upload_new: Yeni Dosya Yukle
20
+ records:
21
+ no_files_yet: Henuz bir dosya yok. "Yeni Dosya Yukle" ye tiklayarak ilk dosyanizi ekleyin.
22
+ insert:
23
+ existing: Varolan Dosya
24
+ new: Yeni Dosya
25
+ no_files: Henuz bir dosya mevcut degil
26
+ existing_resource:
27
+ link_to_file: Bunu dosyaya baglanti yap
28
+ button_text: Cikart
29
+ activerecord:
30
+ models:
31
+ refinery/resource: "file"
32
+ errors:
33
+ models:
34
+ refinery/resource:
35
+ blank: Yukleme islemi icin bir dosya belirtmelisiniz
36
+ too_big: "Dosya %{size} den daha kucuk olmak zorunda"
@@ -0,0 +1,37 @@
1
+ uk:
2
+ refinery:
3
+ plugins:
4
+ refinery_files:
5
+ title: Файли
6
+ description: Завантажнння і створення посилань на файли
7
+ article: masculine
8
+ admin:
9
+ resources:
10
+ delete: Видалити цей файл назавжди
11
+ edit: Редагувати цей файл
12
+ form:
13
+ download_current: Завантажити поточний файл
14
+ or: або
15
+ replace: " замінити його цим"
16
+ maximum_file_size: "Максимальний розмір файлу — %{bytes}."
17
+ resource:
18
+ download: "Завантажити файл (%{size})"
19
+ actions:
20
+ upload_new: Завантажити новий файл
21
+ records:
22
+ no_files_yet: "Тут поки немає файлів. Натисніть «Завантажити нові файли», щоб додати перший файл."
23
+ insert:
24
+ existing: Існуючий файл
25
+ new: Новий файл
26
+ no_files: Немає файлів.
27
+ existing_resource:
28
+ link_to_file: Послатися на цей файл
29
+ button_text: Вставити
30
+ activerecord:
31
+ models:
32
+ refinery/resource: файл
33
+ errors:
34
+ models:
35
+ refinery/resource:
36
+ blank: Ви повинні вибрати файл для завантаження
37
+ too_big: "Розмір файлу повинен бути меншим за %{size} МБ"
@@ -3,7 +3,7 @@ zh-CN:
3
3
  plugins:
4
4
  refinery_files:
5
5
  title: 文件
6
- description: 上传与连接文件
6
+ description: 上传并链接文件
7
7
  admin:
8
8
  resources:
9
9
  delete: 永久删除此文件
@@ -24,7 +24,7 @@ zh-CN:
24
24
  new: 新文件
25
25
  no_files: 没有文件.
26
26
  existing_resource:
27
- link_to_file: 连接到此文件
27
+ link_to_file: 链接到此文件
28
28
  button_text: 插入
29
29
  activerecord:
30
30
  models:
data/config/routes.rb CHANGED
@@ -1,7 +1,7 @@
1
- Refinery::Core::Engine.routes.prepend do
2
- match '/system/resources/*dragonfly', :to => Dragonfly[:refinery_resources]
1
+ Refinery::Core::Engine.routes.draw do
2
+ get '/system/resources/*dragonfly', :to => Dragonfly[:refinery_resources]
3
3
 
4
- namespace :admin, :path => 'refinery' do
4
+ namespace :admin, :path => Refinery::Core.backend_route do
5
5
  resources :resources, :except => :show do
6
6
  get :insert, :on => :collection
7
7
  end
@@ -15,13 +15,20 @@ Refinery::Resources.configure do |config|
15
15
  # config.s3_bucket_name = ENV['S3_BUCKET']
16
16
  # config.s3_access_key_id = ENV['S3_KEY']
17
17
  # config.s3_secret_access_key = ENV['S3_SECRET']
18
- # config.s3_region = ENV['S3_REGION]
18
+ # config.s3_region = ENV['S3_REGION']
19
19
 
20
20
  # Configure Dragonfly
21
21
  # This is where in the middleware stack to insert the Dragonfly middleware
22
22
  # config.dragonfly_insert_before = <%= Refinery::Resources.dragonfly_insert_before.inspect %>
23
23
  # config.dragonfly_secret = <%= Refinery::Resources.dragonfly_secret.inspect %>
24
24
  # config.dragonfly_url_format = <%= Refinery::Resources.dragonfly_url_format.inspect %>
25
+ # config.dragonfly_url_host = <%= Refinery::Resources.dragonfly_url_host.inspect %>
25
26
  # config.datastore_root_path = <%= Refinery::Resources.datastore_root_path.inspect %>
27
+ # config.content_disposition = <%= Refinery::Resources.content_disposition.inspect %>
28
+
29
+ # Configure Dragonfly custom storage backend
30
+ # The custom_backend setting by default defers to the core setting for this but can be set just for resources.
31
+ # config.custom_backend_class = <%= Refinery::Resources.custom_backend_class.inspect %>
32
+ # config.custom_backend_opts = <%= Refinery::Resources.custom_backend_opts.inspect %>
26
33
 
27
34
  end
@@ -2,16 +2,19 @@ module Refinery
2
2
  module Resources
3
3
  include ActiveSupport::Configurable
4
4
 
5
- config_accessor :dragonfly_insert_before, :dragonfly_secret, :dragonfly_url_format,
5
+ config_accessor :dragonfly_insert_before, :dragonfly_secret, :dragonfly_url_format, :dragonfly_url_host,
6
6
  :max_file_size, :pages_per_dialog, :pages_per_admin_index,
7
7
  :s3_backend, :s3_bucket_name, :s3_region,
8
8
  :s3_access_key_id, :s3_secret_access_key,
9
- :datastore_root_path
9
+ :datastore_root_path, :content_disposition,
10
+ :custom_backend_class, :custom_backend_opts
10
11
 
11
12
  self.dragonfly_insert_before = 'ActionDispatch::Callbacks'
12
- self.dragonfly_secret = Refinery::Core.dragonfly_secret
13
+ self.dragonfly_secret = Core.dragonfly_secret
13
14
  self.dragonfly_url_format = '/system/resources/:job/:basename.:format'
15
+ self.dragonfly_url_host = ''
14
16
 
17
+ self.content_disposition = :attachment
15
18
  self.max_file_size = 52428800
16
19
  self.pages_per_dialog = 12
17
20
  self.pages_per_admin_index = 20
@@ -24,23 +27,35 @@ module Refinery
24
27
  end
25
28
 
26
29
  def s3_backend
27
- config.s3_backend.nil? ? Refinery::Core.s3_backend : config.s3_backend
30
+ config.s3_backend.nil? ? Core.s3_backend : config.s3_backend
28
31
  end
29
32
 
30
33
  def s3_bucket_name
31
- config.s3_bucket_name.nil? ? Refinery::Core.s3_bucket_name : config.s3_bucket_name
34
+ config.s3_bucket_name.presence || Core.s3_bucket_name
32
35
  end
33
36
 
34
37
  def s3_access_key_id
35
- config.s3_access_key_id.nil? ? Refinery::Core.s3_access_key_id : config.s3_access_key_id
38
+ config.s3_access_key_id.presence || Core.s3_access_key_id
36
39
  end
37
40
 
38
41
  def s3_secret_access_key
39
- config.s3_secret_access_key.nil? ? Refinery::Core.s3_secret_access_key : config.s3_secret_access_key
42
+ config.s3_secret_access_key.presence || Core.s3_secret_access_key
40
43
  end
41
44
 
42
45
  def s3_region
43
- config.s3_region.nil? ? Refinery::Core.s3_region : config.s3_region
46
+ config.s3_region.presence || Core.s3_region
47
+ end
48
+
49
+ def custom_backend?
50
+ config.custom_backend_class.nil? ? Core.dragonfly_custom_backend? : config.custom_backend_class.present?
51
+ end
52
+
53
+ def custom_backend_class
54
+ config.custom_backend_class.nil? ? Core.dragonfly_custom_backend_class : config.custom_backend_class.constantize
55
+ end
56
+
57
+ def custom_backend_opts
58
+ config.custom_backend_opts.presence || Core.dragonfly_custom_backend_opts
44
59
  end
45
60
 
46
61
  end
@@ -11,14 +11,16 @@ module Refinery
11
11
  app_resources.define_macro(::Refinery::Resource, :resource_accessor)
12
12
 
13
13
  app_resources.analyser.register(::Dragonfly::Analysis::FileCommandAnalyser)
14
- app_resources.content_disposition = :attachment
14
+ app_resources.content_disposition = Refinery::Resources.content_disposition
15
15
  end
16
16
 
17
17
  def configure!
18
18
  app_resources = ::Dragonfly[:refinery_resources]
19
- app_resources.configure_with(:rails) do |c|
19
+ app_resources.configure_with(:rails)
20
+ app_resources.configure do |c|
20
21
  c.datastore.root_path = Refinery::Resources.datastore_root_path
21
22
  c.url_format = Refinery::Resources.dragonfly_url_format
23
+ c.url_host = Refinery::Resources.dragonfly_url_host
22
24
  c.secret = Refinery::Resources.dragonfly_secret
23
25
  end
24
26
 
@@ -32,18 +34,20 @@ module Refinery
32
34
  s3.region = Refinery::Resources.s3_region if Refinery::Resources.s3_region
33
35
  end
34
36
  end
37
+
38
+ if Resources.custom_backend?
39
+ app_resources.datastore = Resources.custom_backend_class.new(Resources.custom_backend_opts)
40
+ end
35
41
  end
36
42
 
43
+ ##
44
+ # Injects Dragonfly::Middleware for Refinery::Images into the stack
37
45
  def attach!(app)
38
- ### Extend active record ###
39
- app.config.middleware.insert_before Refinery::Resources.dragonfly_insert_before,
40
- 'Dragonfly::Middleware', :refinery_resources
41
-
42
- app.config.middleware.insert_before 'Dragonfly::Middleware', 'Rack::Cache', {
43
- :verbose => Rails.env.development?,
44
- :metastore => "file:#{URI.encode(Rails.root.join('tmp', 'dragonfly', 'cache', 'meta').to_s)}",
45
- :entitystore => "file:#{URI.encode(Rails.root.join('tmp', 'dragonfly', 'cache', 'body').to_s)}"
46
- }
46
+ if ::Rails.application.config.action_controller.perform_caching
47
+ app.config.middleware.insert_after 'Rack::Cache', 'Dragonfly::Middleware', :refinery_resources
48
+ else
49
+ app.config.middleware.use 'Dragonfly::Middleware', :refinery_resources
50
+ end
47
51
  end
48
52
  end
49
53
 
@@ -1,7 +1,7 @@
1
1
  module Refinery
2
2
  module Resources
3
3
  class Engine < ::Rails::Engine
4
- include Refinery::Engine
4
+ extend Refinery::Engine
5
5
 
6
6
  isolate_namespace Refinery
7
7
  engine_name :refinery_resources
@@ -18,7 +18,6 @@ module Refinery
18
18
  plugin.pathname = root
19
19
  plugin.name = 'refinery_files'
20
20
  plugin.menu_match = /refinery\/(refinery_)?(files|resources)$/
21
- plugin.version = %q{2.0.0}
22
21
  plugin.activity = { :class_name => :'refinery/resource' }
23
22
  plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.admin_resources_path }
24
23
  end
@@ -1,6 +1,5 @@
1
1
  # Encoding: UTF-8
2
- $:.push File.expand_path('../../core/lib', __FILE__)
3
- require 'refinery/version'
2
+ require File.expand_path('../../core/lib/refinery/version', __FILE__)
4
3
 
5
4
  version = Refinery::Version.to_s
6
5
 
@@ -20,7 +19,7 @@ Gem::Specification.new do |s|
20
19
  s.files = `git ls-files`.split("\n")
21
20
  s.test_files = `git ls-files -- spec/*`.split("\n")
22
21
 
23
- s.add_dependency 'dragonfly', '~> 0.9.8'
24
- s.add_dependency 'rack-cache', '>= 0.5.3'
22
+ s.add_dependency 'dragonfly', '~> 0.9.12'
23
+ s.add_dependency 'acts_as_indexed', '~> 0.8.0'
25
24
  s.add_dependency 'refinerycms-core', version
26
25
  end
@@ -4,7 +4,7 @@ require "spec_helper"
4
4
  module Refinery
5
5
  module Admin
6
6
  describe "Resources" do
7
- login_refinery_user
7
+ refinery_login_with :refinery_user
8
8
 
9
9
  context "when no files" do
10
10
  it "invites to upload file" do
@@ -39,10 +39,14 @@ module Refinery
39
39
 
40
40
  describe "max file size" do
41
41
  before do
42
- ::Refinery::Resources.stub(:max_file_size).and_return('1224')
42
+ Refinery::Resources.stub(:max_file_size).and_return('1224')
43
43
  end
44
44
 
45
45
  context "in english" do
46
+ before do
47
+ Refinery::I18n.stub(:current_locale).and_return(:en)
48
+ end
49
+
46
50
  it "is shown" do
47
51
  visit refinery.admin_resources_path
48
52
  click_link "Upload new file"
@@ -52,23 +56,19 @@ module Refinery
52
56
  end
53
57
  end
54
58
  end
59
+
55
60
  context "in danish" do
61
+ before do
62
+ Refinery::I18n.stub(:current_locale).and_return(:da)
63
+ end
64
+
56
65
  it "is shown" do
57
- visit refinery.admin_dashboard_path
58
- within "#other_locales" do
59
- click_link "Dansk"
60
- end
66
+ visit refinery.admin_resources_path
61
67
 
62
- click_link "Filer"
63
68
  click_link "Tilføj en ny fil"
64
69
  within "#maximum_file_size" do
65
70
  page.should have_content "1,2 KB"
66
71
  end
67
-
68
- visit refinery.admin_dashboard_path
69
- within "#other_locales" do
70
- click_link "English"
71
- end
72
72
  end
73
73
  end
74
74
  end
@@ -125,6 +125,7 @@ module Refinery
125
125
  Rails.application.routes.draw do
126
126
  mount Refinery::Core::Engine, :at => "/about"
127
127
  end
128
+ Rails.application.routes_reloader.reload!
128
129
  end
129
130
 
130
131
  after do
@@ -0,0 +1,41 @@
1
+ require "spec_helper"
2
+
3
+ describe Refinery::Resources do
4
+ describe "with custom s3 settings" do
5
+ it "prefers custom values over the default" do
6
+ Refinery::Core.s3_bucket_name = "kfc"
7
+ described_class.s3_bucket_name = "buckethead"
8
+
9
+ described_class.s3_bucket_name.should == "buckethead"
10
+ end
11
+ end
12
+
13
+ describe "without custom s3 settings" do
14
+ it "falls back on defaults" do
15
+ described_class.s3_bucket_name = nil
16
+ Refinery::Core.s3_bucket_name = "kfc"
17
+
18
+ described_class.s3_bucket_name.should == "kfc"
19
+ end
20
+ end
21
+
22
+ describe "with a custom storage backend" do
23
+ before do
24
+ Refinery::Core.dragonfly_custom_backend_class = 'DummyBackend1'
25
+ class DummyBackend1; end
26
+ class DummyBackend2; end
27
+ end
28
+ after { Refinery::Core.dragonfly_custom_backend_class = nil }
29
+ let(:backend1) { DummyBackend1.new }
30
+ let(:backend2) { DummyBackend2.new }
31
+
32
+ it "uses the default configuration if present" do
33
+ described_class.custom_backend_class.should == backend1.class
34
+ end
35
+
36
+ it "prefers custom values over the defaults" do
37
+ described_class.custom_backend_class = 'DummyBackend2'
38
+ described_class.custom_backend_class.should == backend2.class
39
+ end
40
+ end
41
+ end
@@ -70,6 +70,13 @@ module Refinery
70
70
  r.should be_an_instance_of(Resource)
71
71
  end
72
72
  end
73
+
74
+ specify "each returned array item should be passed form parameters" do
75
+ params = {:file => [file, file, file], :fake_param => 'blah'}
76
+
77
+ Resource.should_receive(:create).exactly(3).times.with({:file => file, :fake_param => 'blah'})
78
+ Resource.create_resources(params)
79
+ end
73
80
  end
74
81
 
75
82
  describe "validations" do
@@ -98,7 +105,10 @@ module Refinery
98
105
  it "should contain an error message" do
99
106
  @resource.valid?
100
107
  @resource.errors.should_not be_empty
101
- @resource.errors[:file].should == ["File should be smaller than #{Resources.max_file_size} bytes in size"]
108
+ @resource.errors[:file].should == Array(::I18n.t(
109
+ 'too_big', :scope => 'activerecord.errors.models.refinery/resource',
110
+ :size => Resources.max_file_size
111
+ ))
102
112
  end
103
113
  end
104
114
 
@@ -110,7 +120,9 @@ module Refinery
110
120
  it "has an error message" do
111
121
  @resource.valid?
112
122
  @resource.errors.should_not be_empty
113
- @resource.errors[:file].should == ["You must specify file for upload"]
123
+ @resource.errors[:file].should == Array(::I18n.t(
124
+ 'blank', :scope => 'activerecord.errors.models.refinery/resource'
125
+ ))
114
126
  end
115
127
  end
116
128
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.10
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Arndt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-14 00:00:00.000000000 Z
13
+ date: 2013-08-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: dragonfly
@@ -18,42 +18,42 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.9.8
21
+ version: 0.9.12
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ~>
27
27
  - !ruby/object:Gem::Version
28
- version: 0.9.8
28
+ version: 0.9.12
29
29
  - !ruby/object:Gem::Dependency
30
- name: rack-cache
30
+ name: acts_as_indexed
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - ~>
34
34
  - !ruby/object:Gem::Version
35
- version: 0.5.3
35
+ version: 0.8.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ~>
41
41
  - !ruby/object:Gem::Version
42
- version: 0.5.3
42
+ version: 0.8.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: refinerycms-core
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 2.0.10
49
+ version: 2.1.0
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 2.0.10
56
+ version: 2.1.0
57
57
  description: Handles all file upload and processing functionality in Refinery CMS.
58
58
  email: info@refinerycms.com
59
59
  executables: []
@@ -82,6 +82,7 @@ files:
82
82
  - config/locales/es.yml
83
83
  - config/locales/fi.yml
84
84
  - config/locales/fr.yml
85
+ - config/locales/hu.yml
85
86
  - config/locales/it.yml
86
87
  - config/locales/ja.yml
87
88
  - config/locales/ko.yml
@@ -91,11 +92,14 @@ files:
91
92
  - config/locales/nl.yml
92
93
  - config/locales/pl.yml
93
94
  - config/locales/pt-BR.yml
95
+ - config/locales/pt.yml
94
96
  - config/locales/rs.yml
95
97
  - config/locales/ru.yml
96
98
  - config/locales/sk.yml
97
99
  - config/locales/sl.yml
98
100
  - config/locales/sv.yml
101
+ - config/locales/tr.yml
102
+ - config/locales/uk.yml
99
103
  - config/locales/vi.yml
100
104
  - config/locales/zh-CN.yml
101
105
  - config/locales/zh-TW.yml
@@ -113,11 +117,12 @@ files:
113
117
  - license.md
114
118
  - refinerycms-resources.gemspec
115
119
  - spec/factories/resource.rb
120
+ - spec/features/refinery/admin/resources_spec.rb
116
121
  - spec/fixtures/refinery_is_awesome.txt
117
122
  - spec/fixtures/refinery_is_awesome2.txt
118
123
  - spec/lib/generators/refinery/resources/resources_generator_spec.rb
124
+ - spec/lib/resources_spec.rb
119
125
  - spec/models/refinery/resource_spec.rb
120
- - spec/requests/refinery/admin/resources_spec.rb
121
126
  homepage: http://refinerycms.com
122
127
  licenses:
123
128
  - MIT
@@ -144,8 +149,9 @@ specification_version: 4
144
149
  summary: Resources extension for Refinery CMS
145
150
  test_files:
146
151
  - spec/factories/resource.rb
152
+ - spec/features/refinery/admin/resources_spec.rb
147
153
  - spec/fixtures/refinery_is_awesome.txt
148
154
  - spec/fixtures/refinery_is_awesome2.txt
149
155
  - spec/lib/generators/refinery/resources/resources_generator_spec.rb
156
+ - spec/lib/resources_spec.rb
150
157
  - spec/models/refinery/resource_spec.rb
151
- - spec/requests/refinery/admin/resources_spec.rb