dorsale 3.9.5 → 3.9.6

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: d8986b4eafbaa82abc408062fef4e7c1ea58f956
4
- data.tar.gz: 7152f22921f77b3b0c58ec95a71e226153031b10
3
+ metadata.gz: c35bf78225914a8dfc322164de561790f97b6e49
4
+ data.tar.gz: 9fd0de39cdcbb701862e92777891924ad6669123
5
5
  SHA512:
6
- metadata.gz: 4239cdcf922244c447eb8eeb6d0637d0d294f1d856d3a919a1090627685b973ecb1c037efa5d83bd668e731a424482f4b519f0651463441bb0c88450f7e8bfe1
7
- data.tar.gz: 4ee06443366cfc89a1390824fa1352554d15e25f65f2290c9de14a7cfb5c2544c2fef87c56d94bc7d693ae25dc2fc47a651c2e6f3d7a9e4ad41316f8c4ffd3c9
6
+ metadata.gz: 84dd08892c8727c90daa2b55f452b334a75e78a3e434dc2cc955fb3055efd83485850a4dc0908b463fa51b2ec2c8a277308db8a489c6bc2002c562f82819e1f9
7
+ data.tar.gz: ae773eb9c50e3a42460e7c59a0298e6f5db3ab515fc3c7ae1a7eda3e7ff5148f5009631a6e2cb8c2aa564240357cd77759f0337891e2a9b16179124083c23752
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## 3.9.6
6
+
7
+ - Tasks : add :on_warning_or_alert scope/filter
8
+ - Tasks : fix redirect after create comment
9
+
5
10
  ## 3.9.5
6
11
 
7
12
  - Fix BillingMachine preview JS
@@ -18,7 +18,14 @@ class Dorsale::Flyboy::TaskCommentsController < ::Dorsale::Flyboy::ApplicationCo
18
18
  private
19
19
 
20
20
  def back_url
21
- request.referer.presence || url_for(@task)
21
+ task_path = flyboy_task_path(@task)
22
+ back_url = super
23
+
24
+ if back_url.to_s.start_with?(task_path)
25
+ back_url
26
+ else
27
+ task_path
28
+ end
22
29
  end
23
30
 
24
31
  def model
@@ -1,7 +1,9 @@
1
1
  class Dorsale::Flyboy::SmallData::FilterStrategyByTaskState < ::Agilibox::SmallData::FilterStrategy
2
+ STATES = Dorsale::Flyboy::Task::STATES + %w(on_warning_or_alert)
3
+
2
4
  def apply(query, value)
3
- if value.in?(Dorsale::Flyboy::Task::STATES)
4
- query.send(value)
5
+ if value.in?(STATES)
6
+ query.public_send(value)
5
7
  else
6
8
  query
7
9
  end
@@ -26,7 +26,7 @@ module Dorsale::Flyboy::ApplicationHelper
26
26
  end
27
27
 
28
28
  def flyboy_status_for_filters_select
29
- Dorsale::Flyboy::Task::STATES.map do |state|
29
+ Dorsale::Flyboy::SmallData::FilterStrategyByTaskState::STATES.map do |state|
30
30
  [Dorsale::Flyboy::Task.t("state.#{state}"), state]
31
31
  end
32
32
  end
@@ -48,6 +48,10 @@ class Dorsale::Flyboy::Task < ::Dorsale::ApplicationRecord
48
48
  .where("#{table_name}.term <= ?", Date.current)
49
49
  }
50
50
 
51
+ scope :on_warning_or_alert, -> {
52
+ undone.where("#{table_name}.reminder_date <= :d OR #{table_name}.term <= :d", d: Date.current)
53
+ }
54
+
51
55
  scope :delayed, -> { where(done: false).where("#{table_name}.term < ?", Date.current) }
52
56
  scope :today, -> { where(done: false).where("#{table_name}.term = ?", Date.current) }
53
57
  scope :tomorrow, -> { where(done: false).where("#{table_name}.term = ?", Date.tomorrow) }
@@ -60,6 +60,7 @@ en:
60
60
  ontime: "On time"
61
61
  onwarning: "Reminder outdated"
62
62
  onalert: "Term outdated"
63
+ on_warning_or_alert: "Reminder or term outdated"
63
64
 
64
65
  dorsale/flyboy/task_comment:
65
66
  progress: "Progress"
@@ -62,6 +62,7 @@ fr:
62
62
  ontime: "À temps"
63
63
  onwarning: "Rappel dépassé"
64
64
  onalert: "Échéance dépassée"
65
+ on_warning_or_alert: "Rappel ou échéance dépassé"
65
66
 
66
67
  dorsale/flyboy/task_comment:
67
68
  progress: "Progression"
@@ -1,3 +1,3 @@
1
1
  module Dorsale
2
- VERSION = "3.9.5"
2
+ VERSION = "3.9.6"
3
3
  end
@@ -18,13 +18,21 @@ describe Dorsale::Flyboy::TaskCommentsController, type: :controller do
18
18
  expect(assigns(:task_comment).persisted?).to be true
19
19
  end
20
20
 
21
- it "should redirect to referrer" do
22
- request.env["HTTP_REFERER"] = "/abc"
21
+ it "should redirect to referrer if referrer is task" do
22
+ url = flyboy_task_path(task) + "?sort=xxx"
23
+ request.env["HTTP_REFERER"] = url
23
24
  post :create, params: valid_params
24
- expect(response).to redirect_to "/abc"
25
+ expect(response).to redirect_to url
25
26
  end
26
27
 
27
- it "should redirect to task" do
28
+ it "should redirect to task if referrer is not task" do
29
+ url = "/anywhere"
30
+ request.env["HTTP_REFERER"] = url
31
+ post :create, params: valid_params
32
+ expect(response).to redirect_to flyboy_task_path(task)
33
+ end
34
+
35
+ it "should redirect to task if referrer is missing" do
28
36
  post :create, params: valid_params
29
37
  expect(response).to redirect_to flyboy_task_path(task)
30
38
  end
@@ -219,6 +219,10 @@ describe Dorsale::Flyboy::Task do
219
219
  )
220
220
  }
221
221
 
222
+ it "should return on_warning_or_alert" do
223
+ expect(described_class.on_warning_or_alert).to contain_exactly(task_onwarning, task_onalert)
224
+ end
225
+
222
226
  it "should return :done" do
223
227
  expect(task_done.state).to eq "done"
224
228
  expect(described_class.done).to eq [task_done]
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.9.5
4
+ version: 3.9.6
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-12-29 00:00:00.000000000 Z
11
+ date: 2018-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails