symphonia 5.0.6 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8947cb70c08f93cb874449e18be3a0f79545f8756bf7f48861fc3974ca23c495
4
- data.tar.gz: a5c91c6dff667e883e43c1c88a265e0408da0d37847637215c15ee943033764b
3
+ metadata.gz: e5e174021378849dc3fd8cbe38f9b407c140d93aadea592e7fd532385ecc02e6
4
+ data.tar.gz: 0ac31c792dbbf173f3fd765225bd315b60bf9c9ef7bdd7f9032fd30e06f998dc
5
5
  SHA512:
6
- metadata.gz: 42254ebb4980586ae51c447fb44940932c49b67e7ffbdf36dc326062af40a8d0062dd6397bf670b9b790335d00e8a280f49ec295a2539aaaaa596ea527774f81
7
- data.tar.gz: 27c87d67823e9351f92856298b9340c803617fad36e28d238d3ea05a6bddd6e057d0460b4d760cc0888d53fa8f54a42417eac6b42482e4cca7cc4ea21ce85684
6
+ metadata.gz: a87909e917f27627228a90ae3125c08334ab391542ebb1ae1e1cf0415c2935365c3ad8cec30e3f41ca7028c250aac42839533e8ee85c316f1f8ef8208ad0cf5d
7
+ data.tar.gz: ff8e4ddd13b3ba30ec4db1cfd2a2b789da0ee6a97d2787a77ca0fb5878e78bce744a282e9aa19b099a8813ea0e6551374488273899744b9906c7fd72858ecd5a
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ 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.0.0] - 2023-07-11
9
+ ### Changed
10
+ - Upgrade to Rails 7
11
+
8
12
  ## [5.0.6] - 2023-04-29
9
13
  ### Changed
10
14
  - modal `large` = "modal-xl"
@@ -9,13 +9,13 @@ Number.prototype.pad = function (size) {
9
9
  return s;
10
10
  };
11
11
 
12
- $(document).on('ajaxSend', function (event, request, settings) {
13
- $('#ajax-indicator').fadeIn('fast');
14
- });
15
-
16
- $(document).on('ajaxComplete', function (event, request, settings) {
17
- $('#ajax-indicator').fadeOut('fast');
18
- });
12
+ // $(document).on('ajaxSend', function (event, request, settings) {
13
+ // $('#ajax-indicator').fadeIn('fast');
14
+ // });
15
+ //
16
+ // $(document).on('ajaxComplete', function (event, request, settings) {
17
+ // $('#ajax-indicator').fadeOut('fast');
18
+ // });
19
19
  window.Symphonia = {
20
20
  routes: {},
21
21
 
@@ -95,35 +95,6 @@ $(document).on('click', 'input.symphonia-query-submit-button', function (event)
95
95
  });
96
96
  form.submit();
97
97
  });
98
- Symphonia.filters = {
99
- search: function (el) {
100
- if (!!el.value) {
101
- if (el.dataset.remote) {
102
- var data = {};
103
- data[el.name] = el.value;
104
- $.get(window.location.pathname, data, function (response) {
105
- document.getElementById("main").innerHTML = response;
106
- })
107
- } else {
108
- window.location.search = "?" + el.name + "=" + encodeURIComponent(el.value);
109
- }
110
-
111
- }
112
- },
113
- resetSearch: function (el) {
114
- if (el.dataset.remote) {
115
- $.get(window.location.pathname, {}, function (response) {
116
- document.getElementById("main").innerHTML = response;
117
- })
118
- } else {
119
- window.location.search = '';
120
- }
121
- },
122
- removeRow: function (id) {
123
- var el = document.getElementById(id);
124
- el.remove();
125
- }
126
- }
127
98
  function submitSymphoniaForm(formId) {
128
99
  console.debug('submitSymphoniaForm in window will remove');
129
100
  SymphoniaFilters.submit(formId);
@@ -41,4 +41,35 @@ SymphoniaFilter.prototype.dateFilterCallback = function(element) {
41
41
  } else {
42
42
  window.Symphonia.toggle(element.nextElementSibling, false)
43
43
  }
44
- };
44
+ };
45
+
46
+ window.Symphonia || (window.Symphonia = {});
47
+ window.Symphonia.filters = {
48
+ search: function (el) {
49
+ if (!!el.value) {
50
+ if (el.dataset.remote) {
51
+ var data = {};
52
+ data[el.name] = el.value;
53
+ $.get(window.location.pathname, data, function (response) {
54
+ document.getElementById("main").innerHTML = response;
55
+ })
56
+ } else {
57
+ window.location.search = "?" + el.name + "=" + encodeURIComponent(el.value);
58
+ }
59
+
60
+ }
61
+ },
62
+ resetSearch: function (el) {
63
+ if (el.dataset.remote) {
64
+ $.get(window.location.pathname, {}, function (response) {
65
+ document.getElementById("main").innerHTML = response;
66
+ })
67
+ } else {
68
+ window.location.search = '';
69
+ }
70
+ },
71
+ removeRow: function (id) {
72
+ var el = document.getElementById(id);
73
+ el.remove();
74
+ }
75
+ }
@@ -271,7 +271,7 @@ module Symphonia
271
271
  # @param [String] template_name
