ecm_downloads 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +27 -0
  3. data/Rakefile +32 -0
  4. data/app/admin/ecm_downloads_download_categories.rb +94 -0
  5. data/app/admin/ecm_downloads_downloads.rb +38 -0
  6. data/app/assets/images/ecm_downloads/download_categories/last_node.png +0 -0
  7. data/app/assets/images/ecm_downloads/download_categories/node.png +0 -0
  8. data/app/assets/images/ecm_downloads/download_categories/vertical_line.png +0 -0
  9. data/app/assets/stylesheets/ecm_downloads/downloads_categories.css.erb +30 -0
  10. data/app/assets/stylesheets/ecm_downloads.css +1 -0
  11. data/app/controllers/ecm/downloads/download_categories_controller.rb +9 -0
  12. data/app/controllers/ecm/downloads/downloads_controller.rb +9 -0
  13. data/app/helpers/ecm/downloads/download_category_helper.rb +10 -0
  14. data/app/helpers/ecm/downloads/download_helper.rb +10 -0
  15. data/app/models/ecm/downloads/download.rb +87 -0
  16. data/app/models/ecm/downloads/download_category.rb +64 -0
  17. data/app/views/ecm/downloads/download_categories/_download_category.html.erb +29 -0
  18. data/app/views/ecm/downloads/download_categories/index.de.html.erb +7 -0
  19. data/app/views/ecm/downloads/download_categories/show.de.html.erb +9 -0
  20. data/app/views/ecm/downloads/downloads/_download.html.erb +19 -0
  21. data/app/views/ecm/downloads/downloads/index.de.html.erb +3 -0
  22. data/app/views/ecm/downloads/downloads/show.de.html.erb +5 -0
  23. data/config/locales/active_admin.patch.de.yml +29 -0
  24. data/config/locales/ecm.downloads.de.yml +16 -0
  25. data/config/locales/ecm.downloads.download.de.yml +24 -0
  26. data/config/locales/ecm.downloads.download.en.yml +24 -0
  27. data/config/locales/ecm.downloads.download_category.de.yml +24 -0
  28. data/config/locales/ecm.downloads.download_category.en.yml +24 -0
  29. data/config/locales/ecm.downloads.en.yml +16 -0
  30. data/config/locales/ecm.downloads.routes.de.yml +4 -0
  31. data/config/locales/ecm.downloads.routes.en.yml +4 -0
  32. data/config/routes.rb +5 -0
  33. data/db/migrate/001_create_ecm_downloads_download_categories.rb +24 -0
  34. data/db/migrate/002_create_ecm_downloads_downloads.rb +29 -0
  35. data/lib/ecm/downloads/engine.rb +25 -0
  36. data/lib/ecm/downloads/routing.rb +22 -0
  37. data/lib/ecm/downloads/version.rb +5 -0
  38. data/lib/ecm_downloads.rb +13 -0
  39. data/lib/tasks/ecm_downloads_tasks.rake +4 -0
  40. metadata +302 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,27 @@
