redmineup 1.0.2 → 1.1.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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.gitlab-ci.yml +33 -0
  4. data/README.md +74 -153
  5. data/app/assets/images/icons.svg +8 -0
  6. data/app/assets/javascripts/chart.min.js +13 -0
  7. data/app/assets/javascripts/consumer.js +53 -0
  8. data/app/assets/javascripts/consumer_worker.js +219 -0
  9. data/app/assets/javascripts/jquery.colorPicker.min.js +26 -0
  10. data/{vendor → app}/assets/javascripts/select2_helpers.js +11 -1
  11. data/app/assets/stylesheets/calendars.css +15 -0
  12. data/{vendor → app}/assets/stylesheets/money.css +1 -2
  13. data/app/assets/stylesheets/redmineup.css +509 -0
  14. data/{vendor → app}/assets/stylesheets/select2.css +1 -1
  15. data/app/views/redmineup/_additional_assets.html.erb +1 -0
  16. data/config/locales/en.yml +1 -0
  17. data/config/locales/ru.yml +1 -0
  18. data/config/routes.rb +4 -0
  19. data/doc/CHANGELOG +116 -7
  20. data/doc/active-record-mixins.md +156 -0
  21. data/doc/assets-money-and-utilities.md +71 -0
  22. data/doc/tagging-and-select2.md +108 -0
  23. data/lib/action_cable/connection/rup_connection.rb +17 -0
  24. data/lib/action_cable/server/rup_configuration.rb +17 -0
  25. data/lib/action_cable/server/rup_server.rb +17 -0
  26. data/lib/application_record.rb +3 -0
  27. data/lib/redmineup/acts_as_taggable/tag.rb +26 -2
  28. data/lib/redmineup/acts_as_taggable/up_acts_as_taggable.rb +42 -2
  29. data/lib/redmineup/acts_as_viewed/up_acts_as_viewed.rb +1 -1
  30. data/lib/redmineup/acts_as_votable/votable.rb +2 -5
  31. data/lib/redmineup/assets_manager.rb +12 -1
  32. data/lib/redmineup/currency.rb +3 -1
  33. data/lib/redmineup/engine.rb +12 -2
  34. data/lib/redmineup/helpers/calendars_helper.rb +22 -0
  35. data/lib/redmineup/helpers/datetime_helper.rb +23 -0
  36. data/lib/redmineup/helpers/external_assets_helper.rb +15 -7
  37. data/lib/redmineup/helpers/form_tag_helper.rb +43 -0
  38. data/lib/redmineup/helpers/tags_helper.rb +41 -0
  39. data/lib/redmineup/helpers/test_helper.rb +12 -0
  40. data/lib/redmineup/hooks/views_layouts_hook.rb +1 -3
  41. data/lib/redmineup/liquid/drops/attachment_drop.rb +8 -0
  42. data/lib/redmineup/liquid/drops/custom_field_enumeration_drop.rb +11 -0
  43. data/lib/redmineup/liquid/drops/issues_drop.rb +11 -19
  44. data/lib/redmineup/liquid/drops/users_drop.rb +2 -3
  45. data/lib/redmineup/liquid/drops/version_drop.rb +38 -0
  46. data/lib/redmineup/liquid/filters/additional.rb +31 -0
  47. data/lib/redmineup/liquid/filters/base.rb +16 -1
  48. data/lib/redmineup/money_helper.rb +10 -2
  49. data/lib/redmineup/patches/action_cable_base_patch.rb +25 -0
  50. data/lib/redmineup/patches/action_cable_patch.rb +19 -0
  51. data/lib/redmineup/patches/auto_completes_controller_patch.rb +17 -0
  52. data/lib/redmineup/patches/compatibility/routing_mapper_patch.rb +16 -0
  53. data/lib/redmineup/patches/compatibility/sprite_patch.rb +13 -0
  54. data/lib/redmineup/patches/compatibility_patch.rb +4 -0
  55. data/lib/redmineup/patches/liquid_patch.rb +13 -22
  56. data/lib/redmineup/version.rb +1 -1
  57. data/lib/redmineup.rb +66 -40
  58. data/test/acts_as_taggable/rup_acts_as_taggable_test.rb +1 -1
  59. data/test/acts_as_taggable/tag_test.rb +16 -0
  60. data/test/acts_as_votable/votable_test.rb +9 -9
  61. data/test/acts_as_votable/voter_test.rb +4 -4
  62. data/test/database.yml +3 -3
  63. data/test/fixtures/tags.yml +2 -0
  64. data/test/liquid/drops/issues_drop_test.rb +5 -0
  65. data/test/liquid/filters/additional_filter_test.rb +35 -0
  66. data/test/liquid/filters/arrays_filter_test.rb +6 -3
  67. data/test/liquid/liquid_helper.rb +1 -1
  68. data/test/models/attachment.rb +5 -0
  69. data/test/models/issue.rb +5 -0
  70. data/test/models/journal.rb +6 -0
  71. data/test/schema.rb +65 -53
  72. data/test/tags_helper_view_test.rb +41 -0
  73. data/test/test_helper.rb +13 -12
  74. metadata +43 -14
  75. data/app/views/redmine_crm/redmineup_calendar/_calendar.html.erb +0 -34
  76. data/bitbucket-pipelines.yml +0 -50
  77. data/lib/redmineup/compatibility/application_controller_patch.rb +0 -33
  78. data/lib/redmineup/compatibility/routing_mapper_patch.rb +0 -25
  79. data/lib/redmineup/helpers/rup_calendar_helper.rb +0 -146
  80. /data/{vendor → app}/assets/images/money.png +0 -0
  81. /data/{vendor → app}/assets/images/vcard.png +0 -0
  82. /data/{vendor/assets/javascripts/Chart.bundle.min.js → app/assets/javascripts/Chart.bundle.min.js.bak} +0 -0
  83. /data/{vendor → app}/assets/javascripts/select2.js +0 -0
