Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Upgrade to Bootstrap 2.0

  • Loading branch information...
commit 9ab07d4594f572d879b2bcff3300ccc09d708054 1 parent bdf1a51
@sferik authored
View
1  Gemfile
@@ -6,6 +6,7 @@ gem 'haml', '~> 3.2.0.alpha'
gem 'omniauth', :git => 'git://github.com/intridea/omniauth.git'
gem 'omniauth-twitter'
gem 'twitter'
+gem 'twitter-text'
platforms :jruby do
gem 'jruby-openssl'
View
3  Gemfile.lock
@@ -125,6 +125,8 @@ GEM
faraday (~> 0.7)
multi_json (~> 1.0)
simple_oauth (~> 0.1)
+ twitter-text (1.4.15)
+ activesupport
tzinfo (0.3.31)
uglifier (1.2.2)
execjs (>= 0.3.0)
@@ -147,5 +149,6 @@ DEPENDENCIES
simplecov
thin
twitter
+ twitter-text
uglifier
webmock
View
55 app/assets/stylesheets/screen.css
@@ -2,21 +2,61 @@
html, body {
background-color: #eee;
}
-body {
- padding-top: 40px; /* 40px to make the container go all the way to the bottom of the topbar */
-}
+
table, form {
margin-bottom: 0;
}
+
h6 {
font-weight: normal;
}
+
+th {
+ border-top: none;
+}
+
+footer {
+ margin-top: 17px;
+}
+
+#sash {
+ position: absolute;
+ top: 0;
+ right: 0;
+ border: 0;
+ z-index: 10001;
+}
+
+#sign_out {
+ min-width: 83px;
+ min-height: 40px;
+ white-space: nowrap;
+}
+
+.span2{
+ width: 83px;
+}
+
+.page-header h1 {
+ margin-bottom: 8px;
+}
+
+.help-block {
+ margin-top: 9px;
+}
+
+.navbar-static {
+ margin-bottom: 0;
+}
+
.container > footer p {
text-align: center; /* center align it with the container */
}
+
.container {
- width: 820px; /* downsize our container to make the content feel a bit tighter and more cohesive. NOTE: this removes two full columns from the grid, meaning you only go to 14 columns and not 16. */
+ width: 803px; /* downsize our container to make the content feel a bit tighter and more cohesive. NOTE: this removes two full columns from the grid, meaning you only go to 14 columns and not 16. */
}
+
/* The white background content wrapper */
.content {
background-color: #fff;
@@ -29,15 +69,18 @@ h6 {
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);
box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
+
/* Page header tweaks */
.page-header {
background-color: #f5f5f5;
padding: 20px 20px 10px;
margin: -20px -20px 20px;
}
-.span2 .media-grid img {
- width: 90px;
+
+.thumbnails img {
+ width: 73px;
}
+
.alert-message {
-webkit-border-top-left-radius: 0;
-moz-border-radius-topleft: 0;
View
2  app/controllers/sessions_controller.rb
@@ -8,7 +8,7 @@ def create
def show
if session['access_token'] && session['access_secret']
- @user = client.user
+ @user = client.user(:include_entities => true)
else
redirect_to failure_path
end
View
1  app/helpers/application_helper.rb
@@ -1,2 +1,3 @@
module ApplicationHelper
+ include Twitter::Autolink
end
View
30 app/views/layouts/application.html.haml
@@ -1,18 +1,24 @@
!!! 5
%html
%head
- %meta{:charset => "utf-8"}
- %link{:rel => "shortcut icon", :href => "/favicon.ico"}
%title
Sign in with Twitter
- = stylesheet_link_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css"
+ %meta{:charset => "utf-8"}
+ %meta{:name => "Description", :content => "A Ruby on Rails app that demonstrates how to use the Sign in with Twitter workflow using the twitter gem and OmniAuth."}
+ %link{:rel => "shortcut icon", :href => "/favicon.ico"}
+ / HTML5 shim, for IE6-8 support of HTML5 elements
+ /[if lt IE 9]
+ = javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
+ = stylesheet_link_tag "http://bootstrap.io/Content/css/bootstrap.css"
= stylesheet_link_tag "application"
+ = javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
+ = javascript_include_tag "http://bootstrap.io/Scripts/bootstrap/bootstrap-alert.js"
= csrf_meta_tags
%body
%a{:href => "https://github.com/sferik/sign-in-with-twitter"}
- = image_tag("fork-me-on-github.png", :alt => "Fork me on GitHub", :style => "position: absolute; top: 0; right: 0; border: 0; z-index: 10001;")
- .topbar
- .fill
+ = image_tag("fork-me-on-github.png", :alt => "Fork me on GitHub", :id => "sash")
+ .navbar.navbar-static
+ .navbar-inner
.container
= link_to("Sign in with Twitter", root_path, :class => "brand")
%ul.nav
@@ -34,16 +40,22 @@
.container
- if flash[:notice]
.alert-message.warning
+ %a{:class => "close", :"data-dismiss" => "alert", :href => "#"}
+ ×
%p
= flash[:notice]
+ :javascript
+ $(".alert-message").alert();
- if flash[:error]
.alert-message.error
+ %a{:class => "close", :"data-dismiss" => "alert", :href => "#"}
+ ×
%p
= flash[:error]
+ :javascript
+ $(".alert-message").alert();
.content
= yield
%footer
%p
- ©
- = Date.today.year
- Erik Michaels-Ober.
+ = "© #{Date.today.year} Erik Michaels-Ober.".html_safe
View
14 app/views/sessions/show.html.haml
@@ -8,11 +8,11 @@
= @user.description
.row
.span2
- %ul.media-grid
+ %ul.thumbnails
%li
- %a{:href => @user.url}
- %img.thumbnail{:src => "https://api.twitter.com/1/users/profile_image?screen_name=#{@user.screen_name}&size=bigger", :alt => @user.name}
- .span12
+ %a.thumbnail{:href => @user.url}
+ %img{:src => "https://api.twitter.com/1/users/profile_image?screen_name=#{@user.screen_name}&size=bigger", :alt => @user.name}
+ .span9
%table
%thead
%tr
@@ -46,14 +46,14 @@
.row
.span2
= form_tag(signout_path, :method => 'delete') do
- %button.btn
+ %button.btn.danger#sign_out
Sign out
- .span12
+ .span9
- unless @user.status.blank?
%blockquote
%q{:cite => "https://twitter.com/#{@user.screen_name}/status/#{@user.status.id}"}
%p
- = @user.status.text
+ = auto_link(@user.status.text).html_safe
%small
= time_ago_in_words(@user.status.created_at).capitalize
ago via
View
6 app/views/welcome/index.html.haml
@@ -3,10 +3,10 @@
A
%a{:href => "http://rubyonrails.org/"}
Ruby on Rails
- app that demonstrates how to use
+ app that demonstrates how to use the
%a{:href => "https://dev.twitter.com/docs/auth/sign-twitter"}
Sign in with Twitter
- using the
+ workflow using the
%a{:href => "https://rubygems.org/gems/twitter"}
twitter gem
and
@@ -17,5 +17,5 @@
= form_tag "/auth/twitter", :method => 'get' do
%button.btn.large.primary
Sign in with Twitter
- %small
+ %p.help-block
Start by pressing this button to authenticate with Twitter.
View
BIN  screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.