devape_cms 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/abstract_member_controller.rb +1 -1
- data/app/controllers/posts_controller.rb +4 -4
- data/app/models/admin.rb +2 -0
- data/app/models/member.rb +4 -0
- data/app/models/user.rb +8 -0
- data/app/views/layouts/_devise_nav_with_settings.html.erb +4 -4
- data/app/views/posts/_form.html.erb +1 -1
- data/app/views/posts/base.html.erb +2 -0
- data/app/views/posts/edit.html.erb +2 -2
- data/app/views/posts/index.html.erb +4 -4
- data/app/views/posts/new.html.erb +1 -1
- data/app/views/posts/show.html.erb +2 -2
- data/config/routes.rb +1 -1
- data/lib/devape_cms.rb +2 -2
- data/lib/rails/generators/devape_cms/devape_cms_generator.rb +5 -2
- data/lib/rails/generators/devape_cms/templates/member.rb +3 -0
- data/lib/rails/generators/devape_cms/templates/user.rb +10 -0
- data/lib/rails/generators/devape_cms_after/devape_cms_after_generator.rb +3 -3
- metadata +15 -10
@@ -1,7 +1,7 @@
|
|
1
1
|
class AbstractMemberController < ApplicationController
|
2
2
|
protect_from_forgery
|
3
3
|
layout "member/layout"
|
4
|
-
before_filter :
|
4
|
+
before_filter :authenticate_member!, :except => [:thanks]
|
5
5
|
before_filter :page_filter
|
6
6
|
|
7
7
|
def page_filter
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class PostsController <
|
1
|
+
class PostsController < AbstractAdminController
|
2
2
|
before_filter :authenticate_admin!, :except => [:show, :cms, :index]
|
3
3
|
# GET /posts
|
4
4
|
# GET /posts.xml
|
@@ -67,7 +67,7 @@ class PostsController < ApplicationController
|
|
67
67
|
|
68
68
|
respond_to do |format|
|
69
69
|
if @post.save
|
70
|
-
format.html { redirect_to(@post, :notice => 'Post was successfully created.') }
|
70
|
+
format.html { redirect_to([:admin, @post], :notice => 'Post was successfully created.') }
|
71
71
|
format.xml { render :xml => @post, :status => :created, :location => @post }
|
72
72
|
else
|
73
73
|
format.html { render :action => "new" }
|
@@ -83,7 +83,7 @@ class PostsController < ApplicationController
|
|
83
83
|
|
84
84
|
respond_to do |format|
|
85
85
|
if @post.update_attributes(params[:post])
|
86
|
-
format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }
|
86
|
+
format.html { redirect_to([:admin, @post], :notice => 'Post was successfully updated.') }
|
87
87
|
format.xml { head :ok }
|
88
88
|
else
|
89
89
|
format.html { render :action => "edit" }
|
@@ -99,7 +99,7 @@ class PostsController < ApplicationController
|
|
99
99
|
@post.destroy
|
100
100
|
|
101
101
|
respond_to do |format|
|
102
|
-
format.html { redirect_to(
|
102
|
+
format.html { redirect_to(admin_posts_url) }
|
103
103
|
format.xml { head :ok }
|
104
104
|
end
|
105
105
|
end
|
data/app/models/admin.rb
CHANGED
data/app/models/user.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
attr_accessible :firstname, :lastname
|
3
|
+
# Include default devise modules. Others available are:
|
4
|
+
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
|
5
|
+
|
6
|
+
# Setup accessible (or protected) attributes for your model
|
7
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me
|
8
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<div class="devise-nav-right">
|
2
|
-
<% if
|
3
|
-
Welcome, <%=
|
4
|
-
<%= link_to :logout,
|
2
|
+
<% if current_member %>
|
3
|
+
Welcome, <%= current_member.firstname %> | <a href="/member/settings">Settings</a> |
|
4
|
+
<%= link_to :logout, destroy_member_session_path, :method => :delete %>
|
5
5
|
|
6
6
|
<% else %>
|
7
|
-
<a href="/
|
7
|
+
<a href="/members/sign_in">Sign In</a> | <a href="/members/sign_up">Sign Up</a>
|
8
8
|
<% end %>
|
9
9
|
</div>
|
@@ -17,10 +17,10 @@
|
|
17
17
|
<%= post.parent.title %>
|
18
18
|
<% end %>
|
19
19
|
</td>
|
20
|
-
<td><%= link_to 'show', post %></td>
|
20
|
+
<td><%= link_to 'show', [:admin, post] %></td>
|
21
21
|
<% if admin_signed_in? %>
|
22
|
-
<td><%= link_to 'Edit',
|
23
|
-
<td><%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %></td>
|
22
|
+
<td><%= link_to 'Edit', edit_admin_post_path(post) %></td>
|
23
|
+
<td><%= link_to 'Destroy', [:admin, post], :confirm => 'Are you sure?', :method => :delete %></td>
|
24
24
|
<% end %>
|
25
25
|
</tr>
|
26
26
|
<% end %>
|
@@ -29,5 +29,5 @@
|
|
29
29
|
<br />
|
30
30
|
|
31
31
|
<% if admin_signed_in? %>
|
32
|
-
<%= link_to 'New Post',
|
32
|
+
<%= link_to 'New Post', new_admin_post_path %>
|
33
33
|
<% end %>
|
data/config/routes.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
namespace "admin" do
|
3
3
|
root :to => "home#dashboard"
|
4
|
+
resources :posts
|
4
5
|
end
|
5
6
|
namespace "member" do
|
6
7
|
root :to => "home#dashboard"
|
7
8
|
match '/settings' => 'settings#index'
|
8
9
|
end
|
9
10
|
resources :categories
|
10
|
-
resources :posts
|
11
11
|
match '/:title' => 'categories#cms'
|
12
12
|
match '/:id' => 'posts#cms'
|
13
13
|
end
|
data/lib/devape_cms.rb
CHANGED
@@ -26,5 +26,5 @@ module DevapeCms
|
|
26
26
|
extend DevapeAdminNavigation::Hooks
|
27
27
|
end
|
28
28
|
|
29
|
-
DevapeCms.register_navigation_item('/member/posts')
|
30
|
-
DevapeCms.register_admin_item('/posts')
|
29
|
+
#DevapeCms.register_navigation_item('/member/posts')
|
30
|
+
DevapeCms.register_admin_item('/admin/posts')
|
@@ -14,10 +14,14 @@ class DevapeCmsGenerator < Rails::Generators::Base
|
|
14
14
|
generate "devise user" # or whatever you want here
|
15
15
|
generate "migration add_name_to_users firstname:string lastname:string type:string"
|
16
16
|
generate "friendly_id"
|
17
|
-
route "devise_for :admins"
|
18
17
|
route "root :to => 'home#index'"
|
19
18
|
|
20
19
|
copy_file "admin.rb", "app/models/admin.rb"
|
20
|
+
copy_file "member.rb", "app/models/member.rb"
|
21
|
+
copy_file "user.rb", "app/models/user.rb"
|
22
|
+
|
23
|
+
route "devise_for :admins"
|
24
|
+
route "devise_for :members"
|
21
25
|
|
22
26
|
if(!File.directory? 'public/javascripts')
|
23
27
|
puts 'create public/javascripts'
|
@@ -34,6 +38,5 @@ class DevapeCmsGenerator < Rails::Generators::Base
|
|
34
38
|
FileUtils.cp_r current_root + '/tiny_mce', 'public/javascripts/tiny_mce'
|
35
39
|
generate "devape_cms_after"
|
36
40
|
FileUtils.rm 'app/views/layouts/application.html.erb'
|
37
|
-
|
38
41
|
end
|
39
42
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
attr_accessible :firstname, :lastname
|
3
|
+
# Include default devise modules. Others available are:
|
4
|
+
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
|
5
|
+
devise :database_authenticatable,
|
6
|
+
:recoverable, :rememberable, :trackable, :validatable
|
7
|
+
|
8
|
+
# Setup accessible (or protected) attributes for your model
|
9
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me
|
10
|
+
end
|
@@ -4,8 +4,8 @@ require 'rails/generators/migration'
|
|
4
4
|
class DevapeCmsAfterGenerator < Rails::Generators::Base
|
5
5
|
include Rails::Generators::Migration
|
6
6
|
def setup
|
7
|
-
inject_into_class "app/models/user.rb", User do
|
8
|
-
|
9
|
-
end
|
7
|
+
#inject_into_class "app/models/user.rb", User do
|
8
|
+
# " attr_accessible :firstname, :lastname \n"
|
9
|
+
#end
|
10
10
|
end
|
11
11
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devape_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-15 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &24414280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *24414280
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: acts_as_tree
|
27
|
-
requirement: &
|
27
|
+
requirement: &24413840 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *24413840
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: devise
|
38
|
-
requirement: &
|
38
|
+
requirement: &24413420 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *24413420
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: friendly_id
|
49
|
-
requirement: &
|
49
|
+
requirement: &24445740 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 3.3.0.rc2
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *24445740
|
58
58
|
description: Insert DevapeCms description.
|
59
59
|
email:
|
60
60
|
executables: []
|
@@ -328,6 +328,8 @@ files:
|
|
328
328
|
- lib/rails/generators/devape_cms/templates/tiny_mce/license.txt
|
329
329
|
- lib/rails/generators/devape_cms/templates/new.html.erb
|
330
330
|
- lib/rails/generators/devape_cms/templates/initializer.rb
|
331
|
+
- lib/rails/generators/devape_cms/templates/user.rb
|
332
|
+
- lib/rails/generators/devape_cms/templates/member.rb
|
331
333
|
- lib/rails/generators/devape_cms/templates/jquery-ui-1.8.14.custom.css
|
332
334
|
- MIT-LICENSE
|
333
335
|
- Rakefile
|
@@ -361,6 +363,7 @@ files:
|
|
361
363
|
- app/views/categories/index.html.erb
|
362
364
|
- app/views/posts/edit.html.erb
|
363
365
|
- app/views/posts/cms.html.erb
|
366
|
+
- app/views/posts/base.html.erb
|
364
367
|
- app/views/posts/_js.html.erb
|
365
368
|
- app/views/posts/notfound.html.erb
|
366
369
|
- app/views/posts/new.html.erb
|
@@ -382,6 +385,8 @@ files:
|
|
382
385
|
- app/models/post.rb
|
383
386
|
- app/models/category.rb
|
384
387
|
- app/models/content.rb
|
388
|
+
- app/models/user.rb
|
389
|
+
- app/models/member.rb
|
385
390
|
- config/routes.rb
|
386
391
|
- public/javascripts/tiny_mce/utils/form_utils.js
|
387
392
|
- public/javascripts/tiny_mce/utils/editable_selects.js
|