dorsale 3.5.0 → 3.5.1

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/app/assets/javascripts/dorsale/common/comments.coffee +7 -0
  4. data/app/assets/javascripts/dorsale/common/datepicker.coffee +2 -2
  5. data/app/assets/stylesheets/dorsale/common/comments.sass +35 -7
  6. data/app/controllers/dorsale/comments_controller.rb +10 -9
  7. data/app/controllers/dorsale/customer_vault/people_controller.rb +6 -3
  8. data/app/helpers/dorsale/comments_helper.rb +4 -0
  9. data/app/models/dorsale/comment.rb +8 -1
  10. data/app/models/dorsale/customer_vault/corporation.rb +6 -0
  11. data/app/models/dorsale/customer_vault/corporation_data.rb +5 -3
  12. data/app/models/dorsale/customer_vault/individual.rb +1 -0
  13. data/app/models/dorsale/customer_vault/individual_data.rb +1 -3
  14. data/app/views/dorsale/billing_machine/invoices/_filters.html.slim +1 -0
  15. data/app/views/dorsale/billing_machine/invoices/_form.html.slim +1 -1
  16. data/app/views/dorsale/billing_machine/quotations/_filters.html.slim +1 -0
  17. data/app/views/dorsale/comments/_comment.html.slim +21 -12
  18. data/app/views/dorsale/comments/_form.html.slim +12 -3
  19. data/app/views/dorsale/customer_vault/links/new.html.slim +1 -1
  20. data/app/views/dorsale/customer_vault/people/_context.html.slim +8 -12
  21. data/app/views/dorsale/customer_vault/people/_context_address.html.slim +6 -0
  22. data/app/views/dorsale/customer_vault/people/_context_general.html.slim +5 -0
  23. data/app/views/dorsale/customer_vault/people/_context_social.html.slim +6 -0
  24. data/app/views/dorsale/customer_vault/people/_form.html.slim +8 -4
  25. data/config/locales/customer_vault.en.yml +6 -2
  26. data/config/locales/customer_vault.fr.yml +7 -2
  27. data/config/locales/dorsale.en.yml +5 -0
  28. data/config/locales/dorsale.fr.yml +5 -0
  29. data/db/migrate/20170406121024_dorsale_comments_add_date_and_title.rb +7 -0
  30. data/db/migrate/20170406122047_add_attribute_to_dorsale_customer_vault_people.rb +36 -0
  31. data/features/customer_vault_corporations.feature +1 -1
  32. data/features/customer_vault_links.feature +2 -2
  33. data/features/customer_vault_people.feature +14 -0
  34. data/features/step_definitions/common_steps.rb +4 -0
  35. data/features/step_definitions/customer_vault_corporations_steps.rb +8 -5
  36. data/features/step_definitions/customer_vault_individuals_steps.rb +0 -4
  37. data/features/step_definitions/customer_vault_links_steps.rb +1 -1
  38. data/features/step_definitions/customer_vault_people_steps.rb +18 -0
  39. data/lib/dorsale/version.rb +1 -1
  40. data/spec/models/dorsale/comment_spec.rb +9 -0
  41. data/spec/models/dorsale/customer_vault/corporation_spec.rb +7 -3
  42. data/spec/models/dorsale/customer_vault/individual_spec.rb +3 -0
  43. metadata +9 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 870af5f1c6e4514f3673393d9d6661f1e2102150
4
- data.tar.gz: 20fdcbb567db8d19f31413f4e4e64864e6663eac
3
+ metadata.gz: b8fd76e9602e5d327405b05c83df5f45a94d0b02
4
+ data.tar.gz: 3b7282e1f9d793d5dc0f687603051f816791e488
5
5
  SHA512:
6
- metadata.gz: 09af05b5ab27cc8d965a630c54fb8b266e12f16c09f2bafc855f6a0e88a531bb92e94d7f5d0ef11184772f8d172dd46b9550262ef4f3be1ce1065ffa1eb6ad64
7
- data.tar.gz: eb03d2134bee5347d5959c3a7657af7460a93edd68c5d0f31eda8631e87d078fea0cb85e3f207d7b6eb21e1850d9326cdf34b91c445c838e367ba1303f337456
6
+ metadata.gz: 9fc09fc9312276e737bf174326c9abd95199105c81e76fa26e3ed65330d5c0c264e88624db0acf38eaed1b58f79db1917d7fe3bf9021fc14e5687957f1ef4a3e
7
+ data.tar.gz: cfcedff1fe60c18667cc417a525a8f2257a72dbe8dca2fc6cd8415c94a4285f7147563b3009b1b1538d59e34f1eee2c72c45905cc75b69d76be1ab2a04fafc8c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.5.1
4
+
5
+ - Add title and date to comments
6
+ - Truncate comments
7
+ - CustomerVault : individual belongs to corporation
8
+ - CustomerVault : add/remove fields
9
+
3
10
  ## 3.5.0
