dorsale 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -2
  3. data/app/assets/javascripts/dorsale/common/upload.coffee +25 -0
  4. data/app/assets/javascripts/dorsale/dependencies.coffee +1 -0
  5. data/app/assets/stylesheets/dorsale/all.sass +0 -1
  6. data/app/assets/stylesheets/dorsale/common.sass +0 -4
  7. data/app/assets/stylesheets/dorsale/dependencies.sass +2 -1
  8. data/app/controllers/dorsale/application_controller.rb +2 -2
  9. data/app/controllers/dorsale/flyboy/tasks_controller.rb +3 -3
  10. data/app/filters/dorsale/billing_machine/small_data/filter_for_invoices.rb +5 -5
  11. data/app/filters/dorsale/billing_machine/small_data/filter_for_quotations.rb +5 -5
  12. data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_customer.rb +1 -1
  13. data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb +1 -1
  14. data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_state.rb +1 -1
  15. data/app/filters/dorsale/customer_vault/small_data/filter_for_people.rb +3 -3
  16. data/app/filters/dorsale/expense_gun/small_data/filter_for_expenses.rb +3 -3
  17. data/app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb +2 -2
  18. data/app/filters/dorsale/flyboy/small_data/filter_strategy_by_done.rb +1 -1
  19. data/app/helpers/dorsale/all_helpers.rb +2 -10
  20. data/app/helpers/dorsale/flyboy/application_helper.rb +2 -2
  21. data/app/models/dorsale/application_record.rb +7 -9
  22. data/app/models/dorsale/customer_vault/person.rb +1 -1
  23. data/app/models/dorsale/flyboy/task.rb +1 -1
  24. data/app/views/dorsale/billing_machine/invoices/_filters.html.slim +2 -2
  25. data/app/views/dorsale/billing_machine/invoices/_show_actions.html.slim +2 -2
  26. data/app/views/dorsale/billing_machine/invoices/index.xlsx.ruby +1 -1
  27. data/app/views/dorsale/billing_machine/quotations/_filters.html.slim +2 -2
  28. data/app/views/dorsale/billing_machine/quotations/_show_actions.html.slim +1 -1
  29. data/app/views/dorsale/customer_vault/people/index.xlsx.ruby +1 -1
  30. data/app/views/dorsale/expense_gun/expenses/_show_actions.html.slim +4 -4
  31. data/app/views/dorsale/flyboy/tasks/index.xlsx.ruby +1 -1
  32. data/config/locales/dorsale.en.yml +11 -1
  33. data/config/locales/dorsale.fr.yml +10 -0
  34. data/config/routes.rb +0 -6
  35. data/lib/dorsale/engine.rb +4 -1
  36. data/lib/dorsale/version.rb +1 -1
  37. metadata +17 -69
  38. data/app/assets/javascripts/dorsale/common/forms.coffee +0 -58
  39. data/app/assets/javascripts/dorsale/common/modals.coffee +0 -126
  40. data/app/assets/stylesheets/dorsale/common/filters.sass +0 -43
  41. data/app/assets/stylesheets/dorsale/common/flash.sass +0 -6
  42. data/app/assets/stylesheets/dorsale/common/modals.sass +0 -45
  43. data/app/assets/stylesheets/dorsale/common/pagination.sass +0 -8
  44. data/app/assets/stylesheets/dorsale/print.sass +0 -74
  45. data/app/controllers/concerns/dorsale/back_url_concern.rb +0 -18
  46. data/app/controllers/dorsale/small_data/filters_controller.rb +0 -36
  47. data/app/filters/dorsale/small_data/filter.rb +0 -68
  48. data/app/filters/dorsale/small_data/filter_strategy.rb +0 -5
  49. data/app/filters/dorsale/small_data/filter_strategy_by_date.rb +0 -6
  50. data/app/filters/dorsale/small_data/filter_strategy_by_date_begin.rb +0 -6
  51. data/app/filters/dorsale/small_data/filter_strategy_by_date_end.rb +0 -6
  52. data/app/filters/dorsale/small_data/filter_strategy_by_key_value.rb +0 -16
  53. data/app/filters/dorsale/small_data/filter_strategy_by_tags.rb +0 -11
  54. data/app/filters/dorsale/small_data/filter_strategy_by_time_period.rb +0 -37
  55. data/app/helpers/dorsale/bootstrap_helper.rb +0 -6
  56. data/app/helpers/dorsale/button_helper.rb +0 -161
  57. data/app/helpers/dorsale/filters_helper.rb +0 -68
  58. data/app/helpers/dorsale/form_helper.rb +0 -49
  59. data/app/helpers/dorsale/link_helper.rb +0 -52
  60. data/app/helpers/dorsale/pagination_helper.rb +0 -6
  61. data/app/helpers/dorsale/routes_helper.rb +0 -20
  62. data/app/helpers/dorsale/sorting_helper.rb +0 -48
  63. data/app/helpers/dorsale/text_helper.rb +0 -121
  64. data/app/libs/dorsale/sortable_uuid_generator.rb +0 -11
  65. data/app/models/concerns/dorsale/active_record_uuid_concern.rb +0 -15
  66. data/app/models/concerns/dorsale/default_values_concern.rb +0 -13
  67. data/app/models/concerns/dorsale/model_i18n.rb +0 -25
  68. data/app/models/concerns/dorsale/model_to_s.rb +0 -9
  69. data/app/models/concerns/dorsale/polymorphic_id.rb +0 -34
  70. data/app/models/concerns/dorsale/search.rb +0 -30
  71. data/app/models/dorsale/small_data.rb +0 -2
  72. data/app/serializers/dorsale/serializers.rb +0 -2
  73. data/app/serializers/dorsale/serializers/base.rb +0 -17
  74. data/app/serializers/dorsale/serializers/xlsx.rb +0 -36
  75. data/app/views/dorsale/search/_form.html.slim +0 -6
  76. data/config/locales/common.en.yml +0 -210
  77. data/config/locales/common.fr.yml +0 -220
  78. data/lib/dorsale/active_record_comma_type_cast.rb +0 -12
  79. data/lib/dorsale/core_and_rails_ext.rb +0 -3
  80. data/lib/dorsale/form_back_url.rb +0 -18
  81. data/spec/controllers/dorsale/small_data/filters_controller_spec.rb +0 -60
  82. data/spec/filters/dorsale/small_data/filter_spec.rb +0 -39
  83. data/spec/helpers/dorsale/form_helper_spec.rb +0 -11
  84. data/spec/helpers/dorsale/link_helper_spec.rb +0 -31
  85. data/spec/helpers/dorsale/sorting_helper_spec.rb +0 -74
  86. data/spec/helpers/dorsale/text_helper_spec.rb +0 -123
  87. data/spec/libs/dorsale/active_record_comma_type_cast_spec.rb +0 -44
  88. data/spec/libs/dorsale/polymorphic_id_spec.rb +0 -30
  89. data/spec/libs/dorsale/sortable_uuid_generator_spec.rb +0 -29
  90. data/spec/models/concerns/dorsale/model_i18n_spec.rb +0 -21
  91. data/spec/routing/dorsale/small_data_routing_spec.rb +0 -15
  92. data/spec/serializers/dorsale/serializers/xlsx_spec.rb +0 -33
