redmine_crm 0.0.23 → 0.0.53

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -1
  3. data/README.md +166 -33
  4. data/Rakefile +3 -12
  5. data/app/controllers/redmine_crm_controller.rb +26 -0
  6. data/app/views/redmine_crm/_money.html.erb +44 -0
  7. data/app/views/redmine_crm/settings.html.erb +10 -0
  8. data/bitbucket-pipelines.yml +54 -0
  9. data/config/currency_iso.json +12 -0
  10. data/config/locales/en.yml +13 -0
  11. data/config/locales/ru.yml +13 -0
  12. data/config/routes.rb +5 -0
  13. data/doc/CHANGELOG +123 -2
  14. data/lib/redmine_crm/acts_as_draftable/draft.rb +40 -0
  15. data/lib/redmine_crm/acts_as_draftable/rcrm_acts_as_draftable.rb +172 -0
  16. data/lib/redmine_crm/acts_as_list/list.rb +282 -0
  17. data/lib/redmine_crm/{rcrm_acts_as_taggable.rb → acts_as_taggable/rcrm_acts_as_taggable.rb} +112 -93
  18. data/lib/redmine_crm/acts_as_taggable/tag.rb +81 -0
  19. data/lib/redmine_crm/acts_as_taggable/tag_list.rb +111 -0
  20. data/lib/redmine_crm/acts_as_taggable/tagging.rb +16 -0
  21. data/lib/redmine_crm/acts_as_viewed/rcrm_acts_as_viewed.rb +274 -0
  22. data/lib/redmine_crm/{rcrm_acts_as_votable.rb → acts_as_votable/rcrm_acts_as_votable.rb} +15 -14
  23. data/lib/redmine_crm/acts_as_votable/rcrm_acts_as_voter.rb +20 -0
  24. data/lib/redmine_crm/{votable.rb → acts_as_votable/votable.rb} +54 -65
  25. data/lib/redmine_crm/{vote.rb → acts_as_votable/vote.rb} +6 -8
  26. data/lib/redmine_crm/{voter.rb → acts_as_votable/voter.rb} +29 -34
  27. data/lib/redmine_crm/assets_manager.rb +43 -0
  28. data/lib/redmine_crm/colors_helper.rb +192 -0
  29. data/lib/redmine_crm/compatibility/application_controller_patch.rb +33 -0
  30. data/lib/redmine_crm/currency/formatting.rb +5 -8
  31. data/lib/redmine_crm/currency/heuristics.rb +1 -1
  32. data/lib/redmine_crm/currency/loader.rb +5 -6
  33. data/lib/redmine_crm/currency.rb +28 -17
  34. data/lib/redmine_crm/engine.rb +4 -0
  35. data/lib/redmine_crm/helpers/external_assets_helper.rb +19 -0
  36. data/lib/redmine_crm/helpers/form_tag_helper.rb +76 -0
  37. data/lib/redmine_crm/helpers/tags_helper.rb +1 -3
  38. data/lib/redmine_crm/helpers/vote_helper.rb +29 -32
  39. data/lib/redmine_crm/hooks/views_layouts_hook.rb +11 -0
  40. data/lib/redmine_crm/liquid/drops/issues_drop.rb +191 -0
  41. data/lib/redmine_crm/liquid/drops/news_drop.rb +54 -0
  42. data/lib/redmine_crm/liquid/drops/projects_drop.rb +86 -0
  43. data/lib/redmine_crm/liquid/drops/time_entries_drop.rb +65 -0
  44. data/lib/redmine_crm/liquid/drops/users_drop.rb +68 -0
  45. data/lib/redmine_crm/liquid/filters/arrays.rb +187 -0
  46. data/lib/redmine_crm/liquid/filters/base.rb +217 -0
  47. data/lib/redmine_crm/liquid/filters/colors.rb +31 -0
  48. data/lib/redmine_crm/money_helper.rb +17 -18
  49. data/lib/redmine_crm/settings/money.rb +46 -0
  50. data/lib/redmine_crm/settings.rb +53 -0
  51. data/lib/redmine_crm/version.rb +1 -1
  52. data/lib/redmine_crm.rb +60 -21
  53. data/redmine_crm.gemspec +12 -6
  54. data/test/acts_as_draftable/draft_test.rb +29 -0
  55. data/test/acts_as_draftable/rcrm_acts_as_draftable_test.rb +178 -0
  56. data/test/{acts_as_taggable_test.rb → acts_as_taggable/rcrm_acts_as_taggable_test.rb} +117 -156
  57. data/test/acts_as_taggable/tag_list_test.rb +34 -0
  58. data/test/acts_as_taggable/tag_test.rb +72 -0
  59. data/test/acts_as_taggable/tagging_test.rb +15 -0
  60. data/test/{viewed_test.rb → acts_as_viewed/rcrm_acts_as_viewed_test.rb} +17 -15
  61. data/test/acts_as_votable/rcrm_acts_as_votable_test.rb +19 -0
  62. data/test/acts_as_votable/rcrm_acts_as_voter_test.rb +14 -0
  63. data/test/{votable_model_test.rb → acts_as_votable/votable_test.rb} +34 -5
  64. data/test/{voter_model_test.rb → acts_as_votable/voter_test.rb} +8 -8
  65. data/test/currency_test.rb +10 -10
  66. data/test/database.yml +14 -14
  67. data/test/fixtures/issues.yml +13 -1
  68. data/test/fixtures/news.yml +8 -0
  69. data/test/fixtures/projects.yml +10 -0
  70. data/test/fixtures/users.yml +6 -2
  71. data/test/liquid/drops/issues_drop_test.rb +34 -0
  72. data/test/liquid/drops/news_drop_test.rb +38 -0
  73. data/test/liquid/drops/projects_drop_test.rb +44 -0
  74. data/test/liquid/drops/uses_drop_test.rb +36 -0
  75. data/test/liquid/filters/arrays_filter_test.rb +31 -0
  76. data/test/liquid/filters/base_filter_test.rb +63 -0
  77. data/test/liquid/filters/colors_filter_test.rb +33 -0
  78. data/test/liquid/liquid_helper.rb +34 -0
  79. data/test/models/issue.rb +14 -0
  80. data/test/models/news.rb +3 -0
  81. data/test/models/project.rb +8 -0
  82. data/test/{fixtures → models}/user.rb +5 -1
  83. data/test/{fixtures → models}/vote_classes.rb +0 -21
  84. data/test/money_helper_test.rb +5 -5
  85. data/test/schema.rb +33 -10
  86. data/test/test_helper.rb +20 -72
  87. data/vendor/assets/images/money.png +0 -0
  88. data/vendor/assets/images/vcard.png +0 -0
  89. data/vendor/assets/javascripts/Chart.bundle.min.js +16 -0
  90. data/vendor/assets/javascripts/select2.js +2 -0
  91. data/vendor/assets/javascripts/select2_helpers.js +192 -0
  92. data/vendor/assets/stylesheets/money.css +3 -0
  93. data/vendor/assets/stylesheets/select2.css +424 -0
  94. metadata +190 -40
  95. data/lib/redmine_crm/rcrm_acts_as_viewed.rb +0 -287
  96. data/lib/redmine_crm/rcrm_acts_as_voter.rb +0 -27
  97. data/lib/redmine_crm/tag.rb +0 -81
  98. data/lib/redmine_crm/tag_list.rb +0 -112
  99. data/lib/redmine_crm/tagging.rb +0 -20
  100. data/test/fixtures/issue.rb +0 -14
  101. data/test/tag_test.rb +0 -64
  102. data/test/tagging_test.rb +0 -14
  103. data/test/votable_test.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb1379b61856d4d51a73e61eaa2af2505559bc55
