dorsale 3.7.4 → 3.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/app/assets/stylesheets/dorsale/engines/flyboy.sass +10 -6
  4. data/app/controllers/dorsale/flyboy/task_comments_controller.rb +1 -0
  5. data/app/controllers/dorsale/flyboy/tasks_controller.rb +3 -12
  6. data/app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb +1 -1
  7. data/app/filters/dorsale/flyboy/small_data/filter_strategy_by_task_state.rb +9 -0
  8. data/app/helpers/dorsale/flyboy/application_helper.rb +3 -13
  9. data/app/models/dorsale/flyboy/task.rb +29 -0
  10. data/app/models/dorsale/flyboy/task_comment.rb +1 -1
  11. data/app/sorters/dorsale/flyboy/task_comments_sorter.rb +12 -0
  12. data/app/views/dorsale/flyboy/_filters.html.slim +1 -1
  13. data/app/views/dorsale/flyboy/task_comments/_form.html.slim +11 -0
  14. data/app/views/dorsale/flyboy/task_comments/_list.html.slim +7 -26
  15. data/app/views/dorsale/flyboy/task_comments/_task_comment.html.slim +13 -0
  16. data/app/views/dorsale/flyboy/tasks/_context.html.slim +1 -1
  17. data/app/views/dorsale/flyboy/tasks/_list.html.slim +1 -1
  18. data/app/views/dorsale/flyboy/tasks/_reminder_fields.html.slim +15 -11
  19. data/app/views/dorsale/flyboy/tasks/_term_fields.html.slim +11 -7
  20. data/config/locales/flyboy.en.yml +8 -6
  21. data/config/locales/flyboy.fr.yml +8 -6
  22. data/features/step_definitions/flyboy_tasks_steps.rb +2 -2
  23. data/lib/dorsale/version.rb +1 -1
  24. data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +2 -2
  25. data/spec/models/dorsale/flyboy/task_spec.rb +68 -5
  26. metadata +7 -6
  27. data/app/filters/dorsale/flyboy/small_data/filter_strategy_by_done.rb +0 -6
  28. data/spec/helpers/dorsale/flyboy/application_helper_spec.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0894fffed18b6a992d19d31f7e07b37a15988cf
4
- data.tar.gz: 6469c9e20f4f12edc13f070e4f3f599f6f44aedb
3
+ metadata.gz: ad479d894fe508bd2db24dbcb03d17c986fd482b
4
+ data.tar.gz: 1122ddf76aabb70beab2c05c4807051b12d35e33
5
5
  SHA512:
6
- metadata.gz: 81e5992cd8182154c49b12e1c0f14f9d9985871b1509ae1d0fd9180e1f59515640a0bb1cb7fb02d2cfaa4ff123fb86a2e853ee24fe010742c79cb9f18e68e34f
7
- data.tar.gz: cf161f045d9c3db79530b6babc7a52f3185045461668913173c2754ac947625278299010bbe589c57e17b7a6ffec5e52bcab52510574611d2465cbba2322e4c1
6
+ metadata.gz: 215f9de605cb95f630c71f709c514e617c8c942bcd22af69411a295900efdfb818b1ef7ae1a392dc5c5d13697c5756d13f1bd064e0ef6ef999e9fa1f59f9c3de
7
+ data.tar.gz: 45b40e12c35892c1a2741a70210195746737105bd673bb08543332e237a3ea3b48387c6a00ec9409f81f8c460f93f0ebdfad6299c4d758954d00e6ba95901b6f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## 3.7.5
6
+
7
+ - Task improvements
8
+
5
9
  ## 3.7.4
6
10
 
7
11
  - Change nilify_blanks config
@@ -9,7 +9,7 @@
9
9
  th
10
10
  text-align: left
11
11
 
12
- .finished td, .context-body.finished
12
+ .done td, .context-body.done
13
13
  background: $state-success-bg !important
14
14
 
15
15
  .onwarning td, .context-body.onwarning
