redmineup 1.0.6 → 1.0.9

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: d1035b01f7fb3252d090e82266fe2fba481dbbbc18648236196dddee8516d812
4
- data.tar.gz: 51c93663b752c3f39223ba51ceba2ca6ff0512414095770944c3141be4933d34
3
+ metadata.gz: 785a28d029a642ecf01ce919e3c4590b2e393bec640da155fb289eef8aedd1b9
4
+ data.tar.gz: 4fcb6f8c483751c3a110adbcadc6d2ad78191b0204fc1178623d03b968a50e3b
5
5
  SHA512:
6
- metadata.gz: bdbb9fe50b93e416a4ca632f44e389e4f095097b376ecaafd2a49454d79b819dbd0bff6704e0758272367b3d0801a096811bb88da17ce40d10e19247f8eab771
7
- data.tar.gz: da9985f0cbc49059443f68eac10e37f913ef85f8949b2cd1e84d6407c9e9d9b4aad548533e9bc7dbe36892988eda21457edeeaf7d79e8e072923f0cb85535b29
6
+ metadata.gz: bf9f8165edb02007ef48a4f8cb56a3f89d60f11fdf771706037b701d1da24017933a057961bc941e19a2afa96affcd269341b14b5443cb76d39c34dff4c5553a
7
+ data.tar.gz: fdc12c196149feb894ab2b02e46d0c216007e40adb9982e121ec208a80a1e5fa9ce77dbc66430ec54a806b9c87cc855a8d12fa0539db1bc539dcc33cf072b392
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" class="icon--sprite">
3
+ <defs>
4
+ <symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" id="icon--money">
5
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M16 6m-5 0a5 3 0 1 0 10 0a5 3 0 1 0 -10 0" /><path d="M11 6v4c0 1.657 2.239 3 5 3s5 -1.343 5 -3v-4" /><path d="M11 10v4c0 1.657 2.239 3 5 3s5 -1.343 5 -3v-4" /><path d="M11 14v4c0 1.657 2.239 3 5 3s5 -1.343 5 -3v-4" /><path d="M7 9h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3h-2.5" /><path d="M5 15v1m0 -8v1" />
6
+ </symbol>
7
+ </defs>
8
+ </svg>
@@ -1,8 +1,7 @@
1
- .icon-redmineup-money {
1
+ #admin-menu a.icon-redmineup-money:not(:has(svg)) {
2
2
  background-image: url(../images/money.png);
3
3
  }
4
4
 
5
-
6
5
  /***** Calendar *****/
7
6
  ul.cal {
8
7
  list-style: none;
data/doc/CHANGELOG CHANGED
@@ -1,9 +1,23 @@
1
- == Redmine UP gem changelog
1
+ == RedmineUP gem changelog
2
2
 
3
3
  Redmine UP gem - general functions for plugins (tags, vote, viewing, currency)
4
- Copyright (C) 2011-2024 Kirill Bezrukov (RedmineUP)
4
+ Copyright (C) 2011-2025 Kirill Bezrukov (RedmineUP)
5
5
  https://www.redmineup.com/
6
6
 
7
+ == 2025-02-04 v1.0.9
8
+
9
+ * Added regex_replace Liquid filter
10
+ * Added svg icons for Redmine 6
11
+
12
+ == 2025-01-31 v1.0.8
13
+
14
+ * Fixed compatibility patch for Redmine < 5
15
+
16
+ == 2025-01-29 v1.0.7
17
+
18
+ * Fixed parse_inline_attachments Liquid filter
19
+ * Added compatibility patch for Redmine 6 sprite_icon
20
+
7
21
  == 2024-05-07 v1.0.6
8
22
 
9
23
  * Updated Chart.js to v3.9.1
@@ -23,4 +37,4 @@ https://www.redmineup.com/
23
37
  == 2023-09-27 v1.0.0
24
38
 
25
39
  * Initial release
26
- * Mirgated from redmineup gem
40
+ * Mirgated from redmineup gem
@@ -40,7 +40,9 @@ module Redmineup
40
40
  Redmine::MenuManager.map(:admin_menu).push(:redmineup_money,
41
41
  { controller: 'redmineup', action: 'settings', id: 'money' },
42
42
  caption: :label_redmineup_money,
43
- html: { class: 'icon icon-redmineup-money' })
43
+ html: { class: 'icon icon-redmineup-money' },
44
+ icon: 'money',
45
+ plugin: :redmineup)
44
46
 
