redmine_crm 0.0.60 → 0.0.62
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/bitbucket-pipelines.yml +1 -0
- data/config/currency_iso.json +1 -1
- data/doc/CHANGELOG +9 -0
- data/lib/redmine_crm/helpers/calendars_helper.rb +22 -0
- data/lib/redmine_crm/helpers/external_assets_helper.rb +0 -7
- data/lib/redmine_crm/helpers/form_tag_helper.rb +8 -25
- data/lib/redmine_crm/hooks/views_layouts_hook.rb +1 -0
- data/lib/redmine_crm/liquid/drops/issues_drop.rb +19 -3
- data/lib/redmine_crm/version.rb +1 -1
- data/lib/redmine_crm.rb +2 -0
- data/test/liquid/filters/base_filter_test.rb +1 -1
- data/test/money_helper_test.rb +1 -1
- data/vendor/assets/stylesheets/calendars.css +15 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc50c105951bb021c6259da95f9cef9fdd018e4c97e5f6647b1d7e52587e0a97
|
4
|
+
data.tar.gz: e61bf0a052d3d7b4b6b50f8af5ef94ab384bc1487bdc1eb1bdbe27779225fdda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3efd69c7eb987ef3b570c3a97916b2e448063021b01a16cee2acb4119ad30ce46f8a7d8fc8b4d8267eaa6886115d0cda3c214e6f719c45b7792a629600790cf1
|
7
|
+
data.tar.gz: 2352b2d60a060152002120defc453fdb7aab2617677d38c31ada078226a5887f74cef6361c31333a20ea57b3709b2c388895b62821d85d6136e8173ea49910b5
|
data/bitbucket-pipelines.yml
CHANGED
@@ -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
|
data/config/currency_iso.json
CHANGED
data/doc/CHANGELOG
CHANGED
@@ -4,6 +4,15 @@ 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-11-15 v0.0.62
|
8
|
+
|
9
|
+
* Redmine 5.1 compatibility fixes
|
10
|
+
|
11
|
+
== 2023-09-27 v0.0.61
|
12
|
+
|
13
|
+
* Reverted time picker calendar
|
14
|
+
* Added helper methods for time format
|
15
|
+
|
7
16
|
== 2023-09-20 v0.0.60
|
8
17
|
|
9
18
|
* Fixed SQL injection
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RedmineCrm
|
2
|
+
module CalendarsHelper
|
3
|
+
|
4
|
+
def calendar_day_css_classes(calendar, day)
|
5
|
+
css = day.month==calendar.month ? +'even' : +'odd'
|
6
|
+
css << " today" if User.current.today == day
|
7
|
+
css << " nwday" if non_working_week_days.include?(day.cwday)
|
8
|
+
css
|
9
|
+
end
|
10
|
+
|
11
|
+
def non_working_week_days
|
12
|
+
@non_working_week_days ||= begin
|
13
|
+
days = Setting.non_working_week_days
|
14
|
+
if days.is_a?(Array) && days.size < 7
|
15
|
+
days.map(&:to_i)
|
16
|
+
else
|
17
|
+
[]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -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
|
77
|
-
|
78
|
-
|
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
|
82
|
-
|
83
|
-
|
84
|
-
|
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(
|
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
|
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
|
data/lib/redmine_crm/version.rb
CHANGED
data/lib/redmine_crm.rb
CHANGED
@@ -38,6 +38,7 @@ require 'redmine_crm/liquid/drops/time_entries_drop'
|
|
38
38
|
require 'redmine_crm/liquid/drops/attachment_drop'
|
39
39
|
require 'redmine_crm/liquid/drops/issue_relations_drop'
|
40
40
|
|
41
|
+
require 'redmine_crm/helpers/calendars_helper'
|
41
42
|
require 'redmine_crm/helpers/external_assets_helper'
|
42
43
|
require 'redmine_crm/helpers/form_tag_helper'
|
43
44
|
require 'redmine_crm/assets_manager'
|
@@ -59,6 +60,7 @@ end
|
|
59
60
|
RedmineCrm::AssetsManager.install_assets
|
60
61
|
|
61
62
|
if defined?(ActionView::Base)
|
63
|
+
ActionView::Base.send :include, RedmineCrm::CalendarsHelper
|
62
64
|
ActionView::Base.send :include, RedmineCrm::ExternalAssetsHelper
|
63
65
|
ActionView::Base.send :include, RedmineCrm::FormTagHelper
|
64
66
|
end
|
data/test/money_helper_test.rb
CHANGED
@@ -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
|
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
|
@@ -0,0 +1,15 @@
|
|
1
|
+
table.cal {width: 100%; margin: 0 0 6px 0; border: 1px solid #c0c0c0; border-spacing: 0; border-radius: 3px;}
|
2
|
+
table.cal thead th {width: 14%; background-color:#EEEEEE; padding: 4px; }
|
3
|
+
table.cal thead th.week-number {width: auto;}
|
4
|
+
table.cal tbody tr {height: 100px;}
|
5
|
+
table.cal td .icon {padding-top: 2px; padding-bottom: 3px;}
|
6
|
+
table.cal td {border: 1px solid #d7d7d7; vertical-align: top; font-size: 0.9em; border-bottom: 0; border-right: 0;}
|
7
|
+
table.cal td.week-number { background-color:#EEEEEE; padding: 4px; border:none; font-size: 1em;}
|
8
|
+
table.cal td p.day-num {font-size: 1.1em; text-align:right;}
|
9
|
+
table.cal td.odd p.day-num {color: #bbb;}
|
10
|
+
table.cal td.today {background:#ffffdd;}
|
11
|
+
table.cal td.today p.day-num {font-weight: bold;}
|
12
|
+
table.cal td.nwday:not(.odd) {background-color:#f1f1f1;}
|
13
|
+
table.cal .starting a.issue, p.cal.legend .starting {background: url(../images/bullet_go.png) no-repeat -1px -2px; padding-left:16px;}
|
14
|
+
table.cal .ending a.issue, p.cal.legend .ending {background: url(../images/bullet_end.png) no-repeat -1px -2px; padding-left:16px;}
|
15
|
+
table.cal .starting.ending a.issue, p.cal.legend .starting.ending {background: url(../images/bullet_diamond.png) no-repeat -1px -2px; padding-left:16px;}
|
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.
|
4
|
+
version: 0.0.62
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RedmineUP
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/redmine_crm/currency/heuristics.rb
|
144
144
|
- lib/redmine_crm/currency/loader.rb
|
145
145
|
- lib/redmine_crm/engine.rb
|
146
|
+
- lib/redmine_crm/helpers/calendars_helper.rb
|
146
147
|
- lib/redmine_crm/helpers/external_assets_helper.rb
|
147
148
|
- lib/redmine_crm/helpers/form_tag_helper.rb
|
148
149
|
- lib/redmine_crm/helpers/tags_helper.rb
|
@@ -215,6 +216,7 @@ files:
|
|
215
216
|
- vendor/assets/javascripts/select2.js
|
216
217
|
- vendor/assets/javascripts/select2_helpers.js
|
217
218
|
- vendor/assets/javascripts/timepicker_addon.js
|
219
|
+
- vendor/assets/stylesheets/calendars.css
|
218
220
|
- vendor/assets/stylesheets/money.css
|
219
221
|
- vendor/assets/stylesheets/select2.css
|
220
222
|
- vendor/assets/stylesheets/timepicker_addon.css
|