272
272
  # @param [Class<Symphonia::Engine>] engine
273
273
  # @param [String] format
274
- def render_super(template_name, engine: Symphonia::Engine, format: "html")
274
+ def render_super(template_name, engine: Symphonia::Engine, format: :html)
275
275
  resolver = lookup_context.view_paths.paths.find do |resolver|
276
276
  resolver.path == engine.root.join("app", "views").to_s
277
277
  end
@@ -6,7 +6,7 @@
6
6
  <div class="card w-75 mx-auto">
7
7
  <div class="card-body">
8
8
  <%= symphonia_form_for(@user, url: account_register_path) do |f| %>
9
- <div style="width:1px;height: 1px;visibility: hidden"><%= check_box_tag :terms, true %></div>
9
+ <div style="width:1px;height: 1px;visibility: hidden"><%= check_box_tag :terms %></div>
10
10
  <%= f.error_messages %>
11
11
  <%= f.text_field :name, required: true, autocomplete: "off", prepend: icon("user") %>
12
12
  <%= f.email_field :mail, required: true, autocomplete: "username", prepend: "@" %>
@@ -4,7 +4,7 @@
4
4
  <% if @query.search? %>
5
5
  <div class="col-sm-12">
6
6
  <div class="input-group input-group-sm">
7
- <%= search_field_tag(:q, params[:q], class: 'form-control input-sm', id: 'symphonia_query_q', placeholder: t(:label_search), autofocus: params[:q].present? || nil, data: { remote: local_assigns[:remote] }, onchange: 'submitSymphoniaQueryQ(this)') %>
7
+ <%= search_field_tag(:q, params[:q], class: 'form-control input-sm', id: 'symphonia_query_q', placeholder: t(:label_search), autofocus: params[:q].present? || nil, data: { remote: local_assigns[:remote] }, onchange: 'Symphonia.filters.search(this);') %>
8
8
  <div class="input-group-append">
9
9
  <div class="input-group-text">
10
10
  <%= link_to(icon('search'), 'javascript:void(0)', { onclick: 'Symphonia.filters.search(document.getElementById("symphonia_query_q"))', title: t(:button_search) }) %>
@@ -35,32 +35,22 @@ module Symphonia
35
35
  @options[:query] && @options[:query].to_params || {}
36
36
  end
37
37
 
38
- def url(page)
39
- @base_url_params ||= begin
40
- url_params = merge_get_params(default_url_params)
41
- url_params[:only_path] = true
42
- merge_optional_params(url_params)
43
- end
44
-
45
- @template.url_for(@base_url_params.merge({:page => page}))
46
- end
47
-
48
38
  def page_number(page)
49
39
  link_options = @options[:link_options] || {}
50
-
40
+ aria_label = @template.will_paginate_translate(:page_aria_label, :page => page.to_i) { "Page #{page}" }
51
41
  if page == current_page
52
- tag(:span, page, class: 'page-link current_page')
42
+ tag(:span, page, :class => 'page-link current_page current', :"aria-label" => aria_label, :"aria-current" => 'page')
53
43
  else
54
44
  link_options.merge! class: 'page-link', rel: rel_value(page)
55
- link(page, page, {:'data-remote' => @options[:remote]}.merge(link_options))
45
+ link(page, page, {:'data-remote' => @options[:remote], :"aria-label" => aria_label}.merge(link_options))
56
46
  end
57
47
  end
58
48
 
59
- def previous_or_next_page(page, text, classname)
49
+ def previous_or_next_page(page, text, classname, aria_label = nil)
60
50
  if page
61
- link(text, page, :'data-remote' => @options[:remote], class: "page-link #{classname}")
51
+ link(text, page, :'data-remote' => @options[:remote], :'aria-label' => aria_label, class: "page-link #{classname}")
62
52
  else
63
- tag(:span, text, class: "page-link #{classname} disabled")
53
+ tag(:span, text, class: "page-link #{classname} disabled", :'aria-label' => aria_label)
64
54
  end
65
55
  end