45
47
  end
46
48
 
@@ -42,6 +42,14 @@ module Redmineup
42
42
  end
43
43
  @content
44
44
  end
45
+
46
+ def to_s
47
+ filename
48
+ end
49
+
50
+ def to_base64_string
51
+ Base64.strict_encode64(File.read(@attachment.diskfile))
52
+ end
45
53
  end
46
54
  end
47
55
  end
@@ -0,0 +1,11 @@
1
+ module Redmineup
2
+ module Liquid
3
+ class CustomFieldEnumerationDrop < ::Liquid::Drop
4
+ delegate :id, :to_s, to: :@enumeration
5
+
6
+ def initialize(enumeration)
7
+ @enumeration = enumeration
8
+ end
9
+ end
10
+ end
11
+ end
@@ -35,7 +35,7 @@ module Redmineup
35
35
  end
36
36
 
37
37
  class UserDrop < ::Liquid::Drop
38
- delegate :id, :name, :firstname, :lastname, :mail, :active?, :admin?, :logged?, :language, :to => :@user, allow_nil: true
38
+ delegate :id, :name, :firstname, :lastname, :mail, :active?, :admin?, :logged?, :language, :to_s, :to => :@user, allow_nil: true
39
39
 
40
40
  def initialize(user)
41
41
  @user = user
@@ -61,8 +61,7 @@ module Redmineup
61
61
 
62
62
  def custom_field_values
63
63
  @user.custom_field_values
64
- end
65
-
64
+ end
66
65
  end
67
66
  end
68
67
  end
@@ -0,0 +1,40 @@
1
+ module Redmineup
2
+ module Liquid
3
+ class VersionDrop < ::Liquid::Drop
4
+ delegate :id,
5
+ :name,
6
+ :description,
7
+ :effective_date,
8
+ :due_date,
9
+ :wiki_page_title,
10
+ :status,
11
+ :sharing,
12
+ :default_project_version,
13
+ :start_date,
14
+ :due_date,
15
+ :estimated_hours,
16
+ :spent_hours,
17
+ :closed?,
18
+ :open?,
19
+ :completed?,
20
+ :completed_percent,
21
+ :closed_percent,
22
+ :overdue?,
23
+ :issues_count,
24
+ :open_issues_count,
25
+ :closed_issues_count,
26
+ :visible_fixed_issues,
27
+ :wiki_page,
28
+ :to_s_with_project,
29
+ :shared?,
30
+ :deletable?,
31
+ :default_project_version,
32
+ :to_s,
33
+ to: :@version
34
+
35
+ def initialize(version)
36
+ @version = version
37
+ end
38
+ end
39
+ end
40
+ end
@@ -12,12 +12,9 @@ module Redmineup
12
12
  filename, ext, alt, alttext = $1, $2, $3, $4
13
13
  # search for the picture in attachments
14
14
  if found = Attachment.latest_attach(attachments, CGI.unescape(filename))
15
- image_url = found.url
16
15
  desc = found.description.to_s.delete('"')
17
- if !desc.blank? && alttext.blank?
18
- alt = " title=\"#{desc}\" alt=\"#{desc}\""
19
- end
20
- "src=\"#{image_url}\"#{alt} loading=\"lazy\""
16
+ alt = " title=\"#{desc}\" alt=\"#{desc}\"" if !desc.blank? && alttext.blank?
17
+ "src='data:image/#{found.content_type};base64,#{found.to_base64_string}' #{alt}"
21
18
  else
22
19
  m
23
20
  end
@@ -38,6 +38,16 @@ module Redmineup
38
38
  Digest::MD5.hexdigest(input) unless input.blank?
39
39
  end
40
40
 
41
+ def regex_replace(str, regex_search, value_replace)
42
+ regex = /#{regex_search}/
43
+ return str.gsub(regex, value_replace)
44
+ end
45
+
46
+ def regex_replace_once(str, regex_search, value_replace)
47
+ regex = /#{regex_search}/
48
+ return str.sub(regex, value_replace)
49
+ end
50
+
41
51
  # example:
42
52
  # {{ "http:://www.example.com?key=hello world" | encode }}
43
53
  #
@@ -102,8 +112,9 @@ module Redmineup
102
112
  custom_value = input.custom_field_values.detect { |cfv| cfv.custom_field.name == field_name }
103
113
  if custom_value
104
114
  result = custom_value.custom_field.format.formatted_custom_value(nil, custom_value)
