redmine_crm 0.0.50 → 0.0.55

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
  SHA1:
3
- metadata.gz: 0db9ce68acb0514cc0652eb603284800851c5a2a
4
- data.tar.gz: ba29da7491709f471cd6be83674fb70d73b7d710
3
+ metadata.gz: afd4e0e67e1d1a6bb522e7736c051c0ccf0495f1
4
+ data.tar.gz: 85b94490ebf04a788428ed6ebf5581d93f8d6723
5
5
  SHA512:
6
- metadata.gz: f6b1ff459d4b63a648703af6306ccc87c81278d83fc057ea911a849690565adf41b5e31096f966ab7b67195c55967721337fb6b72508ecb739c7c71bcaab7b06
7
- data.tar.gz: 81b37a16be40aa4af841f63fe659a3b74c70977a36547fd73d375d523b1c8c9b6110500be48c5fb9a85055ba75c3ce46bf2aab5795a00edcea8b37270552ddcb
6
+ metadata.gz: 0db2f41a96bdc765da21a0553f9989ea484da52daff6b52922da75feb26d83d9b9c938cb1aca72c42463708190df9e0159caa5671b6753ce665f0c8540b0b40b
7
+ data.tar.gz: 27bb8d96230d724b121cd12125036a40d98bcaf6fbe437eea42eb5ce12faa1df1c3378c7287089310566cef3a728be95df2f33701bc92672ad59c36189e589d7
@@ -3,7 +3,7 @@
3
3
  <div id="settings">
4
4
  <%= form_tag({ action: 'settings', id: @section[:id] }) do %>
5
5
  <div class="box tabular settings">
6
- <%= render_tabs @section_tabs %>
6
+ <%= render partial: 'money' %>
7
7
  </div>
8
8
  <%= submit_tag l(:button_apply) %>
9
9
  <% end %>
@@ -32,6 +32,8 @@ pipelines:
32
32
  - sed -i "s/'pg'/'pg', '~> 0.18.0'/g" redmine_crm.gemspec
33
33
  - sed -i "s/^end/ spec.add_development_dependency 'minitest', '~> 5.11.3'\nend/g" redmine_crm.gemspec
34
34
  - sed -i "s/^end/ spec.add_development_dependency 'sprockets', '~> 3.5.2'\nend/g" redmine_crm.gemspec
35
+ - sed -i "s/^end/ spec.add_development_dependency 'thor', '~> 0.20.3'\nend/g" redmine_crm.gemspec
36
+ - sed -i "s/'rubyzip'/'rubyzip', '~> 1.3.0'/g" redmine_crm.gemspec
35
37
  - bundle install
36
38
  - bundle exec rake test DB=sqlite
37
39
  - bundle exec rake test DB=mysql
@@ -0,0 +1,13 @@
1
+ cs:
2
+ label_redmine_crm_settings: Peníze
3
+ label_redmine_crm_money: Peníze
4
+
5
+ label_redmine_crm_disable_taxes: Znemožnit daně
6
+ label_redmine_crm_default_tax: Výchozí hodnota daně
7
+ label_redmine_crm_tax_type: Typ daně
8
+ label_redmine_crm_tax_type_exclusive: Bez daně
9
+ label_redmine_crm_tax_type_inclusive: Včetně daně
10
+ label_redmine_crm_default_currency: Výchozí měna
11
+ label_redmine_crm_major_currencies: Hlavní měny
12
+ label_redmine_crm_thousands_delimiter: Oddělovač tisíců
13
+ label_redmine_crm_decimal_separator: Desetinný oddělovač
@@ -0,0 +1,13 @@
1
+ de:
2
+ label_redmine_crm_settings: Währungseinstellungen
3
+ label_redmine_crm_money: Währung
4
+
5
+ label_redmine_crm_disable_taxes: Steuern deaktiviert
6
+ label_redmine_crm_default_tax: Standard Steuersatz
7
+ label_redmine_crm_tax_type: Steuerart
8
+ label_redmine_crm_tax_type_exclusive: Steuer ausgeschlossen
9
+ label_redmine_crm_tax_type_inclusive: Steuer eingeschlossen
10
+ label_redmine_crm_default_currency: Standard Währung
11
+ label_redmine_crm_major_currencies: Aktive Währungen
12
+ label_redmine_crm_thousands_delimiter: Tausendertrennzeichen
13
+ label_redmine_crm_decimal_separator: Dezimaltrennzeichen
@@ -1,5 +1,5 @@
1
1
  en:
2
- label_redmine_crm_settings: Redmine Crm Settings
2
+ label_redmine_crm_settings: Money Settings
3
3
  label_redmine_crm_money: Money
4
4
 
5
5
  label_redmine_crm_disable_taxes: Disable taxes
@@ -1,5 +1,5 @@
1
1
  ru:
2
- label_redmine_crm_settings: Настройки Redmine Crm
2
+ label_redmine_crm_settings: Настройки валют
3
3
  label_redmine_crm_money: Деньги
4
4
 
5
5
  label_redmine_crm_disable_taxes: Отключить налоги
data/doc/CHANGELOG CHANGED
@@ -1,9 +1,35 @@
1
1
  == Redmine CRM gem changelog
2
2
 
3
3
  Redmine crm gem - general functions for plugins (tags, vote, viewing, currency)
4
- Copyright (C) 2011-2019 RedmineUP
4
+ Copyright (C) 2011-2021 RedmineUP
5
5
  https://www.redmineup.com/
6
6
 
7
+ == 2021-06-08 v0.0.55
8
+
9
+ * Added Attachment Liquid drop
10
+ * Added section to Checklist Liquid drop
11
+ * Added Czech locale
12
+ * Added German locale
13
+
14
+ == 2020-08-10 v0.0.54
15
+
16
+ * Fixed new JQuery select2 bug
17
+
18
+ == 2020-04-07 v0.0.53
19
+
20
+ * Multiselect styles cleanup
21
+ * Added rubyzip dependence
22
+
23
+ == 2019-12-26 v0.0.52
24
+
25
+ * select2 styles cleanup
26
+
27
+ == 2019-12-20 v0.0.51
28
+
29
+ * Changed drafts params
30
+ * Changed Money settings UI
31
+ * Fixed bug with settings access
32
+
7
33
  == 2019-11-18 v0.0.50
8
34
 
9
35
  * Fixed bug with settings initialization
data/lib/redmine_crm.rb CHANGED
@@ -34,6 +34,7 @@ require 'redmine_crm/liquid/drops/news_drop'
34
34
  require 'redmine_crm/liquid/drops/projects_drop'
35
35
  require 'redmine_crm/liquid/drops/users_drop'
36
36
  require 'redmine_crm/liquid/drops/time_entries_drop'
37
+ require 'redmine_crm/liquid/drops/attachment_drop'
37
38
 
38
39
  require 'redmine_crm/helpers/external_assets_helper'
39
40
  require 'redmine_crm/helpers/form_tag_helper'
@@ -78,8 +78,10 @@ module RedmineCrm
78
78
  target
79
79
  end
80
80
 
81
- def drafts(user)
82
- Draft.where(user_id: user.id, target_type: name)
81
+ def drafts(user = nil)
82
+ drafts = Draft.where(target_type: name)
83
+ drafts = drafts.where(user_id: user.id) if user
84
+ drafts
83
85
  end
84
86
  end # ClassMethods
85
87
 
@@ -90,7 +90,7 @@ module RedmineCrm
90
90
  #Return all avalible tags for a project or global
91
91
  #Example: Question.available_tags(:project => @project_id )
92
92
  def available_tags(options = {})