1
+ = EcmDownloads
2
+
3
+ {<img src="https://secure.travis-ci.org/robotex82/ecm_downloads.png?branch=master" alt="Build Status" />}[http://travis-ci.org/robotex82/ecm_downloads]
4
+
5
+ = Purpose
6
+
7
+ TODO
8
+
9
+ = Features
10
+
11
+ TODO
12
+
13
+ = Installation
14
+
15
+ TODO
16
+
17
+ = Usage
18
+
19
+ TODO>
20
+
21
+ = Todo
22
+
23
+ TODO
24
+
25
+ = License
26
+
27
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'EcmDownloads'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
27
+ # Travis CI
28
+ task :default => [:spec]
29
+ desc 'run Rspec specs'
30
+ task :spec do
31
+ sh 'cd ./spec/dummy && rspec && cd ../../'
32
+ end
@@ -0,0 +1,94 @@
1
+ if defined?(ActiveAdmin)
2
+ include ActiveAdmin::ActsAsList::Helper
3
+ include ActiveAdmin::AwesomeNestedSet::Helper
4
+
5
+ ActiveAdmin.register Ecm::Downloads::DownloadCategory do
6
+ # menu entry settings
7
+ menu :parent => I18n.t('ecm.downloads.active_admin.menu')
8
+
9
+ # sorting
10
+ config.sort_order = 'lft_asc'
11
+
12
+ # awesome nested set
13
+ sortable_tree_member_actions
14
+
15
+ form do |f|
16
+ 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)
19
+ f.input :name
20
+ f.input :description
21
+ end
22
+
23
+ f.actions
24
+ end
25
+
26
+ index do
27
+ selectable_column
28
+ sortable_tree_columns
29
+ column :index_name
30
+ # column :locale
31
+ # column :parent
32
+ # column :name
33
+ column :description
34
+ column :ecm_downloads_downloads_count
35
+ default_actions
36
+ end
37
+
38
+ show :title => :to_s do
39
+ attributes_table do
40
+ row :parent
41
+ row :locale
42
+ row :name
43
+ row :ecm_downloads_downloads_count
44
+ row :created_at
45
+ row :updated_at
46
+ end
47
+
48
+ panel Ecm::Downloads::DownloadCategory.human_attribute_name(:description) do
49
+ div do
50
+ ecm_downloads_download_category.description
51
+ end
52
+ end
53
+
54
+ panel Ecm::Downloads::DownloadCategory.human_attribute_name(:display_code) do
55
+ div do
56
+ ecm_downloads_download_category.display_code
57
+ end
58
+ end
59
+
60
+ panel Ecm::Downloads::DownloadCategory.human_attribute_name(:link) do
61
+ div do
62
+ ecm_downloads_download_category_path(I18n.locale, ecm_downloads_download_category)
63
+ end
64
+ end
65
+
66
+ panel Ecm::Downloads::DownloadCategory.human_attribute_name(:children) do
67
+ 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
+ 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
74
+ column :description
75
+ column :ecm_downloads_downloads_count
76
+ end
77
+ end
78
+
79
+ panel Ecm::Downloads::DownloadCategory.human_attribute_name(:ecm_downloads_downloads) do
80
+ table_for ecm_downloads_download_category.ecm_downloads_downloads, :i18n => Ecm::Downloads::Download do
81
+ sortable_columns
82
+ column :position
83
+ column :locale
84
+ column(:name) { |ecm_downloads_download| link_to ecm_downloads_download, [:admin, ecm_downloads_download] }
85
+ column :asset_file_name
86
+ column :asset_file_size, :sortable => :asset_file_size do |download|
87
+ number_to_human_size(download.asset_file_size)
88
+ end
89
+ column :created_at
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,38 @@
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
@@ -0,0 +1,30 @@
1
+ .download_categories-tree {
2
+ background-color: white;
3
+ }
4
+
5
+ ul.tree, ul.tree ul {
6
+ background-color: inherit;
7
+ list-style-type: none;
8
+ background-image: url("<%= asset_path 'ecm_downloads/download_categories/vertical_line.png' %>");
9
+ background-repeat: repeat-y;
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+
14
+ .tree ul {
15
+ margin-left: 10px;
16
+ }
17
+
18
+ ul.tree li {
19
+ margin: 0;
20
+ padding: 0 12px;
21
+ line-height: 20px;
22
+ background: url("<%= asset_path 'ecm_downloads/download_categories/node.png' %>");
23
+ background-repeat: no-repeat;
24
+ }
25
+
26
+ ul.tree li:last-child {
27
+ background-color: white;
28
+ background-image: url("<%= asset_path 'ecm_downloads/download_categories/last_node.png' %>") !important;
29
+ background-repeat: no-repeat;
30
+ }
@@ -0,0 +1 @@
1
+ //= require_tree ./ecm_downloads
@@ -0,0 +1,9 @@
1
+ class Ecm::Downloads::DownloadCategoriesController < FrontendController
2
+ def index
3
+ @download_categories = Ecm::Downloads::DownloadCategory.all
4
+ end
5
+
6
+ def show
7
+ @download_category = Ecm::Downloads::DownloadCategory.find(params[:id])
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class Ecm::Downloads::DownloadsController < FrontendController
2
+ def index
3
+ @downloads = Ecm::Downloads::Download.all
4
+ end
5
+
6
+ def show
7
+ @download = Ecm::Downloads::Download.find(params[:id])
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ module Ecm::Downloads::DownloadCategoryHelper
2
+ def render_download_category(download_category_name, options = {})
3
+ download_category = ::Ecm::Downloads::DownloadCategory.where(:name => download_category_name).first
4
+ if download_category.nil?
5
+ I18n.t('ecm.downloads.download_category.messages.not_found', :name => download_category_name)
6
+ else
7
+ render download_category
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Ecm::Downloads::DownloadHelper
2
+ def render_download(download_name, options = {})
3
+ download = ::Ecm::Downloads::Download.where(:name => download_name).first
4
+ if download.nil?
5
+ I18n.t('ecm.downloads.download.messages.not_found', :name => download_name)
6
+ else
7
+ render download
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,87 @@
1
+ module FixUpdateCounters
2
+ def fix_updated_counters
3
+ self.changes.each {|key, value|
4
+ # key should match /master_files_id/ or /bibls_id/
5
+ # value should be an array ['old value', 'new value']
6
+ if key =~ /_id/
7
+ changed_class = key.sub(/_id/, '')
8
+
9
+ # Get real class of changed attribute, so work both with namespaced/normal models
10
+ klass = self.association(changed_class.to_sym).klass
11
+
12
+ # Try to get counter cache from association options
13
+ begin
14
+ counter_name = self.association(changed_class.to_sym).options[:counter_cache]
15
+ rescue
16
+ # Namespaced model return a slash, split it.
17
+ unless (counter_name = "#{self.class.name.underscore.pluralize.split("/")[1]}_count".to_sym)
18
+ counter_name = "#{self.class.name.underscore.pluralize}_count".to_sym
19
+ end
20
+ end
21
+
22
+
23
+ klass.decrement_counter(counter_name, value[0]) unless value[0] == nil
24
+ klass.increment_counter(counter_name, value[1]) unless value[1] == nil
25
+ end
26
+ }
27
+ end
28
+ end
29
+
30
+ ActiveRecord::Base.send(:include, FixUpdateCounters)
31
+
32
+
33
+
34
+ class Ecm::Downloads::Download < ActiveRecord::Base
35
+ # db settings
36
+ self.table_name = 'ecm_downloads_downloads'
37
+
38
+ # acts as list
39
+ acts_as_list :scope => :ecm_downloads_download_category
40
+
41
+ # associations
42
+ belongs_to :ecm_downloads_download_category,
43
+ :class_name => Ecm::Downloads::DownloadCategory,
44
+ :counter_cache => :ecm_downloads_downloads_count
45
+
46
+ # attibutes
47
+ attr_accessible :asset,
48
+ :description,
49
+ :ecm_downloads_download_category_id,
50
+ :locale,
51
+ :name
52
+
53
+ # callbacks
54
+ after_update :fix_updated_counters
55
+ before_update :fix_updated_position, :if => Proc.new { |d| !position.blank? && d.ecm_downloads_download_category_id_changed? }
56
+
57
+ # friendly id
58
+ extend FriendlyId
59
+ friendly_id :name, :use => :slugged
60
+
61
+ # paperclip
62
+ has_attached_file :asset
63
+
64
+ # validations
65
+ 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
68
+ validates_attachment_presence :asset
69
+
70
+ # public methods
71
+
72
+ def heading_name
73
+ locale_prefix = (locale.blank?) ? "" : "[#{locale}] "
74
+ "#{locale_prefix}#{name}"
75
+ end
76
+
77
+ def to_s
78
+ name
79
+ end
80
+
81
+ # private methods
82
+ private
83
+ def fix_updated_position
84
+ Rails.logger.debug "Fixing positions for #{self.to_s} (Moving to last)"
85
+ add_to_list_bottom
86
+ end
87
+ end
@@ -0,0 +1,64 @@
1
+ class Ecm::Downloads::DownloadCategory < ActiveRecord::Base
2
+ # db settings
3
+ self.table_name = 'ecm_downloads_download_categories'
4
+
5
+ # associations
6
+ has_many :ecm_downloads_downloads,
7
+ :class_name => Ecm::Downloads::Download,
8
+ :dependent => :destroy,
9
+ :foreign_key => :ecm_downloads_download_category_id,
10
+ :order => 'position'
11
+
12
+ # attributes
13
+ attr_accessible :description,
14
+ :ecm_courses_courses_count,
15
+ :locale,
16
+ :name,
17
+ :parent_id,
18
+ :position,
19
+ :slug
20
+
21
+ # awesome nested set
22
+ acts_as_nested_set
23
+ default_scope :order => 'lft ASC'
24
+
25
+ # friendly id
26
+ extend FriendlyId
27
+ friendly_id :name, :use => :slugged
28
+
29
+ # 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
+
35
+ # public methods
36
+
37
+ # public methods
38
+
39
+ def display_code
40
+ "<%= render_download_category '#{self.name}' %>"
41
+ end
42
+
43
+ def index_name
44
+ if self.root?
45
+ "[#{self.locale}] #{self.name}"
46
+ else
47
+ "#{'&#160;&#160;&#160;&#160;' * self.level} |--&#160;#{self.name}".html_safe
48
+ end
49
+ end
50
+
51
+ def to_s
52
+ name
53
+ end
54
+
55
+ def tree_name
56
+ root_prefix = (self.root?) ? "[#{self.locale}] " : ""
57
+
58
+ if ecm_downloads_downloads_count < 1
59
+ "#{root_prefix}#{to_s}"
60
+ else
61
+ "#{root_prefix}#{to_s} (#{ecm_downloads_downloads_count})"
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,29 @@
1
+ <div class="download_category" id="download_category-<%= download_category.id %>">
2
+ <% if action_name == 'show' %>
3
+ <h1 class="downloads_category-name"><%= download_category.name %></h1>
4
+ <% else %>
5
+ <h2 class="downloads_category-name"><%= download_category.name %></h2>
6
+ <% end %>
7
+
8
+ <div class="download_categories-tree">
9
+ <%= nested_li(download_category.descendants, {}) do |download_category| %>
10
+ <%= link_to download_category.tree_name, download_category %>
11
+ <% end %>
12
+ </div>
13
+
14
+ <% unless download_category.description.blank? %>
15
+ <div class="download_categories-description">
16
+ <p><%= download_category.description %></p>
17
+ </div>
18
+ <% end %>
19
+
20
+ <div class="download_category-downloads">
21
+ <h2><%= Ecm::Downloads::DownloadCategory.human_attribute_name(:ecm_downloads_downloads) %></h2>
22
+ <% if download_category.ecm_downloads_downloads_count == 0 %>
23
+ <%= t('ecm.downloads.download_category.messages.no_downloads_available') %>
24
+ <hr />
25
+ <% else %>
26
+ <%= render download_category.ecm_downloads_downloads %>
27
+ <% end %>
28
+ </div>
29
+ </div>
@@ -0,0 +1,7 @@
1
+ <h1><%= Ecm::Downloads::DownloadCategory.model_name.human(:count => :other) %></h1>
2
+
3
+ <div class="download_categories-tree">
4
+ <%= nested_li(@download_categories, {}) do |download_category| %>
5
+ <%= link_to download_category.tree_name, download_category %>
6
+ <% end %>
7
+ </div>
@@ -0,0 +1,9 @@
1
+ <%= render @download_category %>
2
+
3
+ <p>
4
+ <% if @download_category.root? %>
5
+ <%= link_to(t('ecm.downloads.download_category.actions.back_to_index'), ecm_downloads_download_categories_path) if respond_to?(:ecm_downloads_download_categories_path) %>
6
+ <% else %>
7
+ <%= link_to(Ecm::Downloads::DownloadCategory.human_attribute_name(:parent), @download_category.parent) %>
8
+ <% end %>
9
+ </p>
@@ -0,0 +1,19 @@
1
+ <div class="download" id="download-<%= download.id %>">
2
+ <h2><%= download.heading_name %></h2>
3
+ <ul>
4
+ <li class="download-asset_file_name"><%= Ecm::Downloads::Download.human_attribute_name(:asset_file_name) %>: <%= download.asset_file_name %></li>
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>
6
+ <li class="download-created_at"><%= Ecm::Downloads::Download.human_attribute_name(:created_at) %>: <%= l download.created_at %></li>
7
+ <li class="download-updated_at"><%= Ecm::Downloads::Download.human_attribute_name(:updated_at) %>: <%= l download.updated_at %></li>
8
+ </ul>
9
+ <% unless download.description.blank? %>
10
+ <div class="download-description">
11
+ <p><%= download.description %></p>
12
+ </div>
13
+ <% end %>
14
+ <div class="download-actions">
15
+ <p><%= link_to t('ecm.downloads.download.actions.start_download'), download.asset.url, { :class => 'download-link button' } %></p>
16
+ </div>
17
+ </div>
18
+
19
+ <hr />
@@ -0,0 +1,3 @@
1
+ <h1><%= Ecm::Downloads::Download.model_name.human(:count => :other) %></h1>
2
+
3
+ <%= render @downloads %>
@@ -0,0 +1,5 @@
1
+ <h1>Downloads</h1>
2
+
3
+ <%= render @download %>
4
+
5
+ <%= link_to @download.ecm_downloads_download_category, @download.ecm_downloads_download_category %>
@@ -0,0 +1,29 @@
1
+ de:
2
+ activerecord:
3
+ attributes:
4
+ admin_user:
5
+ id: ID
6
+ email: E-Mail
7
+ encrypted_Password: Verschlüsseltes Passwort
8
+ reset_password_token: Passwort Reset Token
9
+ reset_password_sent_at: Passwort Reset Anweisungen gesendet am
10
+ remember_created_at: Passwort merken seit
11
+ sign_in_count: Anzahl Logins
12
+ current_sign_in_at: Aktuell angemeldet seit
13
+ last_sign_in_at: Letzter Login am
14
+ current_sign_in_ip: Aktuelle IP-Adresse
15
+ last_sign_in_ip: Letzte IP-Adresse
16
+ created_at: Erstellt am
17
+ updated_at: Aktualisiert am
18
+ models:
19
+ admin_user:
20
+ one: Administrator
21
+ other: Administratoren
22
+ devise:
23
+ failure:
24
+ admin_user:
25
+ invalid: Benutzername oder Kennwort nicht korrekt.
26
+ unauthenticated: Bitte melden Sie sich als Administrator an.
27
+ sessions:
28
+ admin_user:
29
+ signed_in: Erfolgreich als Administrator angemeldet.
@@ -0,0 +1,16 @@
1
+ de:
2
+ ecm:
3
+ downloads:
4
+ active_admin:
5
+ menu: "Downloads"
6
+ download:
7
+ actions:
8
+ start_download: "Jetzt herunterladen"
9
+ messages:
10
+ not_found: "Download \"%{name}\" nicht gefunden."
11
+ download_category:
12
+ actions:
13
+ back_to_index: "Zurück zur Übersicht"
14
+ messages:
15
+ not_found: "Download Kategorie \"%{name}\" nicht gefunden."
16
+ no_downloads_available: "Keine Downloads in dieser Kategorie vorhanden."
@@ -0,0 +1,24 @@
1
+ ---
2
+ de:
3
+ activerecord:
4
+ attributes:
5
+ ecm/downloads/download:
6
+ asset: Datei
7
+ asset_content_type: Datei Content-Type
8
+ asset_file_name: Dateiname
9
+ asset_file_size: Dateigröße
10
+ asset_fingerprint: Fingerabdruck
11
+ asset_updated_at: Datei aktualisiert am
12
+ created_at: Erstellt am
13
+ description: Beschreibung
14
+ ecm_downloads_download_category: Download Kategorie
15
+ ecm_downloads_download_category_id: Download Kategorie
16
+ locale: Sprache
17
+ name: Name
18
+ position: Position
19
+ slug: Freundliche ID
20
+ updated_at: Aktualisiert am
21
+ models:
22
+ ecm/downloads/download:
23
+ one: Download
24
+ other: Downloads
@@ -0,0 +1,24 @@
1
+ ---
2
+ en:
3
+ activerecord:
4
+ attributes:
5
+ ecm/downloads/download:
6
+ asset: file
7
+ asset_content_type: content type
8
+ asset_file_name: filename
9
+ asset_file_size: filesize
10
+ asset_fingerprint: fingerprint
11
+ asset_updated_at: file updated at
12
+ created_at: created at
13
+ description: description
14
+ ecm_downloads_download_category: download category
15
+ ecm_downloads_download_category_id: download category
16
+ locale: locale
17
+ name: name
18
+ position: position
19
+ slug: friendly id
20
+ updated_at: updated at
21
+ models:
22
+ ecm/downloads/download:
23
+ one: download
24
+ other: downloads
@@ -0,0 +1,24 @@
1
+ ---
2
+ de:
3
+ activerecord:
4
+ attributes:
5
+ ecm/downloads/download_category:
6
+ children: Unter Kategorien
7
+ created_at: Erstellt am
8
+ depth: Baumtiefe
9
+ description: Beschreibung
10
+ ecm_downloads_downloads: Downloads
11
+ ecm_downloads_downloads_count: Downloads
12
+ lft: Links
13
+ locale: Sprache
14
+ name: Name
15
+ parent: Über Kategorie
16
+ parent_id: Über Kategorie
17
+ position: Position
18
+ rgt: Rechts
19
+ slug: Freundliche ID
20
+ updated_at: Aktualisiert am
21
+ models:
22
+ ecm/downloads/download_category:
23
+ one: Download Kategorie
24
+ other: Download Kategorien
@@ -0,0 +1,24 @@
1
+ ---
2
+ en:
3
+ activerecord:
4
+ attributes:
5
+ ecm/downloads/download_category:
6
+ children: children
7
+ created_at: created at
8
+ depth: depth
9
+ description: description
10
+ ecm_downloads_downloads: downloads
11
+ ecm_downloads_downloads_count: downloads
12
+ lft: left
13
+ locale: locale
14
+ name: name
15
+ parent: parent
16
+ parent_id: parent
17
+ position: position
18
+ rgt: right
19
+ slug: friendly id
20
+ updated_at: updated at
21
+ models:
22
+ ecm/downloads/download_category:
23
+ one: download category
24
+ other: download categories
@@ -0,0 +1,16 @@
1
+ en:
2
+ ecm:
3
+ downloads:
4
+ active_admin:
5
+ menu: "Downloads"
6
+ download:
7
+ actions:
8
+ start_download: "Download now"
9
+ messages:
10
+ not_found: "Download \"%{name}\" not found."
11
+ download_category:
12
+ actions:
13
+ back_to_index: "Back to the index"
14
+ messages:
15
+ not_found: "Download category \"%{name}\" not found."
16
+ no_downloads_available: "There are now downloads in this category."
@@ -0,0 +1,4 @@
1
+ de:
2
+ resources:
3
+ ecm_downloads_downloads: downloads
4
+ ecm_downloads_download_categories: download-kategorien
@@ -0,0 +1,4 @@
1
+ en:
2
+ resources:
3
+ ecm_downloads_downloads: downloads
4
+ ecm_downloads_download_categories: download-categories
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ ## Rails.application.routes.draw do
2
+ #Ecm::Downloads::Engine.routes.draw do
3
+ # resources :ecm_downloads_download_categories, :only => [ :index, :show ], :controller => 'ecm/downloads/download_categories'
4
+ # resources :ecm_downloads_downloads, :only => [ :index, :show ], :controller => 'ecm/downloads/downloads'
5
+ #end
@@ -0,0 +1,24 @@
1
+ class CreateEcmDownloadsDownloadCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_downloads_download_categories do |t|
4
+ t.string :name
5
+ t.text :description
6
+ t.string :locale
7
+ t.integer :position
8
+
9
+ # references
10
+ t.integer :ecm_downloads_downloads_count, :default => 0, :null => false
11
+
12
+ # awesome nested set
13
+ t.integer :parent_id
14
+ t.integer :lft
15
+ t.integer :rgt
16
+ t.integer :depth
17
+
18
+ # frienldy id
19
+ t.string :slug
20
+
21
+ t.timestamps
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ class CreateEcmDownloadsDownloads < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_downloads_downloads do |t|
4
+ t.string :name
5
+ t.text :description
6
+ t.string :locale
7
+
8
+ # references
9
+ t.references :ecm_downloads_download_category
10
+
11
+ # acts as list
12
+ t.integer :position
13
+
14
+ # friendly id
15
+ t.string :slug
16
+
17
+ # paperclip
18
+ # t.attachment :asset
19
+ t.string :asset_file_name
20
+ t.integer :asset_file_size
21
+ t.string :asset_content_type
22
+ t.timestamp :asset_updated_at
23
+ t.string :asset_fingerprint
24
+
25
+ t.timestamps
26
+ end
27
+ add_index :ecm_downloads_downloads, :ecm_downloads_download_category_id,:name => 'index_ecm_downloads_downloads_on_download_category_id'
28
+ end
29
+ end
@@ -0,0 +1,25 @@
1
+ module Ecm
2
+ module Downloads
3
+ class Engine < Rails::Engine
4
+ # endpoint
5
+
6
+ # active admin
7
+ initializer :ecm_courses_engine do
8
+ ::ActiveAdmin.setup do |active_admin_config|
9
+ active_admin_config.load_paths += Dir[File.dirname(__FILE__) + '/../../../app/admin']
10
+ end
11
+ end if defined?(::ActiveAdmin)
12
+
13
+ # controllers
14
+ # paths["app/controllers"] << File.dirname(__FILE__) + '/../../../app/controllers'
15
+
16
+ # helpers
17
+ config.to_prepare do
18
+ ApplicationController.helper(Ecm::Downloads::DownloadCategoryHelper)
19
+ end
20
+
21
+ # locales
22
+ paths["config/locales"] << File.dirname(__FILE__) + '/../../../config/locales'
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ module Ecm
2
+ module Downloads
3
+ class Routing
4
+ # Creates the routes for downloads and categories. You can pass options to
5
+ # specify the actions for both downloads and/or categories.
6
+ #
7
+ # Ecm::Downloads::Routing.routes(self, { :download_category_actions => [ :show ]})
8
+ #
9
+ # This will only create the show action for download categories, but omit the index action.
10
+ def self.routes(router, options = {})
11
+ options.reverse_merge!(
12
+ { :download_category_actions => [:index, :show],
13
+ :download_actions => [:index, :show]
14
+ }
15
+ )
16
+
17
+ 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
@@ -0,0 +1,5 @@
1
+ module Ecm
2
+ module Downloads
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ require 'active_admin-acts_as_list'
4
+ require 'active_admin-awesome_nested_set'
5
+ require 'acts_as_list'
6
+ require 'awesome_nested_set'
7
+ require 'awesome_nested_set-tools'
8
+ require 'friendly_id'
9
+ require 'rails_tools-absence_validator'
10
+ require 'paperclip'
11
+
12
+ require 'ecm/downloads/engine'
13
+ require 'ecm/downloads/routing'
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :ecm_downloads do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,302 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ecm_downloads
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.2
6
+ platform: ruby
7
+ authors:
8
+ - Roberto Vasquez Angel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-07-19 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rails
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 3.2.6
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: active_admin-acts_as_list
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ type: :runtime
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: active_admin-awesome_nested_set
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: acts_as_list
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: 0.1.6
57
+ type: :runtime
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: awesome_nested_set
61
+ prerelease: false
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 2.1.3
68
+ type: :runtime
69
+ version_requirements: *id005
70
+ - !ruby/object:Gem::Dependency
71
+ name: awesome_nested_set-tools
72
+ prerelease: false
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ type: :runtime
80
+ version_requirements: *id006
81
+ - !ruby/object:Gem::Dependency
82
+ name: friendly_id
83
+ prerelease: false
84
+ requirement: &id007 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 4.0.7
90
+ type: :runtime
91
+ version_requirements: *id007
92
+ - !ruby/object:Gem::Dependency
93
+ name: paperclip
94
+ prerelease: false
95
+ requirement: &id008 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ~>
99
+ - !ruby/object:Gem::Version
100
+ version: "2.7"
101
+ type: :runtime
102
+ version_requirements: *id008
103
+ - !ruby/object:Gem::Dependency
104
+ name: rails_tools-absence_validator
105
+ prerelease: false
106
+ requirement: &id009 !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ version: 0.0.1
112
+ type: :runtime
113
+ version_requirements: *id009
114
+ - !ruby/object:Gem::Dependency
115
+ name: sqlite3
116
+ prerelease: false
117
+ requirement: &id010 !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: "0"
123
+ type: :development
124
+ version_requirements: *id010
125
+ - !ruby/object:Gem::Dependency
126
+ name: thin
127
+ prerelease: false
128
+ requirement: &id011 !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: "0"
134
+ type: :development
135
+ version_requirements: *id011
136
+ - !ruby/object:Gem::Dependency
137
+ name: yard
138
+ prerelease: false
139
+ requirement: &id012 !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: "0"
145
+ type: :development
146
+ version_requirements: *id012
147
+ - !ruby/object:Gem::Dependency
148
+ name: rspec-rails
149
+ prerelease: false
150
+ requirement: &id013 !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ~>
154
+ - !ruby/object:Gem::Version
155
+ version: "2.0"
156
+ type: :development
157
+ version_requirements: *id013
158
+ - !ruby/object:Gem::Dependency
159
+ name: factory_girl_rails
160
+ prerelease: false
161
+ requirement: &id014 !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ~>
165
+ - !ruby/object:Gem::Version
166
+ version: "3.0"
167
+ type: :development
168
+ version_requirements: *id014
169
+ - !ruby/object:Gem::Dependency
170
+ name: shoulda-matchers
171
+ prerelease: false
172
+ requirement: &id015 !ruby/object:Gem::Requirement
173
+ none: false
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: "0"
178
+ type: :development
179
+ version_requirements: *id015
180
+ - !ruby/object:Gem::Dependency
181
+ name: capybara
182
+ prerelease: false
183
+ requirement: &id016 !ruby/object:Gem::Requirement
184
+ none: false
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: "0"
189
+ type: :development
190
+ version_requirements: *id016
191
+ - !ruby/object:Gem::Dependency
192
+ name: sass-rails
193
+ prerelease: false
194
+ requirement: &id017 !ruby/object:Gem::Requirement
195
+ none: false
196
+ requirements:
197
+ - - ">="
198
+ - !ruby/object:Gem::Version
199
+ version: "0"
200
+ type: :development
201
+ version_requirements: *id017
202
+ - !ruby/object:Gem::Dependency
203
+ name: meta_search
204
+ prerelease: false
205
+ requirement: &id018 !ruby/object:Gem::Requirement
206
+ none: false
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: 1.1.0.pre
211
+ type: :development
212
+ version_requirements: *id018
213
+ - !ruby/object:Gem::Dependency
214
+ name: coffee-rails
215
+ prerelease: false
216
+ requirement: &id019 !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ version: "0"
222
+ type: :development
223
+ version_requirements: *id019
224
+ description: Provides downloads for active admin.
225
+ email:
226
+ - roberto@vasquez-angel.de
227
+ executables: []
228
+
229
+ extensions: []
230
+
231
+ extra_rdoc_files: []
232
+
233
+ files:
234
+ - app/controllers/ecm/downloads/downloads_controller.rb
235
+ - app/controllers/ecm/downloads/download_categories_controller.rb
236
+ - app/helpers/ecm/downloads/download_helper.rb
237
+ - app/helpers/ecm/downloads/download_category_helper.rb
238
+ - app/views/ecm/downloads/download_categories/_download_category.html.erb
239
+ - app/views/ecm/downloads/download_categories/index.de.html.erb
240
+ - app/views/ecm/downloads/download_categories/show.de.html.erb
241
+ - app/views/ecm/downloads/downloads/index.de.html.erb
242
+ - app/views/ecm/downloads/downloads/show.de.html.erb
243
+ - app/views/ecm/downloads/downloads/_download.html.erb
244
+ - app/models/ecm/downloads/download_category.rb
245
+ - app/models/ecm/downloads/download.rb
246
+ - app/admin/ecm_downloads_downloads.rb
247
+ - app/admin/ecm_downloads_download_categories.rb
248
+ - app/assets/images/ecm_downloads/download_categories/last_node.png
249
+ - app/assets/images/ecm_downloads/download_categories/node.png
250
+ - app/assets/images/ecm_downloads/download_categories/vertical_line.png
251
+ - app/assets/stylesheets/ecm_downloads.css
252
+ - app/assets/stylesheets/ecm_downloads/downloads_categories.css.erb
253
+ - config/routes.rb
254
+ - config/locales/ecm.downloads.routes.en.yml
255
+ - config/locales/ecm.downloads.download.de.yml
256
+ - config/locales/ecm.downloads.download_category.de.yml
257
+ - config/locales/active_admin.patch.de.yml
258
+ - config/locales/ecm.downloads.download_category.en.yml
259
+ - config/locales/ecm.downloads.routes.de.yml
260
+ - config/locales/ecm.downloads.en.yml
261
+ - config/locales/ecm.downloads.de.yml
262
+ - config/locales/ecm.downloads.download.en.yml
263
+ - db/migrate/001_create_ecm_downloads_download_categories.rb
264
+ - db/migrate/002_create_ecm_downloads_downloads.rb
265
+ - lib/tasks/ecm_downloads_tasks.rake
266
+ - lib/ecm/downloads/engine.rb
267
+ - lib/ecm/downloads/version.rb
268
+ - lib/ecm/downloads/routing.rb
269
+ - lib/ecm_downloads.rb
270
+ - MIT-LICENSE
271
+ - Rakefile
272
+ - README.rdoc
273
+ homepage: https://github.com/robotex82/ecm_downloads
274
+ licenses: []
275
+
276
+ post_install_message:
277
+ rdoc_options: []
278
+
279
+ require_paths:
280
+ - lib
281
+ required_ruby_version: !ruby/object:Gem::Requirement
282
+ none: false
283
+ requirements:
284
+ - - ">="
285
+ - !ruby/object:Gem::Version
286
+ version: "0"
287
+ required_rubygems_version: !ruby/object:Gem::Requirement
288
+ none: false
289
+ requirements:
290
+ - - ">="
291
+ - !ruby/object:Gem::Version
292
+ version: "0"
293
+ requirements: []
294
+
295
+ rubyforge_project:
296
+ rubygems_version: 1.8.24
297
+ signing_key:
298
+ specification_version: 3
299
+ summary: Provides downloads for active admin.
300
+ test_files: []
301
+
302
+ has_rdoc: