redmineup 1.0.11 → 1.0.12
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/doc/CHANGELOG +4 -0
- data/lib/redmineup/acts_as_taggable/tag.rb +7 -1
- data/lib/redmineup/acts_as_taggable/up_acts_as_taggable.rb +37 -1
- data/lib/redmineup/version.rb +1 -1
- data/test/acts_as_taggable/tag_test.rb +10 -0
- data/test/fixtures/tags.yml +2 -0
- data/test/liquid/filters/additional_filter_test.rb +5 -1
- data/test/schema.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b6a7c941dfeb0f6331943c83eb73c7a42f4c05f7037a356eed48bf56eb34a39
|
4
|
+
data.tar.gz: b1cea3cb3fc3a4939f81c6b2c6dcabd95af9d07a7e98ae9678333562f4ec5f5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 166f403c0e9ce2c0bf4610ebc351d3a9960745570370130af4834691af152cb38b84f6d0c1b6cee9df2df6d193e82ff7495e61ff717fdc5ada2ce45de4c7a306
|
7
|
+
data.tar.gz: 205aa1afc05ee67941348dcf4db70b49c80129dbf8d41c2a104a68d2fdaf1dcfff7ac5962ad811304074a4796378706d50d9692222145c12c85ea3b40a1c165d
|
data/doc/CHANGELOG
CHANGED
@@ -4,6 +4,10 @@ Redmine UP gem - general functions for plugins (tags, vote, viewing, currency)
|
|
4
4
|
Copyright (C) 2011-2025 Kirill Bezrukov (RedmineUP)
|
5
5
|
https://www.redmineup.com/
|
6
6
|
|
7
|
+
== 2025-07-08 v1.0.12
|
8
|
+
|
9
|
+
* Added color to Tag
|
10
|
+
|
7
11
|
== 2025-02-04 v1.0.11
|
8
12
|
|
9
13
|
* Fixed bug with Redmine language settings
|
@@ -68,7 +68,13 @@ module Redmineup
|
|
68
68
|
group_by = "#{Tag.table_name}.id, #{Tag.table_name}.name"
|
69
69
|
# group_by << " AND #{having}" unless having.blank?
|
70
70
|
|
71
|
-
|
71
|
+
select_condition = if self.column_names.include?('color')
|
72
|
+
"#{Tag.table_name}.id, #{Tag.table_name}.name, #{Tag.table_name}.color, COUNT(*) AS count"
|
73
|
+
else
|
74
|
+
"#{Tag.table_name}.id, #{Tag.table_name}.name, COUNT(*) AS count"
|
75
|
+
end
|
76
|
+
|
77
|
+
{ :select => select_condition,
|
72
78
|
:joins => joins.join(" "),
|
73
79
|
:conditions => conditions,
|
74
80
|
:group => group_by,
|
@@ -44,7 +44,7 @@ module Redmineup
|
|
44
44
|
|
45
45
|
# Create the taggable tables
|
46
46
|
# === Options hash:
|
47
|
-
# * <tt>:table_name</tt> - use a table name other than
|
47
|
+
# * <tt>:table_name</tt> - use a table name other than tags
|
48
48
|
# To be used during migration, but can also be used in other places
|
49
49
|
def create_taggable_table(options = {})
|
50
50
|
tag_name_table = options[:tags] || :tags
|
@@ -73,6 +73,42 @@ module Redmineup
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
# Create the needed column for up_acts_as_taggable.
|
77
|
+
# To be used during migration, but can also be used in other places.
|
78
|
+
#
|
79
|
+
# Options :name, :type, :default are required
|
80
|
+
#
|
81
|
+
# By default, a :color: column will be created
|
82
|
+
#
|
83
|
+
# E.g.: ActiveRecord::Base.add_tags_column(:tags, name: :color, type: :string, default: nil)
|
84
|
+
def add_tags_column(table_name = :tags, **options)
|
85
|
+
tag_column = options || { name: :color, type: :string, default: nil }
|
86
|
+
tag_column.assert_valid_keys(:name, :type, :default)
|
87
|
+
|
88
|
+
raise ArgumentError, "Table `#{table_name}' not found" unless self.connection.table_exists?(table_name)
|
89
|
+
|
90
|
+
unless self.connection.column_exists?(table_name, tag_column[:name])
|
91
|
+
self.connection.add_column table_name, tag_column[:name], tag_column[:type], default: tag_column[:default]
|
92
|
+
self.reset_column_information
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Remove the up_acts_as_taggable specific columns
|
97
|
+
# To be used during migration, but can also be used in other places
|
98
|
+
#
|
99
|
+
# E.g.: ActiveRecord::Base.remove_tags_columns(:tags, :color, :color1)
|
100
|
+
def remove_tags_columns(table_name = :tags, *columns)
|
101
|
+
raise ArgumentError, "Table `#{table_name}' not found" unless self.connection.table_exists?(table_name)
|
102
|
+
return if columns.blank?
|
103
|
+
|
104
|
+
columns.each do |column|
|
105
|
+
if self.connection.column_exists?(table_name, column)
|
106
|
+
self.connection.remove_column table_name, column
|
107
|
+
self.reset_column_information
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
76
112
|
def drop_taggable_table(options = {})
|
77
113
|
tag_name_table = options[:tags] || :tags
|
78
114
|
if self.connection.table_exists?(tag_name_table)
|
data/lib/redmineup/version.rb
CHANGED
@@ -33,6 +33,16 @@ class TagTest < ActiveSupport::TestCase
|
|
33
33
|
assert_equal tags(:error).name, tags(:error).to_s
|
34
34
|
end
|
35
35
|
|
36
|
+
def test_color
|
37
|
+
tags.each do |tag|
|
38
|
+
if ['New feature', 'bug'].include?(tag.name)
|
39
|
+
assert_not_nil tag.color
|
40
|
+
else
|
41
|
+
assert_nil tag.color
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
36
46
|
def test_tag_is_equal_to_itself
|
37
47
|
tag = tags(:error)
|
38
48
|
assert_equal tag, tag
|
data/test/fixtures/tags.yml
CHANGED
@@ -15,7 +15,9 @@ module Redmineup
|
|
15
15
|
attachments = [attachment]
|
16
16
|
@issue_drop.define_singleton_method(:attachments) { attachments }
|
17
17
|
Attachment.stub(:latest_attach, attachment) do
|
18
|
-
|
18
|
+
expected_string = '<p>description with image ' \
|
19
|
+
'<img src=\'data:image/content_type;base64,to_base64_string\' title="attach_image" alt="attach_image" /></p>'
|
20
|
+
assert_equal expected_string, @strainer.parse_inline_attachments(text, @issue_drop)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
@@ -25,6 +27,8 @@ module Redmineup
|
|
25
27
|
attachment = Minitest::Mock.new
|
26
28
|
attachment.expect(:url, 'mock_url')
|
27
29
|
attachment.expect(:description, "attach_image")
|
30
|
+
attachment.expect(:content_type, "content_type")
|
31
|
+
attachment.expect(:to_base64_string, "to_base64_string")
|
28
32
|
attachment
|
29
33
|
end
|
30
34
|
end
|
data/test/schema.rb
CHANGED
@@ -36,6 +36,7 @@ ActiveRecord::Schema.define version: 0 do
|
|
36
36
|
|
37
37
|
create_table :tags, force: true do |t|
|
38
38
|
t.string :name
|
39
|
+
t.string :color
|
39
40
|
end
|
40
41
|
|
41
42
|
create_table :taggings, force: true do |t|
|
@@ -50,6 +51,10 @@ ActiveRecord::Schema.define version: 0 do
|
|
50
51
|
t.string :language
|
51
52
|
end
|
52
53
|
|
54
|
+
create_table :categories, force: true do |t|
|
55
|
+
t.string :name
|
56
|
+
end
|
57
|
+
|
53
58
|
create_table :issue_relations, force: true do |t|
|
54
59
|
t.integer :issue_from_id
|
55
60
|
t.integer :issue_to_id
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmineup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RedmineUP
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|