93
- project = options[:project]
93
+ projects = [[options[:project]], options[:projects]].flatten.compact
94
94
  limit = options[:limit].to_i.zero? ? 30 : options[:limit].to_i
95
95
  scope = Tag.where({})
96
96
  class_name = quote_string_value(base_class.name)
@@ -98,9 +98,9 @@ module RedmineCrm
98
98
  join << "JOIN #{Tagging.table_name} ON #{Tagging.table_name}.tag_id = #{Tag.table_name}.id "
99
99
  join << "JOIN #{table_name} ON #{table_name}.id = #{Tagging.table_name}.taggable_id
100
100
  AND #{Tagging.table_name}.taggable_type = #{class_name} "
101
- if attribute_names.include?('project_id') && project
101
+ if attribute_names.include?('project_id') && projects.any?
102
102
  join << "JOIN #{Project.table_name} ON #{Project.table_name}.id = #{table_name}.project_id"
103
- scope = scope.where("#{table_name}.project_id = ?", project.id)
103
+ scope = scope.where("#{table_name}.project_id IN (%s)", projects.map(&:id).join(','))
104
104
  end
105
105
 
106
106
  if options[:name_like]
@@ -58,7 +58,7 @@ module RedmineCrm
58
58
 
59
59
  end
60
60
 
61
- if self.parent::VERSION::MAJOR < 4
61
+ if ::ActiveRecord::VERSION::MAJOR < 4
62
62
  create_index votes_name_table, [:votable_id, :votable_type, :vote_ip]
63
63
  create_index votes_name_table, [:voter_id, :voter_type, :vote_ip]
64
64
  end
@@ -0,0 +1,49 @@
1
+ module RedmineCrm
2
+ module Liquid
3
+ class AttachmentDrop < ::Liquid::Drop
4
+ delegate :id,
5
+ :filename,
6
+ :title,
7
+ :description,
8
+ :filesize,
9
+ :content_type,
10
+ :digest,
11
+ :downloads,
12
+ :created_on,
13
+ :token,
14
+ :visible?,
15
+ :image?,
16
+ :thumbnailable?,
17
+ :is_text?,
18
+ :readable?,
19
+ to: :@attachment
20
+
21
+ delegate :id, :filename, :filesize, :description, to: :@attachment
22
+
23
+ def initialize(attachment)
24
+ @attachment = attachment
25
+ end
26
+
27
+ def url(options = {})
28
+ Rails.application.routes.url_helpers.download_named_attachment_url(@attachment, { filename: filename,
29
+ host: Setting.host_name,
30
+ protocol: Setting.protocol }.merge(options))
31
+ end
32
+
33
+ def link
34
+ link_to((@attachment.description.blank? ? @attachment.filename : @attachment.description), url)
35
+ end
36
+
37
+ def author
38
+ @author ||= UsersDrop.new @attachment.author
39
+ end
40
+
41
+ def read
42
+ @content ||= if @attachment.is_text? && @attachment.filesize <= Setting.file_max_size_displayed.to_i.kilobyte
43
+ File.new(@attachment.diskfile, "rb").read
44
+ end
45
+ @content
46
+ end
47
+ end
48
+ end
49
+ end
@@ -96,15 +96,15 @@ module RedmineCrm
96
96
  end
97
97
 
98
98
  def parent
99
- @parent ||= IssueDrop.new @issue.parent if @issue.parent
99
+ @parent ||= IssueDrop.new @issue.parent if @issue.parent
100
100
  end
101
101
 
102
102
  def project
103
- @project ||= ProjectDrop.new @issue.project if @issue.project
103
+ @project ||= ProjectDrop.new @issue.project if @issue.project
104
104
  end
105
105
 
106
106
  def subtasks
107
- @subtasks ||= IssuesDrop.new @issue.children
107
+ @subtasks ||= IssuesDrop.new @issue.children
108
108
  end
109
109
 
110
110
  def notes
@@ -126,19 +126,20 @@ module RedmineCrm
126
126
  def color