66
56
 
@@ -1,5 +1,3 @@
1
- require 'symphonia/object'
2
-
3
1
  require 'authlogic'
4
2
  require 'cancancan'
5
3
  require 'scrypt'
@@ -163,7 +163,7 @@ module Symphonia
163
163
  class BooleanAttribute < Attribute
164
164
 
165
165
  def format_value(view, value, _entity)
166
- if value.to_boolean
166
+ if value.to_s == "true"
167
167
  view.icon('true', view.t(:true))
168
168
  else
169
169
  view.icon('false', view.t(:false))
@@ -70,7 +70,7 @@ module Symphonia
70
70
  }) +
71
71
  # context.content_tag(:span, context.t('query_options.filter_date.to'), class: 'input-group-addon')+
72
72
  context.date_field_tag("#{form_field_name}_custom[from]", '', {
73
- placeholder: _c.t('query_options.filter_date.from'),
73
+ placeholder: context.t('query_options.filter_date.from'),
74
74
  class: 'form-control datepicker',
75
75
  })
76
76
  end
@@ -40,7 +40,7 @@ module Symphonia
40
40
  @sort_col, @sort_dir = params[:sort]&.split(":")
41
41
  @sort_dir ||= params[:direction]
42
42
  self.entity_scope = entity.like(@q) if (@q = params[:q].presence)
43
- setup_filters(params) if (@set_filter = params[:set_filter].to_boolean)
43
+ setup_filters(params) if (@set_filter = params[:set_filter].to_s == "1")
44
44
  setup_columns(params)
45
45
  end
46
46
 
@@ -167,9 +167,7 @@ module Symphonia
167
167
  if @q
168
168
  { q: @q }
169
169
  elsif @set_filter || force
170
- filters.inject(set_filter: 1) do |(f, v), mem|
171
- mem[f.send(:form_field_name).to_sym] = v
172
- end
170
+ filters.each_with_object(set_filter: 1) { |var, mem| f, v = var; mem[f.send(:form_field_name).to_sym] = v; }
173
171
  else
174
172
  {}
175
173
  end
@@ -1,5 +1,5 @@
1
1
  module Symphonia
2
2
 
3
- VERSION = '5.0.6'
3
+ VERSION = '6.0.0'
4
4
 
5
5
  end
data/spec/spec_helper.rb CHANGED
@@ -39,13 +39,11 @@ RSpec.configure do |config|
39
39
  config.include Authlogic::TestCase
40
40
 
41
41
  config.before(:suite) do
42
- DatabaseCleaner.strategy = :transaction
43
42
  DatabaseCleaner.clean_with(:truncation, except: %w[ar_internal_metadata])
44
43
  end
45
44
 
46
45
  config.before(:each) do
47
46
  DatabaseCleaner.strategy = :transaction
48
- Rails.application.config.action_mailer.delivery_method = :test
49
47
  Symphonia::User.current = nil
50
48
  end
51
49
 
@@ -61,7 +59,6 @@ RSpec.configure do |config|
61
59
  end
62
60
 
63
61
  config.before(:each) do
64
- ActiveJob::Base.queue_adapter = :test
65
62
  DatabaseCleaner.start
66
63
  end
67
64
 
@@ -5,10 +5,11 @@ RSpec.describe "symphonia/filters/options.html.erb" do
5
5
  q.model = DummyQueryEntity
6
6
  q
7
7
  end
8
+
8
9
  it "render" do
9
10
  assign(:query, query)
10
11
  params[:path] = "/"
11
- render
12
+ render template: "symphonia/filters/options"
12
13
  expect(rendered).to include "form", "checked"
13
14
  end
14
15
  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: 5.0.6
4
+ version: 6.0.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: 2023-04-29 00:00:00.000000000 Z
11
+ date: 2023-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: api-pagination
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.7.0
19
+ version: '4.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 4.7.0
26
+ version: '4.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: authlogic
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 6.4.0
33
+ version: '6.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 6.4.0
40
+ version: '6.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap_form
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 4.4.0
47
+ version: '4.4'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 4.4.0
54
+ version: '4.4'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: cancancan
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,62 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.3.1
83
- - !ruby/object:Gem::Dependency
84
- name: net-pop
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 0.1.1
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 0.1.1
97
- - !ruby/object:Gem::Dependency
98
- name: net-imap
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 0.2.3
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 0.2.3
111
- - !ruby/object:Gem::Dependency
112
- name: rails
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '6'
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '6'
125
83
  - !ruby/object:Gem::Dependency
126
84
  name: rails-i18n
127
85
  requirement: !ruby/object:Gem::Requirement