@@ -18,6 +18,7 @@ module Redmineup
18
18
  # * <tt>:allow_clear</tt> Provides support for clearable selections. Default value false.
19
19
  # * <tt>:min_input_length</tt> Minimum number of characters required to start a search. Default value 0.
20
20
  # * <tt>:format_state</tt> Defines template of search results in the drop-down.
21
+ # * <tt>:on_select</tt> Global JS callback name bound to `select2:select` event.
21
22
  # * <tt>:tags</tt> Used to enable tagging feature.
22
23
  #
23
24
  # <b>Note:</b> The HTML specification says when +multiple+ parameter passed to select and all options got deselected
@@ -49,6 +50,31 @@ module Redmineup
49
50
 
50
51
  alias select2 select2_tag
51
52
 
53
+ # Renders a select2 tag field for a tag list (standalone, no form object).
54
+ # Analogous to text_field_tag.
55
+ #
56
+ # ==== Example
57
+ # tag_list_field_tag 'entry[tag_list]', entry.tag_list,
58
+ # url: auto_complete_taggable_tags_path(taggable_type: 'DriveEntry')
59
+ def tag_list_field_tag(name, value = [], options = {})
60
+ url = options.delete(:url)
61
+ taggable_type = options.delete(:taggable_type)
62
+ width = options.delete(:width)
63
+ project_id = options.delete(:project_id)
64
+ placeholder = options.delete(:placeholder)
65
+ select2_tag(
66
+ name,
67
+ options_for_select(value, value),
68
+ {
69
+ multiple: true,
70
+ width: width || '95%',
71
+ url: url || auto_complete_taggable_tags_path(taggable_type: taggable_type, project_id: project_id),
72
+ placeholder: placeholder || l(:lable_redmineup_add_tag),
73
+ tags: true
74
+ }.merge(options)
75
+ )
76
+ end
77
+
52
78
  # Transforms select filters of +type+ fields into select2