4
- data.tar.gz: dac49994dbd3c6df0727e37b4f1739cdeeb11406
3
+ metadata.gz: 4ab38758127d9a2e2509bc8e9ff1ec80a9f1352d
4
+ data.tar.gz: 3f3cc66ccf665ce4a2499c559062e66f84e13256
5
5
  SHA512:
6
- metadata.gz: 58cad6ac2a7c193331c40f8e897a9462573e4ee126f623b727b5623ec437a921a4b2227aba13b91d625b8d77c1d95fbce24b4b4a580baa4864b1472cb2da38dd
7
- data.tar.gz: 70f067cf96642b3dab5d66469eef34daa4c52dd6dac4af215a2c026cc7c1e7551e8771299803c8db5cde6ffa6dd41b578f73a70bc7c89911b872a960114e80db
6
+ metadata.gz: 015402b86d6d3b211a755bfdf1123d7aa4324cddab8f53721fa724d4e2fd012f06c71aa455965ff6dc5cd897efb0709c18794215fe59c18e493520508fc685af
7
+ data.tar.gz: f8c17428036c110cc3c25812a319a6bc59b06ce97cf57ef81cabba99d1cd834ad27f10aff6bb536d73f355263626dcf7bb18a9dba262415b27cdad9fe88ba0dd
data/.gitignore CHANGED
@@ -4,6 +4,8 @@
4
4
  /_yardoc/
