Skip to content

Commit

Permalink
Merge pull request #94 from rmparr/remove-gender
Browse files Browse the repository at this point in the history
Remove gender
  • Loading branch information
tvdeyen authored Nov 28, 2019
2 parents 17459e3 + 1a973f0 commit a76d7d5
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 17 deletions.
5 changes: 2 additions & 3 deletions app/controllers/alchemy/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Alchemy
module Admin
class UsersController < ResourcesController

before_action :set_roles_and_genders, except: [:index, :destroy]
before_action :set_roles, except: [:index, :destroy]

load_and_authorize_resource class: Alchemy::User,
only: [:edit, :update, :destroy]
Expand Down Expand Up @@ -67,13 +67,12 @@ def destroy

private

def set_roles_and_genders
def set_roles
if can_update_role?
@user_roles = User::ROLES.map do |role|
[User.human_rolename(role), role]
end
end
@user_genders = User.genders_for_select
end

def user_params
Expand Down
8 changes: 0 additions & 8 deletions app/models/alchemy/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class User < ActiveRecord::Base
:lastname,
:login,
:email,
:gender,
:language,
:password,
:password_confirmation,
Expand Down Expand Up @@ -41,13 +40,6 @@ def human_rolename(role)
Alchemy.t("user_roles.#{role}")
end

def genders_for_select
[
[Alchemy.t('male'), 'male'],
[Alchemy.t('female'), 'female']
]
end

def logged_in_timeout
Config.get(:auto_logout_time).minutes.to_i
end
Expand Down
4 changes: 0 additions & 4 deletions app/views/alchemy/admin/users/_fields.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<%= f.input :gender,
collection: @user_genders,
prompt: Alchemy.t('Please choose'),
input_html: {class: 'alchemy_selectbox'} %>
<%= f.input :firstname %>
<%= f.input :lastname %>
<%= f.input :login, autofocus: true %>
Expand Down
1 change: 0 additions & 1 deletion db/migrate/20131015124700_create_alchemy_users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ def up
t.string "lastname"
t.string "login"
t.string "email"
t.string "gender"
t.string "language"
t.string "encrypted_password", limit: 128, default: "", null: false
t.string "password_salt", limit: 128, default: "", null: false
Expand Down
1 change: 0 additions & 1 deletion spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@
t.string "lastname"
t.string "login"
t.string "email"
t.string "gender"
t.string "language"
t.string "encrypted_password", limit: 128, default: "", null: false
t.string "password_salt", limit: 128, default: "", null: false
Expand Down

0 comments on commit a76d7d5

Please sign in to comment.