From a9b7cd1254b7a1ef62563648ecbe04c4f858d6cc Mon Sep 17 00:00:00 2001
From: danielgrippi <danielgrippi@gmail.com>
Date: Thu, 23 Jun 2011 12:40:47 -0700
Subject: [PATCH] nicer auth prompt.  wip.

---
 app/controllers/authorizations_controller.rb |  2 +-
 app/views/authorizations/index.html.haml     | 38 ++++++-------
 app/views/authorizations/new.html.haml       | 60 ++++++++++----------
 app/views/layouts/popup.html.haml            |  2 +-
 app/views/services/index.html.haml           |  3 -
 app/views/shared/_add_remove_services.haml   | 15 +++--
 app/views/shared/_settings_nav.haml          |  7 ++-
 app/views/users/edit.html.haml               |  3 -
 config/locales/diaspora/en.yml               |  4 ++
 public/stylesheets/sass/application.sass     | 31 ++++++++++
 public/stylesheets/sass/popup.scss           | 24 +++++++-
 11 files changed, 118 insertions(+), 71 deletions(-)

diff --git a/app/controllers/authorizations_controller.rb b/app/controllers/authorizations_controller.rb
index b29eb50bff..e09a0c5180 100644
--- a/app/controllers/authorizations_controller.rb
+++ b/app/controllers/authorizations_controller.rb
@@ -11,7 +11,7 @@ class AuthorizationsController < ApplicationController
   def new
     @requested_scopes = params["scope"].split(',')
     @client = oauth2_authorization_request.client
-    render :layout => "popup" if params[:popup]
+    #render :layout => "popup" if params[:popup]
   end
 
   def create
diff --git a/app/views/authorizations/index.html.haml b/app/views/authorizations/index.html.haml
index f4b300fca7..87e47c8e6b 100644
--- a/app/views/authorizations/index.html.haml
+++ b/app/views/authorizations/index.html.haml
@@ -8,24 +8,20 @@
   = render 'shared/settings_nav'
 
 .span-19.prepend-5.last
-  %h2
-    = t('_applications')
-
-
-#applications_stream.stream
-  - for app in @applications
-
-    .stream_element{:id => app.id}
-      .right
-        = link_to t('delete'), authorization_path(:id => app.id), :method => :delete, :confirm => 'are you sure?'
-      
-      - if app.icon_url
-        = image_tag app.icon_url
-
-      .content
-        %span.from
-          = link_to app.name, app.homepage_url
-
-        .info
-          = app.description
-
+  #applications_stream.stream
+    - if @applications.count > 0
+      - for app in @applications
+        .stream_element{:id => app.id}
+          .right
+            = link_to t('.revoke_access'), authorization_path(:id => app.id), :method => :delete, :confirm => 'are you sure?', :class => "button"
+          
+          - if app.icon_url
+            = image_tag app.icon_url, :class => "avatar"
+
+          .content
+            %div.from
+              = link_to app.name, app.homepage_url
+            = app.description
+
+    - else
+      You haven't registered any applications yet.
diff --git a/app/views/authorizations/new.html.haml b/app/views/authorizations/new.html.haml
index be6328d3fb..c22793336b 100644
--- a/app/views/authorizations/new.html.haml
+++ b/app/views/authorizations/new.html.haml
@@ -1,45 +1,43 @@
-#popup-contents
-  %h4
-    = "#{@client.name} is requesting access to your account"
+#authorize
+  #application-description
+    = image_tag(@client.homepage_url + @client.icon_url, :id => 'client-application-image')
+    %br
+    %strong
+      = @client.name
+    .description
+      = @client.description
+
+  %h2
+    = @client.permissions_overview
 
-  #popup-content-left
-    %ul#requested-scopes
-      - @requested_scopes.each do |scope|
-        - if scope == "name"
-          %li
-            .scope-photo
-              = owner_image_tag
+  %ul#requested-scopes
+    - @requested_scopes.each do |scope|
+      - if scope == "profile"
+        %li
+          .scope-photo
+            = owner_image_tag
 
+          .scope-description
             %strong
               Basic Info
             %br
             Cubbies will be able to see your name, profile photo, and other basic profile information.
 
-        - elsif scope == "AS_photo:post"
-          %li
-            .scope-photo
-              = image_tag('/images/icons/photo.svg')
+      - elsif scope == "AS_photo:post"
+        %li
+          .scope-photo
+            = image_tag('/images/icons/photo.svg', :title => "Cubbies will be able to post photos on your behalf")
 
+          .scope-description
             %strong
               Your Photos
             %br
             Cubbies will be able to post photos on your behalf
 
-
-
-
-    = form_for :authorization,
-      :url => oauth_authorize_path(params.slice(:redirect_uri, :client_id, :client_secret)) do |form|
-      %br
-      %p
-        = form.submit "Fuck Yeah!", :value => "Authorize", :class => 'button'
-        = form.submit "Hell No.", :value => "No", :class => 'button'
-
-
-  #popup-content-right
-    = image_tag(@client.icon_url, :id => 'client-application-image')
+  = form_for :authorization,
+    :url => oauth_authorize_path(params.slice(:redirect_uri, :client_id, :client_secret)) do |form|
     %br
-    %strong
-      = @client.name
-    .description
-      = @client.description
+    %p
+      = form.submit "Fuck Yeah!", :value => "Authorize", :class => 'button'
+      = form.submit "Hell No.", :value => "No", :class => 'button'
+
diff --git a/app/views/layouts/popup.html.haml b/app/views/layouts/popup.html.haml
index aa207839cd..68c54358b2 100644
--- a/app/views/layouts/popup.html.haml
+++ b/app/views/layouts/popup.html.haml
@@ -63,7 +63,7 @@
 
   %body{:class => "#{yield(:body_class)}"}
     %header
