Compare commits

...

144 Commits

Author SHA1 Message Date
  SylorHuang 7f29a13fab add myimgh48 css 7 years ago
  SylorHuang 8d55788cd0 个人主页待办事项及底部的部分信息 7 years ago
  caishi ce3792b219 Merge branch 'dev-homepage-revision' of http://git.trustie.net/jacknudt/trustieforge into dev_new_head 7 years ago
  Jasder b4a8cfc363 FIX merge 7 years ago
  caishi 8cce8438a1 Merge branch 'dev-homepage-revision' into dev_new_head 7 years ago
  Jasder 17b9c06027 FIX only show read messages count 7 years ago
  Jasder 21dfac44ab FIX 解决KE编辑器导致Latex公式显示不正常的bug -MathJax 7 years ago
  Jasder da73c34c5a Merge branch 'dev-homepage-revision' of http://git.trustie.net/jacknudt/trustieforge into dev-homepage-revision 7 years ago
  Jasder ade760d2dd ADD blog url 7 years ago
  SylorHuang 9523a8304e 私信添加提醒 7 years ago
  SylorHuang 4555eba8e7 私信的功能完成 7 years ago
  SylorHuang 14353bceb6 私信的页面的完成 7 years ago
  caishi 96816ffb5d 待办事项页面 7 years ago
  caishi 3ab74de0eb Merge branch 'dev-homepage-revision' into dev_new_head 7 years ago
  caishi ee5778746d again 7 years ago
  caishi 26cee33e9e common.css 7 years ago
  caishi 644300ccaa fix 7 years ago
  caishi c041de02a7 新版个人主页和“TA的主页”的左侧头像和个人信息显示调整 7 years ago
  SylorHuang 3ad343fc33 项目的500 错误 7 years ago
  SylorHuang 82c5fbd4fe Merge branch 'dev_new_head' of http://git.trustie.net/jacknudt/trustieforge into dev_new_head 7 years ago
  SylorHuang b650b8efe6 私信未完成 7 years ago
  caishi 6ebd78f3cc Merge branch 'dev-homepage-revision' into dev_new_head 7 years ago
  caishi e64c570b38 fix 7 years ago
  caishi 1e7587f69c Merge branch 'dev-homepage-revision' into dev_new_head 7 years ago
  caishi caf41f92b1 icon1 7 years ago
  caishi 6452bb1f6f Merge branch 'dev-homepage-revision' into dev_new_head 7 years ago
  caishi 008e8a0f7a icon 7 years ago
  caishi f5d6e1f347 icon 7 years ago
  caishi 95f83f7793 个人主页 7 years ago
  Jasder 3877d6e29d FIX 完善 网站合作单位的相关功能 7 years ago
  caishi 98cfa418ac pull 7 years ago
  SylorHuang d8b0a1987e Merge branch 'dev-homepage-revision' into dev_new_head 7 years ago
  SylorHuang d479e21221 修改issue的点击权限 7 years ago
  SylorHuang 936abfcddd 消息点击失败 7 years ago
  caishi 774d12ed9d Merge branch 'develop' into dev_new_head 7 years ago
  SylorHuang 40941b0f6d 新增私信的前端和后端 7 years ago
  Jasder 50047d1e1c ADD web footer companies sort 7 years ago
  Jasder b8c67ef297 Merge branch 'dev_new_head' of http://git.trustie.net/jacknudt/trustieforge into dev_new_head 7 years ago
  SylorHuang 52bebf73b8 Merge branch 'dev_new_head' of http://git.trustie.net/jacknudt/trustieforge into dev_new_head 7 years ago
  SylorHuang ac49cd0fa8 私信的列表页前后端 7 years ago
  caishi 4b483e961e 冲突 7 years ago
  Jasder 729ceecd2c FIX 7 years ago
  Jasder 83270ab272 FIX bug 7 years ago
  Jasder 62f38402f7 Merge branch 'xss-bug' into dev-homepage-revision 7 years ago
  caishi dca1515830 issue页面样式错乱 7 years ago
  SylorHuang 7096abce3b 私信的页面 7 years ago
  caishi 9dd5bf66b3 私信对话框 7 years ago
  caishi 5587175e48 Merge branch 'dev-homepage-revision' into dev_new_head 7 years ago
  caishi 9f6f585bc3 issue回复隐藏删除按钮-黄 7 years ago
  caishi 7d3b4f6efe repeat 7 years ago
  caishi 250ff98cbb h-删除 7 years ago
  caishi 69d90a36bd 私信列表页面 7 years ago
  caishi 06827df1c8 冲突 7 years ago
  caishi 14d427aed1 Merge branch 'dev-homepage-revision' into dev_new_head 7 years ago
  Jasder d06c0d6fa0 ADD url 7 years ago
  caishi 21409187d0 链接 7 years ago
  SylorHuang 5064dffbc6 homeservice的修改 7 years ago
  caishi 533170970a 行业动态 7 years ago
  caishi 950f09009c ff 7 years ago
  Jasder a79dbdc922 ADD some url 7 years ago
  SylorHuang e1c89c6662 消息通知 7 years ago
  caishi 2a346b3906 首页 7 years ago
  caishi 352a045034 submit 7 years ago
  Jasder c8481e7244 FIX 同步项目数和学校数量 7 years ago
  Jasder 508ddd38f9 FIX 代码冲突 7 years ago
  Jasder 942accb7c1 FIX merge 7 years ago
  Jasder 7cfb5c7da0 Merge branch 'dev-homepage-revision' of http://git.trustie.net/jacknudt/trustieforge into dev-homepage-revision 7 years ago
  Jasder db52e7a358 ADD url 7 years ago
  caishi d3b1cee097 首页 7 years ago
  caishi 942e93ae40 首页 7 years ago
  Jasder d8718ba2b4 Merge branch 'dev-homepage-revision' of http://git.trustie.net/jacknudt/trustieforge into dev-homepage-revision 7 years ago
  Jasder 0f223c7343 ADD 各平台跳转链接 7 years ago
  SylorHuang 6d6445465b 消息通知页面的完成 7 years ago
  caishi 9ee9850e3b 社区动态 7 years ago
  caishi 3488c210b6 社区动态 7 years ago
  Jasder 2444af2f5f ADD scholls count api 7 years ago
  Jasder 5015f98e53 FIX 调整主页信息数据显示 7 years ago
  Jasder 933c30bf21 FIX code style 7 years ago
  Jasder ebbbf4ed11 FIX a target blank 7 years ago
  caishi e503690dda news_list 7 years ago
  Jasder 6fbbc24828 Merge branch 'dev-homepage-revision' of http://git.trustie.net/jacknudt/trustieforge into dev-homepage-revision 7 years ago
  Jasder 9b0c37a9bd FIX 首页更新 7 years ago
  caishi c7f172940c 动态新闻页面-分页 7 years ago
  SylorHuang 0da8977115 消息通知 7 years ago
  caishi 393d85e587 首页 7 years ago
  caishi 70630df038 首页 7 years ago
  caishi 3df8f6acdf 首页修改 7 years ago
  SylorHuang 88505a22a4 个人主页的样式和功能 7 years ago
  Jasder f6b02e7c93 ADD platform to dynamic_new model and api 7 years ago
  Jasder 3e06dddbe4 Merge branch 'dev-homepage-revision' of http://git.trustie.net/jacknudt/trustieforge into dev-homepage-revision 7 years ago
  Jasder b4cc5883bd ADD edit and delete dynamic_news 7 years ago
  caishi 01a7711d22 不知道什么原因,拉完代码出现很多更改过的文件 7 years ago
  Jasder 418975c21e ADD admin destroy dynamic_new 7 years ago
  Jasder 2e4e631c6c FIX change root url 7 years ago
  Jasder 50e31873dc FIX dynamic_news search 7 years ago
  caishi a38f73edac home 7 years ago
  SylorHuang d33fa8af92 个人主页的样式问题 7 years ago
  SylorHuang 1c9aae461f Merge branch 'dev_new_head' of http://git.trustie.net/jacknudt/trustieforge into dev_new_head 7 years ago
  SylorHuang 8f9f0215e3 change user page 7 years ago
  Jasder fdcc46afef Merge branch 'dev-homepage-revision' of http://git.trustie.net/jacknudt/trustieforge into dev-homepage-revision 7 years ago
  Jasder 857b888f7c ADD some apis 7 years ago
  caishi 4fafa577fe 首页底部 7 years ago
  caishi 40bb1b29ca fix modified 7 years ago
  caishi 83fc0e5eb3 fix 7 years ago
  caishi 0c98a7f5aa 首页底部样式问题 7 years ago
  SylorHuang c245ffb8d6 solve confict after merge dev_homepage 7 years ago
  Jasder 6aac0d0926 FIX delete redundant files 7 years ago
  Jasder 0cc06409c1 FIX 修复home主页链接错误问题 7 years ago
  Jasder 80b64f260d FIX bug 7 years ago
  Jasder 63057a1fb5 ADD more news page 7 years ago
  caishi 610d82d550 消息列表 7 years ago
  Jasder 0bc4ba2ac2 ADD more companies page 7 years ago
  caishi 613b371e58 加入项目弹框 7 years ago
  Jasder 849b928bae ADD default dynamic_new cover 7 years ago
  Jasder eac3960d01 Merge branch 'dev-homepage-revision' of http://git.trustie.net/jacknudt/trustieforge into dev-homepage-revision 7 years ago
  Jasder 082056ae47 ADD dynamic managerment 7 years ago
  caishi a02feb6be2 style 7 years ago
  caishi fee44440de 社区动态 7 years ago
  Jasder 6070c44ffe FIX logger print 7 years ago
  caishi 02ab992a57 行业动态 7 years ago
  caishi 838af497ef f 7 years ago
  Jasder fb3eda8559 FIX 7 years ago
  caishi a2757b440a ? 7 years ago
  Jasder f9a01ac7cc FIX excute homes migration bug 7 years ago
  caishi 85575e1ff3 fix 7 years ago
  caishi aa84d704d8 iconfont 7 years ago
  caishi fdf404f137 x 7 years ago
  Jasder a34140e19b FIX bug 7 years ago
  caishi 0dcc931aee 项目主页改版 7 years ago
  caishi fca15b9d52 个人主页改版 7 years ago
  Jasder ea1f3ed5bf ADD frendly_id to homes 7 years ago
  Jasder 30ff3234aa ADD home page 7 years ago
  Jasder 69d33dfe88 FIX update db/schema.rb 7 years ago
  Jasder 5209290667 ADD some fileds to homes table 7 years ago
  Jasder d10e13a9d0 ADD a column key to web_footer_companies table 7 years ago
  Jasder c96f60b56f ADD model DynamicNew 7 years ago
  Jasder 343d06c11b ADD model Banner 7 years ago
  Jasder d0adb73d58 ADD model Cover 7 years ago
  Jasder 486920c465 ADD model Home 7 years ago
  caishi 8a981d4c5d 头部搜索icon 7 years ago
  caishi 68d57c3c8a 蓝色logo 7 years ago
  caishi ad53b92a8e 所有用到公用头部和底部页面(base) 7 years ago
  caishi a521b0bf16 首页改版 7 years ago
  caishi ed1dc0a10f 首页 7 years ago
100 changed files with 2111 additions and 1065 deletions
Unified View
  1. +0
    -1
      .gitignore
  2. +2
    -0
      Gemfile
  3. +74
    -0
      README.md
  4. +0
    -5
      README.rdoc
  5. +7
    -2
      app/api/mobile/api.rb
  6. +71
    -0
      app/api/mobile/apis/homes.rb
  7. +3
    -0
      app/assets/javascripts/private_messages.js.coffee
  8. +3
    -0
      app/assets/stylesheets/private_messages.css.scss
  9. +5
    -5
      app/controllers/account_controller.rb
  10. +15
    -0
      app/controllers/admin_controller.rb
  11. +9
    -9
      app/controllers/application_controller.rb
  12. +61
    -0
      app/controllers/dynamic_news_controller.rb
  13. +106
    -0
      app/controllers/homes_controller.rb
  14. +139
    -0
      app/controllers/private_messages_controller.rb
  15. +1
    -1
      app/controllers/pull_requests_controller.rb
  16. +247
    -283
      app/controllers/users_controller.rb
  17. +39
    -9
      app/controllers/web_footer_companies_controller.rb
  18. +4
    -0
      app/helpers/admin_helper.rb
  19. +2
    -0
      app/helpers/dynamic_new_helper.rb
  20. +31
    -0
      app/helpers/homes_helper.rb
  21. +2
    -0
      app/helpers/private_messages_helper.rb
  22. +11
    -11
      app/helpers/users_helper.rb
  23. +21
    -0
      app/helpers/web_footer_companies_helper.rb
  24. +3
    -0
      app/models/banner.rb
  25. +3
    -0
      app/models/category.rb
  26. +5
    -0
      app/models/cover.rb
  27. +14
    -0
      app/models/dynamic_new.rb
  28. +26
    -0
      app/models/home.rb
  29. +13
    -0
      app/models/private_message.rb
  30. +15
    -12
      app/models/project.rb
  31. +6
    -0
      app/models/school.rb
  32. +177
    -26
      app/models/user.rb
  33. +12
    -1
      app/models/web_footer_company.rb
  34. +9
    -0
      app/services/dynamic_news_service.rb
  35. +15
    -0
      app/services/homes_service.rb
  36. +0
    -488
      app/views/account/_introduce.html.erb
  37. +66
    -0
      app/views/admin/_dynamic_news.html.erb
  38. +30
    -0
      app/views/admin/dynamic_news.html.erb
  39. +1
    -0
      app/views/admin/dynamic_news.js.erb
  40. +1
    -1
      app/views/admin/organization.html.erb
  41. +1
    -6
      app/views/admin/web_footer_made.html.erb
  42. +39
    -23
      app/views/applied_project/_applied_join_project.html.erb
  43. +10
    -10
      app/views/bids/contest.html.erb
  44. +6
    -6
      app/views/bids/index.html.erb
  45. +1
    -1
      app/views/courses/index.html.erb
  46. +2
    -2
      app/views/courses/search.html.erb
  47. +70
    -0
      app/views/dynamic_news/_form.html.erb
  48. +23
    -0
      app/views/dynamic_news/edit.html.erb
  49. +2
    -0
      app/views/dynamic_news/index.html.erb
  50. +22
    -0
      app/views/dynamic_news/new.html.erb
  51. +5
    -0
      app/views/homes/_banners.html.erb
  52. +45
    -0
      app/views/homes/_companies.html.erb
  53. +15
    -0
      app/views/homes/_dynamic_news.html.erb
  54. +60
    -0
      app/views/homes/_educoder.html.erb
  55. +30
    -0
      app/views/homes/_floating_tabs.html.erb
  56. +25
    -0
      app/views/homes/_form.html.erb
  57. +8
    -0
      app/views/homes/_home.html.erb
  58. +16
    -0
      app/views/homes/_nav_buttons.html.erb
  59. +17
    -0
      app/views/homes/_news_list.html.erb
  60. +52
    -0
      app/views/homes/_ossean.html.erb
  61. +3
    -0
      app/views/homes/_partners.html.erb
  62. +18
    -0
      app/views/homes/_statistics.html.erb
  63. +51
    -0
      app/views/homes/_trustie_coderpedia.html.erb
  64. +49
    -0
      app/views/homes/_trustie_forge.html.erb
  65. +54
    -0
      app/views/homes/index.html.erb
  66. +15
    -0
      app/views/homes/news.html.erb
  67. +1
    -0
      app/views/homes/news.js.erb
  68. +17
    -0
      app/views/homes/partners.html.erb
  69. +14
    -0
      app/views/homes/show.html.erb
  70. +9
    -14
      app/views/issues/index.html.erb
  71. +1
    -1
      app/views/journals/index.builder
  72. +3
    -4
      app/views/layouts/_base_college_header.html.erb
  73. +17
    -17
      app/views/layouts/_base_enterprise_header.html.erb
  74. +3
    -4
      app/views/layouts/_base_home_menu.html.erb
  75. +2
    -2
      app/views/layouts/_base_homework_attach.html.erb
  76. +2
    -2
      app/views/layouts/_base_softapplication_index_top_content.html.erb
  77. +4
    -4
      app/views/layouts/_base_softapplication_top_content.html.erb
  78. +17
    -1
      app/views/layouts/_footer.html.erb
  79. +25
    -22
      app/views/layouts/_logined_header.html.erb
  80. +5
    -2
      app/views/layouts/_show_messages_list.html.erb
  81. +31
    -29
      app/views/layouts/_unlogin_header.html.erb
  82. +2
    -1
      app/views/layouts/base.html.erb
  83. +4
    -4
      app/views/layouts/base_.html.erb
  84. +10
    -10
      app/views/layouts/base_bids.html.erb
  85. +3
    -2
      app/views/layouts/base_contest_community.html.erb
  86. +3
    -1
      app/views/layouts/base_contests.html.erb
  87. +3
    -2
      app/views/layouts/base_course_community.html.erb
  88. +2
    -1
      app/views/layouts/base_courses.html.erb
  89. +3
    -2
      app/views/layouts/base_forums.html.erb
  90. +1
    -1
      app/views/layouts/base_homework.html.erb
  91. +3
    -3
      app/views/layouts/base_introduce.html.erb
  92. +2
    -1
      app/views/layouts/base_mail.html.erb
  93. +11
    -11
      app/views/layouts/base_memos.html.erb
  94. +2
    -0
      app/views/layouts/base_new_forum.html.erb
  95. +1
    -1
      app/views/layouts/base_newcontest.html.erb
  96. +1
    -2
      app/views/layouts/base_opensource_p.html.erb
  97. +1
    -1
      app/views/layouts/base_org.html.erb
  98. +4
    -2
      app/views/layouts/base_project_community.html.erb
  99. +15
    -15
      app/views/layouts/base_projects.html.erb
  100. +1
    -1
      app/views/layouts/base_statistic.html.erb

+ 0
- 1
.gitignore View File

@@ -19,7 +19,6 @@
/public/images/avatars/* /public/images/avatars/*
/Gemfile /Gemfile
/Gemfile.lock /Gemfile.lock
/db/schema.rb
/Gemfile.lock /Gemfile.lock
/lib/plugins/acts_as_versioned/test/debug.log /lib/plugins/acts_as_versioned/test/debug.log
.rbenv-gemsets .rbenv-gemsets


+ 2
- 0
Gemfile View File

@@ -40,6 +40,7 @@ gem 'ruby-ole'
gem 'rails_kindeditor',path:'lib/rails_kindeditor' gem 'rails_kindeditor',path:'lib/rails_kindeditor'
gem 'binding_of_caller' gem 'binding_of_caller'
gem 'chinese_pinyin' gem 'chinese_pinyin'
gem 'jbuilder'
# gem 'sunspot_rails', '~> 1.3.3' # gem 'sunspot_rails', '~> 1.3.3'
# gem 'sunspot_solr' # gem 'sunspot_solr'
# gem 'sunspot' # gem 'sunspot'
@@ -59,6 +60,7 @@ gem 'elasticsearch-rails'
group :development do group :development do
gem 'grape-swagger' gem 'grape-swagger'
gem 'sextant'
gem 'better_errors', '~> 1.1.0' gem 'better_errors', '~> 1.1.0'
# gem "query_reviewer" # gem "query_reviewer"
gem 'rack-mini-profiler', '~> 0.9.3' gem 'rack-mini-profiler', '~> 0.9.3'


+ 74
- 0
README.md View File

@@ -0,0 +1,74 @@
# API文档
---
## 基本介绍
trustie平台同步其他平台数据的相关接口,如Educode、Openl,在获得许可权限后,如下接口可在其他任何平台调用。

#### token认证
token在trustie控制台下通过Setting.api_token获取,获取后可放环境变量中或者某个配置文件中

#### 同步用户数量、开源项目数量、实训项目数量
```
PUT homes/sync_count
```
*示例*
```
curl -X PUT http://localhost:3001/api/v1/homes/sync_count \
-d "token=34c82f51e0b699d9d16d70fd6497c9b1e4821d6ea3e872558a6537a091076b8e" \
-d "type=project" | jq
```

请求参数说明:

token(requires): String,权限验证

type(requires): String;同步的类型,取值范围: {user(用户) | project(开源项目) | practical_training_project(实训项目) | school(应用高校)}

number(optional): Integer;同步数量, 该参数可选,不传时,后台默认值为1


返回值
```
{
"status": 1,
"message": "token is invalid!"
}
```
---

#### 同步动态新闻
```
PUT homes/sync_news
```
*示例*
```
curl -X PUT http://localhost:3001/api/v1/homes/sync_news \
-d "token=34c82f51e0b699d9d16d70fd6497c9b1e4821d6ea3e872558a6537a091076b8e" \
-d "title=“基于OpenI海参的视频编码大赛”海口启动" \
-d "simple_intruduce=2019年8月31日下午,“AVS工作组第70次会议暨AI标准工作组第8次会议”闭幕式在海口召开,会上启动了“基于OpenI海参的视频编码大赛”,哈尔滨工业大学范晓鹏教授介绍了大赛背景、选题及参赛流程等信息,正式开启大赛参赛团队招募。" \
-d "remote_url=https://www.openi.org.cn/html/2019/dongtai_0903/255.html" | jq
```

请求参数说明:
cover_remote_url(optional): String, 封面访问地址

category_id(optional): Integer, 分类ID

content(optional): String, 新闻内容

title(requires): String, 新闻标题

simple_intruduce(requires): String, 新闻简介

remote_url(requires): String, 新闻访问地址

platform(requires): String, 该条数据的来源{educoder | trusite | ihub | gcc | openi |toschina | military | jiaotong_university}; 如educoder说明是来源educoder平台


返回值
```
{
"status": 1,
"message": "token is invalid!"
}
```
---

+ 0
- 5
README.rdoc View File

@@ -1,5 +0,0 @@
= Redmine

Redmine is a flexible project management web application written using Ruby on Rails framework.

More details can be found in the doc directory or on the official website http://www.redmine.org

+ 7
- 2
app/api/mobile/api.rb View File

@@ -21,6 +21,7 @@ module Mobile
require_relative 'apis/resources' require_relative 'apis/resources'
require_relative 'apis/syllabuses' require_relative 'apis/syllabuses'
require_relative 'apis/projects' require_relative 'apis/projects'
require_relative 'apis/homes'
class API < Grape::API class API < Grape::API
version 'v1', using: :path version 'v1', using: :path
@@ -56,6 +57,11 @@ module Mobile
nil nil
end end
# 使用固定token来简单验证用户是否有调用某个api权限
def authenticate_token!
raise 'token is invalid!' unless params[:token].strip == Setting.api_token
end
end end
mount Apis::Auth mount Apis::Auth
@@ -77,10 +83,9 @@ module Mobile
mount Apis::Resources mount Apis::Resources
mount Apis::Syllabuses mount Apis::Syllabuses
mount Apis::Projects mount Apis::Projects
mount Apis::Homes
add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development? add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
end end
end end

+ 71
- 0
app/api/mobile/apis/homes.rb View File

@@ -0,0 +1,71 @@
#coding=utf-8

module Mobile
module Apis
class Homes< Grape::API
resources :homes do

desc "Current user's information in access token's scope<span class='accstr'>*</span>", {
headers: {
"Authorization" => {
description: "Valdates your identity",
required: true
}
}
}

desc "同步用户数量、开源项目数量、实训项目数量"
params do
optional :number, type: Integer, default: 1, desc: "同步的数量"
requires :token, type: String, desc: "token is validate user identity"
requires :type, type: String, values: ['user', 'project', 'practical_training_project', 'school'], desc: "type requires."
end
put 'sync_count' do
authenticate_token!
begin
HomesService.new.sync_count(params[:type].strip, params[:number].to_i)

present :status, 0
present :message, "sync success."
rescue Exception=>e
present :status, -1
present :message, e.message
end
end

desc "同步社区动态新闻"
params do
optional :cover_remote_url, type: String, regexp: Home::REG_URL_FORMAT
optional :category_id, type: Integer
optional :content, type: String
requires :title, type: String
requires :simple_intruduce, type: String
requires :remote_url, type: String, regexp: Home::REG_URL_FORMAT
requires :platform, type: String, desc: "platform requires." , values: DynamicNew::PLATFORMS
end
put 'sync_news' do
authenticate_token!
news_params = {
title: params[:title],
simple_intruduce: params[:simple_intruduce],
remote_url: params[:remote_url],
category_id: params[:category_id],
content: params[:content],
cover_remote_url: params[:cover_remote_url],
platform: params[:platform]
}
begin
DynamicNewsService.new.sync(news_params)

present :status, 0
present :message, 'sync success'
rescue => e
logger.info e
present :status, -1
present :message, e.message
end
end
end
end
end
end

+ 3
- 0
app/assets/javascripts/private_messages.js.coffee View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

+ 3
- 0
app/assets/stylesheets/private_messages.css.scss View File

@@ -0,0 +1,3 @@
// Place all the styles related to the private_messages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

+ 5
- 5
app/controllers/account_controller.rb View File

@@ -134,7 +134,7 @@ class AccountController < ApplicationController
Mailer.run.lost_password(token) Mailer.run.lost_password(token)
flash[:notice] = l(:notice_account_lost_email_sent) flash[:notice] = l(:notice_account_lost_email_sent)
redirect_to lost_password_path redirect_to lost_password_path
return
return
end end
end end
render :layout => 'static_base' render :layout => 'static_base'
@@ -379,7 +379,7 @@ class AccountController < ApplicationController
def password_authentication def password_authentication
user, last_login_on = User.try_to_login(params[:username], params[:password]) user, last_login_on = User.try_to_login(params[:username], params[:password])
if user.nil? if user.nil?
invalid_credentials invalid_credentials
elsif user.status == 2 elsif user.status == 2
@@ -447,8 +447,8 @@ class AccountController < ApplicationController
call_hook(:controller_account_success_authentication_after, {:user => user }) call_hook(:controller_account_success_authentication_after, {:user => user })
code = /\d*/ code = /\d*/
#根据home_url生产正则表达式
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
#根据homes_url生产正则表达式
eval("code = " + "/^" + homes_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != '' if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != ''
redirect_to user_activities_path(user,host: Setting.host_user) redirect_to user_activities_path(user,host: Setting.host_user)
elsif params[:back_url64] elsif params[:back_url64]
@@ -502,7 +502,7 @@ class AccountController < ApplicationController
# render :layout => 'login' # render :layout => 'login'
redirect_to signin_path(:login=>true) redirect_to signin_path(:login=>true)
end end
def invalid_credentials_new def invalid_credentials_new
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}" logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
# flash[:error] = l(:notice_account_invalid_creditentials_new) # flash[:error] = l(:notice_account_invalid_creditentials_new)


+ 15
- 0
app/controllers/admin_controller.rb View File

@@ -712,6 +712,21 @@ class AdminController < ApplicationController
end end
end end
# 动态消息列表
def dynamic_news
@category_id = params[:category_id] || 0
scope = DynamicNew.desc.like(params[:title])
scope = scope.by_category(@category_id.to_i) unless @category_id.to_i == 0
@dynamic_news_count = scope.count
@dynamic_news = paginateHelper scope, 15
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.js
format.html
end
end
# 单位审核 # 单位审核
# 未审批tab页 # 未审批tab页
# status: 0 未审批; 1 已批阅; 2已更改; 3拒绝; # status: 0 未审批; 1 已批阅; 2已更改; 3拒绝;


+ 9
- 9
app/controllers/application_controller.rb View File

@@ -26,7 +26,7 @@ class ApplicationController < ActionController::Base
include Redmine::Pagination include Redmine::Pagination
include RoutesHelper include RoutesHelper
helper :routes helper :routes
#added by william #added by william
helper :watchers helper :watchers
@@ -57,7 +57,7 @@ class ApplicationController < ActionController::Base
helper Redmine::MenuManager::MenuHelper helper Redmine::MenuManager::MenuHelper
def user_agent def user_agent
logger.info "HTTP_USER_AGENT #{request.env["HTTP_USER_AGENT"]}"
logger.info "HTTP_USER_AGENT #{request.env["HTTP_USER_AGENT"]}"
end end
def session_expiration def session_expiration
@@ -72,7 +72,7 @@ class ApplicationController < ActionController::Base
end end
end end
def session_expired? def session_expired?
if Setting.session_lifetime? if Setting.session_lifetime?
unless session[:ctime] && (Time.now.utc.to_i - session[:ctime].to_i <= Setting.session_lifetime.to_i * 60) unless session[:ctime] && (Time.now.utc.to_i - session[:ctime].to_i <= Setting.session_lifetime.to_i * 60)
@@ -474,7 +474,7 @@ class ApplicationController < ActionController::Base
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
end end
# Finds and sets @project based on @object.project # Finds and sets @project based on @object.project
def find_project_from_association def find_project_from_association
render_404 unless @object.present? render_404 unless @object.present?
@@ -488,7 +488,7 @@ class ApplicationController < ActionController::Base
end end
end end
def find_contest_from_association def find_contest_from_association
render_404 unless @object.present? render_404 unless @object.present?
@@ -810,10 +810,10 @@ class ApplicationController < ActionController::Base
end end
if offset.nil? && options[:page].present? if offset.nil? && options[:page].present?
offset = (options[:page].to_i - 1) * limit offset = (options[:page].to_i - 1) * limit
offset = 0 if offset < 0
offset = 0 if offset < 0
offset ||= 0 offset ||= 0
end end
[offset, limit] [offset, limit]
end end
@@ -876,7 +876,7 @@ class ApplicationController < ActionController::Base
if unsaved_issue_ids.empty? if unsaved_issue_ids.empty?
flash[:notice] = l(:notice_successful_update) unless issues.empty? flash[:notice] = l(:notice_successful_update) unless issues.empty?
else else
flash[:error] = l(:notice_failed_to_save_issues,
flash[:error] = l(:notice_failed_to_save_issues,
:count => unsaved_issue_ids.size, :count => unsaved_issue_ids.size,
:total => issues.size, :total => issues.size,
:ids => '#' + unsaved_issue_ids.join(', #')) :ids => '#' + unsaved_issue_ids.join(', #'))
@@ -961,7 +961,7 @@ class ApplicationController < ActionController::Base
def find_web_footer def find_web_footer
@organizer = WebFooterOranizer.first @organizer = WebFooterOranizer.first
@companies = WebFooterCompany.all
@companies = WebFooterCompany.partners
end end


+ 61
- 0
app/controllers/dynamic_news_controller.rb View File

@@ -0,0 +1,61 @@
class DynamicNewsController < ApplicationController
layout 'admin', only: [:new, :destroy, :edit]

before_filter :require_admin, :except => [:index, :show]
before_filter :find_dynamic_new, :only => [:destroy, :edit, :update]

def index
end

def new
@category_id = params[:category_id] || 0
@dynamic_new = DynamicNew.new
end

def create
tmp_file = params[:cover]
@dynamic_new = DynamicNew.new(params[:dynamic_new])
begin
identity = SecureRandom.uuid
unless tmp_file.nil?
File.open(Rails.root.join('public', 'images', 'dynamic_new', identity.to_s+'.png'), 'wb') do |file|
file.write(tmp_file.read)
end
@dynamic_new.cover_remote_url = "/images/dynamic_new/#{identity}.png"
end
# TODO: 如下警告信息导致值写不进库
# WARNING: Can't mass-assign protected attributes: simple_intruduce,
@dynamic_new.simple_intruduce = params[:dynamic_new][:simple_intruduce]
if @dynamic_new.save!
redirect_to admin_dynamic_news_path
else
render :action => 'new'
end

rescue => e
logger.info e
render 'new'
end
end

def destroy
@dynamic_new.destroy
redirect_to admin_dynamic_news_path
end

def edit
end

def update
@dynamic_new.update_attributes!(params[:dynamic_new])
redirect_to admin_dynamic_news_path
end

def show
end

private
def find_dynamic_new
@dynamic_new = DynamicNew.find params[:id]
end
end

+ 106
- 0
app/controllers/homes_controller.rb View File

@@ -0,0 +1,106 @@
class HomesController < ApplicationController
layout 'base_introduce'

before_filter :find_home, :except => [:index, :new, :create, :partners, :news]

def index
@home = Home.includes(:banners, :cover => [:file]).first
@dynamic_news = DynamicNew.desc.limit(4)

@companies = WebFooterCompany.dedicators
@partners = WebFooterCompany.opensources

@first_companies_group = Array(@companies.slice(0, 5))
@second_companies_group = Array(@companies.slice(5, 8))
@third_companies_group = Array(@companies.slice(13, 5))
end

def partners
@companies = WebFooterCompany.where(key: ['opensource', 'dedicator']).group_by(&:key).sort { |a, b| b[0]<=>a[0] }
end

def news
scope = DynamicNew.desc
@dynamic_news_count = scope.count

@dynamic_news = paginateHelper scope, 15
@page = (params['page'] || 1).to_i - 1

respond_to do |format|
format.js
format.html
end
end

# GET /homes/1
# GET /homes/1.json
def show

respond_to do |format|
format.html # show.html.erb
format.json { render json: @home }
end
end

# GET /homes/new
# GET /homes/new.json
def new
@home = Home.new

respond_to do |format|
format.html # new.html.erb
format.json { render json: @home }
end
end

# GET /homes/1/edit
def edit
end

# POST /homes
# POST /homes.json
def create
@home = Home.new(params[:home])

respond_to do |format|
if @home.save
format.html { redirect_to @home, notice: 'Home was successfully created.' }
format.json { render json: @home, status: :created, location: @home }
else
format.html { render action: "new" }
format.json { render json: @home.errors, status: :unprocessable_entity }
end
end
end

# PUT /homes/1
# PUT /homes/1.json
def update

respond_to do |format|
if @home.update_attributes(params[:home])
format.html { redirect_to @home, notice: 'Home was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @home.errors, status: :unprocessable_entity }
end
end
end

# DELETE /homes/1
# DELETE /homes/1.json
def destroy
@home.destroy

respond_to do |format|
format.html { redirect_to homes_url }
format.json { head :no_content }
end
end

private
def find_home
@home = Home.find_by_frendly_id! params[:id]
end
end

+ 139
- 0
app/controllers/private_messages_controller.rb View File

@@ -0,0 +1,139 @@
class PrivateMessagesController < ApplicationController
before_filter :require_login
before_filter :set_user
before_filter :set_message, except: [:index]
before_filter :set_type_and_count

def index
#用户更新私信为全部已读
if User.current == @user || User.current.admin?
@onclick_time = User.current.onclick_time.onclick_time
User.current.onclick_time.update_attribute(:onclick_time, Time.now)
jours = PrivateMessage.find_by_sql("SELECT ui.* FROM (SELECT * FROM private_messages WHERE STATUS != 2 AND user_id = #{@user.id} ORDER BY id DESC) ui GROUP BY ui.target_id ORDER BY ui.send_time DESC")

@unred_all_messages = @user.count_new_message("all")
@unred_private_messages = @user.unread_private_messages
# jours = PrivateMessage.without_deleted.where("user_id = ?", @user.id).order("created_at desc")
@limit = 20
@jours_count = jours.count
@jours_all_pages = Paginator.new @jours_count, @limit, params['page'] || 1
@offset ||= @jours_all_pages.offset
@jours_alls = paginateHelper jours, @limit
render :layout=>'base_user_message'
else
render_403
end


end

def new

end

def create
ActiveRecord::Base.transaction do
begin
user_id = params[:private_message][:receiver_id]
receiver_user = User.find_by_id(user_id)
if receiver_user.present?
content = params[:private_message][:content].strip.truncate(200)
sender_params = {
user_id: current_user.id,
target_id: user_id,
sender_id: current_user.id,
receiver_id: user_id,
content: content,
status: 0,
send_time: Time.now
}

receiver_params = {
user_id: user_id,
target_id: current_user.id,
sender_id: current_user.id,
receiver_id: user_id,
content: content,
status: 0,
send_time: Time.now
}
@sender_message = PrivateMessage.new(sender_params)
@receiver_message = PrivateMessage.new(receiver_params)
@sender_message.save!
@receiver_message.save!
respond_to do |format|
format.js
format.html{
redirect_to private_messages_detail_user_private_messages_path(@user, target_ids: user_id)
}
end
else
redirect_to user_private_messages_path(current_user), notice: "用户不存在"
end
rescue Exception => e
Rails.logger.info("#######___________####{e}")
raise ActiveRecord::Rollback
end
end
end

def private_messages_detail
if User.current == @user || User.current.admin?
@unred_private_messages = @user.unread_private_messages
@unred_all_messages = 0
@target_user = User.where(:id => params[:target_ids]).includes(:user_extensions).first
if @target_user.present?
target_user_messages = @user.private_messages.where(:target_id => params[:target_ids], :status => [0, 1])
@message_list = target_user_messages.order("send_time asc")
target_user_messages.where(status: 0).update_all(status: 1)
@onclick_time = User.current.onclick_time.onclick_time
User.current.onclick_time.update_attribute(:onclick_time, Time.now)
@all_users = params[:all_user] || "0"
user_message_details = PrivateMessage.find_by_sql("SELECT ui.* FROM (SELECT * FROM private_messages WHERE STATUS != 2 AND user_id = #{@user.id} ORDER BY id DESC) ui GROUP BY ui.target_id ORDER BY ui.send_time DESC")
user_message_details_count = user_message_details.size
if user_message_details_count > 10 && @all_users == "0"
user_message_details = user_message_details.first(10)
end
@user_message_details = user_message_details
render :layout=>'base_user_message'
else
render_404
end
else
render_403
end
end

def destroy
@message.update_attribute(:status, 2)
end

def get_recent_users
@recent_users = User.where(:id => @user.private_messages.without_deleted.order("created_at desc").map(&:target_id)).includes(:user_extensions).limit(10)
render "get_recent_users", layout: false
end

def message_search_users
@search_users = User.where("id != #{@user.id} and LOWER(concat(lastname, firstname)) LIKE '%#{params[:receiver_name].strip.to_s.downcase}%'").includes(:user_extensions)

# @search_users = User.where("LOWER(concat(lastname, ifnull(firstname, ''), login)) LIKE ?", "#{params[:receiver_name].strip.to_s.downcase}")
render "message_search_users", layout: false
end


private

def set_user
@user = User.find_by_login(params[:user_id])
end

def set_message
@message = PrivateMessage.find_by_id(params[:id])
end

def set_type_and_count
@unred_all_messages = 0
@user_message_type = "2"
end

end

+ 1
- 1
app/controllers/pull_requests_controller.rb View File

@@ -291,7 +291,7 @@ class PullRequestsController < ApplicationController
rescue Gitlab::Error::NotFound => e rescue Gitlab::Error::NotFound => e
@message = l(:label_pull_request_notfound) @message = l(:label_pull_request_notfound)
rescue Exception => e rescue Exception => e
puts e
logger.info e
end end
end end




+ 247
- 283
app/controllers/users_controller.rb View File

@@ -42,7 +42,7 @@ class UsersController < ApplicationController
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,:user_contestlist, :user_manage_issues, :user_receive_issues, :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,:user_contestlist, :user_manage_issues, :user_receive_issues,
:user_courses4show,:user_projects4show,:user_contests4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, :user_courses4show,:user_projects4show,:user_contests4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list, :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community, :contest_community]
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community, :contest_community, :undo_items]
before_filter :auth_user_extension, only: :show before_filter :auth_user_extension, only: :show
before_filter :show_system_message, :only => [:show] before_filter :show_system_message, :only => [:show]
#before_filter :rest_user_score, only: :show #before_filter :rest_user_score, only: :show
@@ -477,19 +477,28 @@ class UsersController < ApplicationController
messages.each do |message_all| messages.each do |message_all|
# 未读的消息存放在数组 # 未读的消息存放在数组
mess = message_all.message mess = message_all.message
if (message_all.message_type != "SystemMessage" && !mess.nil? && (mess.viewed == 0 || !mess.viewed)) || (message_all.message_type == "SystemMessage"&& !mess.nil? && mess.created_at > onclick_time)
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
if (message_all.message_type != "SystemMessage" && !mess.nil? && (mess.viewed == 0 || !mess.viewed) && mess.created_at > onclick_time) || (message_all.message_type == "SystemMessage"&& !mess.nil? && mess.created_at > onclick_time)
unless (message_all.message_type == 'CourseMessage') && mess && mess.course && (mess.course.is_delete == 1)
@message_alls << mess @message_alls << mess
end end
break if @message_alls.length == 10 break if @message_alls.length == 10
end end
end end
#未读私信
unred_private_messages = User.current.private_messages.where(status: 0)
unred_private_messages.each do |message|
@message_alls << message
break if @message_alls.length == 10
end
end end
# 用户消息 # 用户消息
# 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复,exercise:课程测验 # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复,exercise:课程测验
# issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment) # issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment)
def user_messages def user_messages
@user_message_type = "1"
@msg_type = params[:type] || "all"
if !User.current.logged? if !User.current.logged?
redirect_to signin_url redirect_to signin_url
return return
@@ -497,72 +506,41 @@ class UsersController < ApplicationController
return render_403 return render_403
end end
# 初始化/更新 点击按钮时间, 24小时内显示系统消息 # 初始化/更新 点击按钮时间, 24小时内显示系统消息
update_onclick_time
user_all_messages = MessageAll.where(:user_id => @user.id).includes(:message)
# 全部设为已读 # 全部设为已读
# if params[:viewed] == "all"
# update_message_viewed(@user)
# end
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
courses = @user.courses.where("is_delete = 1")
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
case params[:type]
when nil
# 系统消息为管理员发送,我的消息中包含有系统消息
@message_alls = []
messages = MessageAll.where(:user_id => @user.id).includes(:message).order("created_at desc")
messages.each do |message_all|
mess = message_all.message
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
@message_alls << mess
end
end
when 'unviewed'
@message_alls = []
messages = MessageAll.where("message_alls.user_id =?", @user.id).includes(:message).order("created_at desc")
messages.each do |message_all|
# 在点击或者刷新消息列表后未读的消息存放在数组
mess = message_all.message
if message_all.message_type != "SystemMessage"&& !mess.nil? && (mess.viewed == 0 || !mess.viewed)
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
@message_alls << mess
end
end
end
#课程相关消息
when 'homework'
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =? and course_id NOT IN #{course_ids}", @user.id).order("created_at desc")
when 'course_message'
@message_alls = CourseMessage.where("course_message_type =? and user_id =? and course_id NOT IN #{course_ids}", "Message", @user.id).order("created_at desc")
when 'course_news'
# 课程通知包含发布的通知和回复的通知
@message_alls = CourseMessage.where("course_message_type in ('News', 'Comment') and user_id =? and course_id NOT IN #{course_ids}", @user.id).order("created_at desc")
when 'poll'
@message_alls = CourseMessage.where("course_message_type =? and user_id =? and course_id NOT IN #{course_ids}", "Poll", @user.id).order("created_at desc")
#项目相关消息
when 'issue'
@message_alls = ForgeMessage.where("forge_message_type in ('Issue', 'Journal') and user_id =?" , @user.id).order("created_at desc")
when 'forge_message'
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user.id).order("created_at desc")
when 'forge_news'
@message_alls = ForgeMessage.where("forge_message_type in (?,?) and user_id =?", "News", "Comment", @user.id).order("created_at desc")
when 'apply'
@message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject', 'JoinProject', 'RemoveFromProject') and user_id =?", @user.id).order("created_at desc")
#贴吧消息
when 'forum'
@message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user.id).order("created_at desc")
#用户留言
when 'user_feedback'
@message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user.id).order("created_at desc")
case @msg_type
when "all"
@message_alls = user_all_messages
when "course"
@message_alls = user_all_messages.where(message_type: "CourseMessage")
when "project"
@message_alls = user_all_messages.where(message_type: "ForgeMessage")
when "at"
@message_alls = user_all_messages.where(message_type: %w(UserFeedbackMessage MemoMessage AtMessage BlogMessage))
when "apply"
@message_alls = user_all_messages.where(message_type: "AppliedMessage")
else else
render_404
return
@message_alls = user_all_messages.where(message_type: %w(SystemMessage ContestMessage OrgMessage))
end end
@unred_all_messages = @user.count_new_message(@msg_type)
# @unred_private_messages = 0
@unred_private_messages = @user.unread_private_messages
@message_alls = @message_alls.order("created_at desc")
#点击进入tab后,全部更新为已读,全部页面除外
@message_alls = paginateHelper @message_alls, 25
@limit = 20
@message_count = @message_alls.count
@message_all_pages = Paginator.new @message_count, @limit, params['page'] || 1
@offset ||= @message_all_pages.offset
@message_alls = paginateHelper @message_alls, @limit
respond_to do |format| respond_to do |format|
format.js format.js
format.html{render :layout=>'new_base_user'}
format.html{render layout: "base_user_message"}
end end
end end
# 初始化/更新 点击按钮时间 # 初始化/更新 点击按钮时间
@@ -1671,41 +1649,6 @@ class UsersController < ApplicationController
render :layout=>'base_users_new' render :layout=>'base_users_new'
end end
# modified by fq
def user_newfeedback
unless User.current.logged?
redirect_to signin_url
return
end
# 自己访问自己的页面才更新消息状态
UserFeedbackMessage.where("user_id =? and viewed =? and journals_for_message_type =? ", User.current.id, 0, "JournalsForMessage").update_all(:viewed => true)
# end
@page = params[:page] ? params[:page].to_i + 1 : 0
if params[:type].present?
case params[:type]
when "public"
jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('updated_on DESC')
when "private"
jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('updated_on DESC')
else
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC')
end
else
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC')
end
@jour_count = jours.count
@jour = jours.limit(10).offset(@page * 10)
@type = params[:type]
# if User.current == @user
# @jour.update_all(:is_readed => true, :status => false)
# @jour.each do |journal|
# # fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
# journal.delay.set_children_readed_delay
# end
# end
@state = false
render :layout=>'new_base_user'
end
#给某人留言 #给某人留言
def feedBackTo def feedBackTo
@@ -2092,154 +2035,180 @@ class UsersController < ApplicationController
end end
def show def show
if User.current == @user
# 点击小铃铛,更新点击时间
update_onclick_time if params[:click_user_message] == 'true'
# 全部设为已读
# 自己的主页显示消息
messages_all = MessageAll.where(:user_id => @user.id)
@message_count = messages_all.count
# REDO:已删除的内容应该在页面中显示不点击
@message_all_pages = Paginator.new @message_count, per_page_option, params['page']
@message_alls = messages_all.includes(:message).
limit(@message_all_pages.per_page).
offset(@message_all_pages.offset).
reorder("#{MessageAll.table_name}.created_at desc")
@unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).count
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).
where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
# 用户待完成的作业
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Time.now}'")
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
@unfinished_homework_count = homeworks.count - student_works.count
# 用户待完成的测验
exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2")
exercise_users = ExerciseUser.where(:user_id => @user.id, :exercise_id => exercises.map{|ex| ex.id})
@unfinished_test_count = exercises.count - exercise_users.count
# 用户待完成的问卷
polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2")
poll_users = PollUser.where(:user_id => @user.id, :poll_id => polls.map{|poll| poll.id})
@unfinished_poll_count = polls.count - poll_users.count
# 用户待匿评的作品
homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status = 2")
student_work_scores = @user.student_works_scores.where("reviewer_role = 3")
anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")"
unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}")
@anonymous_evaluation_count = StudentWork.where(:id => unfinished_evaluations.map{|ev| ev.student_work_id}, :homework_common_id => homeworks.map{|hw| hw.id}).count
# 待评阅的作业 暂不做
# @unreview_homework = 1
# 待审批的申请
#applied_message_count = AppliedMessage.where(:applied_type => ["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"], :user_id => User.current.id, :status => 0).count
#applied_course_message_count = CourseMessage.where(:user_id => User.current.id, :course_message_type => "JoinCourseRequest", :status => 0).count
# applied_pull_request_message_count = ForgeMessage.where(:user_id => User.current.id, :forge_message_type => "PullRequest", :status => [1,3]).count
# @applied_message_alls_count = applied_message_count + applied_course_message_count + applied_pull_request_message_count
user_id = User.current.id
sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id
left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id
where (ma.user_id =#{user_id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{user_id} ) or
(ma.user_id=#{user_id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{user_id} and apm.status =0 ) or
(ma.user_id=#{user_id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{user_id} );"
message_alls = MessageAll.find_by_sql(sql)
@applied_message_alls_count = message_alls.count
else
# 看别人的主页显示动态
#更新用户申请成为课程老师或教辅消息的状态
if params[:course_id] != nil
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
join_course_messages.update_all(:viewed => true)
end
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
@page = params[:page] ? params[:page].to_i + 1 : 0
user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
project_types = "('Message','Issue','Project')"
principal_types = "JournalsForMessage"
container_type = ''
act_type = ''
# 他的动态
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
if params[:type].present?
case params[:type]
when "course_homework"
container_type = 'Course'
act_type = 'HomeworkCommon'
when "course_news"
container_type = 'Course'
act_type = 'News'
when "course_message"
container_type = 'Course'
act_type = 'Message'
when "course_poll"
container_type = 'Course'
act_type = 'Poll'
when "course_journals"
container_type = 'Course'
act_type = 'JournalsForMessage'
when "project_issue"
container_type = 'Project'
act_type = 'Issue'
when "project_message"
container_type = 'Project'
act_type = 'Message'
when "user_journals"
container_type = 'Principal'
act_type = 'JournalsForMessage'
when "current_user"
container_type = 'Principal'
act_type = 'Principal'
when "all"
container_type = 'all'
act_type = 'all'
end
end
if container_type != '' && container_type != 'all'
if container_type == 'Course'
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
elsif container_type == 'Project'
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
elsif container_type == 'Principal' && act_type == 'Principal'
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
end
if User.current != @user
sql += " and user_id = #{@user.id}"
end
else
if User.current != @user
blog_ids = "("+@user.blog.id.to_s+")"
else
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
end
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
if container_type != 'all' && User.current != @user
sql = "user_id = #{@user.id} and(" + sql + ")"
end
end
@user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count
@user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
@type = params[:type]
end
# @user_projects = @user.projects.order("updated_on desc")
messages_all = @user.project_relate_messages
@limit = 20
@message_count = messages_all.count
# REDO:已删除的内容应该在页面中显示不点击
@message_all_pages = Paginator.new @message_count, @limit, params['page'] || 1
@offset ||= @message_all_pages.offset
@message_alls = messages_all
@message_alls = paginateHelper @message_alls, @limit
respond_to do |format| respond_to do |format|
format.js format.js
format.html {render :layout => 'new_base_user'} format.html {render :layout => 'new_base_user'}
end end
end end
# #以前的用户show页面,暂时不删除
# def show
# @user_projects = @user.projects.order("updated_on desc")
# if User.current == @user
# # 点击小铃铛,更新点击时间
# update_onclick_time if params[:click_user_message] == 'true'
# # 全部设为已读
# # 自己的主页显示消息
# messages_all = MessageAll.where(:user_id => @user.id)
# @limit = 20
#
# @message_count = messages_all.count
# # REDO:已删除的内容应该在页面中显示不点击
# @message_all_pages = Paginator.new @message_count, @limit, params['page'] || 1
# @offset ||= @message_all_pages.offset
# @message_alls = messages_all.includes(:message).reorder("#{MessageAll.table_name}.created_at desc")
# @message_alls = paginateHelper @message_alls, @limit
#
# @unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).count
#
# my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).
# where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
# # 用户待完成的作业
# homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Time.now}'")
# homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
# student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
# @unfinished_homework_count = homeworks.count - student_works.count
# # 用户待完成的测验
# exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2")
# exercise_users = ExerciseUser.where(:user_id => @user.id, :exercise_id => exercises.map{|ex| ex.id})
# @unfinished_test_count = exercises.count - exercise_users.count
# # 用户待完成的问卷
# polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2")
# poll_users = PollUser.where(:user_id => @user.id, :poll_id => polls.map{|poll| poll.id})
# @unfinished_poll_count = polls.count - poll_users.count
# # 用户待匿评的作品
# homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status = 2")
# student_work_scores = @user.student_works_scores.where("reviewer_role = 3")
# anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")"
# unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}")
# @anonymous_evaluation_count = StudentWork.where(:id => unfinished_evaluations.map{|ev| ev.student_work_id}, :homework_common_id => homeworks.map{|hw| hw.id}).count
# # 待评阅的作业 暂不做
# # @unreview_homework = 1
#
# # 待审批的申请
# #applied_message_count = AppliedMessage.where(:applied_type => ["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"], :user_id => User.current.id, :status => 0).count
# #applied_course_message_count = CourseMessage.where(:user_id => User.current.id, :course_message_type => "JoinCourseRequest", :status => 0).count
# # applied_pull_request_message_count = ForgeMessage.where(:user_id => User.current.id, :forge_message_type => "PullRequest", :status => [1,3]).count
# # @applied_message_alls_count = applied_message_count + applied_course_message_count + applied_pull_request_message_count
# user_id = User.current.id
# sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id
# left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id
# where (ma.user_id =#{user_id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{user_id} ) or
# (ma.user_id=#{user_id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{user_id} and apm.status =0 ) or
# (ma.user_id=#{user_id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{user_id} );"
# message_alls = MessageAll.find_by_sql(sql)
# @applied_message_alls_count = message_alls.count
# else
# # 看别人的主页显示动态
# #更新用户申请成为课程老师或教辅消息的状态
# if params[:course_id] != nil
# join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
# params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
# join_course_messages.update_all(:viewed => true)
# end
# shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
# shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
# @page = params[:page] ? params[:page].to_i + 1 : 0
# user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
# user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
# course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
# project_types = "('Message','Issue','Project')"
# principal_types = "JournalsForMessage"
# container_type = ''
# act_type = ''
# # 他的动态
# sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
# if params[:type].present?
# case params[:type]
# when "course_homework"
# container_type = 'Course'
# act_type = 'HomeworkCommon'
# when "course_news"
# container_type = 'Course'
# act_type = 'News'
# when "course_message"
# container_type = 'Course'
# act_type = 'Message'
# when "course_poll"
# container_type = 'Course'
# act_type = 'Poll'
# when "course_journals"
# container_type = 'Course'
# act_type = 'JournalsForMessage'
# when "project_issue"
# container_type = 'Project'
# act_type = 'Issue'
# when "project_message"
# container_type = 'Project'
# act_type = 'Message'
# when "user_journals"
# container_type = 'Principal'
# act_type = 'JournalsForMessage'
# when "current_user"
# container_type = 'Principal'
# act_type = 'Principal'
# when "all"
# container_type = 'all'
# act_type = 'all'
# end
# end
# if container_type != '' && container_type != 'all'
# if container_type == 'Course'
# sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
# elsif container_type == 'Project'
# sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
# elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
# sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
# elsif container_type == 'Principal' && act_type == 'Principal'
# sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
# end
# if User.current != @user
# sql += " and user_id = #{@user.id}"
# end
# else
# if User.current != @user
# blog_ids = "("+@user.blog.id.to_s+")"
# else
# blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
# end
# sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
# "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
# "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
# "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
# if container_type != 'all' && User.current != @user
# sql = "user_id = #{@user.id} and(" + sql + ")"
# end
# end
# @user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count
# @user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
# @type = params[:type]
# end
# respond_to do |format|
# format.js
# format.html {render :layout => 'new_base_user'}
# # format.html {render :layout => 'base'}
#
# end
# end
# 待解决的Issue # 待解决的Issue
def unsolved_issues_list def unsolved_issues_list
@unsolved_issues = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).order("updated_on desc")
@undo_show_type = 1
@unsolved_issues = @user.user_unsolve_issues
@unsolved_issues_count = @unsolved_issues.count @unsolved_issues_count = @unsolved_issues.count
@message_count = @user.user_unsolve_messages.count
@limit = 20 @limit = 20
@is_remote = true @is_remote = true
@unsolved_issues_pages = Paginator.new @unsolved_issues_count, @limit, params['page'] || 1 @unsolved_issues_pages = Paginator.new @unsolved_issues_count, @limit, params['page'] || 1
@@ -2250,20 +2219,28 @@ class UsersController < ApplicationController
end end
end end
# 待审批的申请
# 待审批的消息一般不多,可以特殊处理
def unapproval_applied_list
@undo_show_type = 6
@message_alls = @user.user_unsolve_messages
@message_count = @message_alls.count
@unsolved_issues_count = @user.user_unsolve_issues.count
@message_alls = paginateHelper @message_alls, 20
respond_to do |format|
format.js
end
end
# 待完成的作业 # 待完成的作业
def unfinished_homework_list def unfinished_homework_list
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Time.now}'")
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
finished_works_id = student_works.blank? ? "(-1)" : "(" + student_works.map{ |sw| sw.homework_common_id.to_i }.join(",") + ")"
@unfinished_homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Time.now}' and id not in #{finished_works_id}").order("updated_at desc")
@unfinished_homeworks_count = @unfinished_homeworks.count
@undo_show_type = 2
@unfinished_homeworks = @user.user_undo_homeworks
@unfinished_homeworks_count = @unfinished_homeworks.size
@limit = 20 @limit = 20
@unfinished_homework_pages = Paginator.new @unfinished_homeworks_count, @limit, params['page'] || 1 @unfinished_homework_pages = Paginator.new @unfinished_homeworks_count, @limit, params['page'] || 1
@offset ||= @unfinished_homework_pages.offset @offset ||= @unfinished_homework_pages.offset
@unfinished_homeworks = paginateHelper @unfinished_homeworks, @limit @unfinished_homeworks = paginateHelper @unfinished_homeworks, @limit
respond_to do |format| respond_to do |format|
format.js format.js
end end
@@ -2271,12 +2248,8 @@ class UsersController < ApplicationController
# 待完成的测验 # 待完成的测验
def unfinished_test_list def unfinished_test_list
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2")
exercise_ids = exercises.blank? ? "(-1)" : "(" + exercises.map{|ex| ex.id}.join(",") + ")"
exercise_users = ExerciseUser.where("user_id = #{@user.id} and exercise_id in #{exercise_ids}")
finished_test_ids = exercise_users.blank? ? "(-1)" : "(" + exercise_users.map{|eu| eu.exercise_id }.join(",") + ")"
@unfinished_test = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2 and id not in #{finished_test_ids}")
@undo_show_type = 3
@unfinished_test = @user.user_undo_tests
@unfinished_test_count = @unfinished_test.count @unfinished_test_count = @unfinished_test.count
@limit = 20 @limit = 20
@unfinished_test_pages = Paginator.new @unfinished_test_count, @limit, params['page'] || 1 @unfinished_test_pages = Paginator.new @unfinished_test_count, @limit, params['page'] || 1
@@ -2289,12 +2262,14 @@ class UsersController < ApplicationController
# 待完成的问卷 # 待完成的问卷
def unfinished_poll_list def unfinished_poll_list
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2")
poll_ids = polls.blank? ? "(-1)" : "(" + polls.map{|poll| poll.id}.join(",") + ")"
poll_users = PollUser.where("user_id = #{@user.id} and poll_id in #{poll_ids}")
finished_poll_ids = poll_users.blank? ? "(-1)" : "(" + poll_users.map{|pu| pu.poll_id }.join(",") + ")"
@unfinished_poll = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2 and id not in #{finished_poll_ids}").order("updated_at desc")
@undo_show_type = 4
# my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
# polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2")
# poll_ids = polls.blank? ? "(-1)" : "(" + polls.map{|poll| poll.id}.join(",") + ")"
# poll_users = PollUser.where("user_id = #{@user.id} and poll_id in #{poll_ids}")
# finished_poll_ids = poll_users.blank? ? "(-1)" : "(" + poll_users.map{|pu| pu.poll_id }.join(",") + ")"
# @unfinished_poll = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2 and id not in #{finished_poll_ids}").order("updated_at desc")
@unfinished_poll = @user.user_undo_polls
@unfinished_poll_count = @unfinished_poll.count @unfinished_poll_count = @unfinished_poll.count
@limit = 20 @limit = 20
@unfinished_poll_pages = Paginator.new @unfinished_poll_count, @limit, params['page'] || 1 @unfinished_poll_pages = Paginator.new @unfinished_poll_count, @limit, params['page'] || 1
@@ -2307,16 +2282,20 @@ class UsersController < ApplicationController
# 待匿评的作业 # 待匿评的作业
def anonymous_evaluation_list def anonymous_evaluation_list
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status in (1,2)")
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
student_work_scores = @user.student_works_scores.where("reviewer_role = 3")
anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")"
unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}")
unfinished_evaluations_work_ids = unfinished_evaluations.blank? ? "(-1)" : "(" + unfinished_evaluations.map{|st| st.student_work_id}.join(",") + ")"
@anonymous_evaluation_count = StudentWork.where("student_works.id in #{unfinished_evaluations_work_ids} and homework_common_id in #{homework_ids}").count
homework_ids = StudentWork.where("id in #{unfinished_evaluations_work_ids} and homework_common_id in #{homework_ids}").blank? ? "(-1)" : "(" + StudentWork.where("id in #{unfinished_evaluations_work_ids} and homework_common_id in #{homework_ids}").map{|st| st.homework_common_id}.join(",") + ")"
@anonymous_evaluation = HomeworkCommon.where("homework_commons.id in #{homework_ids}")
@undo_show_type = 5
# my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
# homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status in (1,2)")
# homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
# student_work_scores = @user.student_works_scores.where("reviewer_role = 3")
# anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")"
# unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}")
# unfinished_evaluations_work_ids = unfinished_evaluations.blank? ? "(-1)" : "(" + unfinished_evaluations.map{|st| st.student_work_id}.join(",") + ")"
# @anonymous_evaluation_count = StudentWork.where("student_works.id in #{unfinished_evaluations_work_ids} and homework_common_id in #{homework_ids}").count
# homework_ids = StudentWork.where("id in #{unfinished_evaluations_work_ids} and homework_common_id in #{homework_ids}").blank? ? "(-1)" : "(" + StudentWork.where("id in #{unfinished_evaluations_work_ids} and homework_common_id in #{homework_ids}").map{|st| st.homework_common_id}.join(",") + ")"
#
# @anonymous_evaluation = HomeworkCommon.where("homework_commons.id in #{homework_ids}")
@anonymous_evaluation = @user.user_undo_anonymous
@anonymous_evaluation_count = @anonymous_evaluation.size
@limit = 20 @limit = 20
@anonymous_evaluation_pages = Paginator.new @anonymous_evaluation.count, @limit, params['page'] || 1 @anonymous_evaluation_pages = Paginator.new @anonymous_evaluation.count, @limit, params['page'] || 1
@offset ||= @anonymous_evaluation_pages.offset @offset ||= @anonymous_evaluation_pages.offset
@@ -2326,22 +2305,7 @@ class UsersController < ApplicationController
end end
end end
# 待审批的申请
# 待审批的消息一般不多,可以特殊处理
def unapproval_applied_list
user_id = User.current.id
sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id
left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id
where (ma.user_id =#{user_id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{user_id} ) or
(ma.user_id=#{user_id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{user_id} and apm.status =0 ) or
(ma.user_id=#{user_id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{user_id}) order by ma.created_at desc;"
@message_alls = MessageAll.find_by_sql(sql)
@message_count = @message_alls.count
@message_alls = paginateHelper @message_alls, 20
respond_to do |format|
format.js
end
end
# 课程社区 # 课程社区
def course_community def course_community
@@ -2674,7 +2638,7 @@ class UsersController < ApplicationController
#Modified by nie #Modified by nie
unless User.current.admin? unless User.current.admin?
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
# redirect_to home_path
# redirect_to homes_path
render_404 render_404
return return
end end


+ 39
- 9
app/controllers/web_footer_companies_controller.rb View File

@@ -4,9 +4,27 @@ class WebFooterCompaniesController < ApplicationController
menu_item :plugins, :only => :plugins menu_item :plugins, :only => :plugins
menu_item :info, :only => :info menu_item :info, :only => :info
before_filter :require_admin before_filter :require_admin
before_filter :find_company, :except => [:index, :new, :create]
def index def index
@companys = WebFooterCompany.all
@key = params[:key] || 'opensource'
scope =
case @key
when 'partner'
WebFooterCompany.partners
when 'dedicator'
WebFooterCompany.dedicators
when 'opensource'
WebFooterCompany.opensources
end
@companies = paginateHelper scope, 25
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.js
format.html
end
end end
def new def new
@@ -15,38 +33,50 @@ class WebFooterCompaniesController < ApplicationController
def create def create
@company = WebFooterCompany.new(params[:web_footer_company]) @company = WebFooterCompany.new(params[:web_footer_company])
if @company.save
@key = params[:web_footer_company][:key]
if @company.save!
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
redirect_to web_footer_companies_url
redirect_to web_footer_companies_url(key: @key)
else else
flash[:error] = "#{l :web_footer_company_create_fail}: #{@company.errors.full_messages[0]}" flash[:error] = "#{l :web_footer_company_create_fail}: #{@company.errors.full_messages[0]}"
respond_to do |format| respond_to do |format|
format.html { render :action => 'new'}
format.html { redirect_to new_web_footer_company_path(key: @key) }
format.api { render_validation_errors(@company) } format.api { render_validation_errors(@company) }
end end
end
end
def move
if request.put? and @company.update_attributes(params[:company])
flash[:notice] = l(:notice_successful_update)
redirect_to web_footer_companies_url(type: @type)
else
render :action => 'edit'
end end
end end
def destroy def destroy
@company = WebFooterCompany.find(params[:id])
@company.destroy @company.destroy
redirect_to web_footer_companies_url
redirect_to web_footer_companies_url(type: @type)
end end
def edit def edit
@company = WebFooterCompany.find(params[:id])
end end
def update def update
@company = WebFooterCompany.find(params[:id])
if @company.update_attributes(params[:web_footer_company]) if @company.update_attributes(params[:web_footer_company])
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to web_footer_companies_url
redirect_to web_footer_companies_url(type: @type)
else else
flash[:error] = "#{l :web_footer_company_update_fail}: #{@company.errors.full_messages[0]}" flash[:error] = "#{l :web_footer_company_update_fail}: #{@company.errors.full_messages[0]}"
render :action => 'edit' render :action => 'edit'
end end
end end
private
def find_company
@company = WebFooterCompany.find(params[:id])
end
end end

+ 4
- 0
app/helpers/admin_helper.rb View File

@@ -24,4 +24,8 @@ module AdminHelper
[l(:project_status_closed), '5'], [l(:project_status_closed), '5'],
[l(:project_status_archived), '9']], selected.to_s) [l(:project_status_archived), '9']], selected.to_s)
end end

def dynamic_news_category_options_for_select(selected)
options_for_select(Category.all.collect{|item| [item.name, item.id]}.insert(0, ['全部', 0]), selected)
end
end end

+ 2
- 0
app/helpers/dynamic_new_helper.rb View File

@@ -0,0 +1,2 @@
module DynamicNewHelper
end

+ 31
- 0
app/helpers/homes_helper.rb View File

@@ -0,0 +1,31 @@
module HomesHelper

def home_cover_tag(home)
file_path = home&.cover&.file.nil? ? "/images/introduce/activeBanner.jpg": local_path(home.cover.file)
image_tag(file_path, class: 'mb30', width: '592px')
end

def home_banner_tag(banner)
image_tag local_path(banner.file)
end

def default_banner_tag(home)
return unless home.banners.size == 0

content_tag :a do
image_tag "/images/introduce/trustie.jpg"
end
end

def local_path(file)
File.join("/files/uploads/image", file.disk_directory, file.disk_filename)
end

def render_pool_name poll
case poll
when 'opensource' then '合作共建开源'
when 'partner' then '合作机构'
when 'dedicator' then '技术合作单位'
end
end
end

+ 2
- 0
app/helpers/private_messages_helper.rb View File

@@ -0,0 +1,2 @@
module PrivateMessagesHelper
end

+ 11
- 11
app/helpers/users_helper.rb View File

@@ -30,7 +30,7 @@ module UsersHelper
end end
def task_count(unsolved_issues_count, unfinished_homework_count, unfinished_test_count, unfinished_poll_count, anonymous_evaluation_count, unapproval_homework) def task_count(unsolved_issues_count, unfinished_homework_count, unfinished_test_count, unfinished_poll_count, anonymous_evaluation_count, unapproval_homework)
result = unsolved_issues_count + unfinished_homework_count + unfinished_test_count + unfinished_poll_count + anonymous_evaluation_count + unapproval_homework
result = unsolved_issues_count.to_i + unfinished_homework_count.to_i + unfinished_test_count.to_i + unfinished_poll_count.to_i + anonymous_evaluation_count.to_i + unapproval_homework.to_i
end end
# 判断某个时间再多少天前 # 判断某个时间再多少天前
@@ -132,13 +132,13 @@ module UsersHelper
def pull_request_message_status ma def pull_request_message_status ma
case ma.status case ma.status
when 1 when 1
"创建了PullRequest:"
"创建了PullRequest"
when 2 when 2
"接受了PullRequest:"
"接受了PullRequest"
when 3 when 3
"重新打开了PullRequest:"
"重新打开了PullRequest"
when 4 when 4
"关闭了PullRequest:"
"关闭了PullRequest"
end end
end end
@@ -169,11 +169,11 @@ module UsersHelper
def applied_project_tip applied_message def applied_project_tip applied_message
case applied_message.status case applied_message.status
when 4 when 4
"拒绝申请加入:"
"拒绝申请加入"
when 5,3,2,1,7 when 5,3,2,1,7
"申请加入:"
"申请加入"
when 6 when 6
"同意申请加入:"
"同意申请加入"
end end
end end
@@ -187,9 +187,9 @@ module UsersHelper
def applied_school_tip applied_message def applied_school_tip applied_message
case applied_message.status case applied_message.status
when 1,2,3 when 1,2,3
"您添加新的单位:"
"您添加新的单位"
when 0 when 0
"申请了单位:"
"申请了单位"
end end
end end
@@ -202,7 +202,7 @@ module UsersHelper
when 4 when 4
"婉拒您" "婉拒您"
when 5,3,2,1,7 when 5,3,2,1,7
"申请:"
"申请"
when 6 when 6
"同意您" "同意您"
end end


+ 21
- 0
app/helpers/web_footer_companies_helper.rb View File

@@ -0,0 +1,21 @@
module WebFooterCompaniesHelper
def label_new_button_name type
(@type == WebFooterCompany::RELATION_TYPE[1]) ? l(:label_new_open_source_company) : l(:label_new_company)
end

def label_title_name type
(@type == WebFooterCompany::RELATION_TYPE[1]) ? l(:label_web_footer_open_source_compnay) : l(:label_web_footer_cooperation_compnay)
end

def label_root_name type
(@type == WebFooterCompany::RELATION_TYPE[1]) ? l(:label_open_source_compnay) : l(:label_cooperation_compnay)
end

def label_edit_button_name type
(@type == WebFooterCompany::RELATION_TYPE[1]) ? l(:label_new_open_source_company) : l(:label_edit_company)
end

def hash_company_types
{ "首页合作共建开源" => "opensource", "首页技术合作单位" => "dedicator", "网站页脚合作单位" => "partner" }
end
end

+ 3
- 0
app/models/banner.rb View File

@@ -0,0 +1,3 @@
class Banner < ActiveRecord::Base
has_one :file, :as => :container, :class_name => 'Attachment', dependent: :destroy
end

+ 3
- 0
app/models/category.rb View File

@@ -0,0 +1,3 @@
class Category < ActiveRecord::Base
has_many :dynamic_news
end

+ 5
- 0
app/models/cover.rb View File

@@ -0,0 +1,5 @@
class Cover < ActiveRecord::Base
belongs_to :coverable, polymorphic: true
has_one :file, :as => :container, :class_name => 'Attachment', dependent: :destroy
end

+ 14
- 0
app/models/dynamic_new.rb View File

@@ -0,0 +1,14 @@
class DynamicNew < ActiveRecord::Base
PLATFORMS = %w(educoder trusite ihub gcc openi toschina military jiaotong_university)
belongs_to :category

validates_presence_of :title, :simple_intruduce, :category_id

scope :desc, -> { order('id desc') }
scope :like, ->(q) { where("title LIKE ?", "#{q.to_s.strip.downcase}") unless q.blank? }
scope :by_category, ->(category_id) { where(category_id: category_id) }

def cover_url
cover_remote_url || "/images/dynamic_new/default.png"
end
end

+ 26
- 0
app/models/home.rb View File

