public
Fork of trevorturk/el-dorado
Description: Localized version of El Dorado using Gibberish. Dutch language included.
Homepage: http://almosteffortless.com/eldorado/
Clone URL: git://github.com/jxl/el-dorado.git
Search Repo:
Merge
jxl (author)
Fri May 16 04:34:14 -0700 2008
commit  4591a59c088988e037a142cf58967e7b375b3e30
tree    445ab7dd15dc2f6a77e5d8953b657622666121c7
parent  81c6640d3aada42df6fb64e59b0f70e38f5d50ea parent  2464989aa555ebb396c18f48439ddf4e50791c0c
...
9
10
11
12
 
13
14
15
...
9
10
11
 
12
13
14
15
0
@@ -9,7 +9,7 @@
0
   def show
0
     @category = Category.find(params[:id], :include => :forums)
0
     @forums = @category.forums
0
- @topics = Topic.paginate(:page => params[:page], :include => [:user, :forum, :last_poster], :order => 'topics.sticky desc, topics.last_post_at desc', :conditions => ["forum_id in (?)", @forums.collect(&:id)])
0
+ @topics = Topic.paginate(:page => params[:page], :include => [:user, :forum, :last_poster], :order => 'topics.topics.last_post_at desc', :conditions => ["forum_id in (?)", @forums.collect(&:id)])
0
     render(:template => "topics/index")
0
   end
0
   
...
3
4
5
6
 
7
8
9
10
 
11
12
13
...
3
4
5
 
6
7
8
9
 
10
11
12
13
0
@@ -3,11 +3,11 @@
0
   def index
0
       @date = Time.parse("#{params[:date]} || TzTime.now")
0
       @avatars = Avatar.find(:all, :limit => 3, :include => :user, :order => 'avatars.updated_at desc')
0
- @message = Message.latest
0
+ @message = Message.last
0
       @chatters = User.chatting
0
       @events = Event.find(:all, :conditions => ['date between ? and ?', @date.strftime("%Y-%m") + '-01', @date.next_month.strftime("%Y-%m") + '-01'])
0
       @headers = Header.find(:all, :limit => 3, :include => :user, :order => 'headers.created_at desc')
0
- @topics = Topic.find(:all, :limit => 20, :include => [:user, :forum, :last_poster], :order => 'topics.sticky desc, topics.last_post_at desc')
0
+ @topics = Topic.find(:all, :limit => 20, :include => [:user, :forum, :last_poster], :order => 'topics.topics.last_post_at desc')
0
       @uploads = Upload.find(:all, :limit => 5, :include => :user, :order => 'uploads.updated_at desc')
0
       @users = User.find(:all, :limit => 3, :order => 'profile_updated_at desc')
0
   end
...
4
5
6
7
 
8
9
 
10
11
12
13
 
 
 
 
14
15
16
...
34
35
36
37
 
 
 
 
 
 
 
 
 
 
 
38
39
40
...
53
54
55
56
 
57
...
4
5
6
 
7
8
9
10
11
12
 
 
13
14
15
16
17
18
19
...
37
38
39
 
40
41
42
43
44
45
46
47
48
49
50
51
52
53
...
66
67
68
 
69
70
0
@@ -4,13 +4,16 @@
0
   before_filter :require_login, :only => [:create]
0
   before_filter :can_edit, :only => [:destroy]
0
   
0
- skip_filter :update_online_at, :get_layout_vars, :only => [:refresh_messages, :refresh_chatters]
0
+ skip_filter :update_online_at, :get_layout_vars, :only => [:more, :refresh, :refresh_chatters]
0
   
0
   def index
0
+ @messages = Message.get
0
     current_user.update_attribute('chatting_at', Time.now.utc) if logged_in?
0
     @chatters = User.chatting
0
- @messages = Message.paginate(:page => params[:page], :include => [:user], :order => 'messages.created_at desc')
0
- session[:message_id] = @messages.map(&:id).max unless @messages.empty?
0
+ unless @messages.empty?
0
+ session[:message_id] = @messages.map(&:id).max
0
+ @last_message = @messages.map(&:id).min
0
+ end
0
   end
0
   
0
   def show
0
@@ -34,7 +37,17 @@
0
     redirect_to chat_url
0
   end
0
   
