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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f11e4c634f33feaaed8c452d7bea7a3c16b8402ad58227f60f99c8ef91c8fe2
4
- data.tar.gz: ecb67096fcba06756c84c8e21144dfe0149a6d7a1cb5268b051219dad82d39d4
3
+ metadata.gz: 6da447b65e8df134e762dd99e232857836329c8a242d16566c6ef5f1d8295d2f
4
+ data.tar.gz: de6d595aade9877cc75469461c0224f9b1b9ed4835aa165a1be27882fa2718ad
5
5
  SHA512:
6
- metadata.gz: 3130915024e08e2963761800157c54bde18544a2df52b932b5419118ea170f457b2d279dbeb99164acbccaa5da42ef32942ae56dd41e7403325d25434f3045a1
7
- data.tar.gz: f9dce86610580b43089b8df943d4f928288d152375f50314c4fe3142ce512b974ef6c4cf9ce811a51f751e08560c093a40472ffbd2e1762f7283a7910e37abdc
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.lock, tr.inactive, tr.archived {
195
- @include inactive-row;
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
- renderModal["#{id}"] = new SymphoniaDialog("#{id}", #{raw opts.to_json});
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
- # script << %q{}
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') %> <%= entity.try(:css_classes) %>">
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 { redirect_to @entity, notice: t(:text_created) }
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 { redirect_to @entity, notice: t(:text_updated) }
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 { redirect_to(action: :index, notice: t(:text_destroyed)) }
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
@@ -47,12 +47,6 @@ module Symphonia
47
47
 
48
48
  alias_method :activate!, :unarchive!
49
49
 
50
- def css_classes
51
- css = ''
52
- css << ' -active' if self.active?
53
- css << ' lock' if self.lock?
54
- css
55
- end
56
50
  end
57
51
  end
58
52
  end
@@ -1,4 +1,3 @@
1
1
  module Symphonia
2
- VERSION = '2.1.7'
3
- VERSION_NAME = '2019.03.31'
2
+ VERSION = '2.1.8'
4
3
  end
@@ -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\s.*Holub<\/\1>/
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\s.*Title<\/\1>/
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\s.*Head<\/\1>/
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.7
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