@@ -0,0 +1,26 @@
class Home < ActiveRecord::Base
SHOW_CONTENT_LENGTH = 400
REG_URL_FORMAT = /(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:\/~\+#]*[\w\-\@?^=%&amp;\/~\+#])?/

has_one :cover, as: :coverable, dependent: :destroy
has_many :banners, dependent: :destroy

# validates_presence_of :name, :content, :frendly_id
# validates_format_of :friendly_id, :with => /\A[a-z0-9\-]+\z/

# before_validation :generate_friendly_id, :on => :create
validates_presence_of :name, :content

def more_content?
content.html_safe.length > Home::SHOW_CONTENT_LENGTH
end

def to_param
self.frendly_id
end

private
def generate_friendly_id
self.frendly_id ||= SecureRandom.uuid
end
end

+ 13
- 0
app/models/private_message.rb View File

@@ -0,0 +1,13 @@
class PrivateMessage < ActiveRecord::Base
# 私信
belongs_to :user
belongs_to :target, class_name: "User"
belongs_to :sender, class_name: "User"
belongs_to :receiver, class_name: "User"

#status 0表示未读,1表示已读,2表示已删除
scope :without_deleted, -> { where("status != 2") }
scope :only_unread, -> { where(status: 0) }


end

+ 15
- 12
app/models/project.rb View File

@@ -90,7 +90,7 @@ class Project < ActiveRecord::Base
# end # end
#ADDED BY NIE #ADDED BY NIE
has_one :project_score, :dependent => :destroy has_one :project_score, :dependent => :destroy
has_many :project_infos, :dependent => :destroy
has_many :project_infos, :dependent => :destroy
has_one :project_status, :class_name => "ProjectStatus", :dependent => :destroy has_one :project_status, :class_name => "ProjectStatus", :dependent => :destroy
has_many :user_grades, :class_name => "UserGrade", :dependent => :destroy has_many :user_grades, :class_name => "UserGrade", :dependent => :destroy
#end #end
@@ -106,7 +106,7 @@ class Project < ActiveRecord::Base
:order => "#{CustomField.table_name}.position", :order => "#{CustomField.table_name}.position",
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
:association_foreign_key => 'custom_field_id' :association_foreign_key => 'custom_field_id'
has_many :tags, :through => :project_tags, :class_name => 'Tag' has_many :tags, :through => :project_tags, :class_name => 'Tag'
has_many :project_tags, :class_name => 'ProjectTags' has_many :project_tags, :class_name => 'ProjectTags'
# 动态级联删除 # 动态级联删除
@@ -131,11 +131,11 @@ class Project < ActiveRecord::Base
:url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o}}, :url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o}},
:author => nil :author => nil
############################added by william ############################added by william
acts_as_taggable
acts_as_taggable
scope :by_join_date, order("created_on DESC") scope :by_join_date, order("created_on DESC")
###################added by liuping 关注 ###################added by liuping 关注
acts_as_watchable
acts_as_watchable
attr_protected :status attr_protected :status
validates_presence_of :name, :identifier validates_presence_of :name, :identifier
@@ -157,7 +157,7 @@ class Project < ActiveRecord::Base
#ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用 #ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?} after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
# 创建project之后默认创建一个board,之后的board去掉了board的概念 # 创建project之后默认创建一个board,之后的board去掉了board的概念
after_create :create_board_sync,:acts_as_forge_activities, :create_project_ealasticsearch_index
after_create :create_board_sync,:acts_as_forge_activities, :create_project_ealasticsearch_index, :sync_projects_count_to_home
before_destroy :delete_all_members,:delete_project_ealasticsearch_index before_destroy :delete_all_members,:delete_project_ealasticsearch_index
after_update :update_project_ealasticsearch_index after_update :update_project_ealasticsearch_index
@@ -173,7 +173,7 @@ class Project < ActiveRecord::Base
scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) } scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
scope :all_public, lambda { where(:is_public => true) } scope :all_public, lambda { where(:is_public => true) }
scope :visible, lambda {|*args| where(Project.visible_condition(args.shift || User.current, *args)) } scope :visible, lambda {|*args| where(Project.visible_condition(args.shift || User.current, *args)) }
scope :allowed_to, lambda {|*args|
scope :allowed_to, lambda {|*args|
user = User.current user = User.current
permission = nil permission = nil
if args.first.is_a?(Symbol) if args.first.is_a?(Symbol)
@@ -223,6 +223,10 @@ class Project < ActiveRecord::Base
) )
end end
def sync_projects_count_to_home
HomesService.new.sync_count('project', 1)
end
# 判断项目是否为实训项目 # 判断项目是否为实训项目
def is_training_project? def is_training_project?
(!self.enabled_modules.where("name = 'training_tasks'").empty? && self.training_status == 1) ? true : false (!self.enabled_modules.where("name = 'training_tasks'").empty? && self.training_status == 1) ? true : false
@@ -265,7 +269,7 @@ class Project < ActiveRecord::Base
pjfm.save pjfm.save
pjfm pjfm
end end
def self.add_new_jour(user, notes, id, options={}) def self.add_new_jour(user, notes, id, options={})
project = Project.find(id) project = Project.find(id)
if options.count == 0 if options.count == 0
@@ -844,7 +848,7 @@ class Project < ActiveRecord::Base
'attachmenttype', 'attachmenttype',
'enterprise_name', 'enterprise_name',
'gpid' 'gpid'
safe_attributes 'enabled_module_names', safe_attributes 'enabled_module_names',
@@ -1225,7 +1229,7 @@ class Project < ActiveRecord::Base
def update_position_under_parent def update_position_under_parent
set_or_update_position_under(parent) set_or_update_position_under(parent)
end end
def course def course
@course @course
end end
@@ -1258,7 +1262,7 @@ class Project < ActiveRecord::Base
def create_board_sync def create_board_sync
@board = self.boards.build @board = self.boards.build
@board.name = " #{l(:label_borad_project) }" @board.name = " #{l(:label_borad_project) }"
@board.description = self.name.to_s
@board.description = self.name.to_s
if @board.save if @board.save
logger.debug "[Project Model] ===> #{@board.to_json}" logger.debug "[Project Model] ===> #{@board.to_json}"
else else
@@ -1310,4 +1314,3 @@ class Project < ActiveRecord::Base
end end
#Project.where('is_public = 1').import :force=>true #Project.where('is_public = 1').import :force=>true

+ 6
- 0
app/models/school.rb View File

@@ -1,9 +1,15 @@
class School < ActiveRecord::Base class School < ActiveRecord::Base
attr_accessible :name, :province,:pinyin attr_accessible :name, :province,:pinyin
after_create :sync_schools_count_to_home

has_many :courses has_many :courses


def to_s def to_s
self.name.to_s self.name.to_s
end end


def sync_schools_count_to_home
HomesService.new.sync_count('school', 1)
end

end end

+ 177
- 26
app/models/user.rb View File

@@ -22,7 +22,7 @@ class User < Principal
STUDENT = 1 STUDENT = 1
ENTERPRISE = 2 ENTERPRISE = 2
DEVELOPER = 3 DEVELOPER = 3
include Redmine::SafeAttributes include Redmine::SafeAttributes
seems_rateable_rater seems_rateable_rater
#elasticsearch #elasticsearch
@@ -137,12 +137,16 @@ class User < Principal
has_many :versions, :dependent => :destroy has_many :versions, :dependent => :destroy
has_many :organizations, :through => :org_members has_many :organizations, :through => :org_members
# belongs_to :ucourse, :class_name => 'Course', :foreign_key => :id #huang # belongs_to :ucourse, :class_name => 'Course', :foreign_key => :id #huang
## added by xianbo for delete
## added by xianbo for delete
# has_many :biding_projects, :dependent => :destroy # has_many :biding_projects, :dependent => :destroy
belongs_to :softapplication, :foreign_key => 'id', :dependent => :destroy belongs_to :softapplication, :foreign_key => 'id', :dependent => :destroy
##ended by xianbo ##ended by xianbo
#####fq #####fq
# 新版私信
has_many :private_messages, dependent: :destroy
has_many :recent_contacts, through: :private_messages, source: :target
has_many :jours, :class_name => 'JournalsForMessage', :dependent => :destroy has_many :jours, :class_name => 'JournalsForMessage', :dependent => :destroy
has_many :journals_messages, :class_name => 'JournalsForMessage', :foreign_key => "user_id", :dependent => :destroy has_many :journals_messages, :class_name => 'JournalsForMessage', :foreign_key => "user_id", :dependent => :destroy
# has_many :bids, :foreign_key => 'author_id', :dependent => :destroy # has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
@@ -206,15 +210,15 @@ class User < Principal
scope :visible, lambda {|*args| scope :visible, lambda {|*args|
nil nil
} }
acts_as_attachable :view_permission => :view_files, acts_as_attachable :view_permission => :view_files,
:delete_permission => :manage_files :delete_permission => :manage_files
acts_as_customizable acts_as_customizable
############################added by william ############################added by william
acts_as_taggable
acts_as_taggable
scope :by_join_date, order("created_on DESC") scope :by_join_date, order("created_on DESC")
############################# added by liuping 关注 ############################# added by liuping 关注
acts_as_watchable
acts_as_watchable
has_one :user_extensions,:dependent => :destroy has_one :user_extensions,:dependent => :destroy
has_one :homepage, :dependent => :destroy has_one :homepage, :dependent => :destroy
@@ -262,7 +266,7 @@ class User < Principal
before_save :update_hashed_password before_save :update_hashed_password
before_destroy :remove_references_before_destroy,:delete_user_ealasticsearch_index before_destroy :remove_references_before_destroy,:delete_user_ealasticsearch_index
# added by fq # added by fq
after_create :add_onclick_time, :act_as_principal_activity,:create_user_ealasticsearch_index,:add_new_jour
after_create :add_onclick_time, :act_as_principal_activity,:create_user_ealasticsearch_index,:add_new_jour, :sync_to_home
# end # end
# 更新邮箱用户或用户名的同事,同步更新邀请信息 # 更新邮箱用户或用户名的同事,同步更新邀请信息
after_update :update_user_ealasticsearch_index after_update :update_user_ealasticsearch_index
@@ -324,6 +328,11 @@ class User < Principal
) )
end end
# 同步新增首页的社区用户量
def sync_to_home
HomesService.new.sync_count('user', 1)
end
# ====================================================================== # ======================================================================
def my_workplace def my_workplace
self.user_extensions.try(:occupation).to_s self.user_extensions.try(:occupation).to_s
@@ -336,6 +345,24 @@ class User < Principal
(self.login.to_i.to_s == self.login || self.login.include?(".") || self.login.include?("%") || self.login.include?("?")) ? id : login (self.login.to_i.to_s == self.login || self.login.include?(".") || self.login.include?("%") || self.login.include?("?")) ? id : login
end end
def check_user_him(user_id)
if id == user_id
"我"
else
"TA"
end
end
def get_user_contact_messages(user_id)
private_messages.where(target_id: user_id).size
end
#判断是否可以点击项目或issue
def user_can_see_project(target)
return false if target.blank?
self.admin? || target.is_public || target.user_id == id || User.current.member_of?(target)
end
def my_blogs_count def my_blogs_count
self.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count self.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count
@@ -386,14 +413,97 @@ class User < Principal
@base_homepage @base_homepage
end end
def get_user_projects
projects.order("updated_on desc")
end
#未解决的issue
def user_unsolve_issues
Issue.where(:assigned_to_id => id, :status_id => [1, 2, 4, 6]).includes(:author, :project).order("updated_on desc")
end
def project_relate_messages
sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id
left join `applied_messages` apm on ma.message_id=apm.id
where (ma.user_id =#{id} and ma.message_type = 'ForgeMessage' and fm.user_id=#{id} and fm.forge_message_type != 'News') or
(ma.user_id=#{id} and ma.message_type='AppliedMessage' and apm.applied_type = 'AppliedProject' and apm.user_id =#{id}) ORDER BY ma.created_at desc;"
MessageAll.find_by_sql(sql)
end
#未处理的消息通知
def user_unsolve_messages
sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id
left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id
where (ma.user_id =#{id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{id}) or
(ma.user_id=#{id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{id} and apm.status =0) or
(ma.user_id=#{id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{id}) ORDER BY ma.created_at desc;"
MessageAll.find_by_sql(sql)
end
def get_user_course_ids #获取用户的全部课堂id
StudentsForCourse.includes(:course).where("student_id = #{id} and courses.is_delete = 0").map{|sf| sf.try(:course_id)}
end
def user_undo_homeworks
user_course_ids = get_user_course_ids #学生的全部课堂
publish_homeworks = HomeworkCommon.where(course_id: user_course_ids)&.where("publish_time <= '#{Time.now}'") #已发布的作业
publish_homeworks_ids = publish_homeworks.pluck(:id)
user_homeworks = student_works&.where(homework_common_id: publish_homeworks_ids)
finished_user_homework_ids = user_homeworks&.where("work_status != 0").pluck(:homework_common_id) #用户已完成的作业
publish_homeworks.where(id: (publish_homeworks_ids - finished_user_homework_ids)).order("updated_at desc")
end
#待完成测验
def user_undo_tests
user_course_ids = get_user_course_ids #学生的全部课堂
publish_exercises = Exercise.where(course_id: user_course_ids, exercise_status: 2) #已发布的作业
publish_exercises_ids = publish_exercises.pluck(:id).uniq
finished_user_exercises_ids = exercise_user&.where(exercise_id: publish_exercises_ids, commit_status: 1).pluck(:exercise_id).uniq
publish_exercises.where(id: (publish_exercises_ids - finished_user_exercises_ids)).order("updated_at desc")
end
#待完成的问卷
def user_undo_polls
user_course_ids = get_user_course_ids #学生的全部课堂
publish_polls = Poll.where(polls_type: "Course",polls_group_id: user_course_ids, polls_status: 2)
publish_polls_ids = publish_polls.pluck(:id).uniq
finished_user_polls_ids = poll_users&.where(poll_id: publish_polls_ids).pluck(:poll_id).uniq
publish_polls.where(id: (publish_polls_ids - finished_user_polls_ids)).order("updated_at desc")
end
#待完成的匿评作品
def user_undo_anonymous
user_course_ids = get_user_course_ids #学生的全部课堂
homework_anonymous_works = HomeworkCommon.where(course_id: user_course_ids).includes(:homework_detail_manual).where("homework_detail_manuals.comment_status in (1,2)")
homework_ids = homework_anonymous_works.map{|h| h.try(:id)}
user_student_work_scores = student_works_scores.where(reviewer_role: 3)
anonymous_evaluation_ids = user_student_work_scores.blank? ? "(-1)" : "(#{user_student_work_scores.pluck(:student_work_id).join(",")})"
unfinished_evaluations_work_ids = student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}").pluck(:student_work_id)
homework_ids = StudentWork.where(id: unfinished_evaluations_work_ids, homework_common_id: homework_ids ).pluck(:homework_common_id)
homework_anonymous_works.where(id: homework_ids)
end
#用户的待办事项计数,包括通知和issue的数量
def count_undo_items
issues_count = user_unsolve_issues.count
apply_messages_count = user_unsolve_messages.count
undo_homeworks_count = user_undo_homeworks.size
undo_tests_count = user_undo_tests.size
undo_polls_count = user_undo_polls.size
undo_anonymous_count = user_undo_anonymous.size
issues_count + apply_messages_count + undo_homeworks_count + undo_tests_count + undo_polls_count + undo_anonymous_count
end
# 查询指派给我的缺陷记录 # 查询指派给我的缺陷记录
def count_new_issue_assign_to def count_new_issue_assign_to
self.issue_assigns self.issue_assigns
end end
# 新消息统计
def count_new_message
if OnclickTime.where("user_id =?", User.current).first.nil?
# 新消息统计,
def count_new_message(type)
message_new_time = OnclickTime.where("user_id =?", User.current).first
if message_new_time.nil?
message_new_time = OnclickTime.new message_new_time = OnclickTime.new
message_new_time.user_id = User.current.id message_new_time.user_id = User.current.id
# 第一次初始化点击铃铛时间 # 第一次初始化点击铃铛时间
@@ -403,17 +513,58 @@ class User < Principal
user = User.current user = User.current
onclick_time = user.onclick_time.onclick_time onclick_time = user.onclick_time.onclick_time
delete_courses = Course.where(:is_delete => 1).blank? ? "(-1)" : "(" + Course.where(:is_delete => 1).map(&:id).join(",") + ")" delete_courses = Course.where(:is_delete => 1).blank? ? "(-1)" : "(" + Course.where(:is_delete => 1).map(&:id).join(",") + ")"
course_count = CourseMessage.where("user_id =? and viewed =? and created_at >? and course_id not in #{delete_courses}", user.id, 0, onclick_time).count
contest_count = ContestMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
system_messages_count = SystemMessage.where("created_at >?", onclick_time).count
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count
applied_count = AppliedMessage.where("user_id=? and viewed =? and created_at >?", user.id, 0, onclick_time).count
blog_message_count = BlogMessage.where("user_id=? and viewed=? and created_at >?", user.id, 0, onclick_time).count
messages_count = course_count + contest_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count + blog_message_count
course_messages = CourseMessage.where("user_id =? and viewed =? and created_at >? and course_id not in #{delete_courses}", user.id, 0, onclick_time)
course_count = course_messages.size
contest_messages = ContestMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time)
contest_count = contest_messages.count
forge_messages = ForgeMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time)
forge_count = forge_messages.count
user_feedbacks = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time)
user_feedback_count = user_feedbacks.count
user_memos = MemoMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time)
user_memo_count = user_memos.count
system_messages = SystemMessage.where("created_at >?", onclick_time)
system_messages_count = system_messages.count
at_messages = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time)
at_count = at_messages.count
org_messages = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time)
org_count = org_messages.count
applied_messages = AppliedMessage.where("user_id=? and viewed =? and created_at >?", user.id, 0, onclick_time)
applied_count = applied_messages.count
blog_messages = BlogMessage.where("user_id=? and viewed=? and created_at >?", user.id, 0, onclick_time)
blog_message_count = blog_messages.count
user_private_messages = PrivateMessage.where("user_id=? and status=?",user.id, 0)
private_messages_count = user_private_messages.size
if type != "all"
Rails.logger.info("######________type__________##########{type}")
message_new_time.update_attribute(:onclick_time, Time.now)
course_messages.update_all(:viewed => true) unless course_messages.nil?
forge_messages.update_all(:viewed => true) unless forge_messages.nil?
user_feedbacks.update_all(:viewed => true) unless user_feedbacks.nil?
user_memos.update_all(:viewed => true) unless user_memos.nil?
org_messages.update_all(:viewed => true) unless org_messages.nil?
at_messages.update_all(:viewed => true) unless at_messages.nil?
contest_messages.update_all(:viewed => true) unless contest_messages.nil?
blog_messages.update_all(:viewed => true) unless blog_messages.nil?
applied_messages.update_all(:viewed => true) unless applied_messages.nil?
end
messages_count = course_count + contest_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count + blog_message_count + private_messages_count
end
#未读私信数量
def unread_private_messages
private_messages.where(status: 0).size
end end
# 查询指派给我的缺陷记录 # 查询指派给我的缺陷记录
@@ -447,18 +598,18 @@ class User < Principal
end end
info info
end end
###添加留言 fq ###添加留言 fq
def add_jour(user, notes, reference_user_id = 0, options = {}) def add_jour(user, notes, reference_user_id = 0, options = {})
if options.count == 0 if options.count == 0
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id, :status => true, :is_readed => false) self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id, :status => true, :is_readed => false)
else
else
jfm = self.journals_for_messages.build(options) jfm = self.journals_for_messages.build(options)
jfm.save jfm.save
jfm jfm
end end
end end
### fq ### fq
def join_in?(course) def join_in?(course)
joined = StudentsForCourse.where('student_id = ? and course_id = ?', self.id, course.id) joined = StudentsForCourse.where('student_id = ? and course_id = ?', self.id, course.id)
@@ -468,7 +619,7 @@ class User < Principal
false false
end end
end end
def show_name def show_name
name = lastname + firstname name = lastname + firstname
name.empty? || name.nil? ? login : name name.empty? || name.nil? ? login : name
@@ -485,12 +636,12 @@ class User < Principal
name = show_name name = show_name
(name != self.login) ? "#{name} #{self.login}" : name (name != self.login) ? "#{name} #{self.login}" : name
end end
#added by nie #added by nie
def count_new_journal_reply def count_new_journal_reply
count = self.journal_reply.count count = self.journal_reply.count
end end
def set_mail_notification def set_mail_notification
##add byxianbo ##add byxianbo
thread=Thread.new do thread=Thread.new do


+ 12
- 1
app/models/web_footer_company.rb View File

@@ -1,8 +1,19 @@
class WebFooterCompany < ActiveRecord::Base class WebFooterCompany < ActiveRecord::Base
attr_accessible :logo_size, :name, :url
# key字段说明:
# partner:网站页脚合作单位(管理员页面页脚), dedicator: 首页技术合作单位; opensource: 首页共建开源单位
RELATION_TYPE = %w(partner dedicator opensource)
acts_as_list
attr_accessible :logo_size, :name, :url, :position, :move_to, :key
validates :name, presence: true, length: { maximum: 500 } validates :name, presence: true, length: { maximum: 500 }
validates :key, inclusion: { in: %w(partner dedicator opensource), message: "%{value} is not a valid value." }
validates :url, length: { maximum: 500 }, validates :url, length: { maximum: 500 },
format: { with: /(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:\/~\+#]*[\w\-\@?^=%&amp;\/~\+#])?/, format: { with: /(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:\/~\+#]*[\w\-\@?^=%&amp;\/~\+#])?/,
message: :invalid message: :invalid
} }
scope :desc, -> { order('position ASC') }
scope :partners, -> { desc.where(:key => 'partner') }
scope :dedicators, -> { desc.where(:key => 'dedicator') }
scope :opensources, -> { desc.where(:key => 'opensource') }
end end

+ 9
- 0
app/services/dynamic_news_service.rb View File

@@ -0,0 +1,9 @@
class DynamicNewsService
def sync(news_params)
if news_params["category_id"].blank?
default_category = Category.find_by_name "社区动态"
news_params = news_params.merge({category_id: default_category&.id})
end
DynamicNew.create!(news_params)
end
end

+ 15
- 0
app/services/homes_service.rb View File

@@ -0,0 +1,15 @@
class HomesService
def sync_count(type, sync_count)
home = Home.first
case type
when "user"
home.update_attributes!(users_count: home.users_count + sync_count)
when "project"
home.update_attributes!(projects_count: home.projects_count + sync_count)
when 'school'
home.update_attributes!(scholls_count: home.scholls_count + sync_count)
when "practical_training_project"
home.update_attributes!(practical_training_projects_count: home.practical_training_projects_count + sync_count)
end
end
end

+ 0
- 488
app/views/account/_introduce.html.erb View File