0
- def refresh_messages
0
+ def more
0
+ @messages = Message.more(params[:id])
0
+ @last_message = @messages.map(&:id).min unless @messages.empty?
0
+ render :update do |page|
0
+ page.insert_html :bottom, 'messages-index', :partial => 'messages', :object => @messages
0
+ page.replace_html 'messages-more', :partial => 'more', :object => @last_message
0
+ page.remove 'messages-more' if @messages.size < 100
0
+ end
0
+ end
0
+
0
+ def refresh
0
     @messages = Message.refresh(session[:message_id], current_user)
0
     session[:message_id] = @messages.map(&:id).max unless @messages.empty?
0
     if @messages
0
@@ -53,6 +66,6 @@
0
         page.replace_html 'chatters', :partial => 'chatters', :object => @chatters
0
       end
0
     end
0
- end
0
+ end
0
 end
...
15
16
17
18
19
 
 
 
20
 
 
 
 
21
22
23
 
 
 
 
 
 
24
25
26
...
15
16
17
 
 
18
19
20
21
22
23
24
25
26
 
 
27
28
29
30
31
32
33
34
35
0
@@ -15,12 +15,21 @@
0
   
0
   validates_presence_of :body
0
   
0
- def self.latest
0
- find(:first, :order => 'created_at desc')
0
+ # TODO can remove w/ rails 2.1
0
+ def self.last
0
+ find(:first, :order => 'id desc')
0
   end
0
+
0
+ def self.get
0
+ find(:all, :limit => 50, :order => 'messages.id desc', :include => :user)
0
+ end
0
   
0
- def self.refresh(message_id, current_user)
0
- find(:all, :order => 'created_at desc', :conditions => ['id > ? and user_id != ?', message_id, current_user])
0
+ def self.more(id)
0
+ find(:all, :limit => 100, :order => 'messages.id desc', :include => :user, :conditions => ['messages.id < ?', id])
0
+ end
0
+
0
+ def self.refresh(id, current_user)
0
+ find(:all, :order => 'messages.id desc', :include => :user, :conditions => ['messages.id > ? and user_id != ?', id, current_user])
0
   end
0
   
0
   def to_s
...
40
41
42
 
43
44
45
...
40
41
42
43
44
45
46
0
@@ -40,6 +40,7 @@
0
   validates_presence_of :login, :email, :password_hash
0
   validates_uniqueness_of :login, :case_sensitive => false
0
   validates_length_of :login, :maximum => 25
0
+ validates_format_of :email, :on => :create, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
0
   validates_confirmation_of :password, :on => :create
0
   validates_confirmation_of :password, :on => :update, :allow_blank => true
0
  
...
 
...
1
0
@@ -1 +1,2 @@
0
+<%= link_to_remote '&darr; More Messages &darr;', :url => { :action => 'more', :id => @last_message }, :method => :get %>
...
4
5
6
7
 
8
9
10
...
22
23
24
25
26
27
28
29
 
 
 
 
 
 
 
...
4
5
6
 
7
8
9
10
...
22
23
24
 
 
 
 
 
25
26
27
28
29
30
31
0
@@ -4,7 +4,7 @@
0
 </div>
0
 <div style="clear:both;"> </div>
0
 
0
-<% if logged_in? && params[:page].blank? %>
0
+<% if logged_in? ? %>
0
   <div class="info-left" style="width:100%;">
0
     <% @message = Message.new unless @message %>
0
     <% remote_form_for @message, :loading => "$('message_body').clear();" do |f| -%>
0
@@ -22,9 +22,11 @@
0
   </tbody>
0
 </table>
0
 
0
-<% unless params[:page] %>
0
- <%= periodically_call_remote :url => refresh_messages_path, :method => 'get', :frequency => 3 %>
0
- <%= periodically_call_remote :url => refresh_chatters_path, :method => 'get', :frequency => 10 %>
0
- <%= javascript_tag "$('message_body').focus();$('message_body').writeAttribute('autocomplete', 'off');" if logged_in? %>
0
-<% end %>
0
+<p id="messages-more" class="center">
0
+ <%= render :partial => 'more', :object => @last_message unless @messages.size < 50 %>
0
+</p>
0
+
0
+<%= periodically_call_remote :url => refresh_messages_path, :method => 'get', :frequency => 3 %>
0
+<%= periodically_call_remote :url => refresh_chatters_path, :method => 'get', :frequency => 10 %>
0
+<%= javascript_tag "$('message_body').focus();$('message_body').writeAttribute('autocomplete', 'off');" if logged_in? %>
...
115
116
117
118
119
120
121
122
123
124
125
126
...
115
116
117
 
 
 
 
 
 
118
119
120
0
@@ -115,12 +115,6 @@
0
   </div>