127
127
  @issue.respond_to?(:color) && @issue.color
128
128
  end
129
-
129
+
130
130
  def day_in_state
131
131
  @issue.respond_to?(:day_in_state) && @issue.day_in_state
132
132
  end
133
133
 
134
134
  def checklists
135
- @issue.respond_to?(:checklists) && @issue.checklists.map{|item| {"id_done" => item.is_done, "subject" => item.subject}}
135
+ @issue.respond_to?(:checklists) && @issue.checklists.map do |item|
136
+ { 'id_done' => item.is_done, 'subject' => item.subject, 'is_section' => item.is_section }
137
+ end
136
138
  end
137
139
 
138
140
  def custom_field_values
139
141
  @issue.custom_field_values
140
- end
141
-
142
+ end
142
143
  end
143
144
 
144
145
  class JournalsDrop < ::Liquid::Drop
@@ -170,7 +171,7 @@ module RedmineCrm
170
171
  :notes,
171
172
  :created_on,
172
173
  :private_notes,
173
- :to => :@journal,
174
+ :to => :@journal,
174
175
  allow_nil: true
175
176
 
176
177
  def initialize(journal)
@@ -182,7 +183,7 @@ module RedmineCrm
182
183
  end
183
184
 
184
185
  def issue
185
- @issue ||= IssueDrop.new @journal.issue if @journal.issue
186
+ @issue ||= IssueDrop.new @journal.issue if @journal.issue
186
187
  end
187
188
 
188
189
  end
@@ -100,7 +100,7 @@ module RedmineCrm
100
100
  def tagged_with(input, tags, match='all')
101
101
  return input unless input.respond_to?(:select)
102
102
  input = input.values if input.is_a?(Hash)
103
- tag_list = input.is_a?(Array) ? tags.sort : tags.split(',').map(&:strip).sort
103
+ tag_list = tags.is_a?(Array) ? tags.sort : tags.split(',').map(&:strip).sort
104
104
  case match
105
105
  when "all"
106
106
  input.select do |object|
@@ -36,7 +36,7 @@ module RedmineCrm
36
36
 
37
37
  def md5(input)
38
38
  Digest::MD5.hexdigest(input) unless input.blank?
39
- end
39
+ end
40
40
 
41
41
  # example:
42
42
  # {{ "http:://www.example.com?key=hello world" | encode }}
@@ -87,8 +87,8 @@ module RedmineCrm
87
87
  to_number(input).floor.to_i
88
88
  end
89
89
 
90
- def currency(input, currency_code = 'USD')
91
- price_to_currency(input, currency_code, :converted => false)
90
+ def currency(input, currency_code = nil)
91
+ price_to_currency(input, currency_code || container_currency, :converted => false)
92
92
  end
93
93
 
94
94
  def call_method(input, method_name)
@@ -121,6 +121,30 @@ module RedmineCrm
121
121
  end
122
122
  end
123
123
 
124
+ def multi_line(input)
125
+ input.to_s.gsub("\n", '<br/>').html_safe
126
+ end
127
+
128
+ def concat(input, *args)
129
+ result = input.to_s
130
+ args.flatten.each { |a| result << a.to_s }
131
+ result
132
+ end
133
+
134
+ # right justify and padd a string
135
+ def rjust(input, integer, padstr = '')
136
+ input.to_s.rjust(integer, padstr)
137
+ end
138
+
139
+ # left justify and padd a string
140
+ def ljust(input, integer, padstr = '')
141
+ input.to_s.ljust(integer, padstr)
142
+ end
143
+
144
+ def textile(input)
145
+ ::RedCloth3.new(input).to_html
146
+ end
147
+
124
148
  protected
125
149
 
126
150
  # Convert an array of properties ('key:value') into a hash
@@ -210,6 +234,14 @@ module RedmineCrm
210
234
  end
211
235
  end