105
- result = result.to_s if result.is_a?(CustomFieldEnumeration)
106
- result
115
+ return result if result.respond_to?(:to_liquid)
116
+ drop_class = "Redmineup::Liquid::#{result.class.name}Drop"
117
+ Object.const_defined?(drop_class) ? drop_class.constantize.new(result) : result
107
118
  end
108
119
  end
109
120
  end
@@ -0,0 +1,21 @@
1
+ module Redmineup
2
+ module Patches
3
+ module Compatibility
4
+ module SpritePatch
5
+ def self.included(base)
6
+ base.send(:include, InstanceMethods)
7
+ end
8
+
9
+ module InstanceMethods
10
+ def sprite_icon(icon_name, label = nil, icon_only: false, size: '18', css_class: nil, sprite: "icons", plugin: nil)
11
+ label
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ unless ActionView::Base.included_modules.include?(Redmineup::Patches::Compatibility::SpritePatch)
20
+ ActionView::Base.send(:include, Redmineup::Patches::Compatibility::SpritePatch)
21
+ end
@@ -4,4 +4,7 @@ end
4
4
  if Redmine::VERSION.to_s < "5"
5
5
  require 'redmineup/patches/compatibility/user_patch'
6
6
  end
7
- require 'redmineup/patches/compatibility/routing_mapper_patch'
7
+ if Redmine::VERSION.to_s < "6"
8
+ require 'redmineup/patches/compatibility/sprite_patch'
9
+ end
10
+ require 'redmineup/patches/compatibility/routing_mapper_patch'
@@ -1,3 +1,3 @@
1
1
  module Redmineup
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.9'
3
3
  end
data/lib/redmineup.rb CHANGED
@@ -38,6 +38,8 @@ require 'redmineup/liquid/drops/users_drop'
38
38
  require 'redmineup/liquid/drops/time_entries_drop'
39
39
  require 'redmineup/liquid/drops/attachment_drop'
40
40
  require 'redmineup/liquid/drops/issue_relations_drop'
41
+ require 'redmineup/liquid/drops/version_drop'
42
+ require 'redmineup/liquid/drops/custom_field_enumeration_drop'
41
43
 
42
44
  require 'redmineup/helpers/external_assets_helper'
43
45
  require 'redmineup/helpers/form_tag_helper'
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.6
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - RedmineUP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-07 00:00:00.000000000 Z
11
+ date: 2025-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -112,6 +112,7 @@ files:
112
112
  - Gemfile
113
113
  - README.md
114
114
  - Rakefile
115
+ - app/assets/images/icons.svg
115
116
  - app/assets/images/money.png
116
117
  - app/assets/images/vcard.png
117
118
  - app/assets/javascripts/Chart.bundle.min.js.bak
@@ -164,12 +165,14 @@ files:
164
165
  - lib/redmineup/helpers/vote_helper.rb
165
166
  - lib/redmineup/hooks/views_layouts_hook.rb
166
167
  - lib/redmineup/liquid/drops/attachment_drop.rb
168
+ - lib/redmineup/liquid/drops/custom_field_enumeration_drop.rb
167
169
  - lib/redmineup/liquid/drops/issue_relations_drop.rb
168
170
  - lib/redmineup/liquid/drops/issues_drop.rb
169
171
  - lib/redmineup/liquid/drops/news_drop.rb
170
172
  - lib/redmineup/liquid/drops/projects_drop.rb
171
173
  - lib/redmineup/liquid/drops/time_entries_drop.rb
172
174
  - lib/redmineup/liquid/drops/users_drop.rb
175
+ - lib/redmineup/liquid/drops/version_drop.rb
173
176
  - lib/redmineup/liquid/filters/additional.rb
174
177
  - lib/redmineup/liquid/filters/arrays.rb
175
178
  - lib/redmineup/liquid/filters/base.rb
@@ -177,6 +180,7 @@ files:
177
180
  - lib/redmineup/money_helper.rb
178
181
  - lib/redmineup/patches/compatibility/application_controller_patch.rb
179
182
  - lib/redmineup/patches/compatibility/routing_mapper_patch.rb
183
+ - lib/redmineup/patches/compatibility/sprite_patch.rb
180
184
  - lib/redmineup/patches/compatibility/user_patch.rb
181
185
  - lib/redmineup/patches/compatibility_patch.rb
182
186
  - lib/redmineup/patches/liquid_patch.rb