dorsale 3.3.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/app/assets/stylesheets/dorsale/engines/flyboy.sass +0 -7
  4. data/app/controllers/dorsale/alexandrie/attachments_controller.rb +7 -0
  5. data/app/controllers/dorsale/application_controller.rb +1 -0
  6. data/app/controllers/dorsale/billing_machine/invoices_controller.rb +2 -0
  7. data/app/controllers/dorsale/billing_machine/quotations_controller.rb +2 -0
  8. data/app/controllers/dorsale/customer_vault/application_controller.rb +0 -4
  9. data/app/controllers/dorsale/customer_vault/people_controller.rb +0 -2
  10. data/app/controllers/dorsale/expense_gun/expenses_controller.rb +2 -2
  11. data/app/controllers/dorsale/flyboy/application_controller.rb +0 -3
  12. data/app/controllers/dorsale/flyboy/tasks_controller.rb +2 -8
  13. data/app/helpers/dorsale/all_helpers.rb +1 -0
  14. data/app/helpers/dorsale/flyboy/application_helper.rb +3 -12
  15. data/app/helpers/dorsale/link_helper.rb +10 -0
  16. data/app/helpers/dorsale/sorting_helper.rb +48 -0
  17. data/app/mailers/dorsale/billing_machine/invoice_mailer.rb +1 -1
  18. data/app/models/concerns/dorsale/model_i18n.rb +25 -0
  19. data/app/models/concerns/dorsale/model_to_s.rb +9 -0
  20. data/{lib → app/models/concerns}/dorsale/polymorphic_id.rb +1 -3
  21. data/app/models/concerns/dorsale/search.rb +30 -0
  22. data/app/models/dorsale/alexandrie/attachment.rb +7 -6
  23. data/app/models/dorsale/application_record.rb +6 -0
  24. data/app/models/dorsale/billing_machine/invoice.rb +2 -6
  25. data/app/models/dorsale/billing_machine/quotation.rb +4 -4
  26. data/app/models/dorsale/customer_vault/person.rb +0 -2
  27. data/app/models/dorsale/expense_gun/expense.rb +8 -8
  28. data/app/models/dorsale/flyboy/task.rb +5 -16
  29. data/app/pdfs/concerns/dorsale/alexandrie/prawn/render_with_attachments.rb +13 -0
  30. data/app/pdfs/dorsale/billing_machine/invoice_single_vat_pdf.rb +6 -1
  31. data/app/pdfs/dorsale/billing_machine/quotation_pdf_common_methods.rb +0 -18
  32. data/app/policies/dorsale/expense_gun/expense_policy_helper.rb +1 -1
  33. data/app/policies/dorsale/flyboy/task_policy_helper.rb +0 -10
  34. data/app/policies/dorsale/policy_checker.rb +0 -1
  35. data/app/services/dorsale/billing_machine/pdf_file_generator.rb +37 -0
  36. data/app/services/dorsale/expense_gun/expense/copy.rb +1 -1
  37. data/app/uploaders/dorsale/pdf_uploader.rb +5 -0
  38. data/app/views/dorsale/billing_machine/invoices/_details.html.slim +1 -1
  39. data/app/views/dorsale/billing_machine/invoices/_list.html.slim +1 -2
  40. data/app/views/dorsale/billing_machine/invoices/index.pdf.ruby +2 -2
  41. data/app/views/dorsale/billing_machine/invoices/show.pdf.ruby +1 -1
  42. data/app/views/dorsale/billing_machine/quotations/_list.html.slim +1 -2
  43. data/app/views/dorsale/billing_machine/quotations/show.pdf.ruby +1 -1
  44. data/app/views/dorsale/comments/_comment.html.slim +1 -1
  45. data/app/views/dorsale/customer_vault/links/new.html.slim +1 -1
  46. data/app/views/dorsale/customer_vault/people/_list_item.html.slim +1 -1
  47. data/app/views/dorsale/flyboy/tasks/_form.html.slim +3 -0
  48. data/app/views/dorsale/flyboy/tasks/_index_actions.html.slim +3 -0
  49. data/app/views/dorsale/flyboy/tasks/_list.html.slim +6 -12
  50. data/app/views/dorsale/flyboy/tasks/_summary_list.html.slim +2 -3
  51. data/app/views/dorsale/flyboy/tasks/_taskable_context.html.slim +1 -1
  52. data/app/views/dorsale/flyboy/tasks/index.xlsx.ruby +2 -4
  53. data/config/locales/billing_machine.en.yml +1 -0
  54. data/config/locales/billing_machine.fr.yml +1 -0
  55. data/config/locales/common.en.yml +3 -3
  56. data/config/locales/expense_gun.fr.yml +12 -12
  57. data/config/locales/flyboy.en.yml +1 -28
  58. data/config/locales/flyboy.fr.yml +1 -28
  59. data/config/routes.rb +0 -7
  60. data/db/migrate/20170127131537_delete_folders.rb +10 -0
  61. data/db/migrate/20170127151610_fix_expense_state.rb +6 -0
  62. data/db/migrate/20170127155636_billing_machine_add_pdf_file.rb +16 -0
  63. data/features/expense_gun_expenses.feature +3 -3
  64. data/features/flyboy_task_comments.feature +1 -1
  65. data/features/flyboy_tasks.feature +3 -4
  66. data/features/flyboy_tasks_summary.feature +0 -1
  67. data/features/step_definitions/billing_machine_invoices_steps.rb +1 -0
  68. data/features/step_definitions/expense_gun_expenses_steps.rb +2 -2
  69. data/features/step_definitions/flyboy_tasks_steps.rb +2 -3
  70. data/features/step_definitions/tasks_summary_steps.rb +3 -3
  71. data/lib/dorsale/active_record_comma_type_cast.rb +12 -0
  72. data/lib/dorsale/core_and_rails_ext.rb +3 -0
  73. data/lib/dorsale/engine.rb +6 -10
  74. data/lib/dorsale/form_back_url.rb +3 -1
  75. data/lib/dorsale/version.rb +1 -1
  76. data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +4 -1
  77. data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +7 -30
  78. data/spec/factories/flyboy_tasks.rb +0 -2
  79. data/spec/helpers/dorsale/flyboy/application_helper_spec.rb +0 -64
  80. data/spec/helpers/dorsale/sorting_helper_spec.rb +74 -0
  81. data/spec/libs/{active_record_comma_type_cast_spec.rb → dorsale/active_record_comma_type_cast_spec.rb} +1 -1
  82. data/spec/libs/dorsale/polymorphic_id_spec.rb +8 -7
  83. data/spec/models/{dorsale → concerns/dorsale}/model_i18n_spec.rb +0 -0
  84. data/spec/models/dorsale/expense_gun/expense_spec.rb +19 -19
  85. data/spec/models/dorsale/flyboy/task_spec.rb +2 -1
  86. data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +18 -13
  87. data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +18 -13
  88. data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +18 -13
  89. data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +25 -19
  90. data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +1 -1
  91. metadata +21 -52
  92. data/app/controllers/dorsale/flyboy/folders_controller.rb +0 -140
  93. data/app/filters/dorsale/flyboy/small_data/filter_for_folders.rb +0 -5
  94. data/app/filters/dorsale/flyboy/small_data/filter_strategy_by_status.rb +0 -9
  95. data/app/models/dorsale/flyboy/folder.rb +0 -72
  96. data/app/policies/dorsale/flyboy/folder_policy_helper.rb +0 -26
  97. data/app/views/dorsale/flyboy/folders/_context.html.slim +0 -18
  98. data/app/views/dorsale/flyboy/folders/_context_actions.html.slim +0 -10
  99. data/app/views/dorsale/flyboy/folders/_form.html.slim +0 -17
  100. data/app/views/dorsale/flyboy/folders/_index_actions.html.slim +0 -2
  101. data/app/views/dorsale/flyboy/folders/_list.html.slim +0 -41
  102. data/app/views/dorsale/flyboy/folders/edit.html.slim +0 -8
  103. data/app/views/dorsale/flyboy/folders/index.html.slim +0 -22
  104. data/app/views/dorsale/flyboy/folders/new.html.slim +0 -2
  105. data/app/views/dorsale/flyboy/folders/show.html.slim +0 -14
  106. data/features/flyboy_folders.feature +0 -109
  107. data/features/step_definitions/flyboy_folders_steps.rb +0 -170
  108. data/lib/active_record_comma_type_cast.rb +0 -12
  109. data/lib/dorsale/alexandrie/prawn.rb +0 -17
  110. data/lib/dorsale/model_i18n.rb +0 -30
  111. data/lib/dorsale/model_to_s.rb +0 -13
  112. data/lib/dorsale/search.rb +0 -34
  113. data/spec/controllers/dorsale/flyboy/folders_controller_spec.rb +0 -113
  114. data/spec/factories/flyboy_folders.rb +0 -7
  115. data/spec/models/dorsale/flyboy/folder_spec.rb +0 -103
  116. data/spec/routing/dorsale/flyboy/folders_routing_spec.rb +0 -44