0
 <% end %>
0
 
0
-<% if current_controller == 'messages' and current_action == 'index' %>
0
- <div class="info-right">
0
- <%= will_paginate @messages, :inner_window => 1, :outer_window => 0, :prev_label => '&laquo; ' + 'Prev'[:prev], :next_label => 'Next'[:next] + '&raquo;' %>
0
- </div>
0
-<% end %>
0
-
0
 <% if current_controller == 'posts' and current_action == 'edit' %>
0
   <div class="info-left">
0
     <%= link_to 'Home'[:home], root_path %> &raquo;
...
1
2
 
3
4
5
...
7
8
9
10
 
11
12
13
14
15
16
17
18
...
15
16
17
18
 
19
20
21
22
23
24
25
26
 
27
28
29
 
30
31
 
32
33
34
...
1
 
2
3
4
5
...
7
8
9
 
10
11
12
13
14
15
16
17
18
...
15
16
17
 
18
19
20
 
21
22
23
24
25
26
27
 
28
29
30
 
31
32
33
34
0
@@ -1,5 +1,5 @@
0
 ActionController::Routing::Routes.draw do |map|
0
-
0
+
0
   map.root :controller => 'home'
0
   
0
   map.resources :avatars, :member => { :select => :post, :deselect => :post }
0
@@ -7,7 +7,7 @@
0
   map.resources :events
0
   map.resources :forums, :member => { :confirm_delete => :get }
0
   map.resources :headers, :member => { :vote_up => :post, :vote_down => :post }
0
- map.resources :messages
0
+ map.resources :messages, :collection => { :more => :get, :refresh => :get }
0
   map.resources :posts, :member => { :quote => :get, :topic => :get }
0
   map.resources :ranks
0
   map.resources :settings
0
0
0
0
0
0
@@ -15,20 +15,20 @@
0
   map.resources :themes, :member => { :select => :post, :deselect => :post }
0
   map.resources :topics, :member => { :show_new => :get }
0
   map.resources :uploads
0
- map.resources :users, :member => { :posts => :get, :confirm_delete => :get, :admin => :post, :ban => :get, :remove_ban => :post }
0
+ map.resources :users, :member => { :posts => :get, :admin => :post, :ban => :get, :remove_ban => :post, :confirm_delete => :get }
0
   
0
   map.search 'search', :controller => 'search', :action => 'index'
0
- map.refresh_messages 'refresh_messages', :controller => 'messages', :action => 'refresh_messages'
0
   map.refresh_chatters 'refresh_chatters', :controller => 'messages', :action => 'refresh_chatters'
0
   
0
   map.login 'login', :controller => 'users', :action => 'login'
0
   map.logout 'logout', :controller => 'users', :action => 'logout'
0
   map.register 'register', :controller => 'users', :action => 'new'
0
+
0
   map.admin 'admin', :controller => 'settings', :action => 'index'
0
- map.files 'files', :controller => 'uploads', :action => 'index'
0
   map.chat 'chat', :controller => 'messages', :action => 'index'
0
+ map.files 'files', :controller => 'uploads', :action => 'index'
0
   map.forum_root 'forum', :controller => 'forums', :action => 'index'
0
-
0
+
0
   map.exceptions 'logged_exceptions/:action/:id', :controller => 'logged_exceptions', :action => 'index', :id => nil
0
   
0
   map.catch_all '*path', :controller => 'topics', :action => 'unknown_request'
...
589
590
591
 
 
 
 
592
593
594
...
589
590
591
592
593
594
595
596
597
598
0
@@ -589,6 +589,10 @@
0
   padding: 4px 5px;
0
 }
0
 
0
+.center {
0
+ text-align: center;
0
+}
0
+
0
 .post-body img { max-width: 560px; }
0
 .post-body blockquote img { max-width: 528px; }
0
 .post-body blockquote blockquote img { max-width: 494px; }
...
99
100
101
 
 
 
 
 
102
103
 
104
105
106
...
108
109
110
111
 
112
...
99
100
101
102
103
104
105
106
107
 
108
109
110
111
...
113
114
115
 
116
117
0
@@ -99,8 +99,13 @@
0
     assert_redirected_to root_path
0
   end