@@ -1,488 +0,0 @@
<% if false %>
<div>
<div class="clearfix homepage_banner">
<p class="fl">
<span class="f32">Trustie</span>
<span class="fw400 ml20" style="line-height: 70px">持续构建协同、共享、可信的软件创新生态系统</span>
</p>
<ul class="fr homepage_banner_nav">
<li>
<a href="javascript:void(0)">开源托管平台</a>
</li>
<li>
<a href="javascript:void(0)">智能学习平台</a>
</li>
<li>
<a href="javascript:void(0)">资源共享平台</a>
</li>
<li>
<a href="javascript:void(0)">众包学习平台</a>
</li>
</ul>
</div>
<div class="pr mt60 banner">
<ul class="img">
<li><a href="javascript:void(0)"><img src="/images/introduce/trustie8_01.jpg"/></a></li>
</ul>
</div>
<div class="homepage_activity">
<div class="mr35">
<img src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2634306427,1511025022&fm=26&gp=0.jpg" class="mb25" width="592px" height="226px" />
<p class="f26 lh26 color-grey3 mb15">关于Trustie</p>
<p class="f16 c_grey02 break_full_word">
Trustie社区力争打造全球领先的群体协同创新平台,已建成协同开发创新、资源汇聚评估与智能学习实践三大平台,持续激发汇聚互联网上自治分散的海量智力资源,为全球软件创新生态助力赋能。
Trustie社区及其核心技术,直接支持了国家9个软件园区创新平台的建设,服务于2500余家中小型软件企业研发和5000余个创新项目孵化,以及600多所大学软件开发人才培养,
已成为国家新一代人工智能发展规划重点开源社区和国家绿色计算基础软硬件开源社区的基础设施,直接推动了我国开源软件生态的快速构建。
</p>
<a href="JavaScript:void(0)" class="homepage_activity_more">MORE<span>→</span></a>
</div>
<div>
<p class="clearfix mb10">
<span class="f26 lh26 color-grey3 fl mt3">社区动态</span>
<a href="javaScript:void(0)" class="fr fontGrey4 mt8">更多>></a>
</p>
<div class="homepage_activity_list">
<div class="homepage_activity_list_item">
<div>
<p class="f18 mb15 lh20 color-grey3">工业互联网体系架构2.0</p>
<p class="f13 mb8 c_grey02 task-hide-2" style="height: 38px;">网易考拉是网易在 2015 年 1 月上线公测的一项跨境电商业务,该业务一开始的品牌名称为 “考拉海购”。</p>
<p>
<span class="activity_tag">行业动态</span>
<span class="fontGrey4 ml14 fl"><i class="iconfont icon-shijian f12 mr5 lh18 fl"></i>2019-10-09</span>
</p>
</div>
<img src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2634306427,1511025022&fm=26&gp=0.jpg" class="ml20" width="158px" height="100px" />
</div>
<div class="homepage_activity_list_item">
<div>
<p class="f18 mb15 lh20 color-grey3">工业互联网体系架构2.0</p>
<p class="f13 mb8 c_grey02 task-hide-2" style="height: 38px;">网易考拉是网易在 2015 年 1 月上线公测的一项跨境电商业务,该业务一开始的品牌名称为 “考拉海购”。</p>
<p>
<span class="activity_tag">行业动态</span>
<span class="fontGrey4 ml14 fl"><i class="iconfont icon-shijian f12 mr5 lh18 fl"></i>2019-10-09</span>
</p>
</div>
<img src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2634306427,1511025022&fm=26&gp=0.jpg" class="ml20" width="158px" height="100px" />
</div>
<div class="homepage_activity_list_item">
<div>
<p class="f18 mb15 lh20 color-grey3">工业互联网体系架构2.0</p>
<p class="f13 mb8 c_grey02 task-hide-2" style="height: 38px;">网易考拉是网易在 2015 年 1 月上线公测的一项跨境电商业务,该业务一开始的品牌名称为 “考拉海购”。</p>
<p>
<span class="activity_tag">行业动态</span>
<span class="fontGrey4 ml14 fl"><i class="iconfont icon-shijian f12 mr5 lh18 fl"></i>2019-10-09</span>
</p>
</div>
<img src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2634306427,1511025022&fm=26&gp=0.jpg" class="ml20" width="158px" height="100px" />
</div>
<div class="homepage_activity_list_item">
<div>
<p class="f18 mb15 lh20 color-grey3">工业互联网体系架构2.0</p>
<p class="f13 mb8 c_grey02 task-hide-2" style="height: 38px;">网易考拉是网易在 2015 年 1 月上线公测的一项跨境电商业务,该业务一开始的品牌名称为 “考拉海购”。</p>
<p>
<span class="activity_tag">行业动态</span>
<span class="fontGrey4 ml14 fl"><i class="iconfont icon-shijian f12 mr5 lh18 fl"></i>2019-10-09</span>
</p>
</div>
<img src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2634306427,1511025022&fm=26&gp=0.jpg" class="ml20" width="158px" height="100px" />
</div>
</div>
</div>
</div>
<div class="homepage_introduce">
<ul>
<li class="active">
<div>
<img src="/images/nav_logo.png" width="50" class="mb40">
<p class="f18">TrustieForge</p>
</div>
</li>
<li>
<div>
<img src="/images/introduce/edulogo.png" width="50" class="mb15">
<p class="f18">TrustieEduCode</p>
<p class="f16 mb20">智能学习平台</p>
<p class="f12">实现实践教学的课程软件化、过程游戏化、<br/>环境生产化和评测全栈化</p>
</div>
</li>
<li>
<div>
<p class="f28 mb50">OSSEAN</p>
<p class="f18">TrustieOSSEAN</p>
</div>
</li>
<li>
<div>
<p class="f18">TrustieCoderpedia</p>
</div>
</li>
</ul>
</div>
<div class="homepage_introduce_content">
<div class="homepage_introduce_trustieForge homepage_introduce_content_item active">
<div class="cartoonTitle">
<p class="f20 mb20">协同开发平台</p>
<p class="f16 color-grey3 mb50">支撑国家9个软件园区创新平台,服务2500余家中小型软件企业研发</p>
</div>
<ul class="cartoon">
<li class="plateContainer">
<div class="plate_before">
<div>
<p><i class="iconfont icon-menu_date colorWhite f40"></i></p>
<span class="content_span">项目管理</span>
</div>
</div>
<div class="plate_back">
<div>
<p><i class="iconfont icon-menu_date colorWhite f40"></i></p>
<span class="f20 lh20 mt10">项目管理</span>
<p class="lh20 mt60 mb80 f14 justify" style="height: 60px;">项目进程管理应用于研发管理、任务分配、目标跟踪等让项目管理流程高效完成。</p>
<a href="javascript:void(0)" class="homepage_detailBtn">查看详情</a>
</div>
</div>
</li>
<li class="plateContainer">
<div class="plate_before">
<div>
<p><i class="iconfont icon-menu_date colorWhite f40"></i></p>
<span class="content_span">代码托管</span>
</div>
</div>
<div class="plate_back">
<div>
<p><i class="iconfont icon-menu_date colorWhite f40"></i></p>
<span class="f20 lh20 mt10">代码托管</span>
<p class="lh20 mt60 mb80 f14 justify" style="height: 60px;">基于Git的代码托管,提供高性能远端仓库,可保护分支、历史版本比对等高级功能。</p>
<a href="javascript:void(0)" class="homepage_detailBtn">查看详情</a>
</div>
</div>
</li>
<li class="plateContainer">
<div class="plate_before">
<div>
<p><i class="iconfont icon-menu_date colorWhite f40"></i></p>
<span class="content_span">质量检测</span>
</div>
</div>
<div class="plate_back">
<div>
<p><i class="iconfont icon-menu_date colorWhite f40"></i></p>
<span class="f20 lh20 mt10">质量检测</span>
<p class="lh20 mt60 mb80 f14 justify" style="height: 60px;">采用一定检验测试手段和检查方法测定代码质量。</p>
<a href="javascript:void(0)" class="homepage_detailBtn">查看详情</a>
</div>
</div>
</li>
<li class="plateContainer">
<div class="plate_before">
<div>
<p><i class="iconfont icon-menu_date colorWhite f40"></i></p>
<span class="content_span">交流社区</span>
</div>
</div>
<div class="plate_back">
<div>
<p><i class="iconfont icon-menu_date colorWhite f40"></i></p>
<span class="f20 lh20 mt10">交流社区</span>
<p class="lh20 mt60 mb80 f14 justify" style="height: 60px;">提供给IT开发者资源分享、学习交流、了解Trustie的社区。</p>
<a href="javascript:void(0)" class="homepage_detailBtn">查看详情</a>
</div>
</div>
</li>
</ul>
</div>
<div class="homepage_introduce_trustieEduCode homepage_introduce_content_item">
<div class="trustieEduCode_container">
</div>
</div>
<div class="homepage_introduce_ossean homepage_introduce_content_item"></div>
<div class="homepage_introduce_trustieCoderpedia homepage_introduce_content_item"></div>
</div>
</div>
<%end %>
<div class="content_Intruduce">
<div class="in_head">
<p class="in_head_rederect">
<% if User.current.logged? %>
<a href="<%= user_path(User.current) %>" target="_blank" class="rightline">TrustieForge</a>
<% else %>
<a href="<%= signin_url() %>" target="_blank" class="rightline">TrustieForge</a>
<% end %>
<a href="http://ossean.trustie.net/" target="_blank" class="rightline">TrustieOSSEAN</a>
<a href="http://www.educoder.net" target="_blank" class="rightline">TrustieEduCoder</a>
<a href="http://codepedia.trustie.net/" target="_blank">TrustieCoderpedia</a>
</p>
</div>
<div class="in_second in_panel">
<img src="/images/introduce/trustielogo_word.png" width="255px" height="45px" class="mb20">
<p class="f28 mb12">TruestieForge</p>
<p class="mb30"><span class="blueUnderLine">协同开发平台</span></p>
<p class="mb40 c_grey02 f16">支撑国家9个软件园区创新平台,服务2500余家中小型软件企业研发</p>
<div class="forgeList">
<div class="inline">
<a href="<%= user_path(User.current) %>" target="_blank" class="forgeListItem">
<div>
<div class="imgPart">
<div>
<img src="/images/introduce/issue.png" width="52">
<p>项目管理</p>
</div>
</div>
<p class="fontPanel">
<span>项目进程管理应用于研发管理、任务分配、目标跟踪等让项目管理流程高效完成。</span>
</p>
</div>
</a>
<a href="<%= user_path(User.current) %>" target="_blank" class="forgeListItem">
<div>
<div class="imgPart">
<div>
<img src="/images/introduce/lichengbei.png" width="52">
<p>代码托管</p>
</div>
</div>
<p class="fontPanel">
<span>基于Git的代码托管,提供高性能远端仓库,可保护分支、历史版本比对等高级功能。</span>
</p>
</div>
</a>
<a href="<%= user_path(User.current) %>" target="_blank" class="forgeListItem">
<div>
<div class="imgPart">
<div>
<img src="/images/introduce/zhiliang.png" width="52">
<p>质量检测</p>
</div>
</div>
<p class="fontPanel">
<span>采用一定检验测试手段和检查方法测定代码质量。</span>
</p>
</div>
</a>
<a href="<%= user_path(User.current) %>" target="_blank" class="forgeListItem">
<div>
<div class="imgPart">
<div>
<img src="/images/introduce/jiaoliu.png" width="52">
<p>交流社区</p>
</div>
</div>
<p class="fontPanel">
<span>提供给IT开发者资源分享、学习交流、了解Trustie的社区。</span>
</p>
</div>
</a>
</div>
</div>
</div>
<div class="in_third">
<div>
<img src="/images/nav_logo.png" width="50" class="mb20">
<img src="/images/introduce/edulogo.png" width="50" class="ml20 mb20">
<p class="f28 mb12 colorWhite">TrustieEduCoder</p>
<p class="mb30"><span class="blueUnderLine" style="color: #fff;">智能学习平台</span></p>
<p class="mb40 colorWhite f16">600多所大学参与共建共享,支持全技术栈的实验和实训教学</p>
<div class="clearfix third_main_part">
<div class="img_box">
<img src="/images/introduce/computer.png" width="100%" class="img0"/>
<img src="/images/introduce/lesson.png" width="100%" class="img1 none"/>
<img src="/images/introduce/game.png" width="100%" class="img2 none"/>
<img src="/images/introduce/homework.png" width="100%" class="img3 none"/>
<img src="/images/introduce/Engineering.png" width="100%" class="img4 none"/>
</div>
<div class="introduce_box">
<a href="http://www.educoder.net" target="_blank" class="sub_box active">
<img src="/images/introduce/3-1-1.png" width="46" height="40" class="img1"/>
<img src="/images/introduce/3-1-2.png" width="46" height="40" class="img2"/>
<div class="sub_box_font">
<p class="mb10 f20">实训课程</p>
<p><span>实现实践教学的课程软件化、过程游戏化、环境生产化和评测全栈化</span></p>
</div>
</a>
<a href="http://www.educoder.net" target="_blank" class="sub_box">
<img src="/images/introduce/3-2-1.png" width="46" height="44" class="img1"/>
<img src="/images/introduce/3-2-2.png" width="46" height="44" class="img2"/>
<div class="sub_box_font">
<p class="mb10 f20">翻转课堂</p>
<p><span>支持老师在线建立课堂,发布任务,学生完成任务,提交作业等各类教学场景</span></p>
</div>
</a>
<a href="http://www.educoder.net" target="_blank" class="sub_box">
<img src="/images/introduce/3-3-1.png" width="43" height="41" class="img1"/>
<img src="/images/introduce/3-3-2.png" width="43" height="41" class="img2"/>
<div class="sub_box_font">
<p class="mb10 f20">竞赛活动</p>
<p><span>汇集以高校竞赛为主,活动、社区为辅的竞赛活动平台</span></p>
</div>
</a>
<a href="http://www.educoder.net" target="_blank" class="sub_box">
<img src="/images/introduce/3-4-1.png" width="39" height="39" class="img1"/>
<img src="/images/introduce/3-4-2.png" width="39" height="39" class="img2"/>
<div class="sub_box_font">
<p class="mb10 f20">作业查重</p>
<p><span>把好学生“质量关”,为高校教师提供教学过程中课程作业的查重服务</span></p>
</div>
</a>
<a href="http://www.educoder.net" target="_blank" class="sub_box">
<img src="/images/introduce/3-5-1.png" width="48" height="45" class="img1"/>
<img src="/images/introduce/3-5-2.png" width="48" height="45" class="img2"/>
<div class="sub_box_font">
<p class="mb10 f20">工程教育</p>
<p><span>达成度自动计算,自评报告一键导出,切实提升相关工程技术人才从业教育质量</span></p>
</div>
</a>
</div>
</div>
</div>
</div>
<div class="in_fourth">
<div>
<img src="/images/introduce/trustielogo.png" width="50" class="mb20">
<p class="f28 mb12">TruestieOSSEAN</p>
<p class="mb30"><span class="blueUnderLine">资源共享平台</span></p>
<p class="mb40 c_grey02 f16">统计分析392个开源项目,汇聚超过600TB软件开发数据和应用数据</p>
<div class="forgeList">
<div class="inline">
<a href="http://ossean.trustie.net/" target="_blank" class="osseanListItem">
<div class="df">
<p class="img-ring"><img src="/images/introduce/guanlian.png" width="60"></p>
<div class="right_font">
<div style="width: 100%">
<p class="mb20 f22" style="color: #373D41">多源关联与反馈</p>
<p class="c_grey02 f16"><span>对多源数据进行检测、关联、组合、反馈的过程</span></p>
</div>
</div>
</div>
</a>
<a href="http://ossean.trustie.net/" target="_blank" class="osseanListItem">
<div class="df">
<p class="img-ring"><img src="/images/introduce/pinggu.png" width="60"></p>
<div class="right_font">
<div style="width: 100%">
<p class="mb20 f22" style="color: #373D41">多维评估</p>
<p class="c_grey02 f16"><span>从互联网到资源库,从主观到客观的多维度评估</span></p>
</div>
</div>
</div>
</a>
<a href="http://ossean.trustie.net/" target="_blank" class="osseanListItem">
<div class="df">
<p class="img-ring"><img src="/images/introduce/ziyuan.png" width="60"></p>
<div class="right_font">
<div style="width: 100%">
<p class="mb20 f22" style="color: #373D41">资源排行和推荐</p>
<p class="c_grey02 f16"><span>开源软件排行榜及相关软件推荐</span></p>
</div>
</div>
</div>
</a>
<a href="http://ossean.trustie.net/" target="_blank" class="osseanListItem">
<div class="df">
<p class="img-ring"><img src="/images/introduce/fenxi.png" width="60"></p>
<div class="right_font">
<div style="width: 100%">
<p class="mb20 f22" style="color: #373D41">分析工具</p>
<p class="c_grey02 f16"><span>结合缺陷检测、代码风格、测试覆盖率和注释率等整体分析</span></p>
</div>
</div>
</div>
</a>
</div>
</div>
</div>
</div>
<div class="in_fifth">
<div>
<img src="/images/nav_logo.png" width="50" class="mb20">
<p class="f28 mb12 colorWhite">TrustieCodepedia</p>
<p class="mb30"><span class="whiteUnderLine" style="color: #fff;">众包学习平台</span></p>
<p class="mb40 colorWhite f16">提供实验数据集给智能化软件开发技术研究和基准软件推荐</p>
<div class="educoderList">
<a href="http://codepedia.trustie.net/" target="_blank" class="educoderItem">
<div>
<span class="white_ring"><img src="/images/introduce/biaozhu.png" width="50"/></span>
<p class="f22 colorWhite mb20">标注引导</p>
<span style="color: #DDCDFF">高质量代码标注<br/>提升代码可理解性</span>
</div>
</a>
<a href="http://codepedia.trustie.net/" target="_blank" class="educoderItem">
<div>
<span class="white_ring"><img src="/images/introduce/qunti.png" width="50"/></span>
<p class="f22 colorWhite mb20">群体标注</p>
<span style="color: #DDCDFF">提供开源项目群体标注<br/>方便团队理解和查看</span>
</div>
</a>
<a href="http://codepedia.trustie.net/" target="_blank" class="educoderItem">
<div>
<span class="white_ring"><img src="/images/introduce/fankui.png" width="50"/></span>
<p class="f22 colorWhite mb20">反馈修正</p>
<span style="color: #DDCDFF">及时的反馈机制<br/>指出瑕疵并进行改进和修正</span>
</div>
</a>
</div>
</div>
</div>
<div class="in_sixth in_panel" style="padding-bottom: 40px;">
<p class="mb30 f28">合作机构</p>
<div class="clearfix partnerInfo">
<a href="https://www.ccf.org.cn/" target="_blank">
<div>
<span class="imgLoGO"><img src="/images/introduce/CCF.png" /></span>
<span class="name">中国计算机学会</span>
</div>
</a>
<a href="http://www.cmooc.cn/" target="_blank">
<div>
<span class="imgLoGO"><img src="/images/introduce/MOOC.png" /></span>
<span class="name">MOOC联盟</span>
</div>
</a>
<a href="http://opengcc.org/" target="_blank">
<div>
<span class="imgLoGO"><img src="/images/introduce/openGCC.png" /></span>
<span class="name">绿色计算产业联盟</span>
</div>
</a>
<a href="http://xgk.csia.org.cn/" target="_blank">
<div>
<span class="imgLoGO"><img src="/images/introduce/EEE.png" /></span>
<span class="name">新工科联盟</span>
</div>
</a>
<a href="http://www.educg.net.cn/" target="_blank">
<div>
<span class="imgLoGO"><img src="/images/introduce/CG.png" /></span>
<span class="name">新一代人工智能</span>
</div>
</a>
<a href="http://www.iscas.ac.cn/" target="_blank">
<div>
<span class="imgLoGO"><img src="/images/introduce/ISCAS.png" style="margin-top: 26px;" /></span>
<span class="name">中国科学院软件研究所</span>
</div>
</a>
</div>
</div>
</div>
<script>
$(function(){
$(".sub_box").hover(function(){
$(".sub_box").removeClass("active");
$(this).addClass("active");
var index = $(this).index();
$(".img_box img").addClass("none");
$(".img_box").find(".img"+index).removeClass("none");
})
})
</script>

+ 66
- 0
app/views/admin/_dynamic_news.html.erb View File

@@ -0,0 +1,66 @@
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 15px;">
序号
</th>
<th style="width: 40px;">
封面
</th>
<th style="width: 60px;">
标题
</th>
<th style="width: 60px;" class = "">
简介
</th>
<th style="width: 60px;" class = "">
所属分类
</th>
<th style="width: 50px;">
创建时间
</th>
<th style="width: 80px;">
</th>
</tr>
</thead>
<tbody>
<% @count= @page * 15 %>
<% @dynamic_news.each do |dynamic_new| %>
<tr class="<%= cycle("odd", "even") %>">
<!td style="text-align:center;vertical-align: middle;">
<!%= dynamic_new.id %>
<% @count +=1 %>
<td align="center">
<%=@count %>
</td>

<td align="center">
<%= image_tag(dynamic_new.cover_url, width:40, height:40) %>
<!%= dynamic_new.title %>
</td>

<td style="text-align:center;vertical-align: middle;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=dynamic_new.title%>'>
<span>
<%= link_to dynamic_new.title, dynamic_new.remote_url %>
</span>
</td>
<td style="vertical-align: middle;text-align:center">
<%= truncate(dynamic_new.simple_intruduce, :length => 30) %>
</td>
<td style="vertical-align: middle;text-align:center">
<%= dynamic_new.category&.name %>
</td>
<td style="vertical-align: middle;text-align:center">
<%= format_time(dynamic_new.created_at) %>
</td>
<td class="buttons" style="vertical-align: middle;text-align:center">
<%= link_to("修改", edit_dynamic_news_path(dynamic_new), :class => 'icon icon-copy') %>
<%= link_to(l(:button_delete), dynamic_news_path(dynamic_new), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
</td>
</tr>
<% end %>
</tbody>
</table>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count ,:per_page_links => true, :remote => true, :flag => true, :is_new => true %>
</div>

+ 30
- 0
app/views/admin/dynamic_news.html.erb View File

@@ -0,0 +1,30 @@
<div class="contextual">
<%= link_to l(:label_dynamic_new), {:controller => 'dynamic_news', :action => 'new'}, :class => 'icon icon-add' %>
</div>

<h3>
<%=l(:label_dynamic_new_plural)%>
</h3>

<%= form_tag({}, :method => :get) do %>
<fieldset>
<legend>
<%= l(:label_filter_plural) %>
</legend>
<label for='status'>
<%= l(:field_category) %> :
</label>
<%= select_tag 'category_id', dynamic_news_category_options_for_select(@category_id), :class => "small", :onchange => "this.form.submit(); return false;" %>
<label for='name'>
<%= l(:label_project) %>:
</label>
<%= text_field_tag 'title', params[:title], :size => 30, :placeholder => '输入新闻标题进行搜索' %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'dynamic_news'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;

<div class="autoscroll" id="admin_dynamic_news_list">
<%= render :partial => "dynamic_news" %>
</div>

+ 1
- 0
app/views/admin/dynamic_news.js.erb View File

@@ -0,0 +1 @@
$("#admin_dynamic_news_list").html("<%= escape_javascript(render :partial => 'dynamic_news') %>");

+ 1
- 1
app/views/admin/organization.html.erb View File

@@ -24,7 +24,7 @@
<tr class="<%= cycle("odd", "even") %>"> <tr class="<%= cycle("odd", "even") %>">
<td style="text-align:center;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=org.name%>'> <td style="text-align:center;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=org.name%>'>
<span> <span>
<%#= link_to org.name,home_path(:organization => org.id) %>
<%#= link_to org.name,homes_path(:organization => org.id) %>
<%= link_to org.name, organization_path(org) %> <%= link_to org.name, organization_path(org) %>
</span> </span>
</td> </td>


+ 1
- 6
app/views/admin/web_footer_made.html.erb View File

@@ -6,7 +6,7 @@
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> <%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p> </p>
<%= render 'tab_partial' %> <%= render 'tab_partial' %>
<div style="float:right"><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %></div>
<div style="float:right;"><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %></div>
<h4><%=l(:label_web_footer_page)%></h4> <h4><%=l(:label_web_footer_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;"> <p style="margin-left:60px;padding-right: 20px;">
@@ -21,8 +21,3 @@
</p> </p>
<%= submit_tag l(:button_save), :class => "small", :name => nil %> <%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %> <% end %>
<div>
</div>

+ 39
- 23
app/views/applied_project/_applied_join_project.html.erb View File

@@ -1,37 +1,53 @@
<div style="width:460px;"> <div style="width:460px;">
<div class="sy_popup_top">
<div class="sy_popup_top clearfix">
<h3 class="fl">欢迎加入项目</h3> <h3 class="fl">欢迎加入项目</h3>
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
<div class="cl"></div>
<!-- <a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>-->
</div> </div>
<div class="sy_popup_con" style="width:370px;">
<div class="sy_popup_con" style="width:400px;">
<%= form_tag( url_for(:controller => 'applied_project', :action => 'applied_project_info', :project_id => (@project.nil? ? nil : @project.id)), :remote => true, :id => 'project_applied_form') do %> <%= form_tag( url_for(:controller => 'applied_project', :action => 'applied_project_info', :project_id => (@project.nil? ? nil : @project.id)), :remote => true, :id => 'project_applied_form') do %>
<ul class="sy_popup_add "> <ul class="sy_popup_add ">
<% if @is_teacher && @is_teacher == 1 %> <% if @is_teacher && @is_teacher == 1 %>
<li class="none">
<label >项目邀请码:</label>
<input name="invite_code" class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" value="<%=@project.invite_code %>" style="width:250px"/>
<div class="cl"></div>
<li class="none t-center">
<span class="inline">
<label >项目邀请码:</label>
<input name="invite_code" class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" value="<%=@project.invite_code %>" style="width:250px"/>
<div class="cl"></div>
</span>
</li> </li>
<% else %> <% else %>
<li>
<label >项目邀请码:</label>
<input name="invite_code" class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" style="width:250px"/>
<div class="cl"></div>
<li class="t-center">
<span class="inline">
<label >项目邀请码:</label>
<input name="invite_code" class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" style="width:250px"/>
<div class="cl"></div>
</span>
</li> </li>
<% end %> <% end %>
<li>
<label >身份:</label>
<input name="member" value="member_manager" type="radio" class="ml5 mr5 " /><span class="mr10">管理人员</span>
<input name="member" value="member_developer" type="radio" class="ml5 mr5 " /><span class="mr10">开发人员</span>
<input name="member" value="member_reporter" type="radio" class="ml5 mr5 " /><span class="mr10">报告人员</span>
<div class="cl"></div>
<li class="mt10 text_c">
<span class="inline">
<label >身份:</label>
<span class="fl mr10 mt3">
<input type="radio" class="magic-radio" name="indentity" value="member_manager" id="member_manager"/>
<label for="member_manager" style="line-height: 28px">管理人员</label>
</span>
<span class="fl mr10 mt3">
<input type="radio" class="magic-radio" name="indentity" value="member_developer" id="member_developer"/>
<label for="member_developer" style="line-height: 28px">开发人员</label>
</span>
<span class="fl mr10 mt3">
<input type="radio" class="magic-radio" name="indentity" value="member_reporter" id="member_reporter"/>
<label for="member_reporter" style="line-height: 28px">报告人员</label>
</span>
<!-- <input name="member" value="member_manager" type="radio" class="ml5 mr5 " /><span class="mr10">管理人员</span>-->
<!-- <input name="member" value="member_developer" type="radio" class="ml5 mr5 " /><span class="mr10">开发人员</span>-->
<!-- <input name="member" value="member_reporter" type="radio" class="ml5 mr5 " /><span class="mr10">报告人员</span>-->
</span>
</li> </li>
<li>
<label class="mr27">&nbsp;</label>
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="$('#project_applied_form').submit();hideModal()">确&nbsp;&nbsp;定</a>
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取&nbsp;&nbsp;消</a>
<div class="cl"></div>
<li class="mt15 text_c" >
<span class="inline">
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="$('#project_applied_form').submit();hideModal()">确&nbsp;&nbsp;定</a>
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取&nbsp;&nbsp;消</a>
</span>
</li> </li>
</ul> </ul>
<% end %> <% end %>


+ 10
- 10
app/views/bids/contest.html.erb View File

@@ -12,28 +12,28 @@
</td> </td>
<td rowspan="2"> <td rowspan="2">
<% if User.current.logged? %> <% if User.current.logged? %>
<% unless User.current.user_extensions.identity == 1 %>
<%= link_to(l(:label_newtype_contest), {:controller => 'bids', :action => 'new_contest'}, :class => 'icon icon-add') %>
<% end %>
<% end %>
<% unless User.current.user_extensions.identity == 1 %>
<%= link_to(l(:label_newtype_contest), {:controller => 'bids', :action => 'new_contest'}, :class => 'icon icon-add') %>
<% end %>
<% end %>
</td> </td>
<td rowspan="2" >
<div class="project-search" style="float: right">
<td rowspan="2" >
<div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30 %>
<%= hidden_field_tag 'project_type', params[:project_type] %> <%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
</div>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td > <td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:field_homepage), homes_path %> >
<a><%= l(:label_contest_innovate) %></a> <a><%= l(:label_contest_innovate) %></a>
</td> </td>
</tr> </tr>
</table> </table>
<% end %> <% end %>
</div>
</div>








+ 6
- 6
app/views/bids/index.html.erb View File

@@ -14,24 +14,24 @@
<td rowspan="2"> <td rowspan="2">
<% if User.current.logged? %> <% if User.current.logged? %>
<%= link_to(l(:label_new_call), {:controller => 'bids', :action => 'new_bid'}, :class => 'icon icon-add') %> <%= link_to(l(:label_new_call), {:controller => 'bids', :action => 'new_bid'}, :class => 'icon icon-add') %>
<% end %>
<% end %>
</td> </td>
<td rowspan="2" >
<td rowspan="2" >
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 28 %> <%= text_field_tag 'name', params[:name], :size => 28 %>
<%= hidden_field_tag 'reward_type', params[:reward_type] %> <%= hidden_field_tag 'reward_type', params[:reward_type] %>
<%= hidden_field_tag 'project_type', params[:project_type] %> <%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
</div>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/calls", :controller => 'bids', :action => 'index' %> </a></td> <td style="padding-left: 8px"><a><%= link_to request.host()+"/calls", :controller => 'bids', :action => 'index' %> </a></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_requirement_enterprise), :controller => 'bids', :action => 'index' %></td>
<td ><%=link_to l(:field_homepage), homes_path %> > <%=link_to l(:label_requirement_enterprise), :controller => 'bids', :action => 'index' %></td>
</tr> </tr>
</table> </table>
<% end %> <% end %>
</div>
</div>
<% if @bids.size > 0 %> <% if @bids.size > 0 %>
<div id="bid-show"> <div id="bid-show">
<%= sort_bid(@s_state, @project_type)%> <%= sort_bid(@s_state, @project_type)%>
@@ -42,4 +42,4 @@
<% end %> <% end %>




<% html_title l(:label_requirement_enterprise_list)%>
<% html_title l(:label_requirement_enterprise_list)%>

+ 1
- 1
app/views/courses/index.html.erb View File

@@ -35,7 +35,7 @@
</tr> </tr>
<tr> <tr>
<td > <td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:field_homepage), homes_path %> >
<a href="http://<%= Setting.host_course%>" class="link_other_item"> <a href="http://<%= Setting.host_course%>" class="link_other_item">
<%=l(:label_courses_management_platform)%> <%=l(:label_courses_management_platform)%>
</a> </a>


+ 2
- 2
app/views/courses/search.html.erb View File

@@ -29,7 +29,7 @@
</tr> </tr>
<tr> <tr>
<td > <td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:field_homepage), homes_path %> >
<a href="http://<%= Setting.host_course%>" class="link_other_item"> <a href="http://<%= Setting.host_course%>" class="link_other_item">
<%=l(:label_courses_management_platform)%> <%=l(:label_courses_management_platform)%>
</a> </a>
@@ -37,7 +37,7 @@
</tr> </tr>
</table> </table>
<% end %> <% end %>
</div>
</div>
<% if @courses && !@courses.empty? %> <% if @courses && !@courses.empty? %>
<div id="courses-index"> <div id="courses-index">


+ 70
- 0
app/views/dynamic_news/_form.html.erb View File

@@ -0,0 +1,70 @@
<%= form_for(@dynamic_new, :url=> { :action => params[:action] == 'new'? :create : :update }, :html => {:id =>'system_messages-form',:multipart => true }) do |f| %>
<li>
<%= image_tag(params[:action] == 'new' ? '' : @dynamic_new.cover_url, id: "avatar_image", :class=>"school_avatar dynamic_new_image" )%>
<a type="button" onclick="$('#file').click();" style="margin: 86px 0 0 15px;float: left;padding: 2px 5px;border: 1px solid #eaeaea;cursor: pointer;text-decoration: none;width: 55px;">上传封面</a>
<%= file_field_tag 'cover',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%>
<div style="clear: both;"></div>
</li>
<li>
<label><span class="">*</span>&nbsp;<%= l(:field_category) %>&nbsp;&nbsp;:</label>
<%= f.select :category_id, options_for_select(Category.all.collect{|item| [item.name, item.id]}, @category_id), :class => "small" %>
<p id="title_notice_span" class="ml55"></p>
</li>

<li>
<label><span class="">*</span>&nbsp;<%= l(:field_title) %>&nbsp;&nbsp;:</label>
<input type="text" name="dynamic_new[title]" class="hwork_input_news" id="dynamic_new_title" width="576px" onblur="regexTitle($(this));" maxlength="255" placeholder="255个字符以内" value="<%= @dynamic_new.title %>">
<p id="title_notice_span" class="ml55"></p>
</li>
<li>
<label><span class="">*</span>&nbsp;<%= l(:field_summary) %>&nbsp;&nbsp;:</label>
<input type="textarea" name="dynamic_new[simple_intruduce]" class="hwork_input_news" id="dynamic_new_simple_introduce" width="576px" onblur="regexTitle($(this));" maxlength="255" placeholder="255个字符以内" value="<%= @dynamic_new.simple_intruduce %>">
<p id="title_notice_span" class="ml55"></p>
</li>
<li>
<label class="fl" >&nbsp;&nbsp;<span class="c_red"></span>&nbsp;<%= l(:field_content) %>&nbsp;&nbsp;:</label>
<%= f.kindeditor :content,:width=>'87.5%',:editor_id=>'dynamic_new_editor' %>
<p id="content_notice_span" class="ml55"></p>
</li>
<div>
<p id="content_notice_span" class="ml55"></p>
</div>
<div class="cl"></div>
<div class="actions">
<%= link_to l(:label_submit), "javascript:void(0)", :class => "btn_message_free", :onclick => "dynamic_new_editor.sync();submit_message($(this));" %>
</div>
<% end %>

<script>
function system_message_length() {
var obj = dynamic_new_editor.html();
if (obj.length > 10000) {
$("#content_notice_span").text("内容过长,超过10000个字符");
$("#content_notice_span").css('color', '#ff0000');
$("#content_notice_span").focus();
return false;
} else {
$("#content_notice_span").text("填写正确");
$("#content_notice_span").css('color', '#008000');
return true;
}
}
function regexTitle(obj) {
var title = obj.val();
if (title.length == 0) {
$("#title_notice_span").text("标题不能为空").css("color", "#ff0000").focus();
return false;
} else if (title.length > 255) {
$("#title_notice_span").text("标题长度过长,不能超过255个字符").css("color", "#ff0000").focus();
return false;
} else {
$("#title_notice_span").text("填写正确").css("color", "#008000");
return true;
}
}
function submit_message(dom) {
if (system_message_length() && regexTitle($("#dynamic_new_title")) && regexTitle($("#dynamic_new_simple_introduce"))) {
$("#system_messages-form").submit();
}
}
</script>

+ 23
- 0
app/views/dynamic_news/edit.html.erb View File

@@ -0,0 +1,23 @@
<script>
function showPreview(source) {
var file = source.files[0];
if (window.FileReader) {
var fr = new FileReader();
fr.onloadend = function (e) {
document.getElementById("avatar_image").src = e.target.result;
};
fr.readAsDataURL(file);
}
}
</script>

<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false) %>
<% end %>
<h3 style="float: left">
<%=l(:label_new_dynamic_new)%>
</h3><br/>
<div style="padding-top: 20px; padding-left: 5px;">
<%= error_messages_for 'dynamic_new' %>
<%= render 'form' %>
</div>

+ 2
- 0
app/views/dynamic_news/index.html.erb View File

@@ -0,0 +1,2 @@
<h1>DynamicNew#index</h1>
<p>Find me in app/views/dynamic_new/index.html.erb</p>

+ 22
- 0
app/views/dynamic_news/new.html.erb View File

@@ -0,0 +1,22 @@
<script>
function showPreview(source) {
var file = source.files[0];
if (window.FileReader) {
var fr = new FileReader();
fr.onloadend = function (e) {
document.getElementById("avatar_image").src = e.target.result;
};
fr.readAsDataURL(file);
}
}
</script>

<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false) %>
<% end %>
<h3 style="float: left">
<%=l(:label_new_dynamic_new)%>
</h3><br/>
<div style="padding-top: 20px; padding-left: 5px;">
<%= render 'form' %>
</div>

+ 5
- 0
app/views/homes/_banners.html.erb View File

@@ -0,0 +1,5 @@
<%= default_banner_tag(@home) %>

<% @home.banners.each do |banner| %>
<a href="<%= banner.remote_path %>"><%= home_banner_tag(banner) %></a>
<% end %>

+ 45
- 0
app/views/homes/_companies.html.erb View File

@@ -0,0 +1,45 @@
<ul class="partnerMenu">
<li class="inline">
<a href="javascript:void(0)" class="active">合作共建开源</a>
<a href="javascript:void(0)">技术合作单位</a>
</li>
</ul>
<div class="partner_lump active partnerSource">
<ul class="inline">
<%= render partial: 'partners', locals: {partners: @partners} %>
</ul>
</div>
<div class="partner_lump">
<% unless @first_companies_group.blank? %>
<div class="partner_item">
<li class="inline">
<% @first_companies_group.each do |company| %>
<%= link_to image_tag(url_to_avatar(company),:alt=> company.name ), company.url, :target => "_blank" %>
<% end %>
</li>
</div>
<% end %>

<% unless @second_companies_group.blank? %>
<div class="partner_item">
<li class="inline">
<% @second_companies_group.each do |company| %>
<%= link_to image_tag(url_to_avatar(company),:alt=> company.name ), company.url, :target => "_blank" %>
<% end %>
</li>
</div>
<% end %>

<% unless @third_companies_group.blank? %>
<div class="partner_item">
<li class="inline">
<% @third_companies_group.each do |company| %>
<%= link_to image_tag(url_to_avatar(company),:alt=> company.name ), company.url, :target => "_blank" %>
<% end %>
<%# if @companies.length > 17 %>
<!-- <a href="<%#= partners_homes_path %>"><img src="/images/introduce/more.png"/></a>-->
<%# end %>
</li>
</div>
<% end %>
</div>

+ 15
- 0
app/views/homes/_dynamic_news.html.erb View File

@@ -0,0 +1,15 @@
<% dynamic_news&.each do |dynamic_new| %>
<a href="<%= dynamic_new.remote_url %>">
<div class="homepage_activity_list_item">
<div>
<p class="f18 mb15 lh20 color-grey3"><%= h dynamic_new.title %></p>
<p class="f13 mb8 c_grey02 task-hide-2" style="height: 38px;"><%= h dynamic_new.simple_intruduce %></p>
<p>
<span class="activity_tag">行业动态</span>
<span class="fontGrey4 ml14 fl"><i class="iconfont icon-shijian f12 mr5 lh18 fl"></i><%= format_time(dynamic_new.created_at) %></span>
</p>
</div>
<img src="<%= dynamic_new.cover_url %>" class="ml20" width="158px" height="100px" />
</div>
</a>
<% end %>

+ 60
- 0
app/views/homes/_educoder.html.erb View File

@@ -0,0 +1,60 @@
<div class="homepage_introduce_trustieEduCode homepage_introduce_content_item">
<div class="trustieEduCode_container cartoon">
<div class="edu_c_panel">
<ul class="edu_c_p_left">
<a href="https://www.educoder.net/">
<li class="active"><i class="iconfont icon-menu_map mr15 f20"></i>实训项目</li>
</a>
<a href="https://www.educoder.net/">
<li><i class="iconfont icon-menu_voucher mr15 f20"></i>翻转课堂</li>
</a>
<a href="https://www.educoder.net/">
<li><i class="iconfont icon-huodong mr15 f20"></i>竞赛活动</li>
</a>
<a href="https://www.educoder.net/">
<li><i class="iconfont icon-menu_events mr15 f20"></i>作业查重</li>
</a>
<a href="https://www.educoder.net/">
<li><i class="iconfont icon-gongcheng mr15 f20"></i>工程教育</li>
</a>
</ul>
<div class="edu_c_p_right">
<div class="c_p_right_item active">
<div class="c_r_title">
<p class="f22 mb20">翻转课堂</p>
<p class="fontGrey4 f16">支持老师在线建立课堂,发布任务,学生完成任务,提交作业等各类教学场景</p>
</div>
<img src="/images/introduce/content2.png" style="margin-top: 45px"/>
</div>
<div class="c_p_right_item">
<div class="c_r_title">
<p class="f22 mb20">实训课程</p>
<p class="fontGrey4 f16">实现实践教学的课程软件化、过程游戏化、环境生产化和评测全栈化</p>
</div>
<img src="/images/introduce/content1.png" style="margin-top: 45px"/>
</div>
<div class="c_p_right_item">
<div class="c_r_title">
<p class="f22 mb20">竞赛活动</p>
<p class="fontGrey4 f16">汇集以高校竞赛为主,活动、社区为辅助的竞赛活动平台</p>
</div>
<img src="/images/introduce/content3.png" style="margin-top: 45px"/>
</div>
<div class="c_p_right_item">
<div class="c_r_title">
<p class="f22 mb20">作业查重</p>
<p class="fontGrey4 f16">把好学生“质量关”,为高校教师提供教学过程中课程作业的查重服务</p>
</div>
<img src="/images/introduce/content4.png" style="margin-top: 45px"/>
</div>
<div class="c_p_right_item">
<div class="c_r_title">
<p class="f22 mb20">工程教育</p>
<p class="fontGrey4 f16">达成度自动计算,自评报告一键导出,切实提升相关工程技术人才从业教育质量</p>
</div>
<img src="/images/introduce/content5.png" style="margin-top: 45px"/>
</div>
</div>
</div>
</div>
</div>

+ 30
- 0
app/views/homes/_floating_tabs.html.erb View File

@@ -0,0 +1,30 @@
<ul>
<li class="active">
<div>
<p class="f18 floatingName"><a href="<%= current_user.logged? ? user_path(current_user) : host_with_protocol %>" target="_blank"class="colorWhite">TrustieForge</a></p>
<p class="f16 mb20">协同开发平台</p>
<p class="f12 mb30 break_full_word floatingContent">开源创作与软件生产相结合,支持大规模群体开展软件协同创新活动。</p>
</div>
</li>
<li>
<div>
<p class="f18 floatingName"><a href="https://www.educoder.net/" target="_blank"class="colorWhite">EduCoder</a></p>
<p class="f16 mb20">智能学习平台</p>
<p class="f12 mb30 break_full_word floatingContent">实现实践教学的课程软件化、过程游戏化、环境生产化和评测全栈化</p>
</div>
</li>
<li>
<div>
<p class="f18 floatingName"><a href="http://ossean.trustie.net/" target="_blank"class="colorWhite">OSSEAN</a></p>
<p class="f16 mb20">资源共享平台</p>
<p class="f12 mb30 break_full_word floatingContent">高效汇聚全球开源开放的软件工程大数据,持续分析与评估开源生态发展态势</p>
</div>
</li>
<li>
<div>
<p class="f18 floatingName"><a href="http://codepedia.trustie.net/" target="_blank"class="colorWhite">Codepedia</a></p>
<p class="f16 mb20">众包标注平台</p>
<p class="f12 mb30 break_full_word floatingContent">实践群体智能硬币的两面,即为学习者提供高效易用的代码阅读环境,也为软件领域积累丰富的自然语言标注。</p>
</div>
</li>
</ul>

+ 25
- 0
app/views/homes/_form.html.erb View File

@@ -0,0 +1,25 @@
<%= form_for(@home) do |f| %>
<% if @home.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@home.errors.count, "error") %> prohibited this home from being saved:</h2>

<ul>
<% @home.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>

<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :content %><br />
<%= f.text_area :content %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>

+ 8
- 0
app/views/homes/_home.html.erb View File

@@ -0,0 +1,8 @@
<div class="mr35">
<%= home_cover_tag(home) %>
<p class="f26 lh26 color-grey3 mb20"><%= home.name %></p>
<p class="f16 c_grey02 break_full_word lh30">
<%= truncate(home.content.html_safe, length: Home::SHOW_CONTENT_LENGTH) %>
</p>
<!-- <a href="<%##= home.more_content? ? homes_path(home) : 'JavaScript:void(0)'%>" class="homepage_activity_more <%#= home.more_content? ? 'visit_color' : 'disabled_color' %>">MORE<span>→</span></a>-->
</div>

+ 16
- 0
app/views/homes/_nav_buttons.html.erb View File

@@ -0,0 +1,16 @@
<li>
<% if User.current.logged? %>
<a href="<%= user_path(User.current) %>" target="_blank" class="rightline">开源托管平台</a>
<% else %>
<a href="<%= signin_url() %>" target="_blank" class="rightline">开源托管平台</a>
<% end %>
</li>
<li>
<a href="https://www.educoder.net/" target="_blank">智能学习平台</a>
</li>
<li>
<a href="http://ossean.trustie.net/" target="_blank">资源共享平台</a>
</li>
<li>
<a href="http://codepedia.trustie.net/" target="_blank">众包学习平台</a>
</li>

+ 17
- 0
app/views/homes/_news_list.html.erb View File

@@ -0,0 +1,17 @@
<% @dynamic_news.each do |dynamic_new| %>
<li>
<img src="<%= dynamic_new.cover_url %>" width="158px" height="100px" class="mr20"/>
<div>
<p class="mb15 clearfix">
<a href="<%= dynamic_new.remote_url %>" class="f18 color-grey3 mr10 fl lh24"><%= h dynamic_new.title %></a>
<span class="activitiesTag">行业动态</span>
<span class="f12 fontGrey4 fr"><i class="iconfont icon-shijian f14 fl mr5 lh18"></i><%= format_time(dynamic_new.created_at) %></span>
</p>
<p class="introduce_a_content break_full_word">
<span><%= h dynamic_new.simple_intruduce %></span>
</p>
</div>
</li>
<% end %>



+ 52
- 0
app/views/homes/_ossean.html.erb View File

@@ -0,0 +1,52 @@
<div class="homepage_introduce_ossean homepage_introduce_content_item">
<div class="cartoonTitle mt30 mb40">
<p class="f34 mb20">资源共享平台</p>
<p class="f16 color-grey3">汇聚全球开源开放的软件工程大数据,持续分析与评估开源生态发展态势。</p>
</div>
<ul class="cartoon ossean_list">
<li>
<a href="http://ossean.trustie.net/" target="_blank">
<div>
<p class="f20 color-grey3 mb20">多元关联与反馈</p>
<p class="f16 fontGrey4">对多扩社区多源异构数据进行清洗、关联、组合与结构化。</p>
</div>
<div>
<i class="iconfont icon-gongyiliucheng"></i>
</div>
</a>
</li>
<li>
<a href="http://ossean.trustie.net/" target="_blank">
<div>
<p class="f20 color-grey3 mb20">多维评估</p>
<p class="f16 fontGrey4">从互联网到资源库,从主观到客观的多维度评估</p>
</div>
<div>
<i class="iconfont icon-shengmingzhouqi"></i>
</div>
</a>
</li>
<li>
<a href="http://ossean.trustie.net/" target="_blank">
<div>
<p class="f20 color-grey3 mb20">资源排行和推荐</p>
<p class="f16 fontGrey4">对开源项目进行评测排行,对相关资源进行关联推荐。</p>
</div>
<div>
<i class="iconfont icon-healthmode" style="font-size: 80px!important;"></i>
</div>
</a>
</li>
<li>
<a href="http://ossean.trustie.net/" target="_blank">
<div>
<p class="f20 color-grey3 mb20">态势感知</p>
<p class="f16 fontGrey4">从数据到知识,从知识到态势。</p>
</div>
<div>
<i class="iconfont icon-yunweijiankong"></i>
</div>
</a>
</li>
</ul>
</div>

+ 3
- 0
app/views/homes/_partners.html.erb View File

@@ -0,0 +1,3 @@
<% partners.each do |partner| %>
<%= link_to image_tag(url_to_avatar(partner),:alt=> partner.name ), partner.url, :target => "_blank" %>
<% end %>

+ 18
- 0
app/views/homes/_statistics.html.erb View File

@@ -0,0 +1,18 @@
<ul>
<li>
<p class="data_number"><%= @home.users_count %></p>
<p class="f16">社区用户量</p>
</li>
<li>
<p class="data_number"><%= @home.projects_count %></p>
<p class="f16">开源项目</p>
</li>
<li>
<p class="data_number"><%= @home.practical_training_projects_count %></p>
<p class="f16">实训项目</p>
</li>
<li>
<p class="data_number"><%= @home.scholls_count %></p>
<p class="f16">应用高校</p>
</li>
</ul>

+ 51
- 0
app/views/homes/_trustie_coderpedia.html.erb View File

@@ -0,0 +1,51 @@
<div class="homepage_introduce_trustieCoderpedia homepage_introduce_content_item">
<div class="cartoonTitle mt30 ">
<p class="f34 mb20">众包标注平台</p>
<p class="f16 color-grey3">群体智能硬币的两面,即为学习者提供高效易用的代码阅读环境,也为软件领域积累丰富的自然语言标注。</p>
</div>
<ul class="cartoon clearfix Coderpedia_list">
<li>
<div class="h_logo">
<i class="iconfont icon-shebeiguanli"></i>
</div>
<p class="hoverLine"></p>

<a href="http://codepedia.trustie.net/" target="_blank">
<div class="coderpedia_i_content">
<div>
<p class="color-grey3 f20 lh20 mb20">标注引导</p>
<p class="c_grey02 lh22">高质量代码标注<br/>提升代码可理解性</p>
</div>
</div>
</a>
</li>
<li>
<div class="h_logo">
<i class="iconfont icon-shebeiguanli"></i>
</div>
<p class="hoverLine"></p>
<a href="http://codepedia.trustie.net/" target="_blank">
<div class="coderpedia_i_content">
<div>
<p class="color-grey3 f20 lh20 mb20">群体标注</p>
<p class="c_grey02 lh22">提供开源项目群体标注<br/>方便团队理解和查看</p>
</div>
</div>
</a>
</li>
<li>
<div class="h_logo">
<i class="iconfont icon-zhiliangkongzhi"></i>
</div>
<p class="hoverLine"></p>
<a href="http://codepedia.trustie.net/" target="_blank">
<div class="coderpedia_i_content">
<div>
<p class="color-grey3 f20 lh20 mb20">反馈修正</p>
<p class="c_grey02 lh22">及时的反馈机制<br/>指出瑕疵并进行改进和修正</p>
</div>
</div>
</a>
</li>
</ul>
</div>

