From 6ce27271e388af7542908b1ada90c40fab2599ea Mon Sep 17 00:00:00 2001 From: baiyu Date: Mon, 23 Sep 2013 09:41:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E4=BA=86=E8=81=8C=E7=A7=B0=E3=80=81?= =?UTF-8?q?=E5=AD=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 6 +- app/controllers/my_controller.rb | 24 ++++- app/models/user_extensions.rb | 2 +- app/views/account/register.html.erb | 69 +++++++++++- app/views/layouts/base_users.html.erb | 8 +- app/views/my/account.html.erb | 70 ++++++++++++ config/database.yml | 14 +-- config/locales/en.yml | 3 +- config/locales/zh.yml | 9 +- db/schema.rb | 146 ++++++++++++++++++++------ public/stylesheets/application.css | 1 + 11 files changed, 299 insertions(+), 53 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 80fb89178..fa4de26f9 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -148,7 +148,11 @@ class AccountController < ApplicationController #added by bai unless @user.id.nil? - UserExtensions.create(:identity => params[:identity].to_i,:gender => params[:gender].to_i,:location => params[:province]+params[:city], :user_id => @user.id) + ue = UserExtensions.create(:identity => params[:identity].to_i,:technical_title => params[:technical_title], :gender => params[:gender].to_i, :user_id => @user.id, :student_id => params[:no]) + unless params[:province].nil? || params[:city].nil? + ue.location = params[:province]+params[:city] + ue.save + end end #end diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 0aba4ed26..48c6a7d59 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -83,14 +83,34 @@ class MyController < ApplicationController se.user_id = @user.id se.occupation = params[:occupation] se.gender = params[:gender] - se.location = params[:province]+params[:city] + if params[:province] && params[:city] + se.location = params[:province]+params[:city] + end + if params[:identity] + se.identity = params[:identity].to_i + end + if params[:technical_title] + se.technical_title = params[:technical_title] + end + if params[:no] + se.student_id = params[:no] + end se.save else se = @user.user_extensions se.occupation = params[:occupation] se.gender = params[:gender] if params[:province] && params[:city] - se.location = params[:province]+params[:city] + se.location = params[:province]+params[:city] + end + if params[:identity] + se.identity= params[:identity].to_i + end + if params[:technical_title] + se.technical_title = params[:technical_title] + end + if params[:no] + se.student_id = params[:no] end se.save end diff --git a/app/models/user_extensions.rb b/app/models/user_extensions.rb index e1b5d049c..aae6ada61 100644 --- a/app/models/user_extensions.rb +++ b/app/models/user_extensions.rb @@ -1,6 +1,6 @@ class UserExtensions < ActiveRecord::Base belongs_to :user - attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity + attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id #this method was used to update the table user_extensions def update_user_extensions(birthday=nil,brief_introduction=nil, gender=nil,location=nil,occupation=nil,work_experience=nil,zip_code=nil) diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index ce666940e..1c9dd6854 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -187,6 +187,48 @@ } + +

<%=l(:label_register)%> <%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>

@@ -211,14 +253,29 @@ <%="#{l(:label_mail_attention)} "%>

<%= f.select :language, lang_options_for_select %>

- +

<%= l(:label_identity) %> * - <%= select_tag 'identity', " - - ".html_safe %>

+ + + + + + +

+ +

@@ -226,7 +283,7 @@ <%= select_tag 'gender', "".html_safe %>
<%= l(:label_gender) %>

-

+

<%= l(:label_location) %> *
- + @@ -116,6 +116,12 @@ + + + <% end %> + <% else%> diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 5a1a55f31..c1b4be4aa 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -325,6 +325,76 @@ $().ready(funtion(){

+ + + + + + + + +

<%= l(:label_identity) %> +

+ + +
<%= l(:label_location) %>
<%= submit_tag l(:button_submit) %>

<% end %> + <% if Setting.openid? %>

<%= f.text_field :identity_url %>

<% end %> diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 55db4d9bb..2cedd1815 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -105,7 +105,7 @@
<%= l(:label_user_mail) %><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %>
<%= l(:label_location) %><%= @user.user_extensions.location %>
+ <% if @user.user_extensions.identity == 0 %> + <%= l(:label_technical_title) %><%= @user.user_extensions.technical_title %>
<%= l(:field_occupation) %> +

+ + + + + + + <% if Setting.openid? %>

diff --git a/config/database.yml b/config/database.yml index 8b832ecf4..d9e69b298 100644 --- a/config/database.yml +++ b/config/database.yml @@ -5,22 +5,22 @@ production: adapter: mysql2 - database: bitnami_redmine - host: 192 - socket: /home/pdl/redmine-2.3.1-2/mysql/tmp/mysql.sock + database: redmine + host: 10.0.47.245 + #socket: /home/pdl/redmine-2.3.1-2/mysql/tmp/mysql.sock port: 3306 username: root - password: "1234" + password: "bitnami" encoding: utf8 development: adapter: mysql2 - database: redmine - host: 10.0.47.98 + database: bitnami_redmine + host: 10.0.47.245 #socket: /home/pdl/redmine-2.3.1-2/mysql/tmp/mysql.sock port: 3306 username: root - password: "1234" + password: "bitnami" encoding: utf8 # Warning: The database defined as "test" will be erased and diff --git a/config/locales/en.yml b/config/locales/en.yml index 1ca807976..a423b8b83 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1416,7 +1416,8 @@ en: label_identity: Identity label_teacher: Teacher label_student: Student - label_other: Other + label_enterprise: Enterprise + label_developer: Developer label_gender: Gender label_gender_male: male label_gender_female: female diff --git a/config/locales/zh.yml b/config/locales/zh.yml index e856264b6..cef6891b5 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1356,7 +1356,6 @@ zh: field_birthday: 生日 field_brief_introduction: 个人简介 field_location: 现住址 - field_occupation: 工作单位 field_work_experience: 工作经验(年) field_zip_code: 邮编 label_reward: 奖励: @@ -1425,11 +1424,15 @@ zh: label_identity: 身份 label_teacher: 教师 label_student: 学生 - label_other: 其他 + label_enterprise: 企业 + label_developer: 开发者 + label_technical_title: "职称:" label_gender: 性别 label_gender_male: 男 label_gender_female: 女 - label_location: 地区 + label_location: "地区:" + field_occupation: "工作单位:" + notice_lost_location: 请选择地区信息 label_brief_introduction: 修改我的状态 label_my_brief_introduction: 今天的心情如何?留下你的脚印吧~ #end diff --git a/db/schema.rb b/db/schema.rb index e2b5ecc37..a6452cbba 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,15 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130828080407) do +ActiveRecord::Schema.define(:version => 20130922123849) do + + create_table "a_user_watchers", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "member_id" + end create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -69,18 +77,20 @@ ActiveRecord::Schema.define(:version => 20130828080407) do t.string "description" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.string "reward" end create_table "bids", :force => true do |t| t.string "name" - t.string "budget", :null => false + t.string "budget", :null => false t.integer "author_id" t.date "deadline" t.string "description" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false t.integer "commit" t.integer "reward_type" + t.integer "homework_type" end create_table "boards", :force => true do |t| @@ -153,6 +163,20 @@ ActiveRecord::Schema.define(:version => 20130828080407) do add_index "comments", ["author_id"], :name => "index_comments_on_author_id" add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" + create_table "courses", :force => true do |t| + t.integer "tea_id" + t.string "name" + t.integer "state" + t.string "code" + t.integer "time" + t.string "extra" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "location" + t.string "term" + t.string "string" + end + create_table "custom_fields", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 30, :default => "", :null => false @@ -238,6 +262,18 @@ ActiveRecord::Schema.define(:version => 20130828080407) do add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true + create_table "homework_attaches", :force => true do |t| + t.integer "bid_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_for_courses", :force => true do |t| + t.integer "project_id" + t.integer "bid_id" + end + create_table "issue_categories", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "name", :limit => 30, :default => "", :null => false @@ -248,9 +284,9 @@ ActiveRecord::Schema.define(:version => 20130828080407) do add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :default => "", :null => false + t.integer "issue_from_id", :null => false + t.integer "issue_to_id", :null => false + t.string "relation_type", :null => false t.integer "delay" end @@ -392,6 +428,22 @@ ActiveRecord::Schema.define(:version => 20130828080407) do add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" add_index "messages", ["parent_id"], :name => "messages_parent_id" + create_table "messages_for_bids", :force => true do |t| + t.string "message" + t.integer "user_id" + t.integer "bid_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "messages_for_users", :force => true do |t| + t.integer "messager_id" + t.integer "user_id" + t.string "message" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "news", :force => true do |t| t.integer "project_id" t.string "title", :limit => 60, :default => "", :null => false @@ -452,6 +504,18 @@ ActiveRecord::Schema.define(:version => 20130828080407) do t.integer "project_id" end + add_index "project_statuses", ["changesets_count"], :name => "index_project_statuses_on_changesets_count" + add_index "project_statuses", ["watchers_count"], :name => "index_project_statuses_on_watchers_count" + + create_table "project_tags", :force => true do |t| + t.integer "project_id" + t.integer "tag_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "user_id" + end + create_table "projects", :force => true do |t| t.string "name", :default => "", :null => false t.text "description" @@ -465,6 +529,7 @@ ActiveRecord::Schema.define(:version => 20130828080407) do t.integer "lft" t.integer "rgt" t.boolean "inherit_members", :default => false, :null => false + t.integer "project_type" end add_index "projects", ["lft"], :name => "index_projects_on_lft" @@ -518,26 +583,6 @@ ActiveRecord::Schema.define(:version => 20130828080407) do t.string "issues_visibility", :limit => 30, :default => "default", :null => false end - create_table "seems_rateable_cached_ratings", :force => true do |t| - t.integer "cacheable_id", :limit => 8 - t.string "cacheable_type" - t.float "avg", :null => false - t.integer "cnt", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_rates", :force => true do |t| - t.integer "rater_id", :limit => 8 - t.integer "rateable_id" - t.string "rateable_type" - t.float "stars", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "settings", :force => true do |t| t.string "name", :default => "", :null => false t.text "value" @@ -548,13 +593,27 @@ ActiveRecord::Schema.define(:version => 20130828080407) do create_table "shares", :force => true do |t| t.date "created_on" - t.string "url" t.string "title" - t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.string "share_type" + t.string "url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "project_id" t.integer "user_id" + t.string "description" + end + + create_table "students", :force => true do |t| + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "students_for_courses", :force => true do |t| + t.integer "student_id" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "taggings", :force => true do |t| @@ -574,6 +633,16 @@ ActiveRecord::Schema.define(:version => 20130828080407) do t.string "name" end + create_table "teachers", :force => true do |t| + t.string "tea_name" + t.string "location" + t.integer "couurse_time" + t.integer "course_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "extra" + end + create_table "time_entries", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false @@ -598,7 +667,7 @@ ActiveRecord::Schema.define(:version => 20130828080407) do create_table "tokens", :force => true do |t| t.integer "user_id", :default => 0, :null => false t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40, :default => "", :null => false + t.string "value", :limit => 40 t.datetime "created_on", :null => false end @@ -624,6 +693,11 @@ ActiveRecord::Schema.define(:version => 20130828080407) do t.integer "zip_code" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "identity" + t.string "technical_title" + t.integer "student_id" + t.string "teacher_realname" + t.string "student_realname" end create_table "user_preferences", :force => true do |t| @@ -646,6 +720,14 @@ ActiveRecord::Schema.define(:version => 20130828080407) do add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" + create_table "user_tags", :force => true do |t| + t.integer "user_id" + t.integer "tag_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "users", :force => true do |t| t.string "login", :default => "", :null => false t.string "hashed_password", :limit => 40, :default => "", :null => false diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index b3e974410..e7de10740 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1194,6 +1194,7 @@ textarea#custom_field_default_value {width: 99%} input#content_comments {width: 99%} + p.pagination {margin-top:8px; font-size: 90%} /***** Tabular forms ******/