0
   
0
+ def test_more_messages_path_should_work
0
+ get :more
0
+ assert_response :success
0
+ end
0
+
0
   def test_refresh_messages_path_should_work
0
- get :refresh_messages
0
+ get :refresh
0
     assert_response :success
0
   end
0
   
0
@@ -108,6 +113,6 @@
0
     get :refresh_chatters
0
     assert_response :success
0
   end
0
-
0
+
0
 end
...
171
172
173
 
 
 
 
 
 
 
174
175
176
...
171
172
173
174
175
176
177
178
179
180
181
182
183
0
@@ -171,6 +171,13 @@
0
     assert_template "new"
0
     assert_equal num_users, User.count
0
   end
0
+
0
+ def test_should_not_create_user_without_valid_email
0
+ num_users = User.count
0
+ post :create, :user => {:login => 'test', :email => 'not_valid', :password => 'test'}
0
+ assert_template "new"
0
+ assert_equal num_users, User.count
0
+ end
0
 
0
   def test_should_not_create_user_without_password_confirmation
0
     num_users = User.count
...
13
14
15
 
 
16
17
18
...
13
14
15
16
17
18
19
20
0
@@ -13,6 +13,8 @@
0
     u = User.create(:login => "test", :email => "email", :password => "sdlfkj", :password_confirmation => '')
0
     assert ! u.valid?
0
     u = User.create(:login => "test", :email => "email", :password => "sdlfkj", :password_confirmation => "sdlfkj")
0
+ assert ! u.valid?
0
+ u = User.create(:login => "test", :email => "email@address.com", :password => "sdlfkj", :password_confirmation => "sdlfkj")
0
     assert u.valid?
0
   end
0
     
...
26
27
28
 
29
30
31
32
33
...
38
39
40
41
 
 
42
43
44
45
46
47
48
49
 
 
 
50
51
 
52
53
54
...
26
27
28
29
30
31
32
33
34
...
39
40
41
 
42
43
44
45
46
47
48
 
 
 
49
50
51
52
 
53
54
55
56
0
@@ -26,6 +26,7 @@
0
       :flash => [ /\[flash\](.+?)\[\/flash\]/i, '<object width="100%" height="100%"><param name="movie" value="\1"></param><embed src="\1" type="application/x-shockwave-flash" width="100%" height="100%"></embed></object>' ],
0
       :spoiler => [ /\[spoiler\](.+?)\[\/spoiler\]/im, '<a href="#" class="spoiler-link" onclick="$(\'_RANDOM_ID_\').toggle(); return false;">SPOILER</a><div id="_RANDOM_ID_" class="spoiler" style="display:none;">\1</div>' ],
0
       :nsfw => [ /\[nsfw\](.+?)\[\/nsfw\]/im, '<a href="#" class="nsfw-link" onclick="$(\'_RANDOM_ID_\').toggle(); return false;">NSFW</a><div id="_RANDOM_ID_" class="nsfw" style="display:none;">\1</div>' ],
0
+ :hide => [ /\[hide=(.+?)\](.+?)\[\/hide\]/im, '<a href="#" class="hide-link" onclick="$(\'_RANDOM_ID_\').toggle(); return false;">\1</a><div id="_RANDOM_ID_" class="hide" style="display:none;">\2</div>' ],
0
       :mp3 => [ /\[mp3\](.+?)\[\/mp3\]/i, '<script language="JavaScript" src="/javascripts/audio-player.js"></script><object type="application/x-shockwave-flash" data="/flash/player.swf" id="_RANDOM_ID_" height="24" width="290"><param name="movie" value="/flash/player.swf"><param name="FlashVars" value="playerID=_RANDOM_ID_&amp;soundFile=\1"><param name="quality" value="high"><param name="menu" value="false"><param name="wmode" value="transparent"></object>' ],
0
       :superdeluxe => [ /\[superdeluxe\](.+?)superdeluxe.com\/sd\/contentDetail.do\?id=(.+?)\[\/superdeluxe\]/i, '<object width="400" height="350"><param name="allowFullScreen" value="true" /><param name="movie" value="http://www.superdeluxe.com/static/swf/share_vidplayer.swf" /><param name="FlashVars" value="id=\2" /><embed src="http://www.superdeluxe.com/static/swf/share_vidplayer.swf" FlashVars="id=\2" type="application/x-shockwave-flash" width="400" height="350" allowFullScreen="true" ></embed></object>' ],
