redmine_crm 0.0.60 → 0.0.61

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4adb8a5f98b9989c95a54071384b427de1c34bcb21796475973f2b26e29d5d21
4
- data.tar.gz: d2d29aefe59b7f0d9ce46e1d8586ac0bb2aa913d2d2a6d5435f88510f4ee1065
3
+ metadata.gz: 6c71d48ccbfad49844db606ac43e6927c07fbc886770df6f2e2cddcdd95a6081
4
+ data.tar.gz: de57d13eb0eebdd8b58b095938d5266ee5bcfd043a41fee736cfa5f4e0d4a436
5
5
  SHA512:
6
- metadata.gz: e42a0654d5415acbdfafd653096eea4c0276d75fb0b489e1cf9034b773bdcac837be3ef4690ae48ecfa855fd17ba8d5bbcdd10810233e33e82775cb3b9a777da
7
- data.tar.gz: 58290aa95c957eb789bb5d02d8c7f59b61da91169ebd689fe4f1fb2dfc52a1a9221728e074ec7a5868d6469c838aeeaec1f2448dae348afb9edeb0a8294c23ec
6
+ metadata.gz: '096a9b92b027b8d5229dd95305a1b63f4a0250266cf50454ff650ea6b16b2255ae9ca2c938bc4b00d09ad7b3c7af11c30535f05a7b7c9e23762d807b04d4611f'
7
+ data.tar.gz: 4140df48577e1ff647ee18bc7c24347528648bc7de68ffe17c12804256fce43134e16405d5d17eff7b4bdc6d3c53dfeb28514913d1f57d50cf4a42dbce2648ff
@@ -12,6 +12,7 @@ pipelines:
12
12
  script:
13
13
  - sed -i "s/'sqlite3'/'sqlite3', '~> 1.3.6'/g" redmine_crm.gemspec
14
14
  - sed -i "s/'mysql2'/'mysql2', '~> 0.4.0'/g" redmine_crm.gemspec
15
+ - sed -i "s/'rubyzip'/'rubyzip'\n spec.add_runtime_dependency 'loofah', '~>2.19.1'/g" redmine_crm.gemspec
15
16
  - bundle install
16
17
  - bundle exec rake test DB=sqlite
17
18
  - bundle exec rake test DB=postgresql
@@ -1813,7 +1813,7 @@
1813
1813
  "priority": 100,
1814
1814
  "iso_code": "RUB",
1815
1815
  "name": "Russian Ruble",
1816
- "symbol": "RUB",
1816
+ "symbol": "",
1817
1817
  "alternate_symbols": ["руб.", "р."],
1818
1818
  "subunit": "Kopeck",
1819
1819
  "subunit_to_unit": 100,
data/doc/CHANGELOG CHANGED
@@ -4,6 +4,11 @@ Redmine crm gem - general functions for plugins (tags, vote, viewing, currency)
4
4
  Copyright (C) 2011-2023 RedmineUP
5
5
  https://www.redmineup.com/
6
6
 
7
+ == 2023-09-27 v0.0.61
8
+
9
+ * Reverted time picker calendar
10
+ * Added helper methods for time format
11
+
7
12
  == 2023-09-20 v0.0.60
8
13
 
9
14
  * Fixed SQL injection
@@ -16,12 +16,5 @@ module RedmineCrm
16
16
  javascript_include_tag('Chart.bundle.min', plugin: GEM_NAME)
17
17
  end
18
18
 
19
- def timepicker_assets
20
- return if @timepicker_tag_included
21
-
22
- @timepicker_tag_included = true
23
- javascript_include_tag('timepicker_addon', plugin: GEM_NAME) +
24
- stylesheet_link_tag('timepicker_addon', plugin: GEM_NAME)
25
- end
26
19
  end
27
20
  end
@@ -73,33 +73,16 @@ module RedmineCrm
73
73
  javascript_tag("setSelect2Filter('#{type}', #{options.to_json});") unless type.empty?
74
74
  end
75
75
 
76
- def datetime_calendar_for(field_id)
77
- include_datetime_calendar_headers_tags
78
- javascript_tag("$(function() { $('##{field_id}').datetimepicker(dateTimePickerOptions); });")
76
+ def format_datetime(time)
77
+ formated_time = format_time(time, false)
78
+ formated_date = ::I18n.l(time.to_date, format: '%Y-%m-%d')
79
+ "#{formated_date} #{formated_time}"
79
80
  end
80
81
 
