ecm_downloads 0.0.4 → 0.0.5.pre

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2012 YOURNAME
1
+ Copyright 2012 Roberto Vasquez Angel
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -2,7 +2,7 @@ class Ecm::Downloads::DownloadCategoriesController < FrontendController
2
2
  def index
3
3
  @download_categories = Ecm::Downloads::DownloadCategory.all
4
4
  end
5
-
5
+
6
6
  def show
7
7
  @download_category = Ecm::Downloads::DownloadCategory.find(params[:id])
8
8
  end
@@ -1,9 +1,9 @@
1
1
  class Ecm::Downloads::DownloadsController < FrontendController
2
2
  def index
3
- @downloads = Ecm::Downloads::Download.all
3
+ @downloads = Ecm::Downloads::Download.published.all
4
4
  end
5
-
5
+
6
6
  def show
7
- @download = Ecm::Downloads::Download.find(params[:id])
7
+ @download = Ecm::Downloads::Download.published.find(params[:id])
8
8
  end
9
9
  end
@@ -8,23 +8,23 @@ module FixUpdateCounters
8
8
 
9
9
  # Get real class of changed attribute, so work both with namespaced/normal models
10
10
  klass = self.association(changed_class.to_sym).klass
11
-
11
+
12
12
  # Try to get counter cache from association options
13
- begin
13
+ begin
14
14
  counter_name = self.association(changed_class.to_sym).options[:counter_cache]
15
- rescue
15
+ rescue
16
16
  # Namespaced model return a slash, split it.
17
17
  unless (counter_name = "#{self.class.name.underscore.pluralize.split("/")[1]}_count".to_sym)
18
18
  counter_name = "#{self.class.name.underscore.pluralize}_count".to_sym
19
19
  end
20
- end
20
+ end
21
21
 
22
22
 
23
23
  klass.decrement_counter(counter_name, value[0]) unless value[0] == nil
24
24
  klass.increment_counter(counter_name, value[1]) unless value[1] == nil
25
25
  end
26
26
  }
27
- end
27
+ end
28
28
  end
29
29
 
30
30
  ActiveRecord::Base.send(:include, FixUpdateCounters)
@@ -34,52 +34,49 @@ ActiveRecord::Base.send(:include, FixUpdateCounters)
34
34
  class Ecm::Downloads::Download < ActiveRecord::Base
35
35
  # db settings
36
36
  self.table_name = 'ecm_downloads_downloads'
37
-
37
+
38
38
  # acts as list
39
- acts_as_list :scope => :ecm_downloads_download_category
40
-
39
+ acts_as_list :scope => :ecm_downloads_download_category
40
+
41
+ # acts as published
42
+ include ActsAsPublished::ActiveRecord
43
+ acts_as_published
44
+
41
45
  # associations
42
- belongs_to :ecm_downloads_download_category,
43
- :class_name => Ecm::Downloads::DownloadCategory,
46
+ belongs_to :ecm_downloads_download_category,
47
+ :class_name => Ecm::Downloads::DownloadCategory,
44
48
  :counter_cache => :ecm_downloads_downloads_count
45
-
49
+
46
50
  # attibutes
47
51
  attr_accessible :asset,
48
52
  :description,
49
- :ecm_downloads_download_category_id,
50
- :locale,
53
+ :ecm_downloads_download_category_id,
51
54
  :name
52
-
55
+
53
56
  # callbacks
54
57
  after_update :fix_updated_counters
55
58
  before_update :fix_updated_position, :if => Proc.new { |d| !position.blank? && d.ecm_downloads_download_category_id_changed? }
56
-
59
+
57
60
  # friendly id
58
61
  extend FriendlyId
59
62
  friendly_id :name, :use => :slugged
60
-
63
+
61
64
  # paperclip
62
65
  has_attached_file :asset
63
-
64
- # validations
66
+
67
+ # validations
65
68
  validates :ecm_downloads_download_category, :presence => true
66
- validates :locale, :inclusion => { :in => I18n.available_locales.map(&:to_s) }, :unless => Proc.new { |c| c.locale.blank? }
67
- validates :name, :presence => true
69
+ validates :name, :presence => true
68
70
  validates_attachment_presence :asset
69
-
71
+
70
72
  # public methods
71
-
72
- # def heading_name
73
- # locale_prefix = (locale.blank?) ? "" : "[#{locale}] "
74
- # "#{locale_prefix}#{name}"
75
- # end
76
-
73
+
77
74
  def to_s
78
75
  name
79
76
  end
80
-
77
+
81
78
  # private methods
82
- private
79
+ private
83
80
  def fix_updated_position
84
81
  Rails.logger.debug "Fixing positions for #{self.to_s} (Moving to last)"
85
82
  add_to_list_bottom
