cmor_links 0.0.6.pre → 0.0.7.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/cmor/links/category.rb +3 -44
- data/app/models/cmor/links/link.rb +3 -36
- data/app/views/cmor/links/categories/_category.html.erb +1 -1
- data/config/locales/de.yml +5 -2
- data/config/locales/en.yml +5 -2
- data/db/migrate/001_create_cmor_links_categories.rb +0 -1
- data/db/migrate/002_create_cmor_links_links.rb +0 -1
- data/lib/cmor/links/configuration.rb +0 -8
- data/lib/cmor_links.rb +2 -1
- data/lib/generators/cmor/links/install/templates/initializer.rb +0 -10
- data/spec/factories/cmor_links_categories.rb +0 -1
- data/spec/factories/cmor_links_links.rb +0 -1
- metadata +32 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e2b0b374a79f8a8331a22bd287c320c8c7f53d89fa8b0a8a0d152b60f31e21a
|
4
|
+
data.tar.gz: 66f8dff8954ed3d419a4a4c76e49602e2439a8116acf81e1e4c012bd4f196da7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58dcd54abcf09135bc1e6b1978c9d2be7cc0dc0c0ab6e3baf3cb62d988deea8c98b406476094ad8a286fa973203b190828d4cef3992b43c44d612db1e76e77dc
|
7
|
+
data.tar.gz: 231e82443434ed37655076d099274eeb9ea291254ddeb3895ee21c33bc435c179b3d36856b4dc744e4523472fe862b11efed10c894b20856e1c9dde9b00af0fa
|
@@ -2,6 +2,8 @@ require_dependency 'redcloth'
|
|
2
2
|
|
3
3
|
module Cmor::Links
|
4
4
|
class Category < ActiveRecord::Base
|
5
|
+
include Markup::Rails::ActiveRecord
|
6
|
+
|
5
7
|
# associations
|
6
8
|
has_many :links, -> { order(:position) },
|
7
9
|
dependent: :destroy
|
@@ -12,8 +14,7 @@ module Cmor::Links
|
|
12
14
|
acts_as_nested_set
|
13
15
|
default_scope { order(lft: :asc) }
|
14
16
|
|
15
|
-
|
16
|
-
after_initialize :set_defaults
|
17
|
+
acts_as_markup :short_description, :long_description, Cmor::Core::Configuration.default_markup_options
|
17
18
|
|
18
19
|
# friendly id
|
19
20
|
extend FriendlyId
|
@@ -24,8 +25,6 @@ module Cmor::Links
|
|
24
25
|
validates :locale, absence: true, if: proc { |c| !c.parent.nil? }
|
25
26
|
validates :name, presence: true,
|
26
27
|
uniqueness: { scope: [:parent_id] }
|
27
|
-
validates :markup_language, presence: true,
|
28
|
-
inclusion: Configuration.markup_languages.map(&:to_s)
|
29
28
|
|
30
29
|
def human
|
31
30
|
name
|
@@ -43,48 +42,8 @@ module Cmor::Links
|
|
43
42
|
where(arel_table['link_footer_column'].not_eq(nil)).for_actual_locale
|
44
43
|
end
|
45
44
|
|
46
|
-
def long_description(options = {})
|
47
|
-
options.reverse_merge!(as: :plain)
|
48
|
-
case options[:as]
|
49
|
-
when :html
|
50
|
-
markup(self[:long_description])
|
51
|
-
else
|
52
|
-
self[:long_description]
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def short_description(options = {})
|
57
|
-
options.reverse_merge!(as: :plain)
|
58
|
-
case options[:as]
|
59
|
-
when :html
|
60
|
-
markup(self[:short_description])
|
61
|
-
else
|
62
|
-
self[:short_description]
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
45
|
def links_count
|
67
46
|
links.count
|
68
47
|
end
|
69
|
-
|
70
|
-
private
|
71
|
-
|
72
|
-
def markup(text)
|
73
|
-
case markup_language.to_sym
|
74
|
-
when :textile
|
75
|
-
return unless text
|
76
|
-
RedCloth.new(text).to_html
|
77
|
-
when :none
|
78
|
-
text
|
79
|
-
else
|
80
|
-
fail "Unsupported markup language #{markup_language}"
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def set_defaults
|
85
|
-
if self.new_record?
|
86
|
-
self.markup_language ||= Configuration.default_markup_language.to_s
|
87
|
-
end
|
88
|
-
end
|
89
48
|
end
|
90
49
|
end
|
@@ -1,50 +1,17 @@
|
|
1
1
|
require_dependency 'redcloth'
|
2
2
|
|
3
3
|
class Cmor::Links::Link < ActiveRecord::Base
|
4
|
+
include Markup::Rails::ActiveRecord
|
5
|
+
|
4
6
|
# acts as list
|
5
7
|
acts_as_list scope: :category
|
6
8
|
|
7
9
|
# associations
|
8
10
|
belongs_to :category, optional: true
|
9
11
|
|
10
|
-
|
11
|
-
# callbacks
|
12
|
-
after_initialize :set_defaults
|
13
|
-
|
14
|
-
# constants
|
15
|
-
MARKUP_LANGUAGES = %w(markdown textile rdoc)
|
12
|
+
acts_as_markup :description, Cmor::Core::Configuration.default_markup_options
|
16
13
|
|
17
14
|
# validations
|
18
15
|
validates :name, presence: true
|
19
16
|
validates :url, presence: true
|
20
|
-
validates :markup_language, presence: true,
|
21
|
-
inclusion: MARKUP_LANGUAGES
|
22
|
-
|
23
|
-
def description(options = {})
|
24
|
-
options.reverse_merge!(as: :plain)
|
25
|
-
case options[:as]
|
26
|
-
when :html
|
27
|
-
markup(self[:description])
|
28
|
-
else
|
29
|
-
self[:description]
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def markup(text)
|
36
|
-
case markup_language.to_sym
|
37
|
-
when :textile
|
38
|
-
return unless text
|
39
|
-
RedCloth.new(text).to_html
|
40
|
-
when :none
|
41
|
-
text
|
42
|
-
else
|
43
|
-
fail "Unsupported markup language #{markup_language}"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def set_defaults
|
48
|
-
self.markup_language ||= 'textile' if self.new_record?
|
49
|
-
end
|
50
17
|
end
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<%= render partial: 'cmor/links/categories/category_in_index', collection: Cmor::Links::CategoryDecorator.decorate_collection(category.descendants), as: :category %>
|
12
12
|
</div>
|
13
13
|
|
14
|
-
<div class="
|
14
|
+
<div class="links_category-links item_list">
|
15
15
|
<h2><%= Cmor::Links::Category.human_attribute_name(:cmor_links_links) %></h2>
|
16
16
|
<% if category.links.count == 0 %>
|
17
17
|
<p><%= t('cmor.links.category.messages.no_links_available') %></p>
|
data/config/locales/de.yml
CHANGED
@@ -19,7 +19,6 @@ de:
|
|
19
19
|
links_count: Links
|
20
20
|
locale: Sprache
|
21
21
|
long_description: Langbeschreibung
|
22
|
-
markup_language: Markup Sprache
|
23
22
|
name: Name
|
24
23
|
parent: Übergeordnete Kategorie
|
25
24
|
parent_id: Übergeordnete Kategorie
|
@@ -34,11 +33,15 @@ de:
|
|
34
33
|
created_at: Erstellt am
|
35
34
|
description: Beschreibung
|
36
35
|
link_actions: ''
|
37
|
-
markup_language: Markup Sprache
|
38
36
|
name: Name
|
39
37
|
position: Position
|
40
38
|
updated_at: Aktualisiert am
|
41
39
|
url: URL
|
40
|
+
cmor:
|
41
|
+
links:
|
42
|
+
category:
|
43
|
+
messages:
|
44
|
+
no_links_available: Keine Links vorhanden.
|
42
45
|
routes:
|
43
46
|
cmor_links_engine: links
|
44
47
|
categories: kategorien
|
data/config/locales/en.yml
CHANGED
@@ -19,7 +19,6 @@ en:
|
|
19
19
|
links_count: links
|
20
20
|
locale: language
|
21
21
|
long_description: long description
|
22
|
-
markup_language: markup language
|
23
22
|
name: name
|
24
23
|
parent: parent category
|
25
24
|
parent_id: parent category
|
@@ -34,11 +33,15 @@ en:
|
|
34
33
|
created_at: created at
|
35
34
|
description: description
|
36
35
|
link_action: ''
|
37
|
-
markup_language: markup language
|
38
36
|
name: name
|
39
37
|
position: position
|
40
38
|
updated_at: updated at
|
41
39
|
url: url
|
40
|
+
cmor:
|
41
|
+
links:
|
42
|
+
category:
|
43
|
+
messages:
|
44
|
+
no_links_available: There are no links here.
|
42
45
|
routes:
|
43
46
|
cmor_links_engine: links
|
44
47
|
categories: categories
|
data/lib/cmor_links.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
require '
|
1
|
+
require 'cmor_core_frontend'
|
2
2
|
require 'acts_as_list'
|
3
3
|
require 'awesome_nested_set'
|
4
4
|
require 'awesome_nested_set-tools'
|
5
5
|
require 'friendly_id'
|
6
6
|
require 'draper'
|
7
|
+
require 'markup-rails'
|
7
8
|
require 'rao-view_helper'
|
8
9
|
require 'redcloth'
|
9
10
|
|
@@ -16,14 +16,4 @@ Cmor::Links.configure do |config|
|
|
16
16
|
# Default: config.base_controller = '<%= base_controller_class_name %>'
|
17
17
|
#
|
18
18
|
config.base_controller = '<%= base_controller_class_name %>'
|
19
|
-
|
20
|
-
# Accepted markup languages
|
21
|
-
#
|
22
|
-
# default: config.markup_languages = %w[ textile ]
|
23
|
-
config.markup_languages = %w( textile )
|
24
|
-
|
25
|
-
# Default markup language
|
26
|
-
#
|
27
|
-
# default: config.default_markup_language = 'textile'
|
28
|
-
config.default_markup_language = 'textile'
|
29
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmor_links
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7.pre
|
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: 2019-04-
|
11
|
+
date: 2019-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.7.pre
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.7.pre
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cmor_core_frontend
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.0.7.pre
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.7.pre
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: sqlite3
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -290,6 +304,20 @@ dependencies:
|
|
290
304
|
- - ">="
|
291
305
|
- !ruby/object:Gem::Version
|
292
306
|
version: '0'
|
307
|
+
- !ruby/object:Gem::Dependency
|
308
|
+
name: markup-rails
|
309
|
+
requirement: !ruby/object:Gem::Requirement
|
310
|
+
requirements:
|
311
|
+
- - ">="
|
312
|
+
- !ruby/object:Gem::Version
|
313
|
+
version: '0'
|
314
|
+
type: :runtime
|
315
|
+
prerelease: false
|
316
|
+
version_requirements: !ruby/object:Gem::Requirement
|
317
|
+
requirements:
|
318
|
+
- - ">="
|
319
|
+
- !ruby/object:Gem::Version
|
320
|
+
version: '0'
|
293
321
|
- !ruby/object:Gem::Dependency
|
294
322
|
name: awesome_nested_set
|
295
323
|
requirement: !ruby/object:Gem::Requirement
|