redmineup 1.0.12 → 1.0.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b6a7c941dfeb0f6331943c83eb73c7a42f4c05f7037a356eed48bf56eb34a39
4
- data.tar.gz: b1cea3cb3fc3a4939f81c6b2c6dcabd95af9d07a7e98ae9678333562f4ec5f5d
3
+ metadata.gz: 00b24f399a84ad8b507bc4bd261e4b239fd230d95df88b6144475e991774846d
4
+ data.tar.gz: 8b7e6f842158fb6940443adb06f83b5314ecef5507acc9a1f4741aaf3c40b1ec
5
5
  SHA512:
6
- metadata.gz: 166f403c0e9ce2c0bf4610ebc351d3a9960745570370130af4834691af152cb38b84f6d0c1b6cee9df2df6d193e82ff7495e61ff717fdc5ada2ce45de4c7a306
7
- data.tar.gz: 205aa1afc05ee67941348dcf4db70b49c80129dbf8d41c2a104a68d2fdaf1dcfff7ac5962ad811304074a4796378706d50d9692222145c12c85ea3b40a1c165d
6
+ metadata.gz: f34aff4d6d617d695e0ef78697a410b8b09a8bcbdc44d5a1e6fb3dfbdfc6577cbb99eaad438cbd25124b41b10e151af0d3cb9d78fb8f9cb7a757cd1a1aef307c
7
+ data.tar.gz: a53558cb49f37db3377b33e1bd66689561f6df8a4d9529118dc2a2d523ff1b20270808d411b81cbdbf95283b14e91c90ee3d06f923440a2f1de0b444bd131fd0
data/doc/CHANGELOG CHANGED
@@ -4,7 +4,7 @@ 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
7
+ == 2025-07-09 v1.0.13
8
8
 
9
9
  * Added color to Tag
10
10
 
@@ -29,6 +29,14 @@ module Redmineup
29
29
  read_attribute(:count).to_i
30
30
  end
31
31
 
32
+ def color
33
+ return ('#' + "%06x" % super) unless super.nil?
34
+ end
35
+
36
+ def color=(color)
37
+ write_attribute(:color, color.from(1).hex) unless color.blank?
38
+ end
39
+
32
40
  class << self
33
41
  # Calculate the tag counts for all tags.
34
42
  # :start_at - Restrict the tags to those created after a certain time
@@ -82,7 +82,7 @@ module Redmineup
82
82
  #
83
83
  # E.g.: ActiveRecord::Base.add_tags_column(:tags, name: :color, type: :string, default: nil)
84
84
  def add_tags_column(table_name = :tags, **options)
85
- tag_column = options || { name: :color, type: :string, default: nil }
85
+ tag_column = options || { name: :color, type: :int, default: nil }
86
86
  tag_column.assert_valid_keys(:name, :type, :default)
87
87
 
88
88
  raise ArgumentError, "Table `#{table_name}' not found" unless self.connection.table_exists?(table_name)
@@ -1,3 +1,3 @@
1
1
  module Redmineup
2
- VERSION = '1.0.12'
2
+ VERSION = '1.0.13'
3
3
  end
@@ -34,12 +34,15 @@ class TagTest < ActiveSupport::TestCase
34
34
  end
35
35
 
36
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
37
+ colors = %w(#aaaaaa #bbbbbb)
38
+ colorized = [tags(:bug), tags(:feature)]
39
+ colorized.each do |tag|
40
+ assert_equal colors.include?(tag.color), true
41
+ end
42
+
43
+ not_colorized = [tags(:error), tags(:question)]
44
+ not_colorized.each do |tag|
45
+ assert_nil tag.color
43
46
  end
44
47
  end
45
48
 
@@ -3,11 +3,11 @@ error:
3
3
 
4
4
  feature:
5
5
  name: New feature
6
- color: '#00ff00'
6
+ color: 11184810
7
7
 
8
8
  bug:
9
9
  name: bug
10
- color: '#ff0000'
10
+ color: 12303291
11
11
 
12
12
  question:
13
13
  name: question
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.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - RedmineUP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-08 00:00:00.000000000 Z
11
+ date: 2025-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails