Permalink
Browse files

windowslive, links, rspec, updates

  • Loading branch information...
1 parent 26366bb commit 66e72260f4bb15e97dd84c075c6d58a6f6aca3df @fred committed Jun 20, 2012
View
@@ -1,5 +1,12 @@
CHANGELOG
+== June 20, 2012
+* Added WindowsLive connect
+* Improved Admin interface for users/admin_users
+* re-aranged Admin Dashboard
+* Added links to admin (WIP)
+* Updated Gems
+
== June 19, 2012
* Improved Welcome Email
View
@@ -17,6 +17,7 @@ gem 'pg'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem 'omniauth-google-oauth2'
+gem 'omniauth-windowslive', git: 'git://github.com/dangerp/omniauth-windowslive.git'
# gem 'omniauth-flattr'
# gem 'omniauth-openid'
# gem 'omniauth-github'
View
@@ -5,6 +5,14 @@ GIT
validates_email_format_of (1.5.3)
GIT
+ remote: git://github.com/dangerp/omniauth-windowslive.git
+ revision: 5abf18df60b314b9955400c45c854f1de099824f
+ specs:
+ omniauth-windowslive (0.0.8.2)
+ multi_json (>= 1.0.3)
+ omniauth-oauth2 (~> 1.0)
+
+GIT
remote: git://github.com/fred/active_admin.git
revision: 62c1dd5f1c9c4d3a4167d57fdf9c36e3e0b2ab02
ref: 62c1dd5f1c9c4d3a4167d57fdf9c36e3e0b2ab02
@@ -48,7 +56,7 @@ GIT
GIT
remote: git://github.com/mperham/sidekiq.git
- revision: 0addaba4a6162e397743ea60400e35b40d548f40
+ revision: d97300c4ab902ce490c5f608e3f17d386ac8674a
specs:
sidekiq (2.0.3)
celluloid (~> 0.11.0)
@@ -59,13 +67,13 @@ GIT
GIT
remote: git://github.com/seyhunak/twitter-bootstrap-rails.git
- revision: 803dfbe60760345905712bac79eb4783ec182673
+ revision: 23a4423162009ebb726ebc4fe236b713d081d0ee
specs:
twitter-bootstrap-rails (2.1.0)
actionpack (>= 3.1)
less-rails (~> 2.2.2)
railties (>= 3.1)
- therubyracer (~> 0.10.1)
+ therubyracer (= 0.10.1)
GEM
remote: http://rubygems.org/
@@ -175,7 +183,7 @@ GEM
excon (0.13.4)
execjs (1.4.0)
multi_json (~> 1.0)
- factory_girl (3.4.0)
+ factory_girl (3.4.2)
activesupport (>= 3.0.0)
factory_girl_rails (3.4.0)
factory_girl (~> 3.4.0)
@@ -324,7 +332,7 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
- raindrops (0.9.0)
+ raindrops (0.10.0)
rake (0.9.2.2)
rakismet (1.2.1)
rdoc (3.12)
@@ -358,9 +366,8 @@ GEM
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
- selenium-webdriver (2.22.2)
+ selenium-webdriver (2.24.0)
childprocess (>= 0.2.5)
- ffi (~> 1.0)
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
@@ -400,7 +407,7 @@ GEM
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
- thor (0.15.2)
+ thor (0.15.3)
tilt (1.3.3)
tinymce-rails (3.5.2)
railties (>= 3.1.1)
@@ -415,9 +422,9 @@ GEM
multi_json (~> 1.3)
simple_oauth (~> 0.1.6)
tzinfo (0.3.33)
- uglifier (1.2.4)
+ uglifier (1.2.5)
execjs (>= 0.3.0)
- multi_json (>= 1.0.2)
+ multi_json (~> 1.3)
unicorn (4.3.1)
kgio (~> 2.6)
rack
@@ -474,6 +481,7 @@ DEPENDENCIES
omniauth-facebook
omniauth-google-oauth2
omniauth-twitter
+ omniauth-windowslive!
opinio!
paper_trail (~> 2.6.3)
pg
View
@@ -26,8 +26,14 @@
bool_row :show_public
row "Logged in at", &:last_sign_in_at
row "Last Seen", &:current_sign_in_at
- row "Last IP", &:last_sign_in_ip
- row "Current IP", &:current_sign_in_ip
+ row "Last IP" do |user|
+ link_to user.last_sign_in_ip,
+ "http://www.geoiptool.com/en/?IP=#{user.last_sign_in_ip}"
+ end
+ row "Current IP" do |user|
+ link_to user.current_sign_in_ip,
+ "http://www.geoiptool.com/en/?IP=#{user.current_sign_in_ip}"
+ end
row :created_at
row :updated_at
end
@@ -40,6 +46,7 @@
column :name
column :email
column :provider
+ column :time_zone
column "Facebook", sortable: false do |user|
if user.facebook.present?
link_to "Facebook", user.facebook
@@ -58,8 +65,14 @@
column "Logins", :sign_in_count
column "Logged in", :last_sign_in_at
column "Last Seen", :current_sign_in_at
- column "Last IP", :last_sign_in_ip
- column "Current IP", :current_sign_in_ip
+ column "Last IP" do |user|
+ link_to user.last_sign_in_ip,
+ "http://www.geoiptool.com/en/?IP=#{user.last_sign_in_ip}"
+ end
+ column "Current IP" do |user|
+ link_to user.current_sign_in_ip,
+ "http://www.geoiptool.com/en/?IP=#{user.current_sign_in_ip}"
+ end
default_actions
end
controller do
View
@@ -40,38 +40,6 @@
##################
-
- ### COMMENTS
-
- section "Approved Comments", priority: 1 do
- if controller.current_ability.can?(:read, Comment)
- table_for Comment.recent(12) do
- column "User" do |t|
- if t.owner
- link_to t.name, admin_user_path(t.owner), class: "suspicious_#{t.suspicious?} spam_#{t.marked_spam?}"
- else
- t.owner_id
- end
- end
- column "Message" do |t|
- link_to t.body.truncate(80), admin_comment_path(t), title: t.body, class: "suspicious_#{t.suspicious?} spam_#{t.marked_spam?}"
- end
- column "Item" do |t|
- if t.commentable && t.commentable_type == "Item"
- link_to t.commentable.title.truncate(44), admin_item_path(t.commentable), title: t.commentable.title
- elsif t.commentable && t.commentable_type == "Comment"
- link_to t.commentable.commentable.title.truncate(44), admin_item_path(t.commentable.commentable)
- end
- end
- column "Time" do |t|
- "#{time_ago_in_words(t.created_at)} ago"
- end
- column "IP" do |t|
- link_to(t.user_ip, "http://www.geoiptool.com/en/?IP=#{t.user_ip}", target: "_blank")
- end
- end
- end
- end
section "Suspicious Comments", priority: 1 do
if controller.current_ability.can?(:read, Comment)
@@ -248,4 +216,37 @@
end
end
+
+ ### COMMENTS
+
+ section "Approved Comments", priority: 32 do
+ if controller.current_ability.can?(:read, Comment)
+ table_for Comment.recent(12) do
+ column "User" do |t|
+ if t.owner
+ link_to t.name, admin_user_path(t.owner), class: "suspicious_#{t.suspicious?} spam_#{t.marked_spam?}"
+ else
+ t.owner_id
+ end
+ end
+ column "Message" do |t|
+ link_to t.body.truncate(80), admin_comment_path(t), title: t.body, class: "suspicious_#{t.suspicious?} spam_#{t.marked_spam?}"
+ end
+ column "Item" do |t|
+ if t.commentable && t.commentable_type == "Item"
+ link_to t.commentable.title.truncate(44), admin_item_path(t.commentable), title: t.commentable.title
+ elsif t.commentable && t.commentable_type == "Comment"
+ link_to t.commentable.commentable.title.truncate(44), admin_item_path(t.commentable.commentable)
+ end
+ end
+ column "Time" do |t|
+ "#{time_ago_in_words(t.created_at)} ago"
+ end
+ column "IP" do |t|
+ link_to(t.user_ip, "http://www.geoiptool.com/en/?IP=#{t.user_ip}", target: "_blank")
+ end
+ end
+ end
+ end
+
end
View
@@ -0,0 +1,20 @@
+ActiveAdmin.register Link do
+ controller.authorize_resource
+ config.comments = false
+ menu parent: "Settings", priority: 120, if: lambda{|tabs_renderer|
+ controller.current_ability.can?(:manage, Link)
+ }
+
+ index do
+ column :id
+ column :title
+ column :priority
+ column :url do |link|
+ link_to "URL", link.url
+ end
+ column :created_at
+ column :updated_at
+ default_actions
+ end
+
+end
View
@@ -28,8 +28,14 @@
bool_row :show_public
row "Logged in at", &:last_sign_in_at
row "Last Seen", &:current_sign_in_at
- row "Last IP", &:last_sign_in_ip
- row "Current IP", &:current_sign_in_ip
+ row "Last IP" do |user|
+ link_to user.last_sign_in_ip,
+ "http://www.geoiptool.com/en/?IP=#{user.last_sign_in_ip}"
+ end
+ row "Current IP" do |user|
+ link_to user.current_sign_in_ip,
+ "http://www.geoiptool.com/en/?IP=#{user.current_sign_in_ip}"
+ end
row :created_at
row :updated_at
end
@@ -42,6 +48,7 @@
end
column :name
column :email
+ column :time_zone
column :provider
column "Facebook", sortable: false do |user|
if user.facebook.present?
@@ -61,8 +68,14 @@
column "Logins", :sign_in_count
column "Logged in", :last_sign_in_at
column "Last Seen", :current_sign_in_at
- column "Last IP", :last_sign_in_ip
- column "Current IP", :current_sign_in_ip
+ column "Last IP" do |user|
+ link_to user.last_sign_in_ip,
+ "http://www.geoiptool.com/en/?IP=#{user.last_sign_in_ip}"
+ end
+ column "Current IP" do |user|
+ link_to user.current_sign_in_ip,
+ "http://www.geoiptool.com/en/?IP=#{user.current_sign_in_ip}"
+ end
default_actions
end
controller do
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -174,14 +174,21 @@ def after_sign_in_path_for(resource_or_scope)
when :admin_user, AdminUser
admin_dashboard_path
when :user, User
- store_location = session[:return_to]
- clear_stored_location
- (store_location.nil?) ? "/" : store_location.to_s
+ redirect_location
else
super
end
end
+ def redirect_location
+ if current_user && current_user.email.match("please_update_your_email")
+ edit_user_registration_path(protocol: 'https')
+ else
+ store_location = session[:return_to]
+ clear_stored_location
+ (store_location.nil?) ? "/" : store_location.to_s
+ end
+ end
protected
@@ -4,10 +4,10 @@ def create
begin
@user = User.find_or_create_from_oauth(auth_hash, current_user)
if @user.persisted?
- flash[:notice] = "Welcome! You are signed in."
+ flash[:notice] = "Welcome! You are now signed in."
sign_in_and_redirect @user,
event: :authentication,
- notice: "Welcome! You are signed in."
+ notice: "Welcome! You are now signed in."
else
session["devise.facebook_data"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
View
@@ -48,7 +48,8 @@ def initialize(user)
# Editor can manager all Items, Tags and Categories,
if user.has_role? :editor
can :manage, [ItemStat,Version,Item,Tag,Category,Page,Language,
- Attachment,CommentSubscription,Subscription,EmailDelivery,Document
+ Attachment,CommentSubscription,Subscription,EmailDelivery,
+ Document,Link
]
can :read, [ItemStat,Version]
end
@@ -68,7 +69,7 @@ def initialize(user)
if user.has_role? :security
can :manage, [Role,User,AdminUser,ItemStat,Language,Version,
Contact,CommentSubscription,Subscription,EmailDelivery,
- TwitterShare,Attachment,Document
+ TwitterShare,Attachment,Document,Link
]
end
View
@@ -135,16 +135,16 @@ def clear_bad_characters
# self.body.gsub!("&mdash;", "&#45;")
# self.body.gsub!("&#180;", "&#39;")
# self.body.gsub!("&#96;", "&#39;")
- self.body.gsub!("&lsquo;", "\'")
- self.body.gsub!("&rsquo;", "\'")
- self.body.gsub!("&ldquo;", "\"")
- self.body.gsub!("&rdquo;", "\"")
- self.body.gsub!("&ndash;", "-")
- self.body.gsub!("&mdash;", "-")
- self.body.gsub!("&#180;", "\'")
- self.body.gsub!("&#96;", "\'")
- self.body.gsub!("&nbsp;", " ")
- self.body.gsub!("&hellip;", "...")
+ self.body.to_s.gsub!("&lsquo;", "\'")
+ self.body.to_s.gsub!("&rsquo;", "\'")
+ self.body.to_s.gsub!("&ldquo;", "\"")
+ self.body.to_s.gsub!("&rdquo;", "\"")
+ self.body.to_s.gsub!("&ndash;", "-")
+ self.body.to_s.gsub!("&mdash;", "-")
+ self.body.to_s.gsub!("&#180;", "\'")
+ self.body.to_s.gsub!("&#96;", "\'")
+ self.body.to_s.gsub!("&nbsp;", " ")
+ self.body.to_s.gsub!("&hellip;", "...")
true
end
View
@@ -0,0 +1,9 @@
+class Link < ActiveRecord::Base
+
+ # Validations
+ validates_presence_of :title
+ validates_presence_of :url
+ validates_presence_of :priority
+ validates_uniqueness_of :url
+
+end
Oops, something went wrong.

0 comments on commit 66e7226

Please sign in to comment.