ecm_links 0.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +61 -0
  3. data/Rakefile +26 -0
  4. data/app/controllers/ecm/links/categories_controller.rb +9 -0
  5. data/app/helpers/ecm/links/categories_helper.rb +5 -0
  6. data/app/helpers/ecm/links/links_helper.rb +5 -0
  7. data/app/helpers/ecm/links_helper.rb +7 -0
  8. data/app/models/ecm/links/category.rb +68 -0
  9. data/app/models/ecm/links/link.rb +43 -0
  10. data/app/views/ecm/links/_link_footer.html.erb +14 -0
  11. data/app/views/ecm/links/categories/_category.html.erb +1 -0
  12. data/app/views/ecm/links/categories/index.html.erb +11 -0
  13. data/app/views/ecm/links/links/_link.html.erb +1 -0
  14. data/config/locales/ecm.links.category.de.yml +26 -0
  15. data/config/locales/ecm.links.category.en.yml +26 -0
  16. data/config/locales/ecm.links.de.yml +5 -0
  17. data/config/locales/ecm.links.en.yml +5 -0
  18. data/config/locales/ecm.links.link.de.yml +18 -0
  19. data/config/locales/ecm.links.link.en.yml +18 -0
  20. data/db/migrate/001_create_ecm_links_categories.rb +26 -0
  21. data/db/migrate/002_create_ecm_links_links.rb +19 -0
  22. data/lib/ecm/links/active_admin/ecm_links_categories.rb +104 -0
  23. data/lib/ecm/links/active_admin/ecm_links_links.rb +49 -0
  24. data/lib/ecm/links/configuration.rb +19 -0
  25. data/lib/ecm/links/engine.rb +12 -0
  26. data/lib/ecm/links/routing.rb +37 -0
  27. data/lib/ecm/links/version.rb +5 -0
  28. data/lib/ecm_links.rb +18 -0
  29. data/lib/generators/ecm/links/install/install_generator.rb +15 -0
  30. data/lib/generators/ecm/links/install/templates/ecm_links.rb +7 -0
  31. data/lib/generators/ecm/links/locales/locales_generator.rb +20 -0
  32. data/lib/tasks/ecm_links_tasks.rake +50 -0
  33. metadata +448 -0
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Roberto Vasquez Angel
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.
@@ -0,0 +1,61 @@
1
+ = ECM Links
2
+
3
+ = Installation
4
+
5
+
6
+ Add it to your gemfile:
7
+
8
+ # Gemfile
9
+ gem 'ecm_links'
10
+
11
+ Install your bundle:
12
+
13
+ > bundle install
14
+
15
+ Generate initializer:
16
+
17
+ > rails generate ecm:links:install
18
+
19
+ Generatre the migrations:
20
+
21
+ > rake ecm_links_engine:install:migrations
22
+
23
+ Migrate:
24
+
25
+ > rake db:migrate
26
+
27
+
28
+ == Optional: Generate locale files
29
+
30
+ You may want to copy the locales to your app:
31
+
32
+ > rails generate ecm:links:locales
33
+
34
+
35
+ == Optional: Example data generation/Data management
36
+
37
+ There are following rake tasks to manage the database content:
38
+
39
+ * rake ecm_links:db:clear! # Clears all data!
40
+ * rake ecm_links:db:populate # Creates example_data
41
+ * rake ecm_links:db:populate! # Purges and creates example data
42
+
43
+ = Usage
44
+
45
+ Use the helper to display the link footer:
46
+
47
+ # i.e. app/views/layouts/application.html.erb
48
+ <%= render_link_footer %>
49
+
50
+ == Optional: Display a link tree
51
+
52
+ To display a link tree, you have to add the routes:
53
+
54
+ # config/routes.rb
55
+ Ecm::Links::Routing.routes(self)
56
+
57
+ This will give you a route to /ecm_links_categories
58
+
59
+ = License
60
+
61
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,26 @@
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 = 'EcmLinks'
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
+
26
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,9 @@
1
+ class Ecm::Links::CategoriesController < ApplicationController
2
+ def index
3
+ @link_categories = ::Ecm::Links::Category.includes(:ecm_links_links)
4
+ end
5
+
6
+ def show
7
+ @link_category = ::Ecm::Links::Category.includes(:ecm_links_links).find(params[:id])
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Ecm::Links::CategoriesHelper
2
+ def render_link_category(link_category, options = {})
3
+ render link_category
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Ecm::Links::LinksHelper
2
+ def render_link(link, options = {})
3
+ render link
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module Ecm::LinksHelper
2
+ def render_link_footer(categories = nil, options = {})
3
+ categories = Ecm::Links::Category.for_link_footer.all if categories.nil?
4
+ grouped_categories = categories.group_by(&:link_footer_column)
5
+ render(:partial => 'ecm/links/link_footer', :locals => { :categories => grouped_categories })
6
+ end
7
+ end
@@ -0,0 +1,68 @@
1
+ class Ecm::Links::Category < ActiveRecord::Base
2
+ # database settings
3
+ self.table_name = 'ecm_links_categories'
4
+
5
+ # acts as markup
6
+ acts_as_markup :language => :variable, :columns => [ :long_description, :short_description ]
7
+
8
+ # associations
9
+ has_many :ecm_links_links,
10
+ :class_name => Ecm::Links::Link,
11
+ :dependent => :destroy,
12
+ :foreign_key => :ecm_links_category_id,
13
+ :order => 'position'
14
+
15
+ # attributes
16
+ attr_accessible :depth,
17
+ :ecm_links_links_attributes,
18
+ :lft,
19
+ :link_footer_column,
20
+ :locale,
21
+ :long_description,
22
+ :markup_language,
23
+ :name,
24
+ :parent_id,
25
+ :rgt,
26
+ :short_description,
27
+ :slug
28
+ accepts_nested_attributes_for :ecm_links_links, :allow_destroy => true
29
+
30
+ # awesome nested set
31
+ acts_as_nested_set
32
+ default_scope :order => 'lft ASC'
33
+
34
+ # callbacks
35
+ after_initialize :set_defaults
36
+
37
+ # constants
38
+ MARKUP_LANGUAGES = %w(markdown textile rdoc)
39
+
40
+ # friendly id
41
+ extend FriendlyId
42
+ friendly_id :name, :use => :slugged
43
+
44
+ # validations
45
+ validates :locale, :presence => true, :if => Proc.new { |c| c.parent.nil? }
46
+ validates :locale, :absence => true, :if => Proc.new { |c| !c.parent.nil? }
47
+ validates :name, :presence => true,
48
+ :uniqueness => { :scope => [ :parent_id ] }
49
+ validates :markup_language, :presence => true,
50
+ :inclusion => MARKUP_LANGUAGES
51
+
52
+ def to_s
53
+ name
54
+ end
55
+
56
+ def self.for_link_footer
57
+ where(self.arel_table['link_footer_column'].not_eq(nil))
58
+ end
59
+
60
+ private
61
+ # private methods
62
+
63
+ def set_defaults
64
+ if self.new_record?
65
+ self.markup_language ||= 'textile'
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,43 @@
1
+ class Ecm::Links::Link < ActiveRecord::Base
2
+ # database settings
3
+ self.table_name = 'ecm_links_links'
4
+
5
+ # acts as list
6
+ acts_as_list :scope => :ecm_links_category
7
+
8
+ # acts as markup
9
+ acts_as_markup :language => :variable, :columns => [ :description ]
10
+
11
+ # associations
12
+ belongs_to :ecm_links_category,
13
+ :class_name => Ecm::Links::Category,
14
+ :counter_cache => :ecm_links_links_count
15
+
16
+ # attributes
17
+ attr_accessible :description,
18
+ :ecm_links_category_id,
19
+ :markup_language,
20
+ :name,
21
+ :position,
22
+ :url
23
+
24
+ # callbacks
25
+ after_initialize :set_defaults
26
+
27
+ # constants
28
+ MARKUP_LANGUAGES = %w(markdown textile rdoc)
29
+
30
+ # validations
31
+ validates :name, :presence => true, :uniqueness => { :scope => [ :ecm_links_category_id ] }
32
+ validates :url, :presence => true, :uniqueness => { :scope => [ :ecm_links_category_id ] }
33
+ validates :markup_language, :presence => true,
34
+ :inclusion => MARKUP_LANGUAGES
35
+
36
+ private
37
+
38
+ def set_defaults
39
+ if self.new_record?
40
+ self.markup_language ||= 'textile'
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,14 @@
1
+ <div class="row link_footer">
2
+ <% Ecm::Links::Configuration.link_footer_columns.times do |column| %>
3
+ <div class="column<%= column + 1 %> <%= Ecm::Links::Configuration.link_footer_column_css_classes.join(' ') %>">
4
+ <% categories[column + 1].each do |c| %>
5
+ <h2><%= c.name %></h2>
6
+
7
+ <% c.ecm_links_links.each do |l| %>
8
+ <p><%= render l %></p>
9
+ <% end %>
10
+
11
+ <% end if categories.has_key?(column + 1) %>
12
+ </div>
13
+ <% end %>
14
+ </div>
@@ -0,0 +1 @@
1
+ <h2><%= category.name %></h2>
@@ -0,0 +1,11 @@
1
+ <h1><%= Ecm::Links::Category.model_name.human(:count => :other) %></h1>
2
+
3
+ <%= nested_li(@link_categories, { :tree_css_class => 'tree unstyled' }) do |c, level| %>
4
+ <%= c.to_s %>
5
+ <ul>
6
+ <% c.ecm_links_links.each do |l| %>
7
+ <li><%= render l %></li>
8
+ <% end %>
9
+ </ul>
10
+ <% end %>
11
+
@@ -0,0 +1 @@
1
+ <%= link_to link.name, link.url, { :title => link.description } %>
@@ -0,0 +1,26 @@
1
+ ---
2
+ de:
3
+ activerecord:
4
+ models:
5
+ ecm/links/category:
6
+ one: Link Kategorie
7
+ other: Link Kategorien
8
+ attributes:
9
+ ecm/links/category:
10
+ name: Name
11
+ ecm_links_links: Links
12
+ ecm_links_links_count: Links
13
+ slug: Freundliche ID
14
+ created_at: Erstellt am
15
+ short_description: Kurzbeschreibung
16
+ updated_at: Aktualisiert am
17
+ depth: Tiefe
18
+ lft: Links
19
+ long_description: Langbeschreibung
20
+ markup_language: Markup Sprache
21
+ parent_id: Über Kategorie
22
+ locale: Sprache
23
+ rgt: Rechts
24
+ link_footer_column: Link Footer Spalte
25
+ children: Unterkategorien
26
+
@@ -0,0 +1,26 @@
1
+ ---
2
+ en:
3
+ activerecord:
4
+ models:
5
+ ecm/links/category:
6
+ one: link category
7
+ other: link categories
8
+ attributes:
9
+ ecm/links/category:
10
+ name: name
11
+ ecm_links_links: links
12
+ ecm_links_links_count: links
13
+ slug: friendly id
14
+ created_at: created at
15
+ short_description: short description
16
+ updated_at: updated at
17
+ depth: depth
18
+ lft: left
19
+ long_description: long description
20
+ markup_language: markup language
21
+ parent_id: parent category
22
+ locale: language
23
+ rgt: right
24
+ link_footer_column: link footer column
25
+ children: Subcategories
26
+
@@ -0,0 +1,5 @@
1
+ de:
2
+ ecm:
3
+ links:
4
+ active_admin:
5
+ menu: Links
@@ -0,0 +1,5 @@
1
+ en:
2
+ ecm:
3
+ links:
4
+ active_admin:
5
+ menu: links
@@ -0,0 +1,18 @@
1
+ ---
2
+ de:
3
+ activerecord:
4
+ models:
5
+ ecm/links/link:
6
+ one: Link
7
+ other: Links
8
+ attributes:
9
+ ecm/links/link:
10
+ position: Position
11
+ name: Name
12
+ created_at: Erstellt am
13
+ updated_at: Aktualisiert am
14
+ url: URL
15
+ ecm_links_category: Link Kategorie
16
+ ecm_links_category_id: Link Kategorie
17
+ markup_language: Markup Sprache
18
+ description: Beschreibung
@@ -0,0 +1,18 @@
1
+ ---
2
+ en:
3
+ activerecord:
4
+ models:
5
+ ecm/links/link:
6
+ one: link
7
+ other: links
8
+ attributes:
9
+ ecm/links/link:
10
+ position: position
11
+ name: name
12
+ created_at: created at
13
+ updated_at: updated at
14
+ url: url
15
+ ecm_links_category: link category
16
+ ecm_links_category_id: link category
17
+ markup_language: markup language
18
+ description: description
@@ -0,0 +1,26 @@
1
+ class CreateEcmLinksCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_links_categories do |t|
4
+ t.string :locale
5
+ t.string :name
6
+ t.text :short_description
7
+ t.text :long_description
8
+ t.string :markup_language
9
+ t.integer :link_footer_column
10
+
11
+ # associations
12
+ t.integer :ecm_links_links_count, :default => 0, :null => false
13
+
14
+ # awesome nested set
15
+ t.integer :lft
16
+ t.integer :rgt
17
+ t.integer :parent_id
18
+ t.integer :depth
19
+
20
+ # friendly id
21
+ t.string :slug
22
+
23
+ t.timestamps
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,19 @@
1
+ class CreateEcmLinksLinks < ActiveRecord::Migration
2
+ def change
3
+ create_table :ecm_links_links do |t|
4
+ t.string :name
5
+ t.string :url
6
+ t.text :description
7
+ t.string :markup_language
8
+
9
+ # associations
10
+ t.references :ecm_links_category
11
+
12
+ # acts as list
13
+ t.integer :position
14
+
15
+ t.timestamps
16
+ end
17
+ add_index :ecm_links_links, :ecm_links_category_id
18
+ end
19
+ end
@@ -0,0 +1,104 @@
1
+ include ActiveAdmin::ActsAsList::Helper if defined?(ActiveAdmin)
2
+ include ActiveAdmin::AwesomeNestedSet::Helper if defined?(ActiveAdmin)
3
+
4
+ ActiveAdmin.register Ecm::Links::Category do
5
+ # menu entry settings
6
+ menu :parent => Proc.new { I18n.t('ecm.links.active_admin.menu') }.call
7
+
8
+ # awesome nested set
9
+ sortable_tree_member_actions
10
+
11
+ form do |f|
12
+ f.inputs do
13
+ f.input :parent, :as => :select, :collection => nested_set_options(Ecm::Links::Category, f.object) { |c| "#{'&#160;&#160;&#160;&#160;' * c.level} |-- #{c.to_s}".html_safe }
14
+ f.input :locale, :as => :select, :collection => I18n.available_locales.map(&:to_s)
15
+ f.input :name
16
+ f.input :short_description
17
+ f.input :long_description
18
+ end
19
+
20
+ f.inputs do
21
+ f.input :markup_language, :as => :select, :collection => Ecm::Links::Category::MARKUP_LANGUAGES
22
+ f.input :link_footer_column, :as => :select, :collection => (1..Ecm::Links::Configuration.link_footer_columns).to_a
23
+ end
24
+
25
+ f.inputs do
26
+ f.has_many :ecm_links_links do |l|
27
+ if l.object.persisted?
28
+ l.input :_destroy, :as => :boolean, :label => I18n.t('active_admin.delete')
29
+ end
30
+ l.input :name
31
+ l.input :url
32
+ l.input :description
33
+ end
34
+ end
35
+
36
+ f.actions
37
+ end
38
+
39
+ index :as => :nested_set do
40
+ selectable_column
41
+ sortable_tree_columns
42
+ column :locale
43
+ column :name do |c|
44
+ span(:style => "margin-left: #{30 * c.level}px") { c.name }
45
+ end
46
+ column :short_description
47
+ column :ecm_links_links_count
48
+ column :link_footer_column
49
+ column :created_at
50
+ column :updated_at
51
+ default_actions
52
+ end
53
+
54
+ show do
55
+ attributes_table do
56
+ row :parent
57
+ row :locale
58
+ row :name
59
+ row :ecm_links_links_count
60
+ row :markup_language
61
+ row :link_footer_column
62
+ row :created_at
63
+ row :updated_at
64
+ end
65
+
66
+ panel Ecm::Links::Category.human_attribute_name(:short_description) do
67
+ div { ecm_links_category.short_description }
68
+ end
69
+
70
+ panel Ecm::Links::Category.human_attribute_name(:long_description) do
71
+ div { ecm_links_category.long_description }
72
+ end
73
+
74
+ panel Ecm::Links::Category.human_attribute_name(:children) do
75
+ table_for ecm_links_category.descendants, :i18n => Ecm::Links::Category do
76
+ sortable_tree_columns
77
+ column(:name) { |child| link_to child, [:admin, child], :style => "margin-left: #{30 * (child.level - ecm_links_category.level - 1)}px" }
78
+ column :short_description
79
+ column :ecm_links_links_count
80
+ column :link_footer_column
81
+ column :created_at
82
+ column :updated_at
83
+ column do |child|
84
+ link_to(I18n.t('active_admin.view'), [:admin, child], :class => "member_link view_link") +
85
+ link_to(I18n.t('active_admin.edit'), [:edit, :admin, child], :class => "member_link edit_link")
86
+ end
87
+ end
88
+ end
89
+
90
+ panel Ecm::Links::Category.human_attribute_name(:ecm_links_links) do
91
+ table_for ecm_links_category.ecm_links_links, :i18n => Ecm::Links::Link do
92
+ sortable_columns
93
+ column(:name) { |link| link_to link.name, [:admin, link] }
94
+ column(:url) { |link| link_to link.url, link.url }
95
+ column :created_at
96
+ column :updated_at
97
+ column do |link|
98
+ link_to(I18n.t('active_admin.view'), [:admin, link], :class => "member_link view_link") +
99
+ link_to(I18n.t('active_admin.edit'), [:edit, :admin, link], :class => "member_link edit_link")
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end if defined?(ActiveAdmin)
@@ -0,0 +1,49 @@
1
+ include ActiveAdmin::ActsAsList::Helper if defined?(ActiveAdmin)
2
+
3
+ ActiveAdmin.register Ecm::Links::Link do
4
+ # menu entry settings
5
+ menu :parent => Proc.new { I18n.t('ecm.links.active_admin.menu') }.call
6
+
7
+ # acts as list
8
+ sortable_member_actions
9
+
10
+ form do |f|
11
+ f.inputs do
12
+ f.input :ecm_links_category, :as => :select, :collection => nested_set_options(Ecm::Links::Category) { |c| "#{'&#160;&#160;&#160;&#160;' * c.level} |-- #{c.to_s}".html_safe }
13
+ f.input :name
14
+ f.input :url
15
+ f.input :description
16
+ end
17
+
18
+ f.inputs do
19
+ f.input :markup_language, :as => :select, :collection => Ecm::Links::Link::MARKUP_LANGUAGES
20
+ end
21
+
22
+ f.actions
23
+ end
24
+
25
+ index do
26
+ selectable_column
27
+ column :ecm_links_category
28
+ column :name
29
+ column :url
30
+ column :created_at
31
+ column :updated_at
32
+ default_actions
33
+ end
34
+
35
+ show do
36
+ attributes_table do
37
+ row :ecm_links_category
38
+ row :name
39
+ row :url
40
+ row :markup_language
41
+ row :created_at
42
+ row :updated_at
43
+ end
44
+
45
+ panel Ecm::Links::Link.human_attribute_name(:description) do
46
+ div { ecm_links_link.description }
47
+ end
48
+ end
49
+ end if defined?(ActiveAdmin)
@@ -0,0 +1,19 @@
1
+ require 'active_support/core_ext/module/delegation'
2
+ require 'active_support/core_ext/module/attribute_accessors'
3
+ require 'active_support/hash_with_indifferent_access'
4
+
5
+ module Ecm
6
+ module Links
7
+ module Configuration
8
+ def configure
9
+ yield self
10
+ end
11
+
12
+ mattr_accessor :link_footer_columns
13
+ @@link_footer_columns = nil
14
+
15
+ mattr_accessor :link_footer_column_css_classes
16
+ @@link_footer_column_css_classes = nil
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ module Ecm
2
+ module Links
3
+ class Engine < ::Rails::Engine
4
+ # active admin
5
+ initializer :ecm_links_engine do
6
+ ::ActiveAdmin.setup do |active_admin_config|
7
+ active_admin_config.load_paths += Dir[File.dirname(__FILE__) + '/active_admin']
8
+ end
9
+ end if defined?(::ActiveAdmin)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,37 @@
1
+ module Ecm
2
+ module Links
3
+ class Routing
4
+ # Creates the routes for categories. You can pass options to
5
+ # specify the actions for categories.
6
+ #
7
+ # Ecm::Links::Routing.routes(self, { :links_category_actions => [ :index ]})
8
+ #
9
+ # This will only create the index action for link categories.
10
+ def self.routes(router, options = {})
11
+ options.reverse_merge!(
12
+ { :links_category_actions => [ :index ]
13
+ }
14
+ )
15
+
16
+ router.resources :ecm_links_categories, :only => options[:links_category_actions], :controller => 'ecm/links/categories'
17
+ end
18
+ # # Creates the routes for links and categories. You can pass options to
19
+ # # specify the actions for both links and/or categories.
20
+ # #
21
+ # # Ecm::Links::Routing.routes(self, { :link_category_actions => [ :show ]})
22
+ # #
23
+ # # This will only create the show action for link categories, but omit the index action.
24
+ # def self.routes(router, options = {})
25
+ # options.reverse_merge!(
26
+ # { :link_category_actions => [:index, :show],
27
+ # :link_actions => [:index, :show]
28
+ # }
29
+ # )
30
+ #
31
+ # router.resources :ecm_links_categories, :only => options[:link_category_actions], :controller => 'ecm/links/link_categories'
32
+ # router.resources :ecm_links_links,:only => options[:link_actions], :controller => 'ecm/products/links'
33
+ # end
34
+ end
35
+ end
36
+ end
37
+
@@ -0,0 +1,5 @@
1
+ module Ecm
2
+ module Links
3
+ VERSION = "0.0.1.pre"
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ require 'active_admin-acts_as_list'
2
+ require 'active_admin-awesome_nested_set'
3
+ require 'acts_as_list'
4
+ require 'acts_as_markup'
5
+ require 'awesome_nested_set'
6
+ require 'awesome_nested_set-tools'
7
+ require 'friendly_id'
8
+ require 'rails_tools-absence_validator'
9
+
10
+ require 'ecm/links/engine'
11
+ require 'ecm/links/configuration'
12
+ require 'ecm/links/routing'
13
+
14
+ module Ecm
15
+ module Links
16
+ extend Configuration
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ module Ecm
2
+ module Links
3
+ module Generators
4
+ class InstallGenerator < Rails::Generators::Base
5
+ desc "Generates the intializer"
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def generate_intializer
10
+ copy_file "ecm_links.rb", "config/initializers/ecm_links.rb"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ Ecm::Links.configure do |config|
2
+ # Configure your link footer columns here.
3
+ config.link_footer_columns = 4
4
+
5
+ # Configure your link footer colum css classes here.
6
+ config.link_footer_column_css_classes = %w[ footer-column span3 ]
7
+ end
@@ -0,0 +1,20 @@
1
+ module Ecm
2
+ module Links
3
+ module Generators
4
+ class LocalesGenerator < Rails::Generators::Base
5
+ desc "Copies the locale files to your application"
6
+
7
+ source_root File.expand_path('../../../../../../config/locales', __FILE__)
8
+
9
+ def generate_locales
10
+ copy_file "ecm.links.category.en.yml", "config/locales/ecm.links.category.en.yml"
11
+ copy_file "ecm.links.category.de.yml", "config/locales/ecm.links.category.de.yml"
12
+ copy_file "ecm.links.en.yml", "config/locales/ecm.links.en.yml"
13
+ copy_file "ecm.links.de.yml", "config/locales/ecm.links.de.yml"
14
+ copy_file "ecm.links.link.en.yml", "config/locales/ecm.links.link.en.yml"
15
+ copy_file "ecm.links.link.de.yml", "config/locales/ecm.links.link.de.yml"
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,50 @@
1
+ namespace :ecm_links do
2
+ namespace :db do
3
+ desc "Purges and creates example data"
4
+ task :populate!, [] => [:environment] do |t, args|
5
+
6
+ Rake::Task["ecm_links:db:clear!"].execute
7
+ Rake::Task["ecm_links:db:populate"].execute
8
+ end
9
+
10
+ desc "Clears all data!"
11
+ task :clear!, [] => [:environment] do |t, args|
12
+ Ecm::Links::Category.delete_all
13
+ Ecm::Links::Link.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 categories
22
+ 5.times do
23
+ Ecm::Links::Category.create! do |c|
24
+ c.locale = I18n.available_locales.map(&:to_s).choice
25
+ c.name = "#{Faker::Company.name} Category"
26
+ c.link_footer_column = [nil, 1, 2, 3, 4].choice
27
+ end
28
+ end
29
+
30
+ 50.times do
31
+ Ecm::Links::Category.create! do |c|
32
+ c.parent = Ecm::Links::Category.all.choice
33
+ c.name = "#{Faker::Company.name} Category"
34
+ c.link_footer_column = [nil, 1, 2, 3, 4].choice
35
+ end
36
+ end
37
+
38
+ # Create example links
39
+ categories = Ecm::Links::Category.all
40
+ 50.times do
41
+ Ecm::Links::Link.create! do |l|
42
+ l.name ="#{Faker::Company.name} Link"
43
+ l.url = "#{Faker::Internet.http_url} Link"
44
+ l.description = Faker::Lorem.paragraph(rand(3))
45
+ l.ecm_links_category = categories.choice
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
metadata ADDED
@@ -0,0 +1,448 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ecm_links
3
+ version: !ruby/object:Gem::Version
4
+ hash: 961915968
5
+ prerelease: 6
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ - pre
11
+ version: 0.0.1.pre
12
+ platform: ruby
13
+ authors:
14
+ - Roberto Vasquez Angel
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2012-09-15 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rails
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 31
30
+ segments:
31
+ - 3
32
+ - 2
33
+ - 8
34
+ version: 3.2.8
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: active_admin-acts_as_list
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: active_admin-awesome_nested_set
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ hash: 25
60
+ segments:
61
+ - 0
62
+ - 0
63
+ - 3
64
+ version: 0.0.3
65
+ type: :runtime
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: acts_as_list
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ type: :runtime
80
+ version_requirements: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ name: acts_as_markup
83
+ prerelease: false
84
+ requirement: &id005 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ type: :runtime
94
+ version_requirements: *id005
95
+ - !ruby/object:Gem::Dependency
96
+ name: awesome_nested_set
97
+ prerelease: false
98
+ requirement: &id006 !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ type: :runtime
108
+ version_requirements: *id006
109
+ - !ruby/object:Gem::Dependency
110
+ name: awesome_nested_set-tools
111
+ prerelease: false
112
+ requirement: &id007 !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ hash: 3
118
+ segments:
119
+ - 0
120
+ version: "0"
121
+ type: :runtime
122
+ version_requirements: *id007
123
+ - !ruby/object:Gem::Dependency
124
+ name: friendly_id
125
+ prerelease: false
126
+ requirement: &id008 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ hash: 3
132
+ segments:
133
+ - 0
134
+ version: "0"
135
+ type: :runtime
136
+ version_requirements: *id008
137
+ - !ruby/object:Gem::Dependency
138
+ name: rails_tools-absence_validator
139
+ prerelease: false
140
+ requirement: &id009 !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ hash: 29
146
+ segments:
147
+ - 0
148
+ - 0
149
+ - 1
150
+ version: 0.0.1
151
+ type: :runtime
152
+ version_requirements: *id009
153
+ - !ruby/object:Gem::Dependency
154
+ name: sqlite3
155
+ prerelease: false
156
+ requirement: &id010 !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ hash: 3
162
+ segments:
163
+ - 0
164
+ version: "0"
165
+ type: :development
166
+ version_requirements: *id010
167
+ - !ruby/object:Gem::Dependency
168
+ name: thin
169
+ prerelease: false
170
+ requirement: &id011 !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ hash: 3
176
+ segments:
177
+ - 0
178
+ version: "0"
179
+ type: :development
180
+ version_requirements: *id011
181
+ - !ruby/object:Gem::Dependency
182
+ name: yard
183
+ prerelease: false
184
+ requirement: &id012 !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ hash: 3
190
+ segments:
191
+ - 0
192
+ version: "0"
193
+ type: :development
194
+ version_requirements: *id012
195
+ - !ruby/object:Gem::Dependency
196
+ name: activeadmin
197
+ prerelease: false
198
+ requirement: &id013 !ruby/object:Gem::Requirement
199
+ none: false
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ hash: 3
204
+ segments:
205
+ - 0
206
+ version: "0"
207
+ type: :development
208
+ version_requirements: *id013
209
+ - !ruby/object:Gem::Dependency
210
+ name: sass-rails
211
+ prerelease: false
212
+ requirement: &id014 !ruby/object:Gem::Requirement
213
+ none: false
214
+ requirements:
215
+ - - ">="
216
+ - !ruby/object:Gem::Version
217
+ hash: 3
218
+ segments:
219
+ - 0
220
+ version: "0"
221
+ type: :development
222
+ version_requirements: *id014
223
+ - !ruby/object:Gem::Dependency
224
+ name: coffee-rails
225
+ prerelease: false
226
+ requirement: &id015 !ruby/object:Gem::Requirement
227
+ none: false
228
+ requirements:
229
+ - - ">="
230
+ - !ruby/object:Gem::Version
231
+ hash: 3
232
+ segments:
233
+ - 0
234
+ version: "0"
235
+ type: :development
236
+ version_requirements: *id015
237
+ - !ruby/object:Gem::Dependency
238
+ name: capybara
239
+ prerelease: false
240
+ requirement: &id016 !ruby/object:Gem::Requirement
241
+ none: false
242
+ requirements:
243
+ - - ">="
244
+ - !ruby/object:Gem::Version
245
+ hash: 3
246
+ segments:
247
+ - 0
248
+ version: "0"
249
+ type: :development
250
+ version_requirements: *id016
251
+ - !ruby/object:Gem::Dependency
252
+ name: rspec-rails
253
+ prerelease: false
254
+ requirement: &id017 !ruby/object:Gem::Requirement
255
+ none: false
256
+ requirements:
257
+ - - ~>
258
+ - !ruby/object:Gem::Version
259
+ hash: 3
260
+ segments:
261
+ - 2
262
+ - 0
263
+ version: "2.0"
264
+ type: :development
265
+ version_requirements: *id017
266
+ - !ruby/object:Gem::Dependency
267
+ name: shoulda-matchers
268
+ prerelease: false
269
+ requirement: &id018 !ruby/object:Gem::Requirement
270
+ none: false
271
+ requirements:
272
+ - - ">="
273
+ - !ruby/object:Gem::Version
274
+ hash: 3
275
+ segments:
276
+ - 0
277
+ version: "0"
278
+ type: :development
279
+ version_requirements: *id018
280
+ - !ruby/object:Gem::Dependency
281
+ name: factory_girl_rails
282
+ prerelease: false
283
+ requirement: &id019 !ruby/object:Gem::Requirement
284
+ none: false
285
+ requirements:
286
+ - - ~>
287
+ - !ruby/object:Gem::Version
288
+ hash: 15
289
+ segments:
290
+ - 1
291
+ - 0
292
+ version: "1.0"
293
+ type: :development
294
+ version_requirements: *id019
295
+ - !ruby/object:Gem::Dependency
296
+ name: ffaker
297
+ prerelease: false
298
+ requirement: &id020 !ruby/object:Gem::Requirement
299
+ none: false
300
+ requirements:
301
+ - - ">="
302
+ - !ruby/object:Gem::Version
303
+ hash: 3
304
+ segments:
305
+ - 0
306
+ version: "0"
307
+ type: :development
308
+ version_requirements: *id020
309
+ - !ruby/object:Gem::Dependency
310
+ name: forgery
311
+ prerelease: false
312
+ requirement: &id021 !ruby/object:Gem::Requirement
313
+ none: false
314
+ requirements:
315
+ - - "="
316
+ - !ruby/object:Gem::Version
317
+ hash: 11
318
+ segments:
319
+ - 0
320
+ - 5
321
+ - 0
322
+ version: 0.5.0
323
+ type: :development
324
+ version_requirements: *id021
325
+ - !ruby/object:Gem::Dependency
326
+ name: rb-inotify
327
+ prerelease: false
328
+ requirement: &id022 !ruby/object:Gem::Requirement
329
+ none: false
330
+ requirements:
331
+ - - ~>
332
+ - !ruby/object:Gem::Version
333
+ hash: 47
334
+ segments:
335
+ - 0
336
+ - 8
337
+ - 8
338
+ version: 0.8.8
339
+ type: :development
340
+ version_requirements: *id022
341
+ - !ruby/object:Gem::Dependency
342
+ name: guard-rspec
343
+ prerelease: false
344
+ requirement: &id023 !ruby/object:Gem::Requirement
345
+ none: false
346
+ requirements:
347
+ - - ">="
348
+ - !ruby/object:Gem::Version
349
+ hash: 3
350
+ segments:
351
+ - 0
352
+ version: "0"
353
+ type: :development
354
+ version_requirements: *id023
355
+ - !ruby/object:Gem::Dependency
356
+ name: guard-bundler
357
+ prerelease: false
358
+ requirement: &id024 !ruby/object:Gem::Requirement
359
+ none: false
360
+ requirements:
361
+ - - ">="
362
+ - !ruby/object:Gem::Version
363
+ hash: 3
364
+ segments:
365
+ - 0
366
+ version: "0"
367
+ type: :development
368
+ version_requirements: *id024
369
+ description: Link management for active admin.
370
+ email:
371
+ - roberto@vasquez-angel.de
372
+ executables: []
373
+
374
+ extensions: []
375
+
376
+ extra_rdoc_files: []
377
+
378
+ files:
379
+ - app/controllers/ecm/links/categories_controller.rb
380
+ - app/helpers/ecm/links_helper.rb
381
+ - app/helpers/ecm/links/categories_helper.rb
382
+ - app/helpers/ecm/links/links_helper.rb
383
+ - app/views/ecm/links/categories/index.html.erb
384
+ - app/views/ecm/links/categories/_category.html.erb
385
+ - app/views/ecm/links/_link_footer.html.erb
386
+ - app/views/ecm/links/links/_link.html.erb
387
+ - app/models/ecm/links/link.rb
388
+ - app/models/ecm/links/category.rb
389
+ - config/locales/ecm.links.de.yml
390
+ - config/locales/ecm.links.category.en.yml
391
+ - config/locales/ecm.links.en.yml
392
+ - config/locales/ecm.links.link.de.yml
393
+ - config/locales/ecm.links.link.en.yml
394
+ - config/locales/ecm.links.category.de.yml
395
+ - db/migrate/002_create_ecm_links_links.rb
396
+ - db/migrate/001_create_ecm_links_categories.rb
397
+ - lib/ecm_links.rb
398
+ - lib/generators/ecm/links/locales/locales_generator.rb
399
+ - lib/generators/ecm/links/install/install_generator.rb
400
+ - lib/generators/ecm/links/install/templates/ecm_links.rb
401
+ - lib/tasks/ecm_links_tasks.rake
402
+ - lib/ecm/links/active_admin/ecm_links_links.rb
403
+ - lib/ecm/links/active_admin/ecm_links_categories.rb
404
+ - lib/ecm/links/engine.rb
405
+ - lib/ecm/links/version.rb
406
+ - lib/ecm/links/routing.rb
407
+ - lib/ecm/links/configuration.rb
408
+ - MIT-LICENSE
409
+ - Rakefile
410
+ - README.rdoc
411
+ homepage: https://github.com/robotex82/ecm_links
412
+ licenses: []
413
+
414
+ post_install_message:
415
+ rdoc_options: []
416
+
417
+ require_paths:
418
+ - lib
419
+ required_ruby_version: !ruby/object:Gem::Requirement
420
+ none: false
421
+ requirements:
422
+ - - ">="
423
+ - !ruby/object:Gem::Version
424
+ hash: 3
425
+ segments:
426
+ - 0
427
+ version: "0"
428
+ required_rubygems_version: !ruby/object:Gem::Requirement
429
+ none: false
430
+ requirements:
431
+ - - ">"
432
+ - !ruby/object:Gem::Version
433
+ hash: 25
434
+ segments:
435
+ - 1
436
+ - 3
437
+ - 1
438
+ version: 1.3.1
439
+ requirements: []
440
+
441
+ rubyforge_project:
442
+ rubygems_version: 1.8.24
443
+ signing_key:
444
+ specification_version: 3
445
+ summary: Link management for active admin.
446
+ test_files: []
447
+
448
+ has_rdoc: