snaptable 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/views/{application → snaptable}/_buttons.html.erb +0 -0
- data/app/views/{application → snaptable}/_search_field.html.erb +0 -0
- data/app/views/{base.html.erb → snaptable/base.html.erb} +8 -2
- data/app/views/{sort.js.erb → snaptable/sort.js.erb} +0 -0
- data/lib/snaptable/constructor/renderer.rb +3 -3
- data/lib/snaptable/rails/version.rb +1 -1
- data/lib/snaptable/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fecbb61f1141258e372e2d8dc713f6d273352b5
|
4
|
+
data.tar.gz: 11d814cbbcd28fa7ed71500d6331ae21fff3ebf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
File without changes
|
File without changes
|
@@ -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
|
-
|
4
|
-
|
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
|
|
data/lib/snaptable/version.rb
CHANGED
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
|
+
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/
|
130
|
-
- app/views/
|
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
|