We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

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
Activate/deactivate users (untested)
Activity has no effect (yet)
Michael Hartl (author)
Fri Mar 21 17:30:19 -0700 2008
commit  827c53ef88cc0e19f0339819589956e69c4dd9ef
tree    f9900b862b25c9040f94df39d5c8e1b7e2c27dd8
parent  d465f55e1e337d85adae36237f109c5b23ba2927
...
1
2
 
 
 
3
4
 
5
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
8
...
1
2
3
4
5
6
 
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
0
@@ -1,7 +1,30 @@
0
 class Admin::PeopleController < ApplicationController
0
 
0
+ before_filter :login_required, :admin_required
0
+
0
+
0
   def index
0
-
0
+ @people = Person.paginate(:all, :page => params[:page], :order => :name)
0
   end
0
 
0
+ def update
0
+ @person = Person.find(params[:id])
0
+ case params[:task]
0
+ when "deactivate"
0
+ if current_person?(@person)
0
+ flash[:error] = "You can't deactivate yourself"
0
+ else
0
+ @person.deactivated = @person.deactivated? ? nil : true
0
+ @person.save!
0
+ flash[:success] = "#{@person.name} updated."
0
+ end
0
+ redirect_to admin_people_url
0
+ end
0
+ end
0
+
0
+ private
0
+
0
+ def admin_required
0
+ redirect_to home_url unless current_person.admin?
0
+ end
0
 end
0
\ No newline at end of file
...
18
19
20
21
22
23
24
25
26
...
18
19
20
 
 
 
21
22
23
0
@@ -18,9 +18,6 @@ class PeopleController < ApplicationController
0
       flash.now[:notice] = %(You are viewing your own profile.
0
                              <a href="#{link}">Click here to edit it</a>)
0
     end
0
- if logged_in? and current_person.admin?
0
- flash.now[:success] = "You're an admin!"
0
- end
0
     respond_to do |format|
0
       format.html
0
     end
...
1
2
 
 
 
 
 
 
 
 
...
 
1
2
3
4
5
6
7
8
9
0
@@ -1 +1,8 @@
0
-foo
0
\ No newline at end of file
0
+<%= will_paginate %>
0
+
0
+<table>
0
+ <tr><th colspan="3">People</th></tr>
0
+ <%= render :partial => 'person', :collection => @people %>
0
+</table>
0
+
0
+<%= will_paginate %>
...
1
2
3
4
5
...
1
 
2
3
4
0
@@ -1,5 +1,4 @@
0
 <%- column_div :type => :primary do -%>
0
- <%= link_to "foo", admin_people_url %>
0
   <%= render :partial => 'feed' %>
0
   <%= render :partial => 'forum_preview' %>
0
   <%= render :partial => 'members_preview' %>
...
4
5
6
 
7
8
9
...
4
5
6
7
8
9
10
0
@@ -4,6 +4,7 @@ quentin:
0
   description: I'm Quentin
0
   crypted_password: TWnnx/+SvCoLEP2kkTEAyrrg3dBRdqfWFUaqo0KEGenEIatA53w/rVgVSvKA\n09SkwWkLynTghL93GAILQzXOdXkVGr6EQEOScOMaUVDdABHkh65/+fJWkRBO\nvzIJ8NrxKAJZYZF015wnlP0vGZBqEYg+yesLZkQVeB1PzWefFrs=\n
0
   created_at: <%= 5.days.ago.to_s :db %>
0
+ admin: true
0
 
0
 aaron:
0
   email: aaron@example.com
...
61
62
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
65
66
...
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
...
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
134
135
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
138
139
0
@@ -61,6 +61,26 @@ describe Person do
0
     end
0
   end
0
   
0
+ describe "associations" do
0
+
0
+ before(:each) do
0
+ @contact = people(:aaron)
0
+ end
0
+
0
+ # TODO: make custom matchers to get @contact.should have_requested_contacts
0
+ it "should have requested contacts" do
0
+ Connection.request(@person, @contact)
0
+ @contact.requested_contacts.should_not be_empty
0
+ end
0
+
0
+ it "should have contacts" do
0
+ Connection.request(@person, @contact)
0
+ Connection.accept(@person, @contact)
0
+ @person.contacts.should == [@contact]
0
+ @contact.contacts.should == [@person]
0
+ end
0
+ end
0
+
0
   describe "photo methods" do
0
     
0
     before(:each) do
0
@@ -114,26 +134,6 @@ describe Person do
0
     end
0
   end
0
   
0
- describe "associations" do
0
-
0
- before(:each) do
0
- @contact = people(:aaron)
0
- end
0
-
0
- # TODO: make custom matchers to get @contact.should have_requested_contacts
0
- it "should have requested contacts" do
0
- Connection.request(@person, @contact)
0
- @contact.requested_contacts.should_not be_empty
0
- end
0
-
0
- it "should have contacts" do
0
- Connection.request(@person, @contact)
0
- Connection.accept(@person, @contact)
0
- @person.contacts.should == [@contact]
0
- @contact.contacts.should == [@person]
0
- end
0
- end
0
-
0
   describe "authentication" do
0
     it 'resets password' do
0
       @person.update_attributes(:password => 'newp',

Comments

    No one has commented yet.