dorsale 3.1.6 → 3.1.7
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/app/controllers/dorsale/billing_machine/invoices_controller.rb +1 -1
- data/app/controllers/dorsale/billing_machine/quotations_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/people_controller.rb +3 -1
- data/app/controllers/dorsale/expense_gun/expenses_controller.rb +1 -1
- data/app/controllers/dorsale/flyboy/tasks_controller.rb +1 -1
- data/app/controllers/dorsale/small_data/filters_controller.rb +5 -11
- data/app/filters/dorsale/small_data/filter.rb +39 -22
- data/app/models/dorsale/address.rb +1 -1
- data/app/models/dorsale/alexandrie/attachment.rb +4 -2
- data/app/models/dorsale/alexandrie/attachment_type.rb +1 -1
- data/app/models/dorsale/application_record.rb +3 -0
- data/app/models/dorsale/billing_machine/id_card.rb +1 -1
- data/app/models/dorsale/billing_machine/invoice.rb +1 -1
- data/app/models/dorsale/billing_machine/invoice_line.rb +1 -1
- data/app/models/dorsale/billing_machine/payment_term.rb +1 -1
- data/app/models/dorsale/billing_machine/quotation.rb +1 -1
- data/app/models/dorsale/billing_machine/quotation_line.rb +1 -1
- data/app/models/dorsale/comment.rb +4 -2
- data/app/models/dorsale/customer_vault/link.rb +1 -1
- data/app/models/dorsale/customer_vault/person.rb +7 -3
- data/app/models/dorsale/expense_gun/category.rb +1 -1
- data/app/models/dorsale/expense_gun/expense.rb +1 -1
- data/app/models/dorsale/expense_gun/expense_line.rb +1 -1
- data/app/models/dorsale/flyboy/folder.rb +1 -1
- data/app/models/dorsale/flyboy/task.rb +1 -1
- data/app/models/dorsale/flyboy/task_comment.rb +1 -1
- data/features/step_definitions/flyboy_tasks_steps.rb +1 -1
- data/features/support/poltergeist.rb +1 -1
- data/lib/dorsale/version.rb +1 -1
- data/spec/controllers/dorsale/flyboy/folders_controller_spec.rb +2 -6
- data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +2 -2
- data/spec/filters/dorsale/small_data/filter_spec.rb +8 -16
- data/spec/models/dorsale/i18n_spec.rb +1 -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: 4e8255c9d6c9efa78f99a3914f3ca347456faa10
|
|
4
|
+
data.tar.gz: c4bea5ce3821ec79e4fb8ff96fce60869cb49e2e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66c316f9221bf01e9b47a8dccc5da0512b3e374c765cf11595104db3189e068df578814219bb2895fecb1b0cdebd13e28395a5161d5362c7b1887f7464340987
|
|
7
|
+
data.tar.gz: 4a5e092869742218f94c4bcbc126c63f644d41a0dbf130a7370cecddbbaa3e2c27457069ebdacab833d6f1e041190a613a6fd0d7b4a689bd2003365b46ee3626
|
data/CHANGELOG.md
CHANGED
|
@@ -12,7 +12,7 @@ class Dorsale::BillingMachine::InvoicesController < ::Dorsale::BillingMachine::A
|
|
|
12
12
|
# callback in BillingMachine::ApplicationController
|
|
13
13
|
authorize model, :list?
|
|
14
14
|
|
|
15
|
-
@invoices ||= scope.all
|
|
15
|
+
@invoices ||= scope.all.preload(:customer)
|
|
16
16
|
@filters ||= ::Dorsale::BillingMachine::SmallData::FilterForInvoices.new(cookies)
|
|
17
17
|
|
|
18
18
|
@invoices = @filters.apply(@invoices)
|
|
@@ -12,7 +12,7 @@ class Dorsale::BillingMachine::QuotationsController < ::Dorsale::BillingMachine:
|
|
|
12
12
|
# callback in BillingMachine::ApplicationController
|
|
13
13
|
authorize model, :list?
|
|
14
14
|
|
|
15
|
-
@quotations ||= scope.all
|
|
15
|
+
@quotations ||= scope.all.preload(:customer)
|
|
16
16
|
@filters ||= ::Dorsale::BillingMachine::SmallData::FilterForQuotations.new(cookies)
|
|
17
17
|
|
|
18
18
|
@quotations = @filters.apply(@quotations)
|
|
@@ -13,7 +13,9 @@ class Dorsale::CustomerVault::PeopleController < ::Dorsale::CustomerVault::Appli
|
|
|
13
13
|
|
|
14
14
|
@filters ||= ::Dorsale::CustomerVault::SmallData::FilterForPeople.new(cookies)
|
|
15
15
|
@tags ||= customer_vault_tag_list
|
|
16
|
-
@people ||= policy_scope(model)
|
|
16
|
+
@people ||= policy_scope(model)
|
|
17
|
+
.search(params[:q])
|
|
18
|
+
.preload(:taggings)
|
|
17
19
|
|
|
18
20
|
if params[:q].blank?
|
|
19
21
|
@people = @filters.apply(@people)
|
|
@@ -15,7 +15,7 @@ class Dorsale::ExpenseGun::ExpensesController < Dorsale::ExpenseGun::Application
|
|
|
15
15
|
def index
|
|
16
16
|
authorize model, :list?
|
|
17
17
|
|
|
18
|
-
@expenses ||= scope.all
|
|
18
|
+
@expenses ||= scope.all.preload(:user, :expense_lines)
|
|
19
19
|
@filters ||= Dorsale::ExpenseGun::SmallData::FilterForExpenses.new(cookies)
|
|
20
20
|
@expenses = @filters.apply(@expenses)
|
|
21
21
|
@expenses = @expenses.page(params[:page]).per(25)
|
|
@@ -13,7 +13,7 @@ class Dorsale::Flyboy::TasksController < ::Dorsale::Flyboy::ApplicationControlle
|
|
|
13
13
|
def index
|
|
14
14
|
authorize model, :list?
|
|
15
15
|
|
|
16
|
-
@tasks ||= scope.all
|
|
16
|
+
@tasks ||= scope.all.preload(:taskable)
|
|
17
17
|
|
|
18
18
|
@order ||= sortable_column_order do |column, direction|
|
|
19
19
|
case column
|
|
@@ -3,21 +3,15 @@ class Dorsale::SmallData::FiltersController < ::Dorsale::ApplicationController
|
|
|
3
3
|
skip_authorization
|
|
4
4
|
skip_policy_scope
|
|
5
5
|
|
|
6
|
-
new_filters = params.fetch(:filters, {}).permit!.to_h
|
|
7
|
-
|
|
8
|
-
new_filters.each do |key, value|
|
|
9
|
-
new_filters[key] = "" if value == "0"
|
|
10
|
-
end
|
|
11
|
-
|
|
12
6
|
filters = ::Dorsale::SmallData::Filter.new(cookies)
|
|
13
|
-
new_filters =
|
|
14
|
-
filters.
|
|
7
|
+
new_filters = params.fetch(:filters, {}).permit!.to_h
|
|
8
|
+
filters.merge new_filters
|
|
15
9
|
|
|
16
10
|
# Rewrite cookie with 1 year expiry
|
|
17
11
|
cookies[:filters] = {
|
|
18
|
-
:value
|
|
12
|
+
:value => cookies[:filters],
|
|
19
13
|
:expires => 1.year.from_now,
|
|
20
|
-
:path
|
|
14
|
+
:path => "/",
|
|
21
15
|
}
|
|
22
16
|
|
|
23
17
|
redirect_to back_url
|
|
@@ -32,7 +26,7 @@ class Dorsale::SmallData::FiltersController < ::Dorsale::ApplicationController
|
|
|
32
26
|
(main_app.root_path rescue "/"),
|
|
33
27
|
].select(&:present?).first
|
|
34
28
|
|
|
35
|
-
# Delete page
|
|
29
|
+
# Delete page param
|
|
36
30
|
base, query_string = url.split("?")
|
|
37
31
|
query_string = query_string.to_s.split("&").delete_if { |p| p.include?("page=") }.join("&")
|
|
38
32
|
query_string = "?#{query_string}" if query_string.present?
|
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
class Dorsale::SmallData::Filter
|
|
2
|
-
|
|
3
|
-
@jar = jar
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
def store(filters)
|
|
7
|
-
@jar["filters"] = filters.to_json
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def read
|
|
11
|
-
JSON.parse @jar["filters"].to_s
|
|
12
|
-
rescue JSON::ParserError
|
|
13
|
-
{}
|
|
14
|
-
end
|
|
2
|
+
STRATEGIES = {}
|
|
15
3
|
|
|
16
|
-
|
|
17
|
-
read[key.to_s]
|
|
18
|
-
end
|
|
4
|
+
attr_reader :jar
|
|
19
5
|
|
|
20
|
-
def
|
|
21
|
-
|
|
22
|
-
array[key.to_s] = value
|
|
23
|
-
store(array)
|
|
6
|
+
def initialize(jar)
|
|
7
|
+
@jar = jar
|
|
24
8
|
end
|
|
25
9
|
|
|
26
10
|
def strategies
|
|
@@ -40,12 +24,45 @@ class Dorsale::SmallData::Filter
|
|
|
40
24
|
end
|
|
41
25
|
|
|
42
26
|
def method_missing(method, *args)
|
|
43
|
-
|
|
27
|
+
if method.to_s.end_with?("=")
|
|
28
|
+
key = method.to_s[0..-2]
|
|
29
|
+
value = args.first
|
|
30
|
+
action = :write
|
|
31
|
+
else
|
|
32
|
+
key = method.to_s
|
|
33
|
+
action = :read
|
|
34
|
+
end
|
|
44
35
|
|
|
45
|
-
if strategies.key?(key)
|
|
36
|
+
if strategies.key?(key) && action == :read
|
|
46
37
|
get(key)
|
|
38
|
+
elsif strategies.key?(key) && action == :write
|
|
39
|
+
set(key, value)
|
|
47
40
|
else
|
|
48
41
|
super
|
|
49
42
|
end
|
|
50
43
|
end
|
|
44
|
+
|
|
45
|
+
def read
|
|
46
|
+
JSON.parse jar["filters"].to_s
|
|
47
|
+
rescue JSON::ParserError
|
|
48
|
+
{}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def write(filters)
|
|
52
|
+
jar["filters"] = filters.to_json
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def merge(new_filters)
|
|
56
|
+
write read.merge(new_filters)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
private
|
|
60
|
+
|
|
61
|
+
def get(key)
|
|
62
|
+
read[key.to_s]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def set(key, value)
|
|
66
|
+
merge(key.to_s => value)
|
|
67
|
+
end
|
|
51
68
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class Dorsale::Alexandrie::Attachment <
|
|
1
|
+
class Dorsale::Alexandrie::Attachment < ::Dorsale::ApplicationRecord
|
|
2
2
|
self.table_name = "dorsale_alexandrie_attachments"
|
|
3
3
|
|
|
4
4
|
belongs_to :attachable, polymorphic: true
|
|
@@ -14,7 +14,9 @@ class Dorsale::Alexandrie::Attachment < ActiveRecord::Base
|
|
|
14
14
|
before_save :set_default_name
|
|
15
15
|
|
|
16
16
|
default_scope -> {
|
|
17
|
-
|
|
17
|
+
all
|
|
18
|
+
.order(id: :desc)
|
|
19
|
+
.preload(:attachment_type)
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
def set_default_name
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class Dorsale::Comment <
|
|
1
|
+
class Dorsale::Comment < ::Dorsale::ApplicationRecord
|
|
2
2
|
belongs_to :author, polymorphic: true
|
|
3
3
|
belongs_to :commentable, polymorphic: true
|
|
4
4
|
|
|
@@ -7,6 +7,8 @@ class Dorsale::Comment < ActiveRecord::Base
|
|
|
7
7
|
validates :text, presence: true
|
|
8
8
|
|
|
9
9
|
default_scope -> {
|
|
10
|
-
|
|
10
|
+
all
|
|
11
|
+
.order(created_at: :desc)
|
|
12
|
+
.preload(:author)
|
|
11
13
|
}
|
|
12
14
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "dorsale/search"
|
|
2
2
|
|
|
3
|
-
class Dorsale::CustomerVault::Person <
|
|
3
|
+
class Dorsale::CustomerVault::Person < ::Dorsale::ApplicationRecord
|
|
4
4
|
self.table_name = "dorsale_customer_vault_people"
|
|
5
5
|
|
|
6
6
|
extend Forwardable
|
|
@@ -50,10 +50,14 @@ class Dorsale::CustomerVault::Person < ActiveRecord::Base
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def links
|
|
53
|
-
a = ::Dorsale::CustomerVault::Link
|
|
53
|
+
a = ::Dorsale::CustomerVault::Link
|
|
54
|
+
.where(alice_id: id)
|
|
55
|
+
.preload(:alice => :taggings, :bob => :taggings)
|
|
54
56
|
.each { |l| l.person = l.alice ; l.other_person = l.bob }
|
|
55
57
|
|
|
56
|
-
b = ::Dorsale::CustomerVault::Link
|
|
58
|
+
b = ::Dorsale::CustomerVault::Link
|
|
59
|
+
.where(bob_id: id)
|
|
60
|
+
.preload(:alice => :taggings, :bob => :taggings)
|
|
57
61
|
.each { |l| l.person = l.bob ; l.other_person = l.alice }
|
|
58
62
|
|
|
59
63
|
return a + b
|
|
@@ -63,7 +63,7 @@ When(/^the flyboy daily crons run$/) do
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
When(/^I create a task$/) do
|
|
66
|
-
|
|
66
|
+
find("#context-main a[href*='tasks/new']").click
|
|
67
67
|
find("form[id*=task] [type=submit]").click # First submit to see errors
|
|
68
68
|
fill_in "task_name", with: "I-am-the-task-title"
|
|
69
69
|
fill_in "task_description", with: "I-am-the-task-description"
|
data/lib/dorsale/version.rb
CHANGED
|
@@ -26,17 +26,13 @@ describe Dorsale::Flyboy::FoldersController, type: :controller do
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it 'should filter by status closed' do
|
|
29
|
-
|
|
30
|
-
.store(fb_status: "closed")
|
|
31
|
-
|
|
29
|
+
cookies["filters"] = {fb_status: "closed"}.to_json
|
|
32
30
|
get :index
|
|
33
31
|
expect(assigns(:folders)).to eq [@folder2]
|
|
34
32
|
end
|
|
35
33
|
|
|
36
34
|
it 'should filter by status open' do
|
|
37
|
-
|
|
38
|
-
.store(fb_status: "open")
|
|
39
|
-
|
|
35
|
+
cookies["filters"] = {fb_status: "open"}.to_json
|
|
40
36
|
get :index
|
|
41
37
|
expect(assigns(:folders)).to eq [@folder1]
|
|
42
38
|
end
|
|
@@ -65,13 +65,13 @@ describe Dorsale::Flyboy::TasksController, type: :controller do
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
it 'should filter by status closed' do
|
|
68
|
-
|
|
68
|
+
cookies["filters"] = {'fb_status' => "closed"}.to_json
|
|
69
69
|
get :index
|
|
70
70
|
expect(assigns(:tasks).to_a).to eq [@task1]
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
it 'should filter by status opened' do
|
|
74
|
-
|
|
74
|
+
cookies["filters"] = {'fb_status' => "opened"}.to_json
|
|
75
75
|
get :index
|
|
76
76
|
expect(assigns(:tasks).to_a).to eq [@task2]
|
|
77
77
|
end
|
|
@@ -6,16 +6,16 @@ module Dorsale
|
|
|
6
6
|
let(:filter) { {"name" => "bidule"} }
|
|
7
7
|
let(:f) { Dorsale::SmallData::Filter.new(jar) }
|
|
8
8
|
|
|
9
|
-
describe "
|
|
10
|
-
it "should
|
|
11
|
-
f.
|
|
9
|
+
describe "write" do
|
|
10
|
+
it "should write the provided hash as json in the jar" do
|
|
11
|
+
f.write(filter)
|
|
12
12
|
expect(jar["filters"]).to eq filter.to_json
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
describe "read" do
|
|
17
17
|
it "should read stored filters" do
|
|
18
|
-
f.
|
|
18
|
+
f.write(filter)
|
|
19
19
|
expect(f.read).to eq(filter)
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -29,19 +29,11 @@ module Dorsale
|
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
end
|
|
32
|
+
it "should set/get values" do
|
|
33
|
+
filter = Dorsale::CustomerVault::SmallData::FilterForPeople.new({})
|
|
34
|
+
filter.person_type = "truc"
|
|
35
|
+
expect(filter.person_type).to eq "truc"
|
|
37
36
|
end
|
|
38
37
|
|
|
39
|
-
describe "set" do
|
|
40
|
-
it "should set the value" do
|
|
41
|
-
f.store(filter)
|
|
42
|
-
f.set("new", "truc")
|
|
43
|
-
expect(f.get("new")).to eq("truc")
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
38
|
end
|
|
47
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.1.
|
|
4
|
+
version: 3.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- agilidée
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-11-
|
|
11
|
+
date: 2016-11-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -570,6 +570,7 @@ files:
|
|
|
570
570
|
- app/models/dorsale/alexandrie.rb
|
|
571
571
|
- app/models/dorsale/alexandrie/attachment.rb
|
|
572
572
|
- app/models/dorsale/alexandrie/attachment_type.rb
|
|
573
|
+
- app/models/dorsale/application_record.rb
|
|
573
574
|
- app/models/dorsale/billing_machine.rb
|
|
574
575
|
- app/models/dorsale/billing_machine/id_card.rb
|
|
575
576
|
- app/models/dorsale/billing_machine/invoice.rb
|