+ 49
- 0
app/views/homes/_trustie_forge.html.erb View File

@@ -0,0 +1,49 @@
<% url = current_user.logged? ? user_path(current_user) : host_with_protocol %>
<div class="homepage_introduce_trustieForge homepage_introduce_content_item active">
<div class="cartoonTitle mt30 mb40">
<p class="f34 mb20">协同开发平台</p>
<p class="f16 color-grey3">支撑国家9个软件园区创新平台,服务2500余家中小型软件企业研发</p>
</div>
<ul class="cartoon ossean_list">
<li>
<div>
<p class="f20 color-grey3 mb20 trustieTabName">项目管理</p>
<p class="f16 fontGrey4">项目进程管理应用于研发管理、任务分配、目标跟踪等让项目管理流程高效完成。</p>
<a href="<%= url %>" target="_blank" class="trustieMore">查看详情</a>
</div>
<div class="mt20">
<i class="iconfont icon-projectx" style="font-size: 80px"></i>
</div>
</li>
<li>
<div>
<p class="f20 color-grey3 mb20 trustieTabName">代码托管</p>
<p class="f16 fontGrey4">项目进程管理应用于研发管理、任务分配、目标跟踪等让项目管理流程高效完成。</p>
<a href="<%= url %>" target="_blank" class="trustieMore">查看详情</a>
</div>
<div>
<i class="iconfont icon-hostingx2"></i>
</div>
</li>
<li>
<div>
<p class="f20 color-grey3 mb20 trustieTabName">质量检测</p>
<p class="f16 fontGrey4">基于Sonar的代码静态分析工具,及时发现代码中的潜在隐患,全面提升软件开发质量。</p>
<a href="<%= url %>" target="_blank" class="trustieMore">查看详情</a>
</div>
<div>
<i class="iconfont icon-detectionx"></i>
</div>
</li>
<li>
<div>
<p class="f20 color-grey3 mb20 trustieTabName">交流社区</p>
<p class="f16 fontGrey4">为IT开发者营造活跃、开放的社区环境,提供即时通讯、资源分享、学习交流等社交化服务。</p>
<a href="<%= url %>" target="_blank" class="trustieMore">查看详情</a>
</div>
<div>
<i class="iconfont icon-communityx"></i>
</div>
</li>
</ul>
</div>

+ 54
- 0
app/views/homes/index.html.erb View File

@@ -0,0 +1,54 @@
<div>
<div class="clearfix homepage_banner">
<p class="fl">
<img src="/images/introduce/whiteLogo_word.png" height="24px" class="mt18 fl"/>
<span class="fw400 ml20 fl" style="opacity: 0.7;line-height: 67px">持续构建协同、共享、可信的软件创新生态</span>
</p>
<ul class="fr homepage_banner_nav">
<%= render :partial => 'nav_buttons' %>
</ul>
</div>
<div class="pr mt60 banner">
<ul class="img">
<li>
<%= render :partial => 'banners'%>
</li>
</ul>
</div>
<div class="homepage_activity">
<%= render :partial => 'home', :locals => {:home => @home} %>
<div>
<p class="clearfix mb10">
<span class="f26 lh26 color-grey3 fl mt3">社区动态</span>
<a href="<%= news_homes_path %>" class="fr fontGrey4 mt8">更多>></a>
</p>
<div class="homepage_activity_list">
<%= render :partial => 'dynamic_news', :locals => {:dynamic_news => @dynamic_news}%>
</div>
</div>
</div>
<div class="homepage_introduce">
<%= render 'floating_tabs' %>
</div>

<div class="homepage_introduce_content">
<div>
<%= render :partial => 'trustie_forge' %>
<%= render :partial => 'educoder' %>
<%= render :partial => 'ossean' %>
<%= render :partial => 'trustie_coderpedia' %>
</div>
</div>
<div class="data_panel">
<%= render :partial => 'statistics'%>
</div>
<div class="partner_container">
<p class="f32 mb30">开源生态</p>
<div class="partner_list">
<%= render :partial => 'companies' %>
</div>
<p class="mt40">
<a href="<%= partners_homes_path %>" class="more-Partner">查看更多</a>
</p>
</div>
</div>

+ 15
- 0
app/views/homes/news.html.erb View File

@@ -0,0 +1,15 @@
<div class="smallPanel">
<p class="mt15 mb25">
<a href="<%= homes_path %>" class="c_grey02">首页</a><span class="c_grey02 ml3 mr3">&gt;</span>
<span>行业动态</span>
</p>
<p class="f28 lh24">社区动态</p>
<ul class="introduce_a_list">
<%= render :partial => 'news_list'%>
</ul>
<div class="pages" style="text-align: center">
<ul class="inline mt30 mb40">
<%= pagination_links_full @obj_pages, @obj_count ,:per_page_links => true, :remote => true, :flag => true, :is_new => true %>
</ul>
</div>
</div>

+ 1
- 0
app/views/homes/news.js.erb View File

@@ -0,0 +1 @@
$(".introduce_a_list").html("<%= escape_javascript(render :partial => 'news_list') %>");

+ 17
- 0
app/views/homes/partners.html.erb View File

@@ -0,0 +1,17 @@
<div class="smallPanel">
<p class="mt15 mb25">
<a href="<%= homes_path %>" class="c_grey02">首页</a><span class="c_grey02 ml3 mr3">&gt;</span>
<span>开源生态</span>
</p>

<% @companies.each do |pool, coms| %>
<p class="f28 lh24 mb20"><%= render_pool_name(pool) %></p>
<ul class="partnerList clearfix mb30">
<% coms.each do |company|%>
<li>
<%= link_to image_tag(url_to_avatar(company),:alt=> company.name ), company.url, :target => "_blank" %>
</li>
<% end %>
</ul>
<% end %>
</div>

+ 14
- 0
app/views/homes/show.html.erb View File

@@ -0,0 +1,14 @@
<p id="notice"><%= notice %></p>

<p>
<b>Name:</b>
<%= @home.name %>
</p>

<p>
<b>Content:</b>
<%= @home.content %>
</p>


<%= link_to 'Back', homes_path %>

+ 9
- 14
app/views/issues/index.html.erb View File

@@ -1,7 +1,6 @@
<%= content_for(:header_tags) do %> <%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true,init_activity: true) %> <%= import_ke(enable_at: true,init_activity: true) %>
<% end %> <% end %>
<script xmlns="http://www.w3.org/1999/html"> <script xmlns="http://www.w3.org/1999/html">
function add_style(){ function add_style(){
if($("select[id='tracker_id']").val() != 0){ if($("select[id='tracker_id']").val() != 0){
@@ -256,11 +255,7 @@
</a> </a>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
</ul> </ul>
<div class="issues_filter "> <div class="issues_filter ">
<div class="issues_form_filter mt5 mr5"> <div class="issues_form_filter mt5 mr5">
<%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [User.find(c.user_id).show_name, c.user_id]}.unshift(["发布人",0]), <%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [User.find(c.user_id).show_name, c.user_id]}.unshift(["发布人",0]),
@@ -309,6 +304,7 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div><!--issues_filter end--> </div><!--issues_filter end-->
</div>
<% end %> <% end %>
<% end %> <% end %>
@@ -319,15 +315,14 @@
<%#= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> <%#= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %>
</div><!--issues_con_list end--> </div><!--issues_con_list end-->
<div class="cl"></div> <div class="cl"></div>
</div><!--issues_filter end-->
<div id="issues_list_content_1">
</div><!--issues_list_content_1 end-->
<div id="issues_list_content_2" class="undis">
</div><!--issues_list_content_2 end-->
<div id="issues_list_content_3" class="undis">
</div><!--issues_list_content_3 end-->
</div><!--issues_con_list end-->
<!--issues_filter end-->
<div id="issues_list_content_1">
</div><!--issues_list_content_1 end-->
<div id="issues_list_content_2" class="undis">
</div><!--issues_list_content_2 end-->
<div id="issues_list_content_3" class="undis">
</div><!--issues_list_content_3 end-->
<!--issues_con_list end-->
</div>
<!--缺陷列表结束--> <!--缺陷列表结束-->

+ 1
- 1
app/views/journals/index.builder View File

@@ -2,7 +2,7 @@ xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
xml.title @title xml.title @title
xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.rss_key, :only_path => false) xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.rss_key, :only_path => false)
xml.link "rel" => "alternate", "href" => home_url(:only_path => false)
xml.link "rel" => "alternate", "href" => homes_url(:only_path => false)
xml.id url_for(:controller => 'welcome', :only_path => false) xml.id url_for(:controller => 'welcome', :only_path => false)
xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema) xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema)
xml.author { xml.name "#{Setting.app_title}" } xml.author { xml.name "#{Setting.app_title}" }


+ 3
- 4
app/views/layouts/_base_college_header.html.erb View File

@@ -1,14 +1,13 @@
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
<div class="welcome_logo"> <div class="welcome_logo">
<%=link_to image_tag("/images/logo.png",weight:"36px", height: "36px"), home_path %>
<%=link_to image_tag("/images/logo.png",weight:"36px", height: "36px"), homes_path %>
</div> </div>
<div id="account"> <div id="account">
<%= render_menu :account_menu -%> <%= render_menu :account_menu -%>
</div> </div>
<%= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %> <%= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %>
<%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %> <%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %>
<%= render_menu :top_college_menu if User.current.logged? || !Setting.login_required? -%> <%= render_menu :top_college_menu if User.current.logged? || !Setting.login_required? -%>
</div> </div>
<div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 5px;margin-top: -10px;"></div> <div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 5px;margin-top: -10px;"></div>


+ 17
- 17
app/views/layouts/_base_enterprise_header.html.erb View File

@@ -1,35 +1,35 @@
<!-- <table id="top-menu" style="background-color: #ac344f;margin-top: 10px;margin-bottom: 0px; padding-top: 3px; ">
<tr><td ><%#=link_to image_tag("/images/logo_ent.png",weight:"38px", height: "38px"), home_path %></td>
<!-- <table id="top-menu" style="background-color: #ac344f;margin-top: 10px;margin-bottom: 0px; padding-top: 3px; ">
<tr><td ><%#=link_to image_tag("/images/logo_ent.png",weight:"38px", height: "38px"), homes_path %></td>
<td valign="top" width="300px"><%#= render_menu :top_enterprise_menu if User.current.logged? || !Setting.login_required? -%></td> <td valign="top" width="300px"><%#= render_menu :top_enterprise_menu if User.current.logged? || !Setting.login_required? -%></td>
<td><%#=link_to "企业入口"%></td> <td><%#=link_to "企业入口"%></td>
<td valign="top" style=" padding-left: 380px">
<td valign="top" style=" padding-left: 380px">
<%#= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %> <%#= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %>
<%#= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %> <%#= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %>
</td> </td>
<td valign="top">
<td valign="top">
<%#= render_menu :account_menu -%> <%#= render_menu :account_menu -%>
</td>
</td>
</tr> </tr>
</table> -->
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
</table> -->
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
<div class="welcome_logo"> <div class="welcome_logo">
<%=link_to image_tag("/images/logo.png",weight:"36px", height: "36px"), home_path %>
<%=link_to image_tag("/images/logo.png",weight:"36px", height: "36px"), homes_path %>
</div> </div>
<div id="account"> <div id="account">
<%= render_menu :account_menu -%> <%= render_menu :account_menu -%>
</div> </div>
<%= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %> <%= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %>
<%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %>
<%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %>
<%= render_menu :top_enterprise_menu if User.current.logged? || !Setting.login_required? -%> <%= render_menu :top_enterprise_menu if User.current.logged? || !Setting.login_required? -%>
</div> </div>


<!-- <div style="float: right; margin-top: 13px;"> <!-- <div style="float: right; margin-top: 13px;">
<%#= content_tag('div', "#{link_to(image_tag('/images/mes.png'), feedback_path(User.current))}".html_safe, :title => "留言") if User.current.logged? %> <%#= content_tag('div', "#{link_to(image_tag('/images/mes.png'), feedback_path(User.current))}".html_safe, :title => "留言") if User.current.logged? %>
</div> --> </div> -->
@@ -39,6 +39,6 @@
<!-- <%#= content_tag('div', "#{}".html_safe, :id => 'loggedas')%> --> <!-- <%#= content_tag('div', "#{}".html_safe, :id => 'loggedas')%> -->
<!-- 消息#{link_to((User.current.count_new_jour), feedback_path(User.current))} --> <!-- 消息#{link_to((User.current.count_new_jour), feedback_path(User.current))} -->
<!-- <%#= content_tag('div', "消息(#{User.current.journals_for_messages.count})".html_safe, :id => 'loggedas')%> --> <!-- <%#= content_tag('div', "消息(#{User.current.journals_for_messages.count})".html_safe, :id => 'loggedas')%> -->


<!-- <div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 5px;margin-top: -10px;"></div> --> <!-- <div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 5px;margin-top: -10px;"></div> -->

+ 3
- 4
app/views/layouts/_base_home_menu.html.erb View File

@@ -1,13 +1,13 @@
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
<div class="welcome_logo"> <div class="welcome_logo">
<%=link_to image_tag("/images/logo.png",weight:"36px", height: "36px"), home_path %>
<%=link_to image_tag("/images/logo.png",weight:"36px", height: "36px"), homes_path %>
</div> </div>
<div id="account"> <div id="account">
<%= render_menu :account_menu -%> <%= render_menu :account_menu -%>
</div> </div>
<%= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %> <%= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %>
<%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %> <%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %>
<!-- <div style="float: right; margin-top: 13px;"> <!-- <div style="float: right; margin-top: 13px;">
<%#= content_tag('div', "#{link_to(image_tag('/images/mes.png'), feedback_path(User.current))}".html_safe, :title => "留言") if User.current.logged? %> <%#= content_tag('div', "#{link_to(image_tag('/images/mes.png'), feedback_path(User.current))}".html_safe, :title => "留言") if User.current.logged? %>
</div> --> </div> -->
@@ -20,4 +20,3 @@
<%= render_menu :top_home_menu if User.current.logged? || !Setting.login_required? -%> <%= render_menu :top_home_menu if User.current.logged? || !Setting.login_required? -%>
</div> </div>
<div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 5px;margin-top: -10px;"></div> <div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 5px;margin-top: -10px;"></div>


+ 2
- 2
app/views/layouts/_base_homework_attach.html.erb View File

@@ -18,7 +18,7 @@
<tr> <tr>
<td> <td>
<p class="top-content-list-homework"> <p class="top-content-list-homework">
<%=link_to "主页", home_path %> >
<%=link_to "主页", homes_path %> >
<a href="http://<%= Setting.host_course%>" class="link_other_item"> <a href="http://<%= Setting.host_course%>" class="link_other_item">
<%=l(:label_courses_management_platform)%> <%=l(:label_courses_management_platform)%>
</a> > </a> >
@@ -33,4 +33,4 @@
</td> </td>
</tr> </tr>
</table> </table>
</div>
</div>

+ 2
- 2
app/views/layouts/_base_softapplication_index_top_content.html.erb View File

@@ -35,9 +35,9 @@


<tr> <tr>
<td > <td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:field_homepage), homes_path %> >
<%=link_to l(:label_contest_work), :controller=>'softapplications', :action=>'index' %> <%=link_to l(:label_contest_work), :controller=>'softapplications', :action=>'index' %>
</td> </td>
</tr> </tr>
</table> </table>
</div>
</div>

+ 4
- 4
app/views/layouts/_base_softapplication_top_content.html.erb View File

@@ -11,17 +11,17 @@
</td> </td>
<td rowspan="2" width="250px"></td> <td rowspan="2" width="250px"></td>
</tr> </tr>
<tr> <tr>
<td > <td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:field_homepage), homes_path %> >
<a><%= l(:label_contest_innovate) %></a> <a><%= l(:label_contest_innovate) %></a>
<span> <span>
<% contest = @softapplication.contests.first %> <% contest = @softapplication.contests.first %>
<%= contest ? link_to(">" + contest.name, show_contest_contest_path(contest)) : '尚未加入竞赛'%> <%= contest ? link_to(">" + contest.name, show_contest_contest_path(contest)) : '尚未加入竞赛'%>
</span> </span>
</td> </td>
</tr> </tr>
</table> </table>
</div>
</div>

+ 17
- 1
app/views/layouts/_footer.html.erb View File

@@ -1,3 +1,4 @@
<% if false %>
<div id="Footer" class="f12"> <div id="Footer" class="f12">
<div class="footerAboutContainer"> <div class="footerAboutContainer">
<ul class="footerAbout"> <ul class="footerAbout">
@@ -42,4 +43,19 @@
<p ><%= l(:label_rights_reserved)%><span class="mr10"></span><a href="http://beian.miit.gov.cn" class=" f_grey" target="_blank"><%= l(:label_license)%></a></p> <p ><%= l(:label_rights_reserved)%><span class="mr10"></span><a href="http://beian.miit.gov.cn" class=" f_grey" target="_blank"><%= l(:label_license)%></a></p>
</div> </div>
</ul> </ul>
</div><!--Footer end-->
</div><!--Footer end-->
<% end %>
<div class="tac tac_footer">
<div>
<p class="mb20 tac_f_link">
<a href="<%= agreement_path %>" class="mr20 ml20 fontGrey8" target="_blank">服务协议</a>
<% memo = Memo.where(:id => 1168).first %>
<% if hidden_unproject_infos && !memo.nil? %>
<%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "mr20 ml20 fontGrey8", :target=>"_blank" %>
<% end %>
<a href="<%= forums_path %>" class="mr20 ml20 fontGrey8" target="_blank" ><%= l(:label_forums)%></a>
<%= link_to "合作伙伴", "#{Setting.protocol}://#{Setting.host_name}/cooperation", :class => "mr20 ml20 fontGrey8", :target=>"_blank" %>
</p>
<%= l(:label_rights_reserved)%><span class="mr10"></span><a href="http://beian.miit.gov.cn/" class="colorWhite" target="_blank"><%= l(:label_license)%></a>
</div>
</div>

+ 25
- 22
app/views/layouts/_logined_header.html.erb View File

@@ -1,38 +1,38 @@
<div class="navHomepage"> <div class="navHomepage">
<div class="navHomepageLogo fl"> <div class="navHomepageLogo fl">
<%=link_to image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3"), home_path()%>
<%=link_to image_tag("../images/logo_blue.png",width:"51px", height: "45px",class: "mt3"), ''%>
</div> </div>
<div class="fl"> <div class="fl">
<ul> <ul>
<li class="navHomepageMenu fl"> <li class="navHomepageMenu fl">
<%= link_to "首页", user_activities_path(User.current), :class => "c_white f16 db p10", :title => "回到个人首页" %>
<%= link_to "首页", user_activities_path(User.current), :class => "color-grey3 f16 db p10", :title => "回到个人首页" %>
</li> </li>
<% if !hidden_unproject_infos %> <% if !hidden_unproject_infos %>
<li class="navHomepageMenu fl"> <li class="navHomepageMenu fl">
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10", :target => "_blank" %>
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "color-grey3 f16 db p10", :target => "_blank" %>
</li> </li>
<% end %> <% end %>
<% if hidden_unproject_infos %> <% if hidden_unproject_infos %>
<li class="navHomepageMenu fl"> <li class="navHomepageMenu fl">
<%= link_to "课程", user_course_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
<%= link_to "课程", user_course_community_path(User.current), :class => "color-grey3 f16 db p10", :target => "_blank" %>
</li> </li>
<% end %> <% end %>
<li class="navHomepageMenu fl"> <li class="navHomepageMenu fl">
<%= link_to "项目", user_project_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
<%= link_to "项目", user_project_community_path(User.current), :class => "color-grey3 f16 db p10", :target => "_blank" %>
</li> </li>
<li class="navHomepageMenu fl"> <li class="navHomepageMenu fl">
<%= link_to "数据", statistics_path, :class => "c_white f16 db p10", :target => "_blank" %>
<%= link_to "数据", statistics_path, :class => "color-grey3 f16 db p10", :target => "_blank" %>
</li> </li>
<% if hidden_unproject_infos %> <% if hidden_unproject_infos %>
<li class="navHomepageMenu fl"> <li class="navHomepageMenu fl">
<%= link_to "竞赛", user_contest_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
<%= link_to "竞赛", user_contest_community_path(User.current), :class => "color-grey3 f16 db p10", :target => "_blank" %>
</li> </li>
<% end %> <% end %>
<li class="navHomepageMenu fl mr20"> <li class="navHomepageMenu fl mr20">
<%= link_to "问吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
<%= link_to "问吧", forums_path, :class =>"color-grey3 f16 db p10", :target => "_blank" %>
</li> </li>
</ul> </ul>
@@ -56,17 +56,6 @@
} }
} }
</script> </script>
<div class="fl" id="navHomepageSearch">
<!--<form class="navHomepageSearchBox">-->
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name %>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索" style="width: 300px" />
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
<% end %>
</div>
<div class="navHomepageProfile" id="navHomepageProfile"> <div class="navHomepageProfile" id="navHomepageProfile">
<ul> <ul>
@@ -97,16 +86,30 @@
</div> </div>
<div class="navHomepageNews" id="user_messages"> <div class="navHomepageNews" id="user_messages">
<%= link_to "", user_path(User.current, :click_user_message => true), :class => "homepageNewsIcon", :target => "_Blank", :title => "您的所有消息" %>
<% new_message_count = User.current.count_new_message.to_i %>
<a href="<%= user_message_path(User.current,click_user_message: true) %>" class="fl"><i class="iconfont icon-xiaoxilingdang fontGrey4 f22 fl mt7"></i></a>
<% new_message_count = User.current.count_new_message("all").to_i %>
<% if new_message_count > 0 %> <% if new_message_count > 0 %>
<div ><%= link_to new_message_count, user_path(User.current, :click_user_message => true), :class => "newsActive", :target => "_Blank" %></div>
<%#= link_to new_message_count, user_path(User.current, :click_user_message => true), :class => "newsActive", :target => "_Blank" %>
<span class="haveNews"></span>
<% end %> <% end %>
<%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %> <%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
<div class="shadowbox_news undis" id="user_messages_list"> <div class="shadowbox_news undis" id="user_messages_list">
<%= render :partial => 'layouts/message_loading' %> <%= render :partial => 'layouts/message_loading' %>
</div> </div>
</div> </div>
<div class="fr mr20" id="navHomepageSearch">
<!--<form class="navHomepageSearchBox">-->
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name %>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索" style="width: 300px" />
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));">
<i class="iconfont icon-sousuo f20 ml5 mt4 fl"></i>
</a>
<% end %>
</div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">


+ 5
- 2
app/views/layouts/_show_messages_list.html.erb View File

@@ -243,11 +243,14 @@
<% content = '<span class="shadowbox_news_user">'+ma.author.show_name+' </span>提到了你:'+ma.subject.html_safe %> <% content = '<span class="shadowbox_news_user">'+ma.author.show_name+' </span>提到了你:'+ma.subject.html_safe %>
<li><%=link_to content.html_safe, ma.url, :title => ma.author.show_name+' 提到了你:'+ma.subject.html_safe, :target => '_blank' %></li> <li><%=link_to content.html_safe, ma.url, :title => ma.author.show_name+' 提到了你:'+ma.subject.html_safe, :target => '_blank' %></li>
<% end %> <% end %>
<% end %>
<% elsif ma.class == PrivateMessage %>
<li><a href="<%=private_messages_detail_user_private_messages_path(current_user, target_ids: ma.target_id) %>" target="_blank" ><span class="shadowbox_news_user"><%= ma.target.try(:show_name) %> </span>给您发了私信:<%= ma.content%></a></li>

<% end %>
<% end %> <% end %>
</ul> </ul>
<!--<a onclick = "show_more();" id = "show_more_messages" style="display: none; cursor: pointer;" class = "shadowbox_news_all">展开更多</a>--> <!--<a onclick = "show_more();" id = "show_more_messages" style="display: none; cursor: pointer;" class = "shadowbox_news_all">展开更多</a>-->
<%= link_to '查看全部', user_path(User.current), :id =>'show_all_messages', :class => "shadowbox_news_all", :target =>"_Blank" %>
<%= link_to '查看全部', user_message_path(User.current), :id =>'show_all_messages', :class => "shadowbox_news_all", :target =>"_Blank" %>
</div> </div>