4
11
 
5
12
  - Move helpers/i18n/... to agilibox gem
@@ -4,6 +4,7 @@ window.dorsaleComments =
4
4
  dorsaleComments.setupEditForm()
5
5
  dorsaleComments.setupEditButtons()
6
6
  dorsaleComments.setupDeleteButtons()
7
+ dorsaleComments.setupShowMoreLinks()
7
8
 
8
9
  setupCreateForm: ->
9
10
  $("#dorsale-comments").on "ajax:success", "form[id*=new]", (e, data) ->
@@ -24,6 +25,7 @@ window.dorsaleComments =
24
25
  url: url
25
26
  success: (data) ->
26
27
  container.replaceWith(data)
28
+ setupDatepickers()
27
29
 
28
30
  return false
29
31
 
@@ -32,5 +34,10 @@ window.dorsaleComments =
32
34
  $(this).parents(".comment").fadeOut ->
33
35
  $(this).remove()
34
36
 
37
+ setupShowMoreLinks: ->
38
+ $("#dorsale-comments").on "click", ".comment-show_more", ->
39
+ $(this).parents(".comment-text-truncated").remove()
40
+ return false
41
+
35
42
  $(document).on "turbolinks:load", ->
36
43
  dorsaleComments.setup()
@@ -1,7 +1,7 @@
1
1
  # Doc : http://bootstrap-datepicker.readthedocs.io/en/stable/index.html
2
2
 
3
- window.setupDatepickers = ->
4
- $("input[type*=date], input[name*=date], input[name$=_at]").map ->
3
+ window.setupDatepickers = (scope = document) ->
4
+ $(scope).find("input[type*=date], input[name*=date], input[name$=_at]").map ->
5
5
  return if this.type == "hidden"
6
6
 
7
7
  this.type = "text"
@@ -4,7 +4,7 @@
4
4
  .comment
5
5
  @extend .well
6
6
  box-shadow: none
7
- padding: 0.5em 1em
7
+ padding: 0.5em
8
8
  margin: 0.75em 0
9
9
 
10
10
  .avatar
@@ -13,19 +13,47 @@
13
13
  height: 50px
14
14
  width: 50px
15
15
 
16
- .infos
16
+ .comment-fields
17
+ margin-left: 65px
18
+
19
+ .comment-title-field
20
+ display: inline-block
21
+ width: calc(100% - 10rem - 0.5rem)
22
+ margin-right: 0.5rem
23
+
24
+ .comment-date-field
25
+ display: inline-block
26
+ width: 10rem
27
+
28
+ input
29
+ text-align: center
30
+
31
+ .comment-text-field
32
+ margin-top: 0.5rem
33
+
34
+ .comment-submit
35
+ text-align: right
36
+ margin-top: 0.5rem
37
+
38
+ input
39
+ min-width: 10rem
40
+
41
+ .comment-infos
17
42
  font-size: 80%
18
43
  @extend .text-muted
19
44
 
20
- .commentable
45
+ .comment-commentable
21
46
  font-weight: bold
22
47
 
23
- .actions
48
+ .comment-actions
24
49
  float: right
25
50
 
26
51
  a
27
52
  font-size: 80%
28
- margin-left: 1.5em
53
+ margin-left: 1.5rem
54
+
55
+ p.comment-text
56
+ margin: 1rem 0 0 65px
29
57
 
30
- p.text
31
- margin: 1em 0 0 65px
58
+ p.comment-text-truncated + p.comment-text
59
+ display: none
@@ -84,17 +84,18 @@ class Dorsale::CommentsController < ::Dorsale::ApplicationController
84
84
  end
85
85
 
86
86
  def permitted_params_for_comment
87
+ safe_params = [
88
+ :title,
89
+ :date,
90
+ :text,
91
+ ]
92
+
87
93
  if params[:action] == "create"
