symphonia 6.0.6 → 6.1.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 +8 -0
- data/app/helpers/symphonia/application_helper.rb +83 -91
- data/app/models/symphonia/user.rb +1 -1
- data/app/views/symphonia/accounts/_detail.html.erb +1 -1
- data/lib/symphonia/model_attributes/attribute.rb +5 -10
- data/lib/symphonia/model_filters/base.rb +1 -1
- data/lib/symphonia/model_filters/select_filter.rb +1 -1
- data/lib/symphonia/query.rb +2 -2
- data/lib/symphonia/user_management.rb +1 -1
- data/lib/symphonia/version.rb +1 -1
- data/spec/models/query/symphonia_query_spec.rb +0 -4
- data/spec/support/query.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f40862fbc205758764087baab8cd515b3e9d8151bd94dfd6f5b16d6749d6c08c
|
4
|
+
data.tar.gz: '0919daa814b36e912b01f0f1850356476c2d608e6f0d2ccec9c40748f7077fbe'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aff32cf78e520189ca9bf05c441316ca0f202e0ca5c37a115f3dda2c3b50a44583f76eeb43be7fb47fc92b429602352fa8f77df0bc5ba3315a68391d828d30a2
|
7
|
+
data.tar.gz: fe5d80693602fa81ac9f3b2afb0329849c12baf336ab7ac8fe3fc10a3dd2441ef3f07a248bb89225a7d19f5015dd03dd1aade020787d0a6938b6ea68d2278118
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
|
+
## [6.1.0] - 2025-07-01
|
9
|
+
### Changed
|
10
|
+
- use Rails 7.2 as default
|
11
|
+
### Removed
|
12
|
+
- deprecations
|
13
|
+
### Fixed
|
14
|
+
- Rails 7.2 syntax
|
15
|
+
|
8
16
|
## [6.0.6] - 2025-01-19
|
9
17
|
### Removed
|
10
18
|
- gemspec dependencies lock version
|
@@ -19,7 +19,7 @@ module Symphonia
|
|
19
19
|
bootstrap_flash = bootstrap_flash_map[type]
|
20
20
|
s << tag.div(class: "d-print-none alert #{bootstrap_flash[:class_name]} alert-dismissible fade show", role: "alert") do
|
21
21
|
icon(bootstrap_flash[:icon], text: message) +
|
22
|
-
tag.button("", class
|
22
|
+
tag.button("", :class => "btn-close close", :data => { "bs-dismiss" => "alert" }, "aria-label" => t(:button_close))
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -27,13 +27,13 @@ module Symphonia
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def render_menu(menu, options = {})
|
30
|
-
s =
|
30
|
+
s = ""
|
31
31
|
Symphonia::MenuManager.menu(menu).each do |name, item|
|
32
32
|
s << render_menu_node(name, item).to_s
|
33
33
|
end
|
34
|
-
options[:container_class] ||=
|
34
|
+
options[:container_class] ||= "mr-auto"
|
35
35
|
|
36
|
-
tag.ul(s.html_safe, itemscope:
|
36
|
+
tag.ul(s.html_safe, itemscope: "", itemtype: "http://schema.org/BreadcrumbList", class: "navbar-nav #{options[:container_class]}", id: menu.to_s)
|
37
37
|
end
|
38
38
|
|
39
39
|
def render_menu_node(menu, item, options = {})
|
@@ -42,13 +42,13 @@ module Symphonia
|
|
42
42
|
|
43
43
|
selected = @menu_item.to_sym == menu
|
44
44
|
label = case item[:label].class.name
|
45
|
-
when
|
46
|
-
|
47
|
-
when
|
45
|
+
when "NilClass"
|
46
|
+
" ".html_safe
|
47
|
+
when "String"
|
48
48
|
item[:label]
|
49
|
-
when
|
49
|
+
when "Symbol"
|
50
50
|
t(item[:label])
|
51
|
-
when
|
51
|
+
when "Proc"
|
52
52
|
item[:label].call(controller)
|
53
53
|
else
|
54
54
|
raise "MenuManager error: Label is unknown type: #{item[:label].class}"
|
@@ -56,14 +56,14 @@ module Symphonia
|
|
56
56
|
if item[:children].blank?
|
57
57
|
tag.li(render_menu_link(item, label, options), class: "nav-item #{menu} #{'active' if selected} #{options[:class]}", id: item[:id])
|
58
58
|
else
|
59
|
-
children =
|
60
|
-
item[:children].
|
61
|
-
children << render_menu_node(menu, subitem, class:
|
59
|
+
children = ""
|
60
|
+
item[:children].each_value do |subitem|
|
61
|
+
children << render_menu_node(menu, subitem, class: "dropdown-item").to_s
|
62
62
|
end
|
63
63
|
if children.present?
|
64
64
|
tag.li(class: "nav-item dropdown #{menu}") do
|
65
|
-
concat render_menu_link(item.merge({ class:
|
66
|
-
concat tag.ul(children.html_safe, class:
|
65
|
+
concat render_menu_link(item.merge({ class: "dropdown-toggle", data: { toggle: "dropdown" } }), label, { is_submenu: true })
|
66
|
+
concat tag.ul(children.html_safe, class: "dropdown-menu")
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -71,25 +71,25 @@ module Symphonia
|
|
71
71
|
|
72
72
|
def render_menu_link(item, label, _options = {})
|
73
73
|
url = case item[:url].class.name
|
74
|
-
when
|
75
|
-
if item[:url].to_s.include?(
|
76
|
-
endpoint, path = item[:url].to_s.split(
|
74
|
+
when "Symbol"
|
75
|
+
if item[:url].to_s.include?(".")
|
76
|
+
endpoint, path = item[:url].to_s.split(".")
|
77
77
|
send(endpoint).send(path)
|
78
78
|
else
|
79
79
|
main_app.send item[:url]
|
80
80
|
end
|
81
|
-
when
|
81
|
+
when "Proc"
|
82
82
|
item[:url].call(self)
|
83
83
|
else
|
84
84
|
item[:url]
|
85
85
|
end
|
86
86
|
link_to(
|
87
|
-
|
87
|
+
"#{tag.i('', class: item[:icon].to_s)}\n#{tag.span(label, itemprop: 'title')}".html_safe,
|
88
88
|
url,
|
89
89
|
class: "nav-link #{item[:class]}",
|
90
90
|
data: item[:data],
|
91
91
|
method: item[:method],
|
92
|
-
itemprop:
|
92
|
+
itemprop: "url"
|
93
93
|
)
|
94
94
|
end
|
95
95
|
|
@@ -97,7 +97,7 @@ module Symphonia
|
|
97
97
|
if args.empty?
|
98
98
|
title = @html_title || []
|
99
99
|
title << t(:meta_title)
|
100
|
-
title.
|
100
|
+
title.compact_blank.join(" — ")
|
101
101
|
else
|
102
102
|
@html_title ||= []
|
103
103
|
@html_title += args
|
@@ -118,27 +118,27 @@ module Symphonia
|
|
118
118
|
def title(*args, &block)
|
119
119
|
options = args.extract_options!
|
120
120
|
header = args.shift
|
121
|
-
small = args.shift ||
|
121
|
+
small = args.shift || ""
|
122
122
|
header_text = if header.is_a?(Symbol)
|
123
123
|
t(header, default: header.to_s.humanize)
|
124
124
|
else
|
125
125
|
header.to_s.dup
|
126
126
|
end
|
127
127
|
if @symphonia_modal_dialog
|
128
|
-
ActiveSupport::Deprecation.warn "@symphonia_modal_dialog is no used anymore !"
|
128
|
+
ActiveSupport::Deprecation.new.warn "@symphonia_modal_dialog is no used anymore !"
|
129
129
|
@symphonia_modal_dialog.title ||= header_text
|
130
|
-
|
130
|
+
""
|
131
131
|
else
|
132
132
|
html_title(header_text.dup)
|
133
|
-
header_text << ("\n" << tag.small(small, class:
|
134
|
-
s =
|
133
|
+
header_text << ("\n" << tag.small(small, class: "text-muted")) if small.present?
|
134
|
+
s = ""
|
135
135
|
if options[:back] && !request.xhr?
|
136
136
|
back_url = options[:back] unless options[:back].is_a? TrueClass
|
137
137
|
s << link_to_back(back_url)
|
138
138
|
end
|
139
139
|
s << capture(&block).to_s if block_given?
|
140
140
|
header_class = (s.present? && "col-6") || nil
|
141
|
-
header_tag = content_tag((
|
141
|
+
header_tag = content_tag((request.xhr? && :h5) || :h1, id: "page_header", class: header_class) do
|
142
142
|
header_text.html_safe
|
143
143
|
end
|
144
144
|
return header_tag if s.blank?
|
@@ -149,16 +149,16 @@ module Symphonia
|
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
|
-
|
152
|
+
alias page_header title
|
153
153
|
|
154
154
|
def render_no_data(message = nil)
|
155
|
-
tag.div(icon("circle-info", text: message || t(:text_no_data)), class:
|
155
|
+
tag.div(icon("circle-info", text: message || t(:text_no_data)), class: "alert alert-info text-center nodata")
|
156
156
|
end
|
157
157
|
|
158
|
-
def content_for(name, content = nil, &
|
158
|
+
def content_for(name, content = nil, &)
|
159
159
|
@has_content ||= {}
|
160
160
|
@has_content[name] = true
|
161
|
-
super
|
161
|
+
super
|
162
162
|
end
|
163
163
|
|
164
164
|
def has_content?(name)
|
@@ -166,14 +166,14 @@ module Symphonia
|
|
166
166
|
end
|
167
167
|
|
168
168
|
def format_text(text, _options = {})
|
169
|
-
return
|
169
|
+
return "" if text.nil?
|
170
170
|
|
171
171
|
markdown = RDiscount.new(text, :smart, :filter_html)
|
172
172
|
markdown.to_html.html_safe
|
173
173
|
end
|
174
174
|
|
175
175
|
def format_html(text)
|
176
|
-
tag.div((defined?(Ckeditor) ? text.html_safe : format_text(text)), class:
|
176
|
+
tag.div((defined?(Ckeditor) ? text.html_safe : format_text(text)), class: "formatted-text")
|
177
177
|
end
|
178
178
|
|
179
179
|
def format_price(value, options = {})
|
@@ -181,46 +181,45 @@ module Symphonia
|
|
181
181
|
end
|
182
182
|
|
183
183
|
def multiselect_toggler(id = nil)
|
184
|
-
link_to(icon(
|
184
|
+
link_to(icon("plus"), "javascript:void(0);", onclick: "toggleMultiSelect(#{id || 'this'});return false", class: "btn fa fa-border")
|
185
185
|
end
|
186
186
|
|
187
187
|
def link_to_back(url = nil)
|
188
|
-
link_to(icon(:back, t(:button_back)),
|
188
|
+
link_to(icon(:back, t(:button_back)), params[:back_url] || url || :back, class: "btn btn-link back")
|
189
189
|
end
|
190
190
|
|
191
191
|
def link_to_new_entity(options = {})
|
192
|
-
anchor = options.
|
192
|
+
anchor = options.key?(:anchor) ? options.delete(:anchor) : "page_header"
|
193
193
|
label = options.delete(:label) || t("label_#{controller_name.singularize}_new")
|
194
194
|
model = controller.try(:model) || controller_name.singularize
|
195
195
|
url = options.delete(:url) || new_polymorphic_path(model, anchor: anchor)
|
196
196
|
|
197
|
-
link_to(icon(
|
197
|
+
link_to(icon("square-plus", text: label), url, { class: "btn btn-primary" }.merge(options))
|
198
198
|
end
|
199
199
|
|
200
200
|
# change the default link renderer for will_paginate
|
201
201
|
def will_paginate(collection_or_options = nil, options = {})
|
202
202
|
if collection_or_options.is_a? Hash
|
203
|
-
options
|
203
|
+
options = collection_or_options
|
204
|
+
collection_or_options = nil
|
204
205
|
end
|
205
206
|
unless options[:renderer]
|
206
207
|
options = options.merge renderer: Symphonia::BootstrapLinkRender
|
207
208
|
end
|
208
209
|
options[:query] ||= @query if @query
|
209
|
-
super
|
210
|
+
super(*[collection_or_options, options].compact)
|
210
211
|
end
|
211
212
|
|
212
213
|
def ckeditor_for(field_id, options = {})
|
213
|
-
return
|
214
|
+
return "" if defined?(Ckeditor).nil?
|
214
215
|
|
215
216
|
inline = options.delete(:inline)
|
216
|
-
opts = options.
|
217
|
+
opts = options.each_with_object({}) do |var, mem|
|
217
218
|
key = var[0].to_s.camelcase(:lower)
|
218
219
|
key[0].downcase!
|
219
220
|
mem[key] = var[1]
|
220
|
-
|
221
|
-
mem
|
222
221
|
end
|
223
|
-
opts[
|
222
|
+
opts["toolbar"] ||= "Basic"
|
224
223
|
# opts['customConfig'] ||= 'Basic'
|
225
224
|
js = if inline
|
226
225
|
"CKEDITOR.inline('#{field_id}', {toolbar: 'Basic'});"
|
@@ -242,24 +241,19 @@ module Symphonia
|
|
242
241
|
end
|
243
242
|
|
244
243
|
text_content = if text
|
245
|
-
tag.span(text, class:
|
244
|
+
tag.span(text, class: "d-none d-sm-inline")
|
246
245
|
elsif html_options[:text]
|
247
246
|
html_options.delete(:text)
|
248
247
|
end
|
249
248
|
html_options[:title] ||= text
|
250
249
|
html_options[:class] = "fa-solid fa-#{icon}"
|
251
|
-
html_options[
|
250
|
+
html_options["aria-hidden"] ||= true
|
252
251
|
|
253
252
|
html = tag.i(nil, **html_options)
|
254
|
-
html <<
|
253
|
+
html << " " << text_content.to_s if text_content.present?
|
255
254
|
html
|
256
255
|
end
|
257
256
|
|
258
|
-
def fa_icon(fa, options = {})
|
259
|
-
ActiveSupport::Deprecation.warn "use `icon` instead"
|
260
|
-
icon(fa, options.delete(:text), options)
|
261
|
-
end
|
262
|
-
|
263
257
|
# Render original template from engine
|
264
258
|
# Useful for override part of engine view
|
265
259
|
#
|
@@ -277,23 +271,23 @@ module Symphonia
|
|
277
271
|
render template: template
|
278
272
|
end
|
279
273
|
|
280
|
-
def render_symphonia_dialog(*args
|
281
|
-
ActiveSupport::Deprecation.warn "Use `render_modal` instead"
|
274
|
+
def render_symphonia_dialog(*args)
|
275
|
+
ActiveSupport::Deprecation.new.warn "Use `render_modal` instead"
|
282
276
|
options = args.extract_options!
|
283
277
|
title = options[:title] || args.shift # first arg possible `title`
|
284
278
|
body = args.shift
|
285
279
|
options[:form_disabled] = true
|
286
280
|
size = options.delete(:size)
|
287
|
-
size ||=
|
288
|
-
if size.to_s.match(
|
289
|
-
size = size
|
281
|
+
size ||= "90%" if options.delete(:large)
|
282
|
+
if size.to_s.match(/^\d+$/)
|
283
|
+
size = "#{size}%"
|
290
284
|
end
|
291
285
|
@symphonia_modal_dialog = SymphoniaModalDialog.new(self, options)
|
292
286
|
@symphonia_modal_dialog.size = size
|
293
287
|
if block_given?
|
294
288
|
yield @symphonia_modal_dialog
|
295
|
-
|
296
|
-
raise ArgumentError
|
289
|
+
elsif body.nil?
|
290
|
+
raise ArgumentError
|
297
291
|
end
|
298
292
|
@symphonia_modal_dialog.title ||= title
|
299
293
|
if @symphonia_modal_dialog.body.blank?
|
@@ -308,7 +302,7 @@ module Symphonia
|
|
308
302
|
if options[:render_only]
|
309
303
|
html
|
310
304
|
else
|
311
|
-
js = %
|
305
|
+
js = %(
|
312
306
|
$('##{@symphonia_modal_dialog.modal_id}').modal('hide').remove();
|
313
307
|
$('body').append('#{j html}');
|
314
308
|
showModal('##{@symphonia_modal_dialog.modal_id}');
|
@@ -332,16 +326,14 @@ module Symphonia
|
|
332
326
|
# end
|
333
327
|
|
334
328
|
class SymphoniaModalDialog
|
335
|
-
|
336
|
-
|
337
|
-
attr_reader :modal_id
|
338
|
-
|
339
|
-
attr_accessor :size
|
329
|
+
attr_writer :body, :footer
|
330
|
+
attr_accessor :title, :size
|
331
|
+
attr_reader :modal_id
|
340
332
|
|
341
333
|
def initialize(controller, options = {})
|
342
334
|
@c = controller
|
343
335
|
@title = options.delete(:title)
|
344
|
-
@modal_id = options.delete(:id) ||
|
336
|
+
@modal_id = options.delete(:id) || "modal-dialog"
|
345
337
|
@form_options = options.delete(:form_options) || {}
|
346
338
|
@options = options
|
347
339
|
end
|
@@ -350,47 +342,47 @@ module Symphonia
|
|
350
342
|
|
351
343
|
def to_html
|
352
344
|
html = "<div id='#{@modal_id}' style='' class='modal fade' role='dialog'><div class='modal-dialog #{'modal-lg' if size.present?}'><div class='modal-content'>"
|
353
|
-
html << @c.tag.div(class:
|
354
|
-
@c.tag.button(
|
345
|
+
html << @c.tag.div(class: "modal-header") do
|
346
|
+
@c.tag.button("", :class => "close fa fa-times", :data => { dismiss: "modal" }, "aria-hidden" => true) + @c.tag.h4(@title, class: "modal-title") + @header.to_s
|
355
347
|
end
|
356
|
-
content = @c.tag.div(@c.tag.div(body.html_safe, class:
|
357
|
-
content << @c.tag.div(footer.html_safe, class:
|
348
|
+
content = @c.tag.div(@c.tag.div(body.html_safe, class: "modal-content-inner-container container-fluid"), class: "modal-body")
|
349
|
+
content << @c.tag.div(footer.html_safe, class: "modal-footer")
|
358
350
|
|
359
351
|
html << content.html_safe
|
360
|
-
html <<
|
352
|
+
html << "</div></div></div>"
|
361
353
|
html.html_safe
|
362
354
|
end
|
363
355
|
|
364
|
-
def header(&
|
365
|
-
if block_given?
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
356
|
+
def header(&)
|
357
|
+
@header = if block_given?
|
358
|
+
@c.capture(&)
|
359
|
+
else
|
360
|
+
(@header.is_a?(Proc) ? @header.call.to_s : @header.to_s)
|
361
|
+
end
|
370
362
|
end
|
371
363
|
|
372
|
-
def body(&
|
373
|
-
if block_given?
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
364
|
+
def body(&)
|
365
|
+
@body = if block_given?
|
366
|
+
@c.capture(&)
|
367
|
+
else
|
368
|
+
(@body.is_a?(Proc) ? @body.call.to_s : @body.to_s)
|
369
|
+
end
|
378
370
|
end
|
379
371
|
|
380
|
-
def footer(&
|
381
|
-
if block_given?
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
372
|
+
def footer(&)
|
373
|
+
@footer = if block_given?
|
374
|
+
@c.capture(&)
|
375
|
+
else
|
376
|
+
(@footer.is_a?(Proc) ? @footer.call.to_s : @footer.to_s)
|
377
|
+
end
|
386
378
|
end
|
387
379
|
|
388
380
|
def submit(name = nil, options = {})
|
389
381
|
name ||= @c.t(:button_save)
|
390
|
-
@footer = footer.to_s + @c.link_to(name,
|
382
|
+
@footer = footer.to_s + @c.link_to(name, "javascript:void(0)", { onclick: "$('##{@modal_id}').find('form').submit()", class: "btn btn-primary" }.merge(options)).html_safe
|
391
383
|
end
|
392
384
|
|
393
385
|
end
|
386
|
+
|
394
387
|
end
|
395
388
|
end
|
396
|
-
|
@@ -6,7 +6,7 @@ module Symphonia
|
|
6
6
|
|
7
7
|
register_query do
|
8
8
|
add_attribute :login, :link
|
9
|
-
add_attribute :name, :link, sort: %i
|
9
|
+
add_attribute :name, :link, sort: %i[first_name last_name], default: true
|
10
10
|
add_attribute :first_name
|
11
11
|
add_attribute :last_name
|
12
12
|
add_attribute :email, :mail, default: true
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= ActiveSupport::Deprecation.warn "View 'accounts/_detail' partial should not use anymore" %>
|
1
|
+
<%= ActiveSupport::Deprecation.new.warn "View 'accounts/_detail' partial should not use anymore" %>
|
2
2
|
<div class="buttons contextual">
|
3
3
|
<% if Symphonia::User.current.admin? %>
|
4
4
|
<% controller = account.class.name.underscore.pluralize %>
|
@@ -2,7 +2,6 @@ module Symphonia
|
|
2
2
|
module ModelAttributes
|
3
3
|
|
4
4
|
class Attribute
|
5
|
-
|
6
5
|
attr_reader :name, :options, :format_options, :sort_column
|
7
6
|
attr_accessor :filter
|
8
7
|
|
@@ -39,10 +38,10 @@ module Symphonia
|
|
39
38
|
@sort = false
|
40
39
|
when Symbol, Array
|
41
40
|
sort = Array(sort_options).collect { |i| t[i] }
|
42
|
-
asc_desc = { asc: sort.map { |i| i.asc.to_sql }.join(
|
41
|
+
asc_desc = { asc: sort.map { |i| i.asc.to_sql }.join(","), desc: sort.map { |i| i.desc.to_sql }.join(",") }
|
43
42
|
@sort_column = SortableTable::SortColumnCustomDefinition.new(@name, asc_desc)
|
44
43
|
when String
|
45
|
-
asc_desc = { asc: sort_options
|
44
|
+
asc_desc = { asc: "#{sort_options} ASC", desc: "#{sort_options} DESC" }
|
46
45
|
@sort_column = SortableTable::SortColumnCustomDefinition.new(@name, asc_desc)
|
47
46
|
else
|
48
47
|
raise "Undefined `sort_options` type: #{sort_options.class.name}"
|
@@ -61,9 +60,7 @@ module Symphonia
|
|
61
60
|
!!@options[:default]
|
62
61
|
end
|
63
62
|
|
64
|
-
def required
|
65
|
-
|
66
|
-
end
|
63
|
+
def required?; end
|
67
64
|
|
68
65
|
def input_field
|
69
66
|
:text_field
|
@@ -81,7 +78,6 @@ module Symphonia
|
|
81
78
|
|
82
79
|
end
|
83
80
|
|
84
|
-
|
85
81
|
class TextAttribute < Attribute
|
86
82
|
|
87
83
|
def format_value(view, value, _entity)
|
@@ -143,7 +139,6 @@ module Symphonia
|
|
143
139
|
else
|
144
140
|
super
|
145
141
|
end
|
146
|
-
|
147
142
|
end
|
148
143
|
|
149
144
|
def format_value(view, value, _entity)
|
@@ -164,9 +159,9 @@ module Symphonia
|
|
164
159
|
|
165
160
|
def format_value(view, value, _entity)
|
166
161
|
if value.to_s == "true"
|
167
|
-
view.icon(
|
162
|
+
view.icon("true", view.t(true))
|
168
163
|
else
|
169
|
-
view.icon(
|
164
|
+
view.icon("false", view.t(false))
|
170
165
|
end
|
171
166
|
end
|
172
167
|
|
@@ -8,7 +8,7 @@ module Symphonia
|
|
8
8
|
# @param [Hash] options
|
9
9
|
def initialize(attribute, query, options = {})
|
10
10
|
if attribute.is_a? String
|
11
|
-
ActiveSupport::Deprecation.warn("name as argument is no longer supported - use Attribute")
|
11
|
+
ActiveSupport::Deprecation.new.warn("name as argument is no longer supported - use Attribute")
|
12
12
|
@name = attribute
|
13
13
|
else
|
14
14
|
@name = attribute.name
|
@@ -45,7 +45,7 @@ module Symphonia
|
|
45
45
|
context.select_tag("#{form_field_name}[]", context.options_for_select(available_values, selected),
|
46
46
|
class: 'form-control', include_blank: true, multiple: selected.size > 1) +
|
47
47
|
context.content_tag(:div,
|
48
|
-
context.link_to(context.
|
48
|
+
context.link_to(context.icon('plus-square-o'), 'javascript:void(0)', onclick: "toggleMultiSelect($(this).closest('.input-group').find('select'))", title: I18n.t(:title_toggle_multiselect), class: "input-group-text"), class: 'input-group-append')
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
data/lib/symphonia/query.rb
CHANGED
@@ -18,13 +18,13 @@ module Symphonia
|
|
18
18
|
# @param [nil, Array] columns
|
19
19
|
def initialize(c = nil, sort: "", filters: {}, columns: nil, **options)
|
20
20
|
if c
|
21
|
-
|
21
|
+
raise("initialize allow only hash. #{c} - update your controller:")
|
22
22
|
#
|
23
23
|
# model.query.new sort: "default sort", filters: {default: filter}, columns: [columns, names]
|
24
24
|
# @query.from_params params
|
25
25
|
#
|
26
26
|
end
|
27
|
-
|
27
|
+
raise("default_order is deprecated, use just `sort`") if options[:default_order]
|
28
28
|
@active_filters = {}
|
29
29
|
@default_sort = sort
|
30
30
|
@default_filters = filters
|
data/lib/symphonia/version.rb
CHANGED
@@ -28,10 +28,6 @@ RSpec.describe Symphonia::Query do
|
|
28
28
|
expect(filter.value).to eq "cip"
|
29
29
|
end
|
30
30
|
|
31
|
-
it "legacy fallback" do
|
32
|
-
expect(ActiveSupport::Deprecation).to receive(:warn).twice
|
33
|
-
described_class.new(spy("Controller"), default_order: "cip")
|
34
|
-
end
|
35
31
|
end
|
36
32
|
|
37
33
|
describe "#from_params" do
|
data/spec/support/query.rb
CHANGED
@@ -24,7 +24,7 @@ class DummyQueryEntity
|
|
24
24
|
end
|
25
25
|
|
26
26
|
register_query do
|
27
|
-
add_attribute :name, :link, sort:
|
27
|
+
add_attribute :name, :link, sort: "first_name ASC, last_name DESC", default: true, filter: "string"
|
28
28
|
add_attribute :status, :enum, default: true, filter: "select"
|
29
29
|
add_attribute :author, sort: false, default: true
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symphonia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Pokorny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01
|
11
|
+
date: 2025-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: api-pagination
|
@@ -396,7 +396,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
396
396
|
- !ruby/object:Gem::Version
|
397
397
|
version: '0'
|
398
398
|
requirements: []
|
399
|
-
rubygems_version: 3.5.
|
399
|
+
rubygems_version: 3.5.22
|
400
400
|
signing_key:
|
401
401
|
specification_version: 4
|
402
402
|
summary: My administration
|