<script type="text/javascript"> <script type="text/javascript">


+ 31
- 29
app/views/layouts/_unlogin_header.html.erb View File

@@ -1,6 +1,6 @@
<div class="navHomepage"> <div class="navHomepage">
<div class="navHomepageLogo fl"> <div class="navHomepageLogo fl">
<%= link_to image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3"), home_path %>
<%= link_to image_tag("../images/logo_blue.png",width:"51px", height: "45px",class: "mt3"), homes_path %>
</div> </div>
<div class="fl"> <div class="fl">
<ul> <ul>
@@ -11,12 +11,12 @@
<% memo = Memo.where(:id => 1168).first %> <% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %> <% unless memo.nil? %>
<li class="navHomepageMenu fl mr40"> <li class="navHomepageMenu fl mr40">
<a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="c_white f16 db p10" >帮助中心</a>
<a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="color-grey3 f16 db p10" >帮助中心</a>
</li> </li>
<% end %> <% end %>
<% else %> <% else %>
<li class="navHomepageMenu fl mr40"> <li class="navHomepageMenu fl mr40">
<%= link_to "问吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
<%= link_to "问吧", forums_path, :class =>"color-grey3 f16 db p10", :target => "_blank" %>
</li> </li>
<% end %> <% end %>
</ul> </ul>
@@ -59,41 +59,43 @@
} }
} }
</script> </script>
<div class="fl" id="navHomepageSearch" >
<div id="loginInButton" class="fr ml20">
<a href="<%= signin_url_without_domain %>" class="color-grey3 db">登录</a>
</div>
<div id="loginSignButton" class="fr">
<a href="<%= register_url_without_domain %>" class="color-grey3 db">注册</a>
</div>
<div class="fr mr20" id="navHomepageSearch" >
<!--<form class="navHomepageSearchBox">--> <!--<form class="navHomepageSearchBox">-->
<% name = name%> <% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox',:style=>'width:380px;', method: :get) do %> <%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox',:style=>'width:380px;', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的班级、项目、用户、资源以及帖子" onkeypress="search_in_header_I(event,$(this));"/>
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的班级、项目、用户、资源以及帖子" onkeypress="search_in_header_I(event,$(this));"/>
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));">
<i class="iconfont icon-sousuo f20 ml5 mt4 fl"></i>
</a>
<% end %> <% end %>
<!--<div class="navSearchTypeBox" id="navHomepageSearchType">--> <!--<div class="navSearchTypeBox" id="navHomepageSearchType">-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="courses" name="search_type" checked/>-->
<!--课程-->
<!--</div>-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="projects" name="search_type" />-->
<!--项目-->
<!--</div>-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="users" name="search_type" />-->
<!--用户-->
<!--</div>-->
<!--<div id="navSearchAlert" class="fr mr10">-->
<!--<span class="c_red">请选择搜索类型</span>-->
<!--</div>-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="courses" name="search_type" checked/>-->
<!--课程-->
<!--</div>-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="projects" name="search_type" />-->
<!--项目-->
<!--</div>-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="users" name="search_type" />-->
<!--用户-->
<!--</div>-->
<!--<div id="navSearchAlert" class="fr mr10">-->
<!--<span class="c_red">请选择搜索类型</span>-->
<!--</div>-->
<!--</div>--> <!--</div>-->
</div> </div>
<div id="loginInButton" class="fr ml20">
<a href="<%= signin_url_without_domain %>" class="c_white db">登录</a>
</div>
<div id="loginSignButton" class="fr">
<a href="<%= register_url_without_domain %>" class="c_white db">注册</a>
</div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">


+ 2
- 1
app/views/layouts/base.html.erb View File

@@ -32,7 +32,7 @@
</script> </script>
</head> </head>
<body class="<%=h body_css_classes %>" onload="prettyPrint();"> <body class="<%=h body_css_classes %>" onload="prettyPrint();">
<div class="pageContainer">
<div class="cl"></div> <div class="cl"></div>
<div class="navContainer mb10"> <div class="navContainer mb10">
<% if User.current.logged? %> <% if User.current.logged? %>
@@ -66,6 +66,7 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
</div>
<div class="cl"></div> <div class="cl"></div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
</body> </body>


+ 4
- 4
app/views/layouts/base_.html.erb View File

@@ -32,7 +32,7 @@
<div class="project_header_tag"> <div class="project_header_tag">
标签:项目托管 社交网络 Rails 标签:项目托管 社交网络 Rails
</div> </div>
<%= link_to "主页:www.trustie.net", home_path, :class => 'project_homepage_tag' %>
<%= link_to "主页:www.trustie.net", homes_path, :class => 'project_homepage_tag' %>
<h1><%= page_header_title %> <h1><%= page_header_title %>
<% if @project.description.present? %> <% if @project.description.present? %>
<%= textilizable @project.description %> <%= textilizable @project.description %>
@@ -43,8 +43,8 @@
<%= link_to(session[:project_focus_num], {:controller => 'projects', :action => 'focus'}, :class => 'project_infor_tag') +'个关注(' %> <%= link_to(session[:project_focus_num], {:controller => 'projects', :action => 'focus'}, :class => 'project_infor_tag') +'个关注(' %>
<%= link_to(session[:project_investor_num], {:controller => 'projects', :action =>'investor'}, :class => 'project_infor_tag') +'个投资者)'+ '|' %> <%= link_to(session[:project_investor_num], {:controller => 'projects', :action =>'investor'}, :class => 'project_infor_tag') +'个投资者)'+ '|' %>
<%= link_to(session[:project_issue_num], {:controller => 'projects', :action => 'issue'}, :class => 'project_infor_tag') +'个缺陷'+'|' %> <%= link_to(session[:project_issue_num], {:controller => 'projects', :action => 'issue'}, :class => 'project_infor_tag') +'个缺陷'+'|' %>
<%= link_to(session[:project_mission_num], {:controller =>'projects', :action =>'mission'}, :class => 'project_infor_tag')+'个任务'+'|'%>
<%= link_to(session[:project_on_num], {:controller =>'projects', :action =>'on'}, :class => 'project_infor_tag')+'个提交'+'|'%>
<%= link_to(session[:project_mission_num], {:controller =>'projects', :action =>'mission'}, :class => 'project_infor_tag')+'个任务'+'|'%>
<%= link_to(session[:project_on_num], {:controller =>'projects', :action =>'on'}, :class => 'project_infor_tag')+'个提交'+'|'%>
<%= link_to(session[:project_file_num], {:controller =>'projects', :action =>'file'}, :class => 'project_infor_tag')+'个文件' %> <%= link_to(session[:project_file_num], {:controller =>'projects', :action =>'file'}, :class => 'project_infor_tag')+'个文件' %>
<hr size="5"> <hr size="5">
</div> </div>
@@ -57,7 +57,7 @@
<div style="clear:both;"> <div style="clear:both;">
</div> </div>
</div> </div>
</div>
</div>
</div> </div>


<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div> <div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>


+ 10
- 10
app/views/layouts/base_bids.html.erb View File

@@ -22,7 +22,7 @@
<div id="wrapper"> <div id="wrapper">
<div id="wrapper2"> <div id="wrapper2">
<div id="wrapper3"> <div id="wrapper3">
<% if session[:enterprise_college] == 2 %> <% if session[:enterprise_college] == 2 %>
<%=render :partial => 'layouts/base_enterprise_header'%> <%=render :partial => 'layouts/base_enterprise_header'%>
<% elsif session[:enterprise_college] == 1 %> <% elsif session[:enterprise_college] == 1 %>
@@ -30,7 +30,7 @@
<% else %> <% else %>
<%=render :partial => 'layouts/base_header'%> <%=render :partial => 'layouts/base_header'%>
<% end %> <% end %>
<div id="main"> <div id="main">
<!-- added by bai --> <!-- added by bai -->
<div class="top-content"> <div class="top-content">
@@ -62,7 +62,7 @@
</a> </a>
</td> </td>
<td > <td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:field_homepage), homes_path %> >
<%=link_to l(:label_requirement_enterprise), :controller => 'bids', :action => 'index' %> > <%=link_to l(:label_requirement_enterprise), :controller => 'bids', :action => 'index' %> >
<span> <span>
<%=link_to @bid.name ,bid_path %> <%=link_to @bid.name ,bid_path %>
@@ -71,7 +71,7 @@
</tr> </tr>
</table> </table>
</div> </div>
<!-- end --> <!-- end -->
<div id="sidebar"> <div id="sidebar">
<div class="main_context"> <div class="main_context">
@@ -137,7 +137,7 @@
<%= @bid.budget%>&nbsp; <%= @bid.budget%>&nbsp;
<%= l(:label_bids_credit_number) %> <%= l(:label_bids_credit_number) %>
</td> </td>
<% end %>
<% end %>
</tr> </tr>
<tr> <tr>
<td> <td>
@@ -180,7 +180,7 @@
<%= link_to l(:label_x_bids_responses, :count => @bid.commit)+"("+@bid.commit.to_s+")", respond_path(@bid)%> <%= link_to l(:label_x_bids_responses, :count => @bid.commit)+"("+@bid.commit.to_s+")", respond_path(@bid)%>
</div> </div>
</div> </div>
<!--tags--> <!--tags-->
<div class="user_fans"> <div class="user_fans">
<div class="font_title_left"> <div class="font_title_left">
@@ -191,7 +191,7 @@
<div class="user_underline"></div> <div class="user_underline"></div>
<table style="font-family:'微软雅黑'"> <table style="font-family:'微软雅黑'">
<tr> <tr>
<td><!-- added by william -for tag -->
<td><!-- added by william -for tag -->
<%= render :partial => 'tags/tag', :locals => {:obj => @bid, :object_flag => "4"}%> <%= render :partial => 'tags/tag', :locals => {:obj => @bid, :object_flag => "4"}%>
</td> </td>
</tr> </tr>
@@ -217,7 +217,7 @@
</p> </p>
<% end%> <% end%>
</td> </td>
</tr>
</tr>
</table> </table>
</div> </div>
</div> </div>
@@ -235,11 +235,11 @@
<% for project in @bid.projects%> <% for project in @bid.projects%>
<%= link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name),project_path(project) %> <%= link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name),project_path(project) %>
<% end%> <% end%>
<% else %>
<% else %>
<p class="font_lighter"><%= l(:label_no_bid_project) %></p> <p class="font_lighter"><%= l(:label_no_bid_project) %></p>
<% end %> <% end %>
</td> </td>
</tr>
</tr>
</table> </table>
</div> </div>
</div> </div>


+ 3
- 2
app/views/layouts/base_contest_community.html.erb View File

@@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<%= favicon %> <%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user','css/iconfont/iconfont', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify','contest'%> <%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify','contest'%>
@@ -30,6 +30,7 @@
</head> </head>


<body onload="prettyPrint();"> <body onload="prettyPrint();">
<div class="pageContainer">
<div class="navContainer"> <div class="navContainer">
<% is_current_user = User.current.logged? && User.current == @user%> <% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %> <% if User.current.logged? %>
@@ -80,7 +81,7 @@
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
<div class="cl"></div> <div class="cl"></div>
</div>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>


+ 3
- 1
app/views/layouts/base_contests.html.erb View File

@@ -12,7 +12,7 @@
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','css/sy_public','css/syllabus', 'css/moduel','css/contest'%>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify','css/iconfont/iconfont', 'css/courses','css/popup','css/sy_public','css/syllabus', 'css/moduel','css/contest'%>
<%= javascript_include_tag "course","avatars","header","attachments",'prettify','contest' %> <%= javascript_include_tag "course","avatars","header","attachments",'prettify','contest' %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
@@ -31,6 +31,7 @@


<!--add by huang--> <!--add by huang-->
<body onload="prettyPrint();"> <body onload="prettyPrint();">
<div class="pageContainer">
<div class="navContainer mb10"> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div> <div class="navContainer mb10"> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div>
<div class="cl"></div> <div class="cl"></div>


@@ -97,6 +98,7 @@
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
<div class="cl"></div> <div class="cl"></div>
</div>
<% if hidden_unproject_infos %> <% if hidden_unproject_infos %>
<%= render :partial => 'layouts/new_feedback' %> <%= render :partial => 'layouts/new_feedback' %>
<% end %> <% end %>


+ 3
- 2
app/views/layouts/base_course_community.html.erb View File

@@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<%= favicon %> <%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public','css/iconfont/iconfont', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%> <%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
@@ -30,6 +30,7 @@
</head> </head>


<body onload="prettyPrint();"> <body onload="prettyPrint();">
<div class="pageContainer">
<div class="navContainer"> <div class="navContainer">
<% is_current_user = User.current.logged? && User.current == @user%> <% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %> <% if User.current.logged? %>
@@ -104,7 +105,7 @@
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
<div class="cl"></div> <div class="cl"></div>
</div>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>


+ 2
- 1
app/views/layouts/base_courses.html.erb View File

@@ -42,6 +42,7 @@
</head> </head>
<!--add by huang--> <!--add by huang-->
<body onload="prettyPrint();"> <body onload="prettyPrint();">
<div class="pageContainer">
<div class="navContainer"> <div class="navContainer">
<% if User.current.logged? %> <% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %> <%= render :partial => 'layouts/logined_header' %>
@@ -168,7 +169,7 @@
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
<div class="cl"></div> <div class="cl"></div>
</div>
<%= render :partial => 'layouts/new_feedback' %> <%= render :partial => 'layouts/new_feedback' %>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>


+ 3
- 2
app/views/layouts/base_forums.html.erb View File

@@ -162,7 +162,7 @@
</script> </script>
</head> </head>
<body class="<%= h body_css_classes %>" onload="prettyPrint();"> <body class="<%= h body_css_classes %>" onload="prettyPrint();">
<div class="pageContainer">
<div class="cl"></div> <div class="cl"></div>
<div class="navContainer"> <div class="navContainer">
<% if User.current.logged? %> <% if User.current.logged? %>
@@ -241,12 +241,13 @@
<%#= call_hook :view_layouts_base_content %> <%#= call_hook :view_layouts_base_content %>
</div> </div>
</div> </div>
</div>
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div> <div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
<div class="cl"></div> <div class="cl"></div>
</div>
<%#= call_hook :view_layouts_base_body_bottom %> <%#= call_hook :view_layouts_base_body_bottom %>
</body> </body>
</html> </html>


+ 1
- 1
app/views/layouts/base_homework.html.erb View File

@@ -77,7 +77,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<p class="top-content-list-homework"><%= link_to "主页", home_path %>
<p class="top-content-list-homework"><%= link_to "主页", homes_path %>
> >
<a href="http://<%= Setting.host_course%>" style="color: #15bccf;"> <a href="http://<%= Setting.host_course%>" style="color: #15bccf;">
<%=l(:label_course_practice) %> <%=l(:label_course_practice) %>


+ 3
- 3
app/views/layouts/base_introduce.html.erb View File

@@ -19,15 +19,15 @@
</head> </head>
<!--add by huang--> <!--add by huang-->
<body onload="prettyPrint();" style="background: #fff;"> <body onload="prettyPrint();" style="background: #fff;">
<div class="pageContainer">
<div class=""> <div class="">
<%= yield %> <%= yield %>
</div> </div>


<div class="cl"></div> <div class="cl"></div>
<%#= render :partial => 'layouts/footer' %>
<p class="tac mb20"><%= l(:label_rights_reserved)%><span class="mr10"></span><a href="http://beian.miit.gov.cn/" class=" f_grey" target="_blank"><%= l(:label_license)%></a></p>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>


</div>
<%#= render :partial => 'layouts/new_feedback' %> <%#= render :partial => 'layouts/new_feedback' %>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>


+ 2
- 1
app/views/layouts/base_mail.html.erb View File

@@ -23,7 +23,7 @@
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示--> <!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
</head> </head>
<body class="<%=h body_css_classes %>" onload="prettyPrint();"> <body class="<%=h body_css_classes %>" onload="prettyPrint();">
<div class="pageContainer">
<div class="cl"></div> <div class="cl"></div>
<div class="navContainer mb10"> <div class="navContainer mb10">
<% if User.current.logged? %> <% if User.current.logged? %>
@@ -54,6 +54,7 @@
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
<div class="cl"></div> <div class="cl"></div>
</div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
</body> </body>
</html> </html>

+ 11
- 11
app/views/layouts/base_memos.html.erb View File

@@ -31,7 +31,7 @@
</head> </head>
<!--add by huang--> <!--add by huang-->
<body class="<%= h body_css_classes %>"> <body class="<%= h body_css_classes %>">
<div class="pageContainer">
<div class="cl"></div> <div class="cl"></div>
<div class="navContainer mb10"> <div class="navContainer mb10">
<% if User.current.logged? %> <% if User.current.logged? %>
@@ -48,7 +48,7 @@
<div id="main"> <div id="main">
<!-- added by bai --> <!-- added by bai -->
<div class="top-content">
<div class="top-content">
<table> <table>
<tr> <tr>
<td class="info_font" style="width: 240px; color: #15bccf"><%= l(:label_projects_community)%></td> <td class="info_font" style="width: 240px; color: #15bccf"><%= l(:label_projects_community)%></td>
@@ -56,20 +56,20 @@
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/forums", forums_path %></a></td> <td style="padding-left: 8px"><a><%= link_to request.host()+"/forums", forums_path %></a></td>
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to '公共贴吧', :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name, forum_path(@forum) %> > <%=link_to @memo.subject, forum_memo_path(@forum, @memo) %></p></td>
<td><p class="top-content-list"><%=link_to l(:label_home),homes_path %> > <%=link_to '公共贴吧', :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name, forum_path(@forum) %> > <%=link_to @memo.subject, forum_memo_path(@forum, @memo) %></p></td>
</tr> </tr>
</table>
</table>
</div> </div>
<div id="sidebar"> <div id="sidebar">
<!--informations--> <!--informations-->
<div class="sidebar-forums"> <div class="sidebar-forums">
<div class="forums-line">
<div class="forums-line">
<div class="forums-title"><%= @forum.name %></div> <div class="forums-title"><%= @forum.name %></div>
<div class="forums-description upload_img"><%= @forum.description.html_safe %></div> <div class="forums-description upload_img"><%= @forum.description.html_safe %></div>
</div>
</div>
<!--informations--> <!--informations-->
<div class="formus-first-title" >创建人信息</div> <div class="formus-first-title" >创建人信息</div>
<div class="forums-info">
<div class="forums-info">
<div style="padding-top: 20px" > <div style="padding-top: 20px" >
<span class="forums-avatar-left"><%= image_tag(url_to_avatar(@forum.creator), :class => 'vatar-size') %></span> <span class="forums-avatar-left"><%= image_tag(url_to_avatar(@forum.creator), :class => 'vatar-size') %></span>
<span class="forums-avatar-right"> <span class="forums-avatar-right">
@@ -83,11 +83,11 @@
<% end %> <% end %>
</div> </div>
</div> </div>
<!--tags-->
<% if User.current.logged? || User.current.admin? %>
<!--tags-->
<% if User.current.logged? || User.current.admin? %>
<!-- <div class="forums-tags">< %= render :partial => 'tags/tag', :locals => {:obj => @forum.creator,:object_flag => "1"} %></div> --> <!-- <div class="forums-tags">< %= render :partial => 'tags/tag', :locals => {:obj => @forum.creator,:object_flag => "1"} %></div> -->
<div class="forums-tags"><%= render :partial => 'tags/tag', :locals => {:obj => @forum,:object_flag => "5"} %></div> <div class="forums-tags"><%= render :partial => 'tags/tag', :locals => {:obj => @forum,:object_flag => "5"} %></div>
<% end %>
<% end %>
</div> </div>
</div> </div>
<div id="content"> <div id="content">
@@ -108,8 +108,8 @@
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
<div class="cl"></div> <div class="cl"></div>
</div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
</div> </div>
</body> </body>
</html> </html>

+ 2
- 0
app/views/layouts/base_new_forum.html.erb View File

@@ -19,6 +19,7 @@


<!--add by huang--> <!--add by huang-->
<body onload="prettyPrint();"> <body onload="prettyPrint();">
<div class="pageContainer">
<div class="navContainer mb10"> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div> <div class="navContainer mb10"> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div>
<div class="cl"></div> <div class="cl"></div>


@@ -33,6 +34,7 @@
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
<div class="cl"></div> <div class="cl"></div>
</div>
<% if hidden_unproject_infos %> <% if hidden_unproject_infos %>
<%= render :partial => 'layouts/new_feedback' %> <%= render :partial => 'layouts/new_feedback' %>
<% end %> <% end %>


+ 1
- 1
app/views/layouts/base_newcontest.html.erb View File

@@ -78,7 +78,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:field_homepage), homes_path %> >
<a href="http://<%= Setting.host_contest %>" class="link_other_item"> <a href="http://<%= Setting.host_contest %>" class="link_other_item">
<%=l(:label_contests_management_platform)%> <%=l(:label_contests_management_platform)%>


+ 1
- 2
app/views/layouts/base_opensource_p.html.erb View File

@@ -40,7 +40,7 @@
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px"><%= link_to request.host()+"/open_source_projects", :controller => 'open_source_projects', :action => 'index' %></td> <td style="padding-left: 8px"><%= link_to request.host()+"/open_source_projects", :controller => 'open_source_projects', :action => 'index' %></td>
<td ><%= link_to l(:field_homepage), home_path %> > <%= link_to "开源项目社区", :controller => 'open_source_projects', :action => 'index' %> > <%=link_to @open_source_project.name, open_source_project_path(@open_source_project) %></td>
<td ><%= link_to l(:field_homepage), homes_path %> > <%= link_to "开源项目社区", :controller => 'open_source_projects', :action => 'index' %> > <%=link_to @open_source_project.name, open_source_project_path(@open_source_project) %></td>
</tr> </tr>
</table> </table>
</div> </div>
@@ -158,4 +158,3 @@
</div> </div>
</body> </body>
</html> </html>


+ 1
- 1
app/views/layouts/base_org.html.erb View File

@@ -12,7 +12,7 @@
<%= favicon %> <%= favicon %>
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= stylesheet_link_tag 'prettify','jquery/jquery-ui-1.9.2','css/common','css/structure','css/public','repository','css/courses','css/org','css/project', 'css/popup', 'css/moduel' %>
<%= stylesheet_link_tag 'prettify','jquery/jquery-ui-1.9.2','css/common','css/structure','css/public','repository','css/iconfont/iconfont','css/courses','css/org','css/project', 'css/popup', 'css/moduel' %>
<%= javascript_include_tag 'cookie','project',"avatars", 'organization','header','prettify','select_list_move','org'%> <%= javascript_include_tag 'cookie','project',"avatars", 'organization','header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'attachments' %> <%= javascript_include_tag 'attachments' %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>


+ 4
- 2
app/views/layouts/base_project_community.html.erb View File

@@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<%= favicon %> <%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user','css/magic-check','css/iconfont/iconfont', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%> <%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
@@ -30,6 +30,7 @@
</head> </head>


<body onload="prettyPrint();"> <body onload="prettyPrint();">
<div class="pageContainer">
<div class="navContainer"> <div class="navContainer">
<% is_current_user = User.current.logged? && User.current == @user%> <% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %> <% if User.current.logged? %>
@@ -80,9 +81,10 @@
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
<div class="cl"></div> <div class="cl"></div>
</div>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>


+ 15
- 15
app/views/layouts/base_projects.html.erb View File

@@ -9,7 +9,7 @@
<%= favicon %> <%= favicon %>
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','css/iconfont/iconfont','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome' %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
@@ -17,23 +17,23 @@
<!--add by huang--> <!--add by huang-->
<body onload="prettyPrint();"> <body onload="prettyPrint();">
<div class="navContainer mb10"> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div>
<div class="cl"></div>
<div class="pageContainer">
<div class="navContainer mb10"> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div>
<div class="cl"></div>
<div id="Container">
<div id="content" class="sy_contanier" style=" width:1000px; margin:0 auto;">
<%= render :partial => 'layouts/base_project_top' %>
</div>
<div id="Container">
<div id="content" class="sy_contanier" style=" width:1000px; margin:0 auto;">
<%= render :partial => 'layouts/base_project_top' %>
</div>
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
</div> </div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<% if hidden_unproject_infos %> <% if hidden_unproject_infos %>
<%= render :partial => 'layouts/new_feedback' %> <%= render :partial => 'layouts/new_feedback' %>
<% end %> <% end %>


+ 1
- 1
app/views/layouts/base_statistic.html.erb View File

@@ -9,7 +9,7 @@
<%= favicon %> <%= favicon %>
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/iconfont/iconfont','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome' %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save