5
5
  /coverage/
6
6
  /pkg/
7
+ /public/
8
+ /test/public/
7
9
  /spec/reports/
8
10
  /tmp/
9
11
  *.bundle
@@ -15,4 +17,5 @@ mkmf.log
15
17
  /Guardfile
16
18
  /Gemfile.local
17
19
  /Gemfile.local.lock
18
- *.gem
20
+ *.gem
21
+ /.idea/*
data/README.md CHANGED
@@ -1,71 +1,204 @@
1
1
  # RedmineCrm
2
2
 
3
- Gem include next functional for Redmine plugins:
4
- * rcrm_acts_as_taggable
5
- * rcrm_acts_as_votable
6
- * rcrm_acts_as_viewable
3
+ This gem is used at RedmineUP as a general place for shared functionality and
4
+ assets. It contains **Chart.js** and **select2** JS libraries, various mixins
5
+ for ActiveRecord models and other things you might find useful.
7
6
 
8
- ## Installation
7
+ Among mixins there are:
8
+
9
+ * rcrm_acts_as_draftable
10
+ * rcrm_acts_as_taggable
11
+ * rcrm_acts_as_viewable
12
+ * rcrm_acts_as_votable
9
13
 
10
- Add this line to your application's Gemfile:
11
14
 
15
+ ## Installation
16
+
17
+ Add it to your plugin's Gemfile:
12
18
  ```ruby
13
- gem "redmine_crm"
19
+ gem 'redmine_crm'
20
+ ```
21
+
22
+ Then invoke the following command in your plugin's or Redmine directory:
23
+ ```
24
+ $ bundle install
14
25
  ```
15
26
 
16
- And then execute:
27
+ And now you can start using it.
17
28
 
18
- $ bundle
19
29
 
20
- Or install it yourself as:
30
+ ## Usage
31
+ ### Drafts
32
+ This module allows saving and restoring drafts for different models. To be
33
+ saved as a draft, an instance does not need to pass the validations. Drafts
34
+ store not only model attributes, but also associations and virtual attributes.
35
+ A draft could be linked to a given user, so every user can manage his/her own
36
+ drafts independent of others. A draft might have a parent instance.
37
+
38
+ First of all, drafts need to be saved somewhere, so let's create a migration:
39
+ ```ruby
40
+ class CreateDrafts < Rails.version > '5' ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
41
+ def change
42
+ ActiveRecord::Base.create_drafts_table
43
+ end
44
+ end
45
+ ```
46
+
47
+ Then in the Redmine directory run:
48
+ ```
49
+ $ rake redmine:plugins:migrate
50
+ ```
21
51
 
22
- $ gem install redmine_crm
52
+ Next, add `rcrm_acts_as_draftable` to a model for which you want to save drafts:
53
+ ```ruby
54
+ class Message < ActiveRecord::Base
55
+ rcrm_acts_as_draftable
56
+ end
57
+ ```
23
58
 
24
- Create migration with next code:
59
+ And that's it for the preparation, now you're ready to make use of drafts:
25
60
  ```ruby
26
- require 'redmine_crm/rcrm_acts_as_taggable'
61
+ # You can save message as a draft.
62
+ Message.new(subject: 'foo').save_draft
63
+
64
+ # And later restore message from the draft.
65
+ draft = Message.drafts(nil).last
66
+ message = draft.restore
67
+ puts message.subject
68
+ # => foo
69
+
70
+ # Draft can be overwritten.
71
+ message.content = 'bar'
72
+ puts message.save_draft
73
+ # => true
74
+
75
+ # You can also save draft linked to a particular user.
76
+ Message.new(subject: 'baz').save_draft(user: current_user)
77
+
78
+ # And restore message from some user's draft.
79
+ user_draft = Message.drafts(current_user).last
80
+ user_message = user_draft.restore
81
+ puts user_message.subject
82
+ # => baz
83
+
84
+ # It's also possible to restore a bunch of messages at once.
85
+ messages = Message.drafts(current_user).restore_all
86
+ p messages.map(&:subject)
87
+ # => ["baz"]
88
+
89
+ # When a model instance is saved, corresponding draft is removed.
90
+ puts Message.drafts(current_user).count
91
+ # => 1
92
+ user_message.board_id = Board.first.id
93
+ user_message.save!
94
+ puts Message.drafts(current_user).count
95
+ # => 0
96
+
97
+ # Drafts will be saved only for new (not persisted) or changed instances.
98
+ puts Message.new.save_draft
99
+ # => true
100
+ persisted = Message.last
101
+ puts persisted.save_draft
102
+ # => false
103
+ persisted.subject = 'other subject'
104
+ puts persisted.save_draft
105
+ # => true
106
+ ```
27
107
 
28
- def self.up
29
- ActiveRecord::Base.create_taggable_table
30
- end
108
+ ### Tags
109
+ This module makes it possible to tag objects.
31
110
 
32
- def self.down
33
- ActiveRecord::Base.drop_taggable_table
111
+ First, create a migration:
112
+ ```ruby
113
+ class CreateTags < Rails.version > '5' ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
114
+ def change
115
+ ActiveRecord::Base.create_taggable_table
34
116
  end
35
117
  end
36
118
  ```
37
- For rcrm_acts_as_viewed You may add column for your model
38
- with help:
39
119
 
120
+ Then in the Redmine directory run:
121
+ ```
122
+ $ rake redmine:plugins:migrate
123
+ ```
124
+
125
+ Next, add `rcrm_acts_as_taggable` to a model for which you want to provide tags:
40
126
  ```ruby
127
+ class Contact < ActiveRecord::Base
128
+ rcrm_acts_as_taggable
129
+ end
130
+ ```
41
131
 
42
- YourModel.add_viewings_columns
132
+ TODO: Add examples of usage.
43
133
 
44
- ```
45
- It will add two column to your table (views and total_views)
46
- and view_count will return two number: total view and unique views.
47
- Without this migration you will get only unique views.
134
+ ### Viewings
135
+ This module allows you to count views for some ActiveRecord model instances.
48
136
 
49
- Run migration for plugin:
137
+ To count views you'll need to create a migration:
138
+ ```ruby
139
+ class CreateViewings < Rails.version > '5' ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
140
+ def change
141
+ ActiveRecord::Base.create_viewings_table
142
+ end
143
+ end
144
+ ```
50
145
 
146
+ To apply it, run the following in the Redmine directory:
51
147
  ```
52
- rake redmine:plugins:migrate
148
+ $ rake redmine:plugins:migrate
53
149
  ```
54
150
 
55
- ## Usage
151
+ Then add `rcrm_acts_as_viewed` to a model for which you want to count views.
152
+ ```ruby
153
+ class Question < ActiveRecord::Base
154
+ rcrm_acts_as_viewed
155
+ end
156
+ ```
157
+
158
+ TODO: Provide some usage examples.
56
159
 
57
- Add to model
160
+ ### Votes
161
+ With this module you can make your models votable and allow users to vote.
58
162
 
163
+ As always, create a migration first:
59
164
  ```ruby
60
- rcrm_acts_as_taggable
165
+ class CreateVotes < Rails.version > '5' ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
166
+ def change
167
+ ActiveRecord::Base.create_votable_table
168
+ end
169
+ end
170
+ ```
171
+
172
+ Then apply it by running the following command in the Redmine directory:
173
+ ```
174
+ $ rake redmine:plugins:migrate
175
+ ```
176
+
177
+ To make a model votable, add `rcrm_acts_as_votable` to it:
178
+ ```ruby
179
+ class Question < ActiveRecord::Base
61
180
  rcrm_acts_as_votable
181
+ end
62
182
  ```
63
183
 
184
+ TODO: Write about `rcrm_acts_as_voter` and add usage examples.
64
185
 
65
- ## Run test
66
186
 
187
+ ## Development
188
+
189
+ If you're planning to extend this gem, you will need to install development
190
+ dependencies. To do this, execute the following command in the project's
191
+ directory:
192
+ ```
193
+ $ bundle install
194
+ ```
195
+
196
+ After that you'll be able to run tests:
67
197
  ```
68
- rake test
198
+ $ bundle exec rake test
69
199
  ```
70
200
 
71
- For test for mysql set enviroment variable DB to value 'mysql' and run test.
201
+ SQLite in-memory database will be used by default, which is the fastest way to run tests. To run them using different database adapters, set `DB` environment variable to one of the available values — `mysql`, `postgresql`, `sqlite`. For example, to use PostgreSQL, invoke tests like so:
202
+ ```
203
+ $ bundle exec rake test DB=postgresql
204
+ ```
data/Rakefile CHANGED
@@ -1,20 +1,11 @@
1
- require "bundler/gem_tasks"
2
-
3
- require 'rake'
1
+ require 'bundler/gem_tasks'
4
2
  require 'rake/testtask'
5
- # require 'rake/rdoctask'
6
3
 
7
- desc 'Default: run unit tests.'
8
- task :default => :test
4
+ task default: :test
9
5
 
10
- desc 'Test the acts_as_taggable_on_steroids plugin.'
6
+ desc 'Run tests'
11
7
  Rake::TestTask.new(:test) do |t|
12
8
  t.libs << 'test'
13
9
  t.pattern = 'test/**/*_test.rb'
