| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
7344c105b6 | .冲突解决 | 10 years ago |
|
|
dbbb914768 |
Merge branch 'develop' into yuanke_cache
Conflicts: app/views/layouts/base_courses.html.erb app/views/users/show.html.erb db/schema.rb |
10 years ago |
|
|
9959e72846 | 冲突漏掉的 | 10 years ago |
|
|
06c7919f00 | Merge branch 'develop' into yuanke_cache | 10 years ago |
|
|
59e96e20ff | 博客数量、关注、粉丝变化修改user中的updated_at字段 | 10 years ago |
|
|
d8ce5100b3 | user 加个updated_at字段 | 10 years ago |
|
|
29fa2389d9 | 个人主页缓存 | 10 years ago |
|
|
954950b14b |
Merge branch 'develop' into yuanke_cache
Conflicts: app/api/mobile/apis/new_comment.rb app/controllers/words_controller.rb app/views/layouts/base_courses.html.erb app/views/users/_course_boardlist.html.erb app/views/users/_course_newslist.html.erb app/views/users/show.html.erb db/schema.rb |
10 years ago |
|
|
00ad2389c2 | 动态回复缓存修改保证KE能加载出来 | 10 years ago |
|
|
3aa35c2f80 | 回复缓存修改 | 10 years ago |
|
|
4917247c73 | 缓存修改 | 10 years ago |
|
|
7677e726eb | 缓存相关修改 | 10 years ago |
|
|
730335cfcc | 缓存修改 | 10 years ago |
|
|
d44b6d68f7 |
Merge branch 'cxt_replies' into yuanke_cache
Conflicts: app/views/users/_course_boardlist.html.erb |
10 years ago |
|
|
e4049c9654 | 缓存修改 | 10 years ago |
|
|
030186f486 |
Merge branch 'develop' into yuanke_cache
Conflicts: app/controllers/homework_common_controller.rb app/views/blogs/_homepage.html.erb app/views/files/_course_file.html.erb app/views/layouts/base_courses.html.erb app/views/users/_course_journalsformessage.html.erb app/views/users/_course_message.html.erb app/views/users/_project_message.html.erb app/views/users/_user_blog.html.erb app/views/users/_user_journalsformessage.html.erb |
10 years ago |
|
|
04e29c51f2 | 缓存修改 | 10 years ago |
|
|
4544e79a5b | . | 10 years ago |
|
|
456ef9acd5 | . | 10 years ago |
|
|
350ba30b71 | 作业缓存还原 | 10 years ago |
|
|
5a89c821a0 | 作业缓存BUG修改 | 10 years ago |
|
|
87d3e6190c | 班级作业缓存BUG修改 | 10 years ago |
|
|
faa1a46c47 | 修改作业缓存的BUG | 10 years ago |
|
|
6263dec2d9 | 个人主页项目和班级左侧列表缓存BUG修改 | 10 years ago |
|
|
96650b951a | 资源缓存相关BUG修改 | 10 years ago |
|
|
5f186f9cab | 缓存BUG修改 | 10 years ago |
|
|
99b33babeb | 班级作业动态加缓存 | 10 years ago |
|
|
e59547adc4 |
Merge branch 'develop' into yuanke_cache
Conflicts: app/views/courses/_course_activity.html.erb app/views/layouts/_user_courses.html.erb app/views/users/_course_homework.html.erb |
10 years ago |
|
|
a5602fd9c3 | 优化回复的代码 | 10 years ago |
|
|
07e0c3c9a8 | 修改获取帖子回复的函数 | 10 years ago |
|
|
5766b0828f | 个人主页代码优化 | 10 years ago |
|
|
efc2874b6c | 个人主页缓存增加 | 10 years ago |
|
|
0eeb4ed439 | 班级主页缓存修改 | 10 years ago |
|
|
6f63e3ea1f | task任务 mysql数据移到redis | 10 years ago |
|
|
36ffc884cc | 班级资源库缓存修改 | 10 years ago |
|
|
0d2b8f8500 | Merge branch 'develop' into yuanke_cache | 10 years ago |
|
|
24a4874abb | 项目动态缓存先还原 | 10 years ago |
|
|
eab12309ef | 动态相关缓存 | 10 years ago |
|
|
a4a20614d7 | 班级推荐key修改 | 10 years ago |
|
|
25d86c517e | Merge branch 'develop' into yuanke_cache | 10 years ago |
|
|
2d5c71570e | 删除production.rb | 10 years ago |
|
|
eb4538ddfa | 增加忽略production.rb | 10 years ago |
|
|
98e004b503 |
Merge branch 'develop' into yuanke_cache
Conflicts: app/views/users/_course_newslist.html.erb |
10 years ago |
|
|
17e437619f | . | 10 years ago |
|
|
f6285b66e8 | 修改缓存设置 | 10 years ago |
|
|
a7c9031be0 | Merge branch 'weixin_guange' into yuanke_cache | 10 years ago |
|
|
f022b72439 |
Merge branch 'develop' into yuanke_cache
Conflicts: app/views/layouts/_course_base_info.html.erb |
10 years ago |
|
|
bdfc13d2b9 | 班级主页缓存修改 | 10 years ago |
|
|
7ed5a04a54 | 班级讨论区和通知缓存修改 | 10 years ago |
|
|
627bc9c8c7 | 班级讨论区通知缓存增加 | 10 years ago |
|
|
e1e1e9ecdf | 缓存方式改为redis_store | 10 years ago |
|
|
cdb7004820 | 班级主页相关缓存增加 | 10 years ago |
|
|
fb85353dbe | 微信动态 | 10 years ago |
|
|
2f0cc6d5e0 | 微信修改个显示动态的BUG | 10 years ago |
|
|
caa5d6ead2 | 班级缓存增加 | 10 years ago |
|
|
4c79db61ef | 缓存 | 10 years ago |
|
|
dc29f728b4 | 缓存配置 | 10 years ago |
| @@ -39,3 +39,4 @@ public/javascripts/wechat/node_modules/ | |||
| .access_token | |||
| tmux*.log | |||
| config/wechat.yml | |||
| config/environments/production.rb | |||
| @@ -50,10 +50,10 @@ gem 'elasticsearch-model' | |||
| gem 'elasticsearch-rails' | |||
| #rails 3.2.22.2 bug | |||
| gem "test-unit", "~>3.0" | |||
| gem "test-unit", "~>3.0" | |||
| ### profile | |||
| gem 'oneapm_rpm' | |||
| gem 'oneapm_rpm' | |||
| group :development do | |||
| gem 'grape-swagger' | |||
| @@ -112,9 +112,10 @@ module Mobile | |||
| # end | |||
| if reply_type == nil || reply_type == 0 | |||
| homework_common = HomeworkCommon.find(params[:id]) | |||
| feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id], params[:id]) | |||
| feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id],params[:id]) | |||
| if (feedback.errors.empty?) | |||
| homework_common.update_column(:updated_at, Time.now) | |||
| homework_common.update_column(:reply_updated_at, Time.now) | |||
| result = 2 | |||
| update_id = homework_common.id | |||
| end | |||
| @@ -124,9 +125,10 @@ module Mobile | |||
| homework_common = HomeworkCommon.find reply.jour_id | |||
| options = {:notes => params[:content], :reply_id => reply.user_id,:user_id => current_user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i} | |||
| feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], reply.jour_id, reply.jour_id, options) | |||
| feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], reply.jour_id,reply.jour_id, options) | |||
| if (feedback.errors.empty?) | |||
| homework_common.update_column(:updated_at, Time.now) | |||
| homework_common.update_column(:reply_updated_at, Time.now) | |||
| result = 2 | |||
| update_id = homework_common.id | |||
| end | |||
| @@ -153,6 +155,7 @@ module Mobile | |||
| if news.comments << comment | |||
| result = 2 | |||
| update_id = news.id | |||
| news.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| else | |||
| #二级回复 | |||
| @@ -162,6 +165,7 @@ module Mobile | |||
| if new_comment.save | |||
| result = 2 | |||
| update_id = news.id | |||
| news.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| end | |||
| end | |||
| @@ -193,6 +197,7 @@ module Mobile | |||
| if message.children << reply | |||
| result = 2 | |||
| update_id = topic.id | |||
| topic.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| # else | |||
| #二级回复 | |||
| @@ -233,6 +238,7 @@ module Mobile | |||
| (JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now) | |||
| result = 2 | |||
| update_id = jour.id | |||
| jour.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| # else | |||
| #二级回复 | |||
| @@ -255,6 +261,7 @@ module Mobile | |||
| if is_jour.save | |||
| result = 2 | |||
| update_id = issue.id | |||
| issue.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| else | |||
| #二级回复 | |||
| @@ -269,6 +276,7 @@ module Mobile | |||
| if is_jour.save | |||
| result = 2 | |||
| update_id = issue.id | |||
| issue.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| end | |||
| end | |||
| @@ -284,6 +292,7 @@ module Mobile | |||
| if blog.children << blogComment | |||
| result = 2 | |||
| update_id = blog.id | |||
| blog.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| else | |||
| #二级回复 | |||
| @@ -301,6 +310,7 @@ module Mobile | |||
| if parent.children << blogComment | |||
| result = 2 | |||
| update_id = blog.id | |||
| blog.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| end | |||
| @@ -160,6 +160,7 @@ class BlogCommentsController < ApplicationController | |||
| @blogComment.root_id = @article.id | |||
| @article.children << @blogComment | |||
| end | |||
| @article.update_column(:reply_updated_at, Time.now) | |||
| @article.save | |||
| # @article.update_attribute(:updated_on, @blogComment.updated_on) | |||
| @user_activity_id = params[:user_activity_id] | |||
| @@ -59,6 +59,7 @@ class CommentsController < ApplicationController | |||
| update_course_activity(@news.class,@news.id) | |||
| update_user_activity(@news.class,@news.id) | |||
| update_org_activity(@news.class,@news.id) | |||
| @news.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| if params[:user_activity_id] | |||
| @@ -100,6 +101,7 @@ class CommentsController < ApplicationController | |||
| update_course_activity(@news.class,@news.id) | |||
| update_user_activity(@news.class,@news.id) | |||
| update_org_activity(@news.class,@news.id) | |||
| @news.update_column(:reply_updated_at, Time.now) | |||
| if @user_activity_id | |||
| respond_to do |format| | |||
| format.js | |||
| @@ -1067,6 +1067,7 @@ class CoursesController < ApplicationController | |||
| end | |||
| @course_activities_count = @course_activities.count | |||
| @course_activities = @course_activities.limit(10).offset(@page * 10) | |||
| @type = params[:type] | |||
| @left_nav_type = 1 | |||
| @@ -598,6 +598,8 @@ class FilesController < ApplicationController | |||
| attachment.description = params[:description] | |||
| attachment.save | |||
| end | |||
| #更新course的时间 | |||
| @course.update_course | |||
| end | |||
| if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) | |||
| params[:course_attachment_type].each do |type| | |||
| @@ -490,6 +490,7 @@ class IssuesController < ApplicationController | |||
| jour.save | |||
| update_user_activity(@issue.class,@issue.id) | |||
| update_forge_activity(@issue.class,@issue.id) | |||
| @issue.update_column(:reply_updated_at, Time.now) | |||
| @allowed_statuses = @issue.new_statuses_allowed_to(User.current) | |||
| @user_activity_id = params[:user_activity_id] | |||
| if params[:issue_id] | |||
| @@ -548,6 +549,7 @@ class IssuesController < ApplicationController | |||
| if new_jour.save | |||
| update_user_activity(@issue.class,@issue.id) | |||
| update_forge_activity(@issue.class,@issue.id) | |||
| @issue.update_column(:reply_updated_at, Time.now) | |||
| respond_to do |format| | |||
| format.js | |||
| end | |||
| @@ -567,6 +569,7 @@ class IssuesController < ApplicationController | |||
| at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id]) | |||
| at_message.destroy_all unless at_message.empty? | |||
| Journal.delete(params[:journal_id]) | |||
| @issue.update_column(:reply_updated_at, Time.now) | |||
| rescue Exception => e | |||
| puts e | |||
| end | |||
| @@ -188,6 +188,7 @@ class MessagesController < ApplicationController | |||
| update_user_activity(@topic.class,@topic.id) | |||
| update_forge_activity(@topic.class,@topic.id) | |||
| update_org_activity(@topic.class,@topic.id) | |||
| @topic.update_column(:reply_updated_at, Time.now) | |||
| #@topic.update_attribute(:updated_on, Time.now) | |||
| if !@reply.new_record? | |||
| @@ -195,6 +195,7 @@ class MyController < ApplicationController | |||
| @se.description = params[:description] | |||
| if @user.save && @se.save | |||
| @user.update_column(:updated_at,Time.now) | |||
| # 头像保存 | |||
| FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1 | |||
| @user.pref.save | |||
| @@ -61,7 +61,7 @@ class PraiseTreadController < ApplicationController | |||
| end | |||
| return | |||
| end | |||
| @pt.delete if !@pt.nil? | |||
| @pt.destroy if !@pt.nil? | |||
| #再更新praise_tread_cache表 使相应的记录减1 当为0时删除 | |||
| @ptc = PraiseTreadCache.where("object_id=? and object_type=?",@obj_id,@obj_type.to_s).first | |||
| @ptc.minus(1) if !@ptc.nil? | |||
| @@ -1021,14 +1021,14 @@ class StudentWorkController < ApplicationController | |||
| end | |||
| def forbidden_anonymous_comment | |||
| @homework.update_column('anonymous_comment', 1) | |||
| @homework.update_attribute('anonymous_comment', 1) | |||
| homework_detail_manual = @homework.homework_detail_manual | |||
| homework_detail_programing = @homework.homework_detail_programing | |||
| if homework_detail_programing | |||
| homework_detail_manual.update_column('ta_proportion', 0.4) | |||
| homework_detail_programing.update_column('ta_proportion', 0.6) | |||
| homework_detail_manual.update_attribute('ta_proportion', 0.4) | |||
| homework_detail_programing.update_attribute('ta_proportion', 0.6) | |||
| else | |||
| homework_detail_manual.update_column('ta_proportion', 1.0) | |||
| homework_detail_manual.update_attribute('ta_proportion', 1.0) | |||
| end | |||
| @homework.student_works.each do |student_work| | |||
| set_final_score @homework,student_work | |||
| @@ -1067,7 +1067,7 @@ class StudentWorkController < ApplicationController | |||
| def student_work_project | |||
| @work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first | |||
| if @work | |||
| @work.update_column('project_id', params[:projectName].to_i) | |||
| @work.update_attribute('project_id', params[:projectName].to_i) | |||
| end | |||
| @project = StudentWorkProject.new | |||
| @project.homework_common_id = @homework.id | |||
| @@ -1075,6 +1075,7 @@ class StudentWorkController < ApplicationController | |||
| @project.user_id = User.current.id | |||
| @project.is_leader = 1 | |||
| if @project.save | |||
| find_homework | |||
| @user_activity_id = params[:user_activity_id].to_i | |||
| @hw_status = params[:hw_status].to_i | |||
| @is_teacher = User.current.allowed_to?(:as_teacher,@homework.course) || User.current.admin? | |||
| @@ -1122,10 +1123,11 @@ class StudentWorkController < ApplicationController | |||
| def cancel_relate_project | |||
| @work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first | |||
| if @work | |||
| @work.update_column('project_id', 0) | |||
| @work.update_attribute('project_id', 0) | |||
| end | |||
| relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first | |||
| if relate_pro.destroy | |||
| find_homework | |||
| @user_activity_id = params[:user_activity_id].to_i | |||
| @hw_status = params[:hw_status].to_i | |||
| @is_teacher = User.current.allowed_to?(:as_teacher,@homework.course) || User.current.admin? | |||
| @@ -1720,7 +1720,7 @@ class UsersController < ApplicationController | |||
| end | |||
| end | |||
| @user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10) | |||
| @user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(5).offset(@page * 5) | |||
| @type = params[:type] | |||
| respond_to do |format| | |||
| format.js | |||
| @@ -2912,6 +2912,7 @@ class UsersController < ApplicationController | |||
| def edit_brief_introduction | |||
| if @user && @user.extensions | |||
| @user.extensions.update_column("brief_introduction",params[:brief_introduction]) | |||
| @user.update_column(:updated_at,Time.now) | |||
| end | |||
| respond_to do |format| | |||
| format.js | |||
| @@ -66,6 +66,7 @@ class WordsController < ApplicationController | |||
| update_org_activity('JournalsForMessage',@activity.id) | |||
| update_principal_activity('JournalsForMessage',@activity.id) | |||
| @activity.update_attribute(:updated_on,Time.now) | |||
| JournalsForMessage.find(options[:root_id]).update_column(:reply_updated_at, Time.now) | |||
| end | |||
| respond_to do |format| | |||
| # format.html { | |||
| @@ -305,6 +306,7 @@ class WordsController < ApplicationController | |||
| update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE | |||
| end | |||
| @homework_common.update_column('updated_at', Time.now) | |||
| @homework_common.update_column(:reply_updated_at, Time.now) | |||
| update_course_activity(@homework_common.class,@homework_common.id) | |||
| update_user_activity(@homework_common.class,@homework_common.id) | |||
| update_org_activity(@homework_common.class,@homework_common.id) | |||
| @@ -338,6 +340,7 @@ class WordsController < ApplicationController | |||
| ids = params[:asset_id].split(',') | |||
| update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE | |||
| end | |||
| @homework_common.update_column(:reply_updated_at, Time.now) | |||
| @homework_common.update_column('updated_at', Time.now) | |||
| update_course_activity(@homework_common.class,@homework_common.id) | |||
| update_user_activity(@homework_common.class,@homework_common.id) | |||
| @@ -261,7 +261,7 @@ module ApplicationHelper | |||
| CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :homework_journal_num => 1) | |||
| else | |||
| score = course_contributor_score.homework_journal_num.to_i + 1 | |||
| course_contributor_score.update_column(:homework_journal_num, score) | |||
| course_contributor_score.update_attribute(:homework_journal_num, score) | |||
| end | |||
| # 课程留言 | |||
| when "Course" | |||
| @@ -269,42 +269,42 @@ module ApplicationHelper | |||
| CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :journal_num => 1) | |||
| else | |||
| score = course_contributor_score.journal_num.to_i + 1 | |||
| course_contributor_score.update_column(:journal_num, score) | |||
| course_contributor_score.update_attribute(:journal_num, score) | |||
| end | |||
| when "Message" | |||
| if course_contributor_score.nil? | |||
| CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 1) | |||
| else | |||
| score = course_contributor_score.message_num.to_i + 1 | |||
| course_contributor_score.update_column(:message_num, score) | |||
| course_contributor_score.update_attribute(:message_num, score) | |||
| end | |||
| when "MessageReply" | |||
| if course_contributor_score.nil? | |||
| CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_reply_num => 1) | |||
| else | |||
| score = course_contributor_score.message_reply_num.to_i + 1 | |||
| course_contributor_score.update_column(:message_reply_num, score) | |||
| course_contributor_score.update_attribute(:message_reply_num, score) | |||
| end | |||
| when "NewReply" | |||
| if course_contributor_score.nil? | |||
| CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :news_reply_num => 1) | |||
| else | |||
| score = course_contributor_score.news_reply_num.to_i + 1 | |||
| course_contributor_score.update_column(:news_reply_num, score) | |||
| course_contributor_score.update_attribute(:news_reply_num, score) | |||
| end | |||
| when "News" | |||
| if course_contributor_score.nil? | |||
| CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :news_num => 1) | |||
| else | |||
| score = course_contributor_score.news_num.to_i + 1 | |||
| course_contributor_score.update_column(:news_num, score) | |||
| course_contributor_score.update_attribute(:news_num, score) | |||
| end | |||
| when "Attachment" | |||
| if course_contributor_score.nil? | |||
| CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :resource_num => 1) | |||
| else | |||
| score = course_contributor_score.resource_num.to_i + 1 | |||
| course_contributor_score.update_column(:resource_num, score) | |||
| course_contributor_score.update_attribute(:resource_num, score) | |||
| end | |||
| end | |||
| end | |||
| @@ -316,38 +316,38 @@ module ApplicationHelper | |||
| when "HomeworkCommon" | |||
| unless course_contributor_score.nil? | |||
| score = course_contributor_score.homework_journal_num.to_i - 1 | |||
| course_contributor_score.update_column(:homework_journal_num, score < 0 ? 0 : score) | |||
| course_contributor_score.update_attribute(:homework_journal_num, score < 0 ? 0 : score) | |||
| end | |||
| # 课程留言 | |||
| when "Course" | |||
| unless course_contributor_score.nil? | |||
| score = course_contributor_score.journal_num.to_i - 1 | |||
| course_contributor_score.update_column(:journal_num, score < 0 ? 0 : score) | |||
| course_contributor_score.update_attribute(:journal_num, score < 0 ? 0 : score) | |||
| end | |||
| when "Message" | |||
| unless course_contributor_score.nil? | |||
| score = course_contributor_score.message_num.to_i - 1 | |||
| course_contributor_score.update_column(:message_num, score < 0 ? 0 : score) | |||
| course_contributor_score.update_attribute(:message_num, score < 0 ? 0 : score) | |||
| end | |||
| when "MessageReply" | |||
| unless course_contributor_score.nil? | |||
| score = course_contributor_score.message_reply_num.to_i - 1 | |||
| course_contributor_score.update_column(:message_reply_num, score < 0 ? 0 : score) | |||
| course_contributor_score.update_attribute(:message_reply_num, score < 0 ? 0 : score) | |||
| end | |||
| when "NewReply" | |||
| unless course_contributor_score.nil? | |||
| score = course_contributor_score.news_reply_num.to_i - 1 | |||
| course_contributor_score.update_column(:news_reply_num, score < 0 ? 0 : score) | |||
| course_contributor_score.update_attribute(:news_reply_num, score < 0 ? 0 : score) | |||
| end | |||
| when "News" | |||
| unless course_contributor_score.nil? | |||
| score = course_contributor_score.news_num.to_i - 1 | |||
| course_contributor_score.update_column(:news_num, score < 0 ? 0 : score) | |||
| course_contributor_score.update_attribute(:news_num, score < 0 ? 0 : score) | |||
| end | |||
| when "Attachment" | |||
| unless course_contributor_score.nil? | |||
| score = course_contributor_score.resource_num.to_i - 1 | |||
| course_contributor_score.update_column(:resource_num, score < 0 ? 0 : score) | |||
| course_contributor_score.update_attribute(:resource_num, score < 0 ? 0 : score) | |||
| end | |||
| end | |||
| end | |||
| @@ -96,7 +96,7 @@ class Attachment < ActiveRecord::Base | |||
| after_save :act_as_course_activity | |||
| after_create :office_conver, :be_user_score,:create_attachment_ealasticsearch_index | |||
| after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index | |||
| after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count, :down_course_score | |||
| after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count, :down_course_score, :update_others | |||
| # add by nwb | |||
| # 获取所有可公开的资源文件列表 | |||
| @@ -683,6 +683,15 @@ class Attachment < ActiveRecord::Base | |||
| down_course_score_num(self.container_id, self.author_id, "Attachment") | |||
| end | |||
| end | |||
| #更新时间 | |||
| def update_others | |||
| if self.course | |||
| if self.course.is_a?(::Course) | |||
| self.course.update_course | |||
| end | |||
| end | |||
| end | |||
| end | |||
| # Delete the previous articles index in Elasticsearch | |||
| @@ -23,8 +23,8 @@ class BlogComment < ActiveRecord::Base | |||
| after_save :add_user_activity | |||
| after_update :update_activity | |||
| after_create :update_parent_time | |||
| before_destroy :destroy_user_activity | |||
| after_create :update_parent_time,:update_user_time | |||
| before_destroy :destroy_user_activity,:update_reply_time,:update_user_time | |||
| scope :like, lambda {|arg| | |||
| if arg.blank? | |||
| @@ -103,4 +103,18 @@ class BlogComment < ActiveRecord::Base | |||
| # ws.comment_template self.parent.author_id, "blog_comment", self.parent_id, "#{l(:label_blog_comment_template)}", self.author.try(:realname), format_time(self.created_at), content | |||
| # end | |||
| # end | |||
| #删除回复的时候更新主贴的reply_updated_at | |||
| def update_reply_time | |||
| if self.root_id | |||
| root_message = BlogComment.find(self.root_id) | |||
| if root_message | |||
| root_message.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| end | |||
| end | |||
| def update_user_time | |||
| self.author.update_column(:updated_at,Time.now) | |||
| end | |||
| end | |||
| @@ -42,6 +42,7 @@ class Comment < ActiveRecord::Base | |||
| safe_attributes 'comments','parent_id','reply_id','comments_count' | |||
| after_create :send_mail, :act_as_system_message, :act_as_student_score | |||
| after_destroy :down_course_score | |||
| before_destroy :update_reply_time | |||
| def act_as_system_message | |||
| #ws = WechatService.new | |||
| @@ -119,4 +120,14 @@ class Comment < ActiveRecord::Base | |||
| self.comments | |||
| end | |||
| #删除回复的时候更新主贴的reply_updated_at | |||
| def update_reply_time | |||
| if self.commented_id | |||
| root_message = News.find(self.commented_id) | |||
| if root_message | |||
| root_message.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| end | |||
| end | |||
| end | |||
| @@ -508,6 +508,10 @@ class Course < ActiveRecord::Base | |||
| ticket | |||
| end | |||
| def update_course | |||
| self.update_attribute(:updated_at,Time.now) | |||
| end | |||
| def log_infor | |||
| Rails.logger.info "##########################################################course's syllabus_id is #{self.syllabus_id}." | |||
| end | |||
| @@ -31,10 +31,10 @@ class HomeworkCommon < ActiveRecord::Base | |||
| :description => :description, | |||
| :author => :author, | |||
| :url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}} | |||
| after_create :act_as_activity, :send_mail,:act_as_course_message | |||
| after_create :act_as_activity, :send_mail,:act_as_course_message,:update_others | |||
| after_update :update_activity | |||
| after_save :act_as_course_activity | |||
| after_destroy :delete_kindeditor_assets | |||
| after_destroy :delete_kindeditor_assets,:update_others | |||
| #作业类型 | |||
| def homework_type_ch | |||
| @@ -124,6 +124,12 @@ class HomeworkCommon < ActiveRecord::Base | |||
| jfm | |||
| end | |||
| #更新时间 | |||
| def update_others | |||
| self.course.update_course | |||
| end | |||
| #修改作业后发送微信模板消息 | |||
| # def wechat_message | |||
| # self.course.members.each do |member| | |||
| @@ -3,5 +3,5 @@ | |||
| class HomeworkDetailManual < ActiveRecord::Base | |||
| attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id | |||
| belongs_to :homework_common | |||
| belongs_to :homework_common,touch:true | |||
| end | |||
| @@ -1,7 +1,7 @@ | |||
| class HomeworkDetailPrograming < ActiveRecord::Base | |||
| attr_accessible :language, :standard_code, :homework_common_id | |||
| belongs_to :homework_common | |||
| belongs_to :homework_common,touch:true | |||
| def language_name | |||
| %W(C C++ Python Java).at(self.language.to_i - 1) | |||
| @@ -62,6 +62,7 @@ class Journal < ActiveRecord::Base | |||
| #after_destroy :down_user_score | |||
| #before_save :be_user_score | |||
| after_destroy :down_user_score, :decrease_issues_journal_count | |||
| before_destroy :update_reply_time | |||
| scope :visible, lambda {|*args| | |||
| user = args.shift || User.current | |||
| @@ -259,4 +260,11 @@ class Journal < ActiveRecord::Base | |||
| # ws.comment_template self.issue.author_id, "issues", self.journalized_id, "#{l(:label_issue_comment_template)}", self.user.try(:realname), format_time(self.created_on), content | |||
| # end | |||
| # end | |||
| #删除回复的时候更新主贴的reply_updated_at | |||
| def update_reply_time | |||
| if self.journalized | |||
| self.journalized.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| end | |||
| end | |||
| @@ -81,6 +81,7 @@ class JournalsForMessage < ActiveRecord::Base | |||
| after_destroy :reset_counters! | |||
| after_save :be_user_score | |||
| after_destroy :down_user_score, :down_course_score | |||
| before_destroy :update_reply_time | |||
| # default_scope { where('m_parent_id IS NULL') } | |||
| @@ -344,4 +345,20 @@ class JournalsForMessage < ActiveRecord::Base | |||
| def content_detail | |||
| self.notes | |||
| end | |||
| #个人留言 班级留言 作业留言等 | |||
| def update_reply_time | |||
| if self.root_id | |||
| case self.jour_type | |||
| when 'HomeworkCommon' | |||
| root_message = HomeworkCommon.find(self.root_id) | |||
| else | |||
| root_message = JournalsForMessage.find(self.root_id) | |||
| end | |||
| if root_message | |||
| root_message.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| end | |||
| end | |||
| end | |||
| @@ -86,6 +86,7 @@ class Message < ActiveRecord::Base | |||
| after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count, :down_course_score | |||
| after_create :act_as_course_activity, :act_as_forge_activity, :act_as_student_score, act_as_at_message(:content, :author_id), :add_author_as_watcher, :reset_counters!, :add_boards_count, :act_as_system_message, :delay_message_send | |||
| #before_save :be_user_score | |||
| before_destroy :update_reply_time | |||
| scope :visible, lambda {|*args| | |||
| includes(:board => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_messages, *args)) | |||
| @@ -412,4 +413,15 @@ class Message < ActiveRecord::Base | |||
| def delete_org_activities | |||
| OrgActivity.where("org_act_type='Message' and org_act_id =#{self.id} and container_type='OrgSubfield'").destroy_all | |||
| end | |||
| #删除回复的时候更新主贴的reply_updated_at | |||
| def update_reply_time | |||
| if self.root_id | |||
| root_message = Message.find(self.root_id) | |||
| if root_message | |||
| root_message.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| end | |||
| end | |||
| end | |||
| @@ -65,9 +65,9 @@ class News < ActiveRecord::Base | |||
| :author_key => :author_id | |||
| acts_as_watchable | |||
| after_create :act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message, :delay_news_send | |||
| after_create :act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message, :delay_news_send, :update_others | |||
| after_update :update_activity | |||
| after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score | |||
| after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score, :update_others | |||
| scope :visible, lambda {|*args| | |||
| includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args)) | |||
| @@ -229,4 +229,11 @@ class News < ActiveRecord::Base | |||
| end | |||
| end | |||
| #更新时间 | |||
| def update_others | |||
| if self.course | |||
| self.course.update_course | |||
| end | |||
| end | |||
| end | |||
| @@ -4,6 +4,10 @@ class PraiseTread < ActiveRecord::Base | |||
| belongs_to :praise_tread_object, polymorphic: true | |||
| #after_create :be_user_score | |||
| #after_destroy :down_user_score | |||
| after_create :update_reply_time | |||
| before_destroy :update_reply_time | |||
| include UserScoreHelper | |||
| def self.find_object_by_type_and_id(type,id) | |||
| @obj = nil | |||
| @@ -95,4 +99,53 @@ class PraiseTread < ActiveRecord::Base | |||
| user_id: User.current.id).empty? | |||
| end | |||
| def update_reply_time | |||
| #找到主贴更新reply_updated_at | |||
| type = self.praise_tread_object_type | |||
| id = self.praise_tread_object_id | |||
| messageClass = type.classify.constantize | |||
| message = messageClass.find(id) rescue nil | |||
| case type | |||
| when 'Journal' | |||
| #issue | |||
| message.journalized.update_column(:reply_updated_at, Time.now) | |||
| when 'Comment' | |||
| #news | |||
| if message && message.commented_id | |||
| root_message = News.find(message.commented_id) | |||
| if root_message | |||
| root_message.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| end | |||
| when 'JournalsForMessage' | |||
| #留言 和 作业 留言 | |||
| if message && message.root_id | |||
| case message.jour_type | |||
| when 'HomeworkCommon' | |||
| root_message = HomeworkCommon.find(message.root_id) | |||
| else | |||
| root_message = messageClass.find(message.root_id) | |||
| end | |||
| if root_message | |||
| root_message.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| elsif message | |||
| message.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| when 'News','Issue','HomeworkCommon' | |||
| if message | |||
| message.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| else | |||
| if message && message.root_id | |||
| root_message = messageClass.find(message.root_id) rescue nil | |||
| if root_message | |||
| root_message.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| elsif message | |||
| message.update_column(:reply_updated_at, Time.now) | |||
| end | |||
| end | |||
| end | |||
| end | |||
| @@ -2,7 +2,7 @@ | |||
| class StudentWork < ActiveRecord::Base | |||
| attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time, :late_penalty, :absence_penalty | |||
| belongs_to :homework_common | |||
| belongs_to :homework_common,touch:true | |||
| belongs_to :user | |||
| has_many :student_work_projects | |||
| has_many :student_works_evaluation_distributions, :dependent => :destroy | |||
| @@ -1,6 +1,6 @@ | |||
| class StudentWorkProject < ActiveRecord::Base | |||
| # attr_accessible :title, :body | |||
| belongs_to :homework_common | |||
| belongs_to :homework_common,touch:true | |||
| belongs_to :student_work | |||
| belongs_to :project | |||
| belongs_to :user | |||
| @@ -34,6 +34,7 @@ class WatchesService | |||
| end | |||
| def set_watcher(watchables, user, watching) | |||
| user.update_column(:updated_at,Time.now) | |||
| watchables.each do |watchable| | |||
| watchable.set_watcher(user, watching) | |||
| # @user = watchable # added by william | |||
| @@ -42,6 +43,7 @@ class WatchesService | |||
| if watchable.instance_of?(User) | |||
| #写user_statuses表 | |||
| UserStatus.find_by_user_id(watchable.id).update_watchers_count(1) | |||
| watchable.update_column(:updated_at,Time.now) | |||
| elsif watchable.instance_of?(Project) | |||
| #写project_statuese表 | |||
| ProjectStatus.find_by_project_id(watchable.id).update_watchers_count(1) | |||
| @@ -51,6 +53,7 @@ class WatchesService | |||
| if watchable.instance_of?(User) | |||
| #写user_statuses表 | |||
| UserStatus.find_by_user_id(watchable.id).update_watchers_count(-1) | |||
| watchable.update_column(:updated_at,Time.now) | |||
| elsif watchable.instance_of?(Project) | |||
| #写project_statuese表 :project_status | |||
| ProjectStatus.find_by_project_id(watchable.id).update_watchers_count(-1) | |||
| @@ -23,44 +23,46 @@ | |||
| 总得分为以上得分之和</div> | |||
| </div> | |||
| <% contributor_course_scor(course.id).each do |contributor_score| %> | |||
| <% total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 + | |||
| contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 + | |||
| + contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 + | |||
| contributor_score.news_num.to_i * 1 %> | |||
| <% unless total_score ==0 %> | |||
| <li> | |||
| <%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "50", :height => "50", :class=> "rankPortrait"),user_path(contributor_score.user) %> | |||
| <p><%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %></p> | |||
| <p><span class="sy_corange" style="cursor:pointer"> | |||
| <a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="sy_corange"> | |||
| <%=total_score %></a></span></p> | |||
| <div style="display: none" class="numIntro"> | |||
| <div class="contributor-course-calculate">积分计算</div> | |||
| <%# unless contributor_score.resource_num.to_i == 0 %> | |||
| <div style="padding-left: 2px;padding-bottom: 2px;padding-right: 2px"> | |||
| 资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br> | |||
| <%# end %> | |||
| <%# unless contributor_score.message_num.to_i == 0 %> | |||
| 问答发布数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %></br> | |||
| 通知发布数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %></br> | |||
| <%# end %> | |||
| <%# unless contributor_score.message_reply_num.to_i == 0 %> | |||
| 问答回帖数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %></br> | |||
| 作业留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %></br> | |||
| 通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %></br> | |||
| <%# end %> | |||
| <%# unless contributor_score.journal_num.to_i == 0 %> | |||
| 班级留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br> | |||
| <%# end %> | |||
| <%# unless contributor_score.homework_journal_num.to_i == 0 %> | |||
| <%# end %> | |||
| <%# unless contributor_score.news_reply_num.to_i == 0 %> | |||
| <%# end %> | |||
| 总得分:<%=total_score %> | |||
| </div> | |||
| </div> | |||
| </li> | |||
| <% end %> | |||
| <%# cache [:user_contributor_score,contributor_score.id.to_s+"-"+contributor_score.updated_at.to_i.to_s+"-"+contributor_score.user.updated_on.to_i.to_s] do%> | |||
| <% total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 + | |||
| contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 + | |||
| + contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 + | |||
| contributor_score.news_num.to_i * 1 %> | |||
| <% unless total_score ==0 %> | |||
| <li> | |||
| <%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "50", :height => "50", :class=> "rankPortrait"),user_path(contributor_score.user) %> | |||
| <p><%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %></p> | |||
| <p><span class="sy_corange" style="cursor:pointer"> | |||
| <a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="sy_corange"> | |||
| <%=total_score %></a></span></p> | |||
| <div style="display: none" class="numIntro"> | |||
| <div class="contributor-course-calculate">积分计算</div> | |||
| <%# unless contributor_score.resource_num.to_i == 0 %> | |||
| <div style="padding-left: 2px;padding-bottom: 2px;padding-right: 2px"> | |||
| 资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br> | |||
| <%# end %> | |||
| <%# unless contributor_score.message_num.to_i == 0 %> | |||
| 问答发布数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %></br> | |||
| 通知发布数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %></br> | |||
| <%# end %> | |||
| <%# unless contributor_score.message_reply_num.to_i == 0 %> | |||
| 问答回帖数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %></br> | |||
| 作业留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %></br> | |||
| 通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %></br> | |||
| <%# end %> | |||
| <%# unless contributor_score.journal_num.to_i == 0 %> | |||
| 班级留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br> | |||
| <%# end %> | |||
| <%# unless contributor_score.homework_journal_num.to_i == 0 %> | |||
| <%# end %> | |||
| <%# unless contributor_score.news_reply_num.to_i == 0 %> | |||
| <%# end %> | |||
| 总得分:<%=total_score %> | |||
| </div> | |||
| </div> | |||
| </li> | |||
| <% end %> | |||
| <%# end %> | |||
| <% end %> | |||
| <div class="cl"></div> | |||
| </ul> | |||
| @@ -28,6 +28,8 @@ | |||
| </ul> | |||
| </li> | |||
| </ul> | |||
| </div> | |||
| <%= render :partial => 'courses/course_activity', :locals => {:course_activities => @course_activities,:page => 0,:type => @type} %> | |||
| </div> | |||
| <%# cache [:course_activity,@course.id,@course_activities_count,@type,@course_activities[0].updated_at.to_i] do%> | |||
| </div> | |||
| <%= render :partial => 'courses/course_activity', :locals => {:course_activities => @course_activities,:page => 0,:type => @type} %> | |||
| </div> | |||
| <%# end %> | |||
| @@ -27,17 +27,19 @@ | |||
| <span class="grey_homework_btn_cir ml5"><%=file.publish_time %> 0点发布</span> | |||
| <% end %> | |||
| </div> | |||
| <div class="mt5"> | |||
| <span class="fontGrey2 mr15 fl">上传时间:<%= format_time(file.created_on)%></span> | |||
| <% if file.tag_list.length > 0%> | |||
| <span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span> | |||
| <% end %> | |||
| <p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p> | |||
| <p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p> | |||
| </div> | |||
| <%# cache [:resource_detail,file.id.to_s] do%> | |||
| <div class="mt5"> | |||
| <span class="fontGrey2 mr15 fl">上传时间:<%= format_time(file.created_on)%></span> | |||
| <% if file.tag_list.length > 0%> | |||
| <span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span> | |||
| <% end %> | |||
| <p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p> | |||
| <p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p> | |||
| </div> | |||
| <%# end %> | |||
| <%# unless file.description.blank? %> | |||
| <div class="cl"></div> | |||
| <% if User.current.admin? || ( User.current.logged? && ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course")) %> | |||
| <% if (User.current.admin? || ( User.current.logged? && ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course"))) %> | |||
| <div> | |||
| <div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4 break_word"> | |||
| <%= render :partial => 'files/file_description', :locals => {:file => file} %> | |||
| @@ -29,6 +29,8 @@ | |||
| <% end %> | |||
| <div class="cl"></div> | |||
| <!-- logo 根据是否是老师显示不同--> | |||
| <% cache [:course_logo,@course.id.to_s+"-"+is_teacher.to_s] do%> | |||
| <div class="sy_class_logo fl"> | |||
| <div class="pr" style="width: 96px; height:96px;"> | |||
| <% if is_teacher%> | |||
| @@ -41,6 +43,9 @@ | |||
| <% end %> | |||
| </div> | |||
| </div> | |||
| <% end %> | |||
| <!--邀请码根据是否是成员显示不同--> | |||
| <% cache [:course_invite,@course.id.to_s+"-"+(User.current.admin? || User.current.member_of_course?(@course)).to_s] do%> | |||
| <div class="sy_class_id fl"> | |||
| <p>邀 请 码<br /> | |||
| <span class="sy_corange"> | |||
| @@ -52,27 +57,30 @@ | |||
| </span> | |||
| </p> | |||
| </div> | |||
| <% end %> | |||
| <div class="sy_class_info fl ml15"> | |||
| <div class="sy_class_titbox"> | |||
| <h3 class="fl sy_class_title"> | |||
| <%= link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class =>'c_dark', :target => '_blank'%> | |||
| <font class="fb">·</font> | |||
| <%=@course.name %> | |||
| </h3> | |||
| <span class="<%= @course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl mr20 mt3"></span> | |||
| <p class="sy_cgrey fl mt3"> | |||
| <span class=" mr15">教师:<%= course_teacher_link teacher_num %></span> | |||
| <span class=" mr15">学生:<%= course_student_link student_num %></span> | |||
| <span class=" mr15">资源:<%= link_to course_file_num, course_files_path(@course), :class => 'sy_cblue',:id=>'courses_files_count_info' %></span> | |||
| </p> | |||
| <div class="cl"></div> | |||
| </div> | |||
| <p class="sy_cgrey mb5"> | |||
| <span class=" mr15">主讲老师:<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cblue') %></span> | |||
| <span class=" mr15">学时:<span class="sy_cblack"><%= @course.class_period %>学时</span></span> | |||
| <span class=" mr15">学期:<span class="sy_cblack"><%= current_time_and_term @course %></span></span> | |||
| <span class=" mr15">单位:<span class="sy_cblack"><%= get_occupation_from_user(@course.teacher).blank? ? '无' : get_occupation_from_user(@course.teacher) %></span></span> | |||
| </p> | |||
| <% cache [:course_righthead,@course.id.to_s+"-"+@course.updated_at.to_i.to_s] do%> | |||
| <div class="sy_class_titbox"> | |||
| <h3 class="fl sy_class_title"> | |||
| <%= link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class =>'c_dark', :target => '_blank'%> | |||
| <font class="fb">·</font> | |||
| <%=@course.name %> | |||
| </h3> | |||
| <span class="<%= @course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl mr20 mt3"></span> | |||
| <p class="sy_cgrey fl mt3"> | |||
| <span class=" mr15">教师:<%= course_teacher_link teacher_num %></span> | |||
| <span class=" mr15">学生:<%= course_student_link student_num %></span> | |||
| <span class=" mr15">资源:<%= link_to course_file_num, course_files_path(@course), :class => 'sy_cblue',:id=>'courses_files_count_info' %></span> | |||
| </p> | |||
| <div class="cl"></div> | |||
| </div> | |||
| <p class="sy_cgrey mb5"> | |||
| <span class=" mr15">主讲老师:<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cblue') %></span> | |||
| <span class=" mr15">学时:<span class="sy_cblack"><%= @course.class_period %>学时</span></span> | |||
| <span class=" mr15">学期:<span class="sy_cblack"><%= current_time_and_term @course %></span></span> | |||
| <span class=" mr15">单位:<span class="sy_cblack"><%= get_occupation_from_user(@course.teacher).blank? ? '无' : get_occupation_from_user(@course.teacher) %></span></span> | |||
| </p> | |||
| <% end %> | |||
| <% if is_teacher %> | |||
| <%= link_to "班级设置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "sy_btn_grey mr10 fl" %> | |||
| <% end %> | |||
| @@ -1,7 +1,10 @@ | |||
| <% courses.each do |course|%> | |||
| <li class="pr"> | |||
| <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %> | |||
| <% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %> | |||
| <% wechat_count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %> | |||
| <% cache [:homepage_course_info,course.id.to_s+"-"+user.id.to_s+"-"+is_teacher.to_s+"-"+(User.current == user).to_s+"-"+(User.current.member_of_course?(course)).to_s+"-"+count.to_s+"-"+wechat_count.to_s+course.updated_at.to_i.to_s] do%> | |||
| <li> | |||
| <span class="user_icons_class"></span> | |||
| <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %> | |||
| <p href="javascript:void(0);" id="show_course_<%= course.id %>" class="course_list_menu" > | |||
| <%= link_to course.syllabus.title + course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => 'display:block;'%> | |||
| </p> | |||
| @@ -13,9 +16,6 @@ | |||
| </div> | |||
| <%#= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), | |||
| :id => "show_course_#{course.id}", :class => 'course_list_menu hidden', :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%> | |||
| <% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %> | |||
| <% wechat_count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %> | |||
| <div class="user_navmore_box"> | |||
| <ul class="<%#= count > 0 ? 'shild shildP':'subNavArrow'%>"> | |||
| <li class="user_navmore_icons"> | |||
| @@ -80,7 +80,7 @@ | |||
| <% end %> | |||
| </li> | |||
| <% end %> | |||
| <% if User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %> | |||
| <% if is_teacher %> | |||
| <li> | |||
| <%= link_to course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => course,:user_page => true}, | |||
| :id => "set_course_public_#{course.id.to_s}",:remote=>true, :class => 'user_navmore_li',:confirm=>"您确定要设置为"+(course.is_public == 0 ? "公开" : "私有")+"吗"%> | |||
| @@ -92,6 +92,7 @@ | |||
| </ul> | |||
| </div> | |||
| </li> | |||
| <% end %> | |||
| <% end %> | |||
| <% if all_count > (page.to_i+1) * 10%> | |||
| @@ -1,9 +1,15 @@ | |||
| <% projects.each do |project|%> | |||
| <% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %> | |||
| <% wechat_count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %> | |||
| <% is_logged = User.current.logged? %> | |||
| <% is_admin = User.current.admin? %> | |||
| <% current_user_isuser = User.current == @user %> | |||
| <% can_setting = User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, project) %> | |||
| <% is_manager = is_project_manager?(User.current,project) %> | |||
| <% cache [:homepage_project_info,project.id.to_s+"-"+user.id.to_s+"-"+is_logged.to_s+"-"+is_admin.to_s+"-"+current_user_isuser.to_s+"-"+can_setting.to_s+"-"+count.to_s+"-"+wechat_count.to_s+"-"+is_manager.to_s+"-"+project.updated_on.to_i.to_s] do%> | |||
| <li> | |||
| <span class="user_icons_class"></span> | |||
| <% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %> | |||
| <%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "project_list_menu hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%> | |||
| <div class="user_navmore_box"> | |||
| <ul class="<%#= count > 0 ? 'shild shildP':'subNavArrow'%>"> | |||
| <li class="user_navmore_icons"> | |||
| @@ -32,7 +38,7 @@ | |||
| <div class="cl"></div> | |||
| </li> | |||
| <li> | |||
| <% if ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %> | |||
| <% if count == 0 %> | |||
| <%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true,:class => "user_navmore_li" %> | |||
| <% else %> | |||
| <%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :project_id => project.id),:method => 'delete',:remote => true,:class => "user_navmore_li" %> | |||
| @@ -40,7 +46,7 @@ | |||
| <div class="cl"></div> | |||
| </li> | |||
| <li> | |||
| <% if ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %> | |||
| <% if wechat_count == 0 %> | |||
| <%= link_to "屏蔽微信消息", shield_wechat_messages_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true,:class => "user_navmore_li" %> | |||
| <% else %> | |||
| <%= link_to "接收微信消息", show_messages_shield_wechat_messages_path(:user_id => user.id, :project_id => project.id),:method => 'delete',:remote => true,:class => "user_navmore_li" %> | |||
| @@ -60,6 +66,7 @@ | |||
| </ul> | |||
| </div> | |||
| </li> | |||
| <% end %> | |||
| <% end %> | |||
| <% if all_count > (page.to_i+1) * 10%> | |||
| @@ -57,99 +57,106 @@ | |||
| <div class="sy_content"> | |||
| <div class="sy_class_l fl" id="courseLSide"> | |||
| <div class="sy_class_leftnav mb12"> | |||
| <ul class="accordion"> | |||
| <% unless show_nav?(@course.course_activities.count) %> | |||
| <li id="sy_01" class="sy_icons_index"> | |||
| <a href="<%=course_path(@course) %>" >动态<span><%=@course.course_activities.count %></span></a> | |||
| </li> | |||
| <% end %> | |||
| <% course_board = @course.boards.where("parent_id is NULL").first %> | |||
| <% unless show_nav?(course_board ? course_board.topics.count : 0) %> | |||
| <li id="sy_02" class="sy_icons_boards"> | |||
| <% count = course_board ? (course_board.topics.count + Message.where("board_id =? and parent_id is not ?", course_board.id, nil).count) : 0 %> | |||
| <a href="<%=course_boards_path(@course) %>">讨论区<span><%=count %></span></a> | |||
| <%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") if is_teacher %> | |||
| </li> | |||
| <div id="board_children_list"> | |||
| <%= render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board} %> | |||
| </div> | |||
| <% end %> | |||
| <% unless show_nav?(@course.homework_commons.count) %> | |||
| <li id="sy_03" class="sy_icons_hwork"> | |||
| <a href="<%= homework_common_index_path(:course => @course.id) %>">作业<span><%=homework_num %></span></a> | |||
| <%= link_to( "",homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_course_homework_new)}") if is_teacher %> | |||
| </li> | |||
| <% end %> | |||
| <% unless show_nav?(@course.news.count) %> | |||
| <li id="sy_04" class="sy_icons_news"> | |||
| <a href="<%=course_news_index_path(@course) %>">通知<span><%=@course.news.count %></span></a> | |||
| <%= link_to( "",new_course_news_path(@course,:is_new=>1), :class => 'sy_class_add', :title =>"#{l(:label_course_news_new)}") if is_teacher %> | |||
| </li> | |||
| <% end %> | |||
| <% unless show_nav?(course_file_num) %> | |||
| <li id="sy_05" class="sy_icons_files"> | |||
| <a href="<%=course_files_path(@course) %>">资源库<span><%=course_file_num %></span></a> | |||
| <% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %> | |||
| <a class="sy_class_add" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a> | |||
| <% end %> | |||
| </li> | |||
| <% end %> | |||
| <% unless show_nav?(course_feedback_count) %> | |||
| <li id="sy_06" class="sy_icons_feedback"> | |||
| <a href="<%=course_feedback_path(@course) %>">留言<span id="course_jour_count"><%=course_feedback_count %></span></a> | |||
| <%= link_to( "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}") if is_teacher %> | |||
| </li> | |||
| <% end %> | |||
| <% unless show_nav?(course_poll_count) %> | |||
| <li id="sy_07" class="sy_icons_poll"> | |||
| <a href="<%=poll_index_path(:polls_type => "Course", :polls_group_id => @course.id) %>">问卷调查<span><%=course_poll_count %></span></a> | |||
| <%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'sy_class_add', :title =>"#{l(:label_new_poll)}") if is_teacher %> | |||
| </li> | |||
| <% end %> | |||
| <% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %> | |||
| <% unless show_nav?(count) %> | |||
| <li id="sy_08" class="sy_icons_exercise"> | |||
| <a href="<%= User.current.logged? ? exercise_index_path(:course_id => @course.id) : signin_url_without_domain %>">在线测验<span><%=count %></span></a> | |||
| <%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %> | |||
| </li> | |||
| <% end %> | |||
| <% group_count = @course.course_groups.count %> | |||
| <% if !show_nav?(group_count) && ((User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) || User.current.admin?) %> | |||
| <li id="sy_09" class="sy_icons_group"> | |||
| <a href="<%=course_member_path(@course, :role => 2) %>">分班<span><%=group_count %></span></a> | |||
| <!--<a href="javascript:void(0);" class="sy_class_add"></a>--> | |||
| </li> | |||
| <div id="group_children_list"> | |||
| <%= render :partial => 'layouts/group_children_list', :locals => {:course => @course} %> | |||
| </div> | |||
| <% end %> | |||
| <% statistics_count = 0 %> | |||
| <% unless show_nav?(statistics_count) %> | |||
| <li id="sy_10" class="sy_icons_st"> | |||
| <a href="<%=statistics_course_course_path(@course) %>">统计<span></span></a> | |||
| <!--<a href="javascript:void(0);" class="sy_class_add"></a>--> | |||
| </li> | |||
| <% end %> | |||
| <%# 工具栏展开 %> | |||
| <% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 || | |||
| course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 || statistics_count == 0%> | |||
| <li id="expand_tools_expand" class="sy_icons_more"><a href="javascript:void(0)"> 更多</a> | |||
| </li> | |||
| <ul class="sub-menu undis" id="navContentCourse"> | |||
| <%= render :partial => 'courses/tool_expand' %> | |||
| </ul> | |||
| <% end %> | |||
| </ul> | |||
| </div><!--sy_class_leftnav end--> | |||
| <% cache [:course_leftmenu,@course.id.to_s+"-"+is_teacher.to_s+"-"+(User.current.member_of_course?(@course)).to_s+"-"+@course.updated_at.to_i.to_s] do%> | |||
| <div class="sy_class_leftnav mb12"> | |||
| <ul class="accordion"> | |||
| <% actcount = @course.course_activities.count %> | |||
| <% unless show_nav?(actcount) %> | |||
| <li id="sy_01" class="sy_icons_index"> | |||
| <a href="<%=course_path(@course) %>" >动态<span><%=actcount %></span></a> | |||
| </li> | |||
| <% end %> | |||
| <% course_board = @course.boards.where("parent_id is NULL").first %> | |||
| <% unless show_nav?(course_board ? course_board.topics.count : 0) %> | |||
| <li id="sy_02" class="sy_icons_boards"> | |||
| <% count = course_board ? (course_board.topics.count + Message.where("board_id =? and parent_id is not ?", course_board.id, nil).count) : 0 %> | |||
| <a href="<%=course_boards_path(@course) %>">讨论区<span><%=count %></span></a> | |||
| <%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") if is_teacher %> | |||
| </li> | |||
| <div id="board_children_list"> | |||
| <%= render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board} %> | |||
| </div> | |||
| <% end %> | |||
| <% unless show_nav?(@course.homework_commons.count) %> | |||
| <li id="sy_03" class="sy_icons_hwork"> | |||
| <a href="<%= homework_common_index_path(:course => @course.id) %>">作业<span><%=homework_num %></span></a> | |||
| <%= link_to( "",homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_course_homework_new)}") if is_teacher %> | |||
| </li> | |||
| <% end %> | |||
| <% unless show_nav?(@course.news.count) %> | |||
| <li id="sy_04" class="sy_icons_news"> | |||
| <a href="<%=course_news_index_path(@course) %>">通知<span><%=@course.news.count %></span></a> | |||
| <%= link_to( "",new_course_news_path(@course,:is_new=>1), :class => 'sy_class_add', :title =>"#{l(:label_course_news_new)}") if is_teacher %> | |||
| </li> | |||
| <% end %> | |||
| <% unless show_nav?(course_file_num) %> | |||
| <li id="sy_05" class="sy_icons_files"> | |||
| <a href="<%=course_files_path(@course) %>">资源库<span><%=course_file_num %></span></a> | |||
| <% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %> | |||
| <a class="sy_class_add" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a> | |||
| <% end %> | |||
| </li> | |||
| <% end %> | |||
| <% unless show_nav?(course_feedback_count) %> | |||
| <li id="sy_06" class="sy_icons_feedback"> | |||
| <a href="<%=course_feedback_path(@course) %>">留言<span id="course_jour_count"><%=course_feedback_count %></span></a> | |||
| <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%> | |||
| </li> | |||
| <% end %> | |||
| <% unless show_nav?(course_poll_count) %> | |||
| <li id="sy_07" class="sy_icons_poll"> | |||
| <a href="<%=poll_index_path(:polls_type => "Course", :polls_group_id => @course.id) %>">问卷调查<span><%=course_poll_count %></span></a> | |||
| <%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'sy_class_add', :title =>"#{l(:label_new_poll)}") if is_teacher %> | |||
| </li> | |||
| <% end %> | |||
| <% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %> | |||
| <% unless show_nav?(count) %> | |||
| <li id="sy_08" class="sy_icons_exercise"> | |||
| <a href="<%=exercise_index_path(:course_id => @course.id) %>">在线测验<span><%=count %></span></a> | |||
| <%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %> | |||
| </li> | |||
| <% end %> | |||
| <% statistics_count = 0 %> | |||
| <% unless show_nav?(statistics_count) %> | |||
| <li id="sy_09" class="sy_icons_st"> | |||
| <a href="<%=statistics_course_course_path(@course) %>">统计<span></span></a> | |||
| <!--<a href="javascript:void(0);" class="sy_class_add"></a>--> | |||
| </li> | |||
| <% end %> | |||
| <%# 工具栏展开 %> | |||
| <% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 || | |||
| course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 || statistics_count == 0%> | |||
| <li id="expand_tools_expand" class="sy_icons_more"><a href="javascript:void(0)"> 更多</a> | |||
| </li> | |||
| <ul class="sub-menu undis" id="navContentCourse"> | |||
| <%= render :partial => 'courses/tool_expand' %> | |||
| </ul> | |||
| <% end %> | |||
| <% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 || | |||
| course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 || statistics_count == 0%> | |||
| <li id="expand_tools_expand" class="sy_icons_more"><a href="javascript:void(0)"> 更多</a> | |||
| </li> | |||
| <ul class="sub-menu undis" id="navContentCourse"> | |||
| <%= render :partial => 'courses/tool_expand' %> | |||
| </ul> | |||
| <% end %> | |||
| </ul> | |||
| </div><!--sy_class_leftnav end--> | |||
| <% end %> | |||
| <%# 课程活跃度 %> | |||
| <%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %> | |||
| <% cache [:course_activity_users,@course.id.to_s],{ expires_in: 1.minutes } do%> | |||
| <%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %> | |||
| <% end %> | |||
| <%# 课程英雄榜 %> | |||
| <%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %> | |||
| <div class="sy_class_leftbox" > | |||
| <h3 class="fontGrey7">班级推荐</h3> | |||
| <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %> | |||
| </div> | |||
| <% cache [:course_heroes,@course.id.to_s],{ expires_in: 1.minutes } do%> | |||
| <%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %> | |||
| <% end %> | |||
| <% cache [:course_recommendation,@course.id.to_s],{ expires_in: 5.minutes } do%> | |||
| <div class="sy_class_leftbox" > | |||
| <h3 class="fontGrey7">班级推荐</h3> | |||
| <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %> | |||
| </div> | |||
| <% end %> | |||
| <%# 更新访问数,刷新的时候更新访问次数 %> | |||
| <% update_visiti_count @course %> | |||
| <div class="fontGrey5 mt10 ml20">访问计数 <%= @course.visits.to_i %> (自2016年5月)</div> | |||
| @@ -102,7 +102,9 @@ | |||
| <div class="homepageContent"> | |||
| <div class="homepageLeft mt10" id="LSide"> | |||
| <div class="user_leftinfo mb10"> | |||
| <% if User.current.logged? && User.current == @user%> | |||
| <% is_current_user = (User.current.logged? && User.current == @user) %> | |||
| <% cache [:user_leftinfo,@user.id.to_s+"-"+is_current_user.to_s+"-"+@user.updated_at.to_i.to_s] do %> | |||
| <% if is_current_user %> | |||
| <div class="pr" style="width: 80px; margin:0 auto;"> | |||
| <%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%> | |||
| <div class="homepageEditProfile undis"> | |||
| @@ -153,11 +155,11 @@ | |||
| </li> | |||
| </ul> | |||
| </div> | |||
| <% end %> | |||
| <div id="watch_user_btn_div"> | |||
| <%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %> | |||
| </div> | |||
| </div> | |||
| <div class="user_leftnav "> | |||
| <% if hidden_unproject_infos %> | |||
| <ul class="users_accordion mb10"> | |||
| @@ -166,7 +168,9 @@ | |||
| <font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user.id}, :style => "color:#aaa;" %></font> | |||
| <% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %> | |||
| <div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list"> | |||
| <%=render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %> | |||
| <%# cache [:personal_courses,@user.id,courses.count,courses[0].updated_at.to_i] do%> | |||
| <%=render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %> | |||
| <%# end %> | |||
| </div> | |||
| </li> | |||
| <% if is_current_user %> | |||
| @@ -194,7 +198,9 @@ | |||
| <font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :style => "color:#aaa;" %></font> | |||
| <% projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%> | |||
| <div class="<%= projects.empty? ? 'none' : ''%>" id="homepage_left_project_list"> | |||
| <%=render :partial => 'layouts/homepage_left_project_list', :locals => {:projects => projects} %> | |||
| <%# cache [:personal_projects,@user.id,projects.count,projects[0].updated_on.to_i] do%> | |||
| <%=render :partial => 'layouts/homepage_left_project_list', :locals => {:projects => projects} %> | |||
| <%# end %> | |||
| </div> | |||
| </li> | |||
| <% if is_current_user %> | |||
| @@ -35,7 +35,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <a href="javascript:void(0);"><%= image_tag(url_to_avatar(User.find(act.user_id)), :width => "45", :height => "45") %></a> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(act.user_id)} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => User.find(act.user_id)} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo"><%= link_to User.find(act.user_id), user_url_in_org(act.user_id),:class => "newsBlue mr15" %> 创建了 <a href="<%= organization_path(@organization)%>" class="newsBlue ml10"><%= Organization.find(act.org_act_id).name %> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.teacher), :width => "50", :height => "50"), user_url_in_org(activity.tea_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.teacher} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.teacher} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -3,7 +3,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_url_in_org(activity.user_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -6,7 +6,7 @@ | |||
| <div class="homepagePostPortrait"> | |||
| <!-- <a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像"/></a>--> | |||
| <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_url_in_org(activity.user_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -4,7 +4,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user.id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => user} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => user} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes" > | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(document.creator_id) %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(document.creator_id)} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => User.find(document.creator_id)} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo"> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -4,7 +4,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => user} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => user} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -4,7 +4,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => user} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => user} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word" style="width:620px"> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word" style="width:620px"> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(document.creator_id) %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(document.creator_id)} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => User.find(document.creator_id)} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo"> | |||
| @@ -1,8 +1,9 @@ | |||
| <% cache [:user_courseattachment_activity,activity.id.to_s+"-"+activity.updated_at.to_i.to_s] do%> | |||
| <div class="resources mt10"> | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -41,6 +42,7 @@ | |||
| <div class="cl"></div> | |||
| </div> | |||
| </div> | |||
| <% end %> | |||
| <script type="text/javascript"> | |||
| $(function(){ | |||
| user_card_show_hide(); | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.teacher), :width => "50", :height => "50"), user_path(activity.tea_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.teacher} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.teacher} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -1,9 +1,10 @@ | |||
| <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %> | |||
| <div class="resources mt10" id="user_activity_<%= user_activity_id%>"> | |||
| <% cache [:user_homework_activity,activity.id.to_s+"-"+User.current.logged?.to_s+"-"+is_teacher.to_s+"-"+(User.current.member_of_course?(activity.course)).to_s+"-"+hw_status.to_s+"-"+activity.updated_at.to_i.to_s] do%> | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -22,6 +23,7 @@ | |||
| <% index = get_hw_index(activity, is_teacher) %> | |||
| <%= link_to "<span class='fontBlue2'>作业#{index+1}:</span>".html_safe+activity.name,student_work_index_path(:homework => activity.id),:class => "postGrey"%> | |||
| <% else %> | |||
| <%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%> | |||
| <% end %> | |||
| </div> | |||
| @@ -60,7 +62,7 @@ | |||
| </div> | |||
| <div class="cl"></div> | |||
| </div> | |||
| <% end %> | |||
| <%= render :partial => 'users/homework_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status, :is_teacher => is_teacher} %> | |||
| </div> | |||
| <script type="text/javascript"> | |||
| @@ -1,8 +1,10 @@ | |||
| <% update_time = CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at %> | |||
| <div class="resources mt10" id="user_activity_<%= user_activity_id%>"> | |||
| <% cache [:user_coursejourformessage_activity,activity.id.to_s+"-"+User.current.logged?.to_s+"-"+update_time.to_i.to_s] do%> | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -34,12 +36,14 @@ | |||
| 留言时间:<%= format_time(activity.created_on) %> | |||
| </div> | |||
| <div class="homepagePostDate fl ml15"> | |||
| 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %> | |||
| 更新时间:<%= format_time(update_time) %> | |||
| </div> | |||
| <div class="cl"></div> | |||
| </div> | |||
| <div class="cl"></div> | |||
| </div> | |||
| <% end %> | |||
| <% cache [:user_coursejournals_reply,activity.id.to_s+"-"+User.current.id.to_s+"-"+User.current.logged?.to_s+"-"+activity.reply_updated_at.to_i.to_s] do %> | |||
| <% all_comments = []%> | |||
| <% all_replies = JournalsForMessage.where("root_id = #{activity.id}").reorder("created_on desc") %> | |||
| <% count = all_replies.count %> | |||
| @@ -79,6 +83,7 @@ | |||
| <div class="cl"></div> | |||
| </div> | |||
| </div> | |||
| <% end %> | |||
| </div> | |||
| <script type="text/javascript"> | |||
| $(function(){ | |||
| @@ -1,8 +1,10 @@ | |||
| <% update_time = CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at%> | |||
| <div class="resources mt10" id="user_activity_<%= user_activity_id%>" onmouseover="$('#message_setting_<%= user_activity_id%>').show();" onmouseout="$('#message_setting_<%= user_activity_id%>').hide();"> | |||
| <% cache [:user_coursemessage_activity,activity.id.to_s+"-"+User.current.logged?.to_s+"-"+(activity.author.id == User.current.id).to_s+"-"+(activity.course_editable_by?(User.current)).to_s+"-"+(activity.course_destroyable_by?(User.current)).to_s+"-"+update_time.to_i.to_s] do%> | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -30,7 +32,7 @@ | |||
| 发帖时间:<%= format_time(activity.created_on) %> | |||
| </div> | |||
| <div class="homepagePostDate fl ml15"> | |||
| 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %> | |||
| 更新时间:<%= format_time(update_time) %> | |||
| </div> | |||
| <div class="cl"></div> | |||
| <% if activity.parent_id.nil? %> | |||
| @@ -52,7 +54,7 @@ | |||
| <ul> | |||
| <li class="homepagePostSettingIcon"> | |||
| <ul class="homepagePostSettiongText"> | |||
| <% if activity.author.id == User.current.id%> | |||
| <% if activity.author_id == User.current.id%> | |||
| <li> | |||
| <%= link_to( | |||
| l(:button_edit), | |||
| @@ -80,6 +82,9 @@ | |||
| </div> | |||
| <div class="cl"></div> | |||
| </div> | |||
| <% end %> | |||
| <% can_reply = !activity.locked? && authorize_for_course('messages', 'reply') %> | |||
| <% cache [:user_coursemessage_reply,activity.id.to_s+"-"+User.current.id.to_s+"-"+can_reply.to_s+"-"+User.current.logged?.to_s+"-"+is_course.to_s+"-"+is_board.to_s+"-"+activity.reply_updated_at.to_i.to_s] do %> | |||
| <% all_comments = []%> | |||
| <%# all_replies = get_all_children(all_comments, activity) %> | |||
| <% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %> | |||
| @@ -94,7 +99,7 @@ | |||
| </div> | |||
| <% end %> | |||
| <% if !activity.locked? && authorize_for_course('messages', 'reply') %> | |||
| <% if can_reply %> | |||
| <div class="homepagePostReplyContainer borderBottomNone minHeight48"> | |||
| <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div> | |||
| <div class="homepagePostReplyInputContainer mb10"> | |||
| @@ -120,6 +125,7 @@ | |||
| </div> | |||
| <% end %> | |||
| </div> | |||
| <% end %> | |||
| </div> | |||
| <script type="text/javascript"> | |||
| $(function(){ | |||
| @@ -1,8 +1,9 @@ | |||
| <div class="resources mt10" id="user_activity_<%= user_activity_id%>"> | |||
| <% cache [:user_coursenews_activity,activity.id.to_s+"-"+User.current.logged?.to_s+"-"+User.current.allowed_to?(:manage_news, activity.course).to_s+"-"+activity.comments.count.to_s] do%> | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -64,7 +65,8 @@ | |||
| </div> | |||
| <div class="cl"></div> | |||
| </div> | |||
| <% end %> | |||
| <% cache [:user_coursenews_reply,activity.id.to_s+"-"+User.current.id.to_s+"-"+activity.commentable?.to_s+"-"+User.current.logged?.to_s+"-"+user_activity_id.to_s+"-"+activity.reply_updated_at.to_i.to_s] do %> | |||
| <% count=activity.comments.count %> | |||
| <div class="homepagePostReply"> | |||
| <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> | |||
| @@ -99,6 +101,7 @@ | |||
| </div> | |||
| <% end %> | |||
| </div> | |||
| <% end %> | |||
| </div> | |||
| <script type="text/javascript"> | |||
| $(function(){ | |||
| @@ -6,7 +6,7 @@ | |||
| <div class="homepagePostPortrait"> | |||
| <!-- <a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像"/></a>--> | |||
| <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -1,3 +1,4 @@ | |||
| <% cache [:user_homework_reply,activity.id.to_s+"-"+User.current.id.to_s+"-"+User.current.logged?.to_s+"-"+is_teacher.to_s+"-"+hw_status.to_s+"-"+activity.reply_updated_at.to_i.to_s] do %> | |||
| <% count=activity.journals_for_messages.count %> | |||
| <div class="homepagePostReply" id="homework_post_reply_<%= user_activity_id %>"> | |||
| <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status} %> | |||
| @@ -31,4 +32,5 @@ | |||
| </div> | |||
| <div class="cl"></div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <% end %> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word" style="width:620px"> | |||
| @@ -4,7 +4,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => user} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => user} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -41,4 +41,4 @@ | |||
| $(function(){ | |||
| user_card_show_hide(); | |||
| }); | |||
| </script> | |||
| </script> | |||
| @@ -1,9 +1,10 @@ | |||
| <% unless activity.author.nil? %> | |||
| <div class="resources mt10" id="user_activity_<%= user_activity_id%>"> | |||
| <%# cache [:user_projectissue_activity,activity.id.to_s+"-"+User.current.logged?.to_s+"-"+(defined?(project_id)).to_s+"-"+(defined?(user_id)).to_s+"-"+(activity.editable?).to_s+"-"+(User.current.allowed_to?(:edit_issues, activity.project)).to_s+"-"+(User.current.allowed_to?(:delete_issues, activity.project)).to_s+"-"+(User.current.allowed_to?(:add_issues, activity.project)).to_s+"-"+activity.updated_on.to_i.to_s] do%> | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word" style="width:620px"> | |||
| @@ -95,6 +96,7 @@ | |||
| </div> | |||
| <div class="cl"></div> | |||
| </div> | |||
| <%# end %> | |||
| <div id="div_user_issue_reply_<%=user_activity_id%>"> | |||
| <%= render :partial => 'users/project_issue_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %> | |||
| </div> | |||
| @@ -1,3 +1,4 @@ | |||
| <% cache [:user_projectissue_reply,activity.id.to_s+"-"+User.current.id.to_s+"-"+User.current.logged?.to_s+"-"+user_activity_id.to_s+"-"+activity.reply_updated_at.to_i.to_s] do %> | |||
| <% count = activity.journals.count %> | |||
| <div class="homepagePostReply"> | |||
| <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> | |||
| @@ -31,4 +32,5 @@ | |||
| <div class="cl"></div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <% end %> | |||
| @@ -1,8 +1,10 @@ | |||
| <div class="resources mt10" id="user_activity_<%= user_activity_id%>"> | |||
| <% update_time = get_forge_act_message(activity, activity.class.to_s) %> | |||
| <% cache [:user_projectmessage_activity,activity.id.to_s+"-"+User.current.logged?.to_s+"-"+(activity.author.id == User.current.id).to_s+"-"+(activity.editable_by?(User.current)).to_s+"-"+(activity.destroyable_by?(User.current)).to_s+"-"+update_time] do%> | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word" style="width:620px"> | |||
| @@ -29,7 +31,7 @@ | |||
| 发帖时间:<%= format_time(activity.created_on) %> | |||
| </div> | |||
| <div class="homepagePostDate fl ml15"> | |||
| 更新时间:<%= get_forge_act_message(activity, activity.class.to_s) %> | |||
| 更新时间:<%= update_time %> | |||
| </div> | |||
| <div class="cl"></div> | |||
| <% if activity.parent_id.nil? %> | |||
| @@ -81,6 +83,8 @@ | |||
| </div> | |||
| <div class="cl"></div> | |||
| </div> | |||
| <% end %> | |||
| <% cache [:user_projectmessage_reply,activity.id.to_s+"-"+User.current.id.to_s+"-"+User.current.logged?.to_s+"-"+(!activity.locked?).to_s+"-"+is_course.to_s+"-"+is_board.to_s+"-"+activity.reply_updated_at.to_i.to_s] do %> | |||
| <% all_comments = []%> | |||
| <% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %> | |||
| <% count = all_replies.count %> | |||
| @@ -121,6 +125,7 @@ | |||
| </div> | |||
| <% end %> | |||
| </div> | |||
| <% end %> | |||
| </div> | |||
| <script type="text/javascript"> | |||
| $(function(){ | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -26,6 +26,7 @@ | |||
| }) | |||
| </script> | |||
| <%# cache [:personal_activities,@user.id,user_activities[0].updated_at.to_i] do%> | |||
| <% user_activities.each do |user_activity| | |||
| if user_activities %> | |||
| <script> | |||
| @@ -104,8 +105,8 @@ | |||
| <% end %> | |||
| <% end %> | |||
| <% end %> | |||
| <% if user_activities.count == 10%> | |||
| <%# end %> | |||
| <% if user_activities.count == 5%> | |||
| <!-- | |||
| <div id="show_more_activities" class="loadMore mt10 f_grey">点击展开更多<%#=link_to "", user_activities_path(@user.id,:type => type,:page => page),:id => "more_activities_link",:remote => "true",:class => "none" %></div> | |||
| --> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -42,6 +42,7 @@ | |||
| <div class="cl"></div> | |||
| </div> | |||
| <%# all_comments = []%> | |||
| <% cache [:user_blog_reply,activity.id.to_s+"-"+User.current.id.to_s+"-"+User.current.logged?.to_s+"-"+(activity.locked == false && User.current.logged?).to_s+"-"+activity.reply_updated_at.to_i.to_s] do %> | |||
| <% all_replies = BlogComment.where("root_id = #{activity.id}").reorder("created_on desc") %> | |||
| <% count = all_replies.count %> | |||
| <div class="homepagePostReply"> | |||
| @@ -83,6 +84,7 @@ | |||
| </div> | |||
| <% end %> | |||
| </div> | |||
| <% end %> | |||
| </div> | |||
| <script type="text/javascript"> | |||
| $("#moreProject_<%=user_activity_id %>").click(function(){ | |||
| @@ -1,5 +1,6 @@ | |||
| <% is_teacher = User.current.allowed_to?(:as_teacher,homework_common.course) %> | |||
| <div class="HomeWork mb10" id="homework_common_<%= homework_common.id %>"> | |||
| <%# cache [:user_homework_detail,@course.id.to_s+"-"+homework_common.id.to_s+"-"+is_teacher.to_s+"-"+(User.current.member_of_course?(homework_common.course) || User.current.admin? || homework_common.is_open == 1).to_s+"-"+homework_common.updated_at.to_i.to_s] do%> | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%=link_to image_tag(url_to_avatar(homework_common.user),width:"50px", height: "50px"), user_activities_path(homework_common.user.id)%> | |||
| @@ -170,7 +171,7 @@ | |||
| <% end %> | |||
| <div class="cl"></div> | |||
| </div> | |||
| <% end %> | |||
| <%# end %> | |||
| <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %> | |||
| <% projects = homework_common.student_work_projects.where("is_leader = 1 and project_id != -1") %> | |||
| @@ -274,6 +275,7 @@ | |||
| </div> | |||
| <div class="cl"></div> | |||
| </div> | |||
| <% end %> | |||
| <% count=homework_common.journals_for_messages.count %> | |||
| <div class="homepagePostReply"> | |||
| @@ -2,7 +2,7 @@ | |||
| <div class="homepagePostBrief"> | |||
| <div class="homepagePostPortrait"> | |||
| <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> | |||
| <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> | |||
| </div> | |||
| <div class="homepagePostDes"> | |||
| <div class="homepagePostTo break_word"> | |||
| @@ -1,51 +1,51 @@ | |||
| <script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script> | |||
| <input type="hidden" value="<%= @type%>" name="type" id="user_activities_type"> | |||
| <div class="homepageRightBanner"> | |||
| <div class="NewsBannerName">最新动态</div> | |||
| <ul class="resourcesSelect"> | |||
| <li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a> | |||
| <ul class="homepagePostType"> | |||
| <li> | |||
| <ul class="homepagePostTypeHomework fl"> | |||
| <% if hidden_unproject_infos %> | |||
| <li class="f14">班级动态</li> | |||
| <li><%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%> | |||
| <!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li> | |||
| <li><%= link_to "通知动态", {:controller => "users", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%> | |||
| <!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>--> | |||
| <li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%> | |||
| <li><%= link_to "问卷动态", {:controller => "users", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%> | |||
| <li><%= link_to "班级留言", {:controller => "users", :action => "show", :type => "course_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%> | |||
| <!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>--> | |||
| <!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>--> | |||
| <% end %> | |||
| </ul> | |||
| </li> | |||
| <li> | |||
| <ul class="homepagePostTypeProject fl"> | |||
| <li class="f14">项目动态</li> | |||
| <li><%= link_to "问题动态", {:controller => "users", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%> | |||
| <li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%> | |||
| <!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li> | |||
| <li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>--> | |||
| </ul> | |||
| </li> | |||
| <li> | |||
| <ul class="homepagePostTypeProject fl"> | |||
| <li class="f14">更多</li> | |||
| <li class="mt-4"><%= link_to "个人留言", {:controller => "users", :action => "show", :type => "user_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%> | |||
| <li class="mt-4"><%= link_to @user == User.current ? "我的动态" : "他的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeMine postTypeGrey"%> | |||
| <li class="mt-4"><%= link_to "全部动态", {:controller => "users", :action => "show", :type => "all"}, :class =>"homepagePostTypeAll postTypeGrey"%> | |||
| </ul> | |||
| </li> | |||
| </ul> | |||
| </li> | |||
| </ul> | |||
| </div> | |||
| <!--显示个人主页--> | |||
| <%# if @user.blog.homepage_id and BlogComment.where("id=?", @user.blog.homepage_id).count > 0 %> | |||
| <%# homepage = BlogComment.find(@user.blog.homepage_id) %> | |||
| <%#= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %> | |||
| <%# end %> | |||
| <%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} %> | |||
| <script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script> | |||
| <input type="hidden" value="<%= @type%>" name="type" id="user_activities_type"> | |||
| <div class="homepageRightBanner"> | |||
| <div class="NewsBannerName">最新动态</div> | |||
| <ul class="resourcesSelect"> | |||
| <li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a> | |||
| <ul class="homepagePostType"> | |||
| <li> | |||
| <ul class="homepagePostTypeHomework fl"> | |||
| <% if hidden_unproject_infos %> | |||
| <li class="f14">班级动态</li> | |||
| <li><%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%> | |||
| <!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li> | |||
| <li><%= link_to "通知动态", {:controller => "users", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%> | |||
| <!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>--> | |||
| <li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%> | |||
| <li><%= link_to "问卷动态", {:controller => "users", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%> | |||
| <li><%= link_to "班级留言", {:controller => "users", :action => "show", :type => "course_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%> | |||
| <!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>--> | |||
| <!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>--> | |||
| <% end %> | |||
| </ul> | |||
| </li> | |||
| <li> | |||
| <ul class="homepagePostTypeProject fl"> | |||
| <li class="f14">项目动态</li> | |||
| <li><%= link_to "问题动态", {:controller => "users", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%> | |||
| <li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%> | |||
| <!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li> | |||
| <li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>--> | |||
| </ul> | |||
| </li> | |||
| <li> | |||
| <ul class="homepagePostTypeProject fl"> | |||
| <li class="f14">更多</li> | |||
| <li class="mt-4"><%= link_to "个人留言", {:controller => "users", :action => "show", :type => "user_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%> | |||
| <li class="mt-4"><%= link_to @user == User.current ? "我的动态" : "他的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeMine postTypeGrey"%> | |||
| <li class="mt-4"><%= link_to "全部动态", {:controller => "users", :action => "show", :type => "all"}, :class =>"homepagePostTypeAll postTypeGrey"%> | |||
| </ul> | |||
| </li> | |||
| </ul> | |||
| </li> | |||
| </ul> | |||
| </div> | |||
| <!--显示个人主页--> | |||
| <%# if @user.blog.homepage_id and BlogComment.where("id=?", @user.blog.homepage_id).count > 0 %> | |||
| <%# homepage = BlogComment.find(@user.blog.homepage_id) %> | |||
| <%#= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %> | |||
| <%# end %> | |||
| <%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} %> | |||
| @@ -12,7 +12,8 @@ RedmineApp::Application.configure do | |||
| # Show full error reports and disable caching | |||
| config.consider_all_requests_local = true | |||
| config.action_controller.perform_caching = true | |||
| config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" | |||
| # config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" | |||
| config.cache_store = :redis_store, 'redis://127.0.0.1:6379/0/cache', { expires_in: 90.minutes } | |||
| #config.cache_store = :dalli_store | |||
| # Don't care if the mailer can't send | |||
| config.action_mailer.raise_delivery_errors = true | |||
| @@ -24,7 +24,7 @@ RedmineApp::Application.configure do | |||
| # config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" | |||
| # config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 90.minutes } | |||
| # | |||
| config.cache_store = :redis_store, 'redis://10.9.52.157:6379/0/cache', { expires_in: 90.minutes } | |||
| # Enable serving of images, stylesheets, and javascripts from an asset server | |||
| # config.action_controller.asset_host = "http://assets.example.com" | |||
| @@ -0,0 +1,38 @@ | |||
| # Settings specified here will take precedence over those in config/application.rb | |||
| RedmineApp::Application.configure do | |||
| # The production environment is meant for finished, "live" apps. | |||
| # Code is not reloaded between requests | |||
| config.cache_classes = true | |||
| ##### | |||
| # Customize the default logger (http://ruby-doc.org/core/classes/Logger.html) | |||
| # | |||
| # Use a different logger for distributed setups | |||
| # config.logger = SyslogLogger.new | |||
| # | |||
| # Rotate logs bigger than 1MB, keeps no more than 7 rotated logs around. | |||
| # When setting a new Logger, make sure to set it's log level too. | |||
| # | |||
| # config.logger = Logger.new(config.log_path, 7, 1048576) | |||
| # config.logger.level = Logger::INFO | |||
| # Full error reports are disabled and caching is turned on | |||
| # config.logger = Logger.new('log/production.log', 'daily',1048576) # daily, weekly or monthly | |||
| config.action_controller.perform_caching = true | |||
| # to additional_environment.rb | |||
| # config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" | |||
| # config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 90.minutes } | |||
| # | |||
| config.cache_store = :redis_store, 'redis://192.168.80.122:6379/0/cache', { expires_in: 90.minutes } | |||
| # Enable serving of images, stylesheets, and javascripts from an asset server | |||
| # config.action_controller.asset_host = "http://assets.example.com" | |||
| # Disable delivery errors if you bad email addresses should just be ignored | |||
| config.action_mailer.raise_delivery_errors = false | |||
| # No email in production log | |||
| config.action_mailer.logger = nil | |||
| config.active_support.deprecation = :log | |||
| end | |||
| @@ -0,0 +1,11 @@ | |||
| class AddReplyUpdatedAtToBlogComments < ActiveRecord::Migration | |||
| def change | |||
| add_column :blog_comments, :reply_updated_at, :datetime | |||
| add_column :journals_for_messages, :reply_updated_at, :datetime | |||
| add_column :messages, :reply_updated_at, :datetime | |||
| add_column :news, :reply_updated_at, :datetime | |||
| add_column :homework_commons, :reply_updated_at, :datetime | |||
| add_column :issues, :reply_updated_at, :datetime | |||
| add_column :org_document_comments, :reply_updated_at, :datetime | |||
| end | |||
| end | |||
| @@ -0,0 +1,5 @@ | |||
| class AddUpdatedAtToAttachments < ActiveRecord::Migration | |||
| def change | |||
| add_column :attachments, :updated_at, :datetime | |||
| end | |||
| end | |||
| @@ -0,0 +1,5 @@ | |||
| class AddUpdatedAtToAttachmentHistories < ActiveRecord::Migration | |||
| def change | |||
| add_column :attachment_histories, :updated_at, :datetime | |||
| end | |||
| end | |||
| @@ -0,0 +1,5 @@ | |||
| class AddUpdatedAtToUsers < ActiveRecord::Migration | |||
| def change | |||
| add_column :users, :updated_at, :datetime | |||
| end | |||
| end | |||
| @@ -11,7 +11,11 @@ | |||
| # | |||
| # It's strongly recommended to check this file into your version control system. | |||
| ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| <<<<<<< HEAD | |||
| ActiveRecord::Schema.define(:version => 20161009053958) do | |||
| ======= | |||
| ActiveRecord::Schema.define(:version => 20161015102324) do | |||
| >>>>>>> develop | |||
| create_table "activities", :force => true do |t| | |||
| t.integer "act_id", :null => false | |||
| @@ -52,6 +56,28 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" | |||
| add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" | |||
| create_table "application_settings", :force => true do |t| | |||
| t.integer "default_projects_limit" | |||
| t.boolean "signup_enabled" | |||
| t.boolean "signin_enabled" | |||
| t.boolean "gravatar_enabled" | |||
| t.text "sign_in_text" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.string "home_page_url" | |||
| t.integer "default_branch_protection", :default => 2 | |||
| t.boolean "twitter_sharing_enabled", :default => true | |||
| t.text "restricted_visibility_levels" | |||
| t.boolean "version_check_enabled", :default => true | |||
| t.integer "max_attachment_size", :default => 10, :null => false | |||
| t.integer "default_project_visibility" | |||
| t.integer "default_snippet_visibility" | |||
| t.text "restricted_signup_domains" | |||
| t.boolean "user_oauth_applications", :default => true | |||
| t.string "after_sign_out_path" | |||
| t.integer "session_expire_delay", :default => 10080, :null => false | |||
| end | |||
| create_table "applied_messages", :force => true do |t| | |||
| t.integer "user_id" | |||
| t.integer "applied_id" | |||
| @@ -117,18 +143,6 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.integer "apply_user_id" | |||
| end | |||
| create_table "article_homepages", :force => true do |t| | |||
| t.string "title" | |||
| t.text "content" | |||
| t.integer "user_id" | |||
| t.integer "homepage_id" | |||
| t.datetime "created_at", :null => false | |||
| t.datetime "updated_at", :null => false | |||
| end | |||
| add_index "article_homepages", ["homepage_id"], :name => "index_article_homepages_on_homepage_id" | |||
| add_index "article_homepages", ["user_id"], :name => "index_article_homepages_on_user_id" | |||
| create_table "at_messages", :force => true do |t| | |||
| t.integer "user_id" | |||
| t.integer "at_message_id" | |||
| @@ -196,6 +210,20 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.string "typeName", :limit => 50 | |||
| end | |||
| create_table "audit_events", :force => true do |t| | |||
| t.integer "author_id", :null => false | |||
| t.string "type", :null => false | |||
| t.integer "entity_id", :null => false | |||
| t.string "entity_type", :null => false | |||
| t.text "details" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| end | |||
| add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id" | |||
| add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type" | |||
| add_index "audit_events", ["type"], :name => "index_audit_events_on_type" | |||
| create_table "auth_sources", :force => true do |t| | |||
| t.string "type", :limit => 30, :default => "", :null => false | |||
| t.string "name", :limit => 60, :default => "", :null => false | |||
| @@ -261,11 +289,8 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.integer "reply_id" | |||
| t.datetime "created_at", :null => false | |||
| t.datetime "updated_at", :null => false | |||
| t.integer "root_id" | |||
| end | |||
| add_index "blog_comments", ["root_id"], :name => "index_blog_comments_on_root_id" | |||
| create_table "blogs", :force => true do |t| | |||
| t.string "name", :default => "", :null => false | |||
| t.text "description" | |||
| @@ -296,6 +321,17 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" | |||
| add_index "boards", ["project_id"], :name => "boards_project_id" | |||
| create_table "broadcast_messages", :force => true do |t| | |||
| t.text "message", :null => false | |||
| t.datetime "starts_at" | |||
| t.datetime "ends_at" | |||
| t.integer "alert_type" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.string "color" | |||
| t.string "font" | |||
| end | |||
| create_table "bug_to_osps", :force => true do |t| | |||
| t.integer "osp_id" | |||
| t.integer "relative_memo_id" | |||
| @@ -683,6 +719,15 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" | |||
| create_table "deploy_keys_projects", :force => true do |t| | |||
| t.integer "deploy_key_id", :null => false | |||
| t.integer "project_id", :null => false | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| end | |||
| add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id" | |||
| create_table "discuss_demos", :force => true do |t| | |||
| t.string "title" | |||
| t.text "body" | |||
| @@ -732,6 +777,16 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.datetime "created_at" | |||
| end | |||
| create_table "emails", :force => true do |t| | |||
| t.integer "user_id", :null => false | |||
| t.string "email", :null => false | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| end | |||
| add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true | |||
| add_index "emails", ["user_id"], :name => "index_emails_on_user_id" | |||
| create_table "enabled_modules", :force => true do |t| | |||
| t.integer "project_id" | |||
| t.string "name", :null => false | |||
| @@ -754,6 +809,25 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" | |||
| add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" | |||
| create_table "events", :force => true do |t| | |||
| t.string "target_type" | |||
| t.integer "target_id" | |||
| t.string "title" | |||
| t.text "data" | |||
| t.integer "project_id" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.integer "action" | |||
| t.integer "author_id" | |||
| end | |||
| add_index "events", ["action"], :name => "index_events_on_action" | |||
| add_index "events", ["author_id"], :name => "index_events_on_author_id" | |||
| add_index "events", ["created_at"], :name => "index_events_on_created_at" | |||
| add_index "events", ["project_id"], :name => "index_events_on_project_id" | |||
| add_index "events", ["target_id"], :name => "index_events_on_target_id" | |||
| add_index "events", ["target_type"], :name => "index_events_on_target_type" | |||
| create_table "exercise_answers", :force => true do |t| | |||
| t.integer "user_id" | |||
| t.integer "exercise_question_id" | |||
| @@ -856,6 +930,15 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" | |||
| add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at" | |||
| create_table "forked_project_links", :force => true do |t| | |||
| t.integer "forked_to_project_id", :null => false | |||
| t.integer "forked_from_project_id", :null => false | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| end | |||
| add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true | |||
| create_table "forums", :force => true do |t| | |||
| t.string "name", :null => false | |||
| t.text "description" | |||
| @@ -884,16 +967,6 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true | |||
| create_table "homepages", :force => true do |t| | |||
| t.string "name" | |||
| t.integer "article_id" | |||
| t.integer "user_id" | |||
| t.datetime "created_at", :null => false | |||
| t.datetime "updated_at", :null => false | |||
| end | |||
| add_index "homepages", ["user_id"], :name => "index_homepages_on_user_id" | |||
| create_table "homework_attaches", :force => true do |t| | |||
| t.integer "bid_id" | |||
| t.integer "user_id" | |||
| @@ -995,6 +1068,17 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.datetime "updated_at", :null => false | |||
| end | |||
| create_table "identities", :force => true do |t| | |||
| t.string "extern_uid" | |||
| t.string "provider" | |||
| t.integer "user_id" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| end | |||
| add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id" | |||
| add_index "identities", ["user_id"], :name => "index_identities_on_user_id" | |||
| create_table "innodb_monitor", :id => false, :force => true do |t| | |||
| t.integer "a" | |||
| end | |||
| @@ -1143,10 +1227,21 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.integer "m_reply_id" | |||
| t.integer "is_comprehensive_evaluation" | |||
| t.integer "private", :default => 0 | |||
| t.integer "root_id" | |||
| end | |||
| add_index "journals_for_messages", ["root_id"], :name => "index_journals_for_messages_on_root_id" | |||
| create_table "keys", :force => true do |t| | |||
| t.integer "user_id" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.text "key" | |||
| t.string "title" | |||
| t.string "type" | |||
| t.string "fingerprint" | |||
| t.boolean "public", :default => false, :null => false | |||
| end | |||
| add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id" | |||
| add_index "keys", ["user_id"], :name => "index_keys_on_user_id" | |||
| create_table "kindeditor_assets", :force => true do |t| | |||
| t.string "asset" | |||
| @@ -1159,6 +1254,27 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.integer "owner_type", :default => 0 | |||
| end | |||
| create_table "label_links", :force => true do |t| | |||
| t.integer "label_id" | |||
| t.integer "target_id" | |||
| t.string "target_type" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| end | |||
| add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id" | |||
| add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type" | |||
| create_table "labels", :force => true do |t| | |||
| t.string "title" | |||
| t.string "color" | |||
| t.integer "project_id" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| end | |||
| add_index "labels", ["project_id"], :name => "index_labels_on_project_id" | |||
| create_table "member_roles", :force => true do |t| | |||
| t.integer "member_id", :null => false | |||
| t.integer "role_id", :null => false | |||
| @@ -1212,6 +1328,47 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.integer "viewed_count", :default => 0 | |||
| end | |||
| create_table "merge_request_diffs", :force => true do |t| | |||
| t.string "state" | |||
| t.text "st_commits", :limit => 2147483647 | |||
| t.text "st_diffs", :limit => 2147483647 | |||
| t.integer "merge_request_id", :null => false | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| end | |||
| add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true | |||
| create_table "merge_requests", :force => true do |t| | |||
| t.string "target_branch", :null => false | |||
| t.string "source_branch", :null => false | |||
| t.integer "source_project_id", :null => false | |||
| t.integer "author_id" | |||
| t.integer "assignee_id" | |||
| t.string "title" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.integer "milestone_id" | |||
| t.string "state" | |||
| t.string "merge_status" | |||
| t.integer "target_project_id", :null => false | |||
| t.integer "iid" | |||
| t.text "description" | |||
| t.integer "position", :default => 0 | |||
| t.datetime "locked_at" | |||
| end | |||
| add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id" | |||
| add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id" | |||
| add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id" | |||
| add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at" | |||
| add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id" | |||
| add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch" | |||
| add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id" | |||
| add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch" | |||
| add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true | |||
| add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title" | |||
| create_table "message_alls", :force => true do |t| | |||
| t.integer "user_id" | |||
| t.integer "message_id" | |||
| @@ -1238,7 +1395,6 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.integer "reply_id" | |||
| t.integer "quotes" | |||
| t.integer "status", :default => 0 | |||
| t.integer "root_id" | |||
| end | |||
| add_index "messages", ["author_id"], :name => "index_messages_on_author_id" | |||
| @@ -1246,7 +1402,39 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| add_index "messages", ["created_on"], :name => "index_messages_on_created_on" | |||
| add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" | |||
| add_index "messages", ["parent_id"], :name => "messages_parent_id" | |||
| add_index "messages", ["root_id"], :name => "index_messages_on_root_id" | |||
| create_table "milestones", :force => true do |t| | |||
| t.string "title", :null => false | |||
| t.integer "project_id", :null => false | |||
| t.text "description" | |||
| t.date "due_date" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.string "state" | |||
| t.integer "iid" | |||
| end | |||
| add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id" | |||
| add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date" | |||
| add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true | |||
| add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id" | |||
| create_table "namespaces", :force => true do |t| | |||
| t.string "name", :null => false | |||
| t.string "path", :null => false | |||
| t.integer "owner_id" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.string "type" | |||
| t.string "description", :default => "", :null => false | |||
| t.string "avatar" | |||
| end | |||
| add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id" | |||
| add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true | |||
| add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id" | |||
| add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true | |||
| add_index "namespaces", ["type"], :name => "index_namespaces_on_type" | |||
| create_table "news", :force => true do |t| | |||
| t.integer "project_id" | |||
| @@ -1273,6 +1461,31 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.datetime "updated_at", :null => false | |||
| end | |||
| create_table "notes", :force => true do |t| | |||
| t.text "note" | |||
| t.string "noteable_type" | |||
| t.integer "author_id" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.integer "project_id" | |||
| t.string "attachment" | |||
| t.string "line_code" | |||
| t.string "commit_id" | |||
| t.integer "noteable_id" | |||
| t.boolean "system", :default => false, :null => false | |||
| t.text "st_diff", :limit => 2147483647 | |||
| end | |||
| add_index "notes", ["author_id"], :name => "index_notes_on_author_id" | |||
| add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id" | |||
| add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id" | |||
| add_index "notes", ["created_at"], :name => "index_notes_on_created_at" | |||
| add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type" | |||
| add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type" | |||
| add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type" | |||
| add_index "notes", ["project_id"], :name => "index_notes_on_project_id" | |||
| add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at" | |||
| create_table "notificationcomments", :force => true do |t| | |||
| t.string "notificationcommented_type" | |||
| t.integer "notificationcommented_id" | |||
| @@ -1282,6 +1495,49 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.datetime "updated_at", :null => false | |||
| end | |||
| create_table "oauth_access_grants", :force => true do |t| | |||
| t.integer "resource_owner_id", :null => false | |||
| t.integer "application_id", :null => false | |||
| t.string "token", :null => false | |||
| t.integer "expires_in", :null => false | |||
| t.text "redirect_uri", :null => false | |||
| t.datetime "created_at", :null => false | |||
| t.datetime "revoked_at" | |||
| t.string "scopes" | |||
| end | |||
| add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true | |||
| create_table "oauth_access_tokens", :force => true do |t| | |||
| t.integer "resource_owner_id" | |||
| t.integer "application_id" | |||
| t.string "token", :null => false | |||
| t.string "refresh_token" | |||
| t.integer "expires_in" | |||
| t.datetime "revoked_at" | |||
| t.datetime "created_at", :null => false | |||
| t.string "scopes" | |||
| end | |||
| add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true | |||
| add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id" | |||
| add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true | |||
| create_table "oauth_applications", :force => true do |t| | |||
| t.string "name", :null => false | |||
| t.string "uid", :null => false | |||
| t.string "secret", :null => false | |||
| t.text "redirect_uri", :null => false | |||
| t.string "scopes", :default => "", :null => false | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.integer "owner_id" | |||
| t.string "owner_type" | |||
| end | |||
| add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type" | |||
| add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true | |||
| create_table "onclick_times", :force => true do |t| | |||
| t.integer "user_id" | |||
| t.datetime "onclick_time" | |||
| @@ -1373,11 +1629,8 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.integer "sticky", :default => 0 | |||
| t.integer "org_subfield_id" | |||
| t.integer "status", :default => 0 | |||
| t.integer "root_id" | |||
| end | |||
| add_index "org_document_comments", ["root_id"], :name => "index_org_document_comments_on_root_id" | |||
| create_table "org_member_roles", :force => true do |t| | |||
| t.integer "org_member_id" | |||
| t.integer "role_id" | |||
| @@ -1442,6 +1695,23 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.integer "allow_teacher", :default => 0 | |||
| end | |||
| create_table "permissions", :force => true do |t| | |||
| t.string "controller", :limit => 30, :default => "", :null => false | |||
| t.string "action", :limit => 30, :default => "", :null => false | |||
| t.string "description", :limit => 60, :default => "", :null => false | |||
| t.boolean "is_public", :default => false, :null => false | |||
| t.integer "sort", :default => 0, :null => false | |||
| t.boolean "mail_option", :default => false, :null => false | |||
| t.boolean "mail_enabled", :default => false, :null => false | |||
| end | |||
| create_table "permissions_roles", :id => false, :force => true do |t| | |||
| t.integer "permission_id", :default => 0, :null => false | |||
| t.integer "role_id", :default => 0, :null => false | |||
| end | |||
| add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id" | |||
| create_table "phone_app_versions", :force => true do |t| | |||
| t.string "version" | |||
| t.text "description" | |||
| @@ -1524,6 +1794,11 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.datetime "updated_at", :null => false | |||
| end | |||
| create_table "project_import_data", :force => true do |t| | |||
| t.integer "project_id" | |||
| t.text "data" | |||
| end | |||
| create_table "project_infos", :force => true do |t| | |||
| t.integer "project_id" | |||
| t.integer "user_id" | |||
| @@ -1545,7 +1820,6 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.integer "board_num", :default => 0 | |||
| t.integer "attach_num", :default => 0 | |||
| t.datetime "commit_time" | |||
| t.integer "pull_request_num", :default => 0 | |||
| end | |||
| create_table "project_statuses", :force => true do |t| | |||
| @@ -1618,6 +1892,16 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true | |||
| add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" | |||
| create_table "protected_branches", :force => true do |t| | |||
| t.integer "project_id", :null => false | |||
| t.string "name", :null => false | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.boolean "developers_can_push", :default => false, :null => false | |||
| end | |||
| add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id" | |||
| create_table "pull_requests", :force => true do |t| | |||
| t.integer "pull_request_id" | |||
| t.integer "gpid" | |||
| @@ -1774,6 +2058,25 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.integer "is_teacher_score", :default => 0 | |||
| end | |||
| create_table "services", :force => true do |t| | |||
| t.string "type" | |||
| t.string "title" | |||
| t.integer "project_id" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.boolean "active", :default => false, :null => false | |||
| t.text "properties" | |||
| t.boolean "template", :default => false | |||
| t.boolean "push_events", :default => true | |||
| t.boolean "issues_events", :default => true | |||
| t.boolean "merge_requests_events", :default => true | |||
| t.boolean "tag_push_events", :default => true | |||
| t.boolean "note_events", :default => true, :null => false | |||
| end | |||
| add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id" | |||
| add_index "services", ["project_id"], :name => "index_services_on_project_id" | |||
| create_table "settings", :force => true do |t| | |||
| t.string "name", :default => "", :null => false | |||
| t.text "value" | |||
| @@ -1812,6 +2115,26 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.datetime "updated_at", :null => false | |||
| end | |||
| create_table "snippets", :force => true do |t| | |||
| t.string "title" | |||
| t.text "content", :limit => 2147483647 | |||
| t.integer "author_id", :null => false | |||
| t.integer "project_id" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.string "file_name" | |||
| t.datetime "expires_at" | |||
| t.string "type" | |||
| t.integer "visibility_level", :default => 0, :null => false | |||
| end | |||
| add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id" | |||
| add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id" | |||
| add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at" | |||
| add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at" | |||
| add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id" | |||
| add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level" | |||
| create_table "softapplications", :force => true do |t| | |||
| t.string "name" | |||
| t.text "description" | |||
| @@ -1965,6 +2288,17 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.datetime "updated_at", :null => false | |||
| end | |||
| create_table "subscriptions", :force => true do |t| | |||
| t.integer "user_id" | |||
| t.integer "subscribable_id" | |||
| t.string "subscribable_type" | |||
| t.boolean "subscribed" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| end | |||
| add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true | |||
| create_table "syllabus_members", :force => true do |t| | |||
| t.integer "rank" | |||
| t.integer "syllabus_id" | |||
| @@ -2238,6 +2572,17 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" | |||
| add_index "users", ["type"], :name => "index_users_on_type" | |||
| create_table "users_star_projects", :force => true do |t| | |||
| t.integer "project_id", :null => false | |||
| t.integer "user_id", :null => false | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| end | |||
| add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id" | |||
| add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true | |||
| add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id" | |||
| create_table "versions", :force => true do |t| | |||
| t.integer "project_id", :default => 0, :null => false | |||
| t.string "name", :default => "", :null => false | |||
| @@ -2289,6 +2634,23 @@ ActiveRecord::Schema.define(:version => 20161019020422) do | |||
| t.datetime "updated_at", :null => false | |||
| end | |||
| create_table "web_hooks", :force => true do |t| | |||
| t.string "url" | |||
| t.integer "project_id" | |||
| t.datetime "created_at" | |||
| t.datetime "updated_at" | |||
| t.string "type", :default => "ProjectHook" | |||
| t.integer "service_id" | |||
| t.boolean "push_events", :default => true, :null => false | |||
| t.boolean "issues_events", :default => false, :null => false | |||
| t.boolean "merge_requests_events", :default => false, :null => false | |||
| t.boolean "tag_push_events", :default => false | |||
| t.boolean "note_events", :default => false, :null => false | |||
| end | |||
| add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id" | |||
| add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id" | |||
| create_table "wechat_logs", :force => true do |t| | |||
| t.string "openid", :null => false | |||
| t.text "request_raw" | |||
| @@ -0,0 +1,31 @@ | |||
| #coding=utf-8 | |||
| namespace :mysql2redis do | |||
| task :mysql2redis=> :environment do | |||
| puts "start mysql2redis." | |||
| mysqlTableName = ARGV[1] | |||
| puts mysqlTableName | |||
| begin | |||
| className = mysqlTableName.classify.constantize | |||
| puts "class ="+className.to_s | |||
| puts className.count | |||
| count = 0 | |||
| className.where("").find_each do|tmp| | |||
| key = mysqlTableName+":"+tmp.id.to_s | |||
| tmp.attributes.each do |k,v| | |||
| $redis.hset(key,k,v) | |||
| end | |||
| count = count + 1 | |||
| end | |||
| puts "count = "+count.to_s | |||
| rescue | |||
| puts "this table is not exist!" | |||
| end | |||
| puts "end mysql2redis." | |||
| end | |||
| end | |||