changeset 55:bbb139d5ca95 luisf

changes to add SSAMR info. This is a development Commit - DO NOT USE this version.
author luisf
date Fri, 26 Nov 2010 15:44:34 +0000
parents cbaf7863aafb
children 1d072f771b4d
files app/controllers/account_controller.rb app/controllers/users_controller.rb app/models/user.rb app/views/account/register.rhtml app/views/users/_form.rhtml app/views/users/show.rhtml
diffstat 6 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/app/controllers/account_controller.rb	Wed Nov 24 11:08:56 2010 +0000
+++ b/app/controllers/account_controller.rb	Fri Nov 26 15:44:34 2010 +0000
@@ -83,6 +83,11 @@
     else
       @user = User.new(params[:user])
       @user.admin = false
+      
+      
+      @user.ssamr_user_detail.description = params[:user.ssamr_user_detail][:description]
+      
+      
       @user.register
       if session[:auth_source_registration]
         @user.activate
--- a/app/controllers/users_controller.rb	Wed Nov 24 11:08:56 2010 +0000
+++ b/app/controllers/users_controller.rb	Fri Nov 26 15:44:34 2010 +0000
@@ -52,6 +52,10 @@
   def show
     @user = User.find(params[:id])
     
+    print @user.ssamr_user_detail.description
+    
+  #  @description = @user.ssamr_user_detail.description
+        
     # show projects based on current user visibility
     @memberships = @user.memberships.all(:conditions => Project.visible_by(User.current))
     
@@ -88,6 +92,10 @@
     @user.login = params[:user][:login]
     @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless @user.auth_source_id
 
+    @user.ssamr_user_detail.description = params[:user.ssamr_user_detail][:description]
+    
+    @ssamr_description = params[:user.ssamr_user_detail][:description]
+
     # TODO: Similar to My#account
     @user.mail_notification = params[:notification_option] || 'only_my_events'
     @user.pref.attributes = params[:pref]
@@ -114,6 +122,8 @@
     @user = User.find(params[:id])
     @notification_options = @user.valid_notification_options
     @notification_option = @user.mail_notification
+    
+#    @ssamr_description = @user.ssamr_user_detail
 
     @auth_sources = AuthSource.find(:all)
     @membership ||= Member.new
@@ -122,6 +132,7 @@
   verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
   def update
     @user = User.find(params[:id])
+        
     @notification_options = @user.valid_notification_options
     @notification_option = @user.mail_notification
 
--- a/app/models/user.rb	Wed Nov 24 11:08:56 2010 +0000
+++ b/app/models/user.rb	Fri Nov 26 15:44:34 2010 +0000
@@ -51,6 +51,8 @@
   has_one :api_token, :dependent => :destroy, :class_name => 'Token', :conditions => "action='api'"
   belongs_to :auth_source
   
+  has_one :ssamr_user_detail, :dependent => :destroy, :class_name => 'SsamrUserDetail'
+  
   # Active non-anonymous users scope
   named_scope :active, :conditions => "#{User.table_name}.status = #{STATUS_ACTIVE}"
   
--- a/app/views/account/register.rhtml	Wed Nov 24 11:08:56 2010 +0000
+++ b/app/views/account/register.rhtml	Fri Nov 26 15:44:34 2010 +0000
@@ -26,9 +26,14 @@
 <p><label for="user_mail"><%=l(:field_mail)%> <span class="required">*</span></label>
 <%= text_field 'user', 'mail'  %></p>
 
+<p><label for="ssamr_user_description"><%=l(:field_ssamr_description)%><span class="required">*</span></label>
+<%= text_field 'user.ssamr_user_detail', 'description'  %></p>
+
+
 <p><label for="user_language"><%=l(:field_language)%></label>
 <%= select("user", "language", lang_options_for_select) %></p>
 
+
 <% if Setting.openid? %>
 <p><label for="user_identity_url"><%=l(:field_identity_url)%></label>
 <%= text_field 'user', 'identity_url'  %></p>
--- a/app/views/users/_form.rhtml	Wed Nov 24 11:08:56 2010 +0000
+++ b/app/views/users/_form.rhtml	Fri Nov 26 15:44:34 2010 +0000
@@ -20,6 +20,10 @@
 </div>
 
 <div class="box tabular">
+	<h3><%=l(:label_ssamr_description)%></h3>
+</div>
+
+<div class="box tabular">
 <h3><%=l(:label_authentication)%></h3>
 <% unless @auth_sources.empty? %>
 <p><%= f.select :auth_source_id, ([[l(:label_internal), ""]] + @auth_sources.collect { |a| [a.name, a.id] }), {}, :onchange => "if (this.value=='') {Element.show('password_fields');} else {Element.hide('password_fields');}" %></p>
--- a/app/views/users/show.rhtml	Wed Nov 24 11:08:56 2010 +0000
+++ b/app/views/users/show.rhtml	Fri Nov 26 15:44:34 2010 +0000
@@ -20,6 +20,10 @@
 	<% end %>
 </ul>
 
+<h3><%=l(:label_ssamr_description)%></h3>
+<%= @description %>
+
+
 <% unless @memberships.empty? %>
 <h3><%=l(:label_project_plural)%></h3>
 <ul>