brightcontent-attachments 2.0.6 → 2.0.7

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.
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightcontent-attachments (2.0.6)
5
- brightcontent-core (= 2.0.6)
4
+ brightcontent-attachments (2.0.7)
5
+ brightcontent-core (= 2.0.7)
6
6
  jquery-fileupload-rails
7
7
  paperclip
8
8
 
9
9
  PATH
10
10
  remote: ../core
11
11
  specs:
12
- brightcontent-core (2.0.6)
12
+ brightcontent-core (2.0.7)
13
13
  bcrypt-ruby
14
14
  bootstrap-wysihtml5-rails
15
15
  has_scope
@@ -0,0 +1,15 @@
1
+ module Brightcontent
2
+ module Attachable
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ add_brightcontent_column :attachments
7
+ has_many :attachments, as: :attachable, dependent: :destroy, class_name: Brightcontent::Attachment
8
+ end
9
+
10
+ def attachment
11
+ attachments.first
12
+ end
13
+
14
+ end
15
+ end
@@ -5,6 +5,8 @@ require "jquery-fileupload-rails"
5
5
  require "brightcontent/attachments/engine"
6
6
 
7
7
  module Brightcontent
8
+ autoload :Attachable, 'brightcontent/attachable'
9
+
8
10
  module Attachments
9
11
  end
10
12
  end
@@ -1,11 +1,2 @@
1
1
  class Brightcontent::BlogsController < Brightcontent::BaseController
2
- private
3
-
4
- def list_fields
5
- %w{name}
6
- end
7
-
8
- def form_fields
9
- %w{name assets}
10
- end
11
2
  end
@@ -1,4 +1,4 @@
1
1
  class Blog < ActiveRecord::Base
2
2
  attr_accessible :body, :name, :featured
3
- has_many :attachments, as: :attachable, dependent: :destroy, class_name: Brightcontent::Attachment
3
+ include Brightcontent::Attachable
4
4
  end
@@ -13,5 +13,6 @@ feature "Attachments" do
13
13
  sign_in
14
14
  click_link "Blogs"
15
15
  click_link "Edit"
16
+ page.should have_selector "#attachments"
16
17
  end
17
18
  end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ module Brightcontent
4
+ describe Attachable do
5
+ subject { Blog }
6
+ its(:brightcontent_columns) { should include "attachments" }
7
+
8
+ it "should have a has_many relation to attachments" do
9
+ Blog.reflect_on_association(:attachments).macro.should eq :has_many
10
+ end
11
+
12
+ it "should have .attachment method" do
13
+ Blog.new.should respond_to :attachment
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightcontent-attachments
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-27 00:00:00.000000000 Z
12
+ date: 2012-12-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: brightcontent-core
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 2.0.6
21
+ version: 2.0.7
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 2.0.6
29
+ version: 2.0.7
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: paperclip
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -154,12 +154,13 @@ files:
154
154
  - app/controllers/brightcontent/attachments_controller.rb
155
155
  - app/helpers/brightcontent/attachments_helper.rb
156
156
  - app/models/brightcontent/attachment.rb
157
- - app/views/brightcontent/attachments/_form_field.html.erb
158
157
  - app/views/brightcontent/attachments/show.html.erb
158
+ - app/views/brightcontent/base/_form_field_attachments.html.erb
159
159
  - brightcontent-attachments.gemspec
160
160
  - config/routes.rb
161
161
  - db/migrate/20121222172513_create_attachments.rb
162
162
  - lib/brightcontent-attachments.rb
163
+ - lib/brightcontent/attachable.rb
163
164
  - lib/brightcontent/attachments.rb
164
165
  - lib/brightcontent/attachments/engine.rb
165
166
  - lib/generators/brightcontent/attachments/install_generator.rb
@@ -176,7 +177,6 @@ files:
176
177
  - spec/dummy/app/mailers/.gitkeep
177
178
  - spec/dummy/app/models/.gitkeep
178
179
  - spec/dummy/app/models/blog.rb
179
- - spec/dummy/app/views/brightcontent/blogs/_form_field_assets.html.erb
180
180
  - spec/dummy/app/views/layouts/application.html.erb
181
181
  - spec/dummy/config.ru
182
182
  - spec/dummy/config/application.rb
@@ -221,6 +221,7 @@ files:
221
221
  - spec/dummy/script/rails
222
222
  - spec/factories.rb
223
223
  - spec/features/attachments_spec.rb
224
+ - spec/models/brightcontent/attachable_spec.rb
224
225
  - spec/models/brightcontent/attachment_spec.rb
225
226
  - spec/spec_helper.rb
226
227
  - spec/support/acceptance_helper.rb
@@ -238,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
238
239
  version: '0'
239
240
  segments:
240
241
  - 0
241
- hash: -2418983405850187822
242
+ hash: 496967867413148045
242
243
  required_rubygems_version: !ruby/object:Gem::Requirement
243
244
  none: false
244
245
  requirements:
@@ -247,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
248
  version: '0'
248
249
  segments:
249
250
  - 0
250
- hash: -2418983405850187822
251
+ hash: 496967867413148045
251
252
  requirements: []
252
253
  rubyforge_project:
253
254
  rubygems_version: 1.8.24
@@ -267,7 +268,6 @@ test_files:
267
268
  - spec/dummy/app/mailers/.gitkeep
268
269
  - spec/dummy/app/models/.gitkeep
269
270
  - spec/dummy/app/models/blog.rb
270
- - spec/dummy/app/views/brightcontent/blogs/_form_field_assets.html.erb
271
271
  - spec/dummy/app/views/layouts/application.html.erb
272
272
  - spec/dummy/config.ru
273
273
  - spec/dummy/config/application.rb
@@ -312,6 +312,7 @@ test_files:
312
312
  - spec/dummy/script/rails
313
313
  - spec/factories.rb
314
314
  - spec/features/attachments_spec.rb
315
+ - spec/models/brightcontent/attachable_spec.rb
315
316
  - spec/models/brightcontent/attachment_spec.rb
316
317
  - spec/spec_helper.rb
317
318
  - spec/support/acceptance_helper.rb
@@ -1 +0,0 @@
1
- <%= render "brightcontent/attachments/form_field", item: item %>