@@ -1,64 +1,75 @@
1
1
  class Ecm::Downloads::DownloadCategory < ActiveRecord::Base
2
2
  # db settings
3
3
  self.table_name = 'ecm_downloads_download_categories'
4
-
4
+
5
5
  # associations
6
- has_many :ecm_downloads_downloads,
7
- :class_name => Ecm::Downloads::Download,
6
+ has_many :ecm_downloads_downloads,
7
+ :class_name => Ecm::Downloads::Download,
8
8
  :dependent => :destroy,
9
9
  :foreign_key => :ecm_downloads_download_category_id,
10
10
  :order => 'position'
11
-
11
+
12
+ accepts_nested_attributes_for :ecm_downloads_downloads,
13
+ :allow_destroy => true
14
+
12
15
  # attributes
13
- attr_accessible :description,
14
- :ecm_courses_courses_count,
15
- :locale,
16
- :name,
17
- :parent_id,
18
- :position,
16
+ attr_accessible :description,
17
+ :ecm_downloads_downloads_attributes,
18
+ :ecm_downloads_downloads_count,
19
+ :locale,
20
+ :name,
21
+ :parent_id,
22
+ :position,
19
23
  :slug
20
-
24
+
21
25
  # awesome nested set
22
26
  acts_as_nested_set
23
27
  default_scope :order => 'lft ASC'
24
-
28
+
25
29
  # friendly id
26
30
  extend FriendlyId
27
31
  friendly_id :name, :use => :slugged
28
-
32
+
29
33
  # validations
30
- validates :name, :presence => true, :uniqueness => { :scope => [ :parent_id ] }
31
- validates :locale, :presence => true, :if => :root?
32
- validates :locale, :inclusion => { :in => I18n.available_locales.map(&:to_s) }, :unless => Proc.new { |cc| cc.locale.blank? }
33
- validates :locale, :absence => true, :unless => :root?
34
-
34
+ validates :name, :presence => true,
35
+ :uniqueness => { :scope => [ :parent_id ] }
36
+
37
+ validates :locale, :presence => true,
38
+ :if => :root?
39
+
40
+ validates :locale, :inclusion => I18n.available_locales.map(&:to_s),
41
+ :if => Proc.new { |cc| cc.locale.present? }
42
+
43
+ validates :locale, :absence => true,
44
+ :unless => :root?
45
+
35
46
  # public methods
36
-
47
+
37
48
  # public methods
38
-
49
+
39
50
  def display_code
40
51
  "<%= render_download_category '#{self.name}' %>"
41
52
  end
42
-
53
+
43
54
  def index_name
44
55
  if self.root?
45
56
  "[#{self.locale}] #{self.name}"
46
57
  else
47
58
  "#{'&#160;&#160;&#160;&#160;' * self.level} |--&#160;#{self.name}".html_safe
48
- end
59
+ end
49
60
  end
50
-
61
+
51
62
  def to_s
52
63
  name
53
64
  end
54
-
65
+
55
66
  def tree_name
56
67
  root_prefix = (self.root?) ? "[#{self.locale}] " : ""
57
-
68
+
58
69
  if ecm_downloads_downloads_count < 1
59
- "#{root_prefix}#{to_s}"
60
- else
61
- "#{root_prefix}#{to_s} (#{ecm_downloads_downloads_count})"
70
+ "#{root_prefix}#{to_s}"
71
+ else
72
+ "#{root_prefix}#{to_s} (#{ecm_downloads_downloads_count})"
62
73
  end
63
- end
74
+ end
64
75
  end
@@ -3,10 +3,10 @@
3
3
  <h1 class="downloads_category-name"><%= download_category.name %></h1>
4
4
  <% else %>
5
5
  <h2 class="downloads_category-name"><%= download_category.name %></h2>
6
- <% end %>
7
-
6
+ <% end %>
7
+
8
8
  <div class="download_categories-tree">
9
- <%= nested_li(download_category.descendants, {}) do |download_category| %>
9
+ <%= nested_li(download_category.descendants, {}) do |download_category, level| %>
10
10
  <%= link_to download_category.tree_name, download_category %>
11
11
  <% end %>
12
12
  </div>
@@ -16,14 +16,14 @@
16
16
  <p><%= download_category.description %></p>
17
17
  </div>
18
18
  <% end %>
19
-
19
+
20
20
  <div class="download_category-downloads item_list">
21
- <h2><%= Ecm::Downloads::DownloadCategory.human_attribute_name(:ecm_downloads_downloads) %></h2>
22
- <% if download_category.ecm_downloads_downloads_count == 0 %>
21
+ <h2><%= Ecm::Downloads::DownloadCategory.human_attribute_name(:ecm_downloads_downloads) %></h2>
22
+ <% if download_category.ecm_downloads_downloads.published.count == 0 %>
23
23
  <%= t('ecm.downloads.download_category.messages.no_downloads_available') %>
