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
Nice message results, horrible search hack
Michael Hartl (author)
Fri Apr 04 18:13:21 -0700 2008
commit  a3029538e498e2786201783800414d71eb3a9e33
tree    3b067a2bf2dbd9e36a2a7f8f9670b5c5467e9e8b
parent  d010b2371ea3455fcfe98529b98b5b680fdf5d79
...
81
82
83
84
85
86
87
88
89
90
91
92
...
81
82
83
 
 
 
 
 
 
84
85
86
0
@@ -81,12 +81,6 @@ module ApplicationHelper
0
   end
0
 
0
   # TODO: polish these & move them somewhere
0
- def linked_image(person, options = {})
0
- href = options[:href] || person
0
- o = { :size => 'thumbnail' }.merge(options)
0
- link_to image_tag(person.send(o[:size])), href
0
- end
0
-
0
   def name_link(person, options = {})
0
      link_to h(person.name), person, options
0
   end
...
46
47
48
49
 
 
50
51
52
...
46
47
48
 
49
50
51
52
53
0
@@ -46,7 +46,8 @@ class Message < Communication
0
       # This is ineffecient. We'll fix it when we move to Sphinx.
0
       conditions = ["recipient_id = ? AND recipient_deleted_at IS NULL",
0
                     options[:recipient]]
0
- results = find_by_contents(query, :conditions => conditions)
0
+ # raise conditions.inspect
0
+ results = find_by_contents(query, {}, :conditions => conditions)
0
       results[0...SEARCH_LIMIT].paginate(:page => options[:page],
0
                                          :per_page => SEARCH_PER_PAGE)
0
     end
...
95
96
97
98
 
99
100
101
...
95
96
97
 
98
99
100
101
0
@@ -95,7 +95,7 @@ class Person < ActiveRecord::Base
0
       return [].paginate if query.blank? or query == "*"
0
       # This is ineffecient. We'll fix it when we move to Sphinx.
0
       conditions = ["deactivated = ?", false]
0
- results = find_by_contents(query, :conditions => conditions)
0
+ results = find_by_contents(query, {}, :conditions => conditions)
0
       results[0...SEARCH_LIMIT].paginate(:page => options[:page],
0
                                          :per_page => SEARCH_PER_PAGE)
0
     end
...
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
32
33
34
 
 
35
...
 
 
 
 
 
 
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
32
33
34
35
36
 
 
37
38
39
40
0
@@ -1,33 +1,38 @@
0
-<tr class="message <%= rowclass = cycle("odd", "even") %>">
0
- <td>
0
- <%= image_tag("replied.png") if message.replied_to? %>
0
- <%= image_tag("new.png") unless message.read? %>
0
- </td>
0
- <td>
0
+<div class="message element clear <%= rowclass = cycle("odd", "even") %>">
0
+ <div class="column first span-1">
0
+ <%- if !message.read? -%>
0
+ <%= image_tag("new.png") %>
0
+ <%- elsif message.replied_to? -%>
0
+ <%= image_tag("replied.png") %>
0
+ <%- else -%>
0
+ &nbsp;
0
+ <%- end -%>
0
+ </div>
0
+ <div class="column span-1">
0
     <% if message.sender == current_person %>
0
- <%= linked_image(message.recipient, :size => 'thumbnail') %>
0
+ <%= image_link message.recipient %>
0
     <% else %>
0
- <%= linked_image(message.sender, :size => 'thumbnail') %>
0
+ <%= image_link message.sender %>
0
     <% end %>
0
- </td>
0
- <td>
0
+ </div>
0
+ <div class="column span-4">
0
     <%= render :partial => 'messages/sender_info',
0
                :locals => { :message => message,
0
                             :rowclass => rowclass } %>
0
- </td>
0
- <td>
0
+ </div>
0
+ <div class="column span-7">
0
       <%# TODO: Refactor this mess %>
0
           <% snippet = sanitize(message.subject)
0
              link = message.read? ? snippet : content_tag(:b, snippet)
0
           %>
0
           <%= link_to message.subject, message %>
0
- </td>
0
- <td>
0
+ </div>
0
+ <div class="column span-1 last">
0
     <% unless message.trashed?(current_person) -%>
0
       <%= link_to(image_tag("delete.png"), message, :method => :delete) %>
0
     <% else -%>
0
       <%= link_to "(untrash)", undestroy_message_path(message),
0
                                 :method => :put %>
0
     <% end -%>
0
- </td>
0
-</tr>
0
\ No newline at end of file
0
+ </div>
0
+</div>
0
\ No newline at end of file
...
1
 
2
3
 
4
5
6
7
8
9
10
 
 
 
 
 
11
12
13
...
1
2
3
 
4
5
 
 
 
 
 
 
6
7
8
9
10
11
12
13
0
@@ -1,13 +1,13 @@
0
 <%- column_div :type => :primary do -%>
0
+ <h1>Messages</h1>
0
 
0
-<%= render :partial => 'message_nav' %>
0
+ <%= render :partial => 'message_nav' %>
0
 
0
-<%= will_paginate %>
0
-<table class="listing">
0
- <tr><th colspan="5">Messages</th></tr>
0
- <%= render :partial => "message", :collection => @messages %>
0
-</table>
0
-<%= will_paginate %>
0
+ <%= will_paginate %>
0
+ <div class="section">
0
+ <%= render :partial => "message", :collection => @messages %>
0
+ </div>
0
+ <%= will_paginate %>
0
 
0
 <%- end -%>
0
 
...
12
13
14
15
 
16
17
18
...
12
13
14
 
15
16
17
18
0
@@ -12,7 +12,7 @@
0
   </tr>
0
   <tr>
0
     <td>
0
- <%= linked_image(@recipient, :size => 'thumbnail') %>
0
+ <%= image_link @recipient, :image => :thumbnail %>
0
     </td>
0
     
0
     <td>
...
16
17
18
19
 
20
21
22
...
16
17
18
 
19
20
21
22
0
@@ -16,7 +16,7 @@
0
   <table class="userlayout">
0
     <tr>
0
       <td class="sender" style="text-align: center;">
0
- <%= linked_image @message.sender, :size => 'thumbnail' %>
0
+ <%= image_link @message.sender, :image => :thumbnail %>
0
       </td>
0
       <td>
0
         <%= render :partial => 'sender_info',
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-<div class="activity clear">
0
+<div class="activity section">
0
   <%- unless @person.recent_activity.empty? -%>
0
   <h1>Recent Activity</h1>
0
      <%= render :partial => 'shared/activity',
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 <%- column_div :type => :primary do -%>
0
   
0
   <h1>Blog</h1>
0
- <div class="blog section clear">
0
+ <div class="blog section">
0
     <%= render :partial => 'blog_post', :collection => @posts %>
0
   </div>
0
 
...
1
2
3
 
4
5
6
...
1
2
 
3
4
5
6
0
@@ -1,6 +1,6 @@
0
 <%- column_div :type => :primary do -%>
0
   <h1><%= @topic.name %></h1>
0
- <div class="forum section clear">
0
+ <div class="forum section">
0
     <%= render :partial => 'forum_post', :collection => @posts %>
0
   </div>
0
 
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 <% column_div :type => :primary do %>
0
   <h1>Search results</h1>
0
   <%= will_paginate(@results) %>
0
- <div class="search section clear">
0
+ <div class="search section">
0
     <%- if @results.empty? -%>
0
       <h1>No results</h1>
0
     <%- else -%>

Comments

    No one has commented yet.