redmine_crm 0.0.28 → 0.0.30

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: 06e250724e907f5c6c3b2590d5bd59994d21bba4
4
- data.tar.gz: 43d893aed3e87d16da19667b5a3705cc190d07aa
3
+ metadata.gz: cdec6b77ac05dfc60cd61d029f48518f10991435
4
+ data.tar.gz: b6df25550e4e7f9bb3c3ebce58d119f3ed08647e
5
5
  SHA512:
6
- metadata.gz: 210d2487c18e8a6d9a540f889fc30b8631922cc9aef5c98856f4cd2ae5e2e6669ec43bc87359d27fd5d5f9463e185c00219308f2ea3a64f358b2faef477e83aa
7
- data.tar.gz: 429c087175aba643771e724e8137b57875552b6026c2bcb5bce3f55f7dbab42c4275c26e1f802cc9a3203124b678732d857e94011b17655a5c70d1a7c0a12be3
6
+ metadata.gz: 5f03058fb24c1d3777387fc3febd8a6fd502c5f7c3e2e754c58a195b39289b45b3a9f767109551f1ff7c831c10abf1686899072310e0ae6b6d145fc3712dfe47
7
+ data.tar.gz: 3ae7e0950ff7fb8023340030a33c6cc713f2f89f272a580065b4bbd7357dc3503e8389fd89d767496b07f0ea558c382427add867b8ecd22fd2c6cac0f90cdec6
@@ -0,0 +1,17 @@
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
+ image: ruby:2.3.0
7
+
8
+ pipelines:
9
+ default:
10
+ - step:
11
+ script: # Modify the commands below to build your repository.
12
+ - bundler --version
13
+ - bundle install
14
+ - gem install byebug
15
+ - gem install rails -v 4.2.7.1
16
+ - gem install sqlite3
17
+ - rake test
data/doc/CHANGELOG CHANGED
@@ -4,6 +4,14 @@ Redmine crm gem - general functions for plugins (tags, vote, viewing, currency)
4
4
  Copyright (C) 2011-2017 RedmineUP
5
5
  https://www.redmineup.com/
6
6
 
7
+ == 2017-05-23 v0.0.30
8
+
9
+ * Fixed votable vote_by
10
+
11
+ == 2017-03-21 v0.0.29
12
+
13
+ * Updated available_tags method
14
+
7
15
  == 2017-03-17 v0.0.28
8
16
 
9
17
  * Fixed bug with quote_value
@@ -86,21 +86,24 @@ module RedmineCrm
86
86
  end
87
87
 
88
88
  module SingletonMethods
89
- # Return all avalible tags for a project or global
90
- # Example: Question.available_tags(@project_id )
91
- def available_tags(project = nil, limit = 30)
89
+ #Return all avalible tags for a project or global
90
+ #Example: Question.available_tags(:project => @project_id )
91
+ def available_tags(options = {})
92
+ project = options[:project]
93
+ limit = options[:limit].to_i.zero? ? 30 : options[:limit].to_i
92
94
  scope = Tag.where({})
93
95
  class_name = quote_string_value(base_class.name)
94
96
  join = []
95
97
  join << "JOIN #{Tagging.table_name} ON #{Tagging.table_name}.tag_id = #{Tag.table_name}.id "
96
98
  join << "JOIN #{table_name} ON #{table_name}.id = #{Tagging.table_name}.taggable_id
97
99
  AND #{Tagging.table_name}.taggable_type = #{class_name} "
98
- if self.attribute_names.include?('project_id')
99
- if project
100
- join << "JOIN #{Project.table_name} ON #{Project.table_name}.id = #{table_name}.project_id"
101
- else
102
- scope = scope.where("#{table_name}.project_id IS NULL")
103
- end
100
+ if attribute_names.include?('project_id') && project
101
+ join << "JOIN #{Project.table_name} ON #{Project.table_name}.id = #{table_name}.project_id"
102
+ scope = scope.where("#{table_name}.project_id = ?", project.id)
103
+ end
104
+
105
+ if options[:name_like]
106
+ scope = scope.where("LOWER(#{Tag.table_name}.name) LIKE LOWER(?)", "%#{options[:name_like]}%")
104
107
  end
105
108
 
106
109
  group_fields = ''
@@ -112,7 +115,7 @@ module RedmineCrm
112
115
  scope = scope.group("#{Tag.table_name}.id, #{Tag.table_name}.name #{group_fields}")
113
116
  scope = scope.having('COUNT(*) > 0')
114
117
  scope = scope.order("#{Tag.table_name}.name")
115
- scope = scope.limit(limit) if limit
118
+ scope = scope.limit(limit)
116
119
  scope
117
120
  end
118
121
  # Returns an array of related tags.
@@ -77,12 +77,9 @@ module RedmineCrm
77
77
 
78
78
  if votes_for.count == 0 || options[:duplicate]
79
79
  # this voter has never voted
80
- vote = RedmineCrm::ActsAsVotable::Vote.new(
81
- :votable => self,
82
- :voter => options[:voter],
83
- :vote_scope => options[:vote_scope],
84
- :vote_ip => options[:vote_ip]
85
- )
80
+ vote_params = { :votable => self, :voter => options[:voter], :vote_scope => options[:vote_scope] }
81
+ vote_params[:vote_ip] = options[:vote_ip] if options[:vote_ip]
82
+ vote = RedmineCrm::ActsAsVotable::Vote.new(vote_params)
86
83
  else
87
84
  # this voter is potentially changing his vote
88
85
  vote = votes_for.last
@@ -1,3 +1,3 @@
1
1
  module RedmineCrm
2
- VERSION = "0.0.28"
2
+ VERSION = "0.0.30"
3
3
  end
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper'
3
3
  class RcrmActsAsTaggableTest < ActiveSupport::TestCase
4
4
  def test_available_tags
5
5
  assert_equivalent [tags(:feature), tags(:bug), tags(:error), tags(:question)], Issue.available_tags(Project.first)
6
- assert_equivalent [tags(:feature), tags(:bug)], Issue.available_tags(Project.first, 2)
6
+ assert_equivalent [tags(:error), tags(:question)], Issue.available_tags(:project => Project.first, :limit => 2)
7
7
  end
8
8
 
9
9
  def test_find_related_tags_with
@@ -330,7 +330,7 @@ class RcrmActsAsTaggableTest < ActiveSupport::TestCase
330
330
  end
331
331
 
332
332
  def test_quote_value
333
- assert_equal "'RedmineCrm::ActsAsTaggable::Tag'", Issue.send(:quote_value, RedmineCrm::ActsAsTaggable::Tag)
333
+ assert_equal "'RedmineCrm::ActsAsTaggable::Tag'", Issue.send(:quote_value, RedmineCrm::ActsAsTaggable::Tag, nil)
334
334
  end
335
335
 
336
336
  def test_tags_condition
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.28
4
+ version: 0.0.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - RedmineUP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-17 00:00:00.000000000 Z
11
+ date: 2017-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -36,6 +36,7 @@ files:
36
36
  - Gemfile
37
37
  - README.md
38
38
  - Rakefile
39
+ - bitbucket-pipelines.yml
39
40
  - config/currency_iso.json
40
41
  - doc/CHANGELOG
41
42
  - doc/LICENSE.txt