24
24
  <hr />
25
25
  <% else %>
26
- <%= render download_category.ecm_downloads_downloads %>
26
+ <%= render download_category.ecm_downloads_downloads.published %>
27
27
  <% end %>
28
- </div>
28
+ </div>
29
29
  </div>
@@ -1,10 +1,5 @@
1
1
  <div class="download" id="download-<%= download.id %>">
2
- <h2>
3
- <% if download.locale.present? %>
4
- <span class="download-locale">[<%= download.locale %>]</span>
5
- <% end %>
6
- <span class="download-name"><%= download.name %></span>
7
- </h2>
2
+ <h2 class="download-name"><%= download.name %></h2>
8
3
  <ul>
9
4
  <li class="download-asset_file_name"><%= Ecm::Downloads::Download.human_attribute_name(:asset_file_name) %>: <%= download.asset_file_name %></li>
10
5
  <li class="download-asset_file_size"><%= Ecm::Downloads::Download.human_attribute_name(:asset_file_size) %>: <%= number_to_human_size(download.asset_file_size) %></li>
@@ -16,6 +16,7 @@ de:
16
16
  locale: Sprache
17
17
  name: Name
18
18
  position: Position
19
+ published: Veröffentlicht
19
20
  slug: Freundliche ID
20
21
  updated_at: Aktualisiert am
21
22
  models:
@@ -16,6 +16,7 @@ en:
16
16
  locale: locale
17
17
  name: name
18
18
  position: position
19
+ published: published
19
20
  slug: friendly id
20
21
  updated_at: updated at
21
22
  models:
@@ -3,17 +3,17 @@ class CreateEcmDownloadsDownloads < ActiveRecord::Migration
3
3
  create_table :ecm_downloads_downloads do |t|
4
4
  t.string :name
5
5
  t.text :description
6
- t.string :locale
7
-
6
+ t.timestamp :published_at
7
+
8
8
  # references
9
9
  t.references :ecm_downloads_download_category
10
-
10
+
11
11
  # acts as list
12
12
  t.integer :position
13
-
13
+
14
14
  # friendly id
15
15
  t.string :slug
16
-
16
+
17
17
  # paperclip
18
18
  # t.attachment :asset
19
19
  t.string :asset_file_name
@@ -24,6 +24,8 @@ class CreateEcmDownloadsDownloads < ActiveRecord::Migration
24
24
 
25
25
  t.timestamps
26
26
  end
27
- add_index :ecm_downloads_downloads, :ecm_downloads_download_category_id,:name => 'index_ecm_downloads_downloads_on_download_category_id'
27
+ add_index :ecm_downloads_downloads,
28
+ :ecm_downloads_download_category_id,
29
+ :name => 'index_ecm_downloads_downloads_on_download_category_id'
28
30
  end
29
31
  end
@@ -1,40 +1,66 @@
1
1
  if defined?(ActiveAdmin)
2
2
  include ActiveAdmin::ActsAsList::Helper
3
3
  include ActiveAdmin::AwesomeNestedSet::Helper
4
-
4
+
5
5
  ActiveAdmin.register Ecm::Downloads::DownloadCategory do
6
6
  # menu entry settings
7
7
  menu :parent => I18n.t('ecm.downloads.active_admin.menu')
8
-
8
+
9
9
  # sorting
10
10
  config.sort_order = 'lft_asc'
11
-
11
+
12
12
  # awesome nested set
13
13
  sortable_tree_member_actions
14
-
14
+
15
+ # scopes
16
+ scope :all
17
+ scope :roots
18
+ I18n.available_locales.each do |locale|
19
+ self.send(:scope, locale.to_s) do |klass|
20
+ klass.where(:locale => locale)
21
+ # klass.where(klass.arel_table[:locale].eq(locale).or(klass.arel_table[:locale].eq(nil)))
22
+ end
23
+ end
24
+
15
25
  form do |f|
16
26
  f.inputs do
17
- f.input :parent, :as => :select, :collection => nested_set_options(Ecm::Downloads::DownloadCategory, f.object) { |dc| "#{'-' * dc.level} #{dc.name}" }
18
- f.input :locale, :as => :select, :collection => I18n.available_locales.map(&:to_s)
27
+ f.input :parent, :as => :select,
28
+ :collection => nested_set_options(Ecm::Downloads::DownloadCategory, f.object) { |dc| "#{'-' * dc.depth} #{dc.name}" }
29
+ f.input :locale, :as => :select,
30
+ :collection => I18n.available_locales.map(&:to_s)
19
31
  f.input :name
20
32
  f.input :description
21
33
  end
22
34
 
