From 9f3392eba88d8435dfd2939d94414430e8444807 Mon Sep 17 00:00:00 2001 From: linhk <304431313@.com> Date: Sat, 23 Aug 2014 16:41:07 +0800 Subject: [PATCH 01/24] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=BB=E7=95=99?= =?UTF-8?q?=E8=A8=80=E6=97=B6=E7=A1=AE=E8=AE=A4=E5=88=A0=E9=99=A4=E7=9A=84?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 1 - app/views/projects/feedback.html.erb | 2 +- config/routes.rb | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 2d03b2112..f2502e03e 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -90,7 +90,6 @@ class WordsController < ApplicationController end def destroyJournal - @journalP=JournalsForMessage.find(params[:object_id]) @journalP.destroy diff --git a/app/views/projects/feedback.html.erb b/app/views/projects/feedback.html.erb index 8e36b8c59..f9182c544 100644 --- a/app/views/projects/feedback.html.erb +++ b/app/views/projects/feedback.html.erb @@ -85,7 +85,7 @@ function checkMaxLength() { <% if User.current.logged? %> <% if journal.user_id==User.current.id|| User.current.admin? %> <%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id, :project_id=>@project.id, :page=>@page}, - :remote => true, :title => l(:button_delete)) %> + :remote => true, :title => l(:button_delete), :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete") %> <% end %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index ed9001ee2..33b5cd16a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -652,6 +652,7 @@ RedmineApp::Application.routes.draw do post 'words/append', :to => 'words#append' post 'words/create_reply', :to => 'words#create_reply' delete 'words/destroy', :to => 'words#destroy' + delete 'words/destroyJournal', :to => 'words#destroyJournal' get 'words/more', :to => 'words#more' get 'words/back', :to=> 'words#back' get 'words/destroyJournal', :to => 'words#destroyJournal' From d16b54a1ea01d1dcbf6c876adcd9ad13ec9e482e Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 25 Aug 2014 09:15:38 +0800 Subject: [PATCH 02/24] =?UTF-8?q?=E5=9F=9F=E5=90=8D=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=81=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=90=8E=E7=89=88=E6=9C=AC=E5=BA=93=E4=B8=8D=E8=83=BD=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 6 +++--- app/models/changeset.rb | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 4e7cf0ce9..0d9206738 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -151,7 +151,7 @@ class WelcomeController < ApplicationController def entry_select #@first_page = FirstPage.where("page_type = 'project'").first url = request.original_url.gsub('/','') - if url.include?(Setting.host_course) + if url.include?(Setting.host_course.gsub('/','')) if @first_page.show_course == 1 course render :course @@ -160,7 +160,7 @@ class WelcomeController < ApplicationController end return 0 - elsif url.include?(Setting.host_contest) + elsif url.include?(Setting.host_contest.gsub('/','')) if @first_page.show_contest == 1 contest render :contest @@ -169,7 +169,7 @@ class WelcomeController < ApplicationController end return 0 - elsif url.include?(Setting.host_user) + elsif url.include?(Setting.host_user.gsub('/','')) redirect_to(:controller => "users", :action => "index") end diff --git a/app/models/changeset.rb b/app/models/changeset.rb index f2228e699..123de1bf3 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -307,8 +307,11 @@ class Changeset < ActiveRecord::Base UserScore.project(:push_code, self.user,self, { changeset_id: self.id }) #更新用户等级 UserLevels.update_user_level(self.user) - update_changeset(self.user,1) - update_changeset(self.user,2,self.repository.project) + unless self.user.nil? + update_changeset(self.user,1) + update_changeset(self.user,2,self.repository.project) + end + end #积分刷新 From 74ba4384b1d40ac5faf4125fd99404e481b2dd8f Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 25 Aug 2014 14:47:27 +0800 Subject: [PATCH 03/24] =?UTF-8?q?1=E3=80=81=E5=8E=BB=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E7=94=A8=E4=BA=86=E7=9A=84=E6=97=A7=E7=9A=84=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E3=80=822=E3=80=81=E5=B0=86=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E6=8F=90=E4=BA=A4=E6=AC=A1=E6=95=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=88=E5=8E=9F=E6=9D=A5=E6=98=AF=E5=9C=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=A1=B9=E7=9B=AE=E6=88=96=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E9=A1=B5=E9=9D=A2=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E8=B0=83=E7=94=A8repository.fetch=5Fchangesets=E5=88=B7?= =?UTF-8?q?=E6=96=B0changeset=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=BA=E5=88=9B?= =?UTF-8?q?=E5=BB=BAchangeset=E5=AF=B9=E8=B1=A1=E5=90=8E=E9=A9=AC=E4=B8=8A?= =?UTF-8?q?=E8=B0=83=E7=94=A8repository.fetch=5Fchangesets=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=88=B7=E6=96=B0changeset=E5=AF=B9=E8=B1=A1=EF=BC=8C?= =?UTF-8?q?=E6=B3=A8=E6=84=8F=EF=BC=9A=E5=B0=9A=E9=9C=80=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 +- app/controllers/users_controller.rb | 12 ++++++++++++ app/models/changeset.rb | 13 ++++++++++--- app/views/users/_user_show.html.erb | 26 -------------------------- 4 files changed, 23 insertions(+), 30 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ee42c2c6a..5093285c6 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -42,7 +42,7 @@ class ProjectsController < ApplicationController before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :file, :statistics, :watcherlist - before_filter :find_project_repository, :only => [:show] + #before_filter :find_project_repository, :only => [:show] # 除非项目内人员,不可查看成员, TODO: 完了写报表里去 before_filter :memberAccess, only: :member diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 98b24bc12..d15036fa0 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -46,6 +46,7 @@ class UsersController < ApplicationController #william before_filter :require_login, :only => [:tag_save,:tag_saveEx] + #before_filter :refresh_changests, :only =>[:user_activities,:user_courses,:user_projects,:user_newfeedback] helper :sort @@ -68,6 +69,17 @@ class UsersController < ApplicationController # fq helper :words + + def refresh_changests + if !(@user.nil?) && !(@user.memberships.nil?) + @user.memberships.each do |member| + unless member.project.nil? + member.project.repository.fetch_changesets if Setting.autofetch_changesets? + end + end + end + end + #added by young def user_projects diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 123de1bf3..b9ce4acf5 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -63,7 +63,7 @@ class Changeset < ActiveRecord::Base includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args)) } - after_create :scan_for_issues,:be_user_score # user_score + after_create :scan_for_issues,:refresh_changests#:be_user_score # user_score after_update :be_user_score after_destroy :down_user_score before_create :before_create_cs @@ -305,9 +305,9 @@ class Changeset < ActiveRecord::Base # update user score def be_user_score UserScore.project(:push_code, self.user,self, { changeset_id: self.id }) - #更新用户等级 - UserLevels.update_user_level(self.user) unless self.user.nil? + #更新用户等级 + UserLevels.update_user_level(self.user) update_changeset(self.user,1) update_changeset(self.user,2,self.repository.project) end @@ -321,4 +321,11 @@ class Changeset < ActiveRecord::Base update_changeset(self.user,2,self.repository.project) end + #刷新本次提交(补全相关信息如:user_id等) + def refresh_changests + unless self.repository.nil? + self.repository.fetch_changesets if Setting.autofetch_changesets? + end + end + end diff --git a/app/views/users/_user_show.html.erb b/app/views/users/_user_show.html.erb index 3afdb8d96..d0c9e204b 100644 --- a/app/views/users/_user_show.html.erb +++ b/app/views/users/_user_show.html.erb @@ -1,32 +1,6 @@
<% for user in @users -%> - - <% messages_count = user.messages.count %> - <% messages_score = messages_count * 0.05%> - <% finall_messages_score = messages_score %> - - <% journals_count = user.journals.count %> - <% journals_score = journals_count * 0.1 %> - <% user_changesets_count = user.changesets.count %> - <% user_changesets_score = user_changesets_count * 0.3 %> - <% finall_user_project_score = journals_score + user_changesets_score %> - - <% journals_for_messages_count = user.journals_messages.count %> - <% activities_count = user.activities.count %> - <% journals_for_messages_score = journals_for_messages_count * 0.05 %> - <% activities_score = activities_count * 0.2 %> - <% finall_activity_score = journals_for_messages_score + activities_score %> - - <% news_count = user.news.count %> - <% news_score = news_count * 0.1 %> - <% wiki_contents_count = user.wiki_contents.count %> - <% wiki_contents_score = wiki_contents_count * 0.1 %> - <% comments_count = user.comments.count %> - <% comments_score = comments_count * 0.1 %> - <% finall_influence_score = news_score + wiki_contents_score + comments_score %> - <% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %> -
<%= content_tag "p", "#{format_date(user.created_on)} #{l(:label_member_since)}", :class => "float_right member_since" %> From e63be10680c0c8a07019bcc8b2e498fcd5f391ce Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 25 Aug 2014 15:18:52 +0800 Subject: [PATCH 04/24] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E7=9A=84=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E8=B0=83=E7=94=A8(=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=8F=90=E4=BA=A4=E6=AC=A1=E6=95=B0=E5=B7=B2?= =?UTF-8?q?=E7=A7=BB=E8=87=B3changeset=E5=AF=B9=E8=B1=A1=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E4=B9=8B=E5=90=8E)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 5093285c6..f3ab77603 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -106,7 +106,7 @@ class ProjectsController < ApplicationController def index #调用存储过程更新提交次数 - ActiveRecord::Base.connection.execute("CALL sp_project_status_cursor();") + #ActiveRecord::Base.connection.execute("CALL sp_project_status_cursor();") #Modified by nie @project_type = params[:project_type].to_i per_page_option = 10 From eb5d1c9efe445ff514b822cc0dddd65c0f66682a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 26 Aug 2014 10:44:44 +0800 Subject: [PATCH 05/24] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E9=A6=96=E9=A1=B5=E6=96=87=E6=98=8E=E5=90=8D?= =?UTF-8?q?=E8=BF=87=E9=95=BF=E8=B6=85=E5=87=BA=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/show.html.erb | 2 +- db/schema.rb | 99 ++++++-------------------------- 2 files changed, 19 insertions(+), 82 deletions(-) diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 7b8ed310e..47e3e8419 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -7,7 +7,7 @@ <% @events_by_day.keys.sort.reverse.each do |day| %> <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%> -
+
<%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %>
diff --git a/db/schema.rb b/db/schema.rb index 525cfb745..e39644b3b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -177,58 +177,6 @@ ActiveRecord::Schema.define(:version => 20140814062455) do add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true - create_table "code_review_assignments", :force => true do |t| - t.integer "issue_id" - t.integer "change_id" - t.integer "attachment_id" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.string "action_type" - t.integer "changeset_id" - end - - create_table "code_review_project_settings", :force => true do |t| - t.integer "project_id" - t.integer "tracker_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "updated_by" - t.boolean "hide_code_review_tab", :default => false - t.integer "auto_relation", :default => 1 - t.integer "assignment_tracker_id" - t.text "auto_assign" - t.integer "lock_version", :default => 0, :null => false - t.boolean "tracker_in_review_dialog", :default => false - end - - create_table "code_review_user_settings", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "mail_notification", :default => 0, :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "code_reviews", :force => true do |t| - t.integer "project_id" - t.integer "change_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "line" - t.integer "updated_by_id" - t.integer "lock_version", :default => 0, :null => false - t.integer "status_changed_from" - t.integer "status_changed_to" - t.integer "issue_id" - t.string "action_type" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.integer "attachment_id" - t.integer "file_count", :default => 0, :null => false - t.boolean "diff_all" - end - create_table "comments", :force => true do |t| t.string "commented_type", :limit => 30, :default => "", :null => false t.integer "commented_id", :default => 0, :null => false @@ -441,10 +389,10 @@ ActiveRecord::Schema.define(:version => 20140814062455) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.integer "sort_type" - t.integer "show_course", :default => 1 - t.integer "show_contest", :default => 1 t.integer "image_width", :default => 107 t.integer "image_height", :default => 63 + t.integer "show_course", :default => 1 + t.integer "show_contest", :default => 1 end create_table "forums", :force => true do |t| @@ -872,18 +820,18 @@ ActiveRecord::Schema.define(:version => 20140814062455) do create_table "relative_memos", :force => true do |t| t.integer "osp_id" t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :limit => 16777215, :null => false + t.string "subject", :null => false + t.text "content", :null => false t.integer "author_id" - t.integer "replies_count", :default => 0 + t.integer "replies_count", :default => 0 t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 t.string "url" t.string "username" t.string "userhomeurl" @@ -907,19 +855,6 @@ ActiveRecord::Schema.define(:version => 20140814062455) do add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" - create_table "rich_rich_files", :force => true do |t| - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "rich_file_file_name" - t.string "rich_file_content_type" - t.integer "rich_file_file_size" - t.datetime "rich_file_updated_at" - t.string "owner_type" - t.integer "owner_id" - t.text "uri_cache" - t.string "simplified_type", :default => "file" - end - create_table "roles", :force => true do |t| t.string "name", :limit => 30, :default => "", :null => false t.integer "position", :default => 1 @@ -970,11 +905,10 @@ ActiveRecord::Schema.define(:version => 20140814062455) do t.string "url" t.string "title" t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + 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 "softapplications", :force => true do |t| @@ -1080,8 +1014,8 @@ ActiveRecord::Schema.define(:version => 20140814062455) do t.integer "zip_code" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.string "technical_title" t.integer "identity" + t.string "technical_title" t.string "student_id" t.string "teacher_realname" t.string "student_realname" @@ -1139,6 +1073,9 @@ ActiveRecord::Schema.define(:version => 20140814062455) do t.integer "active" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "level" + t.integer "file" + t.integer "issue" end create_table "user_statuses", :force => true do |t| From cb8b0e0f416532515ff38c0587ede3a575179b1c Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 26 Aug 2014 16:07:17 +0800 Subject: [PATCH 06/24] =?UTF-8?q?admin=E9=A1=B5=E9=9D=A2=E4=B8=AD=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E8=BF=BD=E8=B8=AA=E9=A1=B9=E7=9B=B8=E5=85=B3=E9=94=99?= =?UTF-8?q?=E8=AF=AF=EF=BC=88=E8=AF=BE=E7=A8=8B=E3=80=81=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=86=E7=A6=BB=E6=AD=A4=E5=A4=84=E4=BB=A3=E7=A0=81=E6=9C=AA?= =?UTF-8?q?=E6=94=B9=E5=AF=BC=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=89?= =?UTF-8?q?=E3=80=81=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E4=B8=AD=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=8F=90=E4=BA=A4=E6=AC=A1=E6=95=B0=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E4=BB=8E=E6=95=B0=E6=8D=AE=E5=BA=93=E4=B8=AD=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=EF=BC=88=E8=BF=90=E8=A1=8Cbundle=20exec=20rake=20project=5Fsco?= =?UTF-8?q?re:calculate=E7=BB=9F=E8=AE=A1=E9=A1=B9=E7=9B=AE=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=AC=A1=E6=95=B0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 38 ----------------- app/controllers/trackers_controller.rb | 12 ++++-- app/helpers/courses_helper.rb | 41 +++++++++++++++++++ app/helpers/project_score_helper.rb | 24 +++++++++++ app/models/tracker.rb | 1 + app/views/projects/_project.html.erb | 4 +- app/views/tags/_tag_name.html.erb | 2 +- app/views/trackers/_form.html.erb | 17 +++++++- db/schema.rb | 16 +++++--- public/stylesheets/application.css | 4 +- .../stylesheets/application.css | 13 +++++- 11 files changed, 117 insertions(+), 55 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index c42944947..38ae662fc 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -502,45 +502,7 @@ class CoursesController < ApplicationController end - def get_course_activity courses, activities - @course_ids=activities.keys() - days = Setting.activity_days_default.to_i - date_to ||= Date.today + 1 - date_from = date_to - days-1.years - - #file_count - Attachment.where(container_id: @course_ids, container_type: Course).where("created_on>?", date_from).each do |attachment| - activities[attachment.container_id]+=1 - end - - #message_count - Board.where(course_id: @course_ids).each do |board| -# activities[board.course_id]+=1 - activities[board.course_id]+=board.messages.where("updated_on>?", date_from).count - end - - #news - News.where(course_id: @course_ids).where("created_on>?",date_from).each do |news| - activities[news.course_id]+=1 - end - - #feedbackc_count - JournalsForMessage.where(jour_id: @course_ids, jour_type: Course).each do |jourformess| - activities[jourformess.jour_id]+=1 - end - - #activities!=0 - i=0; - courses.each do |course| - id=course.id - if activities[id]==0 - activities[id]=1 - end - end - - return activities - end def toggleCourse @course_prefs = Course.find_by_extra(@course.extra) diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index de686493b..a317f82de 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -21,7 +21,7 @@ class TrackersController < ApplicationController before_filter :require_admin, :except => :index before_filter :require_admin_or_api_request, :only => :index accept_api_auth :index - + include CoursesHelper def index respond_to do |format| format.html { @@ -37,8 +37,13 @@ class TrackersController < ApplicationController def new @tracker ||= Tracker.new(params[:tracker]) @trackers = Tracker.sorted.all - @projects = Project.all + @projects = Project.where("project_type = #{Project::ProjectType_project}").all @courses = Course.all + @course_activity_count=Hash.new + @courses.each do |course| + @course_activity_count[course.id]=0 + end + @course_activity_count=get_course_activity @courses,@course_activity_count end def create @@ -58,7 +63,8 @@ class TrackersController < ApplicationController def edit @tracker ||= Tracker.find(params[:id]) - @projects = Project.all + @projects = Project.where("project_type = #{Project::ProjectType_project}").all + @courses = Course.all end def update diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index d075f67ae..a005b299b 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -480,4 +480,45 @@ module CoursesHelper type end + #获取课程动态 + def get_course_activity courses, activities + @course_ids=activities.keys() + + days = Setting.activity_days_default.to_i + date_to ||= Date.today + 1 + date_from = date_to - days-1.years + + #file_count + Attachment.where(container_id: @course_ids, container_type: Course).where("created_on>?", date_from).each do |attachment| + activities[attachment.container_id]+=1 + end + + #message_count + Board.where(course_id: @course_ids).each do |board| +# activities[board.course_id]+=1 + activities[board.course_id]+=board.messages.where("updated_on>?", date_from).count + end + + #news + News.where(course_id: @course_ids).where("created_on>?",date_from).each do |news| + activities[news.course_id]+=1 + end + + #feedbackc_count + JournalsForMessage.where(jour_id: @course_ids, jour_type: Course).each do |jourformess| + activities[jourformess.jour_id]+=1 + end + + #activities!=0 + i=0; + courses.each do |course| + id=course.id + if activities[id]==0 + activities[id]=1 + end + end + + return activities + end + end diff --git a/app/helpers/project_score_helper.rb b/app/helpers/project_score_helper.rb index bdb070cc2..104cd16cb 100644 --- a/app/helpers/project_score_helper.rb +++ b/app/helpers/project_score_helper.rb @@ -71,11 +71,24 @@ module ProjectScoreHelper pss = ProjectScore.where("project_id = '#{project.id}'") if pss.nil? || pss.count == 0 ps = ProjectScore.new + ps.issue_num = issue_num(project) + ps.board_message_num = board_message_num(project) + ps.changeset_num = changesets_num(project) + ps.documents_num = documents_num(project) + ps.issue_journal_num = issue_journal_num(project) + ps.news_num = news_num(project) + ps.score = result ps.project = project ps.save else ps = pss.first + ps.issue_num = issue_num(project) + ps.board_message_num = board_message_num(project) + ps.changeset_num = changesets_num(project) + ps.documents_num = documents_num(project) + ps.issue_journal_num = issue_journal_num(project) + ps.news_num = news_num(project) ps.score = result ps.save end @@ -95,4 +108,15 @@ module ProjectScoreHelper end end + def get_project_score project + pss = ProjectScore.where("project_id = '#{project.id}'") + ps = nil + if pss.nil? || pss.count == 0 + ps = nil + else + ps = pss.first + end + ps + end + end \ No newline at end of file diff --git a/app/models/tracker.rb b/app/models/tracker.rb index d487de67e..6a0069975 100644 --- a/app/models/tracker.rb +++ b/app/models/tracker.rb @@ -32,6 +32,7 @@ class Tracker < ActiveRecord::Base end has_and_belongs_to_many :projects + has_and_belongs_to_many :courses has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id' acts_as_list diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index 92e20f9e4..004fb38ac 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -46,7 +46,7 @@ - <%= content_tag('span', "#{changesets_num(@project)}", :class => "info") %> + <%= content_tag('span', "#{get_project_score(@project).nil? ? 0:get_project_score(@project).changeset_num}", :class => "info") %> <%= content_tag('span', l(:label_commit_on)) %> @@ -87,7 +87,7 @@ <% end %>
-
+
<% if(@project.project_type==1)%> diff --git a/app/views/tags/_tag_name.html.erb b/app/views/tags/_tag_name.html.erb index 38b8ac85c..01889f1f3 100644 --- a/app/views/tags/_tag_name.html.erb +++ b/app/views/tags/_tag_name.html.erb @@ -22,7 +22,7 @@ <% i += 1 %> <% end %> - <%= link_to l(:label_more_tags), :action => "show", :id => obj.id %> + <%= link_to l(:label_more_tags),:controller => "tags", :action => "show", :id => obj.id %> <% else %> diff --git a/app/views/trackers/_form.html.erb b/app/views/trackers/_form.html.erb index 9039bba68..5acd0da1b 100644 --- a/app/views/trackers/_form.html.erb +++ b/app/views/trackers/_form.html.erb @@ -1,6 +1,6 @@ <%= error_messages_for 'tracker' %> -
+

<%= f.text_field :name, :required => true %>

@@ -39,14 +39,27 @@ <%= submit_tag l(@tracker.new_record? ? :button_create : :button_save) %>
-
+
<% if @projects.any? %>
<%= l(:label_project_plural) %> +
<%= render_project_nested_lists(@projects) do |p| content_tag('label', check_box_tag('tracker[project_ids][]', p.id, @tracker.projects.include?(p), :id => nil) + ' ' + h(p)) end %> +
<%= hidden_field_tag('tracker[project_ids][]', '', :id => nil) %> +

<%= check_all_links 'tracker_project_ids' %>

+
<% end %> +
diff --git a/db/schema.rb b/db/schema.rb index 525cfb745..db51ddd37 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140814062455) do +ActiveRecord::Schema.define(:version => 20140826072838) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -441,10 +441,10 @@ ActiveRecord::Schema.define(:version => 20140814062455) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.integer "sort_type" - t.integer "show_course", :default => 1 - t.integer "show_contest", :default => 1 t.integer "image_width", :default => 107 t.integer "image_height", :default => 63 + t.integer "show_course", :default => 1 + t.integer "show_contest", :default => 1 end create_table "forums", :force => true do |t| @@ -793,8 +793,14 @@ ActiveRecord::Schema.define(:version => 20140814062455) do create_table "project_scores", :force => true do |t| t.string "project_id" t.integer "score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "issue_num", :default => 0 + t.integer "issue_journal_num", :default => 0 + t.integer "news_num", :default => 0 + t.integer "documents_num", :default => 0 + t.integer "changeset_num", :default => 0 + t.integer "board_message_num", :default => 0 end create_table "project_statuses", :force => true do |t| diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 9d1a6bc93..1a95f0c64 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1725,8 +1725,8 @@ ul.projects li {list-style-type:none; #projects-index ul.projects div.root a.project {font-family:'微软雅黑', "Trebuchet MS", Verdana, sans-serif; font-weight: bold; font-size: 14px; margin: 0 0 10px 0; } .my-project { padding-left: 18px; background: url(../images/fav.png) no-repeat 0 50%; } -#notified-projects ul, #tracker_project_ids ul {max-height:250px; overflow-y:auto;} - +#notified-projects ul{max-height:250px; overflow-y:auto;} +#tracker_project_ids ul {max-height:250px; /*overflow-y:auto;*/} #related-issues li img {vertical-align:middle;} ul.properties {padding:0; font-size: 0.9em; color: #777;} diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index 9baa5526c..098e02be2 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -1071,14 +1071,14 @@ overflow: hidden; .information { margin-top: 20px; margin-left: 690px; - float: left; + /*float: left;*/ height: auto; width: 280px; font-family: '微软雅黑',helvetica,arial,sans-serif; /*modify by men*/ color: rgb(0, 0, 0); font-size: 13px; line-height: 18px; - position: absolute; + /*position: absolute;*/ } /* a.project { @@ -1216,6 +1216,15 @@ p.stats { padding-top: 10px; } +.add-info-project { + /*float: left;*/ + margin-top: 0px; + height: 20px; + width: 908px; + margin-bottom: 5px; + padding-top: 10px; +} + .main-language { float: left; height: 18px; From 30cbbb5a2a9a4aef6132857366de4cd8c836079e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 26 Aug 2014 16:39:12 +0800 Subject: [PATCH 07/24] =?UTF-8?q?=E5=BC=95=E7=94=A8=E5=9B=9E=E5=B8=96?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=B6=85=E5=87=BA=E8=BE=B9=E6=A1=86=20#1491?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb index 44d6dfbe4..a8def56f5 100644 --- a/app/views/messages/_form.html.erb +++ b/app/views/messages/_form.html.erb @@ -32,7 +32,7 @@ <%= f.select :board_id, boards_options_for_select(@message.course.boards) %>

