3296: display read-only email, first name, last name, and identity url in the profile...
authorradhika <radhika@curoverse.com>
Tue, 5 Aug 2014 18:20:45 +0000 (14:20 -0400)
committerradhika <radhika@curoverse.com>
Tue, 5 Aug 2014 18:20:45 +0000 (14:20 -0400)
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/controllers/users_controller.rb
apps/workbench/app/views/users/_profile.html.erb

index 4b79cb49a18b1bb6fc5bec4341fc8bfd18b107df..fd94cf8e40bc8fccac90821d2fe2f17af6452356 100644 (file)
@@ -517,7 +517,8 @@ class ApplicationController < ActionController::Base
     if current_user && @profile_config
       missing_required_profile = false
 
-      user_prefs = User.limit(1).where(uuid: current_user.uuid).first.prefs
+      @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
 
       @profile_config.andand.each do |entry|
index 441c99ad0a20cc1117b5ff2cdcb209e99afcda88..0d6f6240564f1e72a31a164a0db333654ab4bd01 100644 (file)
@@ -279,7 +279,8 @@ class UsersController < ApplicationController
 
   def manage_profile
     @profile_config = Rails.configuration.user_profile_form_fields
-    user_prefs = User.limit(1).where(uuid: current_user.uuid).first.prefs
+    @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|
index 994691438432f8c475adc13ab8bf640dabf96636..7cc786a27ff111320a462a7583247c25c4234f37 100644 (file)
           </div>
           <div>
             <%= form_tag update_profile_path, {method: 'get', id: 'save_profile_form', name: 'save_profile_form', class: 'form-horizontal', remote: true} do %>
-            <% @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="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>
+                  </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>
+                  </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>
+                  </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>
+                  </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"
                 </div>
               <% end %>
 
-                <div class="form-group">
-                  <div class="col-sm-offset-2 col-sm-10">
-                    <button type="submit" class="btn btn-primary">Save profile</button>
-                  </div>
+              <div class="form-group">
+                <div class="col-sm-offset-2 col-sm-10">
+                  <button type="submit" class="btn btn-primary">Save profile</button>
                 </div>
-
-              <% end %>
+              </div>
+            <% end %>
           </div>
         </div>
       </div>