35
+ f.inputs do
36
+ f.has_many :ecm_downloads_downloads do |d|
37
+ if d.object.persisted?
38
+ d.input :_destroy, :as => :boolean, :label => I18n.t('active_admin.delete')
39
+ end
40
+ d.input :asset, :as => :file
41
+ d.input :name
42
+ d.input :published, :as => :boolean
43
+ d.input :description
44
+ end
45
+ end
46
+
23
47
  f.actions
24
48
  end
25
-
49
+
26
50
  index do
27
51
  selectable_column
28
52
  sortable_tree_columns
29
- column :index_name
30
- # column :locale
31
- # column :parent
32
- # column :name
33
- column :description
53
+ column :locale
54
+ column :name do |dc|
55
+ span(:style => "margin-left: #{25 * dc.level}px") { dc.name }
56
+ end
57
+ column(:description) do |dc|
58
+ truncate(dc.description, :length => 100 , :separator => ' ')
59
+ end
34
60
  column :ecm_downloads_downloads_count
35
61
  default_actions
36
62
  end
37
-
63
+
38
64
  show :title => :to_s do
39
65
  attributes_table do
40
66
  row :parent
@@ -44,51 +70,50 @@ if defined?(ActiveAdmin)
44
70
  row :created_at
45
71
  row :updated_at
46
72
  end
47
-
73
+
48
74
  panel Ecm::Downloads::DownloadCategory.human_attribute_name(:description) do
49
75
  div do
50
76
  ecm_downloads_download_category.description
51
77
  end
52
78
  end
53
-
79
+
54
80
  panel Ecm::Downloads::DownloadCategory.human_attribute_name(:display_code) do
55
81
  div do
56
82
  ecm_downloads_download_category.display_code
57
83
  end
58
- end
59
-
84
+ end
85
+
60
86
  panel Ecm::Downloads::DownloadCategory.human_attribute_name(:link) do
61
87
  div do
62
88
  ecm_downloads_download_category_path(I18n.locale, ecm_downloads_download_category)
63
89
  end
64
- end
65
-
90
+ end
91
+
66
92
  panel Ecm::Downloads::DownloadCategory.human_attribute_name(:children) do
67
93
  table_for ecm_downloads_download_category.children, :i18n => Ecm::Downloads::DownloadCategory do
68
- # column(:name) { |ecm_downloads_download| link_to ecm_downloads_download, [:admin, ecm_downloads_download] }
69
94
  sortable_tree_columns
70
- column(:index_name) { |ecm_downloads_download_category| link_to ecm_downloads_download_category, [:admin, ecm_downloads_download_category] }
71
- # column :locale
72
- # column :parent
73
- # column :name
95
+ column(:index_name) do |ecm_downloads_download_category|
96
+ link_to ecm_downloads_download_category, [:admin, ecm_downloads_download_category]
97
+ end
74
98
  column :description
75
99
  column :ecm_downloads_downloads_count
76
100
  end
77
- end
78
-
101
+ end
102
+
79
103
  panel Ecm::Downloads::DownloadCategory.human_attribute_name(:ecm_downloads_downloads) do
80
104
  table_for ecm_downloads_download_category.ecm_downloads_downloads, :i18n => Ecm::Downloads::Download do
81
105
  sortable_columns
82
- column :position
83
- column :locale
84
- column(:name) { |ecm_downloads_download| link_to ecm_downloads_download, [:admin, ecm_downloads_download] }
106
+ column(:name) do |ecm_downloads_download|
107
+ link_to ecm_downloads_download, [:admin, ecm_downloads_download]
108
+ end
109
+ acts_as_published_columns
85
110
  column :asset_file_name
86
111
  column :asset_file_size, :sortable => :asset_file_size do |download|
87
112
  number_to_human_size(download.asset_file_size)
88
113
  end
89
- column :created_at
114
+ column :created_at
90
115
  end
91
- end
116
+ end
92
117
  end
93
118
  end
94
- end
119
+ end
@@ -0,0 +1,44 @@
1
+ include ActiveAdmin::ActsAsList::Helper
2
+ include ActsAsPublished::ActiveAdminHelper
3
+
4
+ ActiveAdmin.register Ecm::Downloads::Download do
5
+ # acts as list
6
+ sortable_member_actions
7
+
8
+ # acts as published
9
+ acts_as_published_actions
10
+
11
+ # config
12
+ menu :parent => I18n.t('ecm.downloads.active_admin.menu')
13
+
14
+ # scopes
15
+ scope :all
16
+ scope :published
17
+ scope :unpublished
18
+
19
+ form :html => { :enctype => "multipart/form-data" } do |f|
20
+ f.inputs do
21
+ f.input :ecm_downloads_download_category, :as => :select,
22
+ :collection => nested_set_options(Ecm::Downloads::DownloadCategory) { |dc| "#{'-' * dc.level} #{dc.name}" }
23
+ f.input :asset, :as => :file
24
+ f.input :name
25
+ f.input :published, :as => :boolean
26
+ f.input :description
27
+ end
28
+
29
+ f.actions
30
+ end
31
+
32
+ index do
33
+ selectable_column
34
+ column :ecm_downloads_download_category
35
+ column :name
36
+ acts_as_published_columns
37
+ column :asset_file_name
38
+ column :asset_file_size, :sortable => :asset_file_size do |download|
39
+ number_to_human_size(download.asset_file_size)
40
+ end
41
+ column :created_at
42
+ default_actions
43
+ end
44
+ end if defined?(ActiveAdmin)
@@ -4,13 +4,14 @@ module Ecm
4
4
  # active admin
