ecm_references2 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0eec12851cb4a8cc1568d3cd8b91b9cf9d47cd7
4
- data.tar.gz: 5ef621a651dbbc89498d513e28279461fc0e8298
3
+ metadata.gz: c3673a28c5459957312089a130d5bb521034962a
4
+ data.tar.gz: ee6f2c9c5b7b47748d53a68bd9109fb5a68e3f66
5
5
  SHA512:
6
- metadata.gz: 78478ab24ab14599ed662a892f5ebd2cee1d23e3595201a84a797c946372929b07c48c4610a0df1c1640d0cfbb23cb89c465c1efb96b4e1947d71e60b4574d41
7
- data.tar.gz: e38a50bbc36a352de7faf6c3c25b97658f23f720ac0ef374af125f3d3a2f91934b69984c15549c15a582e45d2b16f652400874a9de536ea820b850927e0f2af3
6
+ metadata.gz: 72b14316756c4449d637c1cefc5f8beabebffda3adb5e21a44e81897c656fb4acfb5d0383c5dcb6252c28b6a4c5e342d5cb7369d6c4ea7fbcdebc45c582071de
7
+ data.tar.gz: 18a9d7ce7fa3ba6bf37384f84a9f4ec476f76b948a6323cdd9612d775e4de002b3db2537d581941b1634657739a8e5db6f8a2cc13d387ca6d49383c46ff309ae
data/README.rdoc CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  This project rocks and uses MIT-LICENSE.
4
4
 
5
+ = Migrating from 1.x.x to 2.0.0
6
+
7
+ Add active_admin-awesome_nested_set to your gemfile, if you are using activeadmin:
8
+
9
+ # Gemfile
10
+ gem 'active_admin-acts_as_list'
11
+
12
+ = Prerequisites when using active admin
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. Add it to your gemfile:
15
+
16
+ # Gemfile
17
+ gem 'active_admin-acts_as_list'
18
+ gem 'active_admin-awesome_nested_set'
19
+
5
20
  = Installation
6
21
 
7
22
  Add it to your Gemfile:
@@ -89,4 +89,4 @@ ActiveAdmin.register Ecm::References::Category do
89
89
  row :updated_at
90
90
  end
91
91
  end # sidebar
92
- end # ActiveAdmin.register Ecm::References::Category
92
+ end if Gem::Specification.find_all_by_name('activeadmin').any?
@@ -3,7 +3,7 @@ ActiveAdmin.register Ecm::References::Reference do
3
3
 
4
4
  permit_params :attached_pictures_attributes,
5
5
  :category,
6
- :ecm_categories_category_id,
6
+ :ecm_references_category_id,
7
7
  :description,
8
8
  :markup_language,
9
9
  :name,
@@ -75,4 +75,4 @@ ActiveAdmin.register Ecm::References::Reference do
75
75
  row :updated_at
76
76
  end
77
77
  end # sidebar
78
- end # ActiveAdmin.register Ecm::References::Reference
78
+ end if Gem::Specification.find_all_by_name('activeadmin').any?
@@ -3,17 +3,9 @@ module Ecm::References
3
3
  self.table_name = 'ecm_references_categories'
4
4
 
5
5
  # associations
6
- has_many :references, foreign_key: :ecm_categories_category_id,
6
+ has_many :references, foreign_key: :ecm_references_category_id,
7
7
  dependent: :destroy
8
8
 
9
- # attributes
10
- # attr_accessible :description,
11
- # :locale,
12
- # :markup_language,
13
- # :name,
14
- # :parent_id,
15
- # :slug
16
-
17
9
  # callbacks
18
10
  after_initialize :set_defaults
19
11
  before_validation :set_locale_from_parent
@@ -64,8 +56,12 @@ module Ecm::References
64
56
  references.count
65
57
  end
66
58
 
67
- def references_count_label(view)
68
- view.content_tag(:span, references_count, class: 'badge')
59
+ def public_references_count
60
+ references.with_public_visibility.count
61
+ end
62
+
63
+ def public_references_count_label(view)
64
+ view.content_tag(:span, public_references_count, class: 'badge')
69
65
  end
70
66
 
71
67
  def to_s
@@ -80,23 +76,23 @@ module Ecm::References
80
76
 
81
77
  def equality_of_locale_and_parent_locale
82
78
  locale == parent.locale
83
- end # def
79
+ end
84
80
 