88
- [
89
- :commentable_id,
90
- :commentable_type,
91
- :text,
92
- ]
93
- else
94
- [
95
- :text,
96
- ]
94
+ safe_params << :commentable_id
95
+ safe_params << :commentable_type
97
96
  end
97
+
98
+ safe_params
98
99
  end
99
100
 
100
101
  def comment_params
@@ -155,6 +155,7 @@ class Dorsale::CustomerVault::PeopleController < ::Dorsale::CustomerVault::Appli
155
155
  :facebook,
156
156
  :linkedin,
157
157
  :viadeo,
158
+ :context,
158
159
  :tag_list => [],
159
160
  :address_attributes => [
160
161
  :street,
@@ -170,19 +171,21 @@ class Dorsale::CustomerVault::PeopleController < ::Dorsale::CustomerVault::Appli
170
171
  common_permitted_params + [
171
172
  :corporation_name,
172
173
  :capital,
173
- :immatriculation_number_1,
174
- :immatriculation_number_2,
174
+ :immatriculation_number,
175
175
  :european_union_vat_number,
176
176
  :legal_form,
177
+ :revenue,
178
+ :societe_com,
179
+ :number_of_employees,
177
180
  ]
178
181
  end
179
182
 
180
183
  def permitted_params_for_individuals
181
184
  common_permitted_params + [
185
+ :corporation_id,
182
186
  :first_name,
183
187
  :last_name,
184
188
  :title,
185
- :context,
186
189
  ]
187
190
  end
188
191
 
@@ -14,4 +14,8 @@ module Dorsale::CommentsHelper
14
14
  },
15
15
  )
16
16
  end
17
+
18
+ def truncate_comment_text?
19
+ controller_name == "people" && action_name == "activity"
20
+ end
17
21
  end
@@ -5,10 +5,17 @@ class Dorsale::Comment < ::Dorsale::ApplicationRecord
5
5
  validates :author, presence: true
6
6
  validates :commentable, presence: true
7
7
  validates :text, presence: true
8
+ validates :date, presence: true
8
9
 
9
10
  default_scope -> {
10
11
  all
11
- .order(created_at: :desc)
12
+ .order(date: :desc, created_at: :desc)
12
13
  .preload(:author)
13
14
  }
15
+
16
+ private
17
+
18
+ def assign_default_values
19
+ assign_default :date, Time.zone.now.to_date
20
+ end
14
21
  end
@@ -3,6 +3,7 @@ class Dorsale::CustomerVault::Corporation < Dorsale::CustomerVault::Person
3
3
  def_delegators :data, *Dorsale::CustomerVault::CorporationData.methods_to_delegate
4
4
 
5
5
  validates :corporation_name, presence: true
6
+ has_many :individuals
6
7
 
7
8
  def name
8
9
  corporation_name
@@ -16,4 +17,9 @@ class Dorsale::CustomerVault::Corporation < Dorsale::CustomerVault::Person
16
17
  private def first_name=; raise NoMethodError; end
17
18
  private def last_name; raise NoMethodError; end
18
19
  private def last_name=; raise NoMethodError; end
20
+ private def corporation; raise NoMethodError; end
21
+ private def corporation=; raise NoMethodError; end
22
+ private def corporation_id; raise NoMethodError; end
23
+ private def corporation_id=; raise NoMethodError; end
24
+
19
25
  end
@@ -1,8 +1,10 @@
1
1
  class Dorsale::CustomerVault::CorporationData < Dorsale::CustomerVault::PersonData
2
2
  attribute :legal_form, String
3
- attribute :immatriculation_number_1, String
4
- attribute :immatriculation_number_2, String
3
+ attribute :immatriculation_number, String
4
+ attribute :naf, String
5
5
  attribute :european_union_vat_number, String
6
+ attribute :societe_com, String
6
7
  attribute :capital, Integer
8
+ attribute :revenue, Integer
9
+ attribute :number_of_employees, Integer
7
10
  end
8
-
@@ -4,6 +4,7 @@ class Dorsale::CustomerVault::Individual < Dorsale::CustomerVault::Person
4
4
 
5
5
  validates :first_name, presence: true
6
6
  validates :last_name, presence: true
7
+ belongs_to :corporation
7
8
 
8
9
  def name
9
10
  [self.last_name, self.first_name].join(", ")
@@ -1,5 +1,3 @@
1
1
  class Dorsale::CustomerVault::IndividualData < Dorsale::CustomerVault::PersonData