5
5
  initializer :ecm_courses_engine do
6
6
  ::ActiveAdmin.setup do |active_admin_config|
7
- active_admin_config.load_paths += Dir[File.dirname(__FILE__) + '/../../../app/admin']
7
+ active_admin_config.load_paths += Dir[File.dirname(__FILE__) + '/active_admin']
8
8
  end
9
9
  end if defined?(::ActiveAdmin)
10
10
 
11
11
  # helpers
12
12
  config.to_prepare do
13
13
  ApplicationController.helper(Ecm::Downloads::DownloadCategoryHelper)
14
+ ApplicationController.helper(Ecm::Downloads::DownloadHelper)
14
15
  end
15
16
 
16
17
  # locales
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module Downloads
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5.pre"
4
4
  end
5
5
  end
data/lib/ecm_downloads.rb CHANGED
@@ -3,6 +3,7 @@ require 'rubygems'
3
3
  require 'active_admin-acts_as_list'
4
4
  require 'active_admin-awesome_nested_set'
5
5
  require 'acts_as_list'
6
+ require 'acts_as_published'
6
7
  require 'awesome_nested_set'
7
8
  require 'awesome_nested_set-tools'
8
9
  require 'friendly_id'
@@ -1,4 +1,52 @@
1
- # desc "Explaining what the task does"
2
- # task :ecm_downloads do
3
- # # Task goes here
4
- # end
1
+ namespace :ecm_downloads do
2
+ namespace :db do
3
+ desc "Purges and creates example data"
4
+ task :populate!, [] => [:environment] do |t, args|
5
+
6
+ Rake::Task["ecm_downloads:db:clear!"].execute
7
+ Rake::Task["ecm_downloads:db:populate"].execute
8
+ end
9
+
10
+ desc "Clears all data!"
11
+ task :clear!, [] => [:environment] do |t, args|
12
+ Ecm::Downloads::DownloadCategory.delete_all
13
+ Ecm::Downloads::Download.delete_all
14
+ end
15
+
16
+ desc "Creates example_data"
17
+ task :populate, [] => [:environment] do |t, args|
18
+ require "ffaker"
19
+ require "forgery"
20
+
21
+ # Create example download category roots
22
+ 10.times do
23
+ Ecm::Downloads::DownloadCategory.create! do |dc|
24
+ dc.locale = I18n.available_locales.choice.to_s
25
+ dc.name = Faker::Product.brand
26
+ dc.description = Faker::Lorem.paragraph(rand(10))
27
+ end
28
+ end
29
+
30
+ # Create example download sub-categories
31
+ 10.times do
32
+ Ecm::Downloads::DownloadCategory.create! do |dc|
33
+ dc.parent = Ecm::Downloads::DownloadCategory.all.choice
34
+ dc.name = Faker::Product.brand
35
+ dc.description = Faker::Lorem.paragraph(rand(10))
36
+ end
37
+ end
38
+
39
+ # Create example downloads
40
+ download_categories = Ecm::Downloads::DownloadCategory.all
41
+ 100.times do
42
+ Ecm::Downloads::Download.create! do |d|
43
+ d.ecm_downloads_download_category = download_categories.choice
44
+ d.name = Faker::Product.product_name
45
+ d.asset = File.open(Ecm::Downloads::Engine.root + "spec/fixtures/download/example.txt")
46
+ d.published = [true, false].choice
47
+ d.description = Faker::Lorem.paragraph(rand(10))
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
metadata CHANGED
@@ -1,8 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_downloads
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.4
4
+ hash: 961915984
5
+ prerelease: 6
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 5
10
+ - pre
11
+ version: 0.0.5.pre
6
12
  platform: ruby
7
13
  authors:
8
14
  - Roberto Vasquez Angel
@@ -10,7 +16,7 @@ autorequire:
10
16
  bindir: bin
11
17
  cert_chain: []
12
18
 
13
- date: 2012-07-26 00:00:00 Z
19
+ date: 2012-08-28 00:00:00 Z
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: rails
@@ -20,6 +26,11 @@ dependencies:
20
26
  requirements:
