add: user super description

This commit is contained in:
yystopf 2022-04-28 10:42:55 +08:00
parent 088c617cc1
commit 396ac55429
6 changed files with 39 additions and 31 deletions

View File

@ -313,6 +313,7 @@ class UsersController < ApplicationController
:occupation, :technical_title,
:school_id, :department_id, :province, :city,
:custom_department, :identity, :student_id, :description,
:show_super_description, :super_description,
:show_email, :show_location, :show_department]
)
end

View File

@ -187,7 +187,7 @@ class User < Owner
attr_accessor :password, :password_confirmation
delegate :description, :gender, :department_id, :school_id, :location, :location_city,
:show_email, :show_location, :show_department,
:show_email, :show_location, :show_department, :super_description, :show_super_description,
:technical_title, :province, :city, :custom_department, to: :user_extension, allow_nil: true
before_save :update_hashed_password, :set_lastname

View File

@ -2,35 +2,34 @@
#
# Table name: user_extensions
#
# id :integer not null, primary key
# user_id :integer not null
# birthday :date
# brief_introduction :string(255)
# gender :integer
# location :string(255)
# occupation :string(255)
# work_experience :integer
# zip_code :integer
# created_at :datetime not null
# updated_at :datetime not null
# technical_title :string(255)
# identity :integer
# student_id :string(255)
# teacher_realname :string(255)
# student_realname :string(255)
# location_city :string(255)
# school_id :integer
# description :string(255) default("")
# department_id :integer
# honor :text(65535)
# edu_background :integer
# edu_entry_year :integer
# province :string(255)
# city :string(255)
# custom_department :string(255)
# show_email :boolean default("0")
# show_location :boolean default("0")
# show_department :boolean default("0")
# id :integer not null, primary key
# user_id :integer not null
# birthday :date
# brief_introduction :string(255)
# gender :integer
# location :string(255)
# occupation :string(255)
# work_experience :integer
# zip_code :integer
# created_at :datetime not null
# updated_at :datetime not null
# technical_title :string(255)
# identity :integer
# student_id :string(255)
# teacher_realname :string(255)
# student_realname :string(255)
# location_city :string(255)
# school_id :integer
# description :string(255) default("")
# department_id :integer
# province :string(255)
# city :string(255)
# custom_department :string(255)
# show_email :boolean default("0")
# show_location :boolean default("0")
# show_department :boolean default("0")
# super_description :text(4294967295)
# show_super_description :boolean
#
# Indexes
#

View File

@ -21,5 +21,6 @@ json.province @user.province
json.city @user.city
json.custom_department @user.custom_department
json.description @user.description
json.(@user, :show_email, :show_department, :show_location)
json.super_description @user.super_description
json.(@user, :show_email, :show_department, :show_location, :show_super_description)
json.message_unread_total @message_unread_total

View File

@ -13,4 +13,5 @@ json.email @user.show_email ? @user.mail : nil
json.province @user.show_location ? @user.province : nil
json.city @user.show_location ? @user.city : nil
json.custom_department @user.show_department ? @user.custom_department : nil
json.super_description @user.show_super_description ? @user.super_description : nil
json.description @user.description

View File

@ -0,0 +1,6 @@
class AddSuperDescriptionToUserExtensions < ActiveRecord::Migration[5.2]
def change
add_column :user_extensions, :super_description, :text, :limit => 4294967295
add_column :user_extensions, :show_super_description, :boolean
end
end