Permalink
Browse files

Merge branch 'master' into stable_release

  • Loading branch information...
2 parents b0f7211 + 4953986 commit 3883f4884d9e5ef02408ff90b5c67c9b2aeb17e6 @chewbranca chewbranca committed Jan 16, 2012
Showing 579 changed files with 8,456 additions and 5,454 deletions.
View
@@ -4,10 +4,11 @@ gem "rails", "2.3.11"
gem "rack", '1.1.0'
-gem "haml", "3.0.25"
-gem 'compass', '~> 0.10.0'
+gem "haml", "3.1.3"
+gem 'compass', '0.11.5'
gem 'compass-960-plugin'
gem 'json', '1.4.6'
+gem 'json_pure', '1.5.1'
gem 'mogli'
gem "formtastic", "1.1.0"
View
@@ -84,8 +84,11 @@ GEM
capistrano (>= 1.0.0)
childprocess (0.1.8)
ffi (~> 1.0.6)
- compass (0.10.6)
- haml (>= 3.0.4)
+ chunky_png (1.2.5)
+ compass (0.11.5)
+ chunky_png (~> 1.2)
+ fssm (>= 0.2.7)
+ sass (~> 3.1)
compass-960-plugin (0.10.3)
compass (>= 0.10.0)
configuration (1.2.0)
@@ -118,9 +121,10 @@ GEM
friendly_id (2.2.7)
activerecord (>= 2.2.3)
activesupport (>= 2.2.3)
+ fssm (0.2.7)
gherkin (2.3.7)
json (>= 1.4.6)
- haml (3.0.25)
+ haml (3.1.3)
hashie (1.0.0)
highline (1.6.1)
hoptoad_notifier (2.4.9)
@@ -243,6 +247,7 @@ GEM
rubyzip (0.9.4)
rufus-scheduler (2.0.9)
tzinfo (>= 0.3.23)
+ sass (3.1.10)
selenium-webdriver (0.2.0)
childprocess (>= 0.1.7)
ffi (>= 1.0.7)
@@ -291,7 +296,7 @@ DEPENDENCIES
capistrano
capistrano-ext
capybara!
- compass (~> 0.10.0)
+ compass (= 0.11.5)
compass-960-plugin
cucumber
cucumber-rails (= 0.3.2)
@@ -303,9 +308,10 @@ DEPENDENCIES
feedzirra!
formtastic (= 1.1.0)
friendly_id (= 2.2.7)
- haml (= 3.0.25)
+ haml (= 3.1.3)
hoptoad_notifier
json (= 1.4.6)
+ json_pure (= 1.5.1)
launchy
loofah (= 0.4.7)
mogli
@@ -93,7 +93,8 @@ def refresh
# This is a serious issue that needs to be addressed
# Cached fragments depend on locales and need to be invalidated with the locales
# but how? doing a flush_all is a terrible solution.
- Rails.cache.clear
+ Newscloud::Redcloud.expire_views
+ Newscloud::Redcloud.expire_locales
flash[:success] = "Refreshed locales"
redirect_to admin_locales_path
end
@@ -0,0 +1,25 @@
+class Admin::MenuItemsController < AdminController
+
+ def index
+ end
+
+ def save
+ params[:items].each do |position, item_vals|
+ menu_item = MenuItem.find(item_vals["id"])
+ enabled = item_vals["enabled"] == "1"
+ menu_item.update_attributes(:position => position, :enabled => enabled, :parent_id => nil)
+
+ if item_vals["children"].present?
+ item_vals["children"].each do |child_position, child_vals|
+ child_item = MenuItem.find(child_vals["id"])
+ child_item.update_attributes(
+ :position => child_position,
+ :enabled => (enabled and child_vals["enabled"] == "1"),
+ :parent_id => menu_item.id)
+ end
+ end
+ end
+ render :json => {:success => "Success!"}.to_json and return
+ end
+
+end
@@ -142,6 +142,7 @@ def self.admin_action
def index
# Loads dashboard
+ check_dashboard_settings
@setting_groups = Newscloud::SettingGroups.groups
end
@@ -184,5 +185,31 @@ def check_iframe
redirect_to admin_path and return false
end
end
+
+ def check_dashboard_settings
+ @enabled_configs = {}
+ @enabled_configs[:automated_feeds] = Feed.count == 0
+ google_search_engine_id = get_setting('google_search_engine_id')
+ @enabled_configs[:google_search_engine] = google_search_engine_id.present? && google_search_engine_id.value == "your-google-search-engine-id"
+ google_site_verification = get_setting('google-site-verification')
+ @enabled_configs[:google_sitemap] = google_site_verification.present? && google_site_verification.value == 'WS8kMC8-Ds77777777777Xy6QcmRpWAfY'
+ google_analytics_site_id = get_setting('google_analytics_site_id')
+ google_analytics_account_id = get_setting('google_analytics_account_id')
+ @enabled_configs[:google_analytics] = (google_analytics_account_id.present? && google_analytics_account_id.value=='UF-123456890-7') || (google_analytics_site_id.present? && google_analytics_site_id.value=='1231232')
+ bitly_username = get_setting('bitly_username')
+ bitly_api_key = get_setting('bitly_api_key')
+ @enabled_configs[:bitly] = (bitly_username.present? && bitly_username.value =='username') || (bitly_api_key.present? && bitly_api_key.value=='api_key')
+ account_setting = get_setting('account')
+ oauth_key_setting = get_setting('oauth_key')
+ @enabled_configs[:twitter] = (account_setting.present? && account_setting.value == 'userkey_name') || (oauth_key_setting.present? && oauth_key_setting.value == 'U6qjcn193333331AuA')
+ @enabled_configs[:welcome_panel] = (t('shared.sidebar.welcome_panel.welcome_panel_headline') == "Welcome to our site") || (t('shared.sidebar.welcome_panel.welcome_panel_message_fbml')=="This is such a wonderful community to keep up on local events. We hope you enjoy yourself here.")
+ # TODO check for site_notification_user
+ site_title = get_setting('site_title')
+ site_topic = get_setting('site_topic')
+ contact_us_recipient = get_setting('contact_us_recipient')
+ app_id = get_setting('app_id')
+ @enabled_configs[:basic_site_settings] = (site_title.present? && site_title.value == 'Default Site Title') || (site_topic.present? && site_topic.value == 'Default Topic') || (app_id.present? && app_id.value == '111111111111') || (contact_us_recipient.present? && contact_us_recipient.value == 'admin@email.com,me@email.com,support@email.com')
+ @enabled_configs[:user_admins] = !User.admins.any?
+ end
end
@@ -315,18 +315,22 @@ def update_last_active
last_active = current_user.last_active
current_user.touch(:last_active)
- if current_facebook_user
- unless not Rails.env.development? and last_active and current_user.last_active < last_active + 1.hour
- redis_friends = $redis.smembers "#{current_user.cache_id}:friends"
- unless redis_friends.any? and last_active and current_user.last_active < last_active + 4.hours
- fb_friends = current_facebook_user.facebook_friend_ids
- $redis.set "#{current_facebook_user.cache_id}:friends_string", fb_friends.join(',')
- current_user.redis_update_friends fb_friends.join(',')
+ begin
+ if current_facebook_user
+ unless not Rails.env.development? and last_active and current_user.last_active < last_active + 1.hour
+ redis_friends = $redis.smembers "#{current_user.cache_id}:friends"
+ unless redis_friends.any? and last_active and current_user.last_active < last_active + 4.hours
+ fb_friends = current_facebook_user.facebook_friend_ids
+ $redis.set "#{current_facebook_user.cache_id}:friends_string", fb_friends.join(',')
+ current_user.redis_update_friends fb_friends.join(',')
+ end
+ # Expire recent users
+ Newscloud::Redcloud.expire_sets($redis.keys("#{User.model_deps_key}:*"))
+ else
end
- # Expire recent users
- Newscloud::Redcloud.expire_sets($redis.keys("#{User.model_deps_key}:*"))
- else
end
+ rescue Mogli::Client::HTTPException => e
+ # Just move on if facebook friends request fails
end
end
@@ -18,7 +18,7 @@ def preview_widgets
def index
if APP_CONFIG["use_view_objects"]
- render(:text => %{<div id="home_container">#{ViewTree.render(self)}</div>}.html_safe, :layout => 'application')
+ render(:text => %{<div id="home-content">#{ViewTree.render(self)}</div>}.html_safe, :layout => 'application')
else
=begin
@page = "page_1_"
@@ -1,12 +1,12 @@
class ViewObjectsController < ApplicationController
def index
- render(:text => %{<div id="home_container">#{ViewTree.render(self)}</div>}, :layout => 'application') and return
+ render(:text => %{<div id="home-content">#{ViewTree.render(self)}</div>}, :layout => 'application') and return
end
def show
@view_object = ViewObject.find(params[:id])
respond_to do |format|
- format.html { render(:text => %{<div id="home_container">#{ViewTree.render(@view_object.name, self)}</div>}.html_safe, :layout => 'application') and return }
+ format.html { render(:text => %{<div id="home-content">#{ViewTree.render(@view_object.name, self)}</div>}.html_safe, :layout => 'application') and return }
format.json { render(:json => ViewTree.render(@view_object.name, self), :layout => false).to_json and return }
end
end
@@ -47,12 +47,7 @@ def dislike
def shared_item
if request.post? and params[:cache_id].present? and params[:action_type].present?
item = find_item_by_cache_id(params[:cache_id])
- item_action = ItemAction.create!({
- :actionable => item,
- :user => current_user,
- :action_type => params[:action_type],
- :url => params[:url]
- })
+ item_action = ItemAction.gen_user_posted_item!(current_user, item, params[:action_type], params[:url])
NewscloudSweeper.expire_instance(item)
render :json => {:success => "Item created successfully"}.to_json and return
else
@@ -103,6 +103,17 @@ def questions
end
end
+ def events
+ case @sort
+ when "newest"
+ @events = Event.active.newest @count
+ @title = t('widgets.events_newest_title', :site_title => get_setting('site_title').value)
+ when "upcoming"
+ @events = Event.active.upcoming @count
+ @title = t('widgets.events_upcoming_title', :site_title => get_setting('site_title').value)
+ end
+ end
+
def newswires
@newswires = Newswire.active.unpublished.newest @count
@title = t('widgets.newswires_newest_title', :site_title => get_setting('site_title').value)
@@ -217,7 +217,7 @@ def gravatar_image user
def profile_pic_badge user
if user.is_moderator?
- image_tag 'default/icon-mod-badge.png', :class => "moderator"
+ image_tag 'skin/icon-mod-badge.png', :class => "moderator"
elsif user.twitter_user? and user.system_user?
image_tag 'https://si0.twimg.com/images/dev/cms/intents/bird/bird_blue/bird_16_blue.png', :class => "moderator"
elsif user.is_host?
@@ -411,14 +411,6 @@ def tag_link(tag, item)
end
end
- def default_image
- 'default/watermark.jpg'
- end
-
- def default_medium_image
- 'default/medium_watermark.jpg'
- end
-
def display_facebook_messages
flash[:notice] = flash[:success] if flash[:notice].nil? and flash[:success].present?
@@ -19,7 +19,7 @@ def fb_share_item_button item
def fb_share_app_button
stream_post = Facebooker::StreamPost.new
attachment = Facebooker::Attachment.new
- attachment.add_image(image_path('default/icon-fan-app.gif'), home_index_path(:only_path => false, :canvas => true))
+ attachment.add_image(image_path(icon_fan_app_location), home_index_path(:only_path => false, :canvas => true))
stream_post.message = t('header.share_description')
stream_post.action_links = [{:text => t('facebook_learn_more'), :href => home_index_path(:only_path => false, :canvas => true)}]
stream_post.attachment = attachment
@@ -71,7 +71,7 @@ def build_app_stream_post
attachment.name = Metadata::Setting.find_setting('site_title').try(:value)
attachment.description = t('header.share_description')
attachment.href = home_index_path(:only_path => false, :canvas => true)
- attachment.add_image(image_path('default/icon-fan-app.gif'), home_index_path(:only_path => false, :canvas => true))
+ attachment.add_image(image_path(icon_fan_app_location), home_index_path(:only_path => false, :canvas => true))
stream_post.attachment = attachment
stream_post
end
@@ -35,6 +35,14 @@ def meta_tag tag, content
content_tag(:meta, nil, :property => tag, :content => content)
end
+ def icon_fan_app_location
+ 'skin/icon-fan-app.gif'
+ end
+
+ def icon_fan_app_url
+ base_url(path_to_image(icon_fan_app_location))
+ end
+
def item_page_title item
page_title :item => item
end
@@ -66,4 +74,8 @@ def s3_sitemap_url
"http://s3.amazonaws.com/#{s3_config['bucket']}/sitemaps/sitemap1.xml.gz"
end
+
+ def link_to_menu_item menu_item, current_tab = nil
+ link_to t(menu_item.locale_string), send(menu_item.resource_path), :class => tab_selected?(current_tab, menu_item.name_slug)
+ end
end
@@ -1,6 +1,14 @@
module MediaHelper
+ def default_image
+ 'skin/watermark.jpg'
+ end
+
+ def default_medium_image
+ 'skin/medium_watermark.jpg'
+ end
+
def external_thumb_image image
img_url = thumb_image_or_default(image)
Oops, something went wrong.

0 comments on commit 3883f48

Please sign in to comment.