<% end %> <% end %> -
+
<%= text_area :quote,:quote,:style => 'display:none' %>

From 79e83b9a857bddcc0a53587faff728b51687df66 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 26 Aug 2014 16:44:56 +0800 Subject: [PATCH 08/24] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=B8=BB=E9=A2=98=E6=98=BE=E7=A4=BA=E8=B6=85?= =?UTF-8?q?=E5=87=BA=E8=BE=B9=E6=A1=86=20#1490?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/edit.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/messages/edit.html.erb b/app/views/messages/edit.html.erb index 2577a4634..62d29ebd8 100644 --- a/app/views/messages/edit.html.erb +++ b/app/views/messages/edit.html.erb @@ -4,7 +4,7 @@ <%= course_board_breadcrumb(@message) %> <% end %> -

<%= avatar(@topic.author, :size => "24") %><%=h @topic.subject %>

+

<%= avatar(@topic.author, :size => "24") %><%=h @topic.subject %>

<%= form_for @message, { :as => :message, From c6b189a846132fc2f2b49755134c7af6ebdd6ed5 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 26 Aug 2014 17:46:21 +0800 Subject: [PATCH 09/24] =?UTF-8?q?wiki=E6=98=BE=E7=A4=BA=E6=9C=AA=E5=AF=B9?= =?UTF-8?q?=E9=9D=9E=E6=B1=89=E5=AD=97=E7=B1=BB=E5=9E=8B=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=8D=A2=E8=A1=8C=E5=A4=84=E7=90=86=20#1486?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/wiki/diff.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/wiki/diff.html.erb b/app/views/wiki/diff.html.erb index c1062924c..ef26c570c 100644 --- a/app/views/wiki/diff.html.erb +++ b/app/views/wiki/diff.html.erb @@ -22,6 +22,6 @@ %>, <%= format_time(@diff.content_to.updated_on) %>)

-
+
<%= simple_format_without_paragraph @diff.to_html %>
From 62aa1d0ed5dae9f0826033877465af4de5687dad Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 26 Aug 2014 17:46:28 +0800 Subject: [PATCH 10/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20140826072838_project_score_add_cloumn.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 db/migrate/20140826072838_project_score_add_cloumn.rb diff --git a/db/migrate/20140826072838_project_score_add_cloumn.rb b/db/migrate/20140826072838_project_score_add_cloumn.rb new file mode 100644 index 000000000..1792273c1 --- /dev/null +++ b/db/migrate/20140826072838_project_score_add_cloumn.rb @@ -0,0 +1,19 @@ +class ProjectScoreAddCloumn < ActiveRecord::Migration + def up + add_column("project_scores","issue_num",:integer,:default => 0) + add_column("project_scores","issue_journal_num",:integer,:default => 0) + add_column("project_scores","news_num",:integer,:default => 0) + add_column("project_scores","documents_num",:integer,:default => 0) + add_column("project_scores","changeset_num",:integer,:default => 0) + add_column("project_scores","board_message_num",:integer,:default => 0) + end + + def down + remove_column("project_scores","issue_num") + remove_column("project_scores","issue_journal_num") + remove_column("project_scores","news_num") + remove_column("project_scores","documents_num") + remove_column("project_scores","changeset_num") + remove_column("project_scores","board_message_num") + end +end From e1672fd0e02f640ead7eed83ef8990ef2cfc986b Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 27 Aug 2014 10:20:08 +0800 Subject: [PATCH 11/24] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E6=95=B0=E7=BB=9F=E8=AE=A1=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_show.html.erb | 2 +- app/views/boards/_project_show.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index ca33b7516..35e066d45 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -37,7 +37,7 @@
- 共有 <%=link_to @topics.count %> 个贴子 + 共有 <%=link_to @topic_count,:controller => 'boards',:action => 'index' %> 个贴子 <%= link_to l(:label_message_new), new_board_message_path(@board), diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index ef1afd27e..8cd46c35b 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -43,7 +43,7 @@
- 共有 <%= link_to @topics.count %> 个贴子 + 共有 <%= link_to @topic_count,:controller => 'boards',:action => 'index' %> 个贴子 <% if @project.enabled_modules.where("name = 'boards'").count > 0 %> <%= link_to l(:label_message_new), From 97f8aedd13ba11928b6f4708388d8a1ab29cb388 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 27 Aug 2014 11:31:18 +0800 Subject: [PATCH 12/24] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E9=A6=96=E9=A1=B5=E6=8F=8F=E8=BF=B0=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/show.html.erb | 18 +++++++++--------- app/views/users/user_activities.html.erb | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index b70d73eb6..068390192 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -72,7 +72,7 @@ <% end %> -

<%= textilizable act.notes %>

+

<%= textAreailizable act.notes %>

<%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
@@ -113,7 +113,7 @@ -

<%= act.description.html_safe %>

+

<%=textAreailizable act, :description %>

@@ -141,7 +141,7 @@ <% if act.notes.nil? %> <% desStr = '' %> <% else %> - <% desStr=act.notes.html_safe %> + <% desStr= textAreailizable(act, :notes) %> <% end %>

<%= desStr %>

@@ -168,7 +168,7 @@ -

<%= act.long_comments.html_safe %>

+

<%= textAreailizable act,:long_comments %>

@@ -194,7 +194,7 @@ -

<%= h act.content.truncate(240, omission: '...') %>

+

<%= textAreailizable(act,:content) %>

@@ -242,7 +242,7 @@ -

<%= act.description.html_safe %>

+

<%= textAreailizable act,:description %>

@@ -287,7 +287,7 @@
--> - <%= textilizable act, :description %> + <%= textAreailizable act, :description %> @@ -314,7 +314,7 @@ <% end %> -

<%= h act.description %>

+

<%= textAreailizable act, :description %>

@@ -384,7 +384,7 @@ -

<%= textilizable e.notes %>

+

<%= textAreailizable e.notes %>

diff --git a/app/views/users/user_activities.html.erb b/app/views/users/user_activities.html.erb index 2b4cf8819..080e772a1 100644 --- a/app/views/users/user_activities.html.erb +++ b/app/views/users/user_activities.html.erb @@ -13,7 +13,7 @@ <%# end -%> <%# end -%> - +
<%# end %> --> From 42285ce44dc28c68c8296c8c3e406c0144866ae6 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 27 Aug 2014 12:00:00 +0800 Subject: [PATCH 13/24] =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=B0=91=E4=BA=8E2?= =?UTF-8?q?=E5=88=86=E6=97=B6=E4=B8=8D=E8=83=BD=E8=B8=A9=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/option_number.rb | 10 +++ app/views/praise_tread/_praise_tread.html.erb | 74 +++++++++++++------ config/locales/zh.yml | 1 + 3 files changed, 63 insertions(+), 22 deletions(-) diff --git a/app/models/option_number.rb b/app/models/option_number.rb index 8ba32a575..0ddea1bff 100644 --- a/app/models/option_number.rb +++ b/app/models/option_number.rb @@ -1,4 +1,14 @@ class OptionNumber < ActiveRecord::Base attr_accessible :attachment, :changeset, :document, :follow, :issue_done_ratio, :issues_status, :memo, :messages_for_issues, :post_issue, :praise_by_one, :praise_by_three, :praise_by_two, :replay_for_memo, :replay_for_message, :score_type, :total_score, :tread, :tread_by_one, :tread_by_three, :tread_by_two, :user_id + def self.get_user_option_number user_id + result = nil + unless user_id.nil? + ons = OptionNumber.find_all_by_user_id(user_id); + unless (ons .nil? && ons.count > 0) + result = ons.first + end + end + result + end end diff --git a/app/views/praise_tread/_praise_tread.html.erb b/app/views/praise_tread/_praise_tread.html.erb index e0ad6fd9b..696b204f9 100644 --- a/app/views/praise_tread/_praise_tread.html.erb +++ b/app/views/praise_tread/_praise_tread.html.erb @@ -38,15 +38,28 @@ <% else %> - - - - - - -
<%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)), - :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %> <%= get_praise_num(obj)%> <%= link_to image_tag("/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_tread)),:controller=>"praise_tread", - :action=>"tread_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %>
+ + <% if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %> + + + + + + +
<%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)), + :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %><%= get_praise_num(obj)%><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issues_score_not_enough) %>
+ <% else %> + + + + + + +
<%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)), + :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %> <%= get_praise_num(obj)%> <%= link_to image_tag("/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_tread)),:controller=>"praise_tread", + :action=>"tread_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %>
+ <% end %> + <% end %> @@ -105,19 +118,36 @@ <% else %> - - - - - - - - - - -
<%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)), - :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %>
<%= get_praise_num(obj)%>
<%= link_to image_tag("/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_tread)),:controller=>"praise_tread", - :action=>"tread_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %>
+ <% if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %> + + + + + + + + + + + +
<%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)), + :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %>
<%= get_praise_num(obj)%>
<%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issues_score_not_enough) %>
+ <% else %> + + + + + + + + + + +
<%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)), + :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %>
<%= get_praise_num(obj)%>
<%= link_to image_tag("/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_tread)),:controller=>"praise_tread", + :action=>"tread_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %>
+ <% end %> + <% end %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 4f0744d86..eeb2b125e 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1589,6 +1589,7 @@ zh: label_issue_tread_over: 我刚才踩过了~ label_issue_not_praise_over: 不能顶自己~ label_issue_not_treed_over: 不能踩自己~ + label_issues_score_not_enough: 积分不够,不能踩别人~ #end label_goto: 前往>> label_issue_appraise_over: 只能评价一次哦! From 060759774b475c4c9385a9d35e0fcb64b56dff70 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 27 Aug 2014 15:00:26 +0800 Subject: [PATCH 14/24] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E3=80=81=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=B8=AD=E8=B5=84=E6=BA=90=E5=88=87=E6=8D=A2=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=B1=BB=E5=9E=8B=E6=97=B6=E5=BC=B9=E5=87=BAerror?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=88=E5=8E=9F=E5=9B=A0=EF=BC=9A1.?= =?UTF-8?q?=E6=9C=AA=E6=96=B0=E5=BB=BA=E5=88=86=E9=A1=B5=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=EF=BC=88=E4=BB=8E=E6=9F=90=E4=B8=AA=E7=B1=BB=E5=9E=8B=E5=88=87?= =?UTF-8?q?=E5=9B=9E=E5=85=A8=E9=83=A8=EF=BC=89=EF=BC=8C2.=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=B1=BB=E5=9E=8B=E4=BF=A1=E6=81=AF=E4=B8=A2=E5=A4=B1?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 1 + app/views/files/_course_sort_by_attachtypel.html.erb | 2 +- app/views/files/_sort_by_attachtypel.html.erb | 2 +- config/locales/en.yml | 1 + config/locales/zh.yml | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 3d541fd61..4d4f78d5b 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -226,6 +226,7 @@ class FilesController < ApplicationController elsif @course @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)] end + show_attachments @containers @attachtype = params[:type].to_i @contenttype = params[:contentType].to_s diff --git a/app/views/files/_course_sort_by_attachtypel.html.erb b/app/views/files/_course_sort_by_attachtypel.html.erb index f0f6c8270..c13d76620 100644 --- a/app/views/files/_course_sort_by_attachtypel.html.erb +++ b/app/views/files/_course_sort_by_attachtypel.html.erb @@ -37,7 +37,7 @@ <%= number_to_human_size(file.filesize) %> - <%= file.attachmentstype.typeName %> + <%= file.attachmentstype.nil? ? l(:lable_unknow_type):file.attachmentstype.typeName %>   <%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes, diff --git a/app/views/files/_sort_by_attachtypel.html.erb b/app/views/files/_sort_by_attachtypel.html.erb index d3723c340..eb7ffffec 100644 --- a/app/views/files/_sort_by_attachtypel.html.erb +++ b/app/views/files/_sort_by_attachtypel.html.erb @@ -37,7 +37,7 @@ <%= number_to_human_size(file.filesize) %> - <%= file.attachmentstype.typeName %> + <%= file.attachmentstype.nil? ? l(:lable_unknow_type):file.attachmentstype.typeName %>   <%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes, diff --git a/config/locales/en.yml b/config/locales/en.yml index 602e7a659..46c5360f1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1807,3 +1807,4 @@ en: label_company_name: Company Name notice_account_invalid_creditentials_new: You have not to the mailbox activation + lable_unknow_type: Unknow type \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index eeb2b125e..8f1bd21b0 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2114,4 +2114,5 @@ zh: lable_memos_max_length: 帖子内容最大长度为65535个字符 lable_forums_max_length: 贴吧描述最大长度为65535个字符 + lable_unknow_type: 未知类型 \ No newline at end of file From 8e6ed3549745651f5f1f7252f8254818bdc40c55 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 27 Aug 2014 15:19:18 +0800 Subject: [PATCH 15/24] =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E8=BE=93=E5=85=A5=E7=84=A6=E7=82=B9=E5=8D=B4?= =?UTF-8?q?=E5=9C=A8=E6=90=9C=E7=B4=A2=E6=A1=86=E9=97=AE=E9=A2=98=EF=BC=88?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E8=BE=93=E5=85=A5=E6=A1=86=E7=94=A8=E4=BA=86?= =?UTF-8?q?=E5=90=8C=E4=B8=80=E4=B8=AAid=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=87=E7=AD=BE=E7=9A=84=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=A1=86=E7=9A=84id=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/tags/_tag.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb index 2e9b3d217..b20b383ef 100644 --- a/app/views/tags/_tag.html.erb +++ b/app/views/tags/_tag.html.erb @@ -52,7 +52,7 @@ <%= l(:label_tag) %>: <% if User.current.logged? %> - <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'name'} %> + <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'tags_name'} %> <% end %>
@@ -62,7 +62,7 @@ <%= form_for "tag_for_save",:remote=>true,:url=>tag_path, :update => "tags_show", :complete => '$("#put-tag-form").hide();' do |f| %> - <%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %> + <%= f.text_field :name ,:id => "tags_name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %> <%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%> <%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%> <%= f.submit l(:button_project_tags_add),:class => "small" %> From d256b2d336454cc85e846bc8dd5aba0e38185d95 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 27 Aug 2014 15:59:02 +0800 Subject: [PATCH 16/24] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/application.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 1a95f0c64..5f4a3166e 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1634,7 +1634,7 @@ fieldset#filters td.field { width:230px; } fieldset#filters td.operator { width:180px; } fieldset#filters td.operator select {max-width:170px;} fieldset#filters td.values { white-space:nowrap; } -fieldset#filters td.values select {min-width:130px;} +fieldset#filters td.values select {min-width:130px;max-width: 220px;} fieldset#filters td.values input {height:1em;} fieldset#filters td.add-filter { text-align: right; vertical-align: top; } From a77b07a99b05d899d19e8697bd12088071c4530e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 27 Aug 2014 17:53:57 +0800 Subject: [PATCH 17/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 53 +++++++++++++++++------------ 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 3d541fd61..f8b4578eb 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -57,36 +57,45 @@ class FilesController < ApplicationController elsif params[:course_id] @isproject = false + sort = "" if params[:sort] - if params[:sort].include?":" - @orderBy = params[:sort].split(":")[0] - @orderType = params[:sort].split(":")[1].split(",")[0] - else - @orderBy = params[:sort].split(",")[0] - @orderType = "asc" + params[:sort].split(",").each do |sort_type| + order_by = sort_type.split(":") + + case order_by[0] + when "filename" + attribute = "filename" + when "size" + attribute = "filesize" + when "attach_type" + attribute = "attachtype" + when "content_type" + attribute = "created_on" + when "field_file_dense" + attribute = "is_public" + when "downloads" + attribute = "downloads" + when "created_on" + attribute = "created_on" + end + + if order_by.count == 1 + sort += "#{Attachment.table_name}.#{attribute} desc " + elsif order_by.count == 2 + sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " + end + if sort_type != params[:sort].split(",").last + sort += "," + end end end - - if @orderBy=="size" - @orderBy="filesize" - elsif @orderBy=="field_file_dense" - @orderBy="is_public" - elsif @orderBy=="attach_type" - @orderBy="attachtype" - elsif @orderBy=="content_type" - @orderBy="attachtype" - end - - if @orderBy - @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@orderBy} #{@orderType}").find(@course.id)] - else - @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)] - end + @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] show_attachments @containers render :layout => 'base_courses' end + end def new From f0db3e1b4a606b25f0b1dacbb3666525194c74ef Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 28 Aug 2014 10:20:08 +0800 Subject: [PATCH 18/24] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B4=9F=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E4=BF=AE=E6=AD=A3=E4=B8=BA0=E7=9A=84=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_users.html.erb | 27 ----------------------- app/views/users/_score_new_index.html.erb | 6 ++++- config/locales/en.yml | 3 ++- config/locales/zh.yml | 1 + 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index e116a800f..de10036de 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -92,33 +92,6 @@ <% end %> - - <%# messages_count = @user.messages.count %> - <%# messages_score = messages_count * 0.05%> - <%# finall_messages_score = messages_score %> - - <%# journals_count = @user.journals.count %> - <%# journals_score = journals_count * 0.1 %> - <%# user_changesets_count = @user.changesets.count %> - <%# user_changesets_score = user_changesets_count * 0.3 %> - <%# finall_user_project_score = journals_score + user_changesets_score %> - - <%# journals_for_messages_count = @user.journals_messages.count %> - <%# activities_count = @user.activities.count %> - <%# journals_for_messages_score = journals_for_messages_count * 0.05 %> - <%# activities_score = activities_count * 0.2 %> - <%# finall_activity_score = journals_for_messages_score + activities_score %> - - <%# news_count = @user.news.count %> - <%# news_score = news_count * 0.1 %> - <%# wiki_contents_count = @user.wiki_contents.count %> - <%# wiki_contents_score = wiki_contents_count * 0.1 %> - <%# comments_count = @user.comments.count %> - <%# comments_score = comments_count * 0.1 %> - <%# finall_influence_score = news_score + wiki_contents_score + comments_score %> - <%# finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %> - -
<%= render :partial => 'users/user_score', :locals => {:user => @user}%> diff --git a/app/views/users/_score_new_index.html.erb b/app/views/users/_score_new_index.html.erb index 539c55f80..b79a57e71 100644 --- a/app/views/users/_score_new_index.html.erb +++ b/app/views/users/_score_new_index.html.erb @@ -6,5 +6,9 @@
= <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %> + <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" , active(option_num)).to_i %>
-
= <%= format("%.2f" ,option_num.total_score).to_i %>
+ <% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , active(option_num)).to_i) < 0 %> +
<%= l(:lable_score_less_than_zero) %>
+ <% else %> +
= <%= format("%.2f" ,option_num.total_score).to_i %>
+ <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 46c5360f1..ddae72799 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1807,4 +1807,5 @@ en: label_company_name: Company Name notice_account_invalid_creditentials_new: You have not to the mailbox activation - lable_unknow_type: Unknow type \ No newline at end of file + lable_unknow_type: Unknow type + lable_score_less_than_zero: Score less than 0, revised to 0 \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 8f1bd21b0..14f57e34f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2115,4 +2115,5 @@ zh: lable_memos_max_length: 帖子内容最大长度为65535个字符 lable_forums_max_length: 贴吧描述最大长度为65535个字符 lable_unknow_type: 未知类型 + lable_score_less_than_zero: 得分小于0,修正为0 \ No newline at end of file From 5afcb73624bddc0763ec190bd16f3d401fb1cc34 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 28 Aug 2014 11:06:01 +0800 Subject: [PATCH 19/24] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E4=B8=AD=E8=8B=B1?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=202.=E4=BF=AE=E6=94=B9=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=B7=AE=E5=88=AB=E9=A1=B5=E9=9D=A2=E4=BC=9A=E8=B6=85=E5=87=BA?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/issues_helper.rb | 2 +- app/views/journals/diff.html.erb | 2 +- config/locales/zh.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 315a86340..637c92db3 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -326,7 +326,7 @@ module IssuesHelper if detail.property == 'attr' && detail.prop_key == 'description' s = l(:text_journal_changed_no_detail, :label => label) unless no_html - diff_link = link_to 'diff', + diff_link = link_to l(:label_diff), {:controller => 'journals', :action => 'diff', :id => detail.journal_id, :detail_id => detail.id, :only_path => options[:only_path]}, :title => l(:label_view_diff) diff --git a/app/views/journals/diff.html.erb b/app/views/journals/diff.html.erb index d846b9d19..6e67f0544 100644 --- a/app/views/journals/diff.html.erb +++ b/app/views/journals/diff.html.erb @@ -1,7 +1,7 @@

