dorsale 3.3.0 → 3.4.0
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 +9 -0
- data/app/assets/stylesheets/dorsale/engines/flyboy.sass +0 -7
- data/app/controllers/dorsale/alexandrie/attachments_controller.rb +7 -0
- data/app/controllers/dorsale/application_controller.rb +1 -0
- data/app/controllers/dorsale/billing_machine/invoices_controller.rb +2 -0
- data/app/controllers/dorsale/billing_machine/quotations_controller.rb +2 -0
- data/app/controllers/dorsale/customer_vault/application_controller.rb +0 -4
- data/app/controllers/dorsale/customer_vault/people_controller.rb +0 -2
- data/app/controllers/dorsale/expense_gun/expenses_controller.rb +2 -2
- data/app/controllers/dorsale/flyboy/application_controller.rb +0 -3
- data/app/controllers/dorsale/flyboy/tasks_controller.rb +2 -8
- data/app/helpers/dorsale/all_helpers.rb +1 -0
- data/app/helpers/dorsale/flyboy/application_helper.rb +3 -12
- data/app/helpers/dorsale/link_helper.rb +10 -0
- data/app/helpers/dorsale/sorting_helper.rb +48 -0
- data/app/mailers/dorsale/billing_machine/invoice_mailer.rb +1 -1
- data/app/models/concerns/dorsale/model_i18n.rb +25 -0
- data/app/models/concerns/dorsale/model_to_s.rb +9 -0
- data/{lib → app/models/concerns}/dorsale/polymorphic_id.rb +1 -3
- data/app/models/concerns/dorsale/search.rb +30 -0
- data/app/models/dorsale/alexandrie/attachment.rb +7 -6
- data/app/models/dorsale/application_record.rb +6 -0
- data/app/models/dorsale/billing_machine/invoice.rb +2 -6
- data/app/models/dorsale/billing_machine/quotation.rb +4 -4
- data/app/models/dorsale/customer_vault/person.rb +0 -2
- data/app/models/dorsale/expense_gun/expense.rb +8 -8
- data/app/models/dorsale/flyboy/task.rb +5 -16
- data/app/pdfs/concerns/dorsale/alexandrie/prawn/render_with_attachments.rb +13 -0
- data/app/pdfs/dorsale/billing_machine/invoice_single_vat_pdf.rb +6 -1
- data/app/pdfs/dorsale/billing_machine/quotation_pdf_common_methods.rb +0 -18
- data/app/policies/dorsale/expense_gun/expense_policy_helper.rb +1 -1
- data/app/policies/dorsale/flyboy/task_policy_helper.rb +0 -10
- data/app/policies/dorsale/policy_checker.rb +0 -1
- data/app/services/dorsale/billing_machine/pdf_file_generator.rb +37 -0
- data/app/services/dorsale/expense_gun/expense/copy.rb +1 -1
- data/app/uploaders/dorsale/pdf_uploader.rb +5 -0
- data/app/views/dorsale/billing_machine/invoices/_details.html.slim +1 -1
- data/app/views/dorsale/billing_machine/invoices/_list.html.slim +1 -2
- data/app/views/dorsale/billing_machine/invoices/index.pdf.ruby +2 -2
- data/app/views/dorsale/billing_machine/invoices/show.pdf.ruby +1 -1
- data/app/views/dorsale/billing_machine/quotations/_list.html.slim +1 -2
- data/app/views/dorsale/billing_machine/quotations/show.pdf.ruby +1 -1
- data/app/views/dorsale/comments/_comment.html.slim +1 -1
- data/app/views/dorsale/customer_vault/links/new.html.slim +1 -1
- data/app/views/dorsale/customer_vault/people/_list_item.html.slim +1 -1
- data/app/views/dorsale/flyboy/tasks/_form.html.slim +3 -0
- data/app/views/dorsale/flyboy/tasks/_index_actions.html.slim +3 -0
- data/app/views/dorsale/flyboy/tasks/_list.html.slim +6 -12
- data/app/views/dorsale/flyboy/tasks/_summary_list.html.slim +2 -3
- data/app/views/dorsale/flyboy/tasks/_taskable_context.html.slim +1 -1
- data/app/views/dorsale/flyboy/tasks/index.xlsx.ruby +2 -4
- data/config/locales/billing_machine.en.yml +1 -0
- data/config/locales/billing_machine.fr.yml +1 -0
- data/config/locales/common.en.yml +3 -3
- data/config/locales/expense_gun.fr.yml +12 -12
- data/config/locales/flyboy.en.yml +1 -28
- data/config/locales/flyboy.fr.yml +1 -28
- data/config/routes.rb +0 -7
- data/db/migrate/20170127131537_delete_folders.rb +10 -0
- data/db/migrate/20170127151610_fix_expense_state.rb +6 -0
- data/db/migrate/20170127155636_billing_machine_add_pdf_file.rb +16 -0
- data/features/expense_gun_expenses.feature +3 -3
- data/features/flyboy_task_comments.feature +1 -1
- data/features/flyboy_tasks.feature +3 -4
- data/features/flyboy_tasks_summary.feature +0 -1
- data/features/step_definitions/billing_machine_invoices_steps.rb +1 -0
- data/features/step_definitions/expense_gun_expenses_steps.rb +2 -2
- data/features/step_definitions/flyboy_tasks_steps.rb +2 -3
- data/features/step_definitions/tasks_summary_steps.rb +3 -3
- data/lib/dorsale/active_record_comma_type_cast.rb +12 -0
- data/lib/dorsale/core_and_rails_ext.rb +3 -0
- data/lib/dorsale/engine.rb +6 -10
- data/lib/dorsale/form_back_url.rb +3 -1
- data/lib/dorsale/version.rb +1 -1
- data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +4 -1
- data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +7 -30
- data/spec/factories/flyboy_tasks.rb +0 -2
- data/spec/helpers/dorsale/flyboy/application_helper_spec.rb +0 -64
- data/spec/helpers/dorsale/sorting_helper_spec.rb +74 -0
- data/spec/libs/{active_record_comma_type_cast_spec.rb → dorsale/active_record_comma_type_cast_spec.rb} +1 -1
- data/spec/libs/dorsale/polymorphic_id_spec.rb +8 -7
- data/spec/models/{dorsale → concerns/dorsale}/model_i18n_spec.rb +0 -0
- data/spec/models/dorsale/expense_gun/expense_spec.rb +19 -19
- data/spec/models/dorsale/flyboy/task_spec.rb +2 -1
- data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +18 -13
- data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +18 -13
- data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +18 -13
- data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +25 -19
- data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +1 -1
- metadata +21 -52
- data/app/controllers/dorsale/flyboy/folders_controller.rb +0 -140
- data/app/filters/dorsale/flyboy/small_data/filter_for_folders.rb +0 -5
- data/app/filters/dorsale/flyboy/small_data/filter_strategy_by_status.rb +0 -9
- data/app/models/dorsale/flyboy/folder.rb +0 -72
- data/app/policies/dorsale/flyboy/folder_policy_helper.rb +0 -26
- data/app/views/dorsale/flyboy/folders/_context.html.slim +0 -18
- data/app/views/dorsale/flyboy/folders/_context_actions.html.slim +0 -10
- data/app/views/dorsale/flyboy/folders/_form.html.slim +0 -17
- data/app/views/dorsale/flyboy/folders/_index_actions.html.slim +0 -2
- data/app/views/dorsale/flyboy/folders/_list.html.slim +0 -41
- data/app/views/dorsale/flyboy/folders/edit.html.slim +0 -8
- data/app/views/dorsale/flyboy/folders/index.html.slim +0 -22
- data/app/views/dorsale/flyboy/folders/new.html.slim +0 -2
- data/app/views/dorsale/flyboy/folders/show.html.slim +0 -14
- data/features/flyboy_folders.feature +0 -109
- data/features/step_definitions/flyboy_folders_steps.rb +0 -170
- data/lib/active_record_comma_type_cast.rb +0 -12
- data/lib/dorsale/alexandrie/prawn.rb +0 -17
- data/lib/dorsale/model_i18n.rb +0 -30
- data/lib/dorsale/model_to_s.rb +0 -13
- data/lib/dorsale/search.rb +0 -34
- data/spec/controllers/dorsale/flyboy/folders_controller_spec.rb +0 -113
- data/spec/factories/flyboy_folders.rb +0 -7
- data/spec/models/dorsale/flyboy/folder_spec.rb +0 -103
- data/spec/routing/dorsale/flyboy/folders_routing_spec.rb +0 -44
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
require "dorsale/search"
|
|
2
|
-
require "dorsale/polymorphic_id"
|
|
3
|
-
|
|
4
|
-
class Dorsale::Flyboy::Folder < ::Dorsale::ApplicationRecord
|
|
5
|
-
self.table_name = "dorsale_flyboy_folders"
|
|
6
|
-
|
|
7
|
-
include AASM
|
|
8
|
-
include ::Dorsale::Search
|
|
9
|
-
|
|
10
|
-
paginates_per 50
|
|
11
|
-
|
|
12
|
-
aasm(column: "status", whiny_transitions: false) do
|
|
13
|
-
state :open, initial: true
|
|
14
|
-
state :closed
|
|
15
|
-
|
|
16
|
-
event :close, if: :no_undone_tasks? do
|
|
17
|
-
transitions from: [:open], to: :closed
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
event :open do
|
|
21
|
-
transitions from: [:closed], to: :open
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
belongs_to :folderable, polymorphic: true
|
|
26
|
-
has_many :tasks, dependent: :destroy, as: :taskable
|
|
27
|
-
|
|
28
|
-
validates :name, presence: true
|
|
29
|
-
validates :status, inclusion: {
|
|
30
|
-
in: proc { ::Dorsale::Flyboy::Folder.aasm.states.map(&:to_s) }
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
def assign_default_values
|
|
34
|
-
assign_default :progress, 0
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def no_undone_tasks?
|
|
38
|
-
tasks.where(done: false).count == 0
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def revision
|
|
42
|
-
"#{tracking} #{version}"
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
before_create :create_tracking
|
|
46
|
-
|
|
47
|
-
def create_tracking
|
|
48
|
-
dailycounter = self.class.where("DATE(created_at) = ?", Time.zone.now.to_date).count + 1
|
|
49
|
-
self.tracking = "#{Time.zone.now.strftime("%y%m%d")}-#{dailycounter}"
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
before_save :update_version
|
|
53
|
-
|
|
54
|
-
def update_version
|
|
55
|
-
self.version = 0 if self.version.nil?
|
|
56
|
-
self.version = self.version + 1
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def update_progress
|
|
60
|
-
if tasks.count.zero?
|
|
61
|
-
self.progress = 0
|
|
62
|
-
else
|
|
63
|
-
self.progress = tasks.sum(:progress) / tasks.count
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def update_progress!
|
|
68
|
-
update_progress
|
|
69
|
-
save
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
module Dorsale::Flyboy::FolderPolicyHelper
|
|
2
|
-
POLICY_METHODS = [
|
|
3
|
-
:list?,
|
|
4
|
-
:create?,
|
|
5
|
-
:read?,
|
|
6
|
-
:update?,
|
|
7
|
-
:delete?,
|
|
8
|
-
:open?,
|
|
9
|
-
:close?,
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
def update?
|
|
13
|
-
return false if folder.closed?
|
|
14
|
-
super
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def close?
|
|
18
|
-
return false unless folder.may_close?
|
|
19
|
-
super
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def open?
|
|
23
|
-
return false unless folder.may_open?
|
|
24
|
-
super
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
- folder = folder || taskable
|
|
2
|
-
|
|
3
|
-
.context
|
|
4
|
-
.context-header
|
|
5
|
-
= icon :tasks
|
|
6
|
-
= " "
|
|
7
|
-
= folder
|
|
8
|
-
|
|
9
|
-
.context-body
|
|
10
|
-
= info folder, :progress, progress_bar(percentage: folder.progress, label: true)
|
|
11
|
-
= info folder, :revision
|
|
12
|
-
= info folder, :status
|
|
13
|
-
|
|
14
|
-
- if request.path == dorsale.flyboy_folder_path(folder)
|
|
15
|
-
= info folder, :description, helper: :text2html
|
|
16
|
-
|
|
17
|
-
.context-footer
|
|
18
|
-
= render "dorsale/flyboy/folders/context_actions", folder: folder
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
= actions_for(folder)
|
|
2
|
-
|
|
3
|
-
- if policy(folder.tasks.new).create? && request.path == dorsale.flyboy_folder_path(folder)
|
|
4
|
-
= create_button dorsale.new_flyboy_task_path(taskable_guid: folder.guid), text: t("actions.new_task")
|
|
5
|
-
|
|
6
|
-
- if policy(folder).close?
|
|
7
|
-
= lock_button dorsale.close_flyboy_folder_path(folder), text: t("actions.close")
|
|
8
|
-
|
|
9
|
-
- if policy(folder).open?
|
|
10
|
-
= unlock_button dorsale.open_flyboy_folder_path(folder), text: t("actions.open")
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
.panel.panel-default
|
|
2
|
-
.panel-heading: .panel-title
|
|
3
|
-
= icon :tasks
|
|
4
|
-
= " "
|
|
5
|
-
- if @folder.persisted?
|
|
6
|
-
= t("actions.update")
|
|
7
|
-
= " : "
|
|
8
|
-
= @folder
|
|
9
|
-
- else
|
|
10
|
-
= t('messages.folders.title_create')
|
|
11
|
-
|
|
12
|
-
.panel-body
|
|
13
|
-
= horizontal_form_for @folder, as: :folder do |f|
|
|
14
|
-
= f.input :name
|
|
15
|
-
= f.input :description
|
|
16
|
-
|
|
17
|
-
= form_buttons
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
table#folders-list
|
|
2
|
-
thead
|
|
3
|
-
tr
|
|
4
|
-
th.folder-status
|
|
5
|
-
= sortable_column Dorsale::Flyboy::Folder.t(:status), column: "status"
|
|
6
|
-
|
|
7
|
-
th.folder-progress.hidden-xs.hidden-xs
|
|
8
|
-
= sortable_column Dorsale::Flyboy::Folder.t(:progress), column: "progress"
|
|
9
|
-
|
|
10
|
-
th.folder-name
|
|
11
|
-
= sortable_column Dorsale::Flyboy::Folder.t, column: "name"
|
|
12
|
-
|
|
13
|
-
th.actions
|
|
14
|
-
= t("actions.actions")
|
|
15
|
-
|
|
16
|
-
tbody
|
|
17
|
-
- folders.each do |folder|
|
|
18
|
-
tr.folder class=folder_color(folder)
|
|
19
|
-
td.folder-status
|
|
20
|
-
- if folder.status.to_s == "open"
|
|
21
|
-
= icon(:unlock)
|
|
22
|
-
- elsif folder.status.to_s == "closed"
|
|
23
|
-
= icon(:lock)
|
|
24
|
-
- else
|
|
25
|
-
= icon(:question)
|
|
26
|
-
|
|
27
|
-
= " "
|
|
28
|
-
= folder.t("status.#{folder.status}")
|
|
29
|
-
|
|
30
|
-
td.folder-progress.hidden-xs
|
|
31
|
-
= progress_bar percentage: folder.progress, label: true
|
|
32
|
-
|
|
33
|
-
td.folder-name
|
|
34
|
-
- if policy(folder).read?
|
|
35
|
-
= link_to folder, dorsale.flyboy_folder_path(folder)
|
|
36
|
-
- else
|
|
37
|
-
= folder
|
|
38
|
-
|
|
39
|
-
td.actions
|
|
40
|
-
- if policy(Dorsale::Flyboy::Task.new(taskable: folder)).create?
|
|
41
|
-
= create_button dorsale.new_flyboy_task_path(taskable_guid: folder.guid), text: t("actions.new_task")
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.flyboy
|
|
2
|
-
- content_for :title
|
|
3
|
-
= icon(:tasks)
|
|
4
|
-
= " "
|
|
5
|
-
= ::Dorsale::Flyboy::Folder.ts
|
|
6
|
-
|
|
7
|
-
- content_for :filters
|
|
8
|
-
= render "dorsale/flyboy/filters"
|
|
9
|
-
|
|
10
|
-
- content_for :search
|
|
11
|
-
= search_form
|
|
12
|
-
|
|
13
|
-
- content_for :actions
|
|
14
|
-
= render "dorsale/flyboy/folders/index_actions"
|
|
15
|
-
|
|
16
|
-
- content_for :table
|
|
17
|
-
= render "dorsale/flyboy/folders/list", folders: @folders
|
|
18
|
-
|
|
19
|
-
- content_for :pagination
|
|
20
|
-
= paginate @folders
|
|
21
|
-
|
|
22
|
-
= render_dorsale_page
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
.flyboy
|
|
2
|
-
- content_for :title
|
|
3
|
-
= icon :check_square_o
|
|
4
|
-
= " "
|
|
5
|
-
= ::Dorsale::Flyboy::Task.ts
|
|
6
|
-
|
|
7
|
-
- content_for :context
|
|
8
|
-
= render "dorsale/flyboy/folders/context", folder: @folder
|
|
9
|
-
|
|
10
|
-
- content_for :page_body
|
|
11
|
-
.tasks
|
|
12
|
-
= tasks_for @folder
|
|
13
|
-
|
|
14
|
-
= render_dorsale_page
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
@javascript
|
|
2
|
-
Feature: Manage folders
|
|
3
|
-
Background:
|
|
4
|
-
Given an authenticated user
|
|
5
|
-
|
|
6
|
-
Scenario: Create a folder
|
|
7
|
-
When I go to the folders section
|
|
8
|
-
And I create a new folder
|
|
9
|
-
Then I am on the created folder
|
|
10
|
-
And the folder is created
|
|
11
|
-
And the folder is opened
|
|
12
|
-
|
|
13
|
-
Scenario: Read a folder
|
|
14
|
-
Given an existing folder
|
|
15
|
-
And 3 tasks in this folder
|
|
16
|
-
When I consult this folder
|
|
17
|
-
Then I see this folder
|
|
18
|
-
And I see the folder tasks
|
|
19
|
-
|
|
20
|
-
Scenario: Update a folder
|
|
21
|
-
Given an existing folder
|
|
22
|
-
When I go to the folders section
|
|
23
|
-
And I update this folder
|
|
24
|
-
Then I am on the updated folder
|
|
25
|
-
And the folder is updated
|
|
26
|
-
|
|
27
|
-
Scenario: Delete a folder
|
|
28
|
-
Given an existing folder
|
|
29
|
-
When I go to the folders section
|
|
30
|
-
And I delete this folder
|
|
31
|
-
Then I am on the folders section
|
|
32
|
-
And the folder is deleted
|
|
33
|
-
|
|
34
|
-
Scenario: Close a folder
|
|
35
|
-
Given an existing folder
|
|
36
|
-
When I close this folder
|
|
37
|
-
Then I am on the folders section
|
|
38
|
-
And the folder is closed
|
|
39
|
-
|
|
40
|
-
Scenario: Reopen a folder
|
|
41
|
-
Given an existing closed folder
|
|
42
|
-
When I reopen this folder
|
|
43
|
-
Then I am on this folder
|
|
44
|
-
And the folder is opened
|
|
45
|
-
|
|
46
|
-
Scenario: Filter folders
|
|
47
|
-
Given an existing open folder
|
|
48
|
-
And an existing closed folder
|
|
49
|
-
When I go to the folders section
|
|
50
|
-
And I filter folders by open
|
|
51
|
-
Then only open folders appear
|
|
52
|
-
When I filter folders by closed
|
|
53
|
-
Then only closed folders appear
|
|
54
|
-
When I reset filters
|
|
55
|
-
Then all folders appear
|
|
56
|
-
|
|
57
|
-
Scenario: Search folders
|
|
58
|
-
Given an existing folder named "Hello"
|
|
59
|
-
And an existing folder named "World"
|
|
60
|
-
When I go to the folders section
|
|
61
|
-
And I search "Hello"
|
|
62
|
-
Then only the "Hello" folder appear
|
|
63
|
-
|
|
64
|
-
Scenario: Folders pagination
|
|
65
|
-
Given 100 existing folders
|
|
66
|
-
When I go to the folders section
|
|
67
|
-
Then folders are paginated
|
|
68
|
-
|
|
69
|
-
Scenario: Filter by name asc
|
|
70
|
-
Given an existing folder
|
|
71
|
-
Given 3 tasks to sort in this folder
|
|
72
|
-
When I consult this folder
|
|
73
|
-
And I sort tasks by "name" "asc"
|
|
74
|
-
Then tasks are sorted by "name" "asc"
|
|
75
|
-
|
|
76
|
-
Scenario: Filter by name desc
|
|
77
|
-
Given an existing folder
|
|
78
|
-
Given 3 tasks to sort in this folder
|
|
79
|
-
When I consult this folder
|
|
80
|
-
And I sort tasks by "name" "desc"
|
|
81
|
-
Then tasks are sorted by "name" "desc"
|
|
82
|
-
|
|
83
|
-
Scenario: Filter by progress asc
|
|
84
|
-
Given an existing folder
|
|
85
|
-
Given 3 tasks to sort in this folder
|
|
86
|
-
When I consult this folder
|
|
87
|
-
And I sort tasks by "progress" "asc"
|
|
88
|
-
Then tasks are sorted by "progress" "asc"
|
|
89
|
-
|
|
90
|
-
Scenario: Filter by progress desc
|
|
91
|
-
Given an existing folder
|
|
92
|
-
Given 3 tasks to sort in this folder
|
|
93
|
-
When I consult this folder
|
|
94
|
-
And I sort tasks by "progress" "desc"
|
|
95
|
-
Then tasks are sorted by "progress" "desc"
|
|
96
|
-
|
|
97
|
-
Scenario: Filter by term asc
|
|
98
|
-
Given an existing folder
|
|
99
|
-
Given 3 tasks to sort in this folder
|
|
100
|
-
When I consult this folder
|
|
101
|
-
And I sort tasks by "term" "asc"
|
|
102
|
-
Then tasks are sorted by "term" "asc"
|
|
103
|
-
|
|
104
|
-
Scenario: Filter by term desc
|
|
105
|
-
Given an existing folder
|
|
106
|
-
Given 3 tasks to sort in this folder
|
|
107
|
-
When I consult this folder
|
|
108
|
-
And I sort tasks by "term" "desc"
|
|
109
|
-
Then tasks are sorted by "term" "desc"
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
When(/^I go to the folders section$/) do
|
|
2
|
-
visit dorsale.flyboy_folders_path
|
|
3
|
-
end
|
|
4
|
-
|
|
5
|
-
When(/^I create a new folder$/) do
|
|
6
|
-
find("a[href$='folders/new']").click
|
|
7
|
-
fill_in "folder_name", with: "I-am-the-folder-title"
|
|
8
|
-
fill_in "folder_description", with: "I-am-the-folder-description"
|
|
9
|
-
find("form[id*=folder] [type=submit]").click
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
Then(/^I am on this folder$/) do
|
|
13
|
-
expect(current_path).to eq dorsale.flyboy_folder_path(@folder)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
Then(/^I am on the created folder$/) do
|
|
17
|
-
@folder = Dorsale::Flyboy::Folder.last_created
|
|
18
|
-
expect(current_path).to eq dorsale.flyboy_folder_path(@folder)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
Then(/^the folder is created$/) do
|
|
22
|
-
expect(page).to have_content "I-am-the-folder-title"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
Then(/^the folder is opened$/) do
|
|
26
|
-
expect(page).to have_content "Ouvert"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
Given(/^an existing folder$/) do
|
|
30
|
-
@folder = create(:flyboy_folder)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
Given(/^(\d+) tasks in this folder$/) do |n|
|
|
34
|
-
n.to_i.times do
|
|
35
|
-
create(:flyboy_task, taskable: @folder)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
When(/^I consult this folder$/) do
|
|
40
|
-
visit dorsale.flyboy_folders_path
|
|
41
|
-
click_link @folder.name
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
Then(/^I see this folder$/) do
|
|
45
|
-
expect(current_path).to eq dorsale.flyboy_folder_path(@folder)
|
|
46
|
-
expect(page).to have_content @folder.name
|
|
47
|
-
expect(page).to have_content @folder.description
|
|
48
|
-
expect(page).to have_content @folder.tracking
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
Then(/^I see the folder tasks$/) do
|
|
52
|
-
@folder.tasks.map do |task|
|
|
53
|
-
expect(page).to have_content task.name
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
When(/^I update this folder$/) do
|
|
58
|
-
click_link @folder.name
|
|
59
|
-
find("a[href$='folders/#{@folder.id}/edit']").click
|
|
60
|
-
fill_in "folder_name", with: "New-folder-title"
|
|
61
|
-
find("form[id*=folder] [type=submit]").click
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
Then(/^I am on the updated folder$/) do
|
|
65
|
-
expect(current_path).to eq dorsale.flyboy_folder_path(@folder)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
Then(/^the folder is updated$/) do
|
|
69
|
-
expect(page).to have_content "New-folder-title"
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
When(/^I delete this folder$/) do
|
|
73
|
-
click_link @folder.name
|
|
74
|
-
find("a[href$='folders/#{@folder.id}/edit']").click
|
|
75
|
-
find(".context a[data-method=delete]").click
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
Then(/^I am on the folders section$/) do
|
|
79
|
-
expect(current_path).to eq dorsale.flyboy_folders_path
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
Then(/^the folder is deleted$/) do
|
|
83
|
-
expect(page).to have_no_content @folder.name
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
When(/^I close this folder$/) do
|
|
87
|
-
visit dorsale.flyboy_folder_path(@folder)
|
|
88
|
-
find("a[href$='folders/#{@folder.id}/close']").click
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
Then(/^the folder is closed$/) do
|
|
92
|
-
expect(page).to have_content "Fermé"
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
Given(/^an existing closed folder$/) do
|
|
96
|
-
@closed_folder = create(:flyboy_folder, status: "closed")
|
|
97
|
-
@folder = @closed_folder
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
When(/^I reopen this folder$/) do
|
|
101
|
-
visit dorsale.flyboy_folder_path(@folder)
|
|
102
|
-
find("a[href$='folders/#{@folder.id}/open']").click
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
Given(/^an existing open folder$/) do
|
|
106
|
-
@open_folder = create(:flyboy_folder, status: "open")
|
|
107
|
-
@folder = @open_folder
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
When(/^I filter folders by open$/) do
|
|
111
|
-
select "Ouvert"
|
|
112
|
-
find(".filters [type=submit]:last-child").click
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
Then(/^only open folders appear$/) do
|
|
116
|
-
expect(page).to have_content @open_folder.name
|
|
117
|
-
expect(page).to have_no_content @closed_folder.name
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
When(/^I filter folders by closed$/) do
|
|
121
|
-
select Dorsale::Flyboy::Folder.t("status.closed")
|
|
122
|
-
find(".filters [type=submit]:last-child").click
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
Then(/^only closed folders appear$/) do
|
|
126
|
-
expect(page).to have_content @closed_folder.name
|
|
127
|
-
expect(page).to have_no_content @open_folder.name
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
Then(/^all folders appear$/) do
|
|
131
|
-
expect(page).to have_content @open_folder.name
|
|
132
|
-
expect(page).to have_content @closed_folder.name
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
Given(/^an existing folder named "(.*?)"$/) do |name|
|
|
136
|
-
create(:flyboy_folder, name: name)
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
Then(/^only the "Hello" folder appear$/) do
|
|
140
|
-
expect(page).to have_content "Hello"
|
|
141
|
-
expect(page).to have_no_content "World"
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
Given(/^(\d+) existing folders$/) do |n|
|
|
145
|
-
n.to_i.times do
|
|
146
|
-
create(:flyboy_folder)
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
Then(/^folders are paginated$/) do
|
|
151
|
-
expect(all("tr.folder").count).to eq 50
|
|
152
|
-
expect(page).to have_selector ".pagination"
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
Given(/^(\d+) tasks to sort in this folder$/) do |n|
|
|
156
|
-
n.to_i.times do
|
|
157
|
-
create(:flyboy_task, taskable: @folder)
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
When(/^I sort tasks by "(.*?)" "(.*?)"$/) do |column, direction|
|
|
162
|
-
sort = direction == "desc" ? "-#{column}" : "#{column}"
|
|
163
|
-
visit dorsale.flyboy_folder_path(@folder, sort: sort)
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
Then(/^tasks are sorted by "(.*?)" "(.*?)"$/) do |column, direction|
|
|
167
|
-
page_names = all("tbody td.task-name").map(&:text)
|
|
168
|
-
expected_name = @folder.tasks.reorder(column => direction).pluck(:name)
|
|
169
|
-
expect(page_names).to eq expected_name
|
|
170
|
-
end
|