85
81
  def set_defaults
86
82
  if self.new_record?
87
83
  self.markup_language ||= Ecm::References::Configuration.default_markup_language
88
84
  end
89
- end # def
85
+ end
90
86
 
91
87
  def set_locale_from_parent
92
88
  self.locale = parent.locale if parent.respond_to?(:locale)
93
- end # def
89
+ end
94
90
 
95
91
  def update_locale_on_children!
96
92
  children.each do |child|
97
93
  child.locale = locale
98
94
  child.save!
99
95
  end
100
- end # def
101
- end # class Category < ActiveRecord::Base
102
- end # module Ecm::References
96
+ end
97
+ end
98
+ end
@@ -3,8 +3,8 @@ module Ecm::References
3
3
  self.table_name = 'ecm_references_references'
4
4
 
5
5
  # acts as list
6
- acts_as_list scope: :ecm_categories_category
7
- default_scope { order('ecm_categories_category_id ASC, position ASC') }
6
+ acts_as_list scope: :ecm_references_category
7
+ default_scope { order('ecm_references_category_id ASC, position ASC') }
8
8
 
9
9
  # acts as published
10
10
  include ActsAsPublished::ActiveRecord
@@ -12,7 +12,7 @@ module Ecm::References
12
12
 
13
13
  # associations
14
14
  belongs_to :category,
15
- foreign_key: :ecm_categories_category_id
15
+ foreign_key: :ecm_references_category_id
16
16
  has_many :attached_pictures, as: :pictureable,
17
17
  class_name: Ecm::Pictures::AttachedPicture,
18
18
  inverse_of: :pictureable
@@ -22,20 +22,8 @@ module Ecm::References
22
22
  accepts_nested_attributes_for :attached_pictures, allow_destroy: true
23
23
  accepts_nested_attributes_for :pictures, allow_destroy: true
24
24
 
25
- # attributes
26
- # attr_accessible :attached_pictures_attributes,
27
- # :category,
28
- # :ecm_categories_category_id,
29
- # :description,
30
- # :markup_language,
31
- # :name,
32
- # :pictures_attributes
33
-
34
25
  # callbacks
35
26
  after_initialize :set_defaults
36
- # before_validation do
37
- # self.published = ["published"] # if @attributes.has_key?("published")
38
- # end
39
27
 
40
28
  # friendly id support
41
29
  extend FriendlyId
@@ -45,11 +33,11 @@ module Ecm::References
45
33
  acts_as_markup language: :variable, columns: [:description]
46
34
 
47
35
  # validations
48
- validates :ecm_categories_category_id, presence: true
36
+ validates :ecm_references_category_id, presence: true
49
37
  validates :markup_language, presence: true,
50
38
  inclusion: Ecm::References::Configuration.markup_languages.map(&:to_s)
51
39
  validates :name, presence: true,
52
- uniqueness: { scope: [:ecm_categories_category_id] }
40
+ uniqueness: { scope: [:ecm_references_category_id] }
53
41
 
54
42
  def self.localized
55
43
  joins(:category).where(ecm_references_categories: { locale: I18n.locale })
@@ -69,7 +57,7 @@ module Ecm::References
69
57
 
70
58
  def to_s
71
59
  name
72
- end # def
60
+ end
73
61
 
74
62
  private
75
63
 
@@ -78,6 +66,6 @@ module Ecm::References
78
66
  self.markup_language ||= Ecm::References::Configuration.default_markup_language
79
67
  self.published = Ecm::References::Configuration.new_references_published_by_default if published_at.nil?
80
68
  end
81
- end # def
82
- end # class Reference < ActiveRecord::Base
83
- end # module Ecm::References
69
+ end
70
+ end
71
+ end
@@ -3,4 +3,4 @@
3
3
  = link_to(category.tree_name, category, class: "left-padding-#{category.depth * 3}", title: category.description)
4
4
  = category.locale_label(self)
5
5
  %td.text-right
6
- = category.references_count_label(self)
6
+ = category.public_references_count_label(self)
@@ -11,7 +11,7 @@ de:
11
11
  markup_language: "Markup Sprache"
12
12
  name: Name
13
13
  parent: "Übergeordnete Kategorie"
14
- reference_count: Referenzen
14
+ references_count: Referenzen
15
15
  references: Referenzen
16
16
  slug: "Freundliche ID"
17
17
  updated_at: "Aktualisiert am"
@@ -20,6 +20,7 @@ de:
20
20
  created_at: "Erstellt am"
21
21
  description: Beschreibung
22
22
  details: Details
23
+ ecm_references_category: Kategorie
23
24
  markup_language: "Markup Sprache"
24
25
  name: Name
25
26
  preview_picture: Vorschaubild
@@ -11,7 +11,7 @@ en:
11
11
  markup_language: "markup language"
12
12
  name: name
13
13
  parent: "parent category"
14
- reference_count: references
14
+ references_count: references
15
15
  references: references
16
16
  slug: "friendly id"
17
17
  updated_at: "updated at"
@@ -20,6 +20,7 @@ en:
20
20
  created_at: "created at"
21
21
  description: description
22
22
  details: details
23
+ ecm_references_category: category
23
24
  markup_language: "markup language"
24
25
  name: name
25
26
  preview_picture: preview picture
@@ -17,7 +17,7 @@ class CreateEcmReferencesReferences < ActiveRecord::Migration
17
17
  t.string :slug
18
18
 
19
19
  # references
20
- t.references :ecm_categories_category
20
+ t.references :ecm_references_category
21
21
 
22
22
  t.timestamps
23
23
  end
@@ -5,7 +5,7 @@ module Ecm
5
5
  ActiveAdmin.setup do |config|
6
6
  config.load_paths << File.join(root, 'app/admin')
7
7
  end
8
- end
8
+ end if Gem::Specification.find_all_by_name('activeadmin').any?
9
9
  end
10
10
  end
11
11
  end
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module References
3
- VERSION = '1.0.0'
3
+ VERSION = '2.0.0'
4
4
  end
5
5
  end
@@ -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 'acts_as_markup'
5
5
  require 'acts_as_published'
@@ -6,8 +6,14 @@ module Ecm
6
6
 
7
7
  source_root File.expand_path('../templates', __FILE__)
8
8
 
9
- def generate_intializer
10
- copy_file 'ecm_references.rb', 'config/initializers/ecm_references.rb'
9
+ def generate_initializer
10
+ copy_file 'initializer.rb', 'config/initializers/ecm_references.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
11
17
  end
12
18
  end
13
19
  end
@@ -0,0 +1,5 @@
1
+
2
+ # ECM References Frontend Routing
3
+ localized do
4
+ Ecm::References::Routing.routes(self)
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_references2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
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: 2015-11-24 00:00:00.000000000 Z
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: active_admin-acts_as_list
28
+ name: acts_as_list
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - ">="
@@ -45,7 +39,7 @@ dependencies:
45
39
  - !ruby/object:Gem::Version
46
40
  version: '0'
47
41
  - !ruby/object:Gem::Dependency
48
- name: active_admin-awesome_nested_set
42
+ name: acts_as_markup
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - ">="
@@ -59,7 +53,7 @@ dependencies:
59
53
  - !ruby/object:Gem::Version
60
54
  version: '0'
61
55
  - !ruby/object:Gem::Dependency
62
- name: acts_as_list
56
+ name: acts_as_published
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - ">="
@@ -73,7 +67,7 @@ dependencies:
73
67
  - !ruby/object:Gem::Version
74
68
  version: '0'
75
69
  - !ruby/object:Gem::Dependency
76
- name: acts_as_markup
70
+ name: awesome_nested_set
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
73
  - - ">="
@@ -87,7 +81,7 @@ dependencies:
87
81
  - !ruby/object:Gem::Version
88
82
  version: '0'
89
83
  - !ruby/object:Gem::Dependency
90
- name: acts_as_published
84
+ name: awesome_nested_set-tools
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
87
  - - ">="
@@ -101,7 +95,7 @@ dependencies:
101
95
  - !ruby/object:Gem::Version
102
96
  version: '0'
103
97
  - !ruby/object:Gem::Dependency
104
- name: awesome_nested_set
98
+ name: ecm_pictures2
105
99
  requirement: !ruby/object:Gem::Requirement
106
100
  requirements:
107
101
  - - ">="
@@ -115,7 +109,7 @@ dependencies:
115
109
  - !ruby/object:Gem::Version
116
110
  version: '0'
117
111
  - !ruby/object:Gem::Dependency
118
- name: awesome_nested_set-tools
112
+ name: friendly_id
119
113
  requirement: !ruby/object:Gem::Requirement
120
114
  requirements:
121
115
  - - ">="
@@ -129,7 +123,7 @@ dependencies:
129
123
  - !ruby/object:Gem::Version
130
124
  version: '0'
131
125
  - !ruby/object:Gem::Dependency
132
- name: ecm_pictures2
126
+ name: haml-rails
133
127
  requirement: !ruby/object:Gem::Requirement
134
128
  requirements:
135
129
  - - ">="
@@ -143,7 +137,7 @@ dependencies:
143
137
  - !ruby/object:Gem::Version
144
138
  version: '0'
145
139
  - !ruby/object:Gem::Dependency
146
- name: friendly_id
140
+ name: kaminari
147
141
  requirement: !ruby/object:Gem::Requirement
148
142
  requirements:
149
143
  - - ">="
@@ -157,7 +151,7 @@ dependencies:
157
151
  - !ruby/object:Gem::Version
158
152
  version: '0'
159
153
  - !ruby/object:Gem::Dependency
160
- name: haml-rails
154
+ name: bootstrap-kaminari-views
161
155
  requirement: !ruby/object:Gem::Requirement
162
156
  requirements:
163
157
  - - ">="
@@ -171,13 +165,13 @@ dependencies:
171
165
  - !ruby/object:Gem::Version
172
166
  version: '0'
173
167
  - !ruby/object:Gem::Dependency
174
- name: kaminari
168
+ name: rails-dummy
175
169
  requirement: !ruby/object:Gem::Requirement
176
170
  requirements:
177
171
  - - ">="
178
172
  - !ruby/object:Gem::Version
179
173
  version: '0'
180
- type: :runtime
174
+ type: :development
181
175
  prerelease: false
182
176
  version_requirements: !ruby/object:Gem::Requirement
183
177
  requirements:
@@ -185,13 +179,13 @@ dependencies:
185
179
  - !ruby/object:Gem::Version
186
180
  version: '0'
187
181
  - !ruby/object:Gem::Dependency
188
- name: bootstrap-kaminari-views
182
+ name: sqlite3
189
183
  requirement: !ruby/object:Gem::Requirement
190
184
  requirements:
191
185
  - - ">="
192
186
  - !ruby/object:Gem::Version
193
187
  version: '0'
194
- type: :runtime
188
+ type: :development
195
189
  prerelease: false
196
190
  version_requirements: !ruby/object:Gem::Requirement
197
191
  requirements:
@@ -199,7 +193,7 @@ dependencies:
199
193
  - !ruby/object:Gem::Version
200
194
  version: '0'
201
195
  - !ruby/object:Gem::Dependency
202
- name: rails-dummy
196
+ name: thin
203
197
  requirement: !ruby/object:Gem::Requirement
204
198
  requirements:
205
199
  - - ">="
@@ -213,7 +207,7 @@ dependencies:
213
207
  - !ruby/object:Gem::Version
214
208
  version: '0'
215
209
  - !ruby/object:Gem::Dependency
216
- name: sqlite3
210
+ name: route_translator
217
211
  requirement: !ruby/object:Gem::Requirement
218
212
  requirements:
219
213
  - - ">="
@@ -227,7 +221,7 @@ dependencies:
227
221
  - !ruby/object:Gem::Version
228
222
  version: '0'
229
223
  - !ruby/object:Gem::Dependency
230
- name: thin
224
+ name: jquery-rails
231
225
  requirement: !ruby/object:Gem::Requirement
232
226
  requirements:
233
227
  - - ">="
@@ -241,21 +235,21 @@ dependencies:
241
235
  - !ruby/object:Gem::Version
242
236
  version: '0'
243
237
  - !ruby/object:Gem::Dependency
244
- name: activeadmin
238
+ name: rails-i18n
245
239
  requirement: !ruby/object:Gem::Requirement
246
240
  requirements:
247
- - - '='
241
+ - - ">="
248
242
  - !ruby/object:Gem::Version
249
- version: 1.0.0.pre2
243
+ version: '0'
250
244
  type: :development
251
245
  prerelease: false
252
246
  version_requirements: !ruby/object:Gem::Requirement
253
247
  requirements:
254
- - - '='
248
+ - - ">="
255
249
  - !ruby/object:Gem::Version
256
- version: 1.0.0.pre2
250
+ version: '0'
257
251
  - !ruby/object:Gem::Dependency
258
- name: devise
252
+ name: ecm_lightbox2
259
253
  requirement: !ruby/object:Gem::Requirement
260
254
  requirements:
261
255
  - - ">="
@@ -269,7 +263,7 @@ dependencies:
269
263
  - !ruby/object:Gem::Version
270
264
  version: '0'
271
265
  - !ruby/object:Gem::Dependency
272
- name: route_translator
266
+ name: less-rails
273
267
  requirement: !ruby/object:Gem::Requirement
274
268
  requirements:
275
269
  - - ">="
@@ -283,7 +277,7 @@ dependencies:
283
277
  - !ruby/object:Gem::Version
284
278
  version: '0'
285
279
  - !ruby/object:Gem::Dependency
286
- name: less-rails
280
+ name: therubyracer
287
281
  requirement: !ruby/object:Gem::Requirement
288
282
  requirements:
289
283
  - - ">="
@@ -297,7 +291,7 @@ dependencies:
297
291
  - !ruby/object:Gem::Version
298
292
  version: '0'
299
293
  - !ruby/object:Gem::Dependency
300
- name: therubyracer
294
+ name: twitter-bootstrap-rails
301
295
  requirement: !ruby/object:Gem::Requirement
302
296
  requirements:
303
297
  - - ">="
@@ -311,21 +305,21 @@ dependencies:
311
305
  - !ruby/object:Gem::Version
312
306
  version: '0'
313
307
  - !ruby/object:Gem::Dependency
314
- name: twitter-bootstrap-rails
308
+ name: activeadmin
315
309
  requirement: !ruby/object:Gem::Requirement
316
310
  requirements:
317
- - - ">="
311
+ - - '='
318
312
  - !ruby/object:Gem::Version
319
- version: '0'
313
+ version: 1.0.0.pre2
320
314
  type: :development
321
315
  prerelease: false
322
316
  version_requirements: !ruby/object:Gem::Requirement
323
317
  requirements:
324
- - - ">="
318
+ - - '='
325
319
  - !ruby/object:Gem::Version
326
- version: '0'
320
+ version: 1.0.0.pre2
327
321
  - !ruby/object:Gem::Dependency
328
- name: jquery-rails
322
+ name: devise
329
323
  requirement: !ruby/object:Gem::Requirement
330
324
  requirements:
331
325
  - - ">="
@@ -339,7 +333,7 @@ dependencies:
339
333
  - !ruby/object:Gem::Version
340
334
  version: '0'
341
335
  - !ruby/object:Gem::Dependency
342
- name: rails-i18n
336
+ name: active_admin-acts_as_list
343
337
  requirement: !ruby/object:Gem::Requirement
344
338
  requirements:
345
339
  - - ">="
@@ -353,7 +347,7 @@ dependencies:
353
347
  - !ruby/object:Gem::Version
354
348
  version: '0'
355
349
  - !ruby/object:Gem::Dependency
356
- name: ecm_lightbox2
350
+ name: active_admin-awesome_nested_set
357
351
  requirement: !ruby/object:Gem::Requirement
358
352
  requirements:
359
353
  - - ">="
@@ -492,7 +486,7 @@ dependencies:
492
486
  - - ">="
493
487
  - !ruby/object:Gem::Version
494
488
  version: '0'
495
- description: References module for active admin.
489
+ description: References module for ruby on rails.
496
490
  email:
497
491
  - roberto@vasquez-angel.de
498
492
  executables: []
@@ -531,7 +525,8 @@ files:
531
525
  - lib/ecm/references/version.rb
532
526
  - lib/ecm_references2.rb
533
527
  - lib/generators/ecm/references/install/install_generator.rb
534
- - lib/generators/ecm/references/install/templates/ecm_references.rb
528
+ - lib/generators/ecm/references/install/templates/initializer.rb
529
+ - lib/generators/ecm/references/install/templates/routes.source
535
530
  - lib/generators/ecm/references/locales/locales_generator.rb
536
531
  - lib/tasks/ecm_references_tasks.rake
537
532
  homepage: https://github.com/robotex82/ecm_references2
@@ -556,5 +551,6 @@ rubyforge_project:
556
551
  rubygems_version: 2.4.8
557
552
  signing_key:
558
553
  specification_version: 4
559
- summary: References module for active admin.
554
+ summary: References module for ruby on rails.
560
555
  test_files: []
556
+ has_rdoc: