brightcontent-assets 2.0.3 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightcontent-assets (2.0.3)
5
- brightcontent-core (= 2.0.3)
4
+ brightcontent-assets (2.0.5)
5
+ brightcontent-core (= 2.0.5)
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.3)
12
+ brightcontent-core (2.0.5)
13
13
  bcrypt-ruby
14
14
  bootstrap-wysihtml5-rails
15
15
  has_scope
@@ -1 +1,5 @@
1
- //= require jquery-fileupload
1
+ //= require jquery-fileupload/basic
2
+
3
+ $(function () {
4
+ $('#fileupload').fileupload();
5
+ });
@@ -1,16 +1,15 @@
1
1
  require_dependency "brightcontent/application_controller"
2
2
 
3
3
  module Brightcontent
4
- class PagesController < BaseController
5
- private
6
-
7
- def list_fields
8
- default_fields - %w{body depth lft rgt parent_id slug}
9
- end
10
-
11
- def form_fields
12
- default_fields - %w{slug depth lft rgt}
4
+ class AssetsController < ApplicationController
5
+
6
+ def create
7
+ @asset = Asset.new(params.slice(:attachable_id, :attachable_type, :asset))
8
+ if @asset.save
9
+ render json: @asset.to_json, status: :created
10
+ else
11
+ render json: @asset.errors, status: :unprocessable_entity
12
+ end
13
13
  end
14
-
15
14
  end
16
15
  end
@@ -1,5 +1,7 @@
1
1
  module Brightcontent
2
2
  class Asset < ActiveRecord::Base
3
+ attr_accessible :attachable_id, :attachable_type, :asset
4
+
3
5
  belongs_to :attachable, :polymorphic => true
4
6
  has_attached_file :asset
5
7
 
@@ -5,9 +5,9 @@
5
5
  <% end %>
6
6
  </div>
7
7
 
8
- <%= form_for item.assets.new, remote: true do |p| %>
9
- <%= p.file_field :asset %>
10
- <% end %>
8
+ <input id="fileupload" type="file" name="asset" data-url="<%= brightcontent_assets_path %>" multiple>
9
+ <%= hidden_field_tag "attachable_id", item.id %>
10
+ <%= hidden_field_tag "attachable_type", item.class.to_s %>
11
11
  <% else %>
12
12
  First save to enable uploads
13
13
  <% end %>
data/config/routes.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  Brightcontent::Engine.routes.draw do
2
- resources :assets, only: [:create, :destroy]
2
+ put 'brightcontent_assets' => 'assets#create'
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require "brightcontent-core"
2
2
  require "paperclip"
3
+ require "jquery-fileupload-rails"
3
4
 
4
5
  require "brightcontent/assets/engine"
5
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightcontent-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.5
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-23 00:00:00.000000000 Z
12
+ date: 2012-12-27 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.3
21
+ version: 2.0.5
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.3
29
+ version: 2.0.5
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: paperclip
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -202,6 +202,16 @@ files:
202
202
  - spec/dummy/public/422.html
203
203
  - spec/dummy/public/500.html
204
204
  - spec/dummy/public/favicon.ico
205
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/001/original/icon-socialmedia.png
206
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/002/original/bg_direction_nav.png
207
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/003/original/icon-android.png
208
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/004/original/icon-calendar.png
209
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/005/original/icon-iphone.png
210
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/006/original/icon-socialmedia.png
211
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/007/original/iphone.png
212
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/008/original/logo.png
213
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/009/original/menu-button.png
214
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/010/original/bestuur.jpg
205
215
  - spec/dummy/script/rails
206
216
  - spec/factories.rb
207
217
  - spec/features/assets_spec.rb
@@ -222,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
232
  version: '0'
223
233
  segments:
224
234
  - 0
225
- hash: 1664730842358737560
235
+ hash: 3665897338164839893
226
236
  required_rubygems_version: !ruby/object:Gem::Requirement
227
237
  none: false
228
238
  requirements:
@@ -231,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
241
  version: '0'
232
242
  segments:
233
243
  - 0
234
- hash: 1664730842358737560
244
+ hash: 3665897338164839893
235
245
  requirements: []
236
246
  rubyforge_project:
237
247
  rubygems_version: 1.8.24
@@ -277,6 +287,16 @@ test_files:
277
287
  - spec/dummy/public/422.html
278
288
  - spec/dummy/public/500.html
279
289
  - spec/dummy/public/favicon.ico
290
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/001/original/icon-socialmedia.png
291
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/002/original/bg_direction_nav.png
292
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/003/original/icon-android.png
293
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/004/original/icon-calendar.png
294
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/005/original/icon-iphone.png
295
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/006/original/icon-socialmedia.png
296
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/007/original/iphone.png
297
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/008/original/logo.png
298
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/009/original/menu-button.png
299
+ - spec/dummy/public/system/brightcontent/assets/assets/000/000/010/original/bestuur.jpg
280
300
  - spec/dummy/script/rails
281
301
  - spec/factories.rb
282
302
  - spec/features/assets_spec.rb