<%=h @issue.tracker %> #<%= @issue.id %>

<%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %>

-
+
<%= simple_format_without_paragraph @diff.to_html %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 4f0744d86..674b88dbe 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1214,7 +1214,7 @@ zh: notice_issue_successful_create: 问题 %{id} 已创建。 label_between: 介于 setting_issue_group_assignment: 允许问题被分配给组 - label_diff: diff + label_diff: 查看差别 description_query_sort_criteria_direction: 排序方式 description_project_scope: 搜索范围 description_filter: 过滤器 From 19be668221194fd48c8174bc4d79a2240db93e30 Mon Sep 17 00:00:00 2001 From: nwb Date: Thu, 28 Aug 2014 11:52:02 +0800 Subject: [PATCH 20/24] =?UTF-8?q?1.=E4=BF=AE=E6=AD=A3RImagic=E4=BF=9D?= =?UTF-8?q?=E5=AD=98gif=E6=A0=BC=E5=BC=8F=E5=9B=BE=E7=89=87=E9=97=AE?= =?UTF-8?q?=E9=A2=98=202.=E4=BF=AE=E6=AD=A3=E8=AF=BE=E7=A8=8B=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/avatar_controller.rb | 17 ++++++++++------- app/controllers/courses_controller.rb | 9 +++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index fa7eb6052..b7dec5453 100644 --- a/app/controllers/avatar_controller.rb +++ b/app/controllers/avatar_controller.rb @@ -55,17 +55,20 @@ class AvatarController < ApplicationController # saved = @avatar.save begin f = Magick::ImageList.new(diskfile) - width = 300.0 - proportion = (width/f[0].columns) - height = (f[0].rows*proportion) - f.resize_to_fill!(width,height) - # f.scale!(width,height) - f.write(diskfile) + # gif格式不再做大小处理 + if f.format != 'GIF' + width = 300.0 + proportion = (width/f[0].columns) + height = (f[0].rows*proportion) + f.resize_to_fill!(width,height) + f.write(diskfile) + end + rescue Exception => e logger.error "[Error] avatar : avatar_controller#upload ===> #{e}" end - + respond_to do |format| format.js format.api { diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 38ae662fc..aa5e2c2a6 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -605,6 +605,15 @@ class CoursesController < ApplicationController events = @activity.events(@date_from, @date_to, :is_public => 1) end + # 无新动态时,显示老动态 + if events.count == 0 + if User.current.member_of_course?(@course)|| User.current.admin? + events = @activity.events + else + events = @activity.events(:is_public => 1) + end + end + @offset, @limit = api_offset_and_limit({:limit => 10}) @events_count = events.count @events_pages = Paginator.new @events_count, @limit, params['page'] From bdeb2e59471e6940a7b4981194ae617504ba2785 Mon Sep 17 00:00:00 2001 From: nwb Date: Thu, 28 Aug 2014 14:02:14 +0800 Subject: [PATCH 21/24] =?UTF-8?q?=E5=90=AF=E7=94=A8=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84wiki=E7=BC=96=E8=BE=91=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 1 + db/schema.rb | 84 +++++++++++++++++++++++--- 2 files changed, 78 insertions(+), 7 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f3ab77603..c0561bd1c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -594,6 +594,7 @@ class ProjectsController < ApplicationController "show_news" => true, "show_bids" => true, "show_contests" => true, + "show_wiki_edits"=>true, "show_journals_for_messages" => true } @date_to ||= Date.today + 1 diff --git a/db/schema.rb b/db/schema.rb index 82a6ad97b..b4dab9094 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -177,6 +177,58 @@ ActiveRecord::Schema.define(:version => 20140826072838) do add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + create_table "comments", :force => true do |t| t.string "commented_type", :limit => 30, :default => "", :null => false t.integer "commented_id", :default => 0, :null => false @@ -385,9 +437,9 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.string "web_title" t.string "title" t.text "description" - t.string "page_type" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.string "page_type" t.integer "sort_type" t.integer "image_width", :default => 107 t.integer "image_height", :default => 63 @@ -406,6 +458,26 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.datetime "updated_at", :null => false end + create_table "gitlab_projects", :force => true do |t| + t.integer "gitlab_project_id" + t.integer "project_id" + t.string "repository_url" + t.string "web_url" + t.string "localfile_url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "gitlab_users", :force => true do |t| + t.integer "gitlab_user_id" + t.integer "user_id" + t.string "email" + t.string "password" + t.string "login", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "groups_users", :id => false, :force => true do |t| t.integer "group_id", :null => false t.integer "user_id", :null => false @@ -911,10 +983,11 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.string "url" t.string "title" t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + 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 "softapplications", :force => true do |t| @@ -1020,8 +1093,8 @@ ActiveRecord::Schema.define(:version => 20140826072838) 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 "identity" t.string "student_id" t.string "teacher_realname" t.string "student_realname" @@ -1079,9 +1152,6 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.integer "active" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.integer "level" - t.integer "file" - t.integer "issue" end create_table "user_statuses", :force => true do |t| From 82b23da54bf34ed13cf92e1bd6b674693a66eaec Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 28 Aug 2014 14:05:48 +0800 Subject: [PATCH 22/24] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0js=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_homework_form.html.erb | 13 ++- app/views/courses/new_homework.html.erb | 53 +++++++++++- db/schema.rb | 99 ++++++++++++++++++----- 3 files changed, 143 insertions(+), 22 deletions(-) diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb index bfecb5304..f93d57f90 100644 --- a/app/views/courses/_homework_form.html.erb +++ b/app/views/courses/_homework_form.html.erb @@ -22,15 +22,22 @@ <%= error_messages_for 'bid' %>

