Permalink
Browse files

Merge branch 'master' of github.com:newscloud/n2 into release3

  • Loading branch information...
chewbranca committed May 3, 2011
2 parents d6332c5 + 409f7e5 commit 163e37df8c5c96264d3afd5bbef92dfd843b9679
View
@@ -3,6 +3,12 @@ Installing on Ubuntu 10.04 LTS Server
This guide will bootstrap newscloud from a minimal ubuntu server install.
+Update Your System
+------------------
+If necessary, update your system:
+
+ sudo apt-get update
+
Base Utilities
--------------
@@ -333,7 +333,7 @@ def update_last_active
unless not Rails.env.development? and last_active and current_user.last_active < last_active + 1.hour
fb_friends = current_facebook_user.friend_ids.join(',')
redis_friends = $redis.get "#{current_user.cache_id}:friends_string"
- unless fb_friends == redis_friends or current_user.last_active < last_active + 4.hours
+ unless fb_friends == redis_friends or (last_active and current_user.last_active < last_active + 4.hours)
$redis.set "#{current_user.cache_id}:friends_string", fb_friends
current_user.redis_update_friends fb_friends
end
View
@@ -31,9 +31,17 @@ def async_vote_messenger item_url, app_caption, image_url = nil
end
def self.top_items limit = 5, range = nil, min_items = nil
+ # HACK:: TODO:: FIXME
+ # When this gets run through Metadata::ViewObjectSetting.kommand_chain
+ # something like [3,nil,3] will get flattened to [3,3] which is obviously not right
+ if range.is_a?(Integer) and min_items.nil?
+ min_items = range
+ range = nil
+ end
+
range ||= 1.week.ago
items = self.active.find(:all, :select => 'count(*) as count, votes.*', :group => 'voteable_type, voteable_id', :conditions => ["voteable_type IN ('#{self.item_klasses.join "', '"}') AND created_at > ?", range], :limit => limit, :order => "count desc, created_at desc").map(&:voteable)
- if items.any? and (not min_items or items.count > min_items)
+ if items.any? and (not min_items or items.count >= min_items)
items
else
items = self.active.find(:all, :select => 'count(*) as count, votes.*', :group => 'voteable_type, voteable_id', :conditions => ["voteable_type IN ('#{self.item_klasses.join "', '"}')"], :limit => limit, :order => "count desc, created_at desc").map(&:voteable)
@@ -786,4 +786,79 @@ p
#follow-twitterapi
display: block
- text-align: center
+ text-align: center
+
+/****************************************************
+ PREDICTIONS */
+
+.prediction-details
+ .item-details
+ margin-bottom: $PanelGutters * .5
+ .vote-options
+ border: 1px solid #ccc
+ padding: 10px 10px 0
+ margin-bottom: 10px
+ ul
+ display: inline-block
+ width: 100%
+ margin: 0
+ padding: 0
+ li
+ background-color: $PanelBarFeaturedBG
+ float: left
+ width: 100%
+ padding: 5px 0
+ margin-bottom: 10px
+ .vote-opt-list
+ ul
+ margin-bottom: 10px
+ li.option-item
+ &:hover
+ background-color: $PanelBarFeaturedBG - #111
+ label
+ display: block
+ padding: $PanelGutters * .5 $PanelGutters * .5 $PanelGutters * .5 $PanelGutters * 1.15
+ font-weight: bold
+ input
+ float: left
+ margin: $PanelGutters * .5 0 $PanelGutters * .5 $PanelGutters * .25
+ .results-list
+ li.results-item
+ background-color: $PanelBarFeaturedBG
+ &.user-choice
+ background-color: $PanelBarFeaturedBG - #111
+ .numbers
+ float: left
+ width: 30%
+ span
+ text-align: center
+ display: block
+ padding: 5px
+ font-weight: bold
+ .voter-profiles
+ margin-left: -1px
+ border-left: 1px solid #fff
+ float: left
+ width: 70%
+ .profile-pic
+ margin: 0 0 0 10px
+
+
+
+ .pred-nav-bar
+ padding: 5px 0
+ background-color: $subTitleBG
+ display: inline-block
+ width: 100%
+ margin-bottom: 10px
+
+ a
+ color: $linkColor
+ display: inline-block
+ font-weight: bold
+ padding: 0 5px
+
+ &.previous
+ float: left
+ &.next
+ float: right
@@ -1,3 +1,4 @@
+= render :partial => 'shared/tests/predictions'
= render :partial => 'shared/header_test'
@@ -26,3 +27,5 @@
= render :partial => 'shared/tests/v2_popover_postitem'
= render :partial => 'shared/tests/v2_user_WGT'
+
+
@@ -0,0 +1,156 @@
+.clearfix
+
+.panel-2.prediction-details
+ .item-details
+ %h1
+ Predictions: Politics
+ %p
+ Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
+
+ .meta-data
+ %h6
+ Posted by
+ %a Jeff Reifman
+ 3 months ago
+ %h6
+ Tags:
+ %a seattle
+ ,
+ %a politics
+
+ .pred-nav-bar
+ %a.previous
+ &laquo; Previous
+ %a.next
+ Next &raquo;
+ .clearfix
+
+ .vote-options
+ %h4 Will Mike McGinn be reelected?
+ %p Select an option below to vote
+ .vote-opt-list
+ %ul
+ %li.option-item
+ .option
+ = radio_button_tag 'option', '1', :class => 'radio'
+ = label_tag 'option 1'
+ %li.option-item
+ .option
+ = radio_button_tag 'option', '2'
+ = label_tag 'option 2'
+ %li.option-item
+ .option
+ = radio_button_tag 'option', '3'
+ = label_tag 'option 3'
+ %li.option-item
+ .option
+ = radio_button_tag 'option', '4'
+ = label_tag 'option 4'
+ %li.option-item
+ .option
+ = radio_button_tag 'option', '5'
+ = label_tag 'option 5'
+
+
+
+ %p.vote-meta
+ %a Is this question out of date?
+ .vote-options
+ %h4 Will Mike McGinn be reelected?
+ %p You voted for Option 1
+ %p template notes: Only show top five latest users who voted. along with the paragraph saying who the user voted for the user's voted option will be highlited.
+ .results-list
+ %ul
+ %li.results-item.user-choice
+ .numbers
+ %span Option 1
+ %span 20% | 12,000 Votes
+ .voter-profiles
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+
+ %li.results-item
+ .numbers
+ %span Option 1
+ %span 20% | 12,000 Votes
+ .voter-profiles
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+
+ %li.results-item
+ .numbers
+ %span Option 1
+ %span 20% | 12,000 Votes
+ .voter-profiles
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+
+ %li.results-item
+ .numbers
+ %span Option 1
+ %span 20% | 12,000 Votes
+ .voter-profiles
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+
+ %li.results-item
+ .numbers
+ %span Option 1
+ %span 20% | 12,000 Votes
+ .voter-profiles
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+ .profile-pic.float-left
+ =link_to image_tag('default/test-profile-pic.jpg'), '#'
+
+
+ %p.vote-meta
+ %a Is this question out of date?
+
+
+
+
+ .pred-nav-bar
+ %a.previous
+ &laquo; Previous
+ %a.next
+ Next &raquo;
+ .clearfix
View
@@ -975,6 +975,22 @@
]
}
},
+ {
+ :name => "Double Column Triple Popular Items",
+ :template_name => "v2_double_col_triple_item",
+ :settings => {
+ :klass_name => "Vote",
+ :locale_title => nil,
+ :locale_subtitle => nil,
+ :use_post_button => false,
+ :kommands => [
+ {
+ :method_name => "top_items",
+ :args => [3, nil, 3]
+ }
+ ]
+ }
+ },
{
:name => "Double Column Featured With Triple Items",
:template_name => "v2_double_col_feature_triple_item",

0 comments on commit 163e37d

Please sign in to comment.