ecm_links2 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +25 -1
- data/Rakefile +1 -1
- data/{lib/ecm/links/active_admin → app/admin}/ecm_links_categories.rb +16 -17
- data/{lib/ecm/links/active_admin → app/admin}/ecm_links_links.rb +3 -3
- data/app/controllers/ecm/links/categories_controller.rb +1 -1
- data/app/decorators/ecm/links/category_decorator.rb +1 -1
- data/app/helpers/ecm/links/categories_helper.rb +1 -1
- data/app/helpers/ecm/links/links_helper.rb +1 -1
- data/app/helpers/ecm/links_helper.rb +2 -2
- data/app/models/ecm/links/category.rb +17 -18
- data/app/models/ecm/links/link.rb +10 -14
- data/db/migrate/001_create_ecm_links_categories.rb +1 -1
- data/lib/ecm/links/engine.rb +4 -5
- data/lib/ecm/links/routing.rb +2 -27
- data/lib/ecm/links/version.rb +1 -1
- data/lib/ecm_links2.rb +2 -2
- data/lib/generators/ecm/links/install/install_generator.rb +13 -7
- data/lib/generators/ecm/links/install/templates/{ecm_links.rb → initializer.rb} +2 -2
- data/lib/generators/ecm/links/install/templates/routes.source +5 -0
- data/lib/generators/ecm/links/locales/locales_generator.rb +10 -10
- data/lib/tasks/ecm_links_tasks.rake +23 -24
- metadata +40 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92d49f4e65da39c29d89701b17d5bf0ffa510796
|
4
|
+
data.tar.gz: 1860a713cb7a510a791283139e22718a1e96a1fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f38fdf14e43eb556acac4f81df4d3c16044c08e161ae80ef8e902b13bf6bb3980ce1fa2a945628c9933342a1c09ef48817af4ca20d7154ace9b965e52ec2b73b
|
7
|
+
data.tar.gz: 895e469bc71874a702da1c27f9cc047edcdfef4f680d01ceb32a2b502c90206e17bf06e7870011ecf9700f00f114ad21767349426a93cb23cad67454e8b1f33e
|
data/README.rdoc
CHANGED
@@ -1,7 +1,24 @@
|
|
1
1
|
= ECM Links 2
|
2
2
|
|
3
|
-
=
|
3
|
+
= Migrating from 1.x.x to 2.0.0
|
4
|
+
|
5
|
+
Add active_admin-awesome_nested_set to your gemfile, if you are using activeadmin:
|
6
|
+
|
7
|
+
# Gemfile
|
8
|
+
gem 'active_admin-acts_as_list'
|
9
|
+
gem 'active_admin-awesome_nested_set'
|
10
|
+
|
11
|
+
|
12
|
+
= Prerequisites
|
13
|
+
|
14
|
+
if you are using activeadmin as backend, ecm_cms2 comes with admin files to provide a backend. In that case, you'll need active_admin-acts_as_list and active_admin-awesome_nested_set. Add it to your gemfile:
|
4
15
|
|
16
|
+
# Gemfile
|
17
|
+
gem 'active_admin-acts_as_list'
|
18
|
+
gem 'active_admin-awesome_nested_set'
|
19
|
+
|
20
|
+
|
21
|
+
= Installation
|
5
22
|
|
6
23
|
Add it to your gemfile:
|
7
24
|
|
@@ -47,6 +64,13 @@ To display a link tree, you have to add the routes:
|
|
47
64
|
|
48
65
|
This will give you a route to /ecm_links_categories
|
49
66
|
|
67
|
+
= Running specs
|
68
|
+
|
69
|
+
gem install bundler
|
70
|
+
bundle
|
71
|
+
cd spec/dummy && rake db:migrate RAILS_ENV=test && cd ../..
|
72
|
+
guard
|
73
|
+
|
50
74
|
= License
|
51
75
|
|
52
76
|
This project rocks and uses MIT-LICENSE.
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ include ActiveAdmin::AwesomeNestedSet::Helper if defined?(ActiveAdmin)
|
|
3
3
|
|
4
4
|
ActiveAdmin.register Ecm::Links::Category do
|
5
5
|
# menu entry settings
|
6
|
-
menu :
|
6
|
+
menu parent: proc { I18n.t('ecm.links.active_admin.menu') }.call
|
7
7
|
|
8
8
|
# awesome nested set
|
9
9
|
sortable_tree_member_actions
|
@@ -24,25 +24,24 @@ ActiveAdmin.register Ecm::Links::Category do
|
|
24
24
|
:url
|
25
25
|
]
|
26
26
|
|
27
|
-
|
28
27
|
form do |f|
|
29
28
|
f.inputs do
|
30
|
-
f.input :parent, :
|
31
|
-
f.input :locale, :
|
29
|
+
f.input :parent, as: :select, collection: nested_set_options(Ecm::Links::Category, f.object) { |c| "#{'    ' * c.level} |-- #{c}".html_safe }
|
30
|
+
f.input :locale, as: :select, collection: I18n.available_locales.map(&:to_s)
|
32
31
|
f.input :name
|
33
32
|
f.input :short_description
|
34
33
|
f.input :long_description
|
35
34
|
end
|
36
35
|
|
37
36
|
f.inputs do
|
38
|
-
f.input :markup_language, :
|
39
|
-
f.input :link_footer_column, :
|
37
|
+
f.input :markup_language, as: :select, collection: Ecm::Links::Configuration.markup_languages.map(&:to_s)
|
38
|
+
f.input :link_footer_column, as: :select, collection: (1..Ecm::Links::Configuration.link_footer_columns).to_a
|
40
39
|
end
|
41
40
|
|
42
|
-
|
41
|
+
f.inputs do
|
43
42
|
f.has_many :ecm_links_links do |l|
|
44
43
|
if l.object.persisted?
|
45
|
-
l.input :_destroy, :
|
44
|
+
l.input :_destroy, as: :boolean, label: I18n.t('active_admin.delete')
|
46
45
|
end
|
47
46
|
l.input :name
|
48
47
|
l.input :url
|
@@ -53,12 +52,12 @@ ActiveAdmin.register Ecm::Links::Category do
|
|
53
52
|
f.actions
|
54
53
|
end
|
55
54
|
|
56
|
-
index :
|
55
|
+
index as: :nested_set do
|
57
56
|
selectable_column
|
58
57
|
sortable_tree_columns
|
59
58
|
column :locale
|
60
59
|
column :name do |c|
|
61
|
-
span(:
|
60
|
+
span(style: "margin-left: #{30 * c.level}px") { c.name }
|
62
61
|
end
|
63
62
|
column :short_description
|
64
63
|
column :ecm_links_links_count
|
@@ -89,31 +88,31 @@ ActiveAdmin.register Ecm::Links::Category do
|
|
89
88
|
end
|
90
89
|
|
91
90
|
panel Ecm::Links::Category.human_attribute_name(:children) do
|
92
|
-
table_for ecm_links_category.descendants, :
|
91
|
+
table_for ecm_links_category.descendants, i18n: Ecm::Links::Category do
|
93
92
|
sortable_tree_columns
|
94
|
-
column(:name) { |child| link_to child, [:admin, child], :
|
93
|
+
column(:name) { |child| link_to child, [:admin, child], style: "margin-left: #{30 * (child.level - ecm_links_category.level - 1)}px" }
|
95
94
|
column :short_description
|
96
95
|
column :ecm_links_links_count
|
97
96
|
column :link_footer_column
|
98
97
|
column :created_at
|
99
98
|
column :updated_at
|
100
99
|
column do |child|
|
101
|
-
link_to(I18n.t('active_admin.view'), [:admin, child], :
|
102
|
-
|
100
|
+
link_to(I18n.t('active_admin.view'), [:admin, child], class: 'member_link view_link') +
|
101
|
+
link_to(I18n.t('active_admin.edit'), [:edit, :admin, child], class: 'member_link edit_link')
|
103
102
|
end
|
104
103
|
end
|
105
104
|
end
|
106
105
|
|
107
106
|
panel Ecm::Links::Category.human_attribute_name(:ecm_links_links) do
|
108
|
-
table_for ecm_links_category.ecm_links_links, :
|
107
|
+
table_for ecm_links_category.ecm_links_links, i18n: Ecm::Links::Link do
|
109
108
|
sortable_columns
|
110
109
|
column(:name) { |link| link_to link.name, [:admin, link] }
|
111
110
|
column(:url) { |link| link_to link.url, link.url }
|
112
111
|
column :created_at
|
113
112
|
column :updated_at
|
114
113
|
column do |link|
|
115
|
-
link_to(I18n.t('active_admin.view'), [:admin, link], :
|
116
|
-
|
114
|
+
link_to(I18n.t('active_admin.view'), [:admin, link], class: 'member_link view_link') +
|
115
|
+
link_to(I18n.t('active_admin.edit'), [:edit, :admin, link], class: 'member_link edit_link')
|
117
116
|
end
|
118
117
|
end
|
119
118
|
end
|
@@ -2,7 +2,7 @@ include ActiveAdmin::ActsAsList::Helper if defined?(ActiveAdmin)
|
|
2
2
|
|
3
3
|
ActiveAdmin.register Ecm::Links::Link do
|
4
4
|
# menu entry settings
|
5
|
-
menu :
|
5
|
+
menu parent: proc { I18n.t('ecm.links.active_admin.menu') }.call
|
6
6
|
|
7
7
|
permit_params :description,
|
8
8
|
:ecm_links_category_id,
|
@@ -16,14 +16,14 @@ ActiveAdmin.register Ecm::Links::Link do
|
|
16
16
|
|
17
17
|
form do |f|
|
18
18
|
f.inputs do
|
19
|
-
f.input :ecm_links_category, :
|
19
|
+
f.input :ecm_links_category, as: :select, collection: nested_set_options(Ecm::Links::Category) { |c| "#{'    ' * c.level} |-- #{c}".html_safe }
|
20
20
|
f.input :name
|
21
21
|
f.input :url
|
22
22
|
f.input :description
|
23
23
|
end
|
24
24
|
|
25
25
|
f.inputs do
|
26
|
-
f.input :markup_language, :
|
26
|
+
f.input :markup_language, as: :select, collection: Ecm::Links::Link::MARKUP_LANGUAGES
|
27
27
|
end
|
28
28
|
|
29
29
|
f.actions
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Ecm::LinksHelper
|
2
|
-
def render_link_footer(categories = nil,
|
2
|
+
def render_link_footer(categories = nil, _options = {})
|
3
3
|
categories = Ecm::Links::Category.for_link_footer.all if categories.nil?
|
4
4
|
grouped_categories = categories.group_by(&:link_footer_column)
|
5
|
-
render(:
|
5
|
+
render(partial: 'ecm/links/link_footer', locals: { categories: grouped_categories })
|
6
6
|
end
|
7
7
|
end
|
@@ -4,10 +4,9 @@ module Ecm::Links
|
|
4
4
|
class Category < ActiveRecord::Base
|
5
5
|
# associations
|
6
6
|
has_many :ecm_links_links, -> { order(:position) },
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
|
7
|
+
class_name: Ecm::Links::Link,
|
8
|
+
dependent: :destroy,
|
9
|
+
foreign_key: :ecm_links_category_id
|
11
10
|
|
12
11
|
# attributes
|
13
12
|
attr_accessible :depth,
|
@@ -22,7 +21,7 @@ module Ecm::Links
|
|
22
21
|
:rgt,
|
23
22
|
:short_description,
|
24
23
|
:slug if respond_to? :attr_accessible
|
25
|
-
accepts_nested_attributes_for :ecm_links_links, :
|
24
|
+
accepts_nested_attributes_for :ecm_links_links, allow_destroy: true
|
26
25
|
|
27
26
|
# awesome nested set
|
28
27
|
acts_as_nested_set
|
@@ -33,15 +32,15 @@ module Ecm::Links
|
|
33
32
|
|
34
33
|
# friendly id
|
35
34
|
extend FriendlyId
|
36
|
-
friendly_id :name, :
|
35
|
+
friendly_id :name, use: [:slugged, :finders]
|
37
36
|
|
38
37
|
# validations
|
39
|
-
validates :locale, :
|
40
|
-
validates :locale, :
|
41
|
-
validates :name, :
|
42
|
-
:
|
43
|
-
validates :markup_language, :
|
44
|
-
:
|
38
|
+
validates :locale, presence: true, if: proc { |c| c.parent.nil? }
|
39
|
+
validates :locale, absence: true, if: proc { |c| !c.parent.nil? }
|
40
|
+
validates :name, presence: true,
|
41
|
+
uniqueness: { scope: [:parent_id] }
|
42
|
+
validates :markup_language, presence: true,
|
43
|
+
inclusion: Configuration.markup_languages.map(&:to_s)
|
45
44
|
|
46
45
|
def human
|
47
46
|
name
|
@@ -52,15 +51,15 @@ module Ecm::Links
|
|
52
51
|
end
|
53
52
|
|
54
53
|
def self.for_actual_locale
|
55
|
-
where(:
|
54
|
+
where(locale: I18n.locale)
|
56
55
|
end
|
57
56
|
|
58
57
|
def self.for_link_footer
|
59
|
-
where(
|
58
|
+
where(arel_table['link_footer_column'].not_eq(nil)).for_actual_locale
|
60
59
|
end
|
61
60
|
|
62
61
|
def long_description(options = {})
|
63
|
-
options.reverse_merge!(:
|
62
|
+
options.reverse_merge!(as: :plain)
|
64
63
|
case options[:as]
|
65
64
|
when :html
|
66
65
|
markup(self[:long_description])
|
@@ -70,7 +69,7 @@ module Ecm::Links
|
|
70
69
|
end
|
71
70
|
|
72
71
|
def short_description(options = {})
|
73
|
-
options.reverse_merge!(:
|
72
|
+
options.reverse_merge!(as: :plain)
|
74
73
|
case options[:as]
|
75
74
|
when :html
|
76
75
|
markup(self[:short_description])
|
@@ -89,7 +88,7 @@ module Ecm::Links
|
|
89
88
|
when :none
|
90
89
|
text
|
91
90
|
else
|
92
|
-
|
91
|
+
fail "Unsupported markup language #{markup_language}"
|
93
92
|
end
|
94
93
|
end
|
95
94
|
|
@@ -99,4 +98,4 @@ module Ecm::Links
|
|
99
98
|
end
|
100
99
|
end
|
101
100
|
end
|
102
|
-
end
|
101
|
+
end
|
@@ -2,12 +2,12 @@ require_dependency 'redcloth'
|
|
2
2
|
|
3
3
|
class Ecm::Links::Link < ActiveRecord::Base
|
4
4
|
# acts as list
|
5
|
-
acts_as_list :
|
5
|
+
acts_as_list scope: :ecm_links_category
|
6
6
|
|
7
7
|
# associations
|
8
8
|
belongs_to :ecm_links_category,
|
9
|
-
:
|
10
|
-
:
|
9
|
+
class_name: Ecm::Links::Category,
|
10
|
+
counter_cache: :ecm_links_links_count
|
11
11
|
|
12
12
|
# attributes
|
13
13
|
attr_accessible :description,
|
@@ -24,14 +24,13 @@ class Ecm::Links::Link < ActiveRecord::Base
|
|
24
24
|
MARKUP_LANGUAGES = %w(markdown textile rdoc)
|
25
25
|
|
26
26
|
# validations
|
27
|
-
validates :name, :
|
28
|
-
validates :url, :
|
29
|
-
validates :markup_language, :
|
30
|
-
:
|
31
|
-
|
27
|
+
validates :name, presence: true # , :uniqueness => { :scope => [ :ecm_links_category_id ] }
|
28
|
+
validates :url, presence: true # , :uniqueness => { :scope => [ :ecm_links_category_id ] }
|
29
|
+
validates :markup_language, presence: true,
|
30
|
+
inclusion: MARKUP_LANGUAGES
|
32
31
|
|
33
32
|
def description(options = {})
|
34
|
-
options.reverse_merge!(:
|
33
|
+
options.reverse_merge!(as: :plain)
|
35
34
|
case options[:as]
|
36
35
|
when :html
|
37
36
|
markup(self[:description])
|
@@ -42,7 +41,6 @@ class Ecm::Links::Link < ActiveRecord::Base
|
|
42
41
|
|
43
42
|
private
|
44
43
|
|
45
|
-
|
46
44
|
def markup(text)
|
47
45
|
case markup_language.to_sym
|
48
46
|
when :textile
|
@@ -51,13 +49,11 @@ class Ecm::Links::Link < ActiveRecord::Base
|
|
51
49
|
when :none
|
52
50
|
text
|
53
51
|
else
|
54
|
-
|
52
|
+
fail "Unsupported markup language #{markup_language}"
|
55
53
|
end
|
56
54
|
end
|
57
55
|
|
58
56
|
def set_defaults
|
59
|
-
if self.new_record?
|
60
|
-
self.markup_language ||= 'textile'
|
61
|
-
end
|
57
|
+
self.markup_language ||= 'textile' if self.new_record?
|
62
58
|
end
|
63
59
|
end
|
@@ -9,7 +9,7 @@ class CreateEcmLinksCategories < ActiveRecord::Migration
|
|
9
9
|
t.integer :link_footer_column
|
10
10
|
|
11
11
|
# associations
|
12
|
-
t.integer :ecm_links_links_count, :
|
12
|
+
t.integer :ecm_links_links_count, default: 0, null: false
|
13
13
|
|
14
14
|
# awesome nested set
|
15
15
|
t.integer :lft
|
data/lib/ecm/links/engine.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
module Ecm
|
2
2
|
module Links
|
3
3
|
class Engine < ::Rails::Engine
|
4
|
-
# active admin
|
5
4
|
initializer :ecm_links_engine do
|
6
|
-
|
7
|
-
|
5
|
+
ActiveAdmin.setup do |config|
|
6
|
+
config.load_paths += Dir[root.join('app', 'admin')]
|
8
7
|
end
|
9
|
-
end if
|
8
|
+
end if Gem::Specification.find_all_by_name('activeadmin').any?
|
10
9
|
end
|
11
|
-
end
|
10
|
+
end
|
12
11
|
end
|
data/lib/ecm/links/routing.rb
CHANGED
@@ -1,36 +1,11 @@
|
|
1
1
|
module Ecm
|
2
2
|
module Links
|
3
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
4
|
def self.routes(router, options = {})
|
11
|
-
options.reverse_merge!(
|
12
|
-
links_category_actions: [:index, :show]
|
13
|
-
})
|
5
|
+
options.reverse_merge!(links_category_actions: [:index, :show])
|
14
6
|
|
15
|
-
router.resources :ecm_links_categories, only: options[:links_category_actions], :
|
7
|
+
router.resources :ecm_links_categories, only: options[:links_category_actions], controller: 'ecm/links/categories'
|
16
8
|
end
|
17
|
-
# # Creates the routes for links and categories. You can pass options to
|
18
|
-
# # specify the actions for both links and/or categories.
|
19
|
-
# #
|
20
|
-
# # Ecm::Links::Routing.routes(self, { :link_category_actions => [ :show ]})
|
21
|
-
# #
|
22
|
-
# # This will only create the show action for link categories, but omit the index action.
|
23
|
-
# def self.routes(router, options = {})
|
24
|
-
# options.reverse_merge!(
|
25
|
-
# { :link_category_actions => [:index, :show],
|
26
|
-
# :link_actions => [:index, :show]
|
27
|
-
# }
|
28
|
-
# )
|
29
|
-
#
|
30
|
-
# router.resources :ecm_links_categories, :only => options[:link_category_actions], :controller => 'ecm/links/link_categories'
|
31
|
-
# router.resources :ecm_links_links,:only => options[:link_actions], :controller => 'ecm/products/links'
|
32
|
-
# end
|
33
9
|
end
|
34
10
|
end
|
35
11
|
end
|
36
|
-
|
data/lib/ecm/links/version.rb
CHANGED
data/lib/ecm_links2.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'active_admin-acts_as_list'
|
2
|
-
require 'active_admin-awesome_nested_set'
|
1
|
+
require 'active_admin-acts_as_list' if Gem::Specification.find_all_by_name('activeadmin').any?
|
2
|
+
require 'active_admin-awesome_nested_set' if Gem::Specification.find_all_by_name('activeadmin').any?
|
3
3
|
require 'acts_as_list'
|
4
4
|
require 'awesome_nested_set'
|
5
5
|
require 'awesome_nested_set-tools'
|
@@ -2,14 +2,20 @@ module Ecm
|
|
2
2
|
module Links
|
3
3
|
module Generators
|
4
4
|
class InstallGenerator < Rails::Generators::Base
|
5
|
-
desc
|
5
|
+
desc 'Generates the intializer'
|
6
6
|
|
7
|
-
source_root File.expand_path('../templates', __FILE__)
|
8
|
-
|
9
|
-
def
|
10
|
-
copy_file
|
11
|
-
end
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
|
9
|
+
def generate_initializer
|
10
|
+
copy_file 'initializer.rb', 'config/initializers/ecm_links.rb'
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate_routes
|
14
|
+
inject_into_file 'config/routes.rb', before: "\nend" do
|
15
|
+
File.read(File.join(File.expand_path('../templates', __FILE__), 'routes.source'))
|
16
|
+
end
|
17
|
+
end
|
12
18
|
end
|
13
19
|
end
|
14
20
|
end
|
15
|
-
end
|
21
|
+
end
|
@@ -9,7 +9,7 @@ Ecm::Links.configure do |config|
|
|
9
9
|
#
|
10
10
|
# Default: config.link_footer_column_css_classes = %w[ link-footer-column col-lg-3 ]
|
11
11
|
#
|
12
|
-
config.link_footer_column_css_classes = %w
|
12
|
+
config.link_footer_column_css_classes = %w( link-footer-column col-lg-3 )
|
13
13
|
|
14
14
|
# Set the base controller for the contact form
|
15
15
|
#
|
@@ -20,7 +20,7 @@ Ecm::Links.configure do |config|
|
|
20
20
|
# Accepted markup languages
|
21
21
|
#
|
22
22
|
# default: config.markup_languages = %w[ textile ]
|
23
|
-
config.markup_languages = %w
|
23
|
+
config.markup_languages = %w( textile )
|
24
24
|
|
25
25
|
# Default markup language
|
26
26
|
#
|
@@ -2,19 +2,19 @@ module Ecm
|
|
2
2
|
module Links
|
3
3
|
module Generators
|
4
4
|
class LocalesGenerator < Rails::Generators::Base
|
5
|
-
desc
|
5
|
+
desc 'Copies the locale files to your application'
|
6
6
|
|
7
7
|
source_root File.expand_path('../../../../../../config/locales', __FILE__)
|
8
|
-
|
8
|
+
|
9
9
|
def generate_locales
|
10
|
-
copy_file
|
11
|
-
copy_file
|
12
|
-
copy_file
|
13
|
-
copy_file
|
14
|
-
copy_file
|
15
|
-
copy_file
|
16
|
-
end
|
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
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
-
end
|
20
|
+
end
|
@@ -1,50 +1,49 @@
|
|
1
1
|
namespace :ecm_links do
|
2
2
|
namespace :db do
|
3
|
-
desc
|
4
|
-
task :populate!, [] => [:environment] do |
|
5
|
-
|
6
|
-
Rake::Task[
|
7
|
-
Rake::Task["ecm_links:db:populate"].execute
|
3
|
+
desc 'Purges and creates example data'
|
4
|
+
task :populate!, [] => [:environment] do |_t, _args|
|
5
|
+
Rake::Task['ecm_links:db:clear!'].execute
|
6
|
+
Rake::Task['ecm_links:db:populate'].execute
|
8
7
|
end
|
9
|
-
|
10
|
-
desc
|
11
|
-
task :clear!, [] => [:environment] do |
|
8
|
+
|
9
|
+
desc 'Clears all data!'
|
10
|
+
task :clear!, [] => [:environment] do |_t, _args|
|
12
11
|
Ecm::Links::Category.delete_all
|
13
12
|
Ecm::Links::Link.delete_all
|
14
13
|
end
|
15
|
-
|
16
|
-
desc
|
17
|
-
task :populate, [] => [:environment] do |
|
18
|
-
require
|
19
|
-
require
|
14
|
+
|
15
|
+
desc 'Creates example_data'
|
16
|
+
task :populate, [] => [:environment] do |_t, _args|
|
17
|
+
require 'ffaker'
|
18
|
+
require 'forgery'
|
20
19
|
|
21
20
|
# Create example categories
|
22
21
|
5.times do
|
23
|
-
Ecm::Links::Category.create! do |c|
|
22
|
+
Ecm::Links::Category.create! do |c|
|
24
23
|
c.locale = I18n.available_locales.map(&:to_s).choice
|
25
24
|
c.name = "#{Faker::Company.name} Category"
|
26
25
|
c.link_footer_column = [nil, 1, 2, 3, 4].choice
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
30
29
|
50.times do
|
31
|
-
Ecm::Links::Category.create! do |c|
|
30
|
+
Ecm::Links::Category.create! do |c|
|
32
31
|
c.parent = Ecm::Links::Category.all.choice
|
33
32
|
c.name = "#{Faker::Company.name} Category"
|
34
33
|
c.link_footer_column = [nil, 1, 2, 3, 4].choice
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
38
37
|
# Create example links
|
39
38
|
categories = Ecm::Links::Category.all
|
40
39
|
50.times do
|
41
40
|
Ecm::Links::Link.create! do |l|
|
42
|
-
l.name ="#{Faker::Company.name} Link"
|
41
|
+
l.name = "#{Faker::Company.name} Link"
|
43
42
|
l.url = "#{Faker::Internet.http_url} Link"
|
44
43
|
l.description = Faker::Lorem.paragraph(rand(3))
|
45
44
|
l.ecm_links_category = categories.choice
|
46
45
|
end
|
47
|
-
end
|
48
|
-
end
|
46
|
+
end
|
47
|
+
end
|
49
48
|
end
|
50
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecm_links2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -17,9 +17,6 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.0'
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '5.0'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,11 +24,8 @@ dependencies:
|
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '4.0'
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '5.0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
28
|
+
name: acts_as_list
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - ">="
|
@@ -45,21 +39,7 @@ dependencies:
|
|
45
39
|
- !ruby/object:Gem::Version
|
46
40
|
version: '0'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - "~>"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 0.0.8
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 0.0.8
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: acts_as_list
|
42
|
+
name: awesome_nested_set
|
63
43
|
requirement: !ruby/object:Gem::Requirement
|
64
44
|
requirements:
|
65
45
|
- - ">="
|
@@ -73,7 +53,7 @@ dependencies:
|
|
73
53
|
- !ruby/object:Gem::Version
|
74
54
|
version: '0'
|
75
55
|
- !ruby/object:Gem::Dependency
|
76
|
-
name: awesome_nested_set
|
56
|
+
name: awesome_nested_set-tools
|
77
57
|
requirement: !ruby/object:Gem::Requirement
|
78
58
|
requirements:
|
79
59
|
- - ">="
|
@@ -87,21 +67,21 @@ dependencies:
|
|
87
67
|
- !ruby/object:Gem::Version
|
88
68
|
version: '0'
|
89
69
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
70
|
+
name: friendly_id
|
91
71
|
requirement: !ruby/object:Gem::Requirement
|
92
72
|
requirements:
|
93
|
-
- - "
|
73
|
+
- - ">="
|
94
74
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0
|
75
|
+
version: '0'
|
96
76
|
type: :runtime
|
97
77
|
prerelease: false
|
98
78
|
version_requirements: !ruby/object:Gem::Requirement
|
99
79
|
requirements:
|
100
|
-
- - "
|
80
|
+
- - ">="
|
101
81
|
- !ruby/object:Gem::Version
|
102
|
-
version: 0
|
82
|
+
version: '0'
|
103
83
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
84
|
+
name: RedCloth
|
105
85
|
requirement: !ruby/object:Gem::Requirement
|
106
86
|
requirements:
|
107
87
|
- - ">="
|
@@ -115,7 +95,7 @@ dependencies:
|
|
115
95
|
- !ruby/object:Gem::Version
|
116
96
|
version: '0'
|
117
97
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
98
|
+
name: draper
|
119
99
|
requirement: !ruby/object:Gem::Requirement
|
120
100
|
requirements:
|
121
101
|
- - ">="
|
@@ -129,13 +109,13 @@ dependencies:
|
|
129
109
|
- !ruby/object:Gem::Version
|
130
110
|
version: '0'
|
131
111
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
112
|
+
name: rails-dummy
|
133
113
|
requirement: !ruby/object:Gem::Requirement
|
134
114
|
requirements:
|
135
115
|
- - ">="
|
136
116
|
- !ruby/object:Gem::Version
|
137
117
|
version: '0'
|
138
|
-
type: :
|
118
|
+
type: :development
|
139
119
|
prerelease: false
|
140
120
|
version_requirements: !ruby/object:Gem::Requirement
|
141
121
|
requirements:
|
@@ -157,7 +137,7 @@ dependencies:
|
|
157
137
|
- !ruby/object:Gem::Version
|
158
138
|
version: '0'
|
159
139
|
- !ruby/object:Gem::Dependency
|
160
|
-
name: rails
|
140
|
+
name: jquery-rails
|
161
141
|
requirement: !ruby/object:Gem::Requirement
|
162
142
|
requirements:
|
163
143
|
- - ">="
|
@@ -297,7 +277,21 @@ dependencies:
|
|
297
277
|
- !ruby/object:Gem::Version
|
298
278
|
version: '0'
|
299
279
|
- !ruby/object:Gem::Dependency
|
300
|
-
name:
|
280
|
+
name: active_admin-acts_as_list
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - ">="
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0'
|
286
|
+
type: :development
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - ">="
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '0'
|
293
|
+
- !ruby/object:Gem::Dependency
|
294
|
+
name: active_admin-awesome_nested_set
|
301
295
|
requirement: !ruby/object:Gem::Requirement
|
302
296
|
requirements:
|
303
297
|
- - ">="
|
@@ -342,16 +336,16 @@ dependencies:
|
|
342
336
|
name: shoulda-matchers
|
343
337
|
requirement: !ruby/object:Gem::Requirement
|
344
338
|
requirements:
|
345
|
-
- - "
|
339
|
+
- - ">="
|
346
340
|
- !ruby/object:Gem::Version
|
347
|
-
version:
|
341
|
+
version: '0'
|
348
342
|
type: :development
|
349
343
|
prerelease: false
|
350
344
|
version_requirements: !ruby/object:Gem::Requirement
|
351
345
|
requirements:
|
352
|
-
- - "
|
346
|
+
- - ">="
|
353
347
|
- !ruby/object:Gem::Version
|
354
|
-
version:
|
348
|
+
version: '0'
|
355
349
|
- !ruby/object:Gem::Dependency
|
356
350
|
name: factory_girl_rails
|
357
351
|
requirement: !ruby/object:Gem::Requirement
|
@@ -408,7 +402,7 @@ dependencies:
|
|
408
402
|
- - ">="
|
409
403
|
- !ruby/object:Gem::Version
|
410
404
|
version: '0'
|
411
|
-
description: Link management for
|
405
|
+
description: Link management module for ruby on rails.
|
412
406
|
email:
|
413
407
|
- roberto@vasquez-angel.de
|
414
408
|
executables: []
|
@@ -418,6 +412,8 @@ files:
|
|
418
412
|
- MIT-LICENSE
|
419
413
|
- README.rdoc
|
420
414
|
- Rakefile
|
415
|
+
- app/admin/ecm_links_categories.rb
|
416
|
+
- app/admin/ecm_links_links.rb
|
421
417
|
- app/controllers/ecm/links/categories_controller.rb
|
422
418
|
- app/decorators/ecm/links/category_decorator.rb
|
423
419
|
- app/helpers/ecm/links/categories_helper.rb
|
@@ -441,15 +437,14 @@ files:
|
|
441
437
|
- config/locales/ecm.links.link.en.yml
|
442
438
|
- db/migrate/001_create_ecm_links_categories.rb
|
443
439
|
- db/migrate/002_create_ecm_links_links.rb
|
444
|
-
- lib/ecm/links/active_admin/ecm_links_categories.rb
|
445
|
-
- lib/ecm/links/active_admin/ecm_links_links.rb
|
446
440
|
- lib/ecm/links/configuration.rb
|
447
441
|
- lib/ecm/links/engine.rb
|
448
442
|
- lib/ecm/links/routing.rb
|
449
443
|
- lib/ecm/links/version.rb
|
450
444
|
- lib/ecm_links2.rb
|
451
445
|
- lib/generators/ecm/links/install/install_generator.rb
|
452
|
-
- lib/generators/ecm/links/install/templates/
|
446
|
+
- lib/generators/ecm/links/install/templates/initializer.rb
|
447
|
+
- lib/generators/ecm/links/install/templates/routes.source
|
453
448
|
- lib/generators/ecm/links/locales/locales_generator.rb
|
454
449
|
- lib/tasks/ecm_links_tasks.rake
|
455
450
|
homepage: https://github.com/robotex82/ecm_links
|
@@ -474,6 +469,6 @@ rubyforge_project:
|
|
474
469
|
rubygems_version: 2.4.8
|
475
470
|
signing_key:
|
476
471
|
specification_version: 4
|
477
|
-
summary: Link management for
|
472
|
+
summary: Link management module for ruby on rails.
|
478
473
|
test_files: []
|
479
474
|
has_rdoc:
|