Project

General

Profile

Patch #5447 ยป change_status.diff

adds a status select box to the user edit form - Holger Just, 2010-05-05 17:39

View differences:

app/helpers/users_helper.rb (working copy)
45 45
    end
46 46
  end
47 47
  
48
  def change_status_options_for_select(user)    
49
    disabled = []
50
    disabled << User::STATUS_REGISTERED unless user.registered?
51
    disabled << User::STATUS_LOCKED if user == User.current
52

  
53
    options_for_select([[l(:status_active), User::STATUS_ACTIVE],
54
                        [l(:status_registered), User::STATUS_REGISTERED],
55
                        [l(:status_locked), User::STATUS_LOCKED]
56
                       ],
57
                       :selected => user.status,
58
                       :disabled => disabled
59
                      )
60
  end
61
  
48 62
  def user_settings_tabs
49 63
    tabs = [{:name => 'general', :partial => 'users/general', :label => :label_general},
50 64
            {:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural}
app/views/users/_form.rhtml (working copy)
16 16
<% end %>
17 17

  
18 18
<p><%= f.check_box :admin, :disabled => (@user == User.current) %></p>
19
<p><%= f.select :status, change_status_options_for_select(@user) %></p>
19 20
<%= call_hook(:view_users_form, :user => @user, :form => f) %>
20 21
</div>
    (1-1/1)