<%= l(:label_homeworks_form_new_description) %>

-

<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT %>

+

+ <%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :onblur => "regexName();" %> -

<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>

+

+

+ +

<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>

<% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %> -

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}",:readonly => "readonly") %><%= calendar_for('bid_deadline')%> +

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();") %><%= calendar_for('bid_deadline')%> + + +

<%= f.select :is_evaluation, is_evaluation_option %>

diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb index b3fff9e5f..e339db2d7 100644 --- a/app/views/courses/new_homework.html.erb +++ b/app/views/courses/new_homework.html.erb @@ -1,9 +1,60 @@ + +

<%=l(:label_course_new_homework)%>

<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<%= render :partial => 'homework_form', :locals => { :f => f } %> - <%= submit_tag l(:button_create), :class => "enterprise" %> + <%= javascript_tag "$('#bid_name').focus();" %> <% end %>
\ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 82a6ad97b..e23fd19d2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -177,6 +177,58 @@ ActiveRecord::Schema.define(:version => 20140826072838) do add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + create_table "comments", :force => true do |t| t.string "commented_type", :limit => 30, :default => "", :null => false t.integer "commented_id", :default => 0, :null => false @@ -389,10 +441,10 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.integer "sort_type" - t.integer "image_width", :default => 107 - t.integer "image_height", :default => 63 t.integer "show_course", :default => 1 t.integer "show_contest", :default => 1 + t.integer "image_width", :default => 107 + t.integer "image_height", :default => 63 end create_table "forums", :force => true do |t| @@ -826,18 +878,18 @@ ActiveRecord::Schema.define(:version => 20140826072838) do create_table "relative_memos", :force => true do |t| t.integer "osp_id" t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :null => false + t.string "subject", :null => false + t.text "content", :limit => 16777215, :null => false t.integer "author_id" - t.integer "replies_count", :default => 0 + t.integer "replies_count", :default => 0 t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 t.string "url" t.string "username" t.string "userhomeurl" @@ -861,6 +913,19 @@ ActiveRecord::Schema.define(:version => 20140826072838) do add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" + create_table "rich_rich_files", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "rich_file_file_name" + t.string "rich_file_content_type" + t.integer "rich_file_file_size" + t.datetime "rich_file_updated_at" + t.string "owner_type" + t.integer "owner_id" + t.text "uri_cache" + t.string "simplified_type", :default => "file" + end + create_table "roles", :force => true do |t| t.string "name", :limit => 30, :default => "", :null => false t.integer "position", :default => 1 @@ -911,10 +976,11 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.string "url" t.string "title" t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + 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 "softapplications", :force => true do |t| @@ -1020,8 +1086,8 @@ ActiveRecord::Schema.define(:version => 20140826072838) 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 "identity" t.string "student_id" t.string "teacher_realname" t.string "student_realname" @@ -1079,9 +1145,6 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.integer "active" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.integer "level" - t.integer "file" - t.integer "issue" end create_table "user_statuses", :force => true do |t| From 51b21000a79f71c63c44e36789c7c5456e0fb602 Mon Sep 17 00:00:00 2001 From: nwb Date: Thu, 28 Aug 2014 14:35:42 +0800 Subject: [PATCH 23/24] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=A0=87?= =?UTF-8?q?=E8=AF=86=E9=99=90=E5=AE=9A=E4=B8=BA=E5=85=A8=E5=B1=80=E5=94=AF?= =?UTF-8?q?=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/repository.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index 260069f94..5680f05a7 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -39,7 +39,8 @@ class Repository < ActiveRecord::Base validates_length_of :password, :maximum => 255, :allow_nil => true validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true validates_presence_of :identifier#, :unless => Proc.new { |r| r.is_default? || r.set_as_default? } - validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true + #validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true + validates_uniqueness_of :identifier, :allow_blank => true validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) # donwcase letters, digits, dashes, underscores but not digits only validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true From bcb9e8688c273ebc6ddb510cf55630aa00afb4cc Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 28 Aug 2014 14:39:09 +0800 Subject: [PATCH 24/24] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/index.html.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index f5018fc94..2446c4e3d 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -37,21 +37,21 @@