53
79
  #
54
80
  # ==== Examples
@@ -86,3 +112,20 @@ module Redmineup
86
112
 
87
113
  end
88
114
  end
115
+
116
+ # Extends Rails FormBuilder with tag_list_field, analogous to f.text_field.
117
+ #
118
+ # ==== Example
119
+ # <%= f.tag_list_field :tag_list %>
120
+ ActionView::Helpers::FormBuilder.class_eval do
121
+ def tag_list_field(method, **options)
122
+ url = options.fetch(:url) {
123
+ @template.auto_complete_taggable_tags_path(taggable_type: @object.class.name)
124
+ }
125
+ @template.tag_list_field_tag(
126
+ "#{@object_name}[#{method}]",
127
+ @object.public_send(method),
128
+ {url: url}.merge(options.except(:url))
129
+ )
130
+ end
131
+ end
@@ -9,5 +9,46 @@ module Redmineup
9
9
  yield tag, classes[index]
10
10
  end
11
11
  end
12
+
13
+ def tag_link(url, tag_name, options = {})
14
+ count = options.delete(:count)
15
+ inner = link_to(tag_name, url, options)
16
+ inner << content_tag('span', "(#{count})", class: 'tag-count') if count
17
+ css = monochrome? ? 'tag-label' : 'tag-label-color'
18
+ style = monochrome? ? {} : { style: "background-color: #{Redmineup::ActsAsTaggable::Tag.color_from_name(tag_name)}" }
19
+ content_tag(:span, inner, { class: css }.merge(style))
20
+ end
21
+
22
+ def tag_separator
23
+ monochrome? ? ', ' : ' '
24
+ end
25
+
26
+ def monochrome?
27
+ @monochrome ||= defined?(RedmineupTags) && !RedmineupTags.use_colors?
28
+ end
29
+
30
+ def tag_links(tag_list, options = {}, &url_block)
31
+ return if tag_list.blank?
32
+ content_tag(:span, class: 'tag_list') do
33
+ safe_join(tag_list.map { |tag| tag_link(url_block.call(tag), tag, options.dup) }, tag_separator)
34
+ end
35
+ end
36
+
37
+ # Renders span.tag_list from an array of tag objects (respond to .name and .count).
38
+ # Resolves URL via `{key}_tag_url(name)` in the current view context.
39
+ #
40
+ # tag_cloud_links(contact.available_tags, :contact) # → contact_tag_url(name)
41
+ # tag_cloud_links(tags_cloud, :people) # → people_tag_url(name)
42
+ def tag_cloud_links(tags, key, options = {})
43
+ return if tags.blank?
44
+ url_method = :"#{key}_tag_url"
45
+ raise NoMethodError, "#{url_method} is not defined in view context" unless respond_to?(url_method, true)
46
+ content_tag(:span, class: 'tag_list') do
47
+ safe_join(tags.map { |tag|
48
+ tag_link(send(url_method, tag.name), tag.name, options.merge(count: tag.count).dup)
49
+ }, tag_separator)
50
+ end
51
+ end
52
+
12
53
  end
13
54
  end
@@ -0,0 +1,12 @@
1
+ module Redmineup
2
+ module TestHelper
3
+ module ClassMethods
4
+ def load_plugin_fixtures(plugin_name, *names)
5
+ fixtures_dir = File.join(Redmine::Plugin.find(plugin_name).directory, 'test', 'fixtures')
6
+ ActiveRecord::FixtureSet.create_fixtures(fixtures_dir, names)
7
+ end
8
+ end
9
+ end
10
+ end
11
+
12
+ ActiveSupport::TestCase.extend Redmineup::TestHelper::ClassMethods
@@ -3,9 +3,7 @@
3
3
  module Redmineup
4
4
  module Hooks
5
5
  class ViewsLayoutsHook < Redmine::Hook::ViewListener