14
10
  t.verbose = true
15
11
  end
16
-
17
- desc 'Copy migration file to db/migration of plugin'
18
- file 'copy_migration' do
19
- cp "generators/redmine_crm_migration/templates/migration.rb", "db/migrate/redmine_crm.rb"
20
- end
@@ -0,0 +1,26 @@
1
+ class RedmineCrmController < ApplicationController
2
+ layout 'admin'
3
+
4
+ before_action :require_admin
5
+ require_sudo_mode :settings if respond_to?(:require_sudo_mode)
6
+
7
+ def settings
8
+ @section = RedmineCrm::Settings::SECTIONS[params[:id]]
9
+ return render_404 unless @section
10
+
11
+ if request.post?
12
+ setting =
13
+ if params[:settings].present?
14
+ params[:settings].respond_to?(:to_unsafe_hash) ? params[:settings].to_unsafe_hash : params[:settings]
15
+ else
16
+ {}
17
+ end
18
+ RedmineCrm::Settings.apply = setting
19
+ flash[:notice] = l(:notice_successful_update)
20
+ redirect_to redmine_crm_settings_path(@section[:id])
21
+ else
22
+ @settings = RedmineCrm::Settings.values
23
+ end
24
+ @section_tabs = RedmineCrm::Settings::SECTIONS.map { |_n, s| { name: s[:id], partial: s[:partial], label: s[:label] } }
25
+ end
26
+ end
@@ -0,0 +1,44 @@
1
+ <p>
2
+ <label for="cb_settings_disable_taxes"><%= l(:label_redmine_crm_disable_taxes) %></label>
3
+ <%= hidden_field_tag 'settings[disable_taxes]', '0' %>
4
+ <%= check_box_tag 'settings[disable_taxes]', 1, RedmineCrm::Settings::Money.disable_taxes?, id: 'cb_settings_disable_taxes' %>
5
+ </p>
6
+
7
+ <span id="tax_data">
8
+ <p>
9
+ <label><%= l(:label_redmine_crm_default_tax) %></label>
10
+ <%= text_field_tag 'settings[default_tax]', RedmineCrm::Settings::Money.default_tax, size: 6, maxlength: 5 %> %
11
+ </p>
12
+
13
+ <p>
14
+ <label><%= l(:label_redmine_crm_tax_type) %></label>
15
+ <%= select_tag 'settings[tax_type]', options_for_select([[l(:label_redmine_crm_tax_type_exclusive), RedmineCrm::Settings::Money::TAX_TYPE_EXCLUSIVE],
16
+ [l(:label_redmine_crm_tax_type_inclusive), RedmineCrm::Settings::Money::TAX_TYPE_INCLUSIVE]],
17
+ @settings['tax_type']) %>
18
+ </p>
19
+ </span>
20
+
21
+ <p>
22
+ <label><%= l(:label_redmine_crm_default_currency) %></label>
23
+ <%= select_tag 'settings[default_currency]', options_for_select(all_currencies.insert(0, ['', '']), RedmineCrm::Settings::Money.default_currency) %>
24
+ </p>
25
+
26
+ <p>
27
+ <label><%= l(:label_redmine_crm_major_currencies) %></label>
28
+ <%= text_field_tag 'settings[major_currencies]', RedmineCrm::Settings::Money.major_currencies.join(', '), size: 40 %>
29
+ <br>
30
+ <em class="info"><%= l(:text_comma_separated) %></em>
31
+ </p>
32
+
33
+ <p>
34
+ <label><%= l(:label_redmine_crm_thousands_delimiter) %></label>
35
+ <%= select_tag 'settings[thousands_delimiter]', options_for_select([["9 999", " "],
36
+ ["9,999", ","],
37
+ ["9.999", "."]], RedmineCrm::Settings::Money.thousands_delimiter) %>
38
+ </p>
39
+
40
+ <p>
41
+ <label><%= l(:label_redmine_crm_decimal_separator) %></label>
42
+ <%= select_tag 'settings[decimal_separator]', options_for_select([["0.00", "."],
43
+ ["0,00", ","]], RedmineCrm::Settings::Money.decimal_separator) %>
44
+ </p>
@@ -0,0 +1,10 @@
1
+ <%= title l(:label_redmine_crm_settings) %>
2
+
3
+ <div id="settings">
4
+ <%= form_tag({ action: 'settings', id: @section[:id] }) do %>
5
+ <div class="box tabular settings">
6
+ <%= render partial: 'money' %>
7
+ </div>
8
+ <%= submit_tag l(:button_apply) %>
9
+ <% end %>
10
+ </div>
@@ -0,0 +1,54 @@
1
+ # This is a sample build configuration for Ruby.
2
+ # Check our guides at https://confluence.atlassian.com/x/8r-5Mw for more examples.
3
+ # Only use spaces to indent your .yml configuration.
4
+ # -----
5
+ # You can specify a custom docker image from Docker Hub as your build environment.
6
+
7
+ pipelines:
8
+ default:
9
+ - step:
10
+ name: New ruby
11
+ image: ruby:2.4.1
12
+ script:
13
+ - sed -i "s/'sqlite3'/'sqlite3', '~> 1.3.6'/g" redmine_crm.gemspec
14
+ - sed -i "s/'mysql2'/'mysql2', '~> 0.4.0'/g" redmine_crm.gemspec
15
+ - bundle install
16
+ - bundle exec rake test DB=sqlite
17
+ - bundle exec rake test DB=postgresql
18
+ - bundle exec rake test DB=mysql
19
+ services:
20
+ - mysql
21
+ - postgres
22
+ - step:
23
+ name: Old ruby
24
+ image: ruby:1.9.3
25
+ script:
26
+ - sed -i "s/'rails'/'rails'\n spec.add_runtime_dependency 'rake', '~> 11.2.0'/g" redmine_crm.gemspec
27
+ - sed -i "s/'rails'/'rails'\n spec.add_runtime_dependency 'i18n', '~> 0.9.5'/g" redmine_crm.gemspec
28
+ - sed -i "s/'rails'/'rails'\n spec.add_runtime_dependency 'nokogiri', '~> 1.6.8'/g" redmine_crm.gemspec
29
+ - sed -i "s/'rails'/'rails', '~> 4.2.11'/g" redmine_crm.gemspec
30
+ - sed -i "s/'sqlite3'/'sqlite3', '~> 1.3.6'/g" redmine_crm.gemspec
31
+ - sed -i "s/'mysql2'/'mysql2', '~> 0.4.0'/g" redmine_crm.gemspec
32
+ - sed -i "s/'pg'/'pg', '~> 0.18.0'/g" redmine_crm.gemspec
33
+ - sed -i "s/^end/ spec.add_development_dependency 'minitest', '~> 5.11.3'\nend/g" redmine_crm.gemspec
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
37
+ - bundle install
38
+ - bundle exec rake test DB=sqlite
39
+ - bundle exec rake test DB=mysql
40
+ services:
41
+ - mysql
42
+
43
+ definitions:
44
+ services:
45
+ mysql:
46
+ image: mysql:5.7
47
+ environment:
48
+ MYSQL_DATABASE: redmine_crm_test
49
+ MYSQL_ROOT_PASSWORD: password
50
+ postgres:
51
+ image: postgres
52
+ environment:
53
+ POSTGRES_DB: redmine_crm_test
54
+ POSTGRES_PASSWORD: password
@@ -2528,5 +2528,17 @@
2528
2528
  "thousands_separator": ",",