212
236
  end
237
+
238
+ def container
239
+ @container ||= @context.registers[:container]
240
+ end
241
+
242
+ def container_currency
243
+ container.currency if container.respond_to?(:currency)
244
+ end
213
245
  end
214
246
  ::Liquid::Template.register_filter(RedmineCrm::Liquid::Filters::Base)
215
247
  end
@@ -26,6 +26,8 @@ module RedmineCrm
26
26
 
27
27
  # Use apply instead attrs assign because it can rewrite other attributes
28
28
  def apply=(values)
29
+ initialize_gem_settings unless @settings_initialized
30
+
29
31
  Setting.plugin_redmine_crm = Setting.plugin_redmine_crm.merge(values)
30
32
  end
31
33
 
@@ -1,3 +1,3 @@
1
1
  module RedmineCrm
2
- VERSION = '0.0.50'
2
+ VERSION = '0.0.55'
3
3
  end
data/redmine_crm.gemspec CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_runtime_dependency 'rails'
22
22
  spec.add_runtime_dependency 'liquid', '< 2.6.4'
23
+ spec.add_runtime_dependency 'rubyzip'
23
24
 
24
25
  spec.add_development_dependency 'sqlite3'
25
26
  spec.add_development_dependency 'mysql2'
@@ -80,11 +80,11 @@ function findSelectTagInRowBy(field) {
80
80
  };
81
81
 
82
82
  function rowHasSelectTag(field) {
83
- return findInRowBy(field, '.values select.value').size() > 0;
83
+ return findInRowBy(field, '.values select.value').length > 0;
84
84
  };
85
85
 
86
86
  function rowHasSelect2(field) {
87
- return findInRowBy(field, '.values .select2').size() > 0;
87
+ return findInRowBy(field, '.values .select2').length > 0;
88
88
  };
89
89
 
90
90
  function findInRowBy(field, selector) {
@@ -137,6 +137,7 @@ function buildSelect2Options(options) {
137
137
  result = {
138
138
  placeholder: options['placeholder'] || '',
139
139
  allowClear: !!options['allow_clear'],
140
+ containerCssClass: options['containerCssClass'],
140
141
  minimumInputLength: options['min_input_length'] || 0,
141
142
  templateResult: window[options['format_state']],
142
143
  templateSelection: window[options['format_selection']],
@@ -150,18 +150,26 @@
150
150
  }
151
151
 
152
152
  .select2-container--default .select2-selection--single {
153
- background: #fff url(../images/vcard.png) no-repeat 2px 50%;
154
- border: 1px solid #9EB1C2;
155
- border-radius: 2px;
156
- height: 21px;
153
+ /*background: #fff url(../images/vcard.png) no-repeat 2px 50%;*/
154
+ background-color: #fff;
155
+ height: 24px;
156
+ border: 1px solid #ccc;
157
+ border-radius: 3px;
158
+ }
159
+
160
+ .select2-container--default .select2-selection--single.icon {
161
+ background-position-x: 3px;
157
162
  }
158
163
 
159
164
  .select2-container--default .select2-selection--single .select2-selection__rendered {
160
- padding-left: 21px;
161
- line-height: 18px;
165
+ line-height: 21px;
162
166
  font-size: 11px;
163
167
  }
164
168
 
169
+ .select2-container--default .select2-selection--single.icon .select2-selection__rendered {
170
+ padding-left: 2px
171
+ }
172
+
165
173
  .select2-container--default .select2-selection--single .select2-selection__clear {
166
174
  cursor: pointer;
167
175
  float: right;
@@ -172,7 +180,7 @@
172
180
  color: #999;
173
181
  }
174
182
  .select2-container--default .select2-selection--single .select2-selection__arrow {
175
- height: 20px;
183
+ height: 24px;
176
184
  position: absolute;
177
185
  top: 0px;
178
186
  right: 1px;
@@ -210,8 +218,8 @@
210
218
  }
211
219
  .select2-container--default .select2-selection--multiple {
212
220
  background-color: white;
213
- border: 1px solid #9EB1C2;
214
- border-radius: 2px;
221
+ border: 1px solid #ccc;
222
+ border-radius: 3px;
215
223
  cursor: text;
216
224
  }
217
225
 
@@ -220,7 +228,7 @@
220
228
  box-sizing: border-box;
221
229
  list-style: none;
222
230
  margin: 0;
223
- padding: 0 2px 2px 2px;
231
+ padding: 0 2px 1px 2px;
224
232
  width: 100%;
225
233
  }
226
234
  .select2-container--default .select2-selection--multiple .select2-selection__rendered li {
@@ -235,8 +243,8 @@
235
243
  cursor: pointer;
236
244
  float: right;
237
245
  font-weight: bold;
238
- margin-top: 5px;
239
- margin-right: 10px;
246
+ margin-top: 2px;
247
+ margin-right: 2px;
240
248
  }
241
249
 
242
250
  #sidebar .select2-container--default .select2-selection--multiple .select2-selection__choice,
@@ -245,8 +253,8 @@
245
253
  border-radius: 2px;
246
254
  cursor: default;
247
255
  float: left;
248
- margin-right: 3px;
249
- margin-top: 3px;
256
+ margin-right: 2px;
257
+ margin-top: 2px;
250
258
  padding: 0 3px;
251
259
  }