6
- def view_layouts_base_html_head(_context = {})
7
- stylesheet_link_tag(:money, plugin: 'redmineup')
8
- end
6
+ render_on :view_layouts_base_html_head, partial: 'redmineup/additional_assets'
9
7
  end
10
8
  end
11
9
  end
@@ -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,6 +35,7 @@ module Redmineup
35
35
 
36
36
  delegate :id,
37
37
  :subject,
38
+ :description,
38
39
  :visible?,
39
40
  :closed?,
40
41
  :start_date,
@@ -71,6 +72,10 @@ module Redmineup
71
72
  @assignee ||= UserDrop.new(@issue.assigned_to)
72
73
  end
73
74
 
75
+ def attachments
76
+ @attachments ||= @issue.attachments.map { |attachment| AttachmentDrop.new(attachment) }
77
+ end
78
+
74
79
  def tracker
75
80
  @tracker ||= @issue.tracker && @issue.tracker.name
76
81
  end
@@ -103,10 +108,6 @@ module Redmineup
103
108
  @project ||= ProjectDrop.new @issue.project if @issue.project
104
109
  end
105
110
 
106
- def description
107
- @description ||= replace_images_urls(@issue.description)
108
- end
109
-
110
111
  def subtasks
111
112
  @subtasks ||= IssuesDrop.new @issue.children
112
113
  end
@@ -120,11 +121,11 @@ module Redmineup
120
121
  end
121
122
 
122
123
  def notes
123
- @notes ||= @issue.journals.where.not(notes: [nil, '']).order(:created_on).map(&:notes).map { |note| replace_images_urls(note) }
124
+ @notes ||= @issue.journals.where.not(notes: [nil, '']).order(:created_on).map(&:notes)
124
125
  end
125
126
 
126
127
  def journals
127
- @journals ||= JournalsDrop.new(@issue.journals.where.not(notes: nil).find_each { |journal| journal.notes = replace_images_urls(journal.notes) })
128
+ @journals ||= JournalsDrop.new @issue.journals.where.not(notes: [nil, ''])
128
129
  end
129
130
 
130
131
  def tags
@@ -158,19 +159,6 @@ module Redmineup
158
159
  def custom_field_values
159
160
  @issue.custom_field_values
160
161
  end
161
-
162
- private
163
-
164
- def replace_images_urls(text)
165
- text.gsub(/\!.*\!/) do |i_name|
166
- i_name = i_name.delete('!')
167
- i_name_css = i_name.scan(/^\{.*\}/).first.to_s
168
- attachment = @issue.attachments.find_by(filename: i_name.gsub(i_name_css, ''))
169
- image = AttachmentDrop.new attachment if attachment
170
- attach_url = image.try(:url)
171
- attach_url ? "!#{i_name_css}#{attach_url}!" : i_name
172
- end
173
- end
174
162
  end
175
163
 
176
164
  class JournalsDrop < ::Liquid::Drop
@@ -212,6 +200,10 @@ module Redmineup
212
200
  def issue
213
201
  @issue ||= IssueDrop.new @journal.issue if @journal.issue
214
202
  end
203
+
204
+ def attachments
205
+ @attachments ||= @journal.attachments.map { |attachment| AttachmentDrop.new(attachment) }
206
+ end
215
207
  end
216
208
  end