2529
2529
  "iso_numeric": "967",
2530
2530
  "smallest_denomination": 5
2531
+ },
2532
+ "btc": {
2533
+ "priority": 100,
2534
+ "iso_code": "BTC",
2535
+ "name": "Bitcoin",
2536
+ "symbol": "฿",
2537
+ "subunit": "sat",
2538
+ "subunit_to_unit": 100000000,
2539
+ "symbol_first": false,
2540
+ "html_entity": "&#x0E3F;",
2541
+ "decimal_mark": ",",
2542
+ "thousands_separator": "."
2531
2543
  }
2532
2544
  }
@@ -0,0 +1,13 @@
1
+ en:
2
+ label_redmine_crm_settings: Money Settings
3
+ label_redmine_crm_money: Money
4
+
5
+ label_redmine_crm_disable_taxes: Disable taxes
6
+ label_redmine_crm_default_tax: Default tax value
7
+ label_redmine_crm_tax_type: Tax type
8
+ label_redmine_crm_tax_type_exclusive: Tax exclusive
9
+ label_redmine_crm_tax_type_inclusive: Tax inclusive
10
+ label_redmine_crm_default_currency: Default currency
11
+ label_redmine_crm_major_currencies: Major currencies
12
+ label_redmine_crm_thousands_delimiter: Thousands delimiter
13
+ label_redmine_crm_decimal_separator: Decimal separator
@@ -0,0 +1,13 @@
1
+ ru:
2
+ label_redmine_crm_settings: Настройки валют
3
+ label_redmine_crm_money: Деньги
4
+
5
+ label_redmine_crm_disable_taxes: Отключить налоги
6
+ label_redmine_crm_default_tax: Ставка налога
7
+ label_redmine_crm_tax_type: Тип налога
8
+ label_redmine_crm_tax_type_exclusive: Налог добавлен к общей сумме
9
+ label_redmine_crm_tax_type_inclusive: Налог включен с общую сумму
10
+ label_redmine_crm_default_currency: Валюта по умолчанию
11
+ label_redmine_crm_major_currencies: Основные валюты
12
+ label_redmine_crm_thousands_delimiter: Разделитель разрядов
13
+ label_redmine_crm_decimal_separator: Десятичный разделитель
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ match 'redmine_crm/settings/:id', to: 'redmine_crm#settings', as: 'redmine_crm_settings', via: [:get, :post]
5
+ end
data/doc/CHANGELOG CHANGED
@@ -1,8 +1,129 @@
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-2016 RedmineUP
5
- http://www.redminecrm.com/
4
+ Copyright (C) 2011-2020 RedmineUP
5
+ https://www.redmineup.com/
6
+
7
+ == 2020-04-07 v0.0.53
8
+
9
+ * Multiselect styles cleanup
10
+ * Added rubyzip dependence
11
+
12
+ == 2019-12-26 v0.0.52
13
+
14
+ * select2 styles cleanup
15
+
16
+ == 2019-12-20 v0.0.51
17
+
18
+ * Changed drafts params
19
+ * Changed Money settings UI
20
+ * Fixed bug with settings access
21
+
22
+ == 2019-11-18 v0.0.50
23
+
24
+ * Fixed bug with settings initialization
25
+
26
+ == 2019-11-12 v0.0.49
27
+
28
+ * Fixed settings compatibility bug
29
+
30
+ == 2019-11-07 v0.0.48
31
+
32
+ * Added global money setting
33
+ * Fixed select2 format
34
+
35
+ == 2019-08-26 v0.0.47
36
+
37
+ * Fixed bug with tag cloud
38
+
39
+ == 2019-08-14 v0.0.46
40
+
41
+ * select2 update
42
+
43
+ == 2019-08-13 v0.0.44
44
+
45
+ * Fixed Safari scroll down bug
46
+ * Multiaddress select helpers fixes
47
+ * Fixed tags privacy bugs
48
+
49
+ == 2019-05-07 v0.0.43
50
+
51
+ * custom_field and custom_fields methods added from Reporter plugin
52
+ * Added support for multi email contacts select
53
+ * Fixed Safari select2 bug with moving screen
54
+ * Fixed after_action method compatibility
55
+
56
+ == 2018-10-24 v0.0.42
57
+
58
+ * Hotfix for ruby 1.9.3 hashes support
59
+ * Added ci image for ruby 1.9.3
60
+
61
+ == 2018-10-23 v0.0.41
62
+
63
+ * New fields for IssueDrop: tags, checklists, story_points, color, day_in_state
64
+ * New Liquid filters for managing colors: darken_color, lighten_color, contrasting_text_color, hex_color, convert_to_brightness_value
65
+ * Fixes for Drops to use nil delegates
66
+
67
+ == 2018-09-28 v0.0.40
68
+
69
+ * acts_as_draftable adopted for Redmine projects
70
+ * New Liquid Drops: JournalsDrop, JournalDrop, TimeEntriesDrop, TimeEntryDrop
71
+ * New liquid properties for issues: done_ratio, estimated_hours, spent_hours, total_spent_hours, total_estimated_hours, is_private, closed_on, assignee, tracker, status, priority, category, version, time_entries, parent, project, subtasks, notes, journals
72
+
73
+ == 2018-03-28 v0.0.37
74
+
75
+ * Added rcrm_acts_as_draftable
76
+ * Added transform_to_select2 helper
77
+
78
+ == 2018-03-22 v0.0.36
79
+
80
+ * select2_tag improvements
81
+
82
+ == 2018-03-05 v0.0.35
83
+
84
+ * Added select2_tag helper
85
+
86
+ == 2017-12-22 v0.0.34
87
+
88
+ * Fixed bug with Redmine 2.x support
89
+
90
+ == 2017-12-18 v0.0.33
91
+
92
+ * Rails 5 support (Redmine 4)
93
+ * rcrm_acts_as_list (Redmine 4)
94
+ * Bitcoin currency support
95
+
96
+ == 2017-07-18 v0.0.32
97
+
98
+ * charjs added
99
+
100
+ == 2017-05-29 v0.0.31
101
+
102
+ * select2 controls for contacts and people
103
+
104
+ == 2017-05-23 v0.0.30
105
+
106
+ * Fixed votable vote_by
107
+
108
+ == 2017-03-21 v0.0.29
109
+
110
+ * Updated available_tags method
111
+
112
+ == 2017-03-17 v0.0.28
113
+
114
+ * Fixed bug with quote_value
115
+
116
+ == 2017-03-13 v0.0.27
117
+
118
+ * Added IP to Votes
119
+
120
+ == 2017-03-10 v0.0.26
121
+
122
+ * Liquid gem with base filters and drops for Redmine objects
123
+
124
+ == 2016-11-12 v0.0.24
125
+
126
+ * Liquid gem dependency
6
127
 
7
128
  == 2016-09-28 v0.0.23
8
129
 
@@ -0,0 +1,40 @@
1
+ # The MIT License (MIT)
2
+
3
+ # Copyright (c) 2016-2018 Georg Ledermann
4
+
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ module RedmineCrm
24
+ module ActsAsDraftable
25
+ class Draft < ActiveRecord::Base
26
+ belongs_to :user
27
+ belongs_to :parent, polymorphic: true, autosave: false
28
+
29
+ validates_presence_of :data, :target_type
30
+
31
+ def restore
32
+ target_type.constantize.from_draft(self)
33
+ end
34
+
35
+ def self.restore_all
36
+ find_each.map(&:restore)
37
+ end
38
+ end
39
+ end
40
+ end