[ARVADOS] updated: c424885353afb06ac835e6d44be2d838d193d49f

git at public.curoverse.com git at public.curoverse.com
Wed Aug 6 21:10:18 EDT 2014


Summary of changes:
 .../app/controllers/application_controller.rb      | 16 ++--
 apps/workbench/app/controllers/users_controller.rb | 21 ++---
 apps/workbench/app/views/layouts/body.html.erb     |  2 +-
 apps/workbench/app/views/users/_profile.html.erb   | 77 ------------------
 apps/workbench/app/views/users/profile.html.erb    | 92 +++++++++++++++++++++-
 apps/workbench/config/application.default.yml      | 14 ++--
 apps/workbench/config/routes.rb                    |  4 +-
 7 files changed, 114 insertions(+), 112 deletions(-)
 delete mode 100644 apps/workbench/app/views/users/_profile.html.erb

       via  c424885353afb06ac835e6d44be2d838d193d49f (commit)
       via  1071802079ee3c706d217ce41fd35b4e304a6a30 (commit)
       via  9921c58649fcbda169f10cf0a2f0e21620b0e3cd (commit)
       via  8514f29184502ce8b39c0c67489740006f6bd5a9 (commit)
      from  ff2e08fbf73f90956141ab6cb0e6fca42ddec33f (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 c424885353afb06ac835e6d44be2d838d193d49f
Author: radhika <radhika at curoverse.com>
Date:   Wed Aug 6 21:09:53 2014 -0400

    3296: add "message" to profile config

diff --git a/apps/workbench/app/views/users/profile.html.erb b/apps/workbench/app/views/users/profile.html.erb
index f8456b9..6af3662 100644
--- a/apps/workbench/app/views/users/profile.html.erb
+++ b/apps/workbench/app/views/users/profile.html.erb
@@ -4,8 +4,8 @@
     user_prefs = User.limit(1).where(uuid: current_user.uuid).first.prefs
     current_user_profile = user_prefs[:profile] if user_prefs
 %>
-  <div>
-      <div class="panel panel-default">
+<div>
+    <div class="panel panel-default">
         <div class="panel-heading">
           <h4 class="panel-title">
             Profile
@@ -13,9 +13,15 @@
         </div>
         <div class="panel-body">
           <div>
-            <p>You can manage your profile using this page.
-               Any feilds in <font style="color:red">red</font> are required and missing.
-               Please fill in those fields before you can accesse Arvados Workbench.</p><br/>
+            <% 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.andand.each do |entry| 
+                  if entry['message']
+                    profile_message = entry['message']
+                    break
+                  end
+                end %>
+            <p> <%=profile_message%> </p><br/>
           </div>
           <div>
             <%= form_tag update_profile_path, {method: 'put', id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal', remote: true} do %>
@@ -45,30 +51,32 @@
               </div>
 
               <% profile_config.andand.each do |entry| %>
-                <%
-                    label = entry['required'] ? '* ' : ''
-                    label += entry['form_field_title']
-                    value = current_user_profile[entry['key'].to_sym] if current_user_profile
-                %>
-                <div class="form-group">
-                  <label for="<%=entry['key']%>"
-                         class="col-sm-3 control-label"
-                         style=<%="color:red" if entry['required']&&!value%>> <%=label%>
-                  </label>
-                  <% if entry['type'] == 'select' %>
-                    <div class="col-sm-9">
-                      <select class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>">
-                        <% entry['options'].each do |option| %>
-                          <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
-                        <% end %>
-                      </select>
-                    </div>
-                  <% else %>
-                    <div class="col-sm-9">
-                      <input type="text" class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
-                    </div>
-                  <% end %>
-                </div>
+                <% if entry['key'] %>
+                  <%
+                      label = entry['required'] ? '* ' : ''
+                      label += entry['form_field_title']
+                      value = current_user_profile[entry['key'].to_sym] if current_user_profile
+                  %>
+                  <div class="form-group">
+                    <label for="<%=entry['key']%>"
+                           class="col-sm-3 control-label"
+                           style=<%="color:red" if entry['required']&&!value%>> <%=label%>
+                    </label>
+                    <% if entry['type'] == 'select' %>
+                      <div class="col-sm-9">
+                        <select class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>">
+                          <% entry['options'].each do |option| %>
+                            <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
+                          <% end %>
+                        </select>
+                      </div>
+                    <% else %>
+                      <div class="col-sm-9">
+                        <input type="text" class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
+                      </div>
+                    <% end %>
+                  </div>
+                <% end %>
               <% end %>
 
               <div class="form-group">
@@ -79,5 +87,5 @@
             <% end %>
           </div>
         </div>
-      </div>
+    </div>
 </div>
diff --git a/apps/workbench/config/application.default.yml b/apps/workbench/config/application.default.yml
index 0dae0bb..a19f707 100644
--- a/apps/workbench/config/application.default.yml
+++ b/apps/workbench/config/application.default.yml
@@ -80,13 +80,15 @@ common:
   user_profile_form_fields: false
 
   # Below is a sample setting of user_profile_form_fields.
-  # This sample configures two fields as represented by the attribute "key".
-  # You can specify "type" as "text" or "select".
-  # Specify "options" when using the type "select".
-  # Set "required" as "true" for any of the fields to make them required.
-  # If any of the required fields are missing in the user's profile, the user will be
-  # redirected to the "/profile" page before they can access any Workbench features.
+  # Use "message" to configure a message you want to display at the top of the profile page.
+  # This sample configures two fields as represented by the attribute "key". For these fields,
+  #   You can specify "type" as "text" or "select".
+  #   Specify "options" when using the type "select".
+  #   Set "required" as "true" for any of the fields to make them required.
+  #   If any of the required fields are missing in the user's profile, the user will be
+  #   redirected to the profile page before they can access any Workbench features.
   #user_profile_form_fields:
+  #  - message: Welcome to Curoverse. Any fields in red are required and missing. Please fill in those fields before you can access Arvados Workbench.
   #  - key: organization
   #    type: text
   #    form_field_title: Institution/Company

commit 1071802079ee3c706d217ce41fd35b4e304a6a30
Author: radhika <radhika at curoverse.com>
Date:   Wed Aug 6 17:50:10 2014 -0400

    3296: some cleanup

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 4468df4..af9ea4b 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -513,22 +513,21 @@ class ApplicationController < ActionController::Base
   end
 
   def check_user_profile
-    @profile_config = Rails.configuration.user_profile_form_fields
+    profile_config = Rails.configuration.user_profile_form_fields
 
     if request.method.downcase != 'get' || params[:partials]
       return true
     end
 
-    if current_user && @profile_config
+    if current_user && profile_config
       missing_required_profile = false
 
-      @this_user = User.limit(1).where(uuid: current_user.uuid).first
-      user_prefs = @this_user.prefs
-      @current_user_profile = user_prefs[:profile] if user_prefs
+      user_prefs = User.limit(1).where(uuid: current_user.uuid).first.prefs
+      current_user_profile = user_prefs[:profile] if user_prefs
 
-      @profile_config.andand.each do |entry|
+      profile_config.andand.each do |entry|
         if entry['required']
-          if !@current_user_profile || !@current_user_profile[entry['key'].to_sym]
+          if !current_user_profile || !current_user_profile[entry['key'].to_sym]
             missing_required_profile = true
             break
           end
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 8ed90c4..d4b917b 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -281,8 +281,8 @@ class UsersController < ApplicationController
     user_prefs = User.limit(1).where(uuid: current_user.uuid).first.prefs
 
     profile_keys = []
-    @profile_config = Rails.configuration.user_profile_form_fields
-    @profile_config.andand.each do |entry|
+    profile_config = Rails.configuration.user_profile_form_fields
+    profile_config.andand.each do |entry|
       profile_keys << entry['key']
     end
 
@@ -297,8 +297,8 @@ class UsersController < ApplicationController
 
     # Inform server to send mail if this is the first time profile is being created and notification is configured
     profile_notification_address = Rails.configuration.user_profile_notification_address
-    @current_user_profile = user_prefs[:profile] if user_prefs
-    if !@current_user_profile && profile_notification_address
+    current_user_profile = user_prefs[:profile] if user_prefs
+    if !current_user_profile && profile_notification_address
       updated_profile[:send_profile_notification_email] = profile_notification_address
     end
 
diff --git a/apps/workbench/app/views/users/_profile.html.erb b/apps/workbench/app/views/users/_profile.html.erb
deleted file mode 100644
index 9d426ca..0000000
--- a/apps/workbench/app/views/users/_profile.html.erb
+++ /dev/null
@@ -1,77 +0,0 @@
-<div>
-      <div class="panel panel-default">
-        <div class="panel-heading">
-          <h4 class="panel-title">
-            Profile
-          </h4>
-        </div>
-        <div class="panel-body">
-          <div>
-            <p>You can manage your profile using this page.
-               Any feilds in <font style="color:red">red</font> are required and missing.
-               Please fill in those fields before you can accesse Arvados Workbench.</p><br/>
-          </div>
-          <div>
-            <%= form_tag update_profile_path, {method: 'put', id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal', remote: true} do %>
-              <div class="form-group">
-                  <label for="email" class="col-sm-3 control-label"> Email </label>
-                  <div class="col-sm-9">
-                    <p class="form-control-static" id="email" name="email"><%=current_user.email%></p>
-                  </div>
-              </div>
-              <div class="form-group">
-                  <label for="first_name" class="col-sm-3 control-label"> First name </label>
-                  <div class="col-sm-9">
-                    <p class="form-control-static" id="first_name" name="first_name"><%=current_user.first_name%></p>
-                  </div>
-              </div>
-              <div class="form-group">
-                  <label for="last_name" class="col-sm-3 control-label"> Last name </label>
-                  <div class="col-sm-9">
-                    <p class="form-control-static" id="last_name" name="last_name"><%=current_user.last_name%></p>
-                  </div>
-              </div>
-              <div class="form-group">
-                  <label for="identity_url" class="col-sm-3 control-label"> Identity URL </label>
-                  <div class="col-sm-9">
-                    <p class="form-control-static" id="identity_url" name="identity_url"><%=@this_user.andand.identity_url%></p>
-                  </div>
-              </div>
-
-              <% @profile_config.andand.each do |entry| %>
-                <%
-                    label = entry['required'] ? '* ' : ''
-                    label += entry['form_field_title']
-                    value = @current_user_profile[entry['key'].to_sym] if @current_user_profile
-                %>
-                <div class="form-group">
-                  <label for="<%=entry['key']%>"
-                         class="col-sm-3 control-label"
-                         style=<%="color:red" if entry['required']&&!value%>> <%=label%>
-                  </label>
-                  <% if entry['type'] == 'select' %>
-                    <div class="col-sm-9">
-                      <select class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>">
-                        <% entry['options'].each do |option| %>
-                          <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
-                        <% end %>
-                      </select>
-                    </div>
-                  <% else %>
-                    <div class="col-sm-9">
-                      <input type="text" class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
-                    </div>
-                  <% end %>
-                </div>
-              <% end %>
-
-              <div class="form-group">
-                <div class="col-sm-offset-3 col-sm-9">
-                  <button type="submit" class="btn btn-primary">Save profile</button>
-                </div>
-              </div>
-            <% end %>
-          </div>
-        </div>
-      </div>
-</div>
diff --git a/apps/workbench/app/views/users/profile.html.erb b/apps/workbench/app/views/users/profile.html.erb
index a95f14d..f8456b9 100644
--- a/apps/workbench/app/views/users/profile.html.erb
+++ b/apps/workbench/app/views/users/profile.html.erb
@@ -1 +1,83 @@
-<%= render :partial => 'users/profile' %>
+<% 
+    profile_config = Rails.configuration.user_profile_form_fields
+    this_user = User.limit(1).where(uuid: current_user.uuid).first
+    user_prefs = User.limit(1).where(uuid: current_user.uuid).first.prefs
+    current_user_profile = user_prefs[:profile] if user_prefs
+%>
+  <div>
+      <div class="panel panel-default">
+        <div class="panel-heading">
+          <h4 class="panel-title">
+            Profile
+          </h4>
+        </div>
+        <div class="panel-body">
+          <div>
+            <p>You can manage your profile using this page.
+               Any feilds in <font style="color:red">red</font> are required and missing.
+               Please fill in those fields before you can accesse Arvados Workbench.</p><br/>
+          </div>
+          <div>
+            <%= form_tag update_profile_path, {method: 'put', id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal', remote: true} do %>
+              <div class="form-group">
+                  <label for="email" class="col-sm-3 control-label"> Email </label>
+                  <div class="col-sm-9">
+                    <p class="form-control-static" id="email" name="email"><%=current_user.email%></p>
+                  </div>
+              </div>
+              <div class="form-group">
+                  <label for="first_name" class="col-sm-3 control-label"> First name </label>
+                  <div class="col-sm-9">
+                    <p class="form-control-static" id="first_name" name="first_name"><%=current_user.first_name%></p>
+                  </div>
+              </div>
+              <div class="form-group">
+                  <label for="last_name" class="col-sm-3 control-label"> Last name </label>
+                  <div class="col-sm-9">
+                    <p class="form-control-static" id="last_name" name="last_name"><%=current_user.last_name%></p>
+                  </div>
+              </div>
+              <div class="form-group">
+                  <label for="identity_url" class="col-sm-3 control-label"> Identity URL </label>
+                  <div class="col-sm-9">
+                    <p class="form-control-static" id="identity_url" name="identity_url"><%=this_user.andand.identity_url%></p>
+                  </div>
+              </div>
+
+              <% profile_config.andand.each do |entry| %>
+                <%
+                    label = entry['required'] ? '* ' : ''
+                    label += entry['form_field_title']
+                    value = current_user_profile[entry['key'].to_sym] if current_user_profile
+                %>
+                <div class="form-group">
+                  <label for="<%=entry['key']%>"
+                         class="col-sm-3 control-label"
+                         style=<%="color:red" if entry['required']&&!value%>> <%=label%>
+                  </label>
+                  <% if entry['type'] == 'select' %>
+                    <div class="col-sm-9">
+                      <select class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>">
+                        <% entry['options'].each do |option| %>
+                          <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
+                        <% end %>
+                      </select>
+                    </div>
+                  <% else %>
+                    <div class="col-sm-9">
+                      <input type="text" class="form-control" id="<%=entry['key']%>" name="<%=entry['key']%>" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
+                    </div>
+                  <% end %>
+                </div>
+              <% end %>
+
+              <div class="form-group">
+                <div class="col-sm-offset-3 col-sm-9">
+                  <button type="submit" class="btn btn-primary">Save profile</button>
+                </div>
+              </div>
+            <% end %>
+          </div>
+        </div>
+      </div>
+</div>

commit 9921c58649fcbda169f10cf0a2f0e21620b0e3cd
Author: radhika <radhika at curoverse.com>
Date:   Wed Aug 6 17:34:13 2014 -0400

    3296: remove skip_profile and add params[:partial] handling

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 4353f3a..4468df4 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -418,7 +418,6 @@ class ApplicationController < ActionController::Base
         is_admin: user.is_admin,
         prefs: user.prefs
       }
-      session[:skip_profile] = params[:skip_profile]
 
       if !request.format.json? and request.method.in? ['GET', 'HEAD']
         # Repeat this request with api_token in the (new) session
@@ -516,7 +515,7 @@ class ApplicationController < ActionController::Base
   def check_user_profile
     @profile_config = Rails.configuration.user_profile_form_fields
 
-    if params[:skip_profile] || session[:skip_profile] || request.method.downcase != 'get'
+    if request.method.downcase != 'get' || params[:partials]
       return true
     end
 
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index dac79be..8ed90c4 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -111,7 +111,7 @@ class UsersController < ApplicationController
                                       owner_uuid: @object.uuid
                                     }
                                   })
-    redirect_to root_url(api_token: resp[:api_token], skip_profile: true)
+    redirect_to root_url(api_token: resp[:api_token])
   end
 
   def home
diff --git a/apps/workbench/app/views/users/_profile.html.erb b/apps/workbench/app/views/users/_profile.html.erb
index ee327dc..9d426ca 100644
--- a/apps/workbench/app/views/users/_profile.html.erb
+++ b/apps/workbench/app/views/users/_profile.html.erb
@@ -16,25 +16,25 @@
               <div class="form-group">
                   <label for="email" class="col-sm-3 control-label"> Email </label>
                   <div class="col-sm-9">
-                    <input type="text" class="form-control" id="email" name="email" placeholder="Email" value="<%=current_user.email%>" disabled></input>
+                    <p class="form-control-static" id="email" name="email"><%=current_user.email%></p>
                   </div>
               </div>
               <div class="form-group">
                   <label for="first_name" class="col-sm-3 control-label"> First name </label>
                   <div class="col-sm-9">
-                    <input type="text" class="form-control" id="first_name" name="first_name" placeholder="First name" value="<%=current_user.first_name%>" disabled></input>
+                    <p class="form-control-static" id="first_name" name="first_name"><%=current_user.first_name%></p>
                   </div>
               </div>
               <div class="form-group">
                   <label for="last_name" class="col-sm-3 control-label"> Last name </label>
                   <div class="col-sm-9">
-                    <input type="text" class="form-control" id="last_name" name="last_name" placeholder="Last name" value="<%=current_user.last_name%>" disabled></input>
+                    <p class="form-control-static" id="last_name" name="last_name"><%=current_user.last_name%></p>
                   </div>
               </div>
               <div class="form-group">
                   <label for="identity_url" class="col-sm-3 control-label"> Identity URL </label>
                   <div class="col-sm-9">
-                    <input type="text" class="form-control" id="identity_url" name="identity_url" placeholder="Identity URL" value="<%=@this_user.identity_url%>" disabled></input>
+                    <p class="form-control-static" id="identity_url" name="identity_url"><%=@this_user.andand.identity_url%></p>
                   </div>
               </div>
 

commit 8514f29184502ce8b39c0c67489740006f6bd5a9
Author: radhika <radhika at curoverse.com>
Date:   Wed Aug 6 15:33:46 2014 -0400

    3296: profile path routing

diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 5746520..dac79be 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -277,17 +277,6 @@ class UsersController < ApplicationController
     end
   end
 
-  def manage_profile
-    @profile_config = Rails.configuration.user_profile_form_fields
-    @this_user = User.limit(1).where(uuid: current_user.uuid).first
-    user_prefs = @this_user.prefs
-    @current_user_profile = user_prefs[:profile] if user_prefs
-
-    respond_to do |f|
-      f.html { render template: 'users/profile' }
-    end
-  end
-
   def update_profile
     user_prefs = User.limit(1).where(uuid: current_user.uuid).first.prefs
 
diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb
index 1d08164..ef96f08 100644
--- a/apps/workbench/app/views/layouts/body.html.erb
+++ b/apps/workbench/app/views/layouts/body.html.erb
@@ -49,7 +49,7 @@
               <% if current_user.is_active %>
               <li role="presentation"><a href="/manage_account" role="menuitem"><i class="fa fa-key fa-fw"></i> Manage account</a></li>
               <% if Rails.configuration.user_profile_form_fields %>
-                <li role="presentation"><a href="/profile" role="menuitem"><i class="fa fa-key fa-fw"></i> Manage my profile</a></li>
+                <li role="presentation"><a href="/users/<%=current_user.uuid%>/profile" role="menuitem"><i class="fa fa-key fa-fw"></i> Manage my profile</a></li>
               <% end %>
               <li role="presentation" class="divider"></li>
               <% end %>
diff --git a/apps/workbench/app/views/users/_profile.html.erb b/apps/workbench/app/views/users/_profile.html.erb
index 4bfc607..ee327dc 100644
--- a/apps/workbench/app/views/users/_profile.html.erb
+++ b/apps/workbench/app/views/users/_profile.html.erb
@@ -12,7 +12,7 @@
                Please fill in those fields before you can accesse Arvados Workbench.</p><br/>
           </div>
           <div>
