manage 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,6 +1,8 @@
1
1
  = Manage
2
2
 
3
- Admin backend based on http://iain.nl/backends-in-rails-3-1
3
+ Admin backend started from http://iain.nl/backends-in-rails-3-1
4
+
5
+ Based on inherit_resources, slim, kaminari
4
6
 
5
7
  == Installing
6
8
 
@@ -28,6 +30,7 @@ Add the resource to your app routes.rb yourapp/config/routes.rb:
28
30
  Create controller in your application yourapp/app/controllers/manage/cities_controller.rb
29
31
 
30
32
  class Manage::CitiesController < Manage::ResourceController
33
+ @@per_page = 10 # optional
31
34
  end
32
35
 
33
36
 
@@ -59,6 +62,13 @@ Create an admin user. The users benefit from the devise password validation/gene
59
62
  AdminUser.create(email: 'admin@example.com', password: '11223344', password_confirmation: '11223344')
60
63
 
61
64
 
65
+ = TODO
66
+
67
+ * Make it work with devise session controllers
68
+ * add filters
69
+ * add search
70
+ * make nice layout
71
+
62
72
  == License
63
73
 
64
74
  This project rocks and uses MIT license
@@ -1,17 +1,25 @@
1
1
  require_dependency "manage/application_controller"
2
+ require_dependency 'kaminari'
2
3
 
3
4
  class Manage::ResourceController < Manage::ApplicationController
4
5
  inherit_resources
5
6
 
7
+ cattr_accessor :per_page
8
+
6
9
  self.responder = Manage::Responder
7
10
 
8
11
  layout 'manage/application'
9
12
 
10
- has_scope :page, default: 1
11
-
12
13
  respond_to :html
13
14
 
15
+ protected
16
+ def collection
17
+ assocation = end_of_association_chain.page(params[:page] || 1)
18
+ per_page ? assocation.per(per_page) : assocation
19
+ end
20
+
14
21
  def permitted_params
15
22
  params.permit!
16
23
  end
24
+
17
25
  end
data/lib/manage/engine.rb CHANGED
@@ -1,6 +1,6 @@
1
+ require 'kaminari'
1
2
  require 'responders'
2
3
  require 'inherited_resources'
3
- require 'has_scope'
4
4
 
5
5
  module Manage
6
6
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module Manage
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -60,22 +60,6 @@ dependencies:
60
60
  - - '>='
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
- - !ruby/object:Gem::Dependency
64
- name: has_scope
65
- requirement: !ruby/object:Gem::Requirement
66
- none: false
67
- requirements:
68
- - - '>='
69
- - !ruby/object:Gem::Version
70
- version: '0'
71
- type: :runtime
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - '>='
77
- - !ruby/object:Gem::Version
78
- version: '0'
79
63
  - !ruby/object:Gem::Dependency
80
64
  name: slim
81
65
  requirement: !ruby/object:Gem::Requirement
@@ -140,7 +124,7 @@ dependencies:
140
124
  - - '>='
141
125
  - !ruby/object:Gem::Version
142
126
  version: '0'
143
- description: Rails backend based on http://iain.nl/backends-in-rails-3-1
127
+ description: Rails backend
144
128
  email:
145
129
  - i.bardarov@gmail.com
146
130
  executables: []