trusty-clipped-extension 2.0.6 → 2.0.7

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: e0f7e2fbb77337dab6ed69bce384fc481e248523
4
- data.tar.gz: a11a10b0f8d511e1625296d038d3532da092a482
3
+ metadata.gz: 67a5398a2a5ac0dd6a16a76d8ded3131c8d73cc4
4
+ data.tar.gz: 80d287a7f7bb5edc95fd9cd582986262a28b2fa2
5
5
  SHA512:
6
- metadata.gz: 3f9469774d156389987291efb0f9c3a0c689e544832458910941c54e1d11f47d07828444bef137d7f341cacb3bd24bb927042ec8229a5ab1f5f8b3a4dea3b6b8
7
- data.tar.gz: 5eb2bcdcb657f0475c5eeb3567b1eb82213b0336a348399b59110aecfcfe3617845437e6191f5b1c6aaad6e2502e22d6e893aa8246d54c2b063eb13f7617dfa0
6
+ metadata.gz: cbd388ef9270419b628e991c85a87a103e7785e1182e28ad9f6c1e0348cc62915b77c15bfa021db03b4bb91c1a46ba07e4972f38584349467fb68c9ae4f79733
7
+ data.tar.gz: 0923f2581dca2e67bba4fbac9fbbf89a48d4ce4d93666b1c628f85a3d2cc5f13365414ed9611f7057abc1053a78ae1eb6d4dd3a387be2a8f163ffabe8a2ecb09
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trusty-clipped-extension (2.0.6)
4
+ trusty-clipped-extension (2.0.7)
5
5
  acts_as_list (~> 0.4.0)
6
6
  cocaine (~> 0.5)
7
7
  paperclip (~> 4.2)
@@ -141,7 +141,7 @@ GEM
141
141
  nokogiri (1.6.7.2)
142
142
  mini_portile2 (~> 2.0.0.rc2)
143
143
  orm_adapter (0.5.0)
144
- paperclip (4.3.5)
144
+ paperclip (4.3.6)
145
145
  activemodel (>= 3.2.0)
146
146
  activesupport (>= 3.2.0)
147
147
  cocaine (~> 0.5.5)
@@ -247,7 +247,7 @@ GEM
247
247
  thor (0.19.1)
248
248
  thread_safe (0.3.5)
249
249
  tilt (1.4.1)
250
- trusty-cms (2.0.16)
250
+ trusty-cms (2.0.17)
251
251
  RedCloth (~> 4.2)
252
252
  acts_as_tree (~> 2.1)
253
253
  bundler (~> 1.7)
@@ -265,6 +265,7 @@ GEM
265
265
  rack-cache (~> 1.2)
266
266
  radius (~> 0.7)
267
267
  rails (~> 4.2)
268
+ rake (< 11.0)
268
269
  rdoc (~> 3.9)
269
270
  stringex (~> 1.3)
270
271
  therubyracer (~> 0.12)
@@ -31,12 +31,16 @@ class Admin::AssetsController < Admin::ResourceController
31
31
  def create
32
32
  @assets, @page_attachments = [], []
33
33
  params[:asset][:asset].to_a.each do |uploaded_asset|
34
- @asset = Asset.create(:asset => uploaded_asset, :title => params[:asset][:title], :caption => params[:asset][:caption])
35
- if params[:for_attachment]
36
- @page = Page.find_by_id(params[:page_id]) || Page.new
37
- @page_attachments << @page_attachment = @asset.page_attachments.build(:page => @page)
34
+ if uploaded_asset.content_type == "application/octet-stream"
35
+ flash[:notice] = "Please only upload assets that have a valid extension in the name."
36
+ else
37
+ @asset = Asset.create(:asset => uploaded_asset, :caption => params[:asset][:caption])
38
+ if params[:for_attachment]
39
+ @page = Page.find_by_id(params[:page_id]) || Page.new
40
+ @page_attachments << @page_attachment = @asset.page_attachments.build(:page => @page)
41
+ end
42
+ @assets << @asset
38
43
  end
39
- @assets << @asset
40
44
  end