@@ -61,13 +61,17 @@
61
61
 
62
62
  .task_reminder_fields,
63
63
  .task_term_fields,
64
- display: flex
65
-
66
- > div
67
- margin-right: 15px
64
+ height: 34px
68
65
 
69
66
  label
70
- line-height: 2.5em
67
+ padding-left: 0
68
+
69
+ .form-sub-group-container
70
+ display: flex
71
+
72
+ > div
73
+ margin-right: 15px
74
+
71
75
 
72
76
  input, select
73
77
  width: auto
@@ -10,6 +10,7 @@ class Dorsale::Flyboy::TaskCommentsController < ::Dorsale::Flyboy::ApplicationCo
10
10
  if @task_comment.save
11
11
  redirect_to @task
12
12
  else
13
+ @task_comments = @task.comments
13
14
  render "dorsale/flyboy/tasks/show"
14
15
  end
15
16
  end
@@ -60,19 +60,10 @@ class Dorsale::Flyboy::TasksController < ::Dorsale::Flyboy::ApplicationControlle
60
60
 
61
61
  def show
62
62
  authorize @task, :read?
63
- @task_comments = @task.comments
64
63
 
65
- @order ||= sortable_column_order do |column, direction|
66
- case column
67
- when :description
68
- %(LOWER(#{column}) #{direction})
69
- when :progress
70
- %(#{column} #{direction})
71
- else
72
- "date #{direction}"
73
- end
74
- end
75
- @task_comments = @task_comments.reorder(@order)
64
+ @task_comments = @task.comments.preload(:author)
65
+
66
+ @task_comments = Dorsale::Flyboy::TaskCommentsSorter.(@task_comments, params[:sort] ||= "-date")
76
67
  end
77
68
 
78
69
  def new
@@ -1,6 +1,6 @@
1
1
  class Dorsale::Flyboy::SmallData::FilterForTasks < ::Agilibox::SmallData::Filter
2
2
  STRATEGIES = {
3
- "fb_status" => ::Dorsale::Flyboy::SmallData::FilterStrategyByDone.new,
3
+ "fb_state" => ::Dorsale::Flyboy::SmallData::FilterStrategyByTaskState.new,
4
4
  "fb_owner" => ::Agilibox::SmallData::FilterStrategyByKeyValue.new(:owner_id)
5
5
  }
6
6
  end
@@ -0,0 +1,9 @@
1
+ class Dorsale::Flyboy::SmallData::FilterStrategyByTaskState < ::Agilibox::SmallData::FilterStrategy
2
+ def apply(query, value)
3
+ if value.in?(Dorsale::Flyboy::Task::STATES)
4
+ query.send(value)
5
+ else
6
+ query
7
+ end
8
+ end
9
+ end
@@ -25,20 +25,10 @@ module Dorsale::Flyboy::ApplicationHelper
25
25
  render "dorsale/flyboy/tasks/summary"
26
26
  end
27
27
 
28
- def task_color(task)
29
- return "finished" if task.done
30
- return "onalert" if task.term < Time.zone.now.to_date
31
- return "onwarning" if task.reminder_date && task.reminder_date < Time.zone.now.to_date
32
- return "ontime"
33
-
34
- end
35
-
36
28
  def flyboy_status_for_filters_select
37
- {
38
- Dorsale::Flyboy::Task.t("status.all") => "",
39
- Dorsale::Flyboy::Task.t("status.open") => "open",
40
- Dorsale::Flyboy::Task.t("status.closed") => "closed",
41
- }
29
+ Dorsale::Flyboy::Task::STATES.map do |state|
30
+ [Dorsale::Flyboy::Task.t("state.#{state}"), state]
31
+ end
42
32
  end
43
33
 
44
34
  def flyboy_tasks_owners_for_filters_select
@@ -15,6 +15,35 @@ class Dorsale::Flyboy::Task < ::Dorsale::ApplicationRecord
15
15
  polymorphic_id_for :taskable
16
16
  polymorphic_id_for :owner
17
17
 
18
+ STATES = %w(done undone ontime onwarning onalert)
19
+
20
+ def state
21
+ return "done" if done
22
+ return "onalert" if term && term <= Time.zone.now.to_date
23
+ return "onwarning" if reminder_date && reminder_date <= Time.zone.now.to_date
24
+ return "ontime"
25
+ end
26
+
27
+ scope :done, -> { where(done: true) }
28
+ scope :undone, -> { where(done: false) }
29
+
30
+ scope :ontime, -> {
31
+ undone
32
+ .where("term IS NULL OR term > ?", Time.zone.now.to_date)
33
+ .where("reminder_date IS NULL OR reminder_date > ?", Time.zone.now.to_date)
34
+ }
35
+
36
+ scope :onwarning, -> {
37
+ undone
38
+ .where("reminder_date <= ?", Time.zone.now.to_date)
39
+ .where("term IS NULL OR term > ?", Time.zone.now.to_date)
40
+ }
41
+
42
+ scope :onalert, -> {
43
+ undone
44
+ .where("term <= ?", Time.zone.now.to_date)
45
+ }
46
+
18
47
  scope :delayed, -> { where(done: false).where("term < ?", Time.zone.now.to_date) }
19
48
  scope :today, -> { where(done: false).where("term = ?", Time.zone.now.to_date) }
20
49
  scope :tomorrow, -> { where(done: false).where("term = ?", Date.tomorrow) }
@@ -10,7 +10,7 @@ class Dorsale::Flyboy::TaskComment < ::Dorsale::ApplicationRecord
10
10
  validates :description, presence: true
11
11
  validates :progress, inclusion: {in: 0..100}
12
12
 
13
- default_scope -> { order("created_at DESC") }
13
+ default_scope -> { order(date: :desc) }
14
14
 
15
15
  def assign_default_values
16
16
  assign_default :date, Time.zone.now
@@ -0,0 +1,12 @@
1
+ class Dorsale::Flyboy::TaskCommentsSorter < Agilibox::Sorter
2
+ def sort
3
+ case column
4
+ when :date
5
+ %(#{column} #{direction})
6
+ when :description
7
+ %(LOWER(#{column}) #{direction})
8
+ else
9
+ "date DESC"
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  = filters_form do |f|
2
- = f.input :fb_status, collection: flyboy_status_for_filters_select, include_blank: false
2
+ = f.input :fb_state, collection: flyboy_status_for_filters_select, include_blank: Dorsale::Flyboy::Task.t("state.all")
3
3
 
4
4
  - if @filters.class::STRATEGIES.include?("fb_owner")
5
5
  = f.input :fb_owner, collection: flyboy_tasks_owners_for_filters_select, include_blank: t("filters.all_owners")
@@ -0,0 +1,11 @@
1
+ - if policy(@task).comment?
2
+ tr#new_task_comment_tr
3
+ td.task_comment-progress
4
+ = f.input :progress, label: false
5
+
6
+ td.task_comment-content
7
+ = f.hidden_field :task_id
8
+
9
+ .textarea-input-group
10
+ = f.text_area :description, rows: 3, class: "form-control"
11
+ input type="submit" value=t("actions.save")
@@ -3,36 +3,17 @@
3
3
  thead
4
4
  tr
5
5
  th.task_comment-progress
6
- = sortable_column Dorsale::Flyboy::TaskComment.t(:progress), :progress
6
+ = sortable_column Dorsale::Flyboy::TaskComment.t(:progress), :date
7
7
 
8
8
  th.task_comment-description
9
9
  = sortable_column Dorsale::Flyboy::TaskComment.t(:description), :description
10
10
 
11
11
  tbody
12
- - if policy(@task).comment?
13
- tr#new_task_comment_tr
14
- td.task_comment-progress
15
- = f.input :progress, label: false
12
+ - if params[:sort] != "date"
13
+ = render "dorsale/flyboy/task_comments/form", f: f
16
14
 
17
- td.task_comment-content
18
- = f.hidden_field :task_id
15
+ - @task_comments.each do |task_comment|
16
+ = render "dorsale/flyboy/task_comments/task_comment", task_comment: task_comment
19
17
 
20
- .textarea-input-group
21
- = f.text_area :description, rows: 3, class: "form-control"
22
- input type="submit" value=t("actions.save")
23
-
24
-
25
- - @task_comments.each do |comment|
26
- tr.task_comment
27
- td.task_comment-progress
28
- = progress_bar percentage: comment.progress, label: true
29
-
30
- td.task_comment-content
31
- p: small
32
- span.task_comment-date = date(comment.date)
33
- = " "
34
- = comment.t(:written_by)
35
- = " "
36
- span.task_comment-author = comment.author
37
-
38
- p.task_comment-description = text2html comment.description
18
+ - if params[:sort] == "date"
19
+ = render "dorsale/flyboy/task_comments/form", f: f
@@ -0,0 +1,13 @@
1
+ tr.task_comment
2
+ td.task_comment-progress
3
+ = progress_bar percentage: task_comment.progress, label: true
4
+
5
+ td.task_comment-content
6
+ p: small
7
+ span.task_comment-date = date(task_comment.date)
8
+ = " "
9
+ = task_comment.t(:written_by)
10
+ = " "
11
+ span.task_comment-author = task_comment.author
12
+
13
+ p.task_comment-description = text2html task_comment.description
@@ -4,7 +4,7 @@
4
4
  = " "
5
5
  = task
6
6
 
7
- .context-body class=task_color(task)
7
+ .context-body class=task.state
8
8
  = info task, :progress, progress_bar(percentage: task.progress, label: true)
9
9
  = info task, :owner
10
10
  = info task, :created_at
@@ -18,7 +18,7 @@ table#tasks-list
18
18
 
19
19
  tbody
20
20
  - tasks.each do |task|
21
- tr.task class=task_color(task)
21
+ tr.task class=task.state
22
22
  td.task-status
23
23
  - if task.done?
24
24
  span.title-tooltip title=task.t(:done)
@@ -1,18 +1,22 @@
1
- .task_reminder_fields
2
- .form-sub-group.task_reminder_label
3
- = f.label :reminder, class: "control-label"
1
+ .form-group.task_reminder_fields class=("has-error" if f.object.errors.key?(:reminder_date))
2
+ = f.label :reminder, class: "control-label col-sm-3"
4
3
 
5
- .form-sub-group.task_reminder_type
6
- = f.input :reminder_type, collection: flyboy_reminder_types_for_select, include_blank: false, wrapper: :default, label: false, input_html: {class: "form-control"}
4
+ .col-sm-9
5
+ .form-sub-group-container
6
+ .form-sub-group.task_reminder_type
7
+ = f.select :reminder_type, flyboy_reminder_types_for_select, {include_blank: false}, {class: "form-control"}
7
8
 
8
- .form-sub-group.task_reminder_duration
9
- = f.input :reminder_duration, wrapper: :default, label: false, input_html: {class: "form-control"}
9
+ .form-sub-group.task_reminder_duration
10
+ = f.text_field :reminder_duration, class: "form-control"
10
11
 
11
- .form-sub-group.task_reminder_unit
12
- = f.input :reminder_unit, collection: flyboy_reminder_type_units_for_select, wrapper: :default, label: false, input_html: {class: "form-control"}
12
+ .form-sub-group.task_reminder_unit
13
+ = f.select :reminder_unit, flyboy_reminder_type_units_for_select, {include_blank: false}, {class: "form-control"}
13
14
 
14
- .form-sub-group.task_reminder_date
15
- = f.input :reminder_date, html5: true, wrapper: :default, label: false, input_html: {class: "form-control"}
15
+ .form-sub-group.task_reminder_date
16
+ = f.date_field :reminder_date, class: "form-control"
17
+
18
+ - if errors = f.object.errors[:reminder_date].join(", ").presence
19
+ span.help-block = errors
16
20
 
17
21
  coffee:
18
22
  $("#task_reminder_type")
@@ -1,12 +1,16 @@
1
- .task_term_fields
2
- .form-sub-group.task_term_label
3
- = f.label :term, class: "control-label"
1
+ .form-group.task_term_fields class=("has-error" if f.object.errors.key?(:term))
2
+ = f.label :term, class: "control-label col-sm-3"
4
3
 
5
- .form-sub-group.task_term_type
6
- = f.input :term, collection: task_term_values_for_select, include_blank: true, html5: true, wrapper: :default, label: false, input_html: {class: "form-control"}
4
+ .col-sm-9
5
+ .form-sub-group-container
6
+ .form-sub-group.task_term_type
7
+ = f.select :term, task_term_values_for_select, {include_blank: true}, {class: "form-control"}
7
8
 
8
- .form-sub-group.task_term_custom
9
- = f.input :term, html5: true, wrapper: :default, label: false, input_html: {class: "form-control", id: "task_term_custom"}
9
+ .form-sub-group.task_term_custom
10
+ = f.date_field :term, class: "form-control", id: "task_term_custom"
11
+
12
+ - if errors = f.object.errors[:term].join(", ").presence
13
+ span.help-block = errors
10
14
 
11
15
  coffee:
12
16
  $("#task_term")
@@ -35,12 +35,6 @@ en:
35
35
  other: "Task Comments"
36
36
 
37
37
  attributes:
38
- dorsale/flyboy/task/status:
39
- all: "All status"
40
- open: "Open"
41
- closed: "Closed"
42
- unknown: "Unknown"
43
-
44
38
  dorsale/flyboy/task:
45
39
  taskable: "Origin"
46
40
  taskable_type: "Origin type"
@@ -58,6 +52,14 @@ en:
58
52
  description: "Description"
59
53
  progress: "Progress"
60
54
 
55
+ dorsale/flyboy/task/state:
56
+ all: "All states"
57
+ done: "Finished"
58
+ undone: "Not finished"
59
+ ontime: "On time"
60
+ onwarning: "Reminder outdated"
61
+ onalert: "Term outdated"
62
+
61
63
  dorsale/flyboy/task_comment:
62
64
  progress: "Progress"
63
65
  description: "Description"
@@ -37,12 +37,6 @@ fr:
37
37
  other: "Commentaires de tâche"
38
38
 
39
39
  attributes:
40
- dorsale/flyboy/task/status:
41
- all: "Tous les status"
42
- open: "Ouvert"
43
- closed: "Fermé"
44
- unknown: "Inconnu"
45
-
46
40
  dorsale/flyboy/task:
47
41
  taskable: "Origine"
48
42
  taskable_type: "Type origine"
@@ -60,6 +54,14 @@ fr:
60
54
  description: "Description"
61
55
  progress: "Progression"
62
56
 
57
+ dorsale/flyboy/task/state:
58
+ all: "Tous les états"
59
+ done: "Terminée"
60
+ undone: "Non terminée"
61
+ ontime: "À temps"
62
+ onwarning: "Rappel dépassé"
63
+ onalert: "Échéance dépassée"
64
+
63
65
  dorsale/flyboy/task_comment:
64
66
  progress: "Progression"
65
67
  description: "Description"
@@ -93,12 +93,12 @@ When(/^I snooze this task$/) do
93
93
  end
94
94
 
95
95
  When(/^I filter tasks by done$/) do
96
- select "Fermé"
96
+ select "Terminée"
97
97
  find(".filters [type=submit]:last-child").click
98
98
  end
99
99
 
100
100
  When(/^I filter tasks by undone$/) do
101
- select "Ouvert"
101
+ select "Non terminé"
102
102
  find(".filters [type=submit]:last-child").click
103
103
  end
104
104
 
@@ -1,3 +1,3 @@
1
1
  module Dorsale
2
- VERSION = "3.7.4"
2
+ VERSION = "3.7.5"
3
3
  end
@@ -58,13 +58,13 @@ describe Dorsale::Flyboy::TasksController, type: :controller do
58
58
  end
59
59
 
60
60
  it 'should filter by status closed' do
61
- cookies["filters"] = {'fb_status' => "closed"}.to_json
61
+ cookies["filters"] = {'fb_state' => "done"}.to_json
62
62
  get :index
63
63
  expect(assigns(:tasks).to_a).to eq [@task1]
64
64
  end
65
65
 
66
66
  it 'should filter by status opened' do
67
- cookies["filters"] = {'fb_status' => "opened"}.to_json
67
+ cookies["filters"] = {'fb_state' => "undone"}.to_json
68
68
  get :index
69
69
  expect(assigns(:tasks).to_a).to eq [@task2]
70
70
  end
@@ -89,7 +89,7 @@ describe Dorsale::Flyboy::Task do
89
89
  end # describe "reminders"
90
90
 
91
91
  describe "scopes" do
92
- it "should return delayed unfinished tasks" do
92
+ it "should return delayed undone tasks" do
93
93
  task = create(:flyboy_task, owner: @user1, term: Time.zone.now.to_date+1)
94
94
  task_1 = create(:flyboy_task, owner: @user1, term: Time.zone.now.to_date-1, done: true)
95
95
  task_2 = create(:flyboy_task, owner: @user1, term: Time.zone.now.to_date-1, done: false)
@@ -99,7 +99,7 @@ describe Dorsale::Flyboy::Task do
99
99
  expect(tasks).to contain_exactly(task_2, task_4)
100
100
  end
101
101
 
102
- it "should return today unfinished tasks" do
102
+ it "should return today undone tasks" do
103
103
  task = create(:flyboy_task, owner: @user1, term: Time.zone.now.to_date+1)
104
104
  task_1 = create(:flyboy_task, owner: @user1, term: Time.zone.now.to_date, done: true)
105
105
  task_2 = create(:flyboy_task, owner: @user1, term: Time.zone.now.to_date, done: false)
@@ -107,7 +107,7 @@ describe Dorsale::Flyboy::Task do
107
107
  expect(tasks).to contain_exactly(task_2)
108
108
  end
109
109
 
110
- it "should return tomorrow unfinished tasks" do
110
+ it "should return tomorrow undone tasks" do
111
111
  task = create(:flyboy_task, owner: @user1, term: Time.zone.now.to_date)
112
112
  task_1 = create(:flyboy_task, owner: @user1, term: Date.tomorrow, done: true)
113
113
  task_2 = create(:flyboy_task, owner: @user1, term: Date.tomorrow, done: false)
@@ -115,7 +115,7 @@ describe Dorsale::Flyboy::Task do
115
115
  expect(tasks).to contain_exactly(task_2)
116
116
  end
117
117
 
118
- it "should return this week unfinished tasks" do
118
+ it "should return this week undone tasks" do
119
119
  Timecop.freeze(2015, 5, 21, 12, 0, 0)
120
120
  task = create(:flyboy_task, owner: @user1, term: Time.zone.now.to_date-7, done: false)
121
121
  task_1 = create(:flyboy_task, owner: @user1, term: Time.zone.now.to_date+2, done: true)
@@ -126,7 +126,7 @@ describe Dorsale::Flyboy::Task do
126
126
  expect(tasks).to contain_exactly(task_2, task_3)
127
127
  end
128
128
 
129
- it "should return next week unfinished tasks" do
129
+ it "should return next week undone tasks" do
130
130
  Timecop.freeze(2015, 5, 21)
131
131
  task = create(:flyboy_task, owner: @user1, term: Time.zone.now.to_date, done: false)
132
132
  task_1 = create(:flyboy_task, owner: @user1, term: Time.zone.now.to_date+7, done: true)
@@ -137,4 +137,67 @@ describe Dorsale::Flyboy::Task do
137
137
  expect(tasks).to contain_exactly(task_2, task_3)
138
138
  end
139
139
  end # describe "scopes"
140
+
141
+ describe "states" do
142
+ # L’affichage de la couleur de la tâche dépend de son achèvement:
143
+ # Si date jour < date relance alors noir
144
+ let(:task_ontime) {
145
+ create(:flyboy_task,
146
+ :reminder_type => "custom",
147
+ :reminder_date => Time.zone.now.to_date + 1.day,
148
+ :term => Time.zone.now.to_date + 3.days,
149
+ :done => false,
150
+ )
151
+ }
152
+
153
+ it "should return :ontime" do
154
+ expect(task_ontime.state).to eq "ontime"
155
+ expect(described_class.ontime).to eq [task_ontime]
156
+ end
157
+
158
+ # Si date relance <= date jour
159
+ let(:task_onwarning) {
160
+ create(:flyboy_task,
161
+ :reminder_type => "custom",
162
+ :reminder_date => Time.zone.now.to_date,
163
+ :term => Time.zone.now.to_date + 3.days,
164
+ :done => false,
165
+ )
166
+ }
167
+
168
+ it "should return :onwarning" do
169
+ expect(task_onwarning.state).to eq "onwarning"
170
+ expect(described_class.onwarning).to eq [task_onwarning]
171
+ end
172
+
173
+ # Si date butoir <= date jour alors rouge
174
+ let(:task_onalert) {
175
+ create(:flyboy_task,
176
+ :reminder_type => "custom",
177
+ :reminder_date => Time.zone.now.to_date - 3.days,
178
+ :term => Time.zone.now.to_date,
179
+ :done => false,
180
+ )
181
+ }
182
+
183
+ it "should return :onalert" do
184
+ expect(task_onalert.state).to eq "onalert"
185
+ expect(described_class.onalert).to eq [task_onalert]
186
+ end
187
+
188
+ # Si action faite alors vert
189
+ let(:task_done) {
190
+ create(:flyboy_task,
191
+ :reminder_type => "custom",
192
+ :reminder_date => Time.zone.now.to_date - 3.days,
193
+ :term => Time.zone.now.to_date - 1.day,
194
+ :done => true,
195
+ )
196
+ }
197
+
198
+ it "should return :done" do
199
+ expect(task_done.state).to eq "done"
200
+ expect(described_class.done).to eq [task_done]
201
+ end
202
+ end # describe "states"
140
203
  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.7.4
4
+ version: 3.7.5
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-09-15 00:00:00.000000000 Z
11
+ date: 2017-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -558,7 +558,7 @@ files:
558
558
  - app/filters/dorsale/customer_vault/small_data/filter_strategy_by_activity_type.rb
559
559
  - app/filters/dorsale/expense_gun/small_data/filter_for_expenses.rb
560
560
  - app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb
561
- - app/filters/dorsale/flyboy/small_data/filter_strategy_by_done.rb
561
+ - app/filters/dorsale/flyboy/small_data/filter_strategy_by_task_state.rb
562
562
  - app/helpers/dh.rb
563
563
  - app/helpers/dorsale/alexandrie/attachments_helper.rb
564
564
  - app/helpers/dorsale/all_helpers.rb
@@ -642,6 +642,7 @@ files:
642
642
  - app/services/dorsale/flyboy/task/snoozer.rb
643
643
  - app/services/dorsale/service.rb
644
644
  - app/services/dorsale/tag_list_for_model.rb
645
+ - app/sorters/dorsale/flyboy/task_comments_sorter.rb
645
646
  - app/uploaders/dorsale/alexandrie/file_uploader.rb
646
647
  - app/uploaders/dorsale/application_uploader.rb
647
648
  - app/uploaders/dorsale/avatar_uploader.rb
@@ -767,7 +768,9 @@ files:
767
768
  - app/views/dorsale/expense_gun/expenses/new.html.slim
768
769
  - app/views/dorsale/expense_gun/expenses/show.html.slim
769
770
  - app/views/dorsale/flyboy/_filters.html.slim
771
+ - app/views/dorsale/flyboy/task_comments/_form.html.slim
770
772
  - app/views/dorsale/flyboy/task_comments/_list.html.slim
773
+ - app/views/dorsale/flyboy/task_comments/_task_comment.html.slim
771
774
  - app/views/dorsale/flyboy/task_mailer/new_task.html.slim
772
775
  - app/views/dorsale/flyboy/task_mailer/term_email.html.slim
773
776
  - app/views/dorsale/flyboy/tasks/_context.html.slim
@@ -950,7 +953,6 @@ files:
950
953
  - spec/factories/flyboy_tasks.rb
951
954
  - spec/files/avatar.png
952
955
  - spec/files/pdf.pdf
953
- - spec/helpers/dorsale/flyboy/application_helper_spec.rb
954
956
  - spec/mailers/user_mailer.rb
955
957
  - spec/models/dorsale/address_spec.rb
956
958
  - spec/models/dorsale/alexandrie/attachment_spec.rb
@@ -1021,7 +1023,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1021
1023
  version: '0'
1022
1024
  requirements: []
1023
1025
  rubyforge_project:
1024
- rubygems_version: 2.6.11
1026
+ rubygems_version: 2.6.13
1025
1027
  signing_key:
1026
1028
  specification_version: 4
1027
1029
  summary: Modular ERP made with Ruby on Rails
@@ -1058,7 +1060,6 @@ test_files:
1058
1060
  - spec/factories/flyboy_tasks.rb
1059
1061
  - spec/files/avatar.png
1060
1062
  - spec/files/pdf.pdf
1061
- - spec/helpers/dorsale/flyboy/application_helper_spec.rb
1062
1063
  - spec/mailers/user_mailer.rb
1063
1064
  - spec/models/dorsale/address_spec.rb
1064
1065
  - spec/models/dorsale/alexandrie/attachment_spec.rb
@@ -1,6 +0,0 @@
1
- class Dorsale::Flyboy::SmallData::FilterStrategyByDone < ::Agilibox::SmallData::FilterStrategy
2
- def apply(query, value)
3
- value = (value == "closed")
4
- query.where(done: value)
5
- end
6
- end
@@ -1,27 +0,0 @@
1
- require 'rails_helper'
2
-
3
- describe Dorsale::Flyboy::ApplicationHelper, type: :helper do
4
- describe '#task_color' do
5
- # L’affichage de la couleur de la tâche dépend de son achèvement:
6
- # Si date jour < date relance alors noir
7
- it 'should return .ontime' do
8
- task = create(:flyboy_task, reminder_type: "custom", reminder_date: Time.zone.now.to_date + 1.day, term: Time.zone.now.to_date + 3.days, done: false)
9
- expect(task_color(task)).to eq('ontime')
10
- end
11
- # Si date relance < date jour < date butoir alors orange
12
- it 'should return .onwarning' do
13
- task = create(:flyboy_task, reminder_type: "custom", reminder_date: Time.zone.now.to_date - 1.day, term: Time.zone.now.to_date + 3.days, done: false)
14
- expect(task_color(task)).to eq('onwarning')
15
- end
16
- # Si date butoir < date jour alors rouge
17
- it 'should return .onalert' do
18
- task = create(:flyboy_task, reminder_type: "custom", reminder_date: Time.zone.now.to_date - 3.days, term: Time.zone.now.to_date - 1.day, done: false)
19
- expect(task_color(task)).to eq('onalert')
20
- end
21
- # Si action faite alors vert
22
- it 'should return .finished' do
23
- task = create(:flyboy_task, reminder_type: "custom", reminder_date: Time.zone.now.to_date - 3.days, term: Time.zone.now.to_date - 1.day, done: true )
24
- expect(task_color(task)).to eq('finished')
25
- end
26
- end
27
- end