beef-admin_area 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -4
- data/VERSION +1 -1
- data/app/controllers/admin/users_controller.rb +2 -1
- data/app/views/admin/users/show.html.erb +2 -2
- data/app/views/layouts/admin.html.erb +1 -1
- data/app/views/sessions/new.html.erb +0 -4
- data/{admin_area.gemspec → beef-admin_area.gemspec} +14 -12
- data/generators/admin_scaffold/admin_scaffold_generator.rb +11 -14
- data/generators/admin_scaffold/templates/admin_controller.rb +3 -15
- data/generators/admin_scaffold/templates/admin_index.html.erb +9 -2
- data/generators/admin_scaffold/templates/factory.rb +5 -0
- data/generators/admin_scaffold/templates/view_index.html.erb +10 -7
- data/rails/init.rb +1 -1
- metadata +9 -9
- data/generators/admin_scaffold/templates/helper.rb +0 -2
- data/generators/admin_scaffold/templates/helper_test.rb +0 -4
data/Rakefile
CHANGED
@@ -4,17 +4,17 @@ require 'rake'
|
|
4
4
|
begin
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "admin_area"
|
7
|
+
gem.name = "beef-admin_area"
|
8
8
|
gem.summary = %Q{Rails engine that provides a standard admin area with user managament}
|
9
9
|
gem.email = "steve@wearebeef.co.uk"
|
10
10
|
gem.homepage = "http://github.com/beef/admin"
|
11
11
|
gem.authors = ["Steve England"]
|
12
|
-
gem.add_dependency("
|
12
|
+
gem.add_dependency("clearance", [">= 0.6.6"])
|
13
13
|
gem.add_dependency("thoughtbot-sortable_table")
|
14
|
-
gem.add_dependency("
|
14
|
+
gem.add_dependency("will_paginate", ['>= 2.3.8'])
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
17
|
-
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
18
|
rescue LoadError
|
19
19
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
20
20
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
@@ -5,7 +5,7 @@ class Admin::UsersController < Admin::BaseController
|
|
5
5
|
# GET /users
|
6
6
|
# GET /users.xml
|
7
7
|
def index
|
8
|
-
@users = User.paginate :page => params[:page], :per_page => 20, :order => sort_order
|
8
|
+
@users = User.paginate :page => params[:page], :per_page => 20, :order => sort_order(:default => 'asc')
|
9
9
|
|
10
10
|
respond_to do |format|
|
11
11
|
format.html # index.html.erb
|
@@ -67,6 +67,7 @@ class Admin::UsersController < Admin::BaseController
|
|
67
67
|
def destroy
|
68
68
|
@user = User.find(params[:id])
|
69
69
|
@user.destroy
|
70
|
+
flash[:notice] = 'User was successfully deleted.'
|
70
71
|
|
71
72
|
respond_to do |format|
|
72
73
|
format.html { redirect_to(admin_users_url) }
|
@@ -26,11 +26,11 @@
|
|
26
26
|
|
27
27
|
<p>
|
28
28
|
<%= f.label :role %><br/>
|
29
|
-
<%= f.select :role, User::ROLES %>
|
29
|
+
<%= f.select :role, User::ROLES.map{|r| r.to_s } %>
|
30
30
|
</p>
|
31
31
|
|
32
32
|
<p>
|
33
|
-
<%= f.submit
|
33
|
+
<%= f.submit @user.new_record? ? 'Create' : 'Update', :disable_with => 'Submitting...' %> or <%= link_to 'Cancel', admin_users_path %>
|
34
34
|
</p>
|
35
35
|
<% end %>
|
36
36
|
|
@@ -32,7 +32,7 @@
|
|
32
32
|
<h1><strong><%= Settings.site_name %></strong> Content Management System</h1>
|
33
33
|
<ul id="status">
|
34
34
|
<% if signed_in? %><li class="no_bull"><%= current_user.name %> is logged in</li><% end %>
|
35
|
-
<li><%= link_to '
|
35
|
+
<li><%= link_to 'Sign Out', session_path, :method => :delete %></li>
|
36
36
|
<%= tab 'Users', admin_users_path, :admin %>
|
37
37
|
<%= tab 'Settings', admin_settings_path if current_user.admin? %>
|
38
38
|
<li><%= link_to 'Live Site', '/' %></li>
|
@@ -9,10 +9,6 @@
|
|
9
9
|
<%= form.label :password %>
|
10
10
|
<%= form.password_field :password %>
|
11
11
|
</div>
|
12
|
-
<div class="text_field">
|
13
|
-
<%= form.check_box :remember_me %>
|
14
|
-
<%= form.label :remember_me %>
|
15
|
-
</div>
|
16
12
|
<div class="submit_field">
|
17
13
|
<%= form.submit "Sign in", :disable_with => "Please wait..." %>
|
18
14
|
</div>
|
@@ -1,12 +1,15 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{admin_area}
|
5
|
-
s.version = "0.1.
|
7
|
+
s.name = %q{beef-admin_area}
|
8
|
+
s.version = "0.1.9"
|
6
9
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
11
|
s.authors = ["Steve England"]
|
9
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-10-28}
|
10
13
|
s.email = %q{steve@wearebeef.co.uk}
|
11
14
|
s.extra_rdoc_files = [
|
12
15
|
"LICENSE",
|
@@ -19,7 +22,6 @@ Gem::Specification.new do |s|
|
|
19
22
|
"README.rdoc",
|
20
23
|
"Rakefile",
|
21
24
|
"VERSION",
|
22
|
-
"admin_area.gemspec",
|
23
25
|
"app/controllers/admin/base_controller.rb",
|
24
26
|
"app/controllers/admin/settings_controller.rb",
|
25
27
|
"app/controllers/admin/users_controller.rb",
|
@@ -34,6 +36,7 @@ Gem::Specification.new do |s|
|
|
34
36
|
"app/views/admin/users/show.html.erb",
|
35
37
|
"app/views/layouts/admin.html.erb",
|
36
38
|
"app/views/sessions/new.html.erb",
|
39
|
+
"beef-admin_area.gemspec",
|
37
40
|
"config/routes.rb",
|
38
41
|
"generators/admin_area_files/USAGE",
|
39
42
|
"generators/admin_area_files/admin_area_files_generator.rb",
|
@@ -131,8 +134,7 @@ Gem::Specification.new do |s|
|
|
131
134
|
"generators/admin_scaffold/templates/admin_controller.rb",
|
132
135
|
"generators/admin_scaffold/templates/admin_index.html.erb",
|
133
136
|
"generators/admin_scaffold/templates/admin_show.html.erb",
|
134
|
-
"generators/admin_scaffold/templates/
|
135
|
-
"generators/admin_scaffold/templates/helper_test.rb",
|
137
|
+
"generators/admin_scaffold/templates/factory.rb",
|
136
138
|
"generators/admin_scaffold/templates/layout.html.erb",
|
137
139
|
"generators/admin_scaffold/templates/style.css",
|
138
140
|
"generators/admin_scaffold/templates/view_controller.rb",
|
@@ -157,17 +159,17 @@ Gem::Specification.new do |s|
|
|
157
159
|
s.specification_version = 3
|
158
160
|
|
159
161
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
160
|
-
s.add_runtime_dependency(%q<
|
162
|
+
s.add_runtime_dependency(%q<clearance>, [">= 0.6.6"])
|
161
163
|
s.add_runtime_dependency(%q<thoughtbot-sortable_table>, [">= 0"])
|
162
|
-
s.add_runtime_dependency(%q<
|
164
|
+
s.add_runtime_dependency(%q<will_paginate>, [">= 2.3.8"])
|
163
165
|
else
|
164
|
-
s.add_dependency(%q<
|
166
|
+
s.add_dependency(%q<clearance>, [">= 0.6.6"])
|
165
167
|
s.add_dependency(%q<thoughtbot-sortable_table>, [">= 0"])
|
166
|
-
s.add_dependency(%q<
|
168
|
+
s.add_dependency(%q<will_paginate>, [">= 2.3.8"])
|
167
169
|
end
|
168
170
|
else
|
169
|
-
s.add_dependency(%q<
|
171
|
+
s.add_dependency(%q<clearance>, [">= 0.6.6"])
|
170
172
|
s.add_dependency(%q<thoughtbot-sortable_table>, [">= 0"])
|
171
|
-
s.add_dependency(%q<
|
173
|
+
s.add_dependency(%q<will_paginate>, [">= 2.3.8"])
|
172
174
|
end
|
173
175
|
end
|
@@ -5,19 +5,16 @@ class AdminScaffoldGenerator < ScaffoldGenerator
|
|
5
5
|
def manifest
|
6
6
|
record do |m|
|
7
7
|
# Check for class naming collisions.
|
8
|
-
m.class_collisions("#{controller_class_name}Controller", "Admin::#{controller_class_name}Controller"
|
8
|
+
m.class_collisions("#{controller_class_name}Controller", "Admin::#{controller_class_name}Controller")
|
9
9
|
m.class_collisions(class_name)
|
10
10
|
|
11
|
-
# Controller,
|
12
|
-
m.directory(File.join('
|
11
|
+
# Controller, views, test and stylesheets directories.
|
12
|
+
m.directory(File.join('spec','factories'))
|
13
13
|
m.directory(File.join('app/controllers', controller_class_path))
|
14
14
|
m.directory(File.join('app/controllers/admin', controller_class_path))
|
15
|
-
m.directory(File.join('app/helpers', controller_class_path))
|
16
15
|
m.directory(File.join('app/views', controller_class_path, controller_file_name))
|
17
16
|
m.directory(File.join('app/views/admin', controller_class_path, controller_file_name))
|
18
17
|
m.directory(File.join('app/views/layouts', controller_class_path))
|
19
|
-
m.directory(File.join('test/unit', class_path))
|
20
|
-
m.directory(File.join('test/unit/helpers', class_path))
|
21
18
|
m.directory(File.join('public/stylesheets', class_path))
|
22
19
|
|
23
20
|
for action in ['index', 'show']
|
@@ -29,24 +26,24 @@ class AdminScaffoldGenerator < ScaffoldGenerator
|
|
29
26
|
|
30
27
|
m.template(
|
31
28
|
"view_index.html.erb",
|
32
|
-
File.join('app/views
|
29
|
+
File.join('app/views', controller_class_path, controller_file_name, "index.html.erb")
|
33
30
|
)
|
34
|
-
|
35
|
-
|
36
31
|
m.template(
|
37
32
|
'view_controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
|
38
33
|
)
|
39
34
|
m.template(
|
40
35
|
'admin_controller.rb', File.join('app/controllers/admin', controller_class_path, "#{controller_file_name}_controller.rb")
|
41
36
|
)
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
m.template(
|
38
|
+
'factory.rb', File.join('spec','factories', "#{singular_name}.rb")
|
39
|
+
)
|
45
40
|
|
46
41
|
m.route_resources controller_file_name
|
47
42
|
m.route_resources_to_namespace('admin', controller_file_name)
|
48
|
-
|
49
|
-
m.dependency '
|
43
|
+
|
44
|
+
m.dependency 'rpec_controller', [controller_file_name, 'index'], :collision => :skip
|
45
|
+
m.dependency 'rpec_controller', ["admin/#{controller_file_name}", 'index', 'show'], :collision => :skip
|
46
|
+
m.dependency 'rpec_model', [name, '--skip-fixture'] + @args, :collision => :skip
|
50
47
|
end
|
51
48
|
end
|
52
49
|
|
@@ -1,8 +1,6 @@
|
|
1
1
|
class Admin::<%= controller_class_name %>Controller < Admin::BaseController
|
2
|
-
sortable_attributes :<%= attributes.collect{|a| a.name}.join(', :') %>
|
2
|
+
sortable_attributes :created_at, :updated_at, :<%= attributes.collect{|a| a.name}.join(', :') %>
|
3
3
|
|
4
|
-
# GET /<%= table_name %>
|
5
|
-
# GET /<%= table_name %>.xml
|
6
4
|
def index
|
7
5
|
@<%= table_name %> = <%= class_name %>.paginate :page => params[:page], :order => sort_order
|
8
6
|
|
@@ -12,8 +10,6 @@ class Admin::<%= controller_class_name %>Controller < Admin::BaseController
|
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
15
|
-
# GET /<%= table_name %>/1
|
16
|
-
# GET /<%= table_name %>/1.xml
|
17
13
|
def show
|
18
14
|
@<%= file_name %> = <%= class_name %>.find(params[:id])
|
19
15
|
|
@@ -23,8 +19,6 @@ class Admin::<%= controller_class_name %>Controller < Admin::BaseController
|
|
23
19
|
end
|
24
20
|
end
|
25
21
|
|
26
|
-
# GET /<%= table_name %>/new
|
27
|
-
# GET /<%= table_name %>/new.xml
|
28
22
|
def new
|
29
23
|
@<%= file_name %> = <%= class_name %>.new
|
30
24
|
|
@@ -34,8 +28,6 @@ class Admin::<%= controller_class_name %>Controller < Admin::BaseController
|
|
34
28
|
end
|
35
29
|
end
|
36
30
|
|
37
|
-
# POST /<%= table_name %>
|
38
|
-
# POST /<%= table_name %>.xml
|
39
31
|
def create
|
40
32
|
@<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])
|
41
33
|
|
@@ -45,14 +37,12 @@ class Admin::<%= controller_class_name %>Controller < Admin::BaseController
|
|
45
37
|
format.html { redirect_to(admin_<%= table_name %>_url) }
|
46
38
|
format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> }
|
47
39
|
else
|
48
|
-
format.html { render :action => "
|
40
|
+
format.html { render :action => "show" }
|
49
41
|
format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
|
50
42
|
end
|
51
43
|
end
|
52
44
|
end
|
53
45
|
|
54
|
-
# PUT /<%= table_name %>/1
|
55
|
-
# PUT /<%= table_name %>/1.xml
|
56
46
|
def update
|
57
47
|
@<%= file_name %> = <%= class_name %>.find(params[:id])
|
58
48
|
|
@@ -62,14 +52,12 @@ class Admin::<%= controller_class_name %>Controller < Admin::BaseController
|
|
62
52
|
format.html { redirect_to(admin_<%= table_name %>_url) }
|
63
53
|
format.xml { head :ok }
|
64
54
|
else
|
65
|
-
format.html { render :action => "
|
55
|
+
format.html { render :action => "show" }
|
66
56
|
format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
|
67
57
|
end
|
68
58
|
end
|
69
59
|
end
|
70
60
|
|
71
|
-
# DELETE /<%= table_name %>/1
|
72
|
-
# DELETE /<%= table_name %>/1.xml
|
73
61
|
def destroy
|
74
62
|
@<%= file_name %> = <%= class_name %>.find(params[:id])
|
75
63
|
@<%= file_name %>.destroy
|
@@ -3,13 +3,15 @@
|
|
3
3
|
<ul class="choices">
|
4
4
|
<li><%%= link_to 'New <%= singular_name.titleize %>', new_admin_<%= singular_name %>_path %></li>
|
5
5
|
</ul>
|
6
|
-
|
6
|
+
<%% paginated_section do -%>
|
7
7
|
<table>
|
8
8
|
<thead>
|
9
9
|
<tr>
|
10
10
|
<% for attribute in attributes -%>
|
11
|
-
<%%= sortable_table_header :name => "<%= attribute.column.human_name %>",
|
11
|
+
<%%= sortable_table_header :name => "<%= attribute.column.human_name %>", :sort => "<%= attribute.name %>" %>
|
12
12
|
<% end -%>
|
13
|
+
<%%= sortable_table_header :name => "Created", :sort => "created_at" %>
|
14
|
+
<%%= sortable_table_header :name => "Updated", :sort => "updated_at" %>
|
13
15
|
<th colspan="2">Actions</th>
|
14
16
|
</tr>
|
15
17
|
</thead>
|
@@ -23,6 +25,8 @@
|
|
23
25
|
<td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
|
24
26
|
<% end -%>
|
25
27
|
<% end -%>
|
28
|
+
<td><%%=h <%= singular_name %>.created_at.to_formatted_s(:short_ordinal) %></td>
|
29
|
+
<td><%%=h <%= singular_name %>.created_at.to_formatted_s(:short_ordinal) %></td>
|
26
30
|
<td><%%= link_to 'Edit', admin_<%= singular_name %>_path(<%= singular_name %>), :class => 'edit' %></td>
|
27
31
|
<td><%%= link_to 'Destroy', admin_<%= singular_name %>_path(<%= singular_name %>), :confirm => 'Are you sure?', :method => :delete, :class => 'delete' %></td>
|
28
32
|
</tr>
|
@@ -33,7 +37,10 @@
|
|
33
37
|
<% for attribute in attributes -%>
|
34
38
|
<%%= sortable_table_header :name => "<%= attribute.column.human_name %>", :sort => "<%= attribute.name %>" %>
|
35
39
|
<% end -%>
|
40
|
+
<%%= sortable_table_header :name => "Created", :sort => "created_at" %>
|
41
|
+
<%%= sortable_table_header :name => "Updated", :sort => "updated_at" %>
|
36
42
|
<th colspan="2">Actions</th>
|
37
43
|
</tr>
|
38
44
|
</tfoot>
|
39
45
|
</table>
|
46
|
+
<%% end -%>
|
@@ -1,17 +1,20 @@
|
|
1
1
|
<h1>Listing <%= plural_name.titleize %></h1>
|
2
2
|
|
3
3
|
<table>
|
4
|
-
<
|
4
|
+
<thead>
|
5
|
+
<tr>
|
5
6
|
<% for attribute in attributes -%>
|
6
|
-
|
7
|
+
<th><%= attribute.column.human_name %></th>
|
7
8
|
<% end -%>
|
8
|
-
|
9
|
-
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
10
12
|
<%% @<%= plural_name %>.each do |<%= singular_name %>| %>
|
11
|
-
|
13
|
+
<tr>
|
12
14
|
<% for attribute in attributes -%>
|
13
|
-
|
15
|
+
<td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
|
14
16
|
<% end -%>
|
15
|
-
|
17
|
+
</tr>
|
16
18
|
<%% end %>
|
19
|
+
</tbody>
|
17
20
|
</table>
|
data/rails/init.rb
CHANGED
@@ -5,6 +5,6 @@ require 'admin_area'
|
|
5
5
|
|
6
6
|
config.after_initialize do
|
7
7
|
# Put Clearance views at bottom of view paths
|
8
|
-
path = ActionController::Base.view_paths.find { |p| p.to_s =~ /
|
8
|
+
path = ActionController::Base.view_paths.find { |p| p.to_s =~ /clearance/ }
|
9
9
|
ActionController::Base.view_paths << ActionController::Base.view_paths.delete(path)
|
10
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beef-admin_area
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve England
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-28 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: clearance
|
17
17
|
type: :runtime
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: "0"
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: will_paginate
|
37
37
|
type: :runtime
|
38
38
|
version_requirement:
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,6 @@ files:
|
|
58
58
|
- README.rdoc
|
59
59
|
- Rakefile
|
60
60
|
- VERSION
|
61
|
-
- admin_area.gemspec
|
62
61
|
- app/controllers/admin/base_controller.rb
|
63
62
|
- app/controllers/admin/settings_controller.rb
|
64
63
|
- app/controllers/admin/users_controller.rb
|
@@ -73,6 +72,7 @@ files:
|
|
73
72
|
- app/views/admin/users/show.html.erb
|
74
73
|
- app/views/layouts/admin.html.erb
|
75
74
|
- app/views/sessions/new.html.erb
|
75
|
+
- beef-admin_area.gemspec
|
76
76
|
- config/routes.rb
|
77
77
|
- generators/admin_area_files/USAGE
|
78
78
|
- generators/admin_area_files/admin_area_files_generator.rb
|
@@ -170,8 +170,7 @@ files:
|
|
170
170
|
- generators/admin_scaffold/templates/admin_controller.rb
|
171
171
|
- generators/admin_scaffold/templates/admin_index.html.erb
|
172
172
|
- generators/admin_scaffold/templates/admin_show.html.erb
|
173
|
-
- generators/admin_scaffold/templates/
|
174
|
-
- generators/admin_scaffold/templates/helper_test.rb
|
173
|
+
- generators/admin_scaffold/templates/factory.rb
|
175
174
|
- generators/admin_scaffold/templates/layout.html.erb
|
176
175
|
- generators/admin_scaffold/templates/style.css
|
177
176
|
- generators/admin_scaffold/templates/view_controller.rb
|
@@ -180,9 +179,10 @@ files:
|
|
180
179
|
- rails/init.rb
|
181
180
|
- test/admin_area_test.rb
|
182
181
|
- test/test_helper.rb
|
183
|
-
has_rdoc:
|
182
|
+
has_rdoc: true
|
184
183
|
homepage: http://github.com/beef/admin
|
185
|
-
licenses:
|
184
|
+
licenses: []
|
185
|
+
|
186
186
|
post_install_message:
|
187
187
|
rdoc_options:
|
188
188
|
- --charset=UTF-8
|