217
209
  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,38 @@
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
+ :estimated_hours,
15
+ :spent_hours,
16
+ :closed?,
17
+ :open?,
18
+ :completed?,
19
+ :completed_percent,
20
+ :closed_percent,
21
+ :overdue?,
22
+ :issues_count,
23
+ :open_issues_count,
24
+ :closed_issues_count,
25
+ :visible_fixed_issues,
26
+ :wiki_page,
27
+ :to_s_with_project,
28
+ :shared?,
29
+ :deletable?,
30
+ :to_s,
31
+ to: :@version
32
+
33
+ def initialize(version)
34
+ @version = version
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,31 @@
1
+ require 'liquid'
2
+
3
+ module Redmineup
4
+ module Liquid
5
+ module Filters
6
+ module Additional
7
+ def parse_inline_attachments(text, obj)
8
+ attachments = obj.attachments if obj.respond_to?(:attachments)
9
+
10
+ if attachments.present?
11
+ text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpe|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m|
12
+ filename, ext, alt, alttext = $1, $2, $3, $4
13
+ # search for the picture in attachments
14
+ if found = Attachment.latest_attach(attachments, CGI.unescape(filename))
15
+ desc = found.description.to_s.delete('"')
16
+ alt = " title=\"#{desc}\" alt=\"#{desc}\"" if !desc.blank? && alttext.blank?
17
+ "src='data:image/#{found.content_type};base64,#{found.to_base64_string}' #{alt}"
18
+ else
19
+ m
20
+ end
21
+ end
22
+ end
23
+
24
+ text
25
+ end
26
+ end
27
+
28
+ ::Liquid::Template.register_filter(Redmineup::Liquid::Filters::Additional)
29
+ end
30
+ end
31
+ 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
  #
@@ -100,7 +110,12 @@ module Redmineup
100
110
  def custom_field(input, field_name)
101
111
  if input.respond_to?(:custom_field_values)
102
112
  custom_value = input.custom_field_values.detect { |cfv| cfv.custom_field.name == field_name }
103
- custom_value.custom_field.format.formatted_custom_value(nil, custom_value) if custom_value
113
+ if custom_value
114
+ result = custom_value.custom_field.format.formatted_custom_value(nil, custom_value)
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
118
+ end
104
119
  end
105
120
  end
106
121
 
@@ -8,11 +8,19 @@ module Redmineup
8
8
  price_to_currency(obj.try(price_field), obj.currency, options).to_s if obj.respond_to?(:currency)
9
9
  end
10
10
 
11
- def prices_collection_by_currency(prices_collection, options = {})
11
+ def prices_formatted_collection(prices_collection, options = {})
12
12
  return [] if prices_collection.blank? || prices_collection == 0
13
13
  prices = prices_collection
14
14
  prices.reject!{|k, v| v.to_i == 0} if options[:hide_zeros]
15
- prices.collect{|k, v| content_tag(:span, price_to_currency(v, k, :symbol => true), :style => "white-space: nowrap;")}.compact
15
+ prices.map { |k, v| price_to_currency(v, k, symbol: true) }.compact
16
+ end
17
+
18
+ def prices_collection_by_currency(prices_collection, options = {})
19
+ formatted_prices = prices_formatted_collection(prices_collection, options)
20
+
21
+ formatted_prices.map do |formatted_price|
22
+ content_tag(:span, formatted_price, :style => "white-space: nowrap;")
23
+ end
16
24
  end
17
25
 
18
26
  def deal_currency_icon(currency)
