symphonia 2.1.7 → 2.1.8
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/app/assets/stylesheets/symphonia/basic.scss +4 -2
- data/app/helpers/symphonia/bootstrap_modal_helper.rb +5 -5
- data/app/helpers/symphonia/renderer_helper.rb +6 -0
- data/app/views/layouts/symphonia/_query.html.erb +1 -1
- data/lib/symphonia/base_controller.rb +3 -3
- data/lib/symphonia/user_management.rb +0 -6
- data/lib/symphonia/version.rb +1 -2
- data/spec/helpers/symphonia/application_helper_spec.rb +3 -3
- data/spec/helpers/symphonia/renderer_helper_spec.rb +11 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6da447b65e8df134e762dd99e232857836329c8a242d16566c6ef5f1d8295d2f
|
4
|
+
data.tar.gz: de6d595aade9877cc75469461c0224f9b1b9ed4835aa165a1be27882fa2718ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 229511c5b388840de246acec21ffb3051628a5fa54627745fa8806e766071078d38bc5c5087a15c0d78a1d163bdef4df49bb39f2c44521817c2105a7520ff7f2
|
7
|
+
data.tar.gz: 6fa7d0ccde1636f9098cc0b472fb2dd166261607d2be17953cdc9df092d99aa5bffa03adefd123231a2dba6c9fb61e28737a24bdd0de7a9ffb2e7a6e013ff8cd
|
@@ -191,8 +191,10 @@ table.table {
|
|
191
191
|
content: "\2193";
|
192
192
|
}
|
193
193
|
}
|
194
|
-
tr.
|
195
|
-
|
194
|
+
tr.status {
|
195
|
+
&--lock, &--inactive, &--archived {
|
196
|
+
@include inactive-row;
|
197
|
+
}
|
196
198
|
}
|
197
199
|
.buttons {
|
198
200
|
text-align: right;
|
@@ -19,7 +19,6 @@ module Symphonia
|
|
19
19
|
# <% end -%>
|
20
20
|
|
21
21
|
|
22
|
-
|
23
22
|
#
|
24
23
|
def render_modal(options = {}, &block)
|
25
24
|
opts = options.slice(:id, :title, :submit, :large)
|
@@ -33,9 +32,10 @@ module Symphonia
|
|
33
32
|
var renderModal = {}
|
34
33
|
if (renderModal["#{id}"])
|
35
34
|
renderModal["#{id}"].destroy();
|
36
|
-
|
37
|
-
|
38
|
-
renderModal["#{id}"].body.innerHTML = "#{j(capture(&block))}";
|
35
|
+
renderModal["#{id}"] = new SymphoniaDialog("#{id}", #{raw opts.to_json});
|
36
|
+
SCRIPT
|
37
|
+
script << %Q{ renderModal["#{id}"].body.innerHTML = "#{j(capture(&block))}"; } if block_given?
|
38
|
+
script << <<SCRIPT
|
39
39
|
var submitButton = renderModal["#{id}"].body.querySelector("input[type=submit]")
|
40
40
|
if (submitButton)
|
41
41
|
submitButton.remove()
|
@@ -50,7 +50,7 @@ SCRIPT
|
|
50
50
|
}
|
51
51
|
EOF
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
script << %Q{renderModal["#{id}"].show();} unless opts.has_key?(:render_only)
|
55
55
|
script.html_safe
|
56
56
|
end
|
@@ -74,6 +74,12 @@ module Symphonia
|
|
74
74
|
@_c.link_to title, query.to_params.merge(sort_params), options.merge({ class: css_class })
|
75
75
|
end
|
76
76
|
|
77
|
+
def css_classes(entity)
|
78
|
+
css = []
|
79
|
+
css << "status--#{entity.status}" if entity.respond_to?(:status)
|
80
|
+
css.join("__") + entity.try(:css_classes).to_s
|
81
|
+
end
|
82
|
+
|
77
83
|
private
|
78
84
|
|
79
85
|
def t(*args)
|
@@ -31,7 +31,7 @@
|
|
31
31
|
</thead>
|
32
32
|
<tbody>
|
33
33
|
<% entities.each do |entity| %>
|
34
|
-
<tr id="<%= dom_id(entity) %>" class="<%= cycle('odd', 'even') %> <%=
|
34
|
+
<tr id="<%= dom_id(entity) %>" class="<%= cycle('odd', 'even') %> <%= renderer.css_classes(entity) %>">
|
35
35
|
<%= content_tag(:td, check_box_tag('ids[]', entity.id), class: "px-0") if renderer.show_checkboxes? %>
|
36
36
|
<%= content_tag(:td, radio_button_tag('id', entity.id)) if renderer.show_radios? %>
|
37
37
|
<% renderer.query.columns.each do |column| %>
|
@@ -44,7 +44,7 @@ module Symphonia
|
|
44
44
|
@entity ||= instance_variable_set(:"@#{model_name}", model.new(entity_params))
|
45
45
|
respond_to do |format|
|
46
46
|
if @entity.save
|
47
|
-
format.html {
|
47
|
+
format.html { redirect_back_or_default @entity, notice: t(:text_created) }
|
48
48
|
format.json { render json: @entity, status: :created, location: @entity }
|
49
49
|
else
|
50
50
|
format.html { render action: 'new' }
|
@@ -56,7 +56,7 @@ module Symphonia
|
|
56
56
|
def update
|
57
57
|
respond_to do |format|
|
58
58
|
if @entity.update(entity_params)
|
59
|
-
format.html {
|
59
|
+
format.html { redirect_back_or_default @entity, notice: t(:text_updated) }
|
60
60
|
format.json { head :no_content }
|
61
61
|
else
|
62
62
|
format.html { render action: 'edit' }
|
@@ -68,7 +68,7 @@ module Symphonia
|
|
68
68
|
def destroy
|
69
69
|
@entity.destroy
|
70
70
|
respond_to do |format|
|
71
|
-
format.html {
|
71
|
+
format.html { redirect_back_or_default(action: :index, notice: t(:text_destroyed)) }
|
72
72
|
format.json { head :no_content }
|
73
73
|
format.js { render js: "Symphonia.filters.removeRow('#{view_context.dom_id(@entity)}')"}
|
74
74
|
end
|
data/lib/symphonia/version.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
RSpec.describe Symphonia::ApplicationHelper do
|
2
2
|
describe "#title" do
|
3
3
|
it "returns the default title" do
|
4
|
-
expect(helper.title("Holub")).to match /<(h1)\s.*id=\Wpage_header\W
|
4
|
+
expect(helper.title("Holub")).to match /<(h1)\s.*id=\Wpage_header\W.*Holub<\/\1>/
|
5
5
|
end
|
6
6
|
|
7
7
|
it "with symbol" do
|
8
|
-
expect(helper.title(:title)).to match /<(h1)\s.*id=\Wpage_header\W
|
8
|
+
expect(helper.title(:title)).to match /<(h1)\s.*id=\Wpage_header\W.*Title<\/\1>/
|
9
9
|
end
|
10
10
|
|
11
11
|
it "with back" do
|
@@ -18,7 +18,7 @@ RSpec.describe Symphonia::ApplicationHelper do
|
|
18
18
|
|
19
19
|
it "xhr without back" do
|
20
20
|
allow(helper.request).to receive(:xhr?).and_return true
|
21
|
-
expect(helper.title("Head", back: true)).to match /<(h5)\s.*id=\Wpage_header\W
|
21
|
+
expect(helper.title("Head", back: true)).to match /<(h5)\s.*id=\Wpage_header\W.*Head<\/\1>/
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
RSpec.describe Symphonia::RendererHelper::QueryRender do
|
2
|
+
let(:user) { FactoryBot.create :user }
|
3
|
+
let(:query) { spy("Query") }
|
4
|
+
subject { described_class.new helper, query }
|
5
|
+
describe "#css_classes" do
|
6
|
+
it "active" do
|
7
|
+
expect(subject.css_classes(user)).to eq "status--active"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symphonia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Pokorny
|
@@ -614,6 +614,7 @@ files:
|
|
614
614
|
- spec/controllers/users_controller_spec.rb
|
615
615
|
- spec/factories/factories.rb
|
616
616
|
- spec/helpers/symphonia/application_helper_spec.rb
|
617
|
+
- spec/helpers/symphonia/renderer_helper_spec.rb
|
617
618
|
- spec/mailers/previews/symphonia/notifier_preview.rb
|
618
619
|
- spec/mailers/symphonia/notifier_spec.rb
|
619
620
|
- spec/models/attachment_spec.rb
|
@@ -695,3 +696,4 @@ test_files:
|
|
695
696
|
- spec/views/filters/options.html.erb_spec.rb
|
696
697
|
- spec/rails_helper.rb
|
697
698
|
- spec/helpers/symphonia/application_helper_spec.rb
|
699
|
+
- spec/helpers/symphonia/renderer_helper_spec.rb
|