128
86
  requirements:
129
87
  - - "~>"
130
88
  - !ruby/object:Gem::Version
131
- version: '6.0'
89
+ version: '7.0'
132
90
  type: :runtime
133
91
  prerelease: false
134
92
  version_requirements: !ruby/object:Gem::Requirement
135
93
  requirements:
136
94
  - - "~>"
137
95
  - !ruby/object:Gem::Version
138
- version: '6.0'
96
+ version: '7.0'
139
97
  - !ruby/object:Gem::Dependency
140
98
  name: rake
141
99
  requirement: !ruby/object:Gem::Requirement
@@ -154,16 +112,16 @@ dependencies:
154
112
  name: rdiscount
155
113
  requirement: !ruby/object:Gem::Requirement
156
114
  requirements:
157
- - - ">="
115
+ - - "~>"
158
116
  - !ruby/object:Gem::Version
159
- version: '0'
117
+ version: '2.2'
160
118
  type: :runtime
161
119
  prerelease: false
162
120
  version_requirements: !ruby/object:Gem::Requirement
163
121
  requirements:
164
- - - ">="
122
+ - - "~>"
165
123
  - !ruby/object:Gem::Version
166
- version: '0'
124
+ version: '2.2'
167
125
  - !ruby/object:Gem::Dependency
168
126
  name: scrypt
169
127
  requirement: !ruby/object:Gem::Requirement
@@ -184,28 +142,28 @@ dependencies:
184
142
  requirements:
185
143
  - - "~>"
186
144
  - !ruby/object:Gem::Version
187
- version: '6.5'
145
+ version: '7.1'
188
146
  type: :runtime
189
147
  prerelease: false
190
148
  version_requirements: !ruby/object:Gem::Requirement
191
149
  requirements:
192
150
  - - "~>"
193
151
  - !ruby/object:Gem::Version
194
- version: '6.5'
152
+ version: '7.1'
195
153
  - !ruby/object:Gem::Dependency
196
154
  name: sidekiq-cron
197
155
  requirement: !ruby/object:Gem::Requirement
198
156
  requirements:
199
157
  - - "~>"
200
158
  - !ruby/object:Gem::Version
201
- version: '1.7'
159
+ version: '1.10'
202
160
  type: :runtime
203
161
  prerelease: false
204
162
  version_requirements: !ruby/object:Gem::Requirement
205
163
  requirements:
206
164
  - - "~>"
207
165
  - !ruby/object:Gem::Version
208
- version: '1.7'
166
+ version: '1.10'
209
167
  - !ruby/object:Gem::Dependency
210
168
  name: sortable-table
211
169
  requirement: !ruby/object:Gem::Requirement
@@ -226,14 +184,14 @@ dependencies:
226
184
  requirements:
227
185
  - - "~>"
228
186
  - !ruby/object:Gem::Version
229
- version: 3.3.0
187
+ version: '4.0'
230
188
  type: :runtime
231
189
  prerelease: false
232
190
  version_requirements: !ruby/object:Gem::Requirement
233
191
  requirements:
234
192
  - - "~>"
235
193
  - !ruby/object:Gem::Version
236
- version: 3.3.0
194
+ version: '4.0'
237
195
  description: Basis of my applications
238
196
  email:
239
197
  - admin@luk4s.cz
@@ -382,7 +340,6 @@ files:
382
340
  - lib/symphonia/model_filters/integer_filter.rb
383
341
  - lib/symphonia/model_filters/select_filter.rb
384
342
  - lib/symphonia/model_filters/string_filter.rb
385
- - lib/symphonia/object.rb
386
343
  - lib/symphonia/query.rb
387
344
  - lib/symphonia/query_columns.rb
388
345
  - lib/symphonia/query_columns/attribute_column.rb
@@ -439,7 +396,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
439
396
  - !ruby/object:Gem::Version
440
397
  version: '0'
441
398
  requirements: []
442
- rubygems_version: 3.4.6
399
+ rubygems_version: 3.4.16
443
400
  signing_key:
444
401
  specification_version: 4
445
402
  summary: My administration
@@ -1,31 +0,0 @@
1
- class String
2
-
3
- def to_boolean
4
- ['true', 1, '1', 'yes', 't', 'y'].include?(downcase)
5
- end
6
-
7
- end
8
-
9
- class NilClass
10
-
11
- def to_boolean
12
- false
13
- end
14
-
15
- end
16
-
17
- class FalseClass
18
-
19
- def to_boolean
20
- false
21
- end
22
-
23
- end
24
-
25
- class TrueClass
26
-
27
- def to_boolean
28
- true
29
- end
30
-
31
- end