2
- attribute :title, String
3
- attribute :context, String
2
+ attribute :title, String
4
3
  end
5
-
@@ -2,6 +2,7 @@
2
2
  = f.input(:bm_customer_guid,
3
3
  :collection => @people.map { |p| [p.to_s, p.guid] },
4
4
  :include_blank => t("filters.all_customers"),
5
+ :input_html => {class: "select2"},
5
6
  )
6
7
 
7
8
  = f.input(:bm_time_period,
@@ -24,7 +24,7 @@
24
24
  .well
25
25
  = f.input :date, html5: true
26
26
  hr
27
- = f.input :customer_guid, collection: @people.map{ |e| [e.to_s, e.guid] }
27
+ = f.input :customer_guid, collection: @people.map{ |e| [e.to_s, e.guid] }, input_html: {class: "select2"}
28
28
 
29
29
  table#lines-table
30
30
  thead
@@ -2,6 +2,7 @@
2
2
  = f.input(:bm_customer_guid,
3
3
  :collection => @people.map { |p| [p.to_s, p.guid] },
4
4
  :include_blank => t("filters.all_customers"),
5
+ :input_html => {class: "select2"},
5
6
  )
6
7
 
7
8
  = f.input(:bm_time_period,
@@ -4,30 +4,39 @@
4
4
  - else
5
5
  = image_tag "dorsale/avatar.png", class: "avatar"
6
6
 
7
- p.actions
7
+ p.comment-actions
8
8
  - if policy(comment).update?
9
9
  = icon_link_to :pencil, t("actions.edit"), dorsale.edit_comment_path(comment), class: "edit"
10
10
 
11
11
  - if policy(comment).delete?
12
12
  = icon_link_to :trash, t("actions.delete"), dorsale.comment_path(comment), method: :delete, remote: true, data: {confirm: t("actions.confirm")}
13
13
 
14
- p.infos
15
- span.commentable-container
16
- span.commentable
17
- = link_to_object(comment.commentable)
14
+ p.comment-infos
15
+ span.comment-commentable-container
16
+ span.comment-commentable = link_to_object(comment.commentable)
17
+ span.comment-separator = " - "
18
18
 
19
- span.separator
20
- = " - "
19
+ - if comment.title.present?
20
+ span.title-container
21
+ strong.title = comment.title
22
+ span.separator = " - "
21
23
 
22
- span.date
23
- = date(comment.created_at)
24
+ span.comment-date
25
+ = date(comment.date)
24
26
 
25
27
  = " "
26
- = ::Dorsale::Comment.t(:written_by)
28
+ = comment.t(:written_by)
27
29
  = " "
28
- span.author
30
+ span.comment-author
29
31
  = comment.author.to_s
30
32
 
31
- p.text = text2html(comment.text)
33
+ - if truncate_comment_text? && comment.text.length > 300
34
+ p.comment-text-truncated
35
+ = truncate(comment.text, length: 200)
36
+ = " "
37
+ a.comment-show_more href="#"
38
+ = ta(:show_more)
39
+
40
+ p.comment-text = text2html(comment.text)
32
41
 
33
42
  .clearfix
@@ -8,8 +8,17 @@
8
8
  - else
9
9
  = image_tag "dorsale/avatar.png", class: "avatar"
10
10
 
11
- .textarea-input-group
12
- = f.text_area :text, rows: 3, class: "form-control"
13
- input type="submit" value=t("actions.send")
11
+ .comment-fields
12
+ .comment-title-field
13
+ = f.text_field :title, class: "form-control input-sm", placeholder: f.object.t(:title)
14
+
15
+ .comment-date-field
16
+ = f.text_field :date, class: "form-control input-sm", placeholder: f.object.t(:date)
17
+
18
+ .comment-text-field
19
+ = f.text_area :text, rows: 3, class: "form-control input-sm", placeholder: f.object.t(:text)
20
+
21
+ .comment-submit
22
+ input type="submit" value=t("actions.send") class="btn btn-success btn-xs"
14
23
 
15
24
  .clearfix
@@ -5,7 +5,7 @@
5
5
 
6
6
  .panel-body
7
7
  = horizontal_form_for @link, as: :link, url: customer_vault_link_form_path do |f|
8
- = f.association :bob, label: ::Dorsale::CustomerVault::Person.t, collection: @people
8
+ = f.association :bob, label: ::Dorsale::CustomerVault::Person.t, collection: @people, input_html: {class: "select2"}
9
9
 
10
10
  = f.input :title
11
11
  = form_buttons
@@ -9,18 +9,14 @@
9
9
 
10
10
  .context-body
11
11
  p.text-center = avatar_img(person)
12
-
13
- = info person, :tags, tags(person)
14
- = info person, :email, helper: :email_link
15
- = info person, :phone, helper: :tel_link
16
- = info person, :mobile, helper: :tel_link
17
- = info person, :fax, helper: :tel_link
18
- = info person, :skype, helper: :email_link
19
- = info person, :www, helper: :web_link
20
- = info person, :twitter, helper: :web_link
21
- = info person, :facebook, helper: :web_link
22
- = info person, :linkedin, helper: :web_link
23
- = info person, :viadeo, helper: :web_link
12
+ = render "dorsale/customer_vault/people/context_general", person: person
13
+ hr
14
+ = render "dorsale/customer_vault/people/context_address", person: person
15
+ hr
16
+ = render 'dorsale/customer_vault/people/context_social', person: person
24
17
 
25
18
  .context-footer
26
19
  = actions_for(person)
20
+
21
+ - if person.individual? && person.corporation.present?
22
+ = render "dorsale/customer_vault/people/context", person: person.corporation
@@ -0,0 +1,6 @@
1
+ - address = person.address
2
+ = info address, :street
3
+ = info address, :street_bis
4
+ = info address, :city
5
+ = info address, :zip
6
+ = info address, :country
@@ -0,0 +1,5 @@
1
+ = info person, :tags, tags(person)
2
+ = info person, :email, helper: :email_link
3
+ = info person, :phone, helper: :tel_link
4
+ = info person, :mobile, helper: :tel_link
5
+ = info person, :fax, helper: :tel_link
@@ -0,0 +1,6 @@
1
+ = info person, :skype, helper: :email_link
2
+ = info person, :www, helper: :web_link
3
+ = info person, :twitter, helper: :web_link
4
+ = info person, :facebook, helper: :web_link
5
+ = info person, :linkedin, helper: :web_link
6
+ = info person, :viadeo, helper: :web_link
@@ -18,15 +18,17 @@
18
18
  .panel-body
19
19
  - if @person.corporation?
20
20
  = f.input :capital
21
- = f.input :immatriculation_number_1
22
- = f.input :immatriculation_number_2
21
+ = f.input :immatriculation_number
22
+ = f.input :number_of_employees
23
+ = f.input :revenue
23
24
  = f.input :european_union_vat_number
24
25
  = f.input :legal_form
25
26
 
27
+
26
28
  - if @person.individual?
27
29
  = f.input :title
28
- = f.input :context, as: :text, input_html: {rows: 4}
29
-
30
+ = f.association :corporation, collection: policy_scope(Dorsale::CustomerVault::Corporation), input_html: {class: 'select2'}
31
+ = f.input :context, as: :text, input_html: {rows: 4}
30
32
  .panel.panel-default
31
33
  .panel-heading: .panel-title = t("customer_vault.contact_informations")
32
34
  .panel-body
@@ -40,6 +42,8 @@
40
42
  = f.input :facebook, as: :string
41
43
  = f.input :linkedin, as: :string
42
44
  = f.input :viadeo, as: :string
45
+ - if @person.corporation?
46
+ = f.input :societe_com
43
47
 
44
48
  .panel.panel-default
45
49
  .panel-heading: .panel-title = t("customer_vault.address_informations")
@@ -57,8 +57,12 @@ en:
57
57
  all_tags: "All tags"
58
58
  all_types: "All types"
59
59
  capital: "Capital"
60
- immatriculation_number_1: "Immatriculation number 1"
61
- immatriculation_number_2: "Immatriculation number 2"
60
+ immatriculation_number: "Immatriculation number 1"
61
+ revenue: "Revenue"
62
+ number_of_employees: "Number of employees"
63
+ naf: "NAF"
64
+ societe_com: "Societe.com"
65
+ corporation: "Corporation"
62
66
  european_union_vat_number: "European union VAT number"
63
67
  legal_form: "Legal form"
64
68
  count: "Number of people"
@@ -57,12 +57,17 @@ fr:
57
57
  all_tags: "Tous les tags"
58
58
  all_types: "Tous les types"
59
59
  capital: "Capital"
60
- immatriculation_number_1: "SIREN"
61
- immatriculation_number_2: "RCS"
60
+ immatriculation_number: "SIREN"
61
+ revenue: "Chiffre d'affaire"
62
+ number_of_employees: "Effectif"
63
+ naf: "NAF"
64
+ corporation: "Entreprise"
65
+ societe_com: "Societe.com"
62
66
  european_union_vat_number: "Numéro TVA européenne"
63
67
  legal_form: "Forme juridique"
64
68
  count: "Nombre de contacts"
65
69
  person_type: "Type"
70
+ title: "Fonction"
66
71
  dorsale/customer_vault/individual:
67
72
  <<: *customer_vault_person_attributes
68
73
  dorsale/customer_vault/corporation:
@@ -34,3 +34,8 @@ en:
34
34
  dorsale/comment:
35
35
  one: "Comment"
36
36
  other: "Comments"
37
+
38
+ attributes:
39
+ dorsale/comment:
40
+ title: "Title (optional)"
41
+ text: "Comment"
@@ -34,3 +34,8 @@ fr:
34
34
  dorsale/comment:
35
35
  one: "Commentaire"
36
36
  other: "Commentaires"
37
+
38
+ attributes:
39
+ dorsale/comment:
40
+ title: "Titre (facultatif)"
41
+ text: "Commentaire"
@@ -0,0 +1,7 @@
1
+ class DorsaleCommentsAddDateAndTitle < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :dorsale_comments, :date, :date
4
+ add_column :dorsale_comments, :title, :string
5
+ Dorsale::Comment.update_all("date = created_at")
6
+ end
7
+ end
@@ -0,0 +1,36 @@
1
+ class AddAttributeToDorsaleCustomerVaultPeople < ActiveRecord::Migration[5.0]
2
+ class Person < ActiveRecord::Base
3
+ self.table_name = :dorsale_customer_vault_people
4
+ end
5
+
6
+ def change
7
+ add_column :dorsale_customer_vault_people, :context, :text
8
+ add_column :dorsale_customer_vault_people, :corporation_id, :integer
9
+ migrate_individuals_context
10
+ migrate_corporations_immatriculation_numbers
11
+ end
12
+
13
+ def migrate_individuals_context
14
+ Dorsale::CustomerVault::Individual.all.each do |individual|
15
+ data = JSON.parse(individual.data_before_type_cast)
16
+
17
+ individual.update_columns context: data["context"]
18
+ data.delete("context")
19
+
20
+ Person.where(id: individual.id).update_all(data: data.to_json)
21
+ end
22
+ end
23
+
24
+ def migrate_corporations_immatriculation_numbers
25
+ Dorsale::CustomerVault::Corporation.all.each do |corporation|
26
+ data = JSON.parse(corporation.data_before_type_cast)
27
+
28
+ immatriculation_number = "#{data['immatriculation_number_1']} / #{data['immatriculation_number_2']}"
29
+ data.delete("immatriculation_number_1")
30
+ data.delete("immatriculation_number_2")
31
+ data["immatriculation_number"] = immatriculation_number
32
+
33
+ Person.where(id: corporation.id).update_all(data: data.to_json)
34
+ end
35
+ end
36
+ end
@@ -11,7 +11,7 @@ Feature: Manage corporations
11
11
  When I create an new corporation
12
12
  And I add the corporation's informations
13
13
  And I fill the corporation's address
14
- And I fill the corporation capital, immatriculation1, immatriculation2, legal form
14
+ And I fill the corporation capital, immatriculation, legal form
15
15
  And I validate the new corporation
16
16
  Then the corporation is created
17
17
  And I am on the corporation page
@@ -9,7 +9,7 @@ Feature: Manage links
9
9
 
10
10
  Scenario: Add a new link on individual
11
11
  Given an existing corporation
12
- And an existing indidual
12
+ And an existing individual
13
13
  When I navigate to the link section of the indidual details
14
14
  And I add a new link to the individual
15
15
  And I provide the link and the target corporation
@@ -32,7 +32,7 @@ Feature: Manage links
32
32
 
33
33
  Scenario: Add a new link on corporation
34
34
  Given an existing corporation
35
- And an existing indidual
35
+ And an existing individual
36
36
  When I navigate to the link section of the corporation details
37
37
  And I add a new link to the corporation
38
38
  And I provide the link and the target individual
@@ -9,3 +9,17 @@ Feature: People
9
9
  When I go the to people list
10
10
  And I export people list
11
11
  Then the file is downloaded
12
+
13
+ Scenario: Activity truncated comment
14
+ Given an existing individual
15
+ And a very long comment on this person
16
+ When I go on the people activity
17
+ Then I see the truncated comment
18
+ When I click on show more
19
+ Then I see the full comment
20
+
21
+ Scenario: Activity not truncated comment
22
+ Given an existing individual
23
+ And a short comment on this person
24
+ When I go on the people activity
25
+ Then I see the full comment
@@ -59,3 +59,7 @@ end
59
59
 
60
60
  When(/^(?:I|he|she) download XLSX file$/) do
61
61
  end
62
+
63
+ When(/^I click on show more$/) do
64
+ find("a[class*=show_more]").click
65
+ end
@@ -16,11 +16,14 @@ When(/^I add the corporation's informations$/) do
16
16
  fill_in 'person_fax', with: '09 00 00 00 00'
17
17
  end
18
18
 
19
- When(/^I fill the corporation capital, immatriculation1, immatriculation2, legal form$/) do
19
+ When(/^I fill the corporation capital, immatriculation, legal form$/) do
20
20
  fill_in 'person_capital', with: '1000'
21
- fill_in 'person_immatriculation_number_1', with: 'RCS 201523658'
22
- fill_in 'person_immatriculation_number_2', with: 'SIREN 5485632569'
21
+ fill_in 'person_immatriculation_number', with: 'RCS 201523658'
23
22
  fill_in 'person_legal_form', with: 'SARL'
23
+ fill_in 'person_number_of_employees', with: '45'
24
+ fill_in 'person_revenue', with: "450000"
25
+ fill_in 'person_context', with: "Le joli contexte"
26
+ fill_in 'person_societe_com', with: "societe_com"
24
27
  end
25
28
 
26
29
  When(/^I fill the corporation's address$/) do
@@ -71,7 +74,7 @@ end
71
74
  Then(/^I see my new comment$/) do
72
75
  expect(Dorsale::Comment.count).to eq(@comments_count + 1)
73
76
 
74
- expect(find(".comment p.text")).to have_content "MyNewComment"
77
+ expect(find("p.comment-text")).to have_content "MyNewComment"
75
78
  end
76
79
 
77
80
  Given(/^an existing comment on this corporation$/) do
@@ -87,7 +90,7 @@ When(/^I update the comment$/) do
87
90
  end
88
91
 
89
92
  Then(/^I see my updated comment$/) do
90
- expect(find(".comment p.text")).to have_content "MyUpdatedComment"
93
+ expect(find("p.comment-text")).to have_content "MyUpdatedComment"
91
94
  end
92
95
 
93
96
  When(/^I delete the comment$/) do
@@ -36,10 +36,6 @@ Then(/^the individual is created$/) do
36
36
  expect(@individual.last_name).to eq "Gantaume"
37
37
  end
38
38
 
39
- Given(/^an existing individual$/) do
40
- @individual = create(:customer_vault_individual)
41
- end
42
-
43
39
  When(/^I edit this individual$/) do
44
40
  visit dorsale.edit_customer_vault_individual_path(@individual)
45
41
  end
@@ -4,7 +4,7 @@ Given(/^an existing corporation$/) do
4
4
  @person = @corporation
5
5
  end
6
6
 
7
- Given(/^an existing indidual$/) do
7
+ Given(/^an existing individual$/) do
8
8
  @individual = create(:customer_vault_individual)
9
9
  @person = @individual
10
10
  end
@@ -5,3 +5,21 @@ end
5
5
  Then(/^the file is downloaded$/) do
6
6
  # Nothing to do, error appears in previous step if any problem
7
7
  end
8
+
9
+ Given(/^a very long comment on this person$/) do
10
+ @comment = create(:dorsale_comment, commentable: @person, text: Faker::Lorem.paragraph(10))
11
+ end
12
+
13
+ Then(/^I see the truncated comment$/) do
14
+ expect(page).to have_selector(".comment-text-truncated")
15
+ expect(page).to have_no_selector(".comment-text")
16
+ end
17
+
18
+ Then(/^I see the full comment$/) do
19
+ expect(page).to have_selector(".comment-text")
20
+ expect(page).to have_no_selector(".comment-text-truncated")
21
+ end
22
+
23
+ Given(/^a short comment on this person$/) do
24
+ @comment = create(:dorsale_comment, commentable: @person, text: "i am short")
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Dorsale
2
- VERSION = "3.5.0"
2
+ VERSION = "3.5.1"
3
3
  end
@@ -8,7 +8,16 @@ RSpec.describe Dorsale::Comment, type: :model do
8
8
  it { is_expected.to belong_to :commentable }
9
9
  it { is_expected.to validate_presence_of :commentable }
10
10
 
11
+ it { is_expected.to validate_presence_of :date }
12
+ it { is_expected.to_not validate_presence_of :title }
13
+
11
14
  it "should have a valid factory" do
12
15
  expect(create(:dorsale_comment)).to be_valid
13
16
  end
17
+
18
+ describe "default values" do
19
+ it "should set date" do
20
+ expect(described_class.new.date).to be_present
21
+ end
22
+ end # describe "default values"
14
23
  end
@@ -5,15 +5,19 @@ RSpec.describe ::Dorsale::CustomerVault::Corporation, type: :model do
5
5
  it { is_expected.to have_many :comments }
6
6
  it { is_expected.to have_many :taggings }
7
7
  it { is_expected.to have_many :tags }
8
+ it { is_expected.to have_many :individuals }
8
9
  it { is_expected.to have_many(:tasks).dependent(:destroy) }
9
10
 
10
11
  it { is_expected.to respond_to :legal_form }
11
12
  it { is_expected.to respond_to :capital }
12
- it { is_expected.to respond_to :immatriculation_number_1 }
13
- it { is_expected.to respond_to :immatriculation_number_2 }
13
+ it { is_expected.to respond_to :immatriculation_number }
14
+ it { is_expected.to respond_to :naf }
15
+ it { is_expected.to respond_to :revenue }
16
+ it { is_expected.to respond_to :context }
17
+ it { is_expected.to respond_to :number_of_employees }
18
+ it { is_expected.to respond_to :societe_com }
14
19
 
15
20
  it { is_expected.to have_many(:comments).dependent(:destroy) }
16
21
 
17
22
  it { is_expected.to validate_presence_of :corporation_name }
18
23
  end
19
-
@@ -7,6 +7,7 @@ RSpec.describe ::Dorsale::CustomerVault::Individual, :type => :model do
7
7
  end
8
8
 
9
9
  it { is_expected.to have_one(:address).dependent(:destroy) }
10
+ it { is_expected.to belong_to :corporation }
10
11
  it { is_expected.to have_many :comments }
11
12
  it { is_expected.to have_many :taggings }
12
13
  it { is_expected.to have_many :tags }
@@ -14,4 +15,6 @@ RSpec.describe ::Dorsale::CustomerVault::Individual, :type => :model do
14
15
  it { is_expected.to have_many(:comments).dependent(:destroy) }
15
16
  it { is_expected.to validate_presence_of :first_name }
16
17
  it { is_expected.to validate_presence_of :last_name }
18
+
19
+ it { is_expected.to respond_to :context }
17
20
  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.0
4
+ version: 3.5.1
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-03 00:00:00.000000000 Z
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.2
33
+ version: 1.0.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.2
40
+ version: 1.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: virtus
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -701,6 +701,9 @@ files:
701
701
  - app/views/dorsale/customer_vault/links/index.html.slim
702
702
  - app/views/dorsale/customer_vault/links/new.html.slim
703
703
  - app/views/dorsale/customer_vault/people/_context.html.slim
704
+ - app/views/dorsale/customer_vault/people/_context_address.html.slim
705
+ - app/views/dorsale/customer_vault/people/_context_general.html.slim
706
+ - app/views/dorsale/customer_vault/people/_context_social.html.slim
704
707
  - app/views/dorsale/customer_vault/people/_data_context.html.slim
705
708
  - app/views/dorsale/customer_vault/people/_filters.html.slim
706
709
  - app/views/dorsale/customer_vault/people/_form.html.slim
@@ -809,6 +812,8 @@ files:
809
812
  - db/migrate/20170127131537_delete_folders.rb
810
813
  - db/migrate/20170127151610_fix_expense_state.rb
811
814
  - db/migrate/20170127155636_billing_machine_add_pdf_file.rb
815
+ - db/migrate/20170406121024_dorsale_comments_add_date_and_title.rb
816
+ - db/migrate/20170406122047_add_attribute_to_dorsale_customer_vault_people.rb
812
817
  - features/access.feature
813
818
  - features/billing_machine_id_cards.feature
814
819
  - features/billing_machine_invoices.feature