@@ -20,6 +20,8 @@ class Dorsale::BillingMachine::Quotation < ::Dorsale::ApplicationRecord
20
20
 
21
21
  polymorphic_id_for :customer
22
22
 
23
+ mount_uploader :pdf_file, ::Dorsale::PdfUploader
24
+
23
25
  validates :id_card, presence: true
24
26
  validates :date, presence: true
25
27
  validates :state, presence: true, inclusion: {in: proc { STATES } }
@@ -117,9 +119,7 @@ class Dorsale::BillingMachine::Quotation < ::Dorsale::ApplicationRecord
117
119
  end
118
120
  end
119
121
 
120
- def to_pdf
121
- ::Dorsale::BillingMachine.quotation_pdf_model.new(self)
122
- .tap(&:build)
123
- .render_with_attachments
122
+ def after_attachments_changes
123
+ Dorsale::BillingMachine::PdfFileGenerator.(self)
124
124
  end
125
125
  end
@@ -1,5 +1,3 @@
1
- require "dorsale/search"
2
-
3
1
  class Dorsale::CustomerVault::Person < ::Dorsale::ApplicationRecord
4
2
  self.table_name = "dorsale_customer_vault_people"
5
3
 
@@ -47,31 +47,31 @@ class Dorsale::ExpenseGun::Expense < ::Dorsale::ApplicationRecord
47
47
  end