41
45
  if params[:for_attachment]
42
46
  render :partial => 'admin/page_attachments/attachment', :collection => @page_attachments
data/app/models/asset.rb CHANGED
@@ -62,6 +62,8 @@ class Asset < ActiveRecord::Base
62
62
  validates_attachment_presence :asset, :message => "You must choose a file to upload!"
63
63
  if TrustyCms.config["paperclip.skip_filetype_validation"] != "true" && TrustyCms.config['paperclip.content_types']
64
64
  validates_attachment_content_type :asset, :content_type => TrustyCms.config["paperclip.content_types"].gsub(' ','').split(',')
65
+ else
66
+ validates_attachment_presence :asset, :message => "Your uploaded file must have an extension in its name!"
65
67
  end
66
68
  validates_attachment_size :asset, :less_than => ( TrustyCms.config["assets.max_asset_size"] || 5 ).to_i.megabytes
67
69
 
@@ -183,7 +185,7 @@ private
183
185
  end
184
186
 
185
187
  def assign_title
186
- self.title = basename unless title?
188
+ self.title = self.asset_file_name
187
189
  end
188
190
 
189
191
  def assign_uuid
@@ -2,9 +2,6 @@
2
2
  - render_region :form do |form|
3
3
  - form.edit_title do
4
4
  %fieldset.title
5
- %label{ :for => "asset_title" }
6
- = t("clipped_extension.title")
7
- = f.text_field :title, :class => 'textbox', :maxlength => 100
8
5
  - form.edit_metadata do
9
6
  .drawer
10
7
  .drawer_contents#attributes
@@ -17,26 +17,7 @@
17
17
  %p
18
18
  %a#attach-popup{:href=>"#attach_asset", :style => 'color: #666; font-size: .8em'}= t('clipped_extension.attach_existing')
19
19
 
20
-
21
- = form_tag('/admin/assets/', :id=> 'update_asset', :class => 'upload_asset') do |f|
22
- = hidden_field_tag "for_attachment", 1
23
- = hidden_field_tag "page_id", @page.id
24
- = hidden_field_tag "asset_id", ""
25
-
26
- #update-controls
27
- %p
28
- %strong
29
- = label_tag :title, t("clipped_extension.alt_text_or_title")
30
- %p
31
- = text_field_tag :title, nil, {:name => "asset[title]", :class => "textbox big"}
32
-
33
- .buttons
34
- = button_tag "Set Title", {:id => 'update-asset', :class => "button"}
35
- #update-status{:style => 'display: none;'}
36
- %img{:src => "/assets/admin/spinner.gif"}
37
- = t('or')
38
- %a.close_popup{:href=>"#"}= 'Continue'
39
- #upload_holders
20
+ %a.close_popup{:href=>"#"}= 'Upload Complete. Click to Close.'
40
21
 
41
22
  - popups.attach_asset do
42
23
  #attach_asset.popup.textured{:style=>"display: none;"}
@@ -53,4 +34,4 @@
53
34
  .busy{:style => "display: none"}= image('spinner.gif', :alt => "")
54
35
  .buttons
55
36
  %a.cancel.close_popup{:href=>"#"}= t('close')
56
- %a.upload-popup{:href=>"#upload_asset", :id=> "upload_asset_link", :style => 'color: #666; float: left'}= t('clipped_extension.upload_asset')
37
+ %a{:href=>"#upload_asset", :id=> "upload_asset_link", :style => 'color: #666; float: left'}= t('clipped_extension.upload_asset')
@@ -1,5 +1,5 @@
1
1
  module TrustyCmsClippedExtension
2
- VERSION = "2.0.6"
2
+ VERSION = "2.0.7"
3
3
  SUMMARY = %q{Assets for TrustyCms CMS}
4
4
  DESCRIPTION = %q{Asset-management derived from Keith Bingman's Paperclipped extension.}
5
5
  URL = "https://github.com/pgharts/trusty-clipped-extension"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusty-clipped-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Bingman
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2016-03-11 00:00:00.000000000 Z
18
+ date: 2016-03-14 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: acts_as_list