admin-panel 0.1.3 → 0.1.4
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/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/admin-panel/version.rb +1 -1
- data/lib/generators/admin_panel/install/templates/assets/stylesheets/admin.css.scss +5 -1
- data/lib/generators/admin_panel/install/templates/helpers/admin_helper.rb +4 -0
- data/lib/generators/admin_panel/scaffold/templates/controllers/controller.rb.erb +1 -1
- data/lib/generators/admin_panel/scaffold/templates/views/erb/index.html.erb.erb +12 -3
- data/lib/generators/admin_panel/scaffold/templates/views/haml/index.html.haml.erb +7 -2
- data/spec/generators/admin_panel/scaffold/scaffold_generator_spec.rb +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bf5b58ee1a00b74bdb5a6024a683cbbeeb43e06
|
4
|
+
data.tar.gz: c19d95f38cc2e2ea6749ba2727da21f4c5616306
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76a72acf852f9706c05b987f870b440749738995e5d99270283cf6d28c7da3f54c39b19b01189b4415c1faacbba1cf17948b65503a09a21792e924037eeebb24
|
7
|
+
data.tar.gz: fdad1aea621dd26acb342a792b730f22ed0880d1a04f4a7c3a1fcffb3bd5f790522e1082bbd8ab67c7821386ae134a0ed6f098cca7eb89d4f94abc9ea47a1cfc
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -57,3 +57,5 @@ Things that'd be nice to have:
|
|
57
57
|
- ~~kaminari/will_paginate support~~
|
58
58
|
- I liked the idea of copying the files to your project during install at first but now it just seems silly; I should probably rewrite everything from scratch to work more similarly to Devise, including the ability to extend default controllers where necessary
|
59
59
|
- I was also supposed to add Carrierwave support too but ran out of time
|
60
|
+
- sorting
|
61
|
+
- ~~per page count selector~~
|
data/lib/admin-panel/version.rb
CHANGED
@@ -9,7 +9,7 @@ class <%= prefixed_controller_class_name %>Controller < <%= parent_controller_cl
|
|
9
9
|
|
10
10
|
# GET <%= prefixed_route_url %>
|
11
11
|
def index
|
12
|
-
@<%= plural_table_name %> = <%= class_name %>.page
|
12
|
+
@<%= plural_table_name %> = <%= class_name %>.page(params[:page]).per(params[:per_page])
|
13
13
|
end
|
14
14
|
|
15
15
|
# GET <%= prefixed_route_url %>/1
|
@@ -34,6 +34,15 @@
|
|
34
34
|
</tbody>
|
35
35
|
</table>
|
36
36
|
|
37
|
-
<div class="
|
38
|
-
|
39
|
-
|
37
|
+
<div class="row">
|
38
|
+
<div class="col-md-8">
|
39
|
+
<%%= paginate @<%= plural_table_name %>, theme: 'admin-bootstrap' %>
|
40
|
+
</div>
|
41
|
+
<div class="col-md-4 text-right">
|
42
|
+
<div class="btn-group per-page">
|
43
|
+
<%% [ 10, 25, 100, 250, 500, 1000 ].each do |i| %>
|
44
|
+
<%%= link_to i, { action: :index, page: params[:page], per_page: i }, class: "btn #{per_page_class(<%= class_name %>, i)}" %>
|
45
|
+
<%% end %>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
</div>
|
@@ -29,5 +29,10 @@
|
|
29
29
|
%td.text-right
|
30
30
|
= link_to 'Destroy', <%= "[:#{prefix}, #{singular_table_name}]" %>, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger'
|
31
31
|
|
32
|
-
.
|
33
|
-
|
32
|
+
.row
|
33
|
+
.col-md-8
|
34
|
+
= paginate @<%= plural_table_name %>, theme: 'admin-bootstrap'
|
35
|
+
.col-md-4.text-right
|
36
|
+
.btn-group.per-page
|
37
|
+
- [ 10, 25, 100, 250, 500, 1000 ].each do |i|
|
38
|
+
= link_to i, { action: :index, page: params[:page], per_page: i }, class: "btn #{per_page_class(<%= class_name %>, i)}"
|
@@ -18,7 +18,12 @@ describe AdminPanel::Generators::ScaffoldGenerator do
|
|
18
18
|
subject { file('app/controllers/admin/posts_controller.rb') }
|
19
19
|
it { should exist }
|
20
20
|
it { should contain 'include Administrable' }
|
21
|
-
it { should contain '@posts = Post.
|
21
|
+
it { should contain '@posts = Post.page(params[:page]).per(params[:per_page])' }
|
22
|
+
|
23
|
+
[ :index, :new, :edit, :create, :update, :show, :destroy ].each do |action|
|
24
|
+
it { should contain "def #{action.to_s}" }
|
25
|
+
end
|
26
|
+
|
22
27
|
end
|
23
28
|
|
24
29
|
it_should_exist 'app/views/admin/posts/index.html.erb'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: admin-panel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michał Matyas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|