48
48
 
49
49
  aasm(column: :state, whiny_transitions: false) do
50
- state :new, initial: true
51
- state :submited
50
+ state :draft, initial: true
51
+ state :submitted
52
52
  state :accepted
53
53
  state :refused
54
54
  state :canceled
55
55
 
56
- event :go_to_submited do
57
- transitions from: :new, to: :submited
56
+ event :go_to_submitted do
57
+ transitions from: :draft, to: :submitted
58
58
  end
59
59
 
60
60
  event :go_to_accepted do
61
- transitions from: :submited, to: :accepted
61
+ transitions from: :submitted, to: :accepted
62
62
  end
63
63
 
64
64
  event :go_to_refused do
65
- transitions from: :submited, to: :refused
65
+ transitions from: :submitted, to: :refused
66
66
  end
67
67
 
68
68
  event :go_to_canceled do
69
- transitions from: [:new, :submited, :accepted], to: :canceled
69
+ transitions from: [:draft, :submitted, :accepted], to: :canceled
70
70
  end
71
71
  end
72
72
 
73
73
  def may_edit?
74
- current_state == :new
74
+ current_state == :draft
75
75
  end
76
76
 
77
77
  end
@@ -1,6 +1,3 @@
1
- require "dorsale/search"
2
- require "dorsale/polymorphic_id"
3
-
4
1
  class Dorsale::Flyboy::Task < ::Dorsale::ApplicationRecord
5
2
  self.table_name = "dorsale_flyboy_tasks"
6
3
 
@@ -8,15 +5,16 @@ class Dorsale::Flyboy::Task < ::Dorsale::ApplicationRecord
8
5
 
9
6
  paginates_per 50
10
7
 
11
- belongs_to :taskable, polymorphic: true
8
+ belongs_to :taskable, polymorphic: true, required: false
12
9
  belongs_to :owner, polymorphic: true
13
10
  has_many :comments, class_name: ::Dorsale::Flyboy::TaskComment, inverse_of: :task, dependent: :destroy
11
+
14
12
  polymorphic_id_for :taskable
15
13
  polymorphic_id_for :owner
16
14
 
17
- scope :delayed, -> { where(done: false).where("term < ?", Time.zone.now.to_date) }
18
- scope :today, -> { where(done: false).where("term = ?", Time.zone.now.to_date) }
19
- scope :tomorrow, -> { where(done: false).where("term = ?", Date.tomorrow) }
15
+ scope :delayed, -> { where(done: false).where("term < ?", Time.zone.now.to_date) }
16
+ scope :today, -> { where(done: false).where("term = ?", Time.zone.now.to_date) }
17
+ scope :tomorrow, -> { where(done: false).where("term = ?", Date.tomorrow) }
20
18
 
