snaptable 0.4.2 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d90948e9e4ed20529bb677f38a20a20870f4e7e
4
- data.tar.gz: 64b84059140e0aa2bb8f016dc254de78972f024b
3
+ metadata.gz: 6fecbb61f1141258e372e2d8dc713f6d273352b5
4
+ data.tar.gz: 11d814cbbcd28fa7ed71500d6331ae21fff3ebf0
5
5
  SHA512:
6
- metadata.gz: 9cc953f194fd841a1c2d5cbb16f735ef32d1e356b7bfdcac37869cb2036b28fc4ec2c1098e7fbc9037f55662f3dedf223268f5d64eca07503f3521ec7f620bd4
7
- data.tar.gz: 5926bb8d3b316bb45408b58267966fd505a0832775ab6f72466bee2121f9803d0ed2b7642cf2da3b7652c1097a2b6fa9e41bd5712559742de80435362e875a1b
6
+ metadata.gz: a9702523725f556ebed78dbd9053105622388c7b2fb915cf1bd65a7faf69207049d50bb65c89ecf28f83d88c36d5ec89b63ab88553d380ff17d9db37d7b61c84
7
+ data.tar.gz: 730111fa1fb953316097e5a38f9b78344f44aa804baeeb8021a3f76d45693e064598301a297d042f724ae3ce0df2edacda0869059e5b6fec1b61928abba69164
data/README.md CHANGED
@@ -67,6 +67,14 @@ Pass the options in the fourth argument. Here is a list:
67
67
  Table.new(self, Article, nil, { search: true, buttons: false })
68
68
  ```
69
69
 
70
+ You can also configure the table in the view. The `present` method takes a single named argument to let you add a custom buttons bar. Pass the name of a partial to the parameter `buttons` and the content will be added above the table.
71
+
72
+ ```erb
73
+ <div>
74
+ <%= @table.present(buttons: "my_custom_partial") %>
75
+ </div>
76
+ ```
77
+
70
78
  ### Custom class
71
79
 
72
80
  If you need more control on the displayed fields or on the search, you can easily create your own table.
@@ -1,7 +1,13 @@
1
1
  <div id="snaptable">
2
+ <%= render 'snaptable/search_field' if presenter.options[:search] == true %>
3
+ <%= render 'snaptable/buttons' unless presenter.options[:buttons] == false %>
2
4
 
3
- <%= render 'search_field' if presenter.options[:search] == true %>
4
- <%= render 'buttons' unless presenter.options[:buttons] == false %>
5
+ <% if buttons %>
6
+ <div class="table_buttons">
7
+ <%= render buttons if buttons %>
8
+ </div>
9
+ <% end %>
10
+
5
11
  <table>
6
12
  <thead>
7
13
  <tr>
File without changes
@@ -2,14 +2,14 @@ module Snaptable
2
2
  module Constructor
3
3
  module Renderer
4
4
 
5
- def present
6
- render_to_string('/base', layout: false, locals: { presenter: self }).html_safe
5
+ def present(buttons: nil)
6
+ render_to_string('/snaptable/base', layout: false, locals: { presenter: self, buttons: buttons}).html_safe
7
7
  end
8
8
 
9
9
  def respond
10
10
  respond_to do |format|
11
11
  format.html
12
- format.js { render '/sort' }
12
+ format.js { render '/snaptable/sort' }
13
13
  end
14
14
  end
15
15
 
@@ -1,5 +1,5 @@
1
1
  module Snaptable
2
2
  module Rails
3
- VERSION = "0.4.2"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module Snaptable
2
- VERSION = "0.4.2"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - khcr
@@ -126,10 +126,10 @@ files:
126
126
  - app/assets/javascripts/snaptable/table.js
127
127
  - app/assets/stylesheets/snaptable.css
128
128
  - app/assets/stylesheets/snaptable/table.css.scss
129
- - app/views/application/_buttons.html.erb
130
- - app/views/application/_search_field.html.erb
131
- - app/views/base.html.erb
132
- - app/views/sort.js.erb
129
+ - app/views/snaptable/_buttons.html.erb
130
+ - app/views/snaptable/_search_field.html.erb
131
+ - app/views/snaptable/base.html.erb
132
+ - app/views/snaptable/sort.js.erb
133
133
  - bin/console
134
134
  - bin/setup
135
135
  - lib/snaptable.rb