-            <%= form_tag update_profile_path, {method: 'get', id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal', remote: true} do %>
+            <%= form_tag update_profile_path, {method: 'put', id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal', remote: true} do %>
               <div class="form-group">
                   <label for="email" class="col-sm-3 control-label"> Email </label>
                   <div class="col-sm-9">
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index cae7d2b..b63e8f6 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -10,7 +10,7 @@ ArvadosWorkbench::Application.routes.draw do
   get '/user_agreements/signatures' => 'user_agreements#signatures'
   get "users/setup_popup" => 'users#setup_popup', :as => :setup_user_popup
   get "users/setup" => 'users#setup', :as => :setup_user
-  get "users/update_profile" => 'users#update_profile', :as => :update_profile
+  put "users/update_profile" => 'users#update_profile', :as => :update_profile
   resources :nodes
   resources :humans
   resources :traits
@@ -33,11 +33,11 @@ ArvadosWorkbench::Application.routes.draw do
     post 'sudo', :on => :member
     post 'unsetup', :on => :member
     get 'setup_popup', :on => :member
+    get 'profile', :on => :member
   end
   get '/manage_account' => 'users#manage_account'
   get "/add_ssh_key_popup" => 'users#add_ssh_key_popup', :as => :add_ssh_key_popup
   get "/add_ssh_key" => 'users#add_ssh_key', :as => :add_ssh_key
-  get '/profile' => 'users#manage_profile'
   resources :logs
   resources :factory_jobs
   resources :uploaded_datasets

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list