21
19
  scope :this_week, -> {
22
20
  min = Date.tomorrow
@@ -37,7 +35,6 @@ class Dorsale::Flyboy::Task < ::Dorsale::ApplicationRecord
37
35
  }
38
36
 
39
37
 
40
- validates :taskable, presence: true
41
38
  validates :name, presence: true
42
39
  validates :term, presence: true
43
40
  validates :reminder, presence: true
@@ -46,7 +43,6 @@ class Dorsale::Flyboy::Task < ::Dorsale::ApplicationRecord
46
43
 
47
44
  def validates_reminder_and_term
48
45
  if reminder && term && reminder > term
49
- # errors.add(:reminder, "La date de relance doit être antérieure ou égale à la date d'échéance")
50
46
  errors.add(:reminder, :less_than, count: term)
51
47
  end
52
48
  end
@@ -58,13 +54,6 @@ class Dorsale::Flyboy::Task < ::Dorsale::ApplicationRecord
58
54
  assign_default :term, Time.zone.now.to_date + snooze_default_term
59
55
  end
60
56
 
61
- after_save :update_taskable_progress!
62
- after_destroy :update_taskable_progress!
63
-
64
- def update_taskable_progress!
65
- taskable.try(:update_progress!)
66
- end
67
-
68
57
  def snooze
69
58
  if term_not_passed_yet
70
59
  if self.reminder + snooze_default_reminder > Time.zone.now.to_date
@@ -0,0 +1,13 @@
1
+ module Dorsale::Alexandrie::Prawn::RenderWithAttachments
2
+ def render_with_attachments
3
+ final_pdf = ::CombinePDF.parse(self.render)
4
+
5
+ attachments.each do |attachment|
6
+ next unless File.extname(attachment.file.path) == ".pdf"
7
+
8
+ final_pdf << ::CombinePDF.load(attachment.file.path)
9
+ end
10
+
11
+ final_pdf.to_pdf
12
+ end
13
+ end
@@ -1,9 +1,14 @@
1
1
  require "prawn/measurement_extensions"
2
2
 
3
3
  class Dorsale::BillingMachine::InvoiceSingleVatPdf < Prawn::Document
4
- include Dorsale::Alexandrie::Prawn
4
+ include Dorsale::Alexandrie::Prawn::RenderWithAttachments
5
5
  include Dorsale::AllHelpers
6
6
  include ActionView::Helpers::NumberHelper
7
+
8
+ def attachments
9
+ @main_document.try(:attachments) || []
10
+ end
11
+
7
12
  DEBUG = false
8
13
 
9
14
  GREY = "808080"
@@ -1,22 +1,4 @@
1
1
  module Dorsale::BillingMachine::QuotationPdfCommonMethods
2
- def build
3
- super
4
- build_attachments
5
- end
6
-
7
- def build_attachments
8
- main_document.attachments.each do |attachment|
9
- next unless File.extname(attachment.file.path) == ".pdf"
10
-
11
- file = attachment.file.path
12
- nb_pages = ::CombinePDF.load(file).pages.count
13
-
14
- nb_pages.times do |i|
15
- start_new_page template: file, template_page: (i+1)
16
- end
17
- end
18
- end
19
-
20
2
  def build_bank_informations
21
3
  end
22
4
 
@@ -17,7 +17,7 @@ module Dorsale::ExpenseGun::ExpensePolicyHelper
17
17
  end
18
18
 
19
19
  def submit?
20
- return false unless expense.may_go_to_submited?
20
+ return false unless expense.may_go_to_submitted?
21
21
  super
22
22
  end
23
23
 
@@ -11,18 +11,15 @@ module Dorsale::Flyboy::TaskPolicyHelper
11
11
  ]
12
12
 
13
13
  def create?
14
- return false if folder_is_closed?
15
14
  return false if cannot_read_taskable?
16
15
  super
17
16
  end
18
17
 
19
18
  def update?
20
- return false if folder_is_closed?
21
19
  super
22
20
  end
23
21
 
24
22
  def delete?
25
- return false if folder_is_closed?
26
23
  super
27
24
  end
28
25
 
@@ -38,13 +35,6 @@ module Dorsale::Flyboy::TaskPolicyHelper
38
35
 
39
36
  private
40
37
 
41
- def folder_is_closed?
42
- return false unless task.is_a?(::Dorsale::Flyboy::Task)
43
- return false unless task.taskable.is_a?(::Dorsale::Flyboy::Folder)
44
-
45
- task.taskable.closed?
46
- end
47
-
48
38
  def cannot_read_taskable?
49
39
  return false unless task.is_a?(::Dorsale::Flyboy::Task)
50
40
  return false unless task.taskable.present?
@@ -17,7 +17,6 @@ class Dorsale::PolicyChecker
17
17
  check_policy! "Dorsale::CustomerVault::LinkPolicy"
18
18
  check_policy! "Dorsale::ExpenseGun::CategoryPolicy"
19
19
  check_policy! "Dorsale::ExpenseGun::ExpensePolicy"
20
- check_policy! "Dorsale::Flyboy::FolderPolicy"
21
20
  check_policy! "Dorsale::Flyboy::TaskPolicy"
22
21
  check_policy! "UserPolicy"
23
22
 
@@ -0,0 +1,37 @@
1
+ class Dorsale::BillingMachine::PdfFileGenerator < Dorsale::Service
2
+ attr_reader :document
3
+
4
+ def initialize(document)
5
+ # I have no idea why I need to do that,
6
+ # if I don't do that, CarrierWare do not stores the file.
7
+ # The reload() method don't work either.
8
+ # The problem appears only on server, not in console.
9
+ # I think CarrierWave do not work anymore after first save.
10
+ @document = document.class.find(document.id)
11
+ end
12
+
13
+ def call
14
+ document.update!(pdf_file: file)
15
+ end
16
+
17
+ private
18
+
19
+ def pdf_klass
20
+ return ::Dorsale::BillingMachine.invoice_pdf_model if document.is_a?(::Dorsale::BillingMachine::Invoice)
21
+ return ::Dorsale::BillingMachine.quotation_pdf_model if document.is_a?(::Dorsale::BillingMachine::Quotation)
22
+ end
23
+
24
+ def pdf_data
25
+ @pdf_data ||= pdf_klass.new(document).tap(&:build).render_with_attachments
26
+ end
27
+
28
+ def file
29
+ @file ||= StringIO.new(pdf_data)
30
+ end
31
+
32
+ class StringIO < ::StringIO
33
+ def original_filename
34
+ @original_filename ||= "#{SecureRandom.uuid}.pdf"
35
+ end
36
+ end
37
+ end
@@ -10,7 +10,7 @@ class Dorsale::ExpenseGun::Expense::Copy < ::Dorsale::Service
10
10
 
11
11
  @copy.user = nil
12
12
  @copy.date = nil
13
- @copy.state = "new"
13
+ @copy.state = "draft"
14
14
  @copy.created_at = nil
15
15
  @copy.updated_at = nil
16
16
 
@@ -0,0 +1,5 @@
1
+ class Dorsale::PdfUploader < ::Dorsale::ApplicationUploader
2
+ def extension_white_list
3
+ %w(pdf)
4
+ end
5
+ end
@@ -61,7 +61,7 @@
61
61
  br
62
62
 
63
63
  - if document.comments.present?
64
- = info document, :comments, text2html(document.comments), separator: " :<br />"
64
+ = info document, :comments, text2html(document.comments), separator: " :<br />".html_safe
65
65
  br
66
66
 
67
67
 
@@ -29,8 +29,7 @@ table.default.invoices
29
29
  = invoice.tracking_id
30
30
 
31
31
  td.customer_name
32
- - if invoice.customer
33
- = link_to invoice.customer, invoice.customer
32
+ = link_to_object(invoice.customer)
34
33
 
35
34
  td.total_excluding_taxes
36
35
  = bm_currency invoice.total_excluding_taxes
@@ -1,5 +1,5 @@
1
1
  pdf = CombinePDF.new
2
2
  @invoices_without_pagination.each do |invoice|
3
- pdf << CombinePDF.parse(invoice.to_pdf)
3
+ pdf << CombinePDF.parse(invoice.pdf_file.read)
4
4
  end
