Compare commits

...

182 Commits

Author SHA1 Message Date
  Jasder 0793d17726 FIX 7 years ago
  Jasder f4890dfa25 FIX project setting revison 7 years ago
  Jasder d37e026d68 FIX create project revision 7 years ago
  Jasder 69bdb65ec7 ADD init some licenses and ignores 7 years ago
  Jasder 5466b44757 ADD some fields to projects table 7 years ago
  Jasder b8557840c8 ADD model Ignore 7 years ago
  Jasder 3b22ad0a54 ADD model License 7 years ago
  Jasder 4f8e992fb1 Merge branch 'dev-homepage-revision' into dev_project_new 7 years ago
  Jasder 36a11d9690 ADD trustie home edit 7 years ago
  Jasder 33cc2f2b15 FIX 众包学习平台更改为'众包标注平台' 7 years ago
  Jasder 30becc226c FIX delete file 7 years ago
  Jasder 3ec29f29c0 FIX educoder plateform url bug 7 years ago
  caishi 06e60fc853 fix 7 years ago
  Jasder 01b0f6beea Merge branch 'dev_project_new' of http://git.trustie.net/jacknudt/trustieforge into dev_project_new 7 years ago
  caishi 0bce630c8c 项目主页 7 years ago
  Jasder 49bbefac2e FIX created_on sort 7 years ago
  Jasder 3b8f5eb906 FIX bug 7 years ago
  Jasder ba663b26ab FIX gemfile version bug 7 years ago
  Jasder b4bca51a85 Merge branch 'dev-homepage-revision' of http://git.trustie.net/jacknudt/trustieforge into dev-homepage-revision 7 years ago
  Jasder a46ae51006 ADD project list and search by name 7 years ago
  Jasder ce0d1e5f2e ADD ransack gem 7 years ago
  Jasder dd0fafe533 ADD some field to projects table 7 years ago
  caishi 04236f338c lost 7 years ago
  caishi 29e65d2f1c 博客 7 years ago
  caishi a8510bb4da 博客 7 years ago
  caishi 97d90bdcd4 项目新建页面改版 7 years ago
  Jasder 65ebeaed25 ADD model ProjectLanguage and associations 7 years ago
  Jasder edd8780607 ADD a tree structure to model ProjectCategory 7 years ago
  Jasder d16faf40af ADD model ProjectCategory 7 years ago
  SylorHuang 6180774d9b Merge branch 'dev-homepage-revision' of http://git.trustie.net/jacknudt/trustieforge into dev-homepage-revision 7 years ago
  SylorHuang 82956b37dd 消息的部分优化 7 years ago
  Jasder dce8c2f776 FIX change homes_path 7 years ago
  SylorHuang 5a061f1ca2 private_messages 页面新增loading图标 7 years ago
  SylorHuang 2c0e26499e Merge branch 'dev_new_head' into dev-homepage-revision 7 years ago
  SylorHuang 7f29a13fab add myimgh48 css 7 years ago
  SylorHuang b988cb0a54 Merge branch 'dev_new_head' into dev-homepage-revision 7 years ago
  SylorHuang 8d55788cd0 个人主页待办事项及底部的部分信息 7 years ago
  caishi bfcc9c6b38 nyan 7 years ago
  caishi b0ecc9f819 nyan 7 years ago
  caishi 61b844dfd4 个人主页左侧 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 2690 additions and 1098 deletions
Split View
  1. +0
    -4
      .gitignore
  2. +5
    -0
      Gemfile
  3. +406
    -0
      Gemfile.lock
  4. +74
    -0
      README.md
  5. +0
    -5
      README.rdoc
  6. +46
    -41
      ReadMe.txt
  7. +7
    -2
      app/api/mobile/api.rb
  8. +71
    -0
      app/api/mobile/apis/homes.rb
  9. +3
    -0
      app/assets/javascripts/private_messages.js.coffee
  10. +3
    -0
      app/assets/stylesheets/private_messages.css.scss
  11. +5
    -5
      app/controllers/account_controller.rb
  12. +36
    -0
      app/controllers/admin_controller.rb
  13. +9
    -9
      app/controllers/application_controller.rb
  14. +61
    -0
      app/controllers/dynamic_news_controller.rb
  15. +106
    -0
      app/controllers/homes_controller.rb
  16. +138
    -0
      app/controllers/private_messages_controller.rb
  17. +1
    -2
      app/controllers/projects_controller.rb
  18. +1
    -1
      app/controllers/pull_requests_controller.rb
  19. +302
    -285
      app/controllers/users_controller.rb
  20. +39
    -9
      app/controllers/web_footer_companies_controller.rb
  21. +4
    -0
      app/helpers/admin_helper.rb
  22. +2
    -0
      app/helpers/dynamic_new_helper.rb
  23. +36
    -0
      app/helpers/homes_helper.rb
  24. +2
    -0
      app/helpers/private_messages_helper.rb
  25. +27
    -11
      app/helpers/projects_helper.rb
  26. +11
    -11
      app/helpers/users_helper.rb
  27. +21
    -0
      app/helpers/web_footer_companies_helper.rb
  28. +3
    -0
      app/models/banner.rb
  29. +3
    -0
      app/models/category.rb
  30. +5
    -0
      app/models/cover.rb
  31. +14
    -0
      app/models/dynamic_new.rb
  32. +26
    -0
      app/models/home.rb
  33. +3
    -0
      app/models/ignore.rb
  34. +3
    -0
      app/models/license.rb
  35. +13
    -0
      app/models/private_message.rb
  36. +27
    -17
      app/models/project.rb
  37. +9
    -0
      app/models/project_category.rb
  38. +8
    -0
      app/models/project_language.rb
  39. +6
    -0
      app/models/school.rb
  40. +168
    -30
      app/models/user.rb
  41. +12
    -1
      app/models/web_footer_company.rb
  42. +9
    -0
      app/services/dynamic_news_service.rb
  43. +15
    -0
      app/services/homes_service.rb
  44. +0
    -488
      app/views/account/_introduce.html.erb
  45. +66
    -0
      app/views/admin/_dynamic_news.html.erb
  46. +30
    -0
      app/views/admin/dynamic_news.html.erb
  47. +1
    -0
      app/views/admin/dynamic_news.js.erb
  48. +32
    -0
      app/views/admin/home.html.erb
  49. +1
    -1
      app/views/admin/organization.html.erb
  50. +1
    -6
      app/views/admin/web_footer_made.html.erb
  51. +39
    -23
      app/views/applied_project/_applied_join_project.html.erb
  52. +10
    -10
      app/views/bids/contest.html.erb
  53. +6
    -6
      app/views/bids/index.html.erb
  54. +1
    -1
      app/views/courses/index.html.erb
  55. +2
    -2
      app/views/courses/search.html.erb
  56. +70
    -0
      app/views/dynamic_news/_form.html.erb
  57. +23
    -0
      app/views/dynamic_news/edit.html.erb
  58. +2
    -0
      app/views/dynamic_news/index.html.erb
  59. +22
    -0
      app/views/dynamic_news/new.html.erb
  60. +5
    -0
      app/views/homes/_banners.html.erb
  61. +45
    -0
      app/views/homes/_companies.html.erb
  62. +15
    -0
      app/views/homes/_dynamic_news.html.erb
  63. +60
    -0
      app/views/homes/_educoder.html.erb
  64. +30
    -0
      app/views/homes/_floating_tabs.html.erb
  65. +25
    -0
      app/views/homes/_form.html.erb
  66. +8
    -0
      app/views/homes/_home.html.erb
  67. +12
    -0
      app/views/homes/_nav_buttons.html.erb
  68. +17
    -0
      app/views/homes/_news_list.html.erb
  69. +52
    -0
      app/views/homes/_ossean.html.erb
  70. +3
    -0
      app/views/homes/_partners.html.erb
  71. +18
    -0
      app/views/homes/_statistics.html.erb
  72. +51
    -0
      app/views/homes/_trustie_coderpedia.html.erb
  73. +49
    -0
      app/views/homes/_trustie_forge.html.erb
  74. +54
    -0
      app/views/homes/index.html.erb
  75. +15
    -0
      app/views/homes/news.html.erb
  76. +1
    -0
      app/views/homes/news.js.erb
  77. +17
    -0
      app/views/homes/partners.html.erb
  78. +14
    -0
      app/views/homes/show.html.erb
  79. +9
    -14
      app/views/issues/index.html.erb
  80. +1
    -1
      app/views/journals/index.builder
  81. +3
    -4
      app/views/layouts/_base_college_header.html.erb
  82. +17
    -17
      app/views/layouts/_base_enterprise_header.html.erb
  83. +3
    -4
      app/views/layouts/_base_home_menu.html.erb
  84. +2
    -2
      app/views/layouts/_base_homework_attach.html.erb
  85. +2
    -2
      app/views/layouts/_base_softapplication_index_top_content.html.erb
  86. +4
    -4
      app/views/layouts/_base_softapplication_top_content.html.erb
  87. +17
    -1
      app/views/layouts/_footer.html.erb
  88. +27
    -23
      app/views/layouts/_logined_header.html.erb
  89. +1
    -1
      app/views/layouts/_logined_header_show.html.erb
  90. +5
    -2
      app/views/layouts/_show_messages_list.html.erb
  91. +31
    -29
      app/views/layouts/_unlogin_header.html.erb
  92. +2
    -1
      app/views/layouts/base.html.erb
  93. +4
    -4
      app/views/layouts/base_.html.erb
  94. +10
    -10
      app/views/layouts/base_bids.html.erb
  95. +3
    -2
      app/views/layouts/base_contest_community.html.erb
  96. +3
    -1
      app/views/layouts/base_contests.html.erb
  97. +3
    -2
      app/views/layouts/base_course_community.html.erb
  98. +2
    -1
      app/views/layouts/base_courses.html.erb
  99. +3
    -2
      app/views/layouts/base_forums.html.erb
  100. +1
    -1
      app/views/layouts/base_homework.html.erb

+ 0
- 4
.gitignore View File

@@ -17,10 +17,6 @@
/public/cache/*
/config/newrelic.yml
/public/images/avatars/*
/Gemfile
/Gemfile.lock
/db/schema.rb
/Gemfile.lock
/lib/plugins/acts_as_versioned/test/debug.log
.rbenv-gemsets
.DS_Store


+ 5
- 0
Gemfile View File

@@ -40,6 +40,7 @@ gem 'ruby-ole'
gem 'rails_kindeditor',path:'lib/rails_kindeditor'
gem 'binding_of_caller'
gem 'chinese_pinyin'
gem 'jbuilder'
# gem 'sunspot_rails', '~> 1.3.3'
# gem 'sunspot_solr'
# gem 'sunspot'
@@ -50,6 +51,9 @@ gem 'kaminari'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
gem 'ancestry'
gem 'ransack'
#rails 3.2.22.2 bug
# gem "test-unit", "~>3.0"
@@ -59,6 +63,7 @@ gem 'elasticsearch-rails'
group :development do
gem 'grape-swagger'
gem 'sextant'
gem 'better_errors', '~> 1.1.0'
# gem "query_reviewer"
gem 'rack-mini-profiler', '~> 0.9.3'


+ 406
- 0
Gemfile.lock View File

@@ -0,0 +1,406 @@
PATH
remote: lib/gitlab-cli
specs:
gitlab (3.2.0)
httparty
terminal-table

PATH
remote: lib/grack
specs:
grack (2.0.2)
rack (~> 1.4.5)

PATH
remote: lib/rails_kindeditor
specs:
rails_kindeditor (0.4.5)
carrierwave
mini_magick

PATH
remote: lib/wechat
specs:
wechat (0.7.1)
activerecord (>= 3.2, < 5.1.x)
http (~> 1.0, >= 1.0.1)
nokogiri (>= 1.6.0)
thor

GEM
remote: https://gems.ruby-china.com/
specs:
actionmailer (3.2.22.5)
actionpack (= 3.2.22.5)
mail (~> 2.5.4)
actionpack (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.22.5)
activesupport (= 3.2.22.5)
builder (~> 3.0.0)
activerecord (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
activesupport (3.2.22.5)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
acts-as-taggable-on (2.4.1)
rails (>= 3, < 5)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
ancestry (3.0.7)
activerecord (>= 3.2.0)
ansi (1.5.0)
arel (3.0.3)
awesome_print (1.8.0)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
better_errors (1.1.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
builder (3.0.0)
byebug (11.0.1)
carrierwave (0.11.2)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
mimemagic (>= 0.3.0)
certified (1.0.0)
chinese_pinyin (1.0.1)
climate_control (0.2.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.2)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
daemons (1.3.1)
debug_inspector (0.0.3)
delayed_job (4.1.7)
activesupport (>= 3.0, < 5.3)
delayed_job_active_record (4.1.3)
activerecord (>= 3.0, < 5.3)
delayed_job (>= 3.0, < 5)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
elasticsearch (7.2.0)
elasticsearch-api (= 7.2.0)
elasticsearch-transport (= 7.2.0)
elasticsearch-api (7.2.0)
multi_json
elasticsearch-model (6.0.0)
activesupport (> 3)
elasticsearch (> 1)
hashie
elasticsearch-rails (6.0.0)
elasticsearch-transport (7.2.0)
faraday
multi_json
equalizer (0.0.11)
erubis (2.7.0)
execjs (2.7.0)
factory_girl (4.9.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0)
railties (>= 3.0.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
fastercsv (1.5.5)
ffi (1.11.1)
grape (0.9.0)
activesupport
builder
hashie (>= 2.1.0)
multi_json (>= 1.3.2)
multi_xml (>= 0.5.2)
rack (>= 1.3.0)
rack-accept
rack-mount
virtus (>= 1.0.0)
grape-entity (0.4.5)
activesupport
multi_json (>= 1.3.2)
grape-swagger (0.20.0)
awesome_print
grape
grape-entity
hashie (3.6.0)
hike (1.2.3)
htmlentities (4.3.4)
http (1.0.4)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (~> 1.0.1)
http_parser.rb (~> 0.6.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
http-form_data (1.0.3)
http_parser.rb (0.6.0)
httparty (0.16.2)
multi_xml (>= 0.5.2)
i18n (0.6.11)
ice_nine (0.11.2)
iconv (1.0.8)
jbuilder (2.6.4)
activesupport (>= 3.0.0)
multi_json (>= 1.2)
jenkins_api_client (1.5.3)
json (>= 1.0)
mixlib-shellout (>= 1.1.0)
nokogiri (~> 1.6)
socksify (>= 1.7.0)
terminal-table (>= 1.4.0)
thor (>= 0.16.0)
journey (1.0.4)
jquery-rails (2.0.3)
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
json (1.8.6)
kaminari (0.17.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
mail (2.5.5)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.9.2)
mime-types (1.25.1)
mimemagic (0.3.3)
mini_magick (4.9.3)
mini_portile2 (2.4.0)
mixlib-shellout (3.0.4)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.1.1)
mysql2 (0.3.18)
net-ldap (0.3.1)
net-ssh (2.9.1)
netrc (0.11.0)
nio4r (2.4.0)
nokogiri (1.10.3)
mini_portile2 (~> 2.4.0)
paperclip (3.5.4)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
polyglot (0.3.5)
power_assert (1.1.4)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.7.0)
byebug (~> 11.0)
pry (~> 0.10)
public_suffix (3.1.1)
puma (4.0.0)
nio4r (~> 2.0)
rack (1.4.7)
rack-accept (0.4.5)
rack (>= 0.4)
rack-cache (1.9.0)
rack (>= 0.4)
rack-cors (1.0.3)
rack-mini-profiler (0.9.9.2)
rack (>= 1.2.0)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-openid (1.4.2)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-raw-upload (1.1.1)
multi_json
rack-ssl (1.3.4)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (3.2.22.5)
actionmailer (= 3.2.22.5)
actionpack (= 3.2.22.5)
activerecord (= 3.2.22.5)
activeresource (= 3.2.22.5)
activesupport (= 3.2.22.5)
bundler (~> 1.0)
railties (= 3.2.22.5)
railties (3.2.22.5)
actionpack (= 3.2.22.5)
activesupport (= 3.2.22.5)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (12.3.2)
ransack (1.8.10)
actionpack (>= 3.0, < 5.2)
activerecord (>= 3.0, < 5.2)
activesupport (>= 3.0, < 5.2)
i18n
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
rdoc (3.12.2)
json (~> 1.4)
redis (4.1.2)
redis-actionpack (3.2.4)
actionpack (~> 3.2.0)
redis-rack (~> 1.4.4)
redis-store (~> 1.1.4)
redis-activesupport (3.2.5)
activesupport (~> 3.2.0)
redis-store (~> 1.1.0)
redis-rack (1.4.4)
rack (~> 1.4.0)
redis-store (~> 1.1.4)
redis-rails (3.2.4)
redis-actionpack (~> 3.2.4)
redis-activesupport (~> 3.2.4)
redis-store (~> 1.1.4)
redis-store (1.1.7)
redis (>= 2.2)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rich (1.4.6)
jquery-rails
kaminari
mime-types
paperclip
rack-raw-upload
rails (>= 3.2.0)
sass-rails
ruby-ole (1.2.12.2)
ruby-openid (2.1.8)
rubyzip (1.2.2)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
seems_rateable (1.0.13)
jquery-rails
rails
sextant (0.2.4)
rails (>= 3.2)
socksify (1.7.1)
spreadsheet (1.2.3)
ruby-ole (>= 1.0)
sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
test-unit (3.3.2)
power_assert
thor (0.20.3)
thread_safe (0.3.6)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.55)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.6)
unicode-display_width (1.6.0)
virtus (1.0.5)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)

PLATFORMS
ruby

DEPENDENCIES
acts-as-taggable-on (= 2.4.1)
ancestry
ansi
better_errors (~> 1.1.0)
binding_of_caller
builder (= 3.0.0)
certified
chinese_pinyin
coderay (~> 1.1.0)
coffee-rails (~> 3.2.1)
daemons
delayed_job_active_record
elasticsearch-model
elasticsearch-rails
factory_girl_rails
fastercsv (~> 1.5.0)
gitlab!
grack!
grape (~> 0.9.0)
grape-entity (= 0.4.5)
grape-swagger
htmlentities
i18n (~> 0.6.0)
iconv
jbuilder
jenkins_api_client
jquery-rails (~> 2.0.2)
kaminari
mysql2 (= 0.3.18)
net-ldap (~> 0.3.1)
net-ssh (= 2.9.1)
nokogiri
paperclip (~> 3.5.4)
pry-byebug
puma
rack-cors
rack-mini-profiler (~> 0.9.3)
rack-openid
rails (~> 3.2)
rails_kindeditor!
ransack
redis-rails
rest-client
rich (= 1.4.6)
ruby-ole
ruby-openid (~> 2.1.4)
rubyzip
sass-rails (~> 3.2.3)
seems_rateable (~> 1.0.13)
sextant
spreadsheet
test-unit (~> 3.0)
uglifier (>= 1.0.3)
wechat!

BUNDLED WITH
1.17.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

+ 46
- 41
ReadMe.txt View File

@@ -1,7 +1,7 @@
===================================[2014-04-09]=================================
kw: 域名, 二级域名, subdomain, forge, course, contest
域名跳转(forge/course/contest)这几个设置在settings.yml中
但是跳转在development模式下会导致无法开发
kw: 锟斤拷锟斤拷, 锟斤拷锟斤拷锟斤拷锟斤拷, subdomain, forge, course, contest
锟斤拷锟斤拷锟斤拷转锟斤拷forge/course/contest锟斤拷锟解几锟斤拷锟斤拷锟斤拷锟斤拷settings.yml锟斤拷
锟斤拷锟斤拷锟斤拷转锟斤拷development模式锟铰会导锟斤拷锟睫凤拷锟斤拷锟斤拷
app/models/setting.rb :165
# fixed domain url in development. tantantan's bug
@@ -10,90 +10,95 @@ app/models/setting.rb :165
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
end
end
程序部分链接中制定了subdomain参数,使链接在二级域名中来回跳转。
为了开发方便,使之功能在development模式下失效。
锟斤拷锟津部凤拷锟斤拷锟斤拷锟斤拷锟狡讹拷锟斤拷subdomain锟斤拷锟斤拷锟斤拷使锟斤拷锟斤拷锟节讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷转锟斤拷
为锟剿匡拷锟斤拷锟斤拷锟姐,使之锟斤拷锟斤拷锟斤拷development模式锟斤拷失效锟斤拷
===================================[2014-04-09]=================================
kw: 菜单, 导航栏, layout
网页上方的导航条没有用Redmine::MenuManager
MenuManager的样式无法定制,菜单显示条件if中的proc执行行为没有了解
kw: 锟剿碉拷, 锟斤拷锟斤拷锟斤拷, layout
锟斤拷页锟较凤拷锟侥碉拷锟斤拷锟斤拷没锟斤拷锟斤拷Redmine::MenuManager
MenuManager锟斤拷锟斤拷式锟睫凤拷锟斤拷锟狡o拷锟剿碉拷锟斤拷示锟斤拷锟斤拷if锟叫碉拷proc执锟斤拷锟斤拷为没锟斤拷锟剿斤拷
#导航栏匹配域名显示和改变
#锟斤拷锟斤拷锟斤拷匹锟斤拷锟斤拷锟斤拷锟斤拷示锟酵改憋拷
app\helper\application_helper.rb
render_dynamic_nav 方法中,利用变量,可以设置在layout中具体显示哪些条目
render_dynamic_nav 锟斤拷锟斤拷锟叫o拷锟斤拷锟矫憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷layout锟叫撅拷锟斤拷锟斤拷示锟斤拷些锟斤拷目
app\views\layouts\_base_header.html.erb
需要显示的条目,由具体的实例变量设置(在各个layout中)
锟斤拷要锟斤拷示锟斤拷锟斤拷目锟斤拷锟缴撅拷锟斤拷锟斤拷实锟斤拷锟斤拷锟斤拷锟斤拷锟矫o拷锟节革拷锟斤拷layout锟叫o拷
===================================[2014-04-09]=================================
kw: home_path, 首页, 跳转, 二级域名, welcome
#首页根据域名匹配进入不同的页面
kw: home_path, 锟斤拷页, 锟斤拷转, 锟斤拷锟斤拷锟斤拷锟斤拷, welcome
#锟斤拷页锟斤拷锟斤拷锟斤拷锟斤拷匹锟斤拷锟斤拷锟诫不同锟斤拷页锟斤拷
app\controller\welcome_controller.rb
#entry_select 放射设置二级域名所显示的首页
#entry_select 锟斤拷锟斤拷锟斤拷锟矫讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷示锟斤拷锟斤拷页
===================================[2014-06-06]=================================
kw: user_scores
user_scores表结构有问题,需要运行
user_scores锟斤拷锟结构锟斤拷锟斤拷锟解,锟斤拷要锟斤拷锟斤拷
bundle exec rake db:migrate:down VERSION=20140410021724
bundle exec rake db:migrate:up VERSION=20140410021724
===================================[2014-07-08]=================================
kw: CKEditor, 富文本, 编辑器
CKEditor插件加载方法
1.把插件文件夹拷入plugins文件夹,确保文件夹名为redmine_ckeditor
2.运行 bundle install --without development test
3.运行 rake redmine:plugins:migrate RAILS_ENV=production
4.启动服务器
5.配置CKEditor插件(Administration > Plugins > Configure)
6.把文本格式 (Administration > Settings > General > Text formatting)改为CKEditor
注意:一定要先配置CKEditor插件再见文本格式更改,不然,数据库不会生成对应记录,会报错。。
kw: CKEditor, 锟斤拷锟侥憋拷, 锟洁辑锟斤拷
CKEditor锟斤拷锟斤拷锟斤拷锟截凤拷锟斤拷
1.锟窖诧拷锟斤拷锟侥硷拷锟叫匡拷锟斤拷plugins锟侥硷拷锟叫o拷确锟斤拷锟侥硷拷锟斤拷锟斤拷为redmine_ckeditor
2.锟斤拷锟斤拷 bundle install --without development test
3.锟斤拷锟斤拷 rake redmine:plugins:migrate RAILS_ENV=production
4.锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
5.锟斤拷锟斤拷CKEditor锟斤拷锟斤拷(Administration > Plugins > Configure)
6.锟斤拷锟侥憋拷锟斤拷式 (Administration > Settings > General > Text formatting)锟斤拷为CKEditor
注锟解:一锟斤拷要锟斤拷锟斤拷锟斤拷CKEditor锟斤拷锟斤拷锟劫硷拷锟侥憋拷锟斤拷式锟斤拷锟侥o拷锟斤拷然锟斤拷锟斤拷锟捷库不锟斤拷锟斤拷锟缴讹拷应锟斤拷录锟斤拷锟结报锟斤拷锟斤拷锟斤拷
===================================[2014-07-19]=================================
kw: 首页, 定制, forge, course, contest, 排序
若遇到首页定制报错问题请尝试如下操作
如果运行迁移文件有报错与‘sort_type’相关
先运行 bundle exec rake db:migrate:down version=20140716021202 bundle exec rake db:migrate:up version=20140716021202
在按如下步骤执行,未报与之相关的则直接按如下步骤执行
1.运行 bundle exec rake db:migrate:down version=20140719080032
2.运行 bundle exec rake db:migrate:up version=20140719080032
kw: 锟斤拷页, 锟斤拷锟斤拷, forge, course, contest, 锟斤拷锟斤拷
锟斤拷锟斤拷锟斤拷锟斤拷页锟斤拷锟狡憋拷锟斤拷锟斤拷锟斤拷锟诫尝锟斤拷锟斤拷锟铰诧拷锟斤拷
锟斤拷锟斤拷锟斤拷锟斤拷迁锟斤拷锟侥硷拷锟叫憋拷锟斤拷锟诫‘sort_type锟斤拷锟斤拷锟斤拷
锟斤拷锟斤拷锟斤拷 bundle exec rake db:migrate:down version=20140716021202 bundle exec rake db:migrate:up version=20140716021202
锟节帮拷锟斤拷锟铰诧拷锟斤拷执锟叫o拷未锟斤拷锟斤拷之锟斤拷锟截碉拷锟斤拷直锟接帮拷锟斤拷锟铰诧拷锟斤拷执锟斤拷
1.锟斤拷锟斤拷 bundle exec rake db:migrate:down version=20140719080032
2.锟斤拷锟斤拷 bundle exec rake db:migrate:up version=20140719080032
===================================[2014-07-30]=================================
kw: 首页, 定制, forge, course, contest, 排序,image_width
kw: 锟斤拷页, 锟斤拷锟斤拷, forge, course, contest, 锟斤拷锟斤拷锟斤拷image_width
undefined image_width 问题
undefined image_width 锟斤拷锟斤拷
bundle exec rake db:migrate:down version=20140725062302
bundle exec rake db:migrate:up version=20140725062302
=================================[2014-07-19]=====================================
kw: Mysql2::Error,存储过程,CALL sp_project_status_cursor();
kw: Mysql2::Error,锟芥储锟斤拷锟斤拷,CALL sp_project_status_cursor();
bundle exec rake db:migrate:down version=20130828004955
bundle exec rake db:migrate:up version=20130828004955
=================================[2014-08-13]====================================
kw:配置支持的图片格式
默认支持如下格式:"bmp,jpeg,jpg,png,gif"
可在configuration.yml中修改,格式:pic_types: "bmp,jpeg,jpg,png,gif"(注意:pic_types若前面有#号需去掉)
配置完成后重启服务
kw:锟斤拷锟斤拷支锟街碉拷图片锟斤拷式
默锟斤拷支锟斤拷锟斤拷锟铰革拷式锟斤拷"bmp,jpeg,jpg,png,gif"
锟斤拷锟斤拷configuration.yml锟斤拷锟睫改o拷锟斤拷式锟斤拷pic_types: "bmp,jpeg,jpg,png,gif"(注锟解:pic_types锟斤拷前锟斤拷锟斤拷#锟斤拷锟斤拷去锟斤拷)
锟斤拷锟斤拷锟斤拷锟缴猴拷锟斤拷锟斤拷锟斤拷锟斤拷
=================================[2014-08-16]====================================
kw:数据迁移,project_scores表已存在
kw:锟斤拷锟斤拷迁锟狡o拷project_scores锟斤拷锟窖达拷锟斤拷
bundle exec rake db:migrate:down VERSION=20140811022947
bundle exec rake db:migrate:up VERSION=20140811022947
bundle exec rake db:migrate
bundle exec rake project_score:calculate
=================================[2014-10-17]====================================
kw:数据迁移,web_footer_oranizers表已存在
kw:锟斤拷锟斤拷迁锟狡o拷web_footer_oranizers锟斤拷锟窖达拷锟斤拷
bundle exec rake db:migrate:down VERSION=20141013014908
bundle exec rake db:migrate:up VERSION=20141013014908
bundle exec rake db:migrate
kw:数据迁移,web_footer_companies表已存在
kw:锟斤拷锟斤拷迁锟狡o拷web_footer_companies锟斤拷锟窖达拷锟斤拷
bundle exec rake db:migrate:down VERSION=20141013023400
bundle exec rake db:migrate:up VERSION=20141013023400
bundle exec rake db:migrate
=================================[2019-11-12]====================================
鍒濆�鍖栧紑婧愰」鐩�浉鍏崇殑licenses鍜宨gnores
bundle exec rake licenses:init
bundle exec rake ignores:init

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

@@ -21,6 +21,7 @@ module Mobile
require_relative 'apis/resources'
require_relative 'apis/syllabuses'
require_relative 'apis/projects'
require_relative 'apis/homes'
class API < Grape::API
version 'v1', using: :path
@@ -56,6 +57,11 @@ module Mobile
nil
end
# 使用固定token来简单验证用户是否有调用某个api权限
def authenticate_token!
raise 'token is invalid!' unless params[:token].strip == Setting.api_token
end
end
mount Apis::Auth
@@ -77,10 +83,9 @@ module Mobile
mount Apis::Resources
mount Apis::Syllabuses
mount Apis::Projects
mount Apis::Homes
add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
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)
flash[:notice] = l(:notice_account_lost_email_sent)
redirect_to lost_password_path
return
return
end
end
render :layout => 'static_base'
@@ -379,7 +379,7 @@ class AccountController < ApplicationController
def password_authentication
user, last_login_on = User.try_to_login(params[:username], params[:password])
if user.nil?
invalid_credentials
elsif user.status == 2
@@ -447,8 +447,8 @@ class AccountController < ApplicationController
call_hook(:controller_account_success_authentication_after, {:user => user })
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 != ''
redirect_to user_activities_path(user,host: Setting.host_user)
elsif params[:back_url64]
@@ -502,7 +502,7 @@ class AccountController < ApplicationController
# render :layout => 'login'
redirect_to signin_path(:login=>true)
end
def invalid_credentials_new
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
# flash[:error] = l(:notice_account_invalid_creditentials_new)


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

@@ -527,6 +527,27 @@ class AdminController < ApplicationController
end
end
def home
if request.get?
@home = Home.first
elsif request.post?
@home = Home.first || Home.new
@home.name = params[:home][:name]
@home.content = params[:home][:content]
if @home.save
respond_to do |format|
flash[:notice] = l(:notice_successful_update)
format.html { redirect_to admin_home_path }
end
else
respond_to do |format|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@home.errors.full_messages[0]}"
format.html { render :action => 'home' }
end
end
end
end
def course_page_made
if request.get?
@course_page = FirstPage.find_by_page_type('course')
@@ -712,6 +733,21 @@ class AdminController < ApplicationController
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页
# 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 RoutesHelper
helper :routes
#added by william
helper :watchers
@@ -57,7 +57,7 @@ class ApplicationController < ActionController::Base
helper Redmine::MenuManager::MenuHelper
def user_agent
logger.info "HTTP_USER_AGENT #{request.env["HTTP_USER_AGENT"]}"
logger.info "HTTP_USER_AGENT #{request.env["HTTP_USER_AGENT"]}"
end
def session_expiration
@@ -72,7 +72,7 @@ class ApplicationController < ActionController::Base
end
end
def session_expired?
if Setting.session_lifetime?
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
render_404
end
# Finds and sets @project based on @object.project
def find_project_from_association
render_404 unless @object.present?
@@ -488,7 +488,7 @@ class ApplicationController < ActionController::Base
end
end
def find_contest_from_association
render_404 unless @object.present?
@@ -810,10 +810,10 @@ class ApplicationController < ActionController::Base
end
if offset.nil? && options[:page].present?
offset = (options[:page].to_i - 1) * limit
offset = 0 if offset < 0
offset = 0 if offset < 0
offset ||= 0
end
[offset, limit]
end
@@ -876,7 +876,7 @@ class ApplicationController < ActionController::Base
if unsaved_issue_ids.empty?
flash[:notice] = l(:notice_successful_update) unless issues.empty?
else
flash[:error] = l(:notice_failed_to_save_issues,
flash[:error] = l(:notice_failed_to_save_issues,
:count => unsaved_issue_ids.size,
:total => issues.size,
:ids => '#' + unsaved_issue_ids.join(', #'))
@@ -961,7 +961,7 @@ class ApplicationController < ActionController::Base
def find_web_footer
@organizer = WebFooterOranizer.first
@companies = WebFooterCompany.all
@companies = WebFooterCompany.partners
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

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

@@ -0,0 +1,138 @@
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")

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

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
- 2
app/controllers/projects_controller.rb View File

@@ -217,8 +217,7 @@ class ProjectsController < ApplicationController
elsif params[:contest_id]
@contest = Contest.find params[:contest_id]
end
render :layout => 'new_base'
render :layout => 'base_projects_new'
else
redirect_to signin_url
end


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

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



+ 302
- 285
app/controllers/users_controller.rb View File

@@ -41,8 +41,8 @@ class UsersController < ApplicationController
:unapproval_applied_list, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
: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_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]
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list, :project_community,
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :projects_list, :contest_community, :undo_items]
before_filter :auth_user_extension, only: :show
before_filter :show_system_message, :only => [:show]
#before_filter :rest_user_score, only: :show
@@ -477,19 +477,28 @@ class UsersController < ApplicationController
messages.each do |message_all|
# 未读的消息存放在数组
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
end
break if @message_alls.length == 10
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
# 用户消息
# 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复,exercise:课程测验
# issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment)
def user_messages
@user_message_type = "1"
@msg_type = params[:type] || "all"
if !User.current.logged?
redirect_to signin_url
return
@@ -497,71 +506,40 @@ class UsersController < ApplicationController
return render_403
end
# 初始化/更新 点击按钮时间, 24小时内显示系统消息
update_onclick_time
user_all_messages = @user.get_user_messages
# 全部设为已读
# 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").order("created_at desc")
when "project"
@message_alls = user_all_messages.where(message_type: "ForgeMessage").order("created_at desc")
when "at"
@message_alls = user_all_messages.where(message_type: %w(UserFeedbackMessage MemoMessage AtMessage BlogMessage)).order("created_at desc")
when "apply"
@message_alls = user_all_messages.where(message_type: "AppliedMessage").order("created_at desc")
else
render_404
return
@message_alls = user_all_messages.where(message_type: %w(SystemMessage ContestMessage OrgMessage)).order("created_at desc")
end
# @unred_all_messages = 0
#点击进入tab后,全部更新为已读,全部页面除外
# @message_alls = message_alls
@message_alls = paginateHelper @message_alls, 25
@limit = 20
@message_count = @message_alls.size
@message_all_pages = Paginator.new @message_count, @limit, params['page'] || 1
@offset ||= @message_all_pages.offset
@message_alls = paginateHelper @message_alls, @limit
# @message_alls = message_alls.order("created_at desc")
@unred_all_messages = @user.count_new_message(@msg_type)
# @unred_private_messages = 0
@unred_private_messages = @user.unread_private_messages
respond_to do |format|
format.js
format.html{render :layout=>'new_base_user'}
format.html{render layout: "base_user_message"}
end
end
@@ -1671,41 +1649,6 @@ class UsersController < ApplicationController
render :layout=>'base_users_new'
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
@@ -2092,154 +2035,180 @@ class UsersController < ApplicationController
end
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|
format.js
format.html {render :layout => 'new_base_user'}
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
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
@message_count = @user.user_unsolve_messages.count
@limit = 20
@is_remote = true
@unsolved_issues_pages = Paginator.new @unsolved_issues_count, @limit, params['page'] || 1
@@ -2250,20 +2219,28 @@ class UsersController < ApplicationController
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
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
@unfinished_homework_pages = Paginator.new @unfinished_homeworks_count, @limit, params['page'] || 1
@offset ||= @unfinished_homework_pages.offset
@unfinished_homeworks = paginateHelper @unfinished_homeworks, @limit
respond_to do |format|
format.js
end
@@ -2271,12 +2248,8 @@ class UsersController < ApplicationController
# 待完成的测验
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
@limit = 20
@unfinished_test_pages = Paginator.new @unfinished_test_count, @limit, params['page'] || 1
@@ -2289,12 +2262,14 @@ class UsersController < ApplicationController
# 待完成的问卷
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
@limit = 20
@unfinished_poll_pages = Paginator.new @unfinished_poll_count, @limit, params['page'] || 1
@@ -2307,16 +2282,20 @@ class UsersController < ApplicationController
# 待匿评的作业
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
@anonymous_evaluation_pages = Paginator.new @anonymous_evaluation.count, @limit, params['page'] || 1
@offset ||= @anonymous_evaluation_pages.offset
@@ -2326,22 +2305,7 @@ class UsersController < ApplicationController
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
@@ -2413,7 +2377,7 @@ class UsersController < ApplicationController
end
end
# 项目社区
# TODO: 项目社区, 已废弃
def project_community
# 看别人的主页显示动态
#更新用户申请成为课程老师或教辅消息的状态
@@ -2469,6 +2433,37 @@ class UsersController < ApplicationController
end
end
# 项目社区
def projects_list
@project_community = "项目"
@search = params[:name]
@language = params[:language]
@order = params[:order] || 'created_on'
@project_status = params[:project_status] || 'all'
scope = @user.favorite_projects.visible
@all_count = scope.size
@public_count = scope.all_public.size
@private_count = @all_count - @public_count
scope = scope.like(@search).by_language_id(@language)
.includes(:project_language, :members, owner: :user_extensions)
.select("id, name, user_id, description, created_on, visits, project_language_id")
scope = scope.visible if @user != current_user
scope = filter_with_status(@project_status, scope)
scope = order_by_hot_or_time(@order, scope)
@languages = @user.projects.visible.joins(:project_language).group(:project_language_id)
.select("project_language_id, count(*) AS ralation_projects_count, project_languages.name")
@projects = paginateHelper scope, 10
respond_to do |format|
format.js
format.html {render :layout => 'base_user_projects'}
end
end
# 竞赛社区
def contest_community
@contest_community = "竞赛"
@@ -2674,7 +2669,7 @@ class UsersController < ApplicationController
#Modified by nie
unless User.current.admin?
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
# redirect_to home_path
# redirect_to homes_path
render_404
return
end
@@ -4528,6 +4523,28 @@ class UsersController < ApplicationController
end
end
def filter_with_status(status, scope)
scope =
case status
when 'all'
scope
when 'public'
scope.all_public
when 'private'
scope.without_public
end
scope
end
def order_by_hot_or_time(order_type, scope)
scope =
case order_type
when 'created_on'
scope.order('created_on DESC')
when 'member_count'
scope.sort {|a,b| b.members.size <=> a.members.size}
end
scope
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 :info, :only => :info
before_filter :require_admin
before_filter :find_company, :except => [:index, :new, :create]
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
def new
@@ -15,38 +33,50 @@ class WebFooterCompaniesController < ApplicationController
def create
@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)
redirect_to web_footer_companies_url
redirect_to web_footer_companies_url(key: @key)
else
flash[:error] = "#{l :web_footer_company_create_fail}: #{@company.errors.full_messages[0]}"
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) }
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
def destroy
@company = WebFooterCompany.find(params[:id])
@company.destroy
redirect_to web_footer_companies_url
redirect_to web_footer_companies_url(type: @type)
end
def edit
@company = WebFooterCompany.find(params[:id])
end
def update
@company = WebFooterCompany.find(params[:id])
if @company.update_attributes(params[:web_footer_company])
flash[:notice] = l(:notice_successful_update)
redirect_to web_footer_companies_url
redirect_to web_footer_companies_url(type: @type)
else
flash[:error] = "#{l :web_footer_company_update_fail}: #{@company.errors.full_messages[0]}"
render :action => 'edit'
end
end
private
def find_company
@company = WebFooterCompany.find(params[:id])
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_archived), '9']], selected.to_s)
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

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

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

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

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

def home_cover_tag(home)
file_path =
if File.exists?(Rails.root.join('/public/images', url_to_avatar(home)))
url_to_avatar(home)
else
"/images/introduce/activeBanner.jpg"
end
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

+ 27
- 11
app/helpers/projects_helper.rb View File

@@ -110,7 +110,7 @@ module ProjectsHelper
]
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
end
def sort_project(state, project_type)
content = ''.html_safe
case state
@@ -129,8 +129,8 @@ module ProjectsHelper
content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type)))
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
end
# 判断我的项目中是否有重名项目
@@ -352,12 +352,12 @@ module ProjectsHelper
when "attachment"
l :label_attachment
when "news"
l :label_news
l :label_news
else
""
""
end
end
def eventToLanguageCourse event_type, project
case event_type
when "issue-note"
@@ -369,7 +369,7 @@ module ProjectsHelper
when "news"
project.project_type == 1 ? (l :label_notification) : (l :label_news)
else
""
""
end
end
@@ -394,7 +394,7 @@ module ProjectsHelper
@projects_status = ProjectStatus.visible.where("project_statuses.project_type <> ? or project_statuses.project_type is null", 1)
@projects_status = @projects_status.reorder('grade').all.reverse
@projects = []
@projects_status.each do |obj|
@projects_status.each do |obj|
break if(@projects_status[10] == obj)
@projects << Project.visible.find_by_id("#{obj.project_id}")#where('id=:id', id: obj.project_id)
end
@@ -411,12 +411,12 @@ module ProjectsHelper
limit = 10
#Project.find_by_sql("SELECT * FROM projects RIGHT OUTER JOIN (SELECT * FROM project_statuses ORDER BY grade DESC LIMIT #{limit} ) AS t ON projects.id = t.project_id ")
Project.find_by_sql("
SELECT p.id, p.name, p.description, p.identifier, t.project_id
SELECT p.id, p.name, p.description, p.identifier, t.project_id
FROM projects AS p RIGHT OUTER JOIN (
SELECT project_id,grade FROM project_statuses
SELECT project_id,grade FROM project_statuses
WHERE project_type = 0 ORDER BY grade DESC LIMIT #{limit} ) AS t ON p.id = t.project_id ")
end
# 判断课程是否结束,快别用,这个定日子的方法有问题
def course_timeout? project
@@ -674,4 +674,20 @@ module ProjectsHelper
return nil
end
end
def select_project_categories
ProjectCategory.desc_with_position.collect { |c| [c.name, c.id]}
end
def select_project_languages
ProjectLanguage.desc_with_position.collect { |pl| [pl.name, pl.id] }
end
def select_project_licenses
License.all.collect { |c| [c.name, c.id]}
end
def select_project_ignores
Ignore.all.collect { |c| [c.name, c.id]}
end
end

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

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

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

@@ -0,0 +1,3 @@
class Ignore < ActiveRecord::Base
attr_accessible :content, :name
end

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

@@ -0,0 +1,3 @@
class License < ActiveRecord::Base
attr_accessible :key, :name
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

+ 27
- 17
app/models/project.rb View File

@@ -43,6 +43,11 @@ class Project < ActiveRecord::Base
end
end
belongs_to :ignore
belongs_to :license
belongs_to :project_category , :counter_cache => true
belongs_to :project_language , :counter_cache => true
belongs_to :owner, :class_name => 'User', :foreign_key => :user_id
has_many :student_work_projects, :dependent => :destroy
has_many :contestant_work_projects, :dependent => :destroy
has_many :student_works
@@ -90,7 +95,7 @@ class Project < ActiveRecord::Base
# end
#ADDED BY NIE
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_many :user_grades, :class_name => "UserGrade", :dependent => :destroy
#end
@@ -106,7 +111,7 @@ class Project < ActiveRecord::Base
:order => "#{CustomField.table_name}.position",
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
:association_foreign_key => 'custom_field_id'
has_many :tags, :through => :project_tags, :class_name => 'Tag'
has_many :project_tags, :class_name => 'ProjectTags'
# 动态级联删除
@@ -131,11 +136,11 @@ class Project < ActiveRecord::Base
:url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o}},
:author => nil
############################added by william
acts_as_taggable
acts_as_taggable
scope :by_join_date, order("created_on DESC")
###################added by liuping 关注
acts_as_watchable
acts_as_watchable
attr_protected :status
validates_presence_of :name, :identifier
@@ -157,7 +162,7 @@ class Project < ActiveRecord::Base
#ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
# 创建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
after_update :update_project_ealasticsearch_index
@@ -172,8 +177,10 @@ class Project < ActiveRecord::Base
scope :active, lambda { where(:status => STATUS_ACTIVE) }
scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
scope :all_public, lambda { where(:is_public => true) }
scope :without_public, lambda { where(:is_public => false) }
scope :by_language_id, lambda {|language_id| where(project_language_id: language_id) unless language_id.blank? }
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
permission = nil
if args.first.is_a?(Symbol)
@@ -223,6 +230,10 @@ class Project < ActiveRecord::Base
)
end
def sync_projects_count_to_home
HomesService.new.sync_count('project', 1)
end
# 判断项目是否为实训项目
def is_training_project?
(!self.enabled_modules.where("name = 'training_tasks'").empty? && self.training_status == 1) ? true : false
@@ -265,7 +276,7 @@ class Project < ActiveRecord::Base
pjfm.save
pjfm
end
def self.add_new_jour(user, notes, id, options={})
project = Project.find(id)
if options.count == 0
@@ -843,8 +854,12 @@ class Project < ActiveRecord::Base
'dts_test',
'attachmenttype',
'enterprise_name',
'gpid'
'gpid',
'project_category_id',
'project_language_id',
'license_id',
'ignore_id'
safe_attributes 'enabled_module_names',
@@ -926,10 +941,6 @@ class Project < ActiveRecord::Base
end
end
def owner
User.find(self.user_id)
end
# 延迟生成邀请码
def invite_code
return generate_invite_code
@@ -1225,7 +1236,7 @@ class Project < ActiveRecord::Base
def update_position_under_parent
set_or_update_position_under(parent)
end
def course
@course
end
@@ -1258,7 +1269,7 @@ class Project < ActiveRecord::Base
def create_board_sync
@board = self.boards.build
@board.name = " #{l(:label_borad_project) }"
@board.description = self.name.to_s
@board.description = self.name.to_s
if @board.save
logger.debug "[Project Model] ===> #{@board.to_json}"
else
@@ -1310,4 +1321,3 @@ class Project < ActiveRecord::Base
end
#Project.where('is_public = 1').import :force=>true

+ 9
- 0
app/models/project_category.rb View File

@@ -0,0 +1,9 @@
# 项目类别
class ProjectCategory < ActiveRecord::Base
attr_accessible :name, :position, :projects_count
has_ancestry

has_many :projects

scope :desc_with_position, -> { order('position DESC') }
end

+ 8
- 0
app/models/project_language.rb View File

@@ -0,0 +1,8 @@
# 项目语言
class ProjectLanguage < ActiveRecord::Base
attr_accessible :name, :position, :projects_count

has_many :projects

scope :desc_with_position, -> { order('position DESC') }
end

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

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

has_many :courses

def to_s
self.name.to_s
end

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

end

+ 168
- 30
app/models/user.rb View File

@@ -22,7 +22,7 @@ class User < Principal
STUDENT = 1
ENTERPRISE = 2
DEVELOPER = 3
include Redmine::SafeAttributes
seems_rateable_rater
#elasticsearch
@@ -137,12 +137,16 @@ class User < Principal
has_many :versions, :dependent => :destroy
has_many :organizations, :through => :org_members
# 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
belongs_to :softapplication, :foreign_key => 'id', :dependent => :destroy
##ended by xianbo
#####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 :journals_messages, :class_name => 'JournalsForMessage', :foreign_key => "user_id", :dependent => :destroy
# has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
@@ -174,6 +178,7 @@ class User < Principal
has_one :onclick_time
has_many :system_messages
has_many :at_messages
has_many :message_alls
# 虚拟转换
has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1"
@@ -206,15 +211,15 @@ class User < Principal
scope :visible, lambda {|*args|
nil
}
acts_as_attachable :view_permission => :view_files,
:delete_permission => :manage_files
acts_as_customizable
############################added by william
acts_as_taggable
acts_as_taggable
scope :by_join_date, order("created_on DESC")
############################# added by liuping 关注
acts_as_watchable
acts_as_watchable
has_one :user_extensions,:dependent => :destroy
has_one :homepage, :dependent => :destroy
@@ -262,7 +267,7 @@ class User < Principal
before_save :update_hashed_password
before_destroy :remove_references_before_destroy,:delete_user_ealasticsearch_index
# 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
# 更新邮箱用户或用户名的同事,同步更新邀请信息
after_update :update_user_ealasticsearch_index
@@ -324,6 +329,11 @@ class User < Principal
)
end
# 同步新增首页的社区用户量
def sync_to_home
HomesService.new.sync_count('user', 1)
end
# ======================================================================
def my_workplace
self.user_extensions.try(:occupation).to_s
@@ -336,6 +346,24 @@ class User < Principal
(self.login.to_i.to_s == self.login || self.login.include?(".") || self.login.include?("%") || self.login.include?("?")) ? id : login
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
self.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count
@@ -386,34 +414,144 @@ class User < Principal
@base_homepage
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
self.issue_assigns
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: id).first
if message_new_time.nil?
message_new_time = OnclickTime.new
message_new_time.user_id = User.current.id
message_new_time.user_id = id
# 第一次初始化点击铃铛时间
message_new_time.onclick_time = User.current.last_login_on.nil? ? Time.now : User.current.last_login_on
message_new_time.onclick_time = last_login_on.nil? ? Time.now : last_login_on
message_new_time.save
end
user = User.current
onclick_time = user.onclick_time.onclick_time
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
if type == "all"
onclick_time = user.onclick_time.onclick_time
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).size
contest_count = ContestMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).size
forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).size
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).size
user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).size
system_messages_count = SystemMessage.where("created_at >?", onclick_time).size
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).size
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).size
applied_count = AppliedMessage.where("user_id=? and viewed =? and created_at >?", user.id, 0, onclick_time).size
blog_message_count = BlogMessage.where("user_id=? and viewed=? and created_at >?", user.id, 0, onclick_time).size
# private_messages_count = PrivateMessage.where("user_id=? and status=?",user.id, 0).size
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
else
Rails.logger.info("######________type__________##########{type}")
message_new_time.update_attribute(:onclick_time, Time.now)
CourseMessage.where(user_id: user.id)&.update_all(:viewed => true)
ForgeMessage.where(user_id: user.id)&.update_all(:viewed => true)
UserFeedbackMessage.where(user_id: user.id)&.update_all(:viewed => true)
MemoMessage.where(user_id: user.id)&.update_all(:viewed => true)
OrgMessage.where(user_id: user.id)&.update_all(:viewed => true)
AtMessage.where(user_id: user.id)&.update_all(:viewed => true)
ContestMessage.where(user_id: user.id)&.update_all(:viewed => true)
BlogMessage.where(user_id: user.id)&.update_all(:viewed => true)
AppliedMessage.where(user_id: user.id)&.update_all(:viewed => true)
messages_count = 0
end
messages_count
end
def get_user_messages
message_alls.includes(:message)
end
#未读私信数量
def unread_private_messages
private_messages.where(status: 0).size
end
# 查询指派给我的缺陷记录
@@ -447,18 +585,18 @@ class User < Principal
end
info
end
###添加留言 fq
def add_jour(user, notes, reference_user_id = 0, options = {})
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)
else
else
jfm = self.journals_for_messages.build(options)
jfm.save
jfm
end
end
### fq
def join_in?(course)
joined = StudentsForCourse.where('student_id = ? and course_id = ?', self.id, course.id)
@@ -468,7 +606,7 @@ class User < Principal
false
end
end
def show_name
name = lastname + firstname
name.empty? || name.nil? ? login : name
@@ -485,12 +623,12 @@ class User < Principal
name = show_name
(name != self.login) ? "#{name} #{self.login}" : name
end
#added by nie
def count_new_journal_reply
count = self.journal_reply.count
end
def set_mail_notification
##add byxianbo
thread=Thread.new do


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

@@ -1,8 +1,19 @@
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 :key, inclusion: { in: %w(partner dedicator opensource), message: "%{value} is not a valid value." }
validates :url, length: { maximum: 500 },
format: { with: /(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:\/~\+#]*[\w\-\@?^=%&amp;\/~\+#])?/,
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

+ 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') %>");

+ 32
- 0
app/views/admin/home.html.erb View File

@@ -0,0 +1,32 @@
<h3>trustie首页</h3>

<div class="tabs">
<ul>
<li><%= link_to "首页定制", admin_home_path, class: "#{current_page?(admin_home_path)? 'selected' : nil }" %></li>
<li><%= link_to "动态新闻", admin_dynamic_news_path, class: "#{current_page?(admin_dynamic_news_path)? 'selected' : nil }" %></li>
<li><%= link_to "开源生态", web_footer_companies_path, class: "#{current_page?(web_footer_companies_path)? 'selected' : nil }" %></li>
</div>
<%= form_tag(:controller => 'admin', :action => 'home') do %>
<h4>首页定制</h4>
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;封面:</label>
</p>
<div style="margin-left: 82px;" id="avatar">
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source: @home} %>
</div>

<p style="margin-left:60px;padding-right: 20px;">
<label for='image_height' style="vertical-align: top">&nbsp;&nbsp;&nbsp;标题:</label>
<%= text_field_tag 'home[name]', params[:name], :value => @home&.name, :style => "font-size:small;width:490px;margin-left:10px;" %>
</p>

<p style="margin-left:60px;padding-right: 20px;">
<label for='content' style="vertical-align: top">&nbsp;&nbsp;&nbsp;介绍:</label>
<!-- <#%= text_area_tag 'content',@first_page.content,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> -->
<%= text_area 'home', 'content', :value => @home.content,:cols => 80, :rows => 15, :class => 'wiki-edit' %>
<%= wikitoolbar_for 'home_content' %>
</p>


<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>

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

@@ -24,7 +24,7 @@
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align:center;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=org.name%>'>
<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) %>
</span>
</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;" %>
</p>
<%= 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>
<p style="margin-left:60px;padding-right: 20px;">
@@ -21,8 +21,3 @@
</p>
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% 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 class="sy_popup_top">
<div class="sy_popup_top clearfix">
<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 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 %>
<ul class="sy_popup_add ">
<% 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>
<% 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>
<% 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>
<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>
</ul>
<% end %>


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

@@ -12,28 +12,28 @@
</td>
<td rowspan="2">
<% 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 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 %>
<%= 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>
</tr>
<tr>
<td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:field_homepage), homes_path %> >
<a><%= l(:label_contest_innovate) %></a>
</td>
</tr>
</table>
<% end %>
</div>
</div>





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

@@ -14,24 +14,24 @@
<td rowspan="2">
<% if User.current.logged? %>
<%= link_to(l(:label_new_call), {:controller => 'bids', :action => 'new_bid'}, :class => 'icon icon-add') %>
<% end %>
<% end %>
</td>
<td rowspan="2" >
<td rowspan="2" >
<div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 28 %>
<%= hidden_field_tag 'reward_type', params[:reward_type] %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
</div>
</div>
</td>
</tr>
<tr>
<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>
</table>
<% end %>
</div>
</div>
<% if @bids.size > 0 %>
<div id="bid-show">
<%= sort_bid(@s_state, @project_type)%>
@@ -42,4 +42,4 @@
<% 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>
<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">
<%=l(:label_courses_management_platform)%>
</a>


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

@@ -29,7 +29,7 @@
</tr>
<tr>
<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">
<%=l(:label_courses_management_platform)%>
</a>
@@ -37,7 +37,7 @@
</tr>
</table>
<% end %>
</div>
</div>
<% if @courses && !@courses.empty? %>
<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">
<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 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/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>

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

@@ -0,0 +1,12 @@
<li>
<a href="<%= User.current.logged? ? user_path(User.current) : signin_url() %>" target="_blank" class="rightline">开源托管平台</a>
</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 %>
<%= import_ke(enable_at: true,init_activity: true) %>
<% end %>
<script xmlns="http://www.w3.org/1999/html">
function add_style(){
if($("select[id='tracker_id']").val() != 0){
@@ -256,11 +255,7 @@
</a>
</li>
<div class="cl"></div>
</ul>
<div class="issues_filter ">
<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]),
@@ -309,6 +304,7 @@
</div>
<div class="cl"></div>
</div><!--issues_filter end-->
</div>
<% 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} %>
</div><!--issues_con_list end-->
<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.title @title
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.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema)
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">
<%=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 id="account">
<%= render_menu :account_menu -%>
</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', "#{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? -%>
</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><%#=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', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %>
</td>
<td valign="top">
<td valign="top">
<%#= render_menu :account_menu -%>
</td>
</td>
</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">
<%=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 id="account">
<%= render_menu :account_menu -%>
</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', "#{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? -%>
</div>

<!-- <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? %>
</div> -->
@@ -39,6 +39,6 @@
<!-- <%#= content_tag('div', "#{}".html_safe, :id => 'loggedas')%> -->
<!-- 消息#{link_to((User.current.count_new_jour), feedback_path(User.current))} -->
<!-- <%#= 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> -->

+ 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">
<%=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 id="account">
<%= render_menu :account_menu -%>
</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', "#{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;">
<%#= content_tag('div', "#{link_to(image_tag('/images/mes.png'), feedback_path(User.current))}".html_safe, :title => "留言") if User.current.logged? %>
</div> -->
@@ -20,4 +20,3 @@
<%= render_menu :top_home_menu if User.current.logged? || !Setting.login_required? -%>
</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>
<td>
<p class="top-content-list-homework">
<%=link_to "主页", home_path %> >
<%=link_to "主页", homes_path %> >
<a href="http://<%= Setting.host_course%>" class="link_other_item">
<%=l(:label_courses_management_platform)%>
</a> >
@@ -33,4 +33,4 @@
</td>
</tr>
</table>
</div>
</div>

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

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

<tr>
<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' %>
</td>
</tr>
</table>
</div>
</div>

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

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

+ 27
- 23
app/views/layouts/_logined_header.html.erb View File

@@ -1,38 +1,38 @@
<div class="navHomepage">
<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 class="fl">
<ul>
<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>
<% if !hidden_unproject_infos %>
<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>
<% end %>
<% if hidden_unproject_infos %>
<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>
<% end %>
<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 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>
<% if hidden_unproject_infos %>
<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>
<% end %>
<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>
</ul>
@@ -56,17 +56,6 @@
}
}
</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">
<ul>
@@ -97,16 +86,31 @@
</div>
<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 %>
<% if new_message_count > 0 %>
<div ><%= link_to new_message_count, user_path(User.current, :click_user_message => true), :class => "newsActive", :target => "_Blank" %></div>
<a href="<%= user_message_path(User.current,click_user_message: true) %>" class="fl"><i class="iconfont icon-xiaoxilingdang fontGrey4 f22 fl mt4"></i></a>
<% new_message_count = User.current.count_new_message("all").to_i %>
<% new_private_message_count = User.current.unread_private_messages %>
<% if new_message_count > 0 || new_private_message_count > 0 %>
<%#= link_to new_message_count, user_path(User.current, :click_user_message => true), :class => "newsActive", :target => "_Blank" %>
<span class="haveNews"></span>
<% end %>
<%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
<div class="shadowbox_news undis" id="user_messages_list">
<%= render :partial => 'layouts/message_loading' %>
</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 mt2 fl"></i>
</a>
<% end %>
</div>
</div>
<script type="text/javascript">


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

@@ -1,6 +1,6 @@
<div class="navHomepage">
<div class="navHomepageLogo fl">
<a href ="javascript:void(0);" disabled="true" class="mt3"><%= image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3")%></a>
<a href ="<%= homes_path %>" disabled="true" class="mt3"><%= image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3")%></a>
</div>
<div class="fl">
<ul>


+ 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 %>
<li><%=link_to content.html_safe, ma.url, :title => ma.author.show_name+' 提到了你:'+ma.subject.html_safe, :target => '_blank' %></li>
<% 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 %>
</ul>
<!--<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>

<script type="text/javascript">


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

@@ -1,6 +1,6 @@
<div class="navHomepage">
<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 class="fl">
<ul>
@@ -11,12 +11,12 @@
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<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>
<% end %>
<% else %>
<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>
<% end %>
</ul>
@@ -59,41 +59,43 @@
}
}
</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">-->
<% name = name%>
<%= 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 mt2 fl"></i>
</a>
<% end %>
<!--<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 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>
<script type="text/javascript">


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

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


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

@@ -32,7 +32,7 @@
<div class="project_header_tag">
标签:项目托管 社交网络 Rails
</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 %>
<% if @project.description.present? %>
<%= 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_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_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')+'个文件' %>
<hr size="5">
</div>
@@ -57,7 +57,7 @@
<div style="clear:both;">
</div>
</div>
</div>
</div>
</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="wrapper2">
<div id="wrapper3">
<% if session[:enterprise_college] == 2 %>
<%=render :partial => 'layouts/base_enterprise_header'%>
<% elsif session[:enterprise_college] == 1 %>
@@ -30,7 +30,7 @@
<% else %>
<%=render :partial => 'layouts/base_header'%>
<% end %>
<div id="main">
<!-- added by bai -->
<div class="top-content">
@@ -62,7 +62,7 @@
</a>
</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' %> >
<span>
<%=link_to @bid.name ,bid_path %>
@@ -71,7 +71,7 @@
</tr>
</table>
</div>
<!-- end -->
<div id="sidebar">
<div class="main_context">
@@ -137,7 +137,7 @@
<%= @bid.budget%>&nbsp;
<%= l(:label_bids_credit_number) %>
</td>
<% end %>
<% end %>
</tr>
<tr>
<td>
@@ -180,7 +180,7 @@
<%= link_to l(:label_x_bids_responses, :count => @bid.commit)+"("+@bid.commit.to_s+")", respond_path(@bid)%>
</div>
</div>
<!--tags-->
<div class="user_fans">
<div class="font_title_left">
@@ -191,7 +191,7 @@
<div class="user_underline"></div>
<table style="font-family:'微软雅黑'">
<tr>
<td><!-- added by william -for tag -->
<td><!-- added by william -for tag -->
<%= render :partial => 'tags/tag', :locals => {:obj => @bid, :object_flag => "4"}%>
</td>
</tr>
@@ -217,7 +217,7 @@
</p>
<% end%>
</td>
</tr>
</tr>
</table>
</div>
</div>
@@ -235,11 +235,11 @@
<% for project in @bid.projects%>
<%= link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name),project_path(project) %>
<% end%>
<% else %>
<% else %>
<p class="font_lighter"><%= l(:label_no_bid_project) %></p>
<% end %>
</td>
</tr>
</tr>
</table>
</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" />
<%= csrf_meta_tag %>
<%= 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' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify','contest'%>
@@ -30,6 +30,7 @@
</head>

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


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

@@ -12,7 +12,7 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= 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' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
@@ -31,6 +31,7 @@

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

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


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

@@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= 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' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
@@ -30,6 +30,7 @@
</head>

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


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

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


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

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


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

@@ -77,7 +77,7 @@
</tr>
<tr>
<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;">
<%=l(:label_course_practice) %>


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

Loading…
Cancel
Save