-      = image_tag('asterisk_white.png', :height => 25, :width => 25, :id => 'asterisk')
+      = image_tag('asterisk_white.png', :height => 20, :width => 20, :id => 'asterisk')
       Grant Account Access
 
     = yield
diff --git a/app/views/services/index.html.haml b/app/views/services/index.html.haml
index 881481d2cf..549d78f9ae 100644
--- a/app/views/services/index.html.haml
+++ b/app/views/services/index.html.haml
@@ -11,8 +11,5 @@
   = render 'shared/settings_nav'
 
 .span-19.prepend-5.last
-  %h2
-    = t('_services')
-
   = render 'shared/add_remove_services'
 
diff --git a/app/views/shared/_add_remove_services.haml b/app/views/shared/_add_remove_services.haml
index c2d2aba669..10e98a1d8c 100644
--- a/app/views/shared/_add_remove_services.haml
+++ b/app/views/shared/_add_remove_services.haml
@@ -4,12 +4,15 @@
 
 
 %ul.stream#service_stream
-  - for service in @services
-    %h3
-      %b= service.provider
-      = t('services.index.logged_in_as')
-      %b= service.nickname
-      = link_to t('services.index.disconnect'), service_path(service), :confirm => t('services.index.really_disconnect', :service => service.provider), :method => :delete
+  - if @services.count > 0
+    - for service in @services
+      %h3
+        %b= service.provider
+        = t('services.index.logged_in_as')
+        %b= service.nickname
+        = link_to t('services.index.disconnect'), service_path(service), :confirm => t('services.index.really_disconnect', :service => service.provider), :method => :delete
+  - else
+    You haven't connected any services yet.
 
 - unless @services.any?{|x| x.provider == 'twitter'}
   %h4= link_to t('services.index.connect_to_twitter'), "/auth/twitter" if SERVICES['twitter'] && SERVICES['twitter']['consumer_key']!= ""
diff --git a/app/views/shared/_settings_nav.haml b/app/views/shared/_settings_nav.haml
index 1a4e991716..fec8cf1a2d 100644
--- a/app/views/shared/_settings_nav.haml
+++ b/app/views/shared/_settings_nav.haml
@@ -1,4 +1,5 @@
 %ul#settings_nav
-  %li=link_to t('profile'), edit_profile_path
-  %li=link_to t('account'), edit_user_path
-  %li=link_to t('_services'), services_path
+  %li= link_to_unless_current t('profile'), edit_profile_path
+  %li= link_to_unless_current t('account'), edit_user_path
+  %li= link_to_unless_current t('_services'), services_path
+  %li= link_to_unless_current t('_applications'), authorizations_path
diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml
index 54f9608173..4b0fee89a3 100644
--- a/app/views/users/edit.html.haml
+++ b/app/views/users/edit.html.haml
@@ -11,9 +11,6 @@
   = render 'shared/settings_nav'
 
 .span-12.prepend-5.last
-  %h2
-    = t('account')
-
   .span-5.append-1
     %h3
       = t('.your_handle')
diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml
index 3b1fc6b611..f09c8c8bd9 100644
--- a/config/locales/diaspora/en.yml
+++ b/config/locales/diaspora/en.yml
@@ -684,6 +684,10 @@ en:
       generate_a_token: "Generate a token"
       via: "(via %{link})"
 
+  authorizations:
+    index:
+      revoke_access: "Revoke Access"
+
   users:
     edit:
       export_data: "Export Data"
diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass
index 262b1f4291..3abb4eaa64 100644
--- a/public/stylesheets/sass/application.sass
+++ b/public/stylesheets/sass/application.sass
@@ -1385,8 +1385,14 @@ ul#settings_nav
     :display inline
     :margin
       :right 1em
+    :font
+      :weight 700
+
     a
       :padding 2px
+      :font
+        :weight normal
+
 
 .settings_pane
   :display none
@@ -2929,3 +2935,28 @@ h1.tag
 
 #client-application-image
   :max-width 100%
+
+#service_stream
+  :margin 0
+  :padding 0
+
+#authorize
+  :text-align center
+
+#application-description
+  :display inline-block
+  :width 300px
+  :padding-bottom 20px
+
+ul#requested-scopes
+  :vertical-align middle
+  li
+    :display inline-block
+    :padding 5px
+
+    img
+      :height 30px
+      :width 30px
+  
+    .scope-description
+      :display none
diff --git a/public/stylesheets/sass/popup.scss b/public/stylesheets/sass/popup.scss
index 86c84da0b6..d425260a74 100644
--- a/public/stylesheets/sass/popup.scss
+++ b/public/stylesheets/sass/popup.scss
@@ -4,6 +4,9 @@
 
 @import "mixins";
 
+body, html{
+  padding: 20px;
+}
 
 body, html, header, footer, ul{
   padding: 0;
@@ -13,18 +16,35 @@ body, html, header, footer, ul{
 header,
 footer{
   width: 100%;
+  left: 0;
+}
+
+header{
+  top: 0;
+}
+
+footer{
+  bottom: 0;
+  padding: 5px 0;
+  color: #444;
 }
 
 header{
   position: relative;
-  font-size: 14px;
-  font-weight: bold;
+  font-size: 12px;
+  padding-top: 8px;
+  padding-bottom: 0px;
+  font-weight: 700;
   color: #fff;
   vertical-align: top;
   margin-bottom: 20px;
 
   #asterisk{
+    position: relative;
     margin-right: 3px;
+    top: -2px;
+    left: 10px;
+    margin-right: 14px;
   }
 }
 
-- 
GitLab