From 4fb040bc61c5d3ec38e04af2cbf0f51d23429b27 Mon Sep 17 00:00:00 2001
From: baiyu <214324@12321.com>
Date: Mon, 23 Sep 2013 16:42:19 +0800
Subject: [PATCH] modify register bug
---
app/controllers/my_controller.rb | 4 +-
app/controllers/projects_controller.rb | 16 +++-
app/helpers/projects_helper.rb | 10 +--
app/helpers/users_helper.rb | 6 +-
app/models/project.rb | 1 +
app/models/user.rb | 1 +
app/views/account/register.html.erb | 33 +++++--
app/views/bids/show.html.erb | 8 ++
app/views/git_usage/ch_usage.html.erb | 2 +-
app/views/layouts/base_users.html.erb | 13 ++-
app/views/my/account.html.erb | 21 ++---
app/views/projects/_form.html.erb | 1 +
app/views/projects/_new_respond.html.erb | 16 ++--
app/views/projects/_project.html.erb | 4 +-
app/views/projects/index.html.erb | 16 ++++
.../20130828004955_stored_status_procedure.rb | 2 +-
db/schema.rb | 89 ++++++-------------
public/stylesheets/application.css | 13 ++-
18 files changed, 147 insertions(+), 109 deletions(-)
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index e83a160c5..0aba4ed26 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -77,7 +77,7 @@ class MyController < ApplicationController
# ue.save
# end
- # added by bai 往数据库里写职业、性别和地区
+ # added by bai 寰鏁版嵁搴撻噷鍐欒亴涓氥佹у埆鍜屽湴鍖
if @user.user_extensions.nil?
se = UserExtensions.new
se.user_id = @user.id
@@ -89,7 +89,9 @@ class MyController < ApplicationController
se = @user.user_extensions
se.occupation = params[:occupation]
se.gender = params[:gender]
+ if params[:province] && params[:city]
se.location = params[:province]+params[:city]
+ end
se.save
end
# end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 6a07c5c84..9ad847dde 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -192,7 +192,7 @@ class ProjectsController < ApplicationController
@projects = []
@projects_status.each do |obj|
- @projects << Project.find_by_id("#{obj.project_id}")
+ @projects << Project.visible.find_by_id("#{obj.project_id}") unless Project.visible.find_by_id("#{obj.project_id}").nil?
end
#end
respond_to do |format|
@@ -366,7 +366,9 @@ class ProjectsController < ApplicationController
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
m = Member.new(:user => User.current, :roles => [r])
project = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
- project_status = ProjectStatus.create(:project_id => @project.id)
+ if params[:project][:is_public] == 1
+ project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0)
+ end
@project.members << m
@project.project_infos << project
end
@@ -435,7 +437,7 @@ class ProjectsController < ApplicationController
@subprojects = @project.children.visible.all
@news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").all
@trackers = @project.rolled_up_trackers
- @user = User.find_by_id(ProjectInfo.find_by_project_id(@project.id).user_id)
+ @user = User.find_by_id(ProjectInfo.find_by_project_id(@project.id).user_id)
cond = @project.project_condition(Setting.display_subprojects_issues?)
@open_issues_by_tracker = Issue.visible.open.where(cond).count(:group => :tracker)
@@ -562,6 +564,14 @@ class ProjectsController < ApplicationController
@course.term = params[:project][:course][:term]
@course.save
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
+
+ if params[:project][:is_public] == '0'
+ project_status = ProjectStatus.find_by_project_id(@project.id)
+ project_status.destroy
+ elsif params[:project][:is_public] == '1'
+ project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0)
+ end
+
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index b23d1174c..1b8340721 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -94,11 +94,11 @@ module ProjectsHelper
def render_project_hierarchy(projects)
render_project_nested_lists(projects) do |project|
#Modified by young
- if (project.project_type==1)
- s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")+"(#{l(:label_course)})".html_safe
- else
- s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
- end
+ if (project.project_type==1)
+ s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")+"(#{l(:label_course)})".html_safe
+ else
+ s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
+ end
#Ended by young
if project.description.present?
#Delete by nie.
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index a1befebc7..c813714d3 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -64,9 +64,9 @@ module UsersHelper
# added by fq
#
def show_activity(state)
diff --git a/app/models/project.rb b/app/models/project.rb
index 3a95ff603..27cb9bb8c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -64,6 +64,7 @@ class Project < ActiveRecord::Base
has_many :project_infos, :dependent => :destroy
has_one :project_status, :class_name => "ProjectStatus", :dependent => :destroy
has_one :project_status, :class_name => "ProjectStatus", :dependent => :destroy
+ has_one :project_status, :class_name => "ProjectStatus", :dependent => :destroy
#end
has_one :wiki, :dependent => :destroy
diff --git a/app/models/user.rb b/app/models/user.rb
index 93f4cb83c..58b33551b 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -88,6 +88,7 @@ class User < Principal
has_many :courses, :through => :students_for_courses, :source => :project
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
+ has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
#####
######added by nie
diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb
index 1f09ba6ab..ce666940e 100644
--- a/app/views/account/register.html.erb
+++ b/app/views/account/register.html.erb
@@ -1,4 +1,4 @@
-
+
-->
-<%= l(:label_location) %>
<% if Setting.openid? %>
diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb
index e2c990915..2ccd84032 100644
--- a/app/views/projects/_form.html.erb
+++ b/app/views/projects/_form.html.erb
@@ -16,6 +16,7 @@
<%= wikitoolbar_for 'project_description' %>
+
<% @project.custom_field_values.each do |value| %>
<%= custom_field_tag_with_label :project, value %>
<% end %>
diff --git a/app/views/projects/_new_respond.html.erb b/app/views/projects/_new_respond.html.erb
index 0db0ecf21..9daa48e14 100644
--- a/app/views/projects/_new_respond.html.erb
+++ b/app/views/projects/_new_respond.html.erb
@@ -1,8 +1,8 @@
-<%= form_tag({:controller => 'projects',
-:action => 'project_respond'}) do %>
-<%= text_area_tag 'project_respond', "", :class => 'noline', :required => true, :style => "resize: none;", :rows => 6, :placeholder => l(:label_projects_feedback_respond_content) %>
-
-<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
-<%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "bid_btn"%>
-
-<%end%>
+<%= form_tag({:controller => 'projects',
+:action => 'project_respond'}) do %>
+<%= text_area_tag 'project_respond', "", :class => 'noline', :required => true, :style => "resize: none;", :rows => 6, :placeholder => l(:label_projects_feedback_respond_content) %>
+
+<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
+<%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "bid_btn"%>
+
+<%end%>
diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb
index 8dbeb11ae..8042cfe4d 100644
--- a/app/views/projects/_project.html.erb
+++ b/app/views/projects/_project.html.erb
@@ -19,7 +19,7 @@
<%= content_tag('span', "#{(@project.repository.nil? || @project.repository.changesets[0].nil?) ? '0' : distance_of_time_in_words(Time.now, @project.repository.changesets[0].committed_on)}", :class => "info") %><%= content_tag('span', l(:label_since_last_commits)) %>
- <%= content_tag('span', "#{@project.repository.nil? ? '0' : @project.repository.changesets.count }", :class => "info") %><%= content_tag('span', l(:label_commit_on)) %>
+ <%= content_tag('span', "#{@project.repository.nil? ? '0' : @project.project_status.changesets_count }", :class => "info") %><%= content_tag('span', l(:label_commit_on)) %>
@@ -35,7 +35,7 @@
<% @admin = @project.project_infos%>
<% if @admin.size > 0 %>
- <%= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %>
+ <%= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %>
<% end %>
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
index d354aa12a..11c44ee01 100644
--- a/app/views/projects/index.html.erb
+++ b/app/views/projects/index.html.erb
@@ -50,6 +50,22 @@
-->
+<%= sort_project(@s_type)%>
+
+
+
<%= render_project_hierarchy(@projects)%>
diff --git a/db/migrate/20130828004955_stored_status_procedure.rb b/db/migrate/20130828004955_stored_status_procedure.rb
index 91b37ecd2..29a752765 100644
--- a/db/migrate/20130828004955_stored_status_procedure.rb
+++ b/db/migrate/20130828004955_stored_status_procedure.rb
@@ -34,7 +34,7 @@ begin
declare v_uid bigint(22);
declare v int(10);
declare _done TINYINT(1) default 0;
- declare cur_user cursor for select project_id,count(*) from (select project_id,repositories.id from repositories inner join changesets where repositories.id = changesets.repository_id)t group by project_id;
+ declare cur_user cursor for select project_id,count(*) from (select project_id,repositories.id from repositories inner join changesets where repositories.id = changesets.repository_id and project_id in (SELECT `projects`.id FROM `projects` WHERE (((projects.status <> 9) AND (projects.is_public = 1)))))t group by project_id;
declare continue handler for not found set _done = 1;
open cur_user;
loop_xxx:loop
diff --git a/db/schema.rb b/db/schema.rb
index b8ca66994..3189f6c12 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -13,14 +13,6 @@
ActiveRecord::Schema.define(:version => 20130918004629) 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
t.string "act_type", :null => false
@@ -77,7 +69,6 @@ ActiveRecord::Schema.define(:version => 20130918004629) do
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
- t.integer "reward"
end
create_table "bids", :force => true do |t|
@@ -284,9 +275,9 @@ ActiveRecord::Schema.define(:version => 20130918004629) 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", :null => false
+ t.integer "issue_from_id", :null => false
+ t.integer "issue_to_id", :null => false
+ t.string "relation_type", :default => "", :null => false
t.integer "delay"
end
@@ -428,22 +419,6 @@ ActiveRecord::Schema.define(:version => 20130918004629) 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
@@ -504,18 +479,6 @@ ActiveRecord::Schema.define(:version => 20130918004629) 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"
@@ -583,6 +546,26 @@ ActiveRecord::Schema.define(:version => 20130918004629) 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"
@@ -593,20 +576,13 @@ ActiveRecord::Schema.define(:version => 20130918004629) do
create_table "shares", :force => true do |t|
t.date "created_on"
- t.string "title"
- 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.string "title"
+ t.integer "share_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.integer "project_id"
+ t.integer "user_id"
end
create_table "students_for_courses", :force => true do |t|
@@ -667,7 +643,7 @@ ActiveRecord::Schema.define(:version => 20130918004629) 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
+ t.string "value", :limit => 40, :default => "", :null => false
t.datetime "created_on", :null => false
end
@@ -693,7 +669,6 @@ ActiveRecord::Schema.define(:version => 20130918004629) do
t.integer "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
- t.integer "identity"
t.string "technical_title"
end
@@ -717,14 +692,6 @@ ActiveRecord::Schema.define(:version => 20130918004629) 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 cd2bc48f6..0326b6f3e 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -1182,6 +1182,12 @@ ul.properties li span {font-style:italic;}
.total-hours { font-size: 110%; font-weight: bold; }
.total-hours span.hours-int { font-size: 120%; }
.gender { width: 20%; }
+/*added by bai 澧炲姞浜嗘у埆銆佸湴鍖哄拰鍗曚綅鐨勬牱寮 */
+#my_account_form select.gender { width: 20%; }
+#my_account_form select.location {width: 31%;}
+#my_account_form .occupation { width: 56%; }
+/*end*/
+
.autoscroll {overflow-x: auto; padding:1px; margin-bottom: 1.2em;}
#user_login, #user_firstname, #user_lastname, #user_mail, #my_account_form select, #user_form select, #user_identity_url { width: 60%; }
@@ -1203,7 +1209,7 @@ p.pagination {margin-top:8px; font-size: 90%}
margin: 0;
padding: 3px 0 3px 0;
padding-left: 100px; /* width of left column containing the label elements *//*by young*/
- min-height: 1.8em;
+ /*/*min-height: 1.8em;*/ by bai*/
clear:left;
}
@@ -1292,9 +1298,10 @@ p.other-formats { text-align: right; font-size:0.9em; color: #666; }
a.atom { background: url(../images/feed.png) no-repeat 1px 50%; padding: 2px 0px 3px 16px; }
-em.info {font-style:normal;font-size:90%;color:#888;display:block;}
+/*modified by bai 鏀瑰彉浜嗗瓧浣撻鑹插拰鍔犵矖*/
+em.info {font-style:normal; font-size:90%; color:#505050; font-weight:bold; display:block;}
em.info.error {padding-left:20px; background:url(../images/exclamation.png) no-repeat 0 50%;}
-
+/*end*/
textarea.text_cf {width:90%;}
#tab-content-modules fieldset p {margin:3px 0 4px 0;}