5
- pdf.to_pdf
5
+ pdf.to_pdf
@@ -6,4 +6,4 @@ filename = [
6
6
 
7
7
  response.headers["Content-Disposition"] = %(inline; filename="#{filename}")
8
8
 
9
- @invoice.to_pdf
9
+ @invoice.pdf_file.read
@@ -32,8 +32,7 @@ table.default.quotations
32
32
  = quotation.tracking_id
33
33
 
34
34
  td.customer_name
35
- - if quotation.customer
36
- = link_to quotation.customer, quotation.customer
35
+ = link_to_object(quotation.customer)
37
36
 
38
37
  td.total_excluding_taxes
39
38
  = bm_currency quotation.total_excluding_taxes
@@ -6,4 +6,4 @@ filename = [
6
6
 
7
7
  response.headers["Content-Disposition"] = %(inline; filename="#{filename}")
8
8
 
9
- @quotation.to_pdf
9
+ @quotation.pdf_file.read
@@ -14,7 +14,7 @@
14
14
  p.infos
15
15
  span.commentable-container
16
16
  span.commentable
17
- = link_to comment.commentable, engine_polymorphic_path(comment.commentable)
17
+ = link_to_object(comment.commentable)
18
18
 
19
19
  span.separator
20
20
  = " - "
@@ -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
8
+ = f.association :bob, label: ::Dorsale::CustomerVault::Person.t, collection: @people
9
9
 
10
10
  = f.input :title
11
11
  = form_buttons
@@ -5,7 +5,7 @@
5
5
  = icon :user if person.individual?
6
6
  = " "
7
7
  span.name
8
- = link_to person.to_s, dorsale.customer_vault_person_path(person)
8
+ = link_to_object(person)
9
9
 
10
10
  - if defined?(link)
11
11
  span.separator = " / "
@@ -12,6 +12,9 @@
12
12
 
13
13
  .panel-body
14
14
  = horizontal_form_for @task, as: :task do |f|
15
+ - if @task.taskable
16
+ = f.input :taskable, as: :string, input_html: {value: @task.taskable.to_s, disabled: true}
17
+
15
18
  = f.input :name
16
19
  = f.input :description
17
20
  = f.input :reminder, html5: true
@@ -1,2 +1,5 @@
1
+ - if policy(model).create?
2
+ = create_button dorsale.new_flyboy_task_path
3
+
1
4
  - if policy(model).export?
2
5
  = export_button url_for(format: :xlsx), download: "#{model.ts}.xlsx"
@@ -4,17 +4,17 @@ table#tasks-list
4
4
  th.task-status
5
5
  th.task-snooze
6
6
  th.task-progress.hidden-xs
7
- = sortable_column Dorsale::Flyboy::Task.t(:progress), column: "progress"
7
+ = sortable_column Dorsale::Flyboy::Task.t(:progress), :progress
8
8
 
9
9
  th.task-name
10
- = sortable_column Dorsale::Flyboy::Task.t, column: "name"
10
+ = sortable_column Dorsale::Flyboy::Task.t, :name
11
11
 
12
12
  - unless nested
13
13
  th.taskable-name.hidden-xs
14
- = sortable_column Dorsale::Flyboy::Task.t(:taskable), column: "taskable"
14
+ = sortable_column Dorsale::Flyboy::Task.t(:taskable), :taskable
15
15
 
16
16
  th.task-term.hidden-xs
17
- = sortable_column Dorsale::Flyboy::Task.t(:term), column: "term"
17
+ = sortable_column Dorsale::Flyboy::Task.t(:term), :term
18
18
 
19
19
  tbody
20
20
  - tasks.each do |task|
@@ -51,17 +51,11 @@ table#tasks-list
51
51
  = progress_bar percentage: task.progress, label: true
52
52
 
53
53
  td.task-name
54
- - if policy(task).read?
55
- = link_to task.to_s, dorsale.flyboy_task_path(task)
56
- - else
57
- = task.to_s
54
+ = link_to_object(task)
58
55
 
59
56
  - unless nested
60
57
  td.taskable-name.hidden-xs
61
- - if policy(task.taskable).read?
62
- = link_to task.taskable.to_s, engine_polymorphic_path(task.taskable)
63
- - else
64
- = task.taskable.to_s
58
+ = link_to_object(task.taskable)
65
59
 
66
60
  td.task-term.hidden-xs
67
61
  = date(task.term)
@@ -11,8 +11,7 @@
11
11
  - tasks.each do |task|
12
12
  tr
13
13
  td.taskable
14
- a href=engine_polymorphic_path(task.taskable)
15
- = task.taskable
14
+ = link_to_object(task.taskable)
16
15
 
17
16
  td.name
18
17
  - if task.owner.nil?
@@ -20,7 +19,7 @@
20
19
  - else
21
20
  = icon(:user)
22
21
 
23
- = link_to task, dorsale.flyboy_task_path(task)
22
+ = link_to_object(task)
24
23
 
25
24
  td.date
26
25
  .text-muted = date(task.term)