@@ -1,6 +0,0 @@
1
- // Convert Rails flash to bootstrap flash
2
- .alert-notice
3
- @extend .alert-success
4
-
5
- .alert-alert
6
- @extend .alert-danger
@@ -1,45 +0,0 @@
1
- body.modal-open
2
- height: 100%
3
- overflow: hidden
4
-
5
- #modal
6
- display: block !important // override bootstrap
7
- z-index: 9999
8
-
9
- #modal, #modal-overlay
10
- position: fixed
11
- top: 0
12
- right: 0
13
- bottom: 0
14
- left: 0
15
- overflow: auto
16
-
17
- #modal-overlay
18
- background: rgba(0, 0, 0, 0.75)
19
-
20
- #modal-body
21
- position: relative
22
- margin: 10vh auto
23
- padding: 2em
24
- width: auto
25
- min-width: 50%
26
- max-width: 980px
27
- background: white
28
- z-index: 9999
29
-
30
- &.fixed-height
31
- max-height: 80vh
32
- overflow: auto
33
-
34
- #modal-close
35
- color: white
36
- position: absolute
37
- font-size: 4em
38
- line-height: 0.5em
39
- top: 0.25em
40
- right: 0.25em
41
- border: none
42
- background: none
43
-
44
- #modal:not(.closable) #modal-close
45
- display: none
@@ -1,8 +0,0 @@
1
- .pagination
2
- display: block
3
- text-align: center
4
- // font-size: 0
5
-
6
- li
7
- display: inline-block
8
- // font-size: $font-size-base
@@ -1,74 +0,0 @@
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
- #flash,
42
- display: none !important
43
-
44
- .panel,
45
- .table,
46
- .list-group,
47
- .well,
48
- hr,
49
- p,
50
- margin: 1em 0 !important
51
-
52
- .panel table,
53
- .well p,
54
- td p,
55
- margin: 0 !important
56
-
57
- .well,
58
- padding: 0.5em !important
59
-
60
- .panel-heading,
61
- .panel-title,
62
- .panel-body,
63
- .panel-footer,
64
- .context-header,
65
- .context-body,
66
- .context-footer,
67
- .list-group-item,
68
- thead tr > *,
69
- tfoot tr > *,
70
- padding: 0.5em !important
71
- margin: 0 !important
72
-
73
- .panel-heading .panel-title,
74
- padding: 0 !important
@@ -1,18 +0,0 @@
1
- module Dorsale::BackUrlConcern
2
- extend ActiveSupport::Concern
3
-
4
- private
5
-
6
- def default_back_url; end
7
-
8
- def back_url
9
- [
10
- params[:back_url],
11
- request.referer,
12
- default_back_url,
13
- main_app.root_path,
14
- "/",
15
- ].select(&:present?).first
16
- end
17
-
18
- end
@@ -1,36 +0,0 @@
1
- class Dorsale::SmallData::FiltersController < ::Dorsale::ApplicationController
2
- def create
3
- skip_authorization
4
- skip_policy_scope
5
-
6
- filters = ::Dorsale::SmallData::Filter.new(cookies)
7
- new_filters = params.fetch(:filters, {}).permit!.to_h
8
- filters.merge new_filters
9
-
10
- # Rewrite cookie with 1 year expiry
11
- cookies[:filters] = {
12
- :value => cookies[:filters],
13
- :expires => 1.year.from_now,
14
- :path => "/",
15
- }
16
-
17
- redirect_to back_url
18
- end
19
-
20
- private
21
-
22
- def back_url
23
- url = [
24
- params[:form_url],
25
- request.referer,
26
- (main_app.root_path rescue "/"),
27
- ].select(&:present?).first
28
-
29
- # Delete page param
30
- base, query_string = url.split("?")
31
- query_string = query_string.to_s.split("&").delete_if { |p| p.include?("page=") }.join("&")
32
- query_string = "?#{query_string}" if query_string.present?
33
- base + query_string
34
- end
35
-
36
- end
@@ -1,68 +0,0 @@
1
- class Dorsale::SmallData::Filter
2
- STRATEGIES = {}
3
-
4
- attr_reader :jar
5
-
6
- def initialize(jar)
7
- @jar = jar
8
- end
9
-
10
- def strategies
11
- self.class::STRATEGIES
12
- end
13
-
14
- def apply(query)
15
- strategies.each do |key, strategy|
16
- value = get(key)
17
-
18
- next if value.blank?
19
-
20
- query = strategy.apply(query, value)
21
- end
22
-
23
- return query
24
- end
25
-
26
- def method_missing(method, *args)
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
35
-
36
- if strategies.key?(key) && action == :read
37
- get(key)
38
- elsif strategies.key?(key) && action == :write
39
- set(key, value)
40
- else
41
- super
42
- end
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
68
- end
@@ -1,5 +0,0 @@
1
- class Dorsale::SmallData::FilterStrategy
2
- def apply(query, value)
3
- raise NotImplementedError
4
- end
5
- end
@@ -1,6 +0,0 @@
1
- class Dorsale::SmallData::FilterStrategyByDate < ::Dorsale::SmallData::FilterStrategyByKeyValue
2
- def apply(query, value)
3
- value = Date.parse(value)
4
- super(query, value)
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- class Dorsale::SmallData::FilterStrategyByDateBegin < ::Dorsale::SmallData::FilterStrategyByKeyValue
2
- def apply(query, value)
3
- value = Time.parse(value).beginning_of_day
4
- query.where("#{key} >= ?", value)
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- class Dorsale::SmallData::FilterStrategyByDateEnd < ::Dorsale::SmallData::FilterStrategyByKeyValue
2
- def apply(query, value)
3
- value = Time.parse(value).end_of_day
4
- query.where("#{key} <= ?", value)
5
- end
6
- end
@@ -1,16 +0,0 @@
1
- class Dorsale::SmallData::FilterStrategyByKeyValue < ::Dorsale::SmallData::FilterStrategy
2
- attr_reader :key
3
-
4
- def initialize(key = nil)
5
- @key = key
6
- end
7
-
8
- def apply(query, value)
9
- value = true if value == "true"
10
- value = false if value == "false"
11
- value = nil if value == "nil"
12
- value = nil if value == "null"
13
-
14
- query.where("#{key} = ?", value)
15
- end
16
- end
@@ -1,11 +0,0 @@
1
- class Dorsale::SmallData::FilterStrategyByTags < ::Dorsale::SmallData::FilterStrategy
2
- def apply(query, value)
3
- value = [*value].flatten.select{ |v| v.present? }
4
-
5
- if value.any?
6
- query.tagged_with(value)
7
- else
8
- query
9
- end
10
- end
11
- end
@@ -1,37 +0,0 @@
1
- class Dorsale::SmallData::FilterStrategyByTimePeriod < ::Dorsale::SmallData::FilterStrategyByKeyValue
2
- def apply(query, value)
3
- if value == "today"
4
- a = Time.zone.now.beginning_of_day
5
- b = Time.zone.now.end_of_day
6
- elsif value == "yesterday"
7
- a = (Time.zone.now - 1.day).beginning_of_day
8
- b = (Time.zone.now - 1.day).end_of_day
9
- elsif value == "this_week"
10
- a = Time.zone.now.beginning_of_week
11
- b = Time.zone.now.end_of_week
12
- elsif value == "this_month"
13
- a = Time.zone.now.beginning_of_month
14
- b = Time.zone.now.end_of_month
15
- elsif value == "this_year"
16
- a = Time.zone.now.beginning_of_year
17
- b = Time.zone.now.end_of_year
18
- elsif value == "last_week"
19
- a = (Time.zone.now - 1.week).beginning_of_week
20
- b = (Time.zone.now - 1.week).end_of_week
21
- elsif value == "last_month"
22
- a = (Time.zone.now - 1.month).beginning_of_month
23
- b = (Time.zone.now - 1.month).end_of_month
24
- elsif value == "last_year"
25
- a = (Time.zone.now - 1.year).beginning_of_year
26
- b = (Time.zone.now - 1.year).end_of_year
27
- else
28
- return query
29
- end
30
-
31
- criteria = "#{query.model.table_name}.#{key}"
32
-
33
- query
34
- .where("#{criteria} >= ?", a.to_date)
35
- .where("#{criteria} <= ?", b.to_date)
36
- end
37
- end
@@ -1,6 +0,0 @@
1
- module Dorsale::BootstrapHelper
2
- def icon(id)
3
- id = id.to_s.gsub("_", "-")
4
- content_tag(:span, class: "icon fa fa-#{id}"){}
5
- end
6
- end
@@ -1,161 +0,0 @@
1
- module Dorsale::ButtonHelper
2
- def dorsale_button(url, options = {})
3
- action = options.delete(:action)
4
- icon = options.delete(:icon)
5
- text = options.delete(:text) || t("actions.#{action}")
6
- title = options.delete(:title) || text
7
-
8
- text = "#{icon icon} <span>#{text}</span>".html_safe
9
-
10
- options = {
11
- :class => "btn btn-xs link_#{action}",
12
- :title => title,
13
- }.deep_merge(options)
14
-
15
- if confirm = options.delete(:confirm)
16
- confirm = t("actions.confirm") if confirm == true
17
-
18
- options.deep_merge!(
19
- :data => {
20
- :confirm => confirm,
21
- }
22
- )
23
- end
24
-
25
- link_to(text, url, options)
26
- end
27
-
28
- def print_button(options = {})
29
- options = {
30
- :icon => :print,
31
- :action => :print,
32
- :class => "btn btn-xs btn-default",
33
- :onclick => "print(); return false;",
34
- }.merge(options)
35
-
36
- dorsale_button("#", options)
37
- end
38
-
39
- def create_button(url, options = {})
40
- options = {
41
- :icon => :plus,
42
- :action => :create,
43
- :class =>"btn btn-xs btn-success link_create"
44
- }.merge(options)
45
-
46
- dorsale_button(url, options)
47
- end
48
-
49
- def read_button(url, options = {})
50
- options = {
51
- :icon => "info-circle",
52
- :action => :read,
53
- }.merge(options)
54
-
55
- dorsale_button(url, options)
56
- end
57
-
58
- def download_button(url, options = {})
59
- options = {
60
- :icon => "cloud-download",
61
- :action => :download,
62
- :download => url,
63
- }.merge(options)
64
-
65
- dorsale_button(url, options)
66
- end
67
-
68
- def export_button(url, options = {})
69
- ext = url.split(".").last
70
-
71
- if ext.length <= 4
72
- action = :"export_#{ext}"
73
- else
74
- action = :export
75
- end
76
-
77
- options = {
78
- :icon => "cloud-download",
79
- :action => action,
80
- :download => url,
81
- }.merge(options)
82
-
83
- dorsale_button(url, options)
84
- end
85
-
86
- def update_button(url, options = {})
87
- options = {
88
- :icon => :pencil,
89
- :action => :update,
90
- }.merge(options)
91
-
92
- dorsale_button(url, options)
93
- end
94
-
95
- def delete_button(url, options = {})
96
- options = {
97
- :icon => :trash,
98
- :action => :delete,
99
- :class => "btn btn-xs btn-danger link_delete",
100
- :confirm => true,
101
- :method => :delete,
102
- }.merge(options)
103
-
104
- dorsale_button(url, options)
105
- end
106
-
107
- def copy_button(url, options = {})
108
- options = {
109
- :icon => :copy,
110
- :action => :copy,
111
- }.merge(options)
112
-
113
- dorsale_button(url, options)
114
- end
115
-
116
- def complete_button(url, options = {})
117
- options = {
118
- :icon => :check,
119
- :action => :complete,
120
- :class => "btn btn-xs btn-success link_complete",
121
- :confirm => true,
122
- :method => :patch,
123
- }.merge(options)
124
-
125
- dorsale_button(url, options)
126
- end
127
-
128
- def snooze_button(url, options = {})
129
- options = {
130
- :icon => :"clock-o",
131
- :action => :snooze,
132
- :confirm => true,
133
- :method => :patch,
134
- }.merge(options)
135
-
136
- dorsale_button(url, options)
137
- end
138
-
139
- def lock_button(url, options = {})
140
- options = {
141
- :icon => :lock,
142
- :action => :lock,
143
- :confirm => true,
144
- :method => :patch,
145
- }.merge(options)
146
-
147
- dorsale_button(url, options)
148
- end
149
-
150
- def unlock_button(url, options = {})
151
- options = {
152
- :icon => :unlock,
153
- :action => :unlock,
154
- :confirm => true,
155
- :method => :patch,
156
- }.merge(options)
157
-
158
- dorsale_button(url, options)
159
- end
160
-
161
- end