[ARVADOS] updated: 9e5af4afef0f70222515214fb4778389c0d364d9

git at public.curoverse.com git at public.curoverse.com
Sun Aug 10 14:26:03 EDT 2014


Summary of changes:
 .../app/assets/stylesheets/application.css.scss    |  4 ++
 .../app/controllers/application_controller.rb      |  2 -
 apps/workbench/app/views/users/profile.html.erb    | 55 ++++++++++++++++------
 .../test/integration/application_layout_test.rb    |  3 ++
 4 files changed, 47 insertions(+), 17 deletions(-)

       via  9e5af4afef0f70222515214fb4778389c0d364d9 (commit)
       via  c803bd3b08fb2a981bb02f99d2be6d10bc37d341 (commit)
       via  51ab8fada99e0d5dad24b7e905c494850dcd1fe1 (commit)
      from  65c7f47f25003775f0a9d1560829b47af70490a0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 9e5af4afef0f70222515214fb4778389c0d364d9
Author: radhika <radhika at curoverse.com>
Date:   Sun Aug 10 14:25:30 2014 -0400

    3296: profile redirection works perfectly now that session caching is removed.

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 7c3e216..4385f81 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -517,7 +517,6 @@ class ApplicationController < ActionController::Base
     if current_user && profile_config
       missing_required_profile = false
 
-      current_user.reload
       user_prefs = current_user.prefs
       current_user_profile = user_prefs[:profile] if user_prefs
 

commit c803bd3b08fb2a981bb02f99d2be6d10bc37d341
Merge: 51ab8fa 65c7f47
Author: radhika <radhika at curoverse.com>
Date:   Sun Aug 10 14:10:52 2014 -0400

    Merge branch '3296-user-profile' of git.curoverse.com:arvados into 3296-user-profile


commit 51ab8fada99e0d5dad24b7e905c494850dcd1fe1
Author: radhika <radhika at curoverse.com>
Date:   Sun Aug 10 07:19:45 2014 -0400

    3296: after profile is filled in by user, bring the user back to profile page with message saying all set and provide button to take to the desired target. for improved ui experience.

diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss
index c986f03..6b91783 100644
--- a/apps/workbench/app/assets/stylesheets/application.css.scss
+++ b/apps/workbench/app/assets/stylesheets/application.css.scss
@@ -244,3 +244,7 @@ div.pane-content iframe {
   width: 100%;
   border: none;
 }
+
+div.rounded {
+  border-radius: 3px;
+}
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 0593ee3..f332bb3 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -529,8 +529,7 @@ class ApplicationController < ActionController::Base
     if current_user && profile_config
       missing_required_profile = false
 
-      user_prefs = current_user.prefs
-      current_user.reload if !user_prefs[:profile]
+      current_user.reload
       user_prefs = current_user.prefs
       current_user_profile = user_prefs[:profile] if user_prefs
 
diff --git a/apps/workbench/app/views/users/profile.html.erb b/apps/workbench/app/views/users/profile.html.erb
index dfb1948..906ca48 100644
--- a/apps/workbench/app/views/users/profile.html.erb
+++ b/apps/workbench/app/views/users/profile.html.erb
@@ -2,6 +2,27 @@
     profile_config = Rails.configuration.user_profile_form_fields
     current_user_profile = current_user.prefs[:profile]
     show_save_button = false
+
+    profile_message = 'You can manage your profile using this page. Any feilds in red are required and missing.
+                       Please fill in those fields before you can accesse Arvados Workbench.'
+              
+    missing_required_profile = false
+    profile_config.kind_of?(Array) && profile_config.andand.each do |entry|
+      if entry['message']
+        profile_message = entry['message']
+      else    # key
+        if !current_user_profile ||
+           !current_user_profile[entry['key'].to_sym] ||
+           current_user_profile[entry['key'].to_sym].empty?
+          missing_required_profile = true
+        end
+      end
+    end
+
+    profile_url = '/users/'+current_user.uuid+'/profile'
+    target = request.url.partition('?target=')[-1]
+    target = request.url if target.empty?
+    return_to_url = (request.url.ends_with? profile_url) ? profile_url : profile_url+'?target='+target
 %>
 
 <div>
@@ -12,20 +33,24 @@
           </h4>
         </div>
         <div class="panel-body">
-          <div>
-            <% profile_message = 'You can manage your profile using this page. Any feilds in red are required and missing.
-                  Please fill in those fields before you can accesse Arvados Workbench.'
-                  profile_config.kind_of?(Array) && profile_config.andand.each do |entry| 
-                  if entry['message']
-                    profile_message = entry['message']
-                    break
-                  end
-                end %>
-            <p> <%=profile_message%> </p><br/>
-          </div>
-          <div>
+          <% if !missing_required_profile && params.andand.keys.include?('target') %>
+            <div class="rounded" style="border-width: 1px; border-style: dotted; border-color: lightgray;">
+              <p style="margin: 8px;">Thank you for filling in your profile. If you are done updating your profile, 
+                 you can now access Arvados Workbench by clicking on this button.
+                  <form action="<%=target%>">
+                    <input style="margin-left: 8px;" class="btn btn-primary" type="submit" value="Take me to my page">
+                  </form>
+              </p>
+            </div>
+          <% else %>
+            <div class="rounded" style="border-width: 1px; border-style: dotted; border-color: lightgray;">
+              <p style="margin: 8px;"> <%=profile_message%> </p>
+            </div>
+          <% end %>
+
+          <div class="rounded" style="border-width: 1px; border-style: dotted; border-color: lightgray;">
             <%= form_tag "/users/#{current_user.uuid}", {method: 'patch', id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal'} do %>
-              <%= hidden_field_tag :return_to, request.url %>
+              <%= hidden_field_tag :return_to, return_to_url %>
               <div class="form-group">
                   <label for="email" class="col-sm-3 control-label"> Email </label>
                   <div class="col-sm-9">
@@ -65,7 +90,7 @@
                            style=<%="color:red" if entry['required']&&(!value||value.empty?)%>> <%=label%>
                     </label>
                     <% if entry['type'] == 'select' %>
-                      <div class="col-sm-9">
+                      <div class="col-sm-8">
                         <select class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]">
                           <% entry['options'].each do |option| %>
                             <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
@@ -73,7 +98,7 @@
                         </select>
                       </div>
                     <% else %>
-                      <div class="col-sm-9">
+                      <div class="col-sm-8">
                         <input type="text" class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
                       </div>
                     <% end %>
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 70b7767..21406b0 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -212,6 +212,9 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
     page.find_field('user[prefs][:profile][:'+required_field_key+']').set 'value to fill required field'
 
     click_button "Save profile"
+    # profile saved and in profile page now with success
+    assert page.has_text? 'Thank you for filling in your profile'
+    click_button 'Take me to my page'
 
     # profile saved and in home page now
     assert page.has_text? 'My projects'

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list