snaptable 0.4.0 → 0.4.1

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
  SHA1:
3
- metadata.gz: bb7ab05db59cf1a238e3efb6b1d7d091314a0b60
4
- data.tar.gz: 97e0fad19495df1c621b997f549dcacdbdc4fe4f
3
+ metadata.gz: 20f9633b41fc538dc77dba4154ce3d1b9a522709
4
+ data.tar.gz: 76655d7a4aa739236dd9d66885b48fe2ad7be782
5
5
  SHA512:
6
- metadata.gz: c6d9e2e50baf967dc1f41172fa698d24aa48d831806f1423518c90bc194a9bd2736cd0f692c18bae243ad1d4370770c2698ddf1289629043a05a402b1d53a8f0
7
- data.tar.gz: 8b97555bd23e36319578a1f4aeb3ab983cece15f4b4403f1e260c5c5814eda48230170627eb33fe04aabab8a5b328a9b79244522c24b46f7c0789a4a69979bed
6
+ metadata.gz: 8c49ec09a34087c57054217c5e96f1cb6cdae817e2bf4218300a9abd78e264177e9e40872ee0222301bab9cc3c96aeb00af166c6ec84c5b44b1c00d26e8f1817
7
+ data.tar.gz: 344f4ab353d7a555083b4dbfb5421f4cad791ff13769116d134331a0876af035d435a4b3b315eddcdf5ffffe837ed9c3f3083bc8b5e854fdb4ee161ac15025b9
data/README.md CHANGED
@@ -18,13 +18,13 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install snaptable
20
20
 
21
- The gem requires also jQuery.
21
+ The gem also requires jQuery.
22
22
 
23
23
  ## Usage
24
24
 
25
25
  ### Basic table
26
26
 
27
- In your controller, instanciate a new `Table` with minimum two arguments: the controller itself and the model to use.
27
+ In your controller, instantiate a new `Table` with minimum two arguments: the controller itself and the model to use.
28
28
 
29
29
  ```ruby
30
30
  def index
@@ -49,11 +49,11 @@ Finally, in your view, generate the table where you wish.
49
49
  </div>
50
50
  ```
51
51
 
52
- The elements in the table are clickable. Click on an element and use the links above the table to edit or destroy it. If you double-click, you are directly redirect to the edit page.
52
+ The elements in the table are clickable. Click on an element and use the links above the table to edit or destroy it. If you double-click, you are directly redirect to the edit page. Furthermore, the columns are sortable. Click on a label to sort the data by a column.
53
53
 
54
54
  ### Options
55
55
 
56
- You can customize the table when you instanciate it. Pass you own collection in the third argument.
56
+ You can customize the table when you instantiate it. Pass you own collection in the third argument.
57
57
 
58
58
  ```ruby
59
59
  @articles = Article.last(3)
@@ -86,8 +86,8 @@ class ArticleTable < BaseTable
86
86
  end
87
87
  ```
88
88
 
89
- From that point, you have a working table, but it acts exactly the same than the basic table. You have few possibilites to change the behavior.
90
- If you want to change the table's columns, write a method `attributes` that return an array of the model's attributes you want to display. It supports associations by allowing you to put a hash.
89
+ From that point, you have a working table, but it acts exactly the same than the basic table. You have few possibilities to change the behavior.
90
+ If you want to change the table's columns, write a method `attributes` that returns an array of the model's attributes you want to display. It supports associations by allowing you to put a hash.
91
91
 
92
92
  ```ruby
93
93
  def attributes
@@ -95,7 +95,7 @@ def attributes
95
95
  end
96
96
  ```
97
97
 
98
- You can also change how the URL to edit and delete an element is generated. By default it uses the element's id, but you can specify an other attribute. Write a method `url` that returns the attribute.
98
+ You can also change how the URL to edit and delete an element is generated. By default, it uses the element's id, but you can specify an other attribute. Write a method `url` that returns an attribute.
99
99
 