81
- def include_datetime_calendar_headers_tags
82
- unless @datetime_calendar_headers_tags
83
- tags = ''.html_safe
84
- @datetime_calendar_headers_tags = true
85
- content_for :header_tags do
86
- start_of_week = Setting.start_of_week
87
- start_of_week = l(:general_first_day_of_week, :default => '1') if start_of_week.blank?
88
- start_of_week = start_of_week.to_i % 7
82
+ def format_datetime_date(time)
83
+ formated_date = ::I18n.l(time.to_date, format: '%Y-%m-%d')
84
+ "#{formated_date}"
85
+ end
89
86
 
90
- locale_keys = ::I18n.backend.send(:translations)[::I18n.config.locale]
91
- time_format = Setting.time_format.blank? ? locale_keys[:time][:formats][:time] : Setting.time_format
92
- time_format = time_format.to_s.gsub('%H', 'H').gsub('%I', 'hh').gsub('%M', 'mm').gsub('%p', 'tt')
93
-
94
- date_format = 'yy-mm-dd'
95
- tags << javascript_tag(
96
- "var dateTimePickerOptions = {dateFormat: '#{date_format}', timeFormat: '#{time_format}', firstDay: #{start_of_week}," +
97
- "showOn: 'button', buttonImageOnly: true, buttonImage: '" +
98
- path_to_image('/images/calendar.png') +
99
- "', showButtonPanel: true, controlType: 'select', oneLine: true, };")
100
- tags
101
- end
102
- end
103
- end
104
87
  end
105
88
  end
@@ -35,7 +35,6 @@ module RedmineCrm
35
35
 
36
36
  delegate :id,
37
37
  :subject,
38
- :description,
39
38
  :visible?,
40
39
  :closed?,
41
40
  :start_date,
@@ -104,6 +103,10 @@ module RedmineCrm
104
103
  @project ||= ProjectDrop.new @issue.project if @issue.project
105
104
  end
106
105
 
106
+ def description
107
+ @description ||= replace_images_urls(@issue.description)
108
+ end
109
+
107
110
  def subtasks
108
111
  @subtasks ||= IssuesDrop.new @issue.children
109
112
  end
@@ -117,11 +120,11 @@ module RedmineCrm
117
120
  end
118
121
 
119
122
  def notes
120
- @notes ||= @issue.journals.where("#{Journal.table_name}.notes IS NOT ?", nil).order(:created_on).map(&:notes)
123
+ @notes ||= @issue.journals.where.not(notes: [nil, '']).order(:created_on).map(&:notes).map { |note| replace_images_urls(note) }
121
124
  end
122
125
 
123
126
  def journals
124
- @journals ||= JournalsDrop.new @issue.journals.where("#{Journal.table_name}.notes IS NOT ?", nil)
127
+ @journals ||= JournalsDrop.new(@issue.journals.where.not(notes: nil).find_each { |journal| journal.notes = replace_images_urls(journal.notes) })
125
128
  end
126
129
 
127
130
  def tags
@@ -155,6 +158,19 @@ module RedmineCrm
155
158
  def custom_field_values
156
159
  @issue.custom_field_values
157
160
  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
158
174
  end
159
175
 
160
176
  class JournalsDrop < ::Liquid::Drop
@@ -1,3 +1,3 @@
1
1
  module RedmineCrm
2
- VERSION = '0.0.60'
2
+ VERSION = '0.0.61'
3
3
  end
@@ -61,7 +61,7 @@ module RedmineCrm
61
61
  end
62
62
 
63
63
  def test_currency_filter
64
- assert_equal '99,99 RUB', @liquid_render.render("{{99.99 | currency: 'RUB' }}")
64
+ assert_equal '99,99 ', @liquid_render.render("{{99.99 | currency: 'RUB' }}")
65
65
  end
66
66
  end
67
67
  end
@@ -5,7 +5,7 @@ class MoneyHelperTest < ActiveSupport::TestCase
5
5
 
6
6
  def test_price_to_currency
7
7
  assert_equal '$3,265.65', price_to_currency(3265.65, 'USD')
8
- assert_equal '3.265,65 RUB', price_to_currency(3265.65, 'RUB')
8
+ assert_equal '3.265,65 ', price_to_currency(3265.65, 'RUB')
9
9
  assert_equal '3,200.0', price_to_currency(3200, '')
10
10
  assert_equal '3,200.0', price_to_currency(3200, 'Foo')
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_crm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.60
4
+ version: 0.0.61
5
5
  platform: ruby
6
6
  authors:
7
7
  - RedmineUP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-20 00:00:00.000000000 Z
11
+ date: 2023-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails