public
Fork of queso/signal-wiki
Description: The easy to use rails wiki
Homepage: http://signalwiki.com
Clone URL: git://github.com/pyu10055/signal-wiki.git
Included admin? function so someone doesn't have to type logged_in? && 
current_user.admin? every time
codafoo (author)
Thu Apr 17 00:48:42 -0700 2008
queso (committer)
Fri Apr 18 10:49:58 -0700 2008
commit  16d0139ed412d2d7d7a8b1caf102932c1d3d155d
tree    b254c40e5d2a385fee8540d57b96c6850772f8b5
parent  902961c070dc8f7e76fca8f5c7c4944e072332c3
...
16
17
18
19
 
20
21
22
...
16
17
18
 
19
20
21
22
0
@@ -16,7 +16,7 @@ class ApplicationController < ActionController::Base
0
   end
0
   
0
   def require_admin
0
- redirect_to(page_path('home')) unless logged_in? && current_user.admin?
0
+ redirect_to(page_path('home')) unless admin?
0
   end
0
   
0
 end
...
4
5
6
7
 
8
9
10
 
 
11
12
13
...
17
18
19
20
 
21
22
23
...
4
5
6
 
7
8
 
 
9
10
11
12
13
...
17
18
19
 
20
21
22
23
0
@@ -4,10 +4,10 @@
0
   <li><%= link_to 'View all revisions', revisions_page_url(:id => page.permalink) %></li>
0
   <li><%= link_to 'View previous revision', revision_page_url(:id => page.permalink, :version => version.previous.version) if version.previous %></li>
0
   <li><%= link_to 'View next revision', revision_page_url(:id => page.permalink, :version => version.next.version) if version.next %></li>
0
- <li><%= link_to((page.locked? ? "Unlock this page" : "Lock this page"), lock_page_path(page)) if logged_in? && current_user.admin? %></li>
0
+ <li><%= link_to((page.locked? ? "Unlock this page" : "Lock this page"), lock_page_path(page)) if admin? %></li>
0
   <% if page.version == version.version %>
0
- <li><%= link_to 'Edit this page', edit_page_path(page) unless page.locked? && logged_in? && !current_user.admin? %></li>
0
- <li><%= link_to "Delete this page and all revisions", page_path(page), :method => :delete if logged_in? && current_user.admin? && page.permalink != 'home' %></li>
0
+ <li><%= link_to 'Edit this page', edit_page_path(page) unless page.locked? && !admin? %></li>
0
+ <li><%= link_to "Delete this page and all revisions", page_path(page), :method => :delete if admin? && page.permalink != 'home' %></li>
0
     <li><%= link_to 'Return to home', pages_path unless page.permalink == "home" %></li>
0
     <li>Inbound links:
0
      <ul>
0
@@ -17,7 +17,7 @@
0
      </ul>
0
    </li>
0
   <% else %>
0
- <li><%= link_to "Rollback to this revision", rollback_page_url(:id => page.permalink, :version => (version.version)) unless (page.locked?) %></li>
0
+ <li><%= link_to "Rollback to this revision", rollback_page_url(:id => page.permalink, :version => (version.version)) unless (page.locked? && !admin?) %></li>
0
     <li><%= link_to 'Return to current revision', wiki_page_url(page.permalink) %></li>    
0
   <% end %>
0
   <%# FIXME Clean up this revision link logic %>
...
96
97
98
99
 
100
101
102
...
96
97
98
 
99
100
101
102
0
@@ -96,7 +96,7 @@ module AuthenticatedSystem
0
     # Inclusion hook to make #current_user and #logged_in?
0
     # available as ActionView helper methods.
0
     def self.included(base)
0
- base.send :helper_method, :current_user, :logged_in?
0
+ base.send :helper_method, :current_user, :logged_in?, :admin?
0
     end
0
 
0
     # Called from #current_user. First attempt to login by the user id stored in the session.

Comments

    No one has commented yet.