dorsale 3.1.7 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/app/assets/javascripts/dorsale/common/comments.coffee +18 -20
- data/app/assets/javascripts/dorsale/common/datepicker.coffee +1 -1
- data/app/assets/javascripts/dorsale/common/forms.coffee +1 -1
- data/app/assets/javascripts/dorsale/common/modals.coffee +1 -1
- data/app/assets/javascripts/dorsale/common/tabs_loader.coffee +1 -1
- data/app/assets/javascripts/dorsale/common/tags.coffee +1 -1
- data/app/assets/javascripts/dorsale/common/tooltips.coffee +1 -1
- data/app/assets/javascripts/dorsale/dependencies.coffee +2 -0
- data/app/assets/javascripts/dorsale/engines/billing_machine.coffee +1 -1
- data/app/assets/stylesheets/dorsale/all.sass +1 -1
- data/app/assets/stylesheets/dorsale/common/comments.sass +1 -1
- data/app/assets/stylesheets/dorsale/common/filters.sass +16 -1
- data/app/assets/stylesheets/dorsale/common/styles.sass +3 -0
- data/app/assets/stylesheets/dorsale/engines/customer_vault.sass +2 -2
- data/app/assets/stylesheets/dorsale/engines/expense_gun.sass +3 -0
- data/app/assets/stylesheets/dorsale/engines/flyboy.sass +4 -0
- data/app/assets/stylesheets/dorsale/print.sass +73 -0
- data/app/controllers/dorsale/alexandrie/attachments_controller.rb +0 -4
- data/app/controllers/dorsale/application_controller.rb +12 -0
- data/app/controllers/dorsale/billing_machine/application_controller.rb +0 -5
- data/app/controllers/dorsale/billing_machine/id_cards_controller.rb +0 -4
- data/app/controllers/dorsale/billing_machine/invoices_controller.rb +0 -4
- data/app/controllers/dorsale/billing_machine/payment_terms_controller.rb +0 -4
- data/app/controllers/dorsale/billing_machine/quotations_controller.rb +0 -4
- data/app/controllers/dorsale/comments_controller.rb +30 -55
- data/app/controllers/dorsale/customer_vault/links_controller.rb +5 -5
- data/app/controllers/dorsale/customer_vault/people_controller.rb +9 -11
- data/app/controllers/dorsale/expense_gun/categories_controller.rb +0 -4
- data/app/controllers/dorsale/expense_gun/expenses_controller.rb +1 -5
- data/app/controllers/dorsale/flyboy/folders_controller.rb +0 -4
- data/app/controllers/dorsale/flyboy/tasks_controller.rb +0 -4
- data/app/controllers/dorsale/users_controller.rb +7 -11
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_customer.rb +1 -1
- data/app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb +1 -1
- data/app/helpers/dorsale/all_helpers.rb +1 -0
- data/app/helpers/dorsale/billing_machine/application_helper.rb +23 -0
- data/app/helpers/dorsale/comments_helper.rb +14 -2
- data/app/helpers/dorsale/flyboy/application_helper.rb +4 -0
- data/app/helpers/dorsale/text_helper.rb +12 -7
- data/app/libs/dorsale/sortable_uuid_generator.rb +11 -0
- data/app/mailers/dorsale/billing_machine/invoice_mailer.rb +2 -4
- data/app/models/concerns/dorsale/active_record_uuid_concern.rb +15 -0
- data/app/models/concerns/dorsale/default_values_concern.rb +13 -0
- data/app/models/dorsale/alexandrie/attachment.rb +3 -3
- data/app/models/dorsale/application_record.rb +11 -0
- data/app/models/dorsale/billing_machine/invoice.rb +13 -13
- data/app/models/dorsale/billing_machine/invoice_line.rb +3 -9
- data/app/models/dorsale/billing_machine/quotation.rb +6 -12
- data/app/models/dorsale/billing_machine/quotation_line.rb +3 -8
- data/app/models/dorsale/customer_vault/person.rb +5 -4
- data/app/models/dorsale/expense_gun/expense.rb +3 -4
- data/app/models/dorsale/expense_gun/expense_line.rb +4 -5
- data/app/models/dorsale/flyboy/folder.rb +2 -3
- data/app/models/dorsale/flyboy/task.rb +5 -6
- data/app/models/dorsale/flyboy/task_comment.rb +3 -8
- data/app/models/dorsale/users/active.rb +1 -1
- data/app/policies/dorsale/billing_machine/invoice_policy_helper.rb +5 -0
- data/app/policies/dorsale/comment_policy_helper.rb +21 -0
- data/app/serializers/dorsale/serializers/xlsx.rb +13 -2
- data/app/views/dorsale/billing_machine/invoices/_details.html.slim +1 -1
- data/app/views/dorsale/billing_machine/invoices/_filters.html.slim +1 -1
- data/app/views/dorsale/billing_machine/invoices/_form.html.slim +1 -1
- data/app/views/dorsale/billing_machine/invoices/_header_infos.html.slim +9 -4
- data/app/views/dorsale/billing_machine/invoices/_list.html.slim +3 -2
- data/app/views/dorsale/billing_machine/invoices/email.html.slim +6 -0
- data/app/views/dorsale/billing_machine/invoices/index.html.slim +1 -1
- data/app/views/dorsale/billing_machine/invoices/index.xlsx.ruby +41 -0
- data/app/views/dorsale/billing_machine/quotations/_filters.html.slim +1 -1
- data/app/views/dorsale/billing_machine/quotations/_list.html.slim +4 -3
- data/app/views/dorsale/comments/_comment.html.slim +2 -2
- data/app/views/dorsale/comments/_comments.html.slim +5 -0
- data/app/views/dorsale/comments/_form.html.slim +5 -6
- data/app/views/dorsale/comments/_list.html.slim +1 -1
- data/app/views/dorsale/comments/edit.html.slim +1 -1
- data/app/views/dorsale/customer_vault/links/edit.html.slim +13 -17
- data/app/views/dorsale/customer_vault/links/index.html.slim +10 -0
- data/app/views/dorsale/customer_vault/links/new.html.slim +10 -14
- data/app/views/dorsale/customer_vault/people/_actions.html.slim +2 -2
- data/app/views/dorsale/customer_vault/people/_data_context.html.slim +1 -1
- data/app/views/dorsale/customer_vault/people/_index_tabs.html.slim +2 -2
- data/app/views/dorsale/customer_vault/people/_show_layout.html.slim +10 -0
- data/app/views/dorsale/customer_vault/people/_tabs.html.slim +24 -0
- data/app/views/dorsale/customer_vault/people/activity.slim +2 -3
- data/app/views/dorsale/customer_vault/people/edit.html.slim +1 -0
- data/app/views/dorsale/customer_vault/people/index.html.slim +2 -2
- data/app/views/dorsale/customer_vault/people/index.xlsx.ruby +49 -0
- data/app/views/dorsale/customer_vault/people/invoices.html.slim +5 -0
- data/app/views/dorsale/customer_vault/people/show.html.slim +5 -26
- data/app/views/dorsale/customer_vault/people/tasks.html.slim +4 -0
- data/app/views/dorsale/expense_gun/categories/_list.html.slim +4 -1
- data/app/views/dorsale/expense_gun/expenses/_list.html.slim +1 -1
- data/app/views/dorsale/expense_gun/expenses/show.html.slim +3 -3
- data/app/views/dorsale/flyboy/_filters.html.slim +3 -0
- data/app/views/dorsale/flyboy/folders/_form.html.slim +3 -1
- data/app/views/dorsale/flyboy/folders/_list.html.slim +2 -2
- data/app/views/dorsale/flyboy/task_comments/_list.html.slim +2 -2
- data/app/views/dorsale/flyboy/tasks/_form.html.slim +4 -1
- data/app/views/dorsale/flyboy/tasks/_list.html.slim +1 -1
- data/app/views/dorsale/flyboy/tasks/_summary_list.html.slim +6 -5
- data/app/views/dorsale/flyboy/tasks/index.html.slim +2 -4
- data/app/views/dorsale/flyboy/tasks/index.xlsx.ruby +23 -0
- data/app/views/dorsale/flyboy/tasks/summary.html.slim +0 -2
- data/config/locales/common.en.yml +2 -0
- data/config/locales/common.fr.yml +2 -0
- data/config/locales/customer_vault.en.yml +0 -6
- data/config/locales/customer_vault.fr.yml +0 -6
- data/config/locales/flyboy.en.yml +2 -0
- data/config/locales/flyboy.fr.yml +2 -0
- data/config/routes.rb +7 -2
- data/db/migrate/20161118071317_dorsale_add_missing_indexes.rb +25 -0
- data/features/billing_machine_invoices.feature +4 -2
- data/features/customer_vault_invoices.feature +10 -0
- data/features/customer_vault_tasks.feature +1 -1
- data/features/flyboy_tasks.feature +3 -15
- data/features/step_definitions/billing_machine_invoices_steps.rb +2 -6
- data/features/step_definitions/billing_machine_quotations_steps.rb +5 -5
- data/features/step_definitions/common_steps.rb +7 -1
- data/features/step_definitions/customer_vault_corporations_steps.rb +7 -7
- data/features/step_definitions/customer_vault_filters_steps.rb +3 -3
- data/features/step_definitions/customer_vault_individuals_steps.rb +1 -1
- data/features/step_definitions/customer_vault_invoices_steps.rb +7 -0
- data/features/step_definitions/customer_vault_links_steps.rb +5 -3
- data/features/step_definitions/customer_vault_people_steps.rb +1 -1
- data/features/step_definitions/customer_vault_search_steps.rb +4 -4
- data/features/step_definitions/customer_vault_tasks_steps.rb +6 -16
- data/features/step_definitions/expense_gun_expenses_steps.rb +2 -2
- data/features/step_definitions/flyboy_folders_steps.rb +5 -5
- data/features/step_definitions/flyboy_tasks_steps.rb +5 -29
- data/lib/dorsale/engine.rb +6 -1
- data/lib/dorsale/polymorphic_id.rb +1 -1
- data/lib/dorsale/version.rb +1 -1
- data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +3 -4
- data/spec/controllers/dorsale/comments_controller_spec.rb +3 -3
- data/spec/controllers/dorsale/expense_gun/expenses_controller_spec.rb +10 -0
- data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +1 -13
- data/spec/factories/dorsale_comments.rb +3 -3
- data/spec/helpers/dorsale/text_helper_spec.rb +15 -0
- data/spec/{lib → libs}/active_record_comma_type_cast_spec.rb +0 -0
- data/spec/{lib → libs/dorsale}/polymorphic_id_spec.rb +0 -0
- data/spec/libs/dorsale/sortable_uuid_generator_spec.rb +29 -0
- data/spec/rails_helper.rb +2 -0
- data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +15 -0
- metadata +54 -18
- data/app/pdfs/dorsale/flyboy/roadmap.rb +0 -47
- data/app/views/dorsale/billing_machine/invoices/index.csv.ruby +0 -46
- data/app/views/dorsale/comments/_loader.html.slim +0 -5
- data/app/views/dorsale/comments/index.html.slim +0 -11
- data/app/views/dorsale/customer_vault/people/_activity_tab.html.slim +0 -4
- data/app/views/dorsale/customer_vault/people/_comment.html.slim +0 -1
- data/app/views/dorsale/customer_vault/people/_links_tab.html.slim +0 -7
- data/app/views/dorsale/customer_vault/people/_tasks_tab.html.slim +0 -1
- data/app/views/dorsale/customer_vault/people/index.xls.slim +0 -24
- data/app/views/dorsale/flyboy/tasks/index.csv.ruby +0 -24
- data/app/views/dorsale/flyboy/tasks/index.pdf.ruby +0 -6
- data/app/views/dorsale/flyboy/tasks/index.xls.erb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3238d078981accff66147d5fb412740e482a115f
|
4
|
+
data.tar.gz: bb228e445bec72569f5083bd8ea6322702ba8ebd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e05fc44b6d74b7f44becd523c8dd7c7d306a82479adf5e86e7c9a677dc2285ab8cd9b56a2d1f2f405427014dc21a0d959192659c5f797ce5bc0c0ac5979b6c
|
7
|
+
data.tar.gz: 5ffd84a943253a3e8fdb99a5adad1286e62299106b62f604074f6ff6e745f0efaf2879dba8266d5540b73438fb1bec7990e3991d19a26957d382c353a17c5779
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.2.0
|
4
|
+
|
5
|
+
- Add print CSS
|
6
|
+
- UUID friendly
|
7
|
+
- Add missing indexes
|
8
|
+
- Add `:default` option to `info` helper
|
9
|
+
- Refactor
|
10
|
+
- Add nilify_blanks gem
|
11
|
+
- Add invoices chart
|
12
|
+
- CustomerVault improvements + add invoices tab
|
13
|
+
- Comments improvements
|
14
|
+
- Remove tasks PDF and CSV export (XLSX still present)
|
15
|
+
- Convert CSV exports to XLSX
|
16
|
+
- XLSX Serializer improvements
|
17
|
+
|
3
18
|
## 3.1.7
|
4
19
|
|
5
20
|
- Filters changes : get/set are now private
|
@@ -1,28 +1,22 @@
|
|
1
1
|
window.dorsaleComments =
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
$.ajax
|
8
|
-
url: url
|
9
|
-
success: (data) ->
|
10
|
-
container.html(data)
|
11
|
-
dorsaleComments.setupCreateForm()
|
12
|
-
dorsaleComments.setupEditButtons()
|
13
|
-
dorsaleComments.setupDeleteButtons()
|
14
|
-
|
15
|
-
reload: ->
|
16
|
-
dorsaleComments.load()
|
2
|
+
setup: ->
|
3
|
+
dorsaleComments.setupCreateForm()
|
4
|
+
dorsaleComments.setupEditForm()
|
5
|
+
dorsaleComments.setupEditButtons()
|
6
|
+
dorsaleComments.setupDeleteButtons()
|
17
7
|
|
18
8
|
setupCreateForm: ->
|
19
|
-
$("#dorsale-comments
|
9
|
+
$("#dorsale-comments").on "ajax:success", "form[id*=new]", (e, data) ->
|
10
|
+
if data.length
|
11
|
+
$(this).find("textarea").val("")
|
12
|
+
$("#dorsale-comments-list").prepend(data)
|
20
13
|
|
21
14
|
setupEditForm: ->
|
22
|
-
$("#dorsale-comments
|
15
|
+
$("#dorsale-comments-list").on "ajax:success", "form[id*=edit]", (e, data) ->
|
16
|
+
$(this).replaceWith(data)
|
23
17
|
|
24
18
|
setupEditButtons: ->
|
25
|
-
$("#dorsale-comments [href$=edit]"
|
19
|
+
$("#dorsale-comments-list").on "click", "[href$=edit]", ->
|
26
20
|
container = $(this).parents(".comment")
|
27
21
|
url = this.href
|
28
22
|
|
@@ -30,9 +24,13 @@ window.dorsaleComments =
|
|
30
24
|
url: url
|
31
25
|
success: (data) ->
|
32
26
|
container.replaceWith(data)
|
33
|
-
dorsaleComments.setupEditForm()
|
34
27
|
|
35
28
|
return false
|
36
29
|
|
37
30
|
setupDeleteButtons: ->
|
38
|
-
$("#dorsale-comments
|
31
|
+
$("#dorsale-comments-list").on "ajax:success", "[data-method=delete]", ->
|
32
|
+
$(this).parents(".comment").fadeOut ->
|
33
|
+
$(this).remove()
|
34
|
+
|
35
|
+
$(document).on "turbolinks:load", ->
|
36
|
+
dorsaleComments.setup()
|
@@ -15,7 +15,7 @@ window.num2str = (num) ->
|
|
15
15
|
num = parseFloat(num)
|
16
16
|
accounting.formatNumber(num)
|
17
17
|
|
18
|
-
$(document).on "
|
18
|
+
$(document).on "turbolinks:load cocoon:after-insert", ->
|
19
19
|
$("#billing_machine-form input.number").keyup ->
|
20
20
|
total_excluding_taxes = 0.0
|
21
21
|
|
@@ -2,13 +2,16 @@
|
|
2
2
|
@extend .well
|
3
3
|
padding: 8px
|
4
4
|
box-shadow: none
|
5
|
+
display: flex
|
5
6
|
|
6
7
|
select,
|
7
8
|
button,
|
8
9
|
input,
|
9
10
|
.form-control,
|
10
11
|
.select2-container,
|
12
|
+
.btn + .btn,
|
11
13
|
margin: 0 5px 0 0
|
14
|
+
max-width: 15em
|
12
15
|
|
13
16
|
.form-group
|
14
17
|
display: inline-block
|
@@ -16,13 +19,25 @@
|
|
16
19
|
padding: 0
|
17
20
|
margin: 0
|
18
21
|
|
19
|
-
.form-control
|
22
|
+
.form-control,
|
23
|
+
@extend .input-sm
|
20
24
|
display: inline-block
|
21
25
|
width: auto
|
22
26
|
|
27
|
+
.btn
|
28
|
+
@extend .btn-sm
|
29
|
+
|
23
30
|
input[id*=date]
|
24
31
|
width: 8em
|
25
32
|
|
26
33
|
.select2-container
|
27
34
|
display: inline-block !important
|
28
35
|
width: 30em !important
|
36
|
+
height: 30px !important
|
37
|
+
|
38
|
+
.select2-selection
|
39
|
+
height: 28px !important
|
40
|
+
min-height: 0 !important
|
41
|
+
|
42
|
+
.select2-selection__choice
|
43
|
+
margin-top: 3px !important
|
@@ -0,0 +1,73 @@
|
|
1
|
+
@media print
|
2
|
+
html,
|
3
|
+
body,
|
4
|
+
#body,
|
5
|
+
#main,
|
6
|
+
#context,
|
7
|
+
#context-main,
|
8
|
+
.row,
|
9
|
+
div[class^=col],
|
10
|
+
thead *,
|
11
|
+
tfoot *,
|
12
|
+
th,
|
13
|
+
margin: 0 !important
|
14
|
+
padding: 0 !important
|
15
|
+
font-size: 11px !important
|
16
|
+
float: none !important
|
17
|
+
width: auto !important
|
18
|
+
height: auto !important
|
19
|
+
|
20
|
+
.panel-title,
|
21
|
+
.context-header,
|
22
|
+
thead *,
|
23
|
+
tfoot *,
|
24
|
+
th,
|
25
|
+
font-size: 12px !important
|
26
|
+
line-height: 12px !important
|
27
|
+
|
28
|
+
h1
|
29
|
+
font-size: 2em
|
30
|
+
|
31
|
+
.filters,
|
32
|
+
form.search,
|
33
|
+
.input-group-addon,
|
34
|
+
.btn,
|
35
|
+
.actions,
|
36
|
+
.actions + hr,
|
37
|
+
.navbar,
|
38
|
+
.nav,
|
39
|
+
.nav-tabs,
|
40
|
+
a[href]:after,
|
41
|
+
display: none !important
|
42
|
+
|
43
|
+
.panel,
|
44
|
+
.table,
|
45
|
+
.list-group,
|
46
|
+
.well,
|
47
|
+
hr,
|
48
|
+
p,
|
49
|
+
margin: 1em 0 !important
|
50
|
+
|
51
|
+
.panel table,
|
52
|
+
.well p,
|
53
|
+
td p,
|
54
|
+
margin: 0 !important
|
55
|
+
|
56
|
+
.well,
|
57
|
+
padding: 0.5em !important
|
58
|
+
|
59
|
+
.panel-heading,
|
60
|
+
.panel-title,
|
61
|
+
.panel-body,
|
62
|
+
.panel-footer,
|
63
|
+
.context-header,
|
64
|
+
.context-body,
|
65
|
+
.context-footer,
|
66
|
+
.list-group-item,
|
67
|
+
thead tr > *,
|
68
|
+
tfoot tr > *,
|
69
|
+
padding: 0.5em !important
|
70
|
+
margin: 0 !important
|
71
|
+
|
72
|
+
.panel-heading .panel-title,
|
73
|
+
padding: 0 !important
|
@@ -7,12 +7,7 @@ class Dorsale::BillingMachine::ApplicationController < ::Dorsale::ApplicationCon
|
|
7
7
|
raise "#euros is not available in BillingMachine, please use #bm_currency instead"
|
8
8
|
end
|
9
9
|
|
10
|
-
def bm_currency(n)
|
11
|
-
DH.currency(n, ::Dorsale::BillingMachine.default_currency)
|
12
|
-
end
|
13
|
-
|
14
10
|
helper_method :euros
|
15
|
-
helper_method :bm_currency
|
16
11
|
|
17
12
|
def set_common_variables
|
18
13
|
@payment_terms ||= policy_scope(::Dorsale::BillingMachine::PaymentTerm)
|
@@ -140,10 +140,6 @@ class Dorsale::BillingMachine::InvoicesController < ::Dorsale::BillingMachine::A
|
|
140
140
|
::Dorsale::BillingMachine::Invoice
|
141
141
|
end
|
142
142
|
|
143
|
-
def scope
|
144
|
-
policy_scope(model)
|
145
|
-
end
|
146
|
-
|
147
143
|
def default_back_url
|
148
144
|
if @invoice
|
149
145
|
url_for(action: :show, id: @invoice.to_param)
|
@@ -113,10 +113,6 @@ class Dorsale::BillingMachine::QuotationsController < ::Dorsale::BillingMachine:
|
|
113
113
|
::Dorsale::BillingMachine::Quotation
|
114
114
|
end
|
115
115
|
|
116
|
-
def scope
|
117
|
-
policy_scope(model)
|
118
|
-
end
|
119
|
-
|
120
116
|
def default_back_url
|
121
117
|
if @quotation
|
122
118
|
url_for(action: :show, id: @quotation.to_param)
|
@@ -7,29 +7,16 @@ class Dorsale::CommentsController < ::Dorsale::ApplicationController
|
|
7
7
|
|
8
8
|
layout false
|
9
9
|
|
10
|
-
def index
|
11
|
-
@comment = scope.new(comment_params_for_create)
|
12
|
-
@commentable = @comment.commentable
|
13
|
-
@comments = scope
|
14
|
-
.where(commentable: @commentable)
|
15
|
-
.preload(:commentable, :author)
|
16
|
-
|
17
|
-
authorize @commentable, :read?
|
18
|
-
end
|
19
|
-
|
20
10
|
def create
|
21
11
|
@comment ||= scope.new(comment_params_for_create)
|
22
|
-
@commentable = @comment.commentable
|
23
12
|
|
24
13
|
authorize @comment, :create?
|
25
14
|
|
26
15
|
if @comment.save
|
27
|
-
|
16
|
+
render_comment
|
28
17
|
else
|
29
|
-
|
18
|
+
render_nothing
|
30
19
|
end
|
31
|
-
|
32
|
-
render_or_redirect
|
33
20
|
end
|
34
21
|
|
35
22
|
def edit
|
@@ -40,37 +27,39 @@ class Dorsale::CommentsController < ::Dorsale::ApplicationController
|
|
40
27
|
authorize @comment, :update?
|
41
28
|
|
42
29
|
if @comment.update(comment_params_for_update)
|
43
|
-
|
30
|
+
render_comment
|
44
31
|
else
|
45
|
-
|
32
|
+
render_form
|
46
33
|
end
|
47
|
-
|
48
|
-
render_or_redirect
|
49
34
|
end
|
50
35
|
|
51
36
|
def destroy
|
52
37
|
authorize @comment, :delete?
|
53
38
|
|
54
|
-
|
55
|
-
flash[:notice] = t("messages.comments.delete_ok")
|
56
|
-
else
|
57
|
-
flash[:alert] = t("messages.comments.delete_error")
|
58
|
-
end
|
39
|
+
@comment.destroy
|
59
40
|
|
60
|
-
|
41
|
+
render_nothing
|
61
42
|
end
|
62
43
|
|
63
44
|
private
|
64
45
|
|
65
|
-
def
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
46
|
+
def render_comment
|
47
|
+
if request.xhr?
|
48
|
+
render partial: "comment", locals: {comment: @comment}
|
49
|
+
else
|
50
|
+
redirect_to back_url
|
51
|
+
end
|
71
52
|
end
|
72
53
|
|
73
|
-
def
|
54
|
+
def render_form
|
55
|
+
if request.xhr?
|
56
|
+
render partial: "form", locals: {comment: @comment}
|
57
|
+
else
|
58
|
+
redirect_to back_url
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def render_nothing
|
74
63
|
if request.xhr?
|
75
64
|
head :ok
|
76
65
|
else
|
@@ -78,12 +67,16 @@ class Dorsale::CommentsController < ::Dorsale::ApplicationController
|
|
78
67
|
end
|
79
68
|
end
|
80
69
|
|
81
|
-
def
|
82
|
-
|
70
|
+
def back_url
|
71
|
+
[
|
72
|
+
params[:form_url],
|
73
|
+
request.referer,
|
74
|
+
(main_app.root_path rescue "/"),
|
75
|
+
].select(&:present?).first
|
83
76
|
end
|
84
77
|
|
85
|
-
def
|
86
|
-
|
78
|
+
def model
|
79
|
+
::Dorsale::Comment
|
87
80
|
end
|
88
81
|
|
89
82
|
def set_objects
|
@@ -109,28 +102,10 @@ class Dorsale::CommentsController < ::Dorsale::ApplicationController
|
|
109
102
|
end
|
110
103
|
|
111
104
|
def comment_params_for_create
|
112
|
-
comment_params.merge(
|
113
|
-
:author => current_user,
|
114
|
-
:commentable => find_commentable,
|
115
|
-
)
|
105
|
+
comment_params.merge(author: current_user)
|
116
106
|
end
|
117
107
|
|
118
108
|
def comment_params_for_update
|
119
109
|
comment_params
|
120
110
|
end
|
121
|
-
|
122
|
-
def commentable_type
|
123
|
-
params[:commentable_type] || @comment.commentable_type
|
124
|
-
end
|
125
|
-
|
126
|
-
def commentable_id
|
127
|
-
params[:commentable_id] || @comment.commentable_id
|
128
|
-
end
|
129
|
-
|
130
|
-
def find_commentable
|
131
|
-
commentable_type.to_s.constantize.find(commentable_id)
|
132
|
-
rescue NameError
|
133
|
-
raise ActiveRecord::RecordNotFound
|
134
|
-
end
|
135
|
-
|
136
111
|
end
|