21
27
  - - ~>
22
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 3
32
+ - 2
33
+ - 6
23
34
  version: 3.2.6
24
35
  type: :runtime
25
36
  version_requirements: *id001
@@ -31,6 +42,9 @@ dependencies:
31
42
  requirements:
32
43
  - - ">="
33
44
  - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
34
48
  version: "0"
35
49
  type: :runtime
36
50
  version_requirements: *id002
@@ -42,6 +56,9 @@ dependencies:
42
56
  requirements:
43
57
  - - ">="
44
58
  - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
45
62
  version: "0"
46
63
  type: :runtime
47
64
  version_requirements: *id003
@@ -53,127 +70,172 @@ dependencies:
53
70
  requirements:
54
71
  - - ~>
55
72
  - !ruby/object:Gem::Version
73
+ hash: 23
74
+ segments:
75
+ - 0
76
+ - 1
77
+ - 6
56
78
  version: 0.1.6
57
79
  type: :runtime
58
80
  version_requirements: *id004
59
81
  - !ruby/object:Gem::Dependency
60
- name: awesome_nested_set
82
+ name: acts_as_published
61
83
  prerelease: false
62
84
  requirement: &id005 !ruby/object:Gem::Requirement
63
85
  none: false
64
86
  requirements:
65
- - - ~>
87
+ - - ">="
66
88
  - !ruby/object:Gem::Version
67
- version: 2.1.3
89
+ hash: 3
90
+ segments:
91
+ - 0
92
+ version: "0"
68
93
  type: :runtime
69
94
  version_requirements: *id005
70
95
  - !ruby/object:Gem::Dependency
71
- name: awesome_nested_set-tools
96
+ name: awesome_nested_set
72
97
  prerelease: false
73
98
  requirement: &id006 !ruby/object:Gem::Requirement
74
99
  none: false
75
100
  requirements:
76
- - - ">="
101
+ - - ~>
77
102
  - !ruby/object:Gem::Version
78
- version: "0"
103
+ hash: 13
104
+ segments:
105
+ - 2
106
+ - 1
107
+ - 3
108
+ version: 2.1.3
79
109
  type: :runtime
80
110
  version_requirements: *id006
81
111
  - !ruby/object:Gem::Dependency
82
- name: friendly_id
112
+ name: awesome_nested_set-tools
83
113
  prerelease: false
84
114
  requirement: &id007 !ruby/object:Gem::Requirement
85
115
  none: false
86
116
  requirements:
87
- - - ~>
117
+ - - ">="
88
118
  - !ruby/object:Gem::Version
89
- version: 4.0.7
119
+ hash: 3
120
+ segments:
121
+ - 0
122
+ version: "0"
90
123
  type: :runtime
91
124
  version_requirements: *id007
92
125
  - !ruby/object:Gem::Dependency
93
- name: paperclip
126
+ name: friendly_id
94
127
  prerelease: false
95
128
  requirement: &id008 !ruby/object:Gem::Requirement
96
129
  none: false
97
130
  requirements:
98
131
  - - ~>
99
132
  - !ruby/object:Gem::Version
100
- version: "2.7"
133
+ hash: 49
134
+ segments:
135
+ - 4
136
+ - 0
137
+ - 7
138
+ version: 4.0.7
101
139
  type: :runtime
102
140
  version_requirements: *id008
103
141
  - !ruby/object:Gem::Dependency
104
- name: rails_tools-absence_validator
142
+ name: paperclip
105
143
  prerelease: false
106
144
  requirement: &id009 !ruby/object:Gem::Requirement
107
145
  none: false
108
146
  requirements:
109
147
  - - ~>
110
148
  - !ruby/object:Gem::Version
111
- version: 0.0.1
149
+ hash: 13
150
+ segments:
151
+ - 2
152
+ - 7
153
+ version: "2.7"
112
154
  type: :runtime
113
155
  version_requirements: *id009
114
156
  - !ruby/object:Gem::Dependency
115
- name: sqlite3
157
+ name: rails_tools-absence_validator
116
158
  prerelease: false
117
159
  requirement: &id010 !ruby/object:Gem::Requirement
118
160
  none: false
119
161
  requirements:
120
- - - ">="
162
+ - - ~>
121
163
  - !ruby/object:Gem::Version
122
- version: "0"
123
- type: :development
164
+ hash: 29
165
+ segments:
166
+ - 0
167
+ - 0
168
+ - 1
169
+ version: 0.0.1
170
+ type: :runtime
124
171
  version_requirements: *id010
125
172
  - !ruby/object:Gem::Dependency
126
- name: thin
173
+ name: sqlite3
127
174
  prerelease: false
128
175
  requirement: &id011 !ruby/object:Gem::Requirement
129
176
  none: false
130
177
  requirements:
131
178
  - - ">="
132
179
  - !ruby/object:Gem::Version
180
+ hash: 3
181
+ segments:
182
+ - 0
133
183
  version: "0"
134
184
  type: :development
135
185
  version_requirements: *id011
136
186
  - !ruby/object:Gem::Dependency
137
- name: yard
187
+ name: thin
138
188
  prerelease: false
139
189
  requirement: &id012 !ruby/object:Gem::Requirement
140
190
  none: false
141
191
  requirements:
142
192
  - - ">="
143
193
  - !ruby/object:Gem::Version
194
+ hash: 3
195
+ segments:
196
+ - 0
144
197
  version: "0"
145
198
  type: :development
146
199
  version_requirements: *id012
147
200
  - !ruby/object:Gem::Dependency
148
- name: rspec-rails
201
+ name: yard
149
202
  prerelease: false
150
203
  requirement: &id013 !ruby/object:Gem::Requirement
151
204
  none: false
152
205
  requirements:
153
- - - ~>
206
+ - - ">="
154
207
  - !ruby/object:Gem::Version
155
- version: "2.0"
208
+ hash: 3
209
+ segments:
210
+ - 0
211
+ version: "0"
156
212
  type: :development
157
213
  version_requirements: *id013
158
214
  - !ruby/object:Gem::Dependency
159
- name: factory_girl_rails
215
+ name: sass-rails
160
216
  prerelease: false
161
217
  requirement: &id014 !ruby/object:Gem::Requirement
162
218
  none: false
163
219
  requirements:
164
- - - ~>
220
+ - - ">="
165
221
  - !ruby/object:Gem::Version
166
- version: "3.0"
222
+ hash: 3
223
+ segments:
224
+ - 0
225
+ version: "0"
167
226
  type: :development
168
227
  version_requirements: *id014
169
228
  - !ruby/object:Gem::Dependency
170
- name: shoulda-matchers
229
+ name: coffee-rails
171
230
  prerelease: false
172
231
  requirement: &id015 !ruby/object:Gem::Requirement
173
232
  none: false
174
233
  requirements:
175
234
  - - ">="
176
235
  - !ruby/object:Gem::Version
236
+ hash: 3
237
+ segments:
238
+ - 0
177
239
  version: "0"
178
240
  type: :development
179
241
  version_requirements: *id015
@@ -185,42 +247,114 @@ dependencies:
185
247
  requirements:
186
248
  - - ">="
187
249
  - !ruby/object:Gem::Version
250
+ hash: 3
251
+ segments:
252
+ - 0
188
253
  version: "0"
189
254
  type: :development
190
255
  version_requirements: *id016
191
256
  - !ruby/object:Gem::Dependency
192
- name: sass-rails
257
+ name: rspec-rails
193
258
  prerelease: false
194
259
  requirement: &id017 !ruby/object:Gem::Requirement
195
260
  none: false
196
261
  requirements:
197
- - - ">="
262
+ - - ~>
198
263
  - !ruby/object:Gem::Version
199
- version: "0"
264
+ hash: 3
265
+ segments:
266
+ - 2
267
+ - 0
268
+ version: "2.0"
200
269
  type: :development
201
270
  version_requirements: *id017
202
271
  - !ruby/object:Gem::Dependency
203
- name: meta_search
272
+ name: shoulda-matchers
204
273
  prerelease: false
205
274
  requirement: &id018 !ruby/object:Gem::Requirement
206
275
  none: false
207
276
  requirements:
208
277
  - - ">="
209
278
  - !ruby/object:Gem::Version
210
- version: 1.1.0.pre
279
+ hash: 3
280
+ segments:
281
+ - 0
282
+ version: "0"
211
283
  type: :development
212
284
  version_requirements: *id018
213
285
  - !ruby/object:Gem::Dependency
214
- name: coffee-rails
286
+ name: factory_girl_rails
215
287
  prerelease: false
216
288
  requirement: &id019 !ruby/object:Gem::Requirement
289
+ none: false
290
+ requirements:
291
+ - - ~>
292
+ - !ruby/object:Gem::Version
293
+ hash: 15
294
+ segments:
295
+ - 1
296
+ - 0
297
+ version: "1.0"
298
+ type: :development
299
+ version_requirements: *id019
300
+ - !ruby/object:Gem::Dependency
301
+ name: ffaker
302
+ prerelease: false
303
+ requirement: &id020 !ruby/object:Gem::Requirement
217
304
  none: false
218
305
  requirements:
219
306
  - - ">="
220
307
  - !ruby/object:Gem::Version
308
+ hash: 3
309
+ segments:
310
+ - 0
221
311
  version: "0"
222
312
  type: :development
