dorsale 3.5.1 → 3.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/app/assets/stylesheets/dorsale/common/comments.sass +5 -1
- data/app/helpers/dorsale/all_helpers.rb +1 -0
- data/app/helpers/dorsale/comments_helper.rb +23 -8
- data/app/helpers/dorsale/customer_vault/application_helper.rb +26 -0
- data/app/models/dorsale/comment.rb +1 -1
- data/app/models/dorsale/customer_vault/corporation.rb +4 -0
- data/app/models/dorsale/customer_vault/individual.rb +4 -0
- data/app/models/dorsale/customer_vault/person.rb +1 -1
- data/app/views/dorsale/comments/_comment.html.slim +2 -2
- data/app/views/dorsale/customer_vault/people/_context.html.slim +4 -5
- data/app/views/dorsale/customer_vault/people/_context_address.html.slim +8 -6
- data/app/views/dorsale/customer_vault/people/_context_general.html.slim +11 -5
- data/app/views/dorsale/customer_vault/people/_context_related_people.slim +5 -0
- data/app/views/dorsale/customer_vault/people/_context_social.html.slim +11 -6
- data/app/views/dorsale/customer_vault/people/show.html.slim +1 -1
- data/config/locales/customer_vault.en.yml +2 -0
- data/config/locales/customer_vault.fr.yml +1 -0
- data/lib/dorsale/version.rb +1 -1
- data/spec/models/dorsale/customer_vault/person_spec.rb +10 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91e5341eb8cfffe13a70e3a8ee82da977139c0a2
|
4
|
+
data.tar.gz: 1f9010dd33f9a3e4ed88e3fea11ce31dd530c36d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ab4ad3cfed29a2ca2a86fde75db9ddf1a1d2bf038bc64e8b790c5afa3896f59c7f9f6e044eee91aa92513e1cf47c3642cbcd784a0e1a9c38d8e0ec31d7936d6
|
7
|
+
data.tar.gz: 8b4980ddc931a658e670d68a7834ef3bf76fd0510a1936e9c5fb292fcc93e8deafd18ca197a993d474b4d61cde6aa0c76c83b45f28063dad89a04d4792876926
|
data/CHANGELOG.md
CHANGED
@@ -16,6 +16,9 @@
|
|
16
16
|
.comment-fields
|
17
17
|
margin-left: 65px
|
18
18
|
|
19
|
+
input, textarea
|
20
|
+
font-size: $font-size-base
|
21
|
+
|
19
22
|
.comment-title-field
|
20
23
|
display: inline-block
|
21
24
|
width: calc(100% - 10rem - 0.5rem)
|
@@ -52,7 +55,8 @@
|
|
52
55
|
font-size: 80%
|
53
56
|
margin-left: 1.5rem
|
54
57
|
|
55
|
-
p.comment-text
|
58
|
+
p.comment-text,
|
59
|
+
p.comment-text-truncated,
|
56
60
|
margin: 1rem 0 0 65px
|
57
61
|
|
58
62
|
p.comment-text-truncated + p.comment-text
|
@@ -7,6 +7,7 @@ module Dorsale::AllHelpers
|
|
7
7
|
include ::Dorsale::CommentsHelper
|
8
8
|
include ::Dorsale::Alexandrie::AttachmentsHelper
|
9
9
|
include ::Dorsale::BillingMachine::ApplicationHelper
|
10
|
+
include ::Dorsale::CustomerVault::ApplicationHelper
|
10
11
|
include ::Dorsale::Flyboy::ApplicationHelper
|
11
12
|
include ::Dorsale::ExpenseGun::ApplicationHelper
|
12
13
|
include ::Dorsale::UsersHelper
|
@@ -1,10 +1,8 @@
|
|
1
1
|
module Dorsale::CommentsHelper
|
2
|
-
def comments_for(commentable,
|
3
|
-
comments
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
new_comment = comments.new(author: current_user)
|
2
|
+
def comments_for(commentable, comments = nil)
|
3
|
+
comments = ::Dorsale::Comment.where(commentable: commentable) if comments.nil?
|
4
|
+
comments = policy_scope(comments).preload(:commentable, :author)
|
5
|
+
new_comment = policy_scope(comments).new(commentable: commentable, author: current_user)
|
8
6
|
|
9
7
|
render(
|
10
8
|
:partial => "dorsale/comments/comments",
|
@@ -15,7 +13,24 @@ module Dorsale::CommentsHelper
|
|
15
13
|
)
|
16
14
|
end
|
17
15
|
|
18
|
-
def
|
19
|
-
controller_name == "people"
|
16
|
+
def truncate_comments_in_this_page?
|
17
|
+
controller_name == "people"
|
18
|
+
end
|
19
|
+
|
20
|
+
def truncate_comment_text(comment)
|
21
|
+
text = comment.text.to_s
|
22
|
+
truncated = false
|
23
|
+
|
24
|
+
if text.to_s.count("\n") > 3
|
25
|
+
text = text.split("\n")[0, 3].join("\n")
|
26
|
+
truncated = true
|
27
|
+
end
|
28
|
+
|
29
|
+
if text.to_s.length > 300
|
30
|
+
text = truncate(text, length: 200)
|
31
|
+
truncated = true
|
32
|
+
end
|
33
|
+
|
34
|
+
text2html(text) if truncated
|
20
35
|
end
|
21
36
|
end
|
@@ -13,4 +13,30 @@ module Dorsale::CustomerVault::ApplicationHelper
|
|
13
13
|
[Dorsale::CustomerVault::Individual.t, "Dorsale::CustomerVault::Individual"],
|
14
14
|
]
|
15
15
|
end
|
16
|
+
|
17
|
+
def person_address_blank?(person)
|
18
|
+
[
|
19
|
+
person.address.street,
|
20
|
+
person.address.street_bis,
|
21
|
+
person.address.zip,
|
22
|
+
person.address.city,
|
23
|
+
person.address.country,
|
24
|
+
].all?(&:blank?)
|
25
|
+
end
|
26
|
+
|
27
|
+
def person_social_blank?(person)
|
28
|
+
[
|
29
|
+
person.skype,
|
30
|
+
person.www,
|
31
|
+
person.twitter,
|
32
|
+
person.facebook,
|
33
|
+
person.linkedin,
|
34
|
+
person.viadeo,
|
35
|
+
person.try(:societe_com),
|
36
|
+
].all?(&:blank?)
|
37
|
+
end
|
38
|
+
|
39
|
+
def person_related_people_blank?(person)
|
40
|
+
person.individuals.empty?
|
41
|
+
end
|
16
42
|
end
|
@@ -5,6 +5,10 @@ class Dorsale::CustomerVault::Corporation < Dorsale::CustomerVault::Person
|
|
5
5
|
validates :corporation_name, presence: true
|
6
6
|
has_many :individuals
|
7
7
|
|
8
|
+
def self_and_related_comments
|
9
|
+
::Dorsale::Comment.where(commentable: [self] + individuals)
|
10
|
+
end
|
11
|
+
|
8
12
|
def name
|
9
13
|
corporation_name
|
10
14
|
end
|
@@ -6,6 +6,10 @@ class Dorsale::CustomerVault::Individual < Dorsale::CustomerVault::Person
|
|
6
6
|
validates :last_name, presence: true
|
7
7
|
belongs_to :corporation
|
8
8
|
|
9
|
+
def self_and_related_comments
|
10
|
+
comments
|
11
|
+
end
|
12
|
+
|
9
13
|
def name
|
10
14
|
[self.last_name, self.first_name].join(", ")
|
11
15
|
end
|
@@ -20,7 +20,7 @@ class Dorsale::CustomerVault::Person < ::Dorsale::ApplicationRecord
|
|
20
20
|
|
21
21
|
acts_as_taggable
|
22
22
|
|
23
|
-
has_many :comments,
|
23
|
+
has_many :comments, class_name: ::Dorsale::Comment, as: :commentable, dependent: :destroy
|
24
24
|
has_one :address, class_name: ::Dorsale::Address, as: :addressable, inverse_of: :addressable, dependent: :destroy
|
25
25
|
has_many :tasks, class_name: ::Dorsale::Flyboy::Task, as: :taskable, dependent: :destroy
|
26
26
|
has_many :invoices, class_name: ::Dorsale::BillingMachine::Invoice, as: :customer
|
@@ -30,9 +30,9 @@
|
|
30
30
|
span.comment-author
|
31
31
|
= comment.author.to_s
|
32
32
|
|
33
|
-
- if
|
33
|
+
- if truncate_comments_in_this_page? && text = truncate_comment_text(comment)
|
34
34
|
p.comment-text-truncated
|
35
|
-
=
|
35
|
+
= text
|
36
36
|
= " "
|
37
37
|
a.comment-show_more href="#"
|
38
38
|
= ta(:show_more)
|
@@ -9,11 +9,10 @@
|
|
9
9
|
|
10
10
|
.context-body
|
11
11
|
p.text-center = avatar_img(person)
|
12
|
-
= render "dorsale/customer_vault/people/context_general",
|
13
|
-
|
14
|
-
= render "dorsale/customer_vault/people/context_address",
|
15
|
-
|
16
|
-
= render 'dorsale/customer_vault/people/context_social', person: person
|
12
|
+
= render "dorsale/customer_vault/people/context_general", person: person
|
13
|
+
= render "dorsale/customer_vault/people/context_related_people", person: person
|
14
|
+
= render "dorsale/customer_vault/people/context_address", person: person
|
15
|
+
= render 'dorsale/customer_vault/people/context_social', person: person
|
17
16
|
|
18
17
|
.context-footer
|
19
18
|
= actions_for(person)
|
@@ -1,6 +1,8 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
=
|
4
|
-
= info address, :
|
5
|
-
= info address, :
|
6
|
-
= info address, :
|
1
|
+
.sub-context class=("blank" if person_address_blank?(person))
|
2
|
+
hr
|
3
|
+
- address = person.address
|
4
|
+
= info address, :street
|
5
|
+
= info address, :street_bis
|
6
|
+
= info address, :city
|
7
|
+
= info address, :zip
|
8
|
+
= info address, :country
|
@@ -1,5 +1,11 @@
|
|
1
|
-
|
2
|
-
= info person, :
|
3
|
-
|
4
|
-
|
5
|
-
= info person, :
|
1
|
+
.sub-context
|
2
|
+
= info person, :tags, tags(person)
|
3
|
+
|
4
|
+
- if person.individual?
|
5
|
+
= info person, :corporation, helper: :link_to_object
|
6
|
+
= info person, :title
|
7
|
+
|
8
|
+
= info person, :email, helper: :email_link
|
9
|
+
= info person, :phone, helper: :tel_link
|
10
|
+
= info person, :mobile, helper: :tel_link
|
11
|
+
= info person, :fax, helper: :tel_link
|
@@ -1,6 +1,11 @@
|
|
1
|
-
=
|
2
|
-
|
3
|
-
= info person, :
|
4
|
-
= info person, :
|
5
|
-
= info person, :
|
6
|
-
= info person, :
|
1
|
+
.sub-context class=("blank" if person_social_blank?(person))
|
2
|
+
hr
|
3
|
+
= info person, :skype, helper: :email_link
|
4
|
+
= info person, :www, helper: :web_link
|
5
|
+
= info person, :twitter, helper: :web_link
|
6
|
+
= info person, :facebook, helper: :web_link
|
7
|
+
= info person, :linkedin, helper: :web_link
|
8
|
+
= info person, :viadeo, helper: :web_link
|
9
|
+
|
10
|
+
- if person.corporation?
|
11
|
+
= info person, :societe_com, helper: :web_link
|
data/lib/dorsale/version.rb
CHANGED
@@ -24,7 +24,16 @@ RSpec.describe ::Dorsale::CustomerVault::Person, type: :model do
|
|
24
24
|
expect { link.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
25
25
|
end
|
26
26
|
end
|
27
|
-
|
28
27
|
end # describe '#links'
|
29
28
|
|
29
|
+
it "should return self_and_related_comments" do
|
30
|
+
corporation = create(:customer_vault_corporation)
|
31
|
+
individual = create(:customer_vault_individual, corporation: corporation)
|
32
|
+
corporation_comment = create(:dorsale_comment, commentable: corporation)
|
33
|
+
individual_comment = create(:dorsale_comment, commentable: individual)
|
34
|
+
|
35
|
+
expect(corporation.self_and_related_comments).to contain_exactly(corporation_comment, individual_comment)
|
36
|
+
expect(individual.self_and_related_comments).to contain_exactly(individual_comment)
|
37
|
+
end
|
38
|
+
|
30
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorsale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- agilidée
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -703,6 +703,7 @@ files:
|
|
703
703
|
- app/views/dorsale/customer_vault/people/_context.html.slim
|
704
704
|
- app/views/dorsale/customer_vault/people/_context_address.html.slim
|
705
705
|
- app/views/dorsale/customer_vault/people/_context_general.html.slim
|
706
|
+
- app/views/dorsale/customer_vault/people/_context_related_people.slim
|
706
707
|
- app/views/dorsale/customer_vault/people/_context_social.html.slim
|
707
708
|
- app/views/dorsale/customer_vault/people/_data_context.html.slim
|
708
709
|
- app/views/dorsale/customer_vault/people/_filters.html.slim
|