252
260
  .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
@@ -271,8 +279,8 @@
271
279
  margin-right: auto;
272
280
  }
273
281
  .select2-container--default.select2-container--focus .select2-selection--multiple {
274
- border: solid #aaa 1px;
275
- outline: 0;
282
+ border: 1px solid #5ad;
283
+ outline: none;
276
284
  }
277
285
  .select2-container--default.select2-container--disabled .select2-selection--multiple {
278
286
  background-color: #eee;
@@ -298,6 +306,7 @@
298
306
  outline: 0;
299
307
  box-shadow: none;
300
308
  -webkit-appearance: textfield;
309
+ height: 18px;
301
310
  }
302
311
  .select2-container--default .select2-results > .select2-results__options {
303
312
  max-height: 200px;
@@ -355,12 +364,12 @@
355
364
  border: 0px !important;
356
365
  height: inherit !important;
357
366
  padding: 0px !important;
358
- width: 2em !important;
359
367
  }
360
368
 
361
369
  .filter .select2-container--default .select2-selection--multiple .select2-selection__choice {
370
+ outline: none;
362
371
  border: 0px;
363
- padding: 2px 5px;
372
+ padding: 3px 5px;
364
373
  }
365
374
 
366
375
  /* == Theming ===
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.50
4
+ version: 0.0.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - RedmineUP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-18 00:00:00.000000000 Z
11
+ date: 2021-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "<"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.6.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubyzip
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: sqlite3
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -97,6 +111,8 @@ files:
97
111
  - app/views/redmine_crm/settings.html.erb
98
112
  - bitbucket-pipelines.yml
99
113
  - config/currency_iso.json
114
+ - config/locales/cs.yml
115
+ - config/locales/de.yml
100
116
  - config/locales/en.yml
101
117
  - config/locales/ru.yml
102
118
  - config/routes.rb
@@ -129,6 +145,7 @@ files:
129
145
  - lib/redmine_crm/helpers/tags_helper.rb
130
146
  - lib/redmine_crm/helpers/vote_helper.rb
131
147
  - lib/redmine_crm/hooks/views_layouts_hook.rb
148
+ - lib/redmine_crm/liquid/drops/attachment_drop.rb
132
149
  - lib/redmine_crm/liquid/drops/issues_drop.rb
133
150
  - lib/redmine_crm/liquid/drops/news_drop.rb
134
151
  - lib/redmine_crm/liquid/drops/projects_drop.rb