0
       :comedycentral => [ /\[comedycentral\](.+?)comedycentral.com\/motherload\/index.jhtml\?ml_video=(.+?)\[\/comedycentral\]/i, '<embed FlashVars="config=http://www.comedycentral.com/motherload/xml/data_synd.jhtml?vid=\2%26myspace=false" src="http://www.comedycentral.com/motherload/syndicated_player/index.jhtml" quality="high" bgcolor="#006699" width="340" height="325" name="comedy_player" align="middle" allowScriptAccess="always" allownetworking="external" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>' ],
0
0
0
@@ -38,17 +39,18 @@
0
       :gametrailers => [ /\[gametrailers\](.+?)gametrailers.com\/player\/(.+?).(.+?)\[\/gametrailers\]/i, '<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="gtembed" width="480" height="392">  <param name="allowScriptAccess" value="sameDomain" /> <param name="allowFullScreen" value="true" /> <param name="movie" value="http://www.gametrailers.com/remote_wrap.php?mid=/2"/> <param name="quality" value="high" /> <embed src="http://www.gametrailers.com/remote_wrap.php?mid=27505" swLiveConnect="true" name="gtembed" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="480" height="392"></embed> </object>' ],
0
       :slideshare => [ /\[slideshare id=(.+?)&(.+?)=(.+?)&(.+?)=(.+?)\]/i, '<object type="application/x-shockwave-flash" wmode="transparent" data="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=\1&#038;doc=\3" width="\5" height="348"><param name="movie" value="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=\1&#038;doc=\3" /></object>' ],
0
       :funnyordie => [ /\[funnyordie\](.+?)funnyordie.com\/videos\/(.+?)\[\/funnyordie\]/i, '<object width="464" height="388"><param name="movie" value="http://www2.funnyordie.com/public/flash/fodplayer.swf?6045" /><param name="flashvars" value="key=\2" /><param name="allowfullscreen" value="true" /><embed width="464" height="388" flashvars="key=\2" allowfullscreen="true" quality="high" src="http://www2.funnyordie.com/public/flash/fodplayer.swf?6045" type="application/x-shockwave-flash"></embed></object>' ],
0
- :atomfilms => [ /\[atomfilms\](.+?)atomfilms.com\/film\/(.+?)\[\/atomfilms\]/i, '<embed src="http://www.atomfilms.com:80/a/autoplayer/shareEmbed.swf?keyword=\2" width="426" height="350"></embed>' ]
0
+ :atomfilms => [ /\[atomfilms\](.+?)atomfilms.com\/film\/(.+?)\[\/atomfilms\]/i, '<embed src="http://www.atomfilms.com:80/a/autoplayer/shareEmbed.swf?keyword=\2" width="426" height="350"></embed>' ],
0
+ :vimeo => [ /\[vimeo\](.+?)vimeo.com\/(.+?)\[\/vimeo\]/i, '<object type="application/x-shockwave-flash" width="400" height="300" data="http://www.vimeo.com/moogaloop.swf?clip_id=\2&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color="> <param name="quality" value="best" /> <param name="allowfullscreen" value="true" /> <param name="scale" value="showAll" /> <param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=\2&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" /></object>' ]
0
     }
0
         
0
     # Tags in this list are invoked. To deactivate a particular tag, call BBCodeizer.deactivate.
0
     # These names correspond to either names above or methods in this module.
0
     TagList = [ :bold, :italic, :underline, :email_with_name, :email_sans_name,
0
- :url_with_title, :url_sans_title, :image, :size, :color,
0
- :code, :quote, :youtube, :googlevid, :flash, :spoiler, :nsfw, :mp3,
0
- :superdeluxe, :comedycentral, :revver, :myspacetv, :collegehumor,
0
+ :url_with_title, :url_sans_title, :image, :size, :color, :code,
0
+ :quote, :youtube, :googlevid, :flash, :spoiler, :nsfw, :hide, :mp3,
0
+ :superdeluxe, :comedycentral, :revver, :myspacetv, :collegehumor,
0
                 :metacafe, :yahoovid, :flickr, :gametrailers, :slideshare, :funnyordie,
0
- :atomfilms ]
0
+ :atomfilms, :vimeo ]
0
 
0
     # Parses all bbcode in +text+ and returns a new HTML-formatted string.
0
     def bbcodeize(text)

Comments

    No one has commented yet.