commit
92752add5f
@ -0,0 +1,7 @@
|
|||||||
|
class CourseActivity < ActiveRecord::Base
|
||||||
|
attr_accessible :user_id, :course_act_id,:course_act_type,:course_id
|
||||||
|
# 虚拟关联
|
||||||
|
belongs_to :course_act ,:polymorphic => true
|
||||||
|
belongs_to :course
|
||||||
|
belongs_to :user
|
||||||
|
end
|
@ -0,0 +1,12 @@
|
|||||||
|
class CourseMessage < ActiveRecord::Base
|
||||||
|
attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed
|
||||||
|
|
||||||
|
# 多态 虚拟关联
|
||||||
|
belongs_to :course_message ,:polymorphic => true
|
||||||
|
belongs_to :course
|
||||||
|
belongs_to :user
|
||||||
|
validates :user_id,presence: true
|
||||||
|
validates :course_id,presence: true
|
||||||
|
validates :course_message_id,presence: true
|
||||||
|
validates :course_message_type, presence: true
|
||||||
|
end
|
@ -0,0 +1,20 @@
|
|||||||
|
class ForgeMessage < ActiveRecord::Base
|
||||||
|
# 公共表中活动类型,命名规则:TYPE_OF_{类名}_ACT
|
||||||
|
TYPE_OF_ISSUE_ACT = "Issue"
|
||||||
|
TYPE_OF_MESSAGE_ACT = "Message"
|
||||||
|
TYPE_OF_ATTACHMENT_ACT = "Attachment"
|
||||||
|
TYPE_OF_DOCUMENT_ACT = "Document"
|
||||||
|
TYPE_OF_JOURNAL_ACT = "Journal"
|
||||||
|
TYPE_OF_WIKI_ACT = "Wiki"
|
||||||
|
TYPE_OF_NEWS_ACT = "News"
|
||||||
|
|
||||||
|
attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed
|
||||||
|
|
||||||
|
belongs_to :forge_message ,:polymorphic => true
|
||||||
|
belongs_to :project
|
||||||
|
belongs_to :user
|
||||||
|
validates :user_id,presence: true
|
||||||
|
validates :project_id,presence: true
|
||||||
|
validates :forge_message_id,presence: true
|
||||||
|
validates :forge_message_type, presence: true
|
||||||
|
end
|
@ -0,0 +1,8 @@
|
|||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><%= link_to l(:label_forum), {:action => 'messages_list'}, class: "#{current_page?(messages_list_path)? 'selected' : nil }" %></li>
|
||||||
|
<li><%= link_to l(:label_borad_course), {:action => 'course_messages'}, class: "#{current_page?(course_messages_path)? 'selected' : nil }" %></li>
|
||||||
|
<li><%= link_to l(:label_borad_project), {:action => 'project_messages'}, class: "#{current_page?(project_messages_path)? 'selected' : nil }" %></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
@ -0,0 +1,66 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_message_plural)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<%= render 'tab_messages' %>
|
||||||
|
<h4><%=l(:label_borad_course) %></h4>
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
来源
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
作者
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
标题
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
回复数
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=0%>
|
||||||
|
<% for course in @course_ms -%>
|
||||||
|
|
||||||
|
<% @count=@count + 1 %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= @count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%= Board.where('id=?',course.board_id).first.course_id %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if course.try(:author).try(:realname) == ' '%><%= course.try(:author)%><% else %><%=course.try(:author).try(:realname) %><% end %>'>
|
||||||
|
<% if course.try(:author).try(:realname) == ' '%>
|
||||||
|
<%= link_to(course.try(:author), user_path(course.author)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(course.try(:author).try(:realname), user_path(course.author)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= format_date(course.created_on) %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=course.subject %>'>
|
||||||
|
<%= course.subject %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%=course.replies_count %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_message_plural)) -%>
|
@ -0,0 +1,62 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_user_homework)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
作业名称
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
课程名称
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
作者
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
提交作品数
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
提交截止日期
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%@count=0 %>
|
||||||
|
<% for homework in @homework do %>
|
||||||
|
<% @count+=1 %>
|
||||||
|
<tr>
|
||||||
|
<td align="center">
|
||||||
|
<%=@count %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.name%>'>
|
||||||
|
<%=link_to(homework.name, student_work_index_path(:homework => homework.id))%>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.course.name%>'>
|
||||||
|
<%= link_to(homework.course.name, course_path(homework.course.id)) %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if homework.try(:user).try(:realname) == ' '%><%= homework.try(:user)%><% else %><%=homework.try(:user).try(:realname) %><% end %>'>
|
||||||
|
<% if homework.try(:user).try(:realname) == ' '%>
|
||||||
|
<%= link_to(homework.try(:user), user_path(homework.user_id)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(homework.try(:user).try(:realname), user_path(homework.user_id)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=StudentWork.where('homework_common_id=?',homework.id).count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=format_date(homework.end_time) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_user_homework)) -%>
|
@ -0,0 +1,73 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_latest_login_user_list)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
登录时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
用户id
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
用户姓名
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
用户昵称
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
用户身份
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=0 %>
|
||||||
|
<% for user in @user do %>
|
||||||
|
<tr>
|
||||||
|
<% @count +=1 %>
|
||||||
|
<td align="center">
|
||||||
|
<%=@count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=format_date(user.last_login_on) %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=user.id %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if user.try(:realname) == ' '%><%= user.login%><% else %><%=user.try(:realname) %><% end %>'>
|
||||||
|
<% if user.try(:realname) == ' '%>
|
||||||
|
<%= link_to(user.login, user_path(user)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(user.try(:realname), user_path(user)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=link_to(user.login, user_path(user)) %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<% case user.user_extensions.identity %>
|
||||||
|
<% when 0 %>
|
||||||
|
<%='老师' %>
|
||||||
|
<% when 1 %>
|
||||||
|
<%='学生' %>
|
||||||
|
<% when 2 %>
|
||||||
|
<%='企业' %>
|
||||||
|
<% when 3 %>
|
||||||
|
<%='开发者' %>
|
||||||
|
<% else %>
|
||||||
|
<%='未知身份' %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_latest_login_user_list)) -%>
|
@ -0,0 +1,79 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_leave_message_list)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
类型
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
来源
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
留言人
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
留言时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
留言内容
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
回复数
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=0%>
|
||||||
|
<% for journal in @jour -%>
|
||||||
|
<% @count=@count + 1 %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= @count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%case journal.jour_type %>
|
||||||
|
<% when 'Principal' %>
|
||||||
|
<%='用户主页' %>
|
||||||
|
<% when 'Course' %>
|
||||||
|
<%='课程' %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%= journal.jour_id %>
|
||||||
|
</td>
|
||||||
|
<td align="center" title='<%= journal.try(:user).try(:realname)%>'>
|
||||||
|
<%= link_to(journal.try(:user).try(:realname).truncate(6, omission: '...'), user_path(journal.user)) %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= format_date(journal.created_on) %>
|
||||||
|
</td>
|
||||||
|
<td title='<%=journal.notes %>'>
|
||||||
|
<%= journal.notes.truncate(15, omission: '...') %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<% if(journal.m_reply_count) %>
|
||||||
|
<%=journal.m_reply_count%>
|
||||||
|
<% else %>
|
||||||
|
<%=0 %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="pagination">
|
||||||
|
<ul>
|
||||||
|
<%= pagination_links_full @jour_pages, @jour_count %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_leave_message_list)) -%>
|
@ -0,0 +1,69 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_message_plural)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<%= render 'tab_messages' %>
|
||||||
|
<h4><%=l(:label_forum) %></h4>
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
来源
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
作者
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
标题
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
回复数
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=0%>
|
||||||
|
<% for memo in @memo -%>
|
||||||
|
<% @count=@count + 1 %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= @count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%= memo.forum_id %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if memo.try(:author).try(:realname) == ' '%><%= memo.try(:author)%><% else %><%=memo.try(:author).try(:realname) %><% end %>'>
|
||||||
|
<% if memo.try(:author).try(:realname) == ' '%>
|
||||||
|
<%= link_to(memo.try(:author), user_path(memo.author)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(memo.try(:author).try(:realname), user_path(memo.author)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= format_date(memo.created_at) %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=memo.subject %>'>
|
||||||
|
<%= memo.subject %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%=memo.replies_count %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<!--<div class="pagination">
|
||||||
|
<ul>
|
||||||
|
<#%= pagination_links_full @memo_pages, @memo_count %>
|
||||||
|
</ul>
|
||||||
|
</div>-->
|
||||||
|
|
||||||
|
<% html_title(l(:label_message_plural)) -%>
|
@ -0,0 +1,74 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_notification_list)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
课程id
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
课程名称
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
主讲老师
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
作者
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
标题
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
回复数
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=0%>
|
||||||
|
<% for news in @news -%>
|
||||||
|
<% @count=@count + 1 %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= @count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=news.course_id %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title="<%=news.course.name %>">
|
||||||
|
<%=link_to(news.course.name, course_path(news.course)) %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title="<%=news.course.try(:teacher).try(:realname) %>">
|
||||||
|
<%=link_to(news.course.try(:teacher).try(:realname), user_path(news.course.teacher)) %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if news.try(:author).try(:realname) == ' '%><%= news.try(:author)%><% else %><%=news.try(:author).try(:realname) %><% end %>'>
|
||||||
|
<% if news.try(:author).try(:realname) == ' '%>
|
||||||
|
<%= link_to(news.try(:author), user_path(news.author)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(news.try(:author).try(:realname), user_path(news.author)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= format_date(news.created_on) %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=news.title %>'>
|
||||||
|
<%= link_to(news.title, news_path(news)) %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%=news.comments_count %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_notification_list)) -%>
|
@ -0,0 +1,66 @@
|
|||||||
|
<h3>
|
||||||
|
<%=l(:label_message_plural)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<%= render 'tab_messages' %>
|
||||||
|
<h4><%=l(:label_borad_project) %></h4>
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
来源
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
作者
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
标题
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
回复数
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=0%>
|
||||||
|
<% for project in @project_ms -%>
|
||||||
|
|
||||||
|
<% @count=@count + 1 %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= @count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%= Board.where('id=?',project.board_id).first.project_id %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if project.try(:author).try(:realname) == ' '%><%= project.try(:author)%><% else %><%=project.try(:author).try(:realname) %><% end %>'>
|
||||||
|
<% if project.try(:author).try(:realname) == ' '%>
|
||||||
|
<%= link_to(project.try(:author), user_path(project.author)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(project.try(:author).try(:realname), user_path(project.author)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%= format_date(project.created_on) %>
|
||||||
|
</td>
|
||||||
|
<td title='<%=project.subject %>' style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name">
|
||||||
|
<%= project.subject %>
|
||||||
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<%=project.replies_count %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_message_plural)) -%>
|
@ -0,0 +1,37 @@
|
|||||||
|
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
|
||||||
|
<div class="upload_con">
|
||||||
|
<h2>选择问卷导入本课程</h2>
|
||||||
|
<div class="upload_box">
|
||||||
|
<div id="error_show" style="color: red;"></div>
|
||||||
|
<%= form_tag import_other_poll_poll_index_path,
|
||||||
|
method: :post,
|
||||||
|
remote: true,
|
||||||
|
id: "relation_file_form" do %>
|
||||||
|
<input type="hidden" name="course_id" value="<%= polls_group_id%>" />
|
||||||
|
<%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses',:style=> 'width: 300px;')%>
|
||||||
|
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" style="margin-left: 0px !important;" onclick="submit_quote();">导 入</a>
|
||||||
|
<a href="javascript:void(0)" class="blue_btn grey_btn fl c_white " onclick="closeModal();">取 消</a>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function submit_quote() {
|
||||||
|
$('#error_show').html('');
|
||||||
|
var selected = false;
|
||||||
|
for(var i = 0; i < $("input[name='polls[]']").length;i++){
|
||||||
|
if($("input[name='polls[]']")[i].checked){
|
||||||
|
selected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selected){
|
||||||
|
$('#submit_quote').parent().submit();
|
||||||
|
closeModal();
|
||||||
|
}else{
|
||||||
|
$('#error_show').html('您没有选择任何问卷');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,10 @@
|
|||||||
|
<% polls.each do |poll|%>
|
||||||
|
<ul id="polls_<%= poll.id %>" class="polls_list_ul">
|
||||||
|
<%= render :partial => 'poll', :locals => {:poll => poll} %>
|
||||||
|
</ul>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
<ul class="wlist">
|
||||||
|
<%= pagination_links_full obj_pages, obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||||
|
</ul>
|
@ -0,0 +1 @@
|
|||||||
|
$('#polls_list').html('<%= escape_javascript(render :partial => 'polls_list', :locals => {:polls => @polls,:obj_pages=>@obj_pages,:obj_count=>@obj_count}) %> <div class="cl"></div>');
|
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
<% if @polls.empty? %>
|
||||||
|
alert('您目前还没有自己新建的问卷');
|
||||||
|
<% else %>
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
|
||||||
|
|
||||||
|
|
||||||
|
showModal('ajax-modal', '513px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
<% end %>
|
@ -0,0 +1,79 @@
|
|||||||
|
<div id="RSide" class="fl">
|
||||||
|
<div class="homepageRight">
|
||||||
|
<div class="resources">
|
||||||
|
<div class="resourcesBanner">
|
||||||
|
<div class="bannerName">消息</div>
|
||||||
|
<ul class="resourcesSelect">
|
||||||
|
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||||
|
<ul class="newsType">
|
||||||
|
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "全部",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user} %></a></li>
|
||||||
|
<!--<li><a href="javascript:void(0);" class="resourcesGrey">@我</a></li>-->
|
||||||
|
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "作业消息",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'homework'} %></a></li>
|
||||||
|
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'message'} %></a></li>
|
||||||
|
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "课程通知",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'news'} %></a></li>
|
||||||
|
<!--<li><a href="javascript:void(0);" class="resourcesGrey">指派给我</a></li>-->
|
||||||
|
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<% if !@user_course_messages.blank? %>
|
||||||
|
<% @user_course_messages.each do |ucm| %>
|
||||||
|
<% if ucm.course_message_type == "News" %>
|
||||||
|
<ul class="homepageNewsList fl">
|
||||||
|
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li>
|
||||||
|
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.author %></a></li>
|
||||||
|
<li class="homepageNewsType fl">发布通知</li>
|
||||||
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
|
<%= link_to format_activity_title(" #{ucm.course_message.title}"), {:controller => 'news', :action => 'show', :id => ucm.course_message.id} %></a></li>
|
||||||
|
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<% if ucm.course_message_type == "HomeworkCommon" %>
|
||||||
|
<ul class="homepageNewsList fl">
|
||||||
|
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
|
||||||
|
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
|
||||||
|
<li class="homepageNewsType fl">发布作业</li>
|
||||||
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
|
<%= link_to ("#{ucm.course_message.name}"), student_work_index_path(:homework => ucm.course_message.id) %></a></li>
|
||||||
|
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<% if ucm.course_message_type == "Poll" %>
|
||||||
|
<ul class="homepageNewsList fl">
|
||||||
|
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
|
||||||
|
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
|
||||||
|
<li class="homepageNewsType fl">发布问卷</li>
|
||||||
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
|
<%= link_to format_activity_title(" #{ucm.course_message.polls_name}"), poll_index_path(:polls_type => "Course", :polls_group_id => ucm.course_id) %></a></li>
|
||||||
|
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<% if ucm.course_message_type == "Message" %>
|
||||||
|
<ul class="homepageNewsList fl">
|
||||||
|
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li>
|
||||||
|
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.author %></a></li>
|
||||||
|
<% if ucm.course_message.parent_id.nil? %>
|
||||||
|
<li class="homepageNewsType fl">发布帖子</li>
|
||||||
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
|
<%=link_to ucm.course_message.subject, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id) %></a></li>
|
||||||
|
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
|
||||||
|
<% else %>
|
||||||
|
<li class="homepageNewsType fl">回复帖子</li>
|
||||||
|
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||||
|
<%=link_to ucm.course_message.subject, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id) %> </a></li>
|
||||||
|
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<div class="flash notice">暂无消息!</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,8 @@
|
|||||||
|
class AddCreatedAtToActivities < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
add_column :activities, :created_at, :timestamp
|
||||||
|
end
|
||||||
|
def end
|
||||||
|
remove_column :activities, :created_at
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,21 @@
|
|||||||
|
class UpdateActivitiesData < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
count = Activity.all.count / 10 + 1
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
Activity.all.each do |activity|
|
||||||
|
type = activity.act_type
|
||||||
|
if type=='Contest' || type=='Message' || type=='News'|| type=='Journal'|| type=='Issue'|| type=='Principal'||type=='JournalsForMessage'
|
||||||
|
activity.created_at = activity.act.created_on if activity.act
|
||||||
|
elsif type=='Contestnotification' || type=='HomeworkCommon' || type=='Poll'
|
||||||
|
activity.created_at = activity.act.created_at if activity.act
|
||||||
|
end
|
||||||
|
activity.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
class AddCourseActivities < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :course_activities do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :course_id
|
||||||
|
t.integer :course_act_id
|
||||||
|
t.string :course_act_type
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
drop_table :course_activities
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,40 @@
|
|||||||
|
#encoding=UTF-8
|
||||||
|
class CourseActivities < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
Course.all.each do |course|
|
||||||
|
transaction do
|
||||||
|
course.course_acts << CourseActivity.new(:user_id => course.tea_id,:course_id => course.id)
|
||||||
|
#作业
|
||||||
|
course.homework_commons.each do |homework_common|
|
||||||
|
homework_common.course_acts << CourseActivity.new(:user_id => homework_common.user_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#通知
|
||||||
|
course.news.each do |new|
|
||||||
|
new.course_acts << CourseActivity.new(:user_id => new.author_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#资源
|
||||||
|
course.attachments.each do |attachment|
|
||||||
|
attachment.course_acts << CourseActivity.new(:user_id => attachment.author_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#讨论区
|
||||||
|
if course.boards.first
|
||||||
|
course.boards.first.messages.each do |message|
|
||||||
|
message.course_acts << CourseActivity.new(:user_id => message.author_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#留言
|
||||||
|
course.journals_for_messages.each do |jour|
|
||||||
|
jour.course_acts << CourseActivity.new(:user_id => jour.user_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#问卷
|
||||||
|
Poll.where("polls_type = 'Course' and polls_group_id = #{course.id}").each do |poll|
|
||||||
|
poll.course_acts << CourseActivity.new(:user_id => poll.user_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
CourseActivity.destroy_all
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,13 @@
|
|||||||
|
class CreateForgeMessages < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :forge_messages do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :project_id
|
||||||
|
t.integer :forge_message_id
|
||||||
|
t.string :forge_message_type
|
||||||
|
t.integer :viewed
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,13 @@
|
|||||||
|
class CreateCourseMessages < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :course_messages do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :course_id
|
||||||
|
t.integer :course_message_id
|
||||||
|
t.string :course_message_type
|
||||||
|
t.integer :viewed
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,13 @@
|
|||||||
|
class ChangeAttachmentTime < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
Attachment.where("container_type = 'Course'").each do |attachment|
|
||||||
|
if attachment.container && attachment.container.created_at.to_i > attachment.created_on.to_i
|
||||||
|
attachment.created_on = attachment.container.created_at + 3600 * 24
|
||||||
|
attachment.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,22 @@
|
|||||||
|
class UpdateCourseActivityTime < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
count = CourseActivity.all.count / 10 + 1
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
CourseActivity.page(i).per(10).each do |activity|
|
||||||
|
if activity.course_act
|
||||||
|
if activity.course_act.respond_to?("created_at")
|
||||||
|
activity.created_at = activity.course_act.created_at
|
||||||
|
elsif activity.course_act.respond_to?("created_on")
|
||||||
|
activity.created_at = activity.course_act.created_on
|
||||||
|
end
|
||||||
|
activity.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,9 @@
|
|||||||
|
class AddSystemScoreToStudentWork < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
add_column :student_works,:system_score,:integer
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
remove_column :student_works,:system_score
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
@ -0,0 +1,10 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :course_message do
|
||||||
|
user_id 1
|
||||||
|
course_id 1
|
||||||
|
course_message_id 1
|
||||||
|
course_message_type "MyString"
|
||||||
|
viewed 1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,10 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :forge_message do
|
||||||
|
user_id 1
|
||||||
|
project_id 1
|
||||||
|
forge_message_id 1
|
||||||
|
forge_message_type "MyString"
|
||||||
|
viewed 1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe CourseMessage, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe ForgeMessage, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in new issue