public
Description: The open source social networking platform in Ruby on Rails from the author of RailsSpace
Homepage: http://insoshi.com
Clone URL: git://github.com/insoshi/insoshi.git
Search Repo:
Partitioned admin views into admin? and admin_view?
admin? is to allow admins to use the regular interface to do admin stuff
admin_view? is for views available only to admins
Michael Hartl (author)
Thu May 01 14:47:36 -0700 2008
commit  6f94c019b03be4b60ef0f26b01453f1e0baec09a
tree    b52ad0d52f19020cfca9091e1b1d697bfc286a3f
parent  aaa46880fa81fab6e7fc1e2bf00a3c0b32c28d9d
...
48
49
50
 
 
 
 
51
52
53
...
48
49
50
51
52
53
54
55
56
57
0
@@ -48,6 +48,10 @@ module ApplicationHelper
0
   
0
   # Return true if the user is viewing the site in admin view.
0
   def admin_view?
0
+ params[:controller] =~ /admin/ and admin?
0
+ end
0
+
0
+ def admin?
0
     logged_in? and current_person.admin?
0
   end
0
   
...
10
11
12
13
 
14
15
16
...
10
11
12
 
13
14
15
16
0
@@ -10,7 +10,7 @@
0
         | <%= link_to "Edit",
0
                 edit_forum_topic_post_path(@forum, @topic, forum_post) %>
0
       <%- end -%>
0
- <%- if admin_view? -%>
0
+ <%- if admin? -%>
0
         | <%= link_to "Destroy",
0
                       forum_topic_post_path(@forum, @topic, forum_post),
0
                       :confirm => 'Are you sure?',
...
14
15
16
17
 
18
19
20
...
14
15
16
 
17
18
19
20
0
@@ -14,7 +14,7 @@
0
   <p class="meta">
0
     Created by <%= person_link topic.person %>
0
     <%= time_ago_in_words(topic.created_at) %> ago
0
- <%- if admin_view? -%>
0
+ <%- if admin? -%>
0
       | <%= link_to "Edit", edit_forum_topic_path(@forum, topic) %>
0
       | <%= link_to "Destroy", forum_topic_path(@forum, topic),
0
                                 :confirm => 'Are you sure?',
...
6
7
8
 
 
9
10
11
...
6
7
8
9
10
11
12
13
0
@@ -6,6 +6,8 @@ describe "/people/show.html.erb" do
0
     @person = login_as(:quentin)
0
     @person.description = "Foo *bar*"
0
     assigns[:person] = @person
0
+ assigns[:some_contacts] = @person.some_contacts
0
+ assigns[:common_connections] = []
0
     render "/people/show.html.erb"
0
   end
0
 

Comments

    No one has commented yet.