100
100
  ```ruby
101
101
  def url
@@ -150,4 +150,4 @@ When the table fetches the data, it will use `current_permission.records(control
150
150
  2. Create your feature branch (`git checkout -b my-new-feature`)
151
151
  3. Commit your changes (`git commit -am 'Add some feature'`)
152
152
  4. Push to the branch (`git push origin my-new-feature`)
153
- 5. Create a new Pull Request
153
+ 5. Create a new Pull Request
@@ -1,15 +1,23 @@
1
1
  /* Table */
2
2
 
3
3
  #snaptable {
4
+ * {
5
+ padding: 0;
6
+ margin: 0;
7
+ }
4
8
  width: 100%;
9
+ font-family: "helvetica neue", "helvetica", "sans-serif";
5
10
  overflow: auto;
11
+ a {
12
+ text-decoration: none;
13
+ }
6
14
 
7
15
  table {
8
16
  border-collapse: collapse;
9
17
  width: 100%;
10
18
  max-width: 100%;
11
- line-height: 21px;
12
- margin: 57px 0 0 0;
19
+ line-height: 25px;
20
+ margin: 20px 0 20px 0;
13
21
  thead {
14
22
  tr {
15
23
  th {
@@ -35,6 +43,7 @@
35
43
  tbody {
36
44
  td {
37
45
  font-size: 12px;
46
+ color: #333;
38
47
  padding: 7px 8px;
39
48
  &:not(:first-child) {
40
49
  border-left: 1px solid #DADADA;
@@ -53,36 +62,49 @@
53
62
  text-align: center;
54
63
  }
55
64
 
56
- .table_buttons {
57
- text-align: right;
58
- padding: 20px;
59
- position: absolute;
60
- }
61
-
62
- .table_buttons a {
63
- padding: 7px 10px;
64
- border-radius: 3px;
65
- color: #fff;
66
- font-weight: lighter;
67
- font-size: 14px;
68
- }
69
-
70
- .table_buttons a {
71
- background: #aaa;
72
- pointer-events: none;
73
- cursor: default;
74
- }
75
-
76
- .table_buttons a.on {
77
- background: #7f72f5;
78
- pointer-events: auto;
79
- cursor: auto;
65
+ .search {
66
+ display: inline-block;
67
+ padding: 0 10px 0 0;
68
+ input {
69
+ font-family: "helvetica neue", "helvetica", "sans-serif";
70
+ padding: 7px 10px;
71
+ border-radius: 3px;
72
+ color: #fff;
73
+ -webkit-font-smoothing: antialiased;
74
+ font-size: 14px;
75
+ background: #7f72f5;
76
+ border: none;
77
+ margin: 5px 0;
78
+ &[type=submit] {
79
+ cursor: pointer;
80
+ }
81
+ }
80
82
  }
81
83
 
82
- .table_buttons a.add {
83
- background: #7f72f5;
84
- pointer-events: auto;
85
- cursor: auto;
84
+ .table_buttons {
85
+ display: inline-block;
86
+ a {
87
+ padding: 7px 10px;
88
+ border-radius: 3px;
89
+ color: #fff;
90
+ -webkit-font-smoothing: antialiased;
91
+ font-size: 14px;
92
+ background: #aaa;
93
+ pointer-events: none;
94
+ cursor: default;
95
+ display: inline-block;
96
+ margin: 5px 0;
97
+ &.on {
98
+ background: #7f72f5;
99
+ pointer-events: auto;
100
+ cursor: auto;
101
+ }
102
+ &.add {
103
+ background: #7f72f5;
104
+ pointer-events: auto;
105
+ cursor: auto;
106
+ }
107
+ }
86
108
  }
87
109
 
88
110
  }
@@ -1,5 +1,8 @@
1
1
  <div class="table_buttons">
2
- <%= link_to "Ajouter", request.path + "/new", class: "add" %>
3
- <a class="edit" href="#">Editer</a>
4
- <a class="delete" href="#" data-method="delete" rel="nofollow" data-confirm="Etes-vous sûr de vouloir supprimer cette entrée ?">Supprimer</a>
2
+ <p>Actions</p>
3
+ <p>
4
+ <%= link_to "Ajouter", request.path + "/new", class: "add" %>
5
+ <a class="edit" href="#">Editer</a>
6
+ <a class="delete" href="#" data-method="delete" rel="nofollow" data-confirm="Etes-vous sûr de vouloir supprimer cette entrée ?">Supprimer</a>
7
+ </p>
5
8
  </div>
@@ -1,9 +1,7 @@
1
- <p>Rechercher</p>
2
-
3
- <%= form_tag nil, method: :get, remote: true do %>
4
-
5
- <%= search_field_tag :query, params[:query] %>
6
-
7
- <%= submit_tag "Chercher" %>
8
-
9
- <% end %>
1
+ <div class="search">
2
+ <p>Rechercher</p>
3
+ <%= form_tag nil, method: :get, remote: true do %>
4
+ <%= search_field_tag :query, params[:query] %>
5
+ <%= submit_tag "Chercher" %>
6
+ <% end %>
7
+ </div>
@@ -1,6 +1,8 @@
1
1
  module Snaptable
2
2
  module Rails
3
3
  class Engine < ::Rails::Engine
4
+ require "will_paginate"
5
+
4
6
  initializer "Snaptable.assets.precompile" do |app|
5
7
  app.config.assets.precompile +=%w(autotable.js autotable.css)
6
8
  end
@@ -1,5 +1,5 @@
1
1
  module Snaptable
2
2
  module Rails
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module Snaptable
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/snaptable.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["khcr"]
10
10
  spec.email = ["kocher.ke@gmail.com"]
11
11
 
12
- spec.summary = "A gem that generate HTML tables from your models to display in your admin views."
12
+ spec.summary = "A gem that generate HTML tables from your models in order to display them in your admin views."
13
13
  spec.description = spec.summary
14
14
  spec.homepage = "http://github.com/khcr/snaptable"
15
15
  spec.license = "MIT"
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "bundler", "~> 1.8"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
 
25
+ spec.add_dependency "rails", ">= 4.2.0"
25
26
  spec.add_dependency "railties", ">= 4.2.0"
26
27
  spec.add_dependency "will_paginate", ">= 3.0.0"
27
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - khcr
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-07 00:00:00.000000000 Z
11
+ date: 2015-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 4.2.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 4.2.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: railties
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,8 +80,8 @@ dependencies:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: 3.0.0
69
- description: A gem that generate HTML tables from your models to display in your admin
70
- views.
83
+ description: A gem that generate HTML tables from your models in order to display
84
+ them in your admin views.
71
85
  email:
72
86
  - kocher.ke@gmail.com
73
87
  executables: []
@@ -123,6 +137,6 @@ rubyforge_project:
123
137
  rubygems_version: 2.4.6
124
138
  signing_key:
125
139
  specification_version: 4
126
- summary: A gem that generate HTML tables from your models to display in your admin
127
- views.
140
+ summary: A gem that generate HTML tables from your models in order to display them
141
+ in your admin views.
128
142
  test_files: []