@@ -0,0 +1,25 @@
1
+ module Redmineup
2
+ module Patches
3
+ module ActionCableBasePatch
4
+ def self.prepended(base)
5
+ base.extend(ClassMethods)
6
+ base.delegate :rup_broadcast_to, to: :class
7
+ end
8
+
9
+ module ClassMethods
10
+ def rup_broadcast_to(*args)
11
+ # TODO: Remove to 2 args after plugins update
12
+ if args.length == 3
13
+ klass, model, message = args
14
+ ActionCable.rup_server(klass).broadcast(broadcasting_for(model), message)
15
+ else
16
+ model, message = args
17
+ ActionCable.rup_server.broadcast(broadcasting_for(model), message)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ ActionCable::Channel::Base.prepend(Redmineup::Patches::ActionCableBasePatch)
@@ -0,0 +1,19 @@
1
+ module Redmineup
2
+ module Patches
3
+ module ActionCablePatch
4
+ def self.prepended(base)
5
+ base.class_eval do
6
+ module_function def rup_server(klass = 'ActionCable::Connection::RupConnection')
7
+ @rup_servers ||= {}
8
+ return @rup_servers[klass] if @rup_servers[klass]
9
+
10
+ config = ActionCable::Server::RupConfiguration.new(connection_klass: klass)
11
+ @rup_servers[klass] = ActionCable::Server::RupServer.new(config: config)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ ActionCable.prepend(Redmineup::Patches::ActionCablePatch)
@@ -0,0 +1,17 @@
1
+ module Redmineup
2
+ module Patches
3
+ module AutoCompletesControllerPatch
4
+ DEFAULT_TAGS_LIMIT = 10
5
+
6
+ def taggable_tags
7
+ limit = params.delete(:limit) || DEFAULT_TAGS_LIMIT
8
+ klass = Object.const_get(params[:taggable_type].camelcase) if params[:taggable_type].present?
9
+
10
+ tags = klass && klass.available_tags(params.merge(limit: limit, name_like: params[:q])) || Redmineup::ActsAsTaggable::Tag.limit(limit)
11
+ render json: tags.map { |tag| { id: tag.name, text: tag.name } }
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ AutoCompletesController.prepend(Redmineup::Patches::AutoCompletesControllerPatch)
@@ -0,0 +1,16 @@
1
+ module Redmineup
2
+ module Patches
3
+ module Compatibility
4
+ module RoutingMapperPatch
5
+ def constraints(options = {}, &block)
6
+ return super(options, &block) unless options.is_a?(Hash)
7
+
8
+ options[:object_type] = /.+/ if options[:object_type] && options[:object_type].is_a?(Regexp)
9
+ super(options, &block)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ ActionDispatch::Routing::Mapper.prepend(Redmineup::Patches::Compatibility::RoutingMapperPatch)
@@ -0,0 +1,13 @@
1
+ module Redmineup
2
+ module Patches
3
+ module Compatibility
4
+ module SpritePatch
5
+ def sprite_icon(icon_name, label = '', icon_only: false, size: '18', css_class: nil, sprite: "icons", plugin: nil, rtl: false)
6
+ label
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
12
+
13
+ ApplicationHelper.prepend(Redmineup::Patches::Compatibility::SpritePatch)
@@ -0,0 +1,4 @@
1
+ if Redmine::VERSION.to_s < "6"
2
+ require 'redmineup/patches/compatibility/sprite_patch'
3
+ end
4
+ require 'redmineup/patches/compatibility/routing_mapper_patch'
@@ -2,32 +2,23 @@ module Redmineup
2
2
  module Patches
3
3
  module LiquidPatch
4
4
  module StandardFilters
5
+ private
5
6
 
6
- def self.included(base)
7
- base.class_eval do
8
-
9
- private
10
-
11
- def to_number(obj)
12
- case obj
13
- when Float
14
- BigDecimal(obj.to_s)
15
- when Numeric
16
- obj
17
- when String
18
- (obj.strip =~ /^\d+\.\d+$/) ? BigDecimal(obj) : obj.to_i
19
- else
20
- 0
21
- end
22
- end
7
+ def to_number(obj)
8
+ case obj
9
+ when Float
10
+ BigDecimal(obj.to_s)
11
+ when Numeric
12
+ obj
13
+ when String
14
+ (obj.strip =~ /^\d+\.\d+$/) ? BigDecimal(obj) : obj.to_i
15
+ else
16
+ 0
23
17
  end
24
18
  end
25
-
26
19
  end
27
20
  end
28
21
  end
29
22
  end
30
-
31
- unless Liquid::StandardFilters.included_modules.include?(Redmineup::Patches::LiquidPatch::StandardFilters)
32
- Liquid::StandardFilters.send(:include, Redmineup::Patches::LiquidPatch::StandardFilters)
33
- end
23
+
24
+ Liquid::StandardFilters.prepend(Redmineup::Patches::LiquidPatch::StandardFilters)
@@ -1,3 +1,3 @@
1
1
  module Redmineup
2
- VERSION = '1.0.2'
2
+ VERSION = '1.1.13'
3
3
  end