223
- version_requirements: *id019
313
+ version_requirements: *id020
314
+ - !ruby/object:Gem::Dependency
315
+ name: forgery
316
+ prerelease: false
317
+ requirement: &id021 !ruby/object:Gem::Requirement
318
+ none: false
319
+ requirements:
320
+ - - "="
321
+ - !ruby/object:Gem::Version
322
+ hash: 11
323
+ segments:
324
+ - 0
325
+ - 5
326
+ - 0
327
+ version: 0.5.0
328
+ type: :development
329
+ version_requirements: *id021
330
+ - !ruby/object:Gem::Dependency
331
+ name: guard-rspec
332
+ prerelease: false
333
+ requirement: &id022 !ruby/object:Gem::Requirement
334
+ none: false
335
+ requirements:
336
+ - - ">="
337
+ - !ruby/object:Gem::Version
338
+ hash: 3
339
+ segments:
340
+ - 0
341
+ version: "0"
342
+ type: :development
343
+ version_requirements: *id022
344
+ - !ruby/object:Gem::Dependency
345
+ name: guard-bundler
346
+ prerelease: false
347
+ requirement: &id023 !ruby/object:Gem::Requirement
348
+ none: false
349
+ requirements:
350
+ - - ">="
351
+ - !ruby/object:Gem::Version
352
+ hash: 3
353
+ segments:
354
+ - 0
355
+ version: "0"
356
+ type: :development
357
+ version_requirements: *id023
224
358
  description: Provides downloads for active admin.
225
359
  email:
226
360
  - roberto@vasquez-angel.de
@@ -243,8 +377,6 @@ files:
243
377
  - app/views/ecm/downloads/downloads/_download.html.erb
244
378
  - app/models/ecm/downloads/download_category.rb
245
379
  - app/models/ecm/downloads/download.rb
246
- - app/admin/ecm_downloads_downloads.rb
247
- - app/admin/ecm_downloads_download_categories.rb
248
380
  - app/assets/images/ecm_downloads/download_categories/last_node.png
249
381
  - app/assets/images/ecm_downloads/download_categories/node.png
250
382
  - app/assets/images/ecm_downloads/download_categories/vertical_line.png
@@ -263,6 +395,8 @@ files:
263
395
  - db/migrate/001_create_ecm_downloads_download_categories.rb
264
396
  - db/migrate/002_create_ecm_downloads_downloads.rb
265
397
  - lib/tasks/ecm_downloads_tasks.rake
398
+ - lib/ecm/downloads/active_admin/ecm_downloads_downloads.rb
399
+ - lib/ecm/downloads/active_admin/ecm_downloads_download_categories.rb
266
400
  - lib/ecm/downloads/engine.rb
267
401
  - lib/ecm/downloads/version.rb
268
402
  - lib/ecm/downloads/routing.rb
@@ -283,13 +417,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
283
417
  requirements:
284
418
  - - ">="
285
419
  - !ruby/object:Gem::Version
420
+ hash: 3
421
+ segments:
422
+ - 0
286
423
  version: "0"
287
424
  required_rubygems_version: !ruby/object:Gem::Requirement
288
425
  none: false
289
426
  requirements:
290
- - - ">="
427
+ - - ">"
291
428
  - !ruby/object:Gem::Version
292
- version: "0"
429
+ hash: 25
430
+ segments:
431
+ - 1
432
+ - 3
433
+ - 1
434
+ version: 1.3.1
293
435
  requirements: []
294
436
 
295
437
  rubyforge_project:
@@ -1,38 +0,0 @@
1
- if defined?(ActiveAdmin)
2
- include ActiveAdmin::ActsAsList::Helper
3
-
4
- ActiveAdmin.register Ecm::Downloads::Download do
5
- # acts as list
6
- sortable_member_actions
7
-
8
- # config
9
- menu :parent => I18n.t('ecm.downloads.active_admin.menu')
10
-
11
- form :html => { :enctype => "multipart/form-data" } do |f|
12
- f.inputs do
13
- f.input :ecm_downloads_download_category, :as => :select,
14
- :collection => nested_set_options(Ecm::Downloads::DownloadCategory) { |dc| "#{'-' * dc.level} #{dc.name}" }
15
- f.input :locale, :as => :select,
16
- :collection => I18n.available_locales.map(&:to_s)
17
- f.input :asset, :as => :file
18
- f.input :name
19
- f.input :description
20
- end
21
-
22
- f.actions
23
- end
24
-
25
- index do
26
- selectable_column
27
- column :locale
28
- column :ecm_downloads_download_category
29
- column :name
30
- column :asset_file_name
31
- column :asset_file_size, :sortable => :asset_file_size do |download|
32
- number_to_human_size(download.asset_file_size)
33
- end
34
- column :created_at
35
- default_actions
36
- end
37
- end
38
- end