ecm_downloads 0.0.10.pre → 0.0.11.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,10 @@
1
1
  class Ecm::Downloads::DownloadsController < FrontendController
2
+ # Support secured downloads with expiring urls on S3.
3
+ def download
4
+ @download = Ecm::Downloads::Download.published.find(params[:id])
5
+ redirect_to @download.asset.expiring_url(100)
6
+ end
7
+
2
8
  def index
3
9
  @downloads = Ecm::Downloads::Download.published.all
4
10
  end
@@ -62,7 +62,7 @@ class Ecm::Downloads::Download < ActiveRecord::Base
62
62
  friendly_id :name, :use => :slugged
63
63
 
64
64
  # paperclip
65
- has_attached_file :asset
65
+ has_attached_file :asset, Ecm::Downloads::Configuration.paperclip_options
66
66
 
67
67
  # validations
68
68
  validates :ecm_downloads_download_category, :presence => true
@@ -13,7 +13,7 @@
13
13
  <% end %>
14
14
  <div class="download-actions">
15
15
  <p>
16
- <%= link_to(download.asset.url, { :class => 'download-link btn' }) do %>
16
+ <%= link_to([:download, download], { :class => 'download-link btn' }) do %>
17
17
  <i class="icon-download"></i> <%= t('ecm.downloads.download.actions.start_download') %>
18
18
  <% end %>
19
19
  </p>
@@ -7,10 +7,11 @@ module Ecm
7
7
  module Configuration
8
8
  def configure
9
9
  yield self
10
- end
10
+ end # def
11
+
12
+ mattr_accessor :paperclip_options
13
+ @@paperclip_options = {}
14
+ end # module Configuration
15
+ end # module Downloads
16
+ end # module Ecm
11
17
 
12
- # mattr_accessor :foo
13
- # @@foo = nil
14
- end
15
- end
16
- end
@@ -9,14 +9,18 @@ module Ecm
9
9
  # This will only create the show action for download categories, but omit the index action.
10
10
  def self.routes(router, options = {})
11
11
  options.reverse_merge!(
12
- { :download_category_actions => [:index, :show],
13
- :download_actions => [:index, :show]
12
+ { :download_category_actions => [:index, :show],
13
+ :download_actions => [:index, :show],
14
+ :add_download_member_action => false
14
15
  }
15
16
  )
16
-
17
+
17
18
  router.resources :ecm_downloads_download_categories, :only => options[:download_category_actions], :controller => 'ecm/downloads/download_categories'
18
- router.resources :ecm_downloads_downloads,:only => options[:download_actions], :controller => 'ecm/downloads/downloads'
19
- end
20
- end
21
- end
22
- end
19
+ router.resources :ecm_downloads_downloads, :only => options[:download_actions], :controller => 'ecm/downloads/downloads' do
20
+ router.get :download, :on => :member, :if => options[:add_download_member_action]
21
+ end # router.resources :ecm_downloads_downloads
22
+ end # def
23
+ end # class Routing
24
+ end # module Downloads
25
+ end # module Ecm
26
+
@@ -1,6 +1,6 @@
1
1
  module Ecm
2
2
  module Downloads
3
- VERSION = "0.0.10.pre"
3
+ VERSION = "0.0.11.pre"
4
4
  end
5
5
  end
6
6
 
@@ -1,2 +1,7 @@
1
1
  Ecm::Downloads.configure do |config|
2
- end
2
+ # options for paperclip
3
+ #
4
+ # default: {}
5
+ config.paperclip_options = {}
6
+ end # Ecm::Downloads.configure
7
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_downloads
3
3
  version: !ruby/object:Gem::Version
4
- hash: 961916012
4
+ hash: 961916008
5
5
  prerelease: 7
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
9
+ - 11
10
10
  - pre
11
- version: 0.0.10.pre
11
+ version: 0.0.11.pre
12
12
  platform: ruby
13
13
  authors:
14
14
  - Roberto Vasquez Angel
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-02-12 00:00:00 Z
19
+ date: 2013-11-06 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rails