Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-05-08 08:53:44 +08:00
commit 3035bf24fc
25 changed files with 767 additions and 107 deletions

View File

@ -490,7 +490,7 @@ class BidsController < ApplicationController
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1
WHERE table1.t_score IS NULL OR table1.t_score = 0")
WHERE table1.t_score IS NULL")
@not_batch_homework = true
@cur_type = 1
else

View File

@ -51,7 +51,7 @@ class HomeworkAttachController < ApplicationController
order_by = "created_at #{direction}"
end
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id}
ORDER BY #{order_by}) AS table1
@ -503,7 +503,7 @@ class HomeworkAttachController < ApplicationController
get_not_batch_homework_list params[:cur_sort] || "s_socre",params[:cur_direction] || "desc",@homework.bid_id
elsif @cur_type == "2" #老师已批列表
@result_homework = HomeworkAttach.find_by_sql("SELECT homework_attaches.*,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE id = #{@homework.id}").first
elsif @cur_type == "3" #全部作业列表
@ -630,7 +630,7 @@ class HomeworkAttachController < ApplicationController
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score
FROM homework_attaches WHERE bid_id = #{bid_id}
ORDER BY #{order_by}) AS table1
WHERE table1.t_score IS NULL OR table1.t_score = 0 ")
WHERE table1.t_score IS NULL ")
@all_homework_list = search_homework_member(@all_homework_list,@search_name.to_s.downcase) if @search_name
# @homework_list = paginateHelper @all_homework_list,10
@homework_list = @all_homework_list

View File

@ -93,7 +93,15 @@ class MessagesController < ApplicationController
end
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
redirect_to board_message_url(@board, @message)
if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@board, @message)
end
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
@ -131,9 +139,16 @@ class MessagesController < ApplicationController
render_attachment_warning_if_needed(@reply)
else
#render file: 'messages#show', layout: 'base_courses'
end
if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@board, @topic, :r => @reply)
end
redirect_to board_message_url(@board, @topic, :r => @reply)
end
# Edit a message
@ -172,16 +187,20 @@ class MessagesController < ApplicationController
@message.destroy
# modify by nwb
if @project
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
else
if params[:is_board]
redirect_to project_boards_url(@project)
else
redirect_to board_message_url(@board, @topic, :r => @reply)
end
elsif @course
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
if params[:is_board]
redirect_to course_boards_url(@course)
else
redirect_to course_board_url(@course, @board)
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
else
redirect_to course_board_url(@course, @board)
end
end
end
end

View File

@ -59,6 +59,55 @@
}
);
}
// $(window).scroll(function(){
// //获取窗口的滚动条的垂直位置
// var s = $(window).scrollTop();
// //当窗口的滚动条的垂直位置大于页面的最小高度时,让返回顶部元素渐现,否则渐隐
// if( s > 600){
// $("#gotoTop").fadeIn(100);
// }else{
// $("#gotoTop").fadeOut(200);
// };
// });
$(function(){goTopEx();});
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
(s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
(s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
(s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
(s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
function goTopEx() {
var obj = document.getElementById("goTopBtn");
var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
function getScrollTop() {
var xsun = document.documentElement.scrollTop;
if (Sys.chrome) {
xsun=document.body.scrollTop;
}
return xsun;
}
function setScrollTop(value) {
if (Sys.chrome) {
document.body.scrollTop = value;
}
else {
document.documentElement.scrollTop = value;
}
}
window.onscroll = function () { getScrollTop() > 0 ? obj.style.display = "" : obj.style.display = "none"; };
obj.onclick = function () {
var goTop = setInterval(scrollMove, 10);
function scrollMove() {
setScrollTop(getScrollTop() / 1.1);
if (getScrollTop() < 1) clearInterval(goTop);
}
}
}
</script>
</div>
<div id='bidding_project_list'>

View File

@ -0,0 +1,9 @@
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f} %>
<li>
<%= link_to l(:button_cancel), course_boards_path(@course), :class => 'grey_btn fr ml10' %>
<a href="#" onclick="$('#message-form').submit();" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<div class="cl"></div>
</li>
<% end %>

View File

@ -1,28 +1,26 @@
<div id="add-message" class="add_frame" style="display:none;">
<% if User.current.logged? %>
<h3>
<%= link_to h(@board.name), course_board_path(@course, @board) %>
<%= l(:label_message_new) %>
</h3>
<div class="add_frame_header" >
<%= l(:label_message_new) %>
</div>
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => false, :id => 'message-form'} do |f| %>
<%= render :partial => 'messages/form_course', :locals => {:f => f} %>
<p>
<a href="javascript:void(0)" onclick="submitCoursesBoard();"class="ButtonColor m3p10"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => '$("#add-message").hide(); return false;' ,:class => 'ButtonColor m3p10' %>
</p>
<% end %>
<div id="preview" class="wiki"></div>
<% end %>
</div>
<!--display the board-->
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_board_plural) %></h2>
</div>
<h2 class="project_h2 fl">
<% if User.current.language == "zh"%>
<%= h @board.name %>
<% else %>
<%= l(:project_module_boards) %>
<% end %>
</h2>
<a href="javascript:void(0)" class="green_btn fr newtalk " onclick="show_newtalk();"><%= l(:label_message_new) %></a>
<div class="cl"></div>
</div>
<!-- 发布新帖部分 -->
<div class="cl"></div>
<div class=" talklist_box" >
<div class="talk_new ml15 mb10" id="about_newtalk" >
<ul>
<%= render :partial => 'course_new' %>
</ul>
</div><!--talknew end-->
<% if !User.current.logged?%>
<div style="font-size: 14px;margin:20px;">
@ -31,38 +29,125 @@
<hr/>
</div>
<% end %>
<div class="talk_top ml15">
<p class="fl">
<%= l(:label_totle) %>
<span><%= @topic_count %></span>
<%= l(:label_course_momes_count) %>
</p>
<%= link_to l(:label_message_new),
new_board_message_path(@board),
:class => 'problem_new_btn fl c_dorange' if User.current.logged? %>
<div class="cl"></div>
</div>
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"32",:height=>"32"), user_path(topic.author),:class => 'problem_pic talk_pic fl' %>
<div class="talk_txt fl">
<%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title: topic.subject.to_s,:class => "problem_tit fl fb c_dblue" %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red">置顶</a>
<% end %>
<br/>
<p>由<%= link_to topic.author,user_path(topic.author),:class => "problem_name" %>添加于<%= format_time(topic.created_on) %></p>
</div>
<%=link_to (l(:label_reply) + topic.replies_count.to_s), board_message_path(@board, topic),:class => "talk_btn fr c_white" %>
<div class="talkmain_box" style="border:none; margin-bottom:0;">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talkmain_txt fl mt5">
<% author = topic.author.to_s + "" %>
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
<p class="talkmain_tit fl fb">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red"><%= l(:label_board_sticky)%></a>
<% end %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<br/>
<p>
<div id="contentmessage<%=topic.id %>" class="project_board_content">
<%= topic.content %>
</div>
<label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#contentmessage<%=topic.id %>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
<span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</p>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div>
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml15 mb10" style="display: none" id="reply<%= topic.id %>">
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<a href="#" onclick="$('#message_form<%= topic.id%>').submit();" class="talk_btn fr c_white" style=""><%= l(:label_memo_create)%></a>
<% end %>
<div class="cl"></div>
</div>
<% end %>
<% replies_all = topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").offset(2).
all %>
<% replies_show = topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").limit(2).
all %>
<% unless replies_show.empty? %>
<% reply_count = 0 %>
<div class="talkWrapMsg">
<ul>
<% replies_show.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<div class="talkWrapMsg" id="talkWrapMsg<%= topic.id %>" style="display: none">
<ul>
<% replies_all.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<div class="talkWrapMsg"><a class=" ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %>
</div>
<% end %>
<% else %>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>

View File

@ -0,0 +1,60 @@
<%= error_messages_for 'message' %>
<% replying ||= false %>
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
<% if replying %>
<li style="display: none">
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span" class="ml55"></p>
</li>
<% else %>
<li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span" class="ml55"></p>
</li>
<% end %>
<li class="ml60 mb5">
<% unless replying %>
<% if @message.safe_attribute? 'sticky' %>
<%= f.check_box :sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<% end %>
<% if @message.safe_attribute? 'locked' %>
<%= f.check_box :locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<% end %>
<% end %>
<div class="cl"></div>
</li>
<li>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<% unless replying %>
<label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label>
<% end %>
<%= text_area :quote,:quote,:style => 'display:none' %>
<% if replying%>
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %>
<% else %>
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
<% end %>
<div class="cl"></div>
<p id="message_content_span" class="ml55"></p>
</li>
<div class="cl"></div>
<li>
<% unless replying %>
<div class="fl ml3" style="padding-left: 52px;">
<%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %>
</div>
<% end %>
</li>
<li >
<div class="cl"></div>
</li>

View File

@ -0,0 +1,60 @@
<%= error_messages_for 'message' %>
<% replying ||= false %>
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
<% if replying %>
<li style="display: none">
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span" class="ml55"></p>
</li>
<% else %>
<li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span" class="ml55"></p>
</li>
<% end %>
<li class="ml60 mb5">
<% unless replying %>
<% if @message.safe_attribute? 'sticky' %>
<%= f.check_box :sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<% end %>
<% if @message.safe_attribute? 'locked' %>
<%= f.check_box :locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<% end %>
<% end %>
<div class="cl"></div>
</li>
<li>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<% unless replying %>
<label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label>
<% end %>
<%= text_area :quote,:quote,:style => 'display:none' %>
<% if replying%>
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %>
<% else %>
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
<% end %>
<div class="cl"></div>
<p id="message_content_span" class="ml55"></p>
</li>
<div class="cl"></div>
<li>
<% unless replying %>
<div class="fl ml3" style="padding-left: 52px;">
<%= render :partial => 'attachments/form_project', :locals => {:container => @message,:isReply => @isReply} %>
</div>
<% end %>
</li>
<li >
<div class="cl"></div>
</li>

View File

@ -0,0 +1,9 @@
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f} %>
<li>
<%= link_to l(:button_cancel), project_boards_path(@project), :class => 'grey_btn fr ml10' %>
<a href="#" onclick="$('#message-form').submit();" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<div class="cl"></div>
</li>
<% end %>

View File

@ -1,11 +1,14 @@
<div class="project_r_h">
<h2 class="project_h2">
<div class="project_r_h" xmlns="http://www.w3.org/1999/html">
<h2 class="project_h2 fl">
<% if User.current.language == "zh"%>
<%= h @board.name %>
<% else %>
<%= l(:project_module_boards) %>
<% end %>
</h2>
<a href="javascript:void(0)" class="green_btn fr newtalk " onclick="show_newtalk();"><%= l(:label_message_new) %></a>
<div class="cl"></div>
</div>
<!--display the board-->
@ -16,34 +19,136 @@
</div>
<% end %>
<!-- 内容显示部分 -->
<div class="talk_top">
<div class="fl"><span><%= l(:label_project_board_count , :count => @topic_count)%></span></div>
<% if @project.enabled_modules.where("name = 'boards'").count > 0 && User.current.member_of?(@project) %>
<span><%= link_to l(:project_module_boards_post), new_board_message_path(@board),
:class => 'problem_new_btn fl c_dorange',
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %></span>
<% end %>
<div class="cl"></div>
</div>
<!-- 发布新帖部分 -->
<div class="cl"></div>
<div class=" talklist_box" >
<div class="talk_new ml15 mb10" id="about_newtalk" >
<ul>
<%= render :partial => 'project_new_topic' %>
</ul>
</div><!--talknew end-->
<!-- 帖子内容显示 -->
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"32",:height=>"32"), user_path(topic.author),:class => 'problem_pic talk_pic fl' %>
<div class="talk_txt fl">
<%= link_to h(topic.subject), board_message_path(@board, topic), title:topic.subject.to_s, :class =>"problem_tit fl" %>
<div class="talkmain_box" style="border:none; margin-bottom:0;">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talkmain_txt fl mt5">
<% author = topic.author.to_s + "" %>
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
<p class="talkmain_tit fl fb">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red"><%= l(:label_board_sticky)%></a>
<% end %>
<br/>
<%= l(:label_post_by)%><%= link_to topic.author, user_path(topic.author), :class =>"problem_name" %>
&nbsp;<%= l(:label_post_by_time)%><%= format_time topic.created_on %>
<div class="cl"></div>
<p id="contentmessage<%=topic.id %>" class="project_board_content">
<%= topic.content %>
</p> <p>
<label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#contentmessage<%=topic.id %>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
<span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</p>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div>
<%= link_to (l(:label_short_reply) + " "+topic.replies_count.to_s), board_message_path(@board, topic), :class => "talk_btn fr c_white" %>
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<% end %>
<div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml15 mb10" style="display: none" id="reply<%= topic.id %>">
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<a href="#" onclick="$('#message_form<%= topic.id%>').submit();" class="talk_btn fr c_white" style=""><%= l(:label_memo_create)%></a>
<% end %>
<div class="cl"></div>
</div>
<% end %>
<% replies_all = topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").offset(2).
all %>
<% replies_show = topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").limit(2).
all %>
<% unless replies_show.empty? %>
<% reply_count = 0 %>
<div class="talkWrapMsg">
<ul>
<% replies_show.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<div class="talkWrapMsg" id="talkWrapMsg<%= topic.id %>" style="display: none">
<ul>
<% replies_all.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<div class="talkWrapMsg"><a class=" ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %>
</div>
<% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
@ -61,3 +166,33 @@
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
<% end %>
</div>
<script type="text/javascript">
// var flag = false;
// jQuery(document).ready(function($) {
// transpotUrl('#content');
// });
function submit_message_replay()
{
if(flag)
{
$("#message_form").submit();
}
}
function regexContent()
{
var content = $.trim($("#message_content").val());
if(content.length ==0)
{
$("#message_content_span").text("<%= l(:label_reply_empty) %>");
$("#message_content_span").css('color','#ff0000');
flag = false;
}
else
{
$("#message_content_span").text("<%= l(:label_field_correct) %>");
$("#message_content_span").css('color','#008000');
flag = true;
}
}
</script>

View File

@ -1,4 +1,107 @@
<script type="text/javascript">
//头部导航
var menuids=["TopUserNav"] //Enter id(s) of SuckerTree UL menus, separated by commas
function buildsubmenus(){
for (var i=0; i<menuids.length; i++){
var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
for (var t=0; t<ultags.length; t++){
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
ultags[t].parentNode.onmouseover=function(){
this.getElementsByTagName("ul")[0].style.display="block"
}
ultags[t].parentNode.onmouseout=function(){
this.getElementsByTagName("ul")[0].style.display="none"
}
}
}
}
if (window.addEventListener)
window.addEventListener("load", buildsubmenus, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus)
</script>
<script type="text/javascript">//侧导航
$(function(){
$(".subNav").click(function(){
$(this).toggleClass("currentDd").siblings(".subNav").removeClass("currentDd")
$(this).toggleClass("currentDt").siblings(".subNav").removeClass("currentDt")
// 修改数字控制速度, slideUp(500)控制卷起速度
$(this).next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
})
})
function show_more_msg()
{
$("#course_description").toggleClass("course_description_none");
}
function show_more_msg02()
{
$("#news_description").toggleClass("news_description_none");
}
function show_newtalk()
{
$("#about_newtalk").toggle();
}
function show_newreply()
{
$("#replyContent").toggle();
}
function regexContent()
{
var content = $.trim($("#message_content").val());
if(content.length ==0)
{
$("#message_content_span").text("<%= l(:label_reply_empty) %>");
$("#message_content_span").css('color','#ff0000');
flag = false;
}
else
{
$("#message_content_span").text("<%= l(:label_field_correct) %>");
$("#message_content_span").css('color','#008000');
flag = true;
}
}
function regexSubject()
{
var content = $.trim($("#message_subject").val());
if(content.length ==0)
{
$("#subject_span").text("主题不能为空");
$("#subject_span").css('color','#ff0000');
return false;
}
else
{
$("#subject_span").text("填写正确");
$("#subject_span").css('color','#008000');
return true;
}
return false;
}
function regexContent()
{
var content = message_content_editor.html();
if(content.length ==0)
{
$("#message_content_span").text("描述不能为空");
$("#message_content_span").css('color','#ff0000');
return false;
}
else
{
$("#message_content_span").text("填写正确");
$("#message_content_span").css('color','#008000');
return true;
}
return false;
}
</script>
<% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %>
<% elsif @course %>

View File

@ -21,7 +21,16 @@
function submit_jours(is_teacher)
{
if(!is_teacher&&$("#stars_value").val() == "0"){alert("您还没有打分");return;}
if(!is_teacher&&$("#stars_value").val() == "0"){
if(confirm('是否确定评分为0分?'))
{
}
else
{
return;
}
}
if(!is_teacher&&$("#new_form_user_message").val() == ""){alert("您还没有填写评语");return;}
$('#new_form_user_message').parent().submit();
}

View File

@ -34,7 +34,11 @@
</span>
</div>
<% end %>
<div class="cl"></div>
<div class="to_top" id="goTopBtn" style="display: none;">
返<br/>回<br/>顶<br/>部
</div>
<div class="cl"></div>
<% unless homeworks.nil? %>

View File

@ -22,7 +22,7 @@
</span>
<% end %>
</span>
<span style="color:#a6a6a6; margin-right:30px; margin-left:10px;">
<span style="color:#a6a6a6; margin-right:20px; margin-left:10px;">
<%= format_time(review.created_at) %>
</span>
<span style="font-weight:bold; color:#a6a6a6; float: right;">

View File

@ -46,7 +46,7 @@
<% end %><!--meny end -->
<!-- more -->
<div class="subNav subNav_jiantou" onclick="expand_tools_expand();" id="expand_tools_expand"><%= l(:label_project_more) %></div>
<ul class="navContent">
<div class="subNav subNav_jiantou" onclick="$('#navContent').toggle(500);" id="expand_tools_expand"><%= l(:label_project_more) %></div>
<ul class="navContent" id="navContent">
<%= render 'projects/tools_expand' %>
</ul>

View File

@ -157,8 +157,8 @@
<!--邀请加入-->
<div class="subNavBox">
<% if User.current.member_of?(@project) %>
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" onclick="expand_tools_expand('invit');"><%= l(:label_invite)%></div>
<ul class="navContent " style="display:block">
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" onclick="$('#navContent_invit').toggle(500);"><%= l(:label_invite)%></div>
<ul class="navContent " style="display:block" id="navContent_invit">
<li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
<% if User.current.allowed_to?(:manage_members, @project) %>
<li><%= link_to l(:label_invite_trustie_user), :controller=>"projects", :action=>"invite_members", :id => @project %></li>

View File

@ -2,7 +2,12 @@
<%
roles = Role.givable.all
if @project.project_type == Project::ProjectType_course
roles = roles[3..5]
if User.current.language == "zh"
roles = ["管理人员","开发者","报告人员"]
else
roles = ["管理人员","开发者","报告人员"]
# roles = roles[3..5]
end
else
roles = roles[0..2]
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150428021035) do
ActiveRecord::Schema.define(:version => 20150505025537) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -438,13 +438,6 @@ ActiveRecord::Schema.define(:version => 20150428021035) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "discuss_demos", :force => true do |t|
t.string "title"
t.text "body"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "documents", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.integer "category_id", :default => 0, :null => false
@ -541,6 +534,8 @@ ActiveRecord::Schema.define(:version => 20150428021035) do
t.integer "is_teacher_score", :default => 0
end
add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id"
create_table "homework_evaluations", :force => true do |t|
t.string "user_id"
t.string "homework_attach_id"
@ -553,6 +548,9 @@ ActiveRecord::Schema.define(:version => 20150428021035) do
t.integer "bid_id"
end
add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
create_table "homework_users", :force => true do |t|
t.string "homework_attach_id"
t.string "user_id"
@ -1159,6 +1157,9 @@ ActiveRecord::Schema.define(:version => 20150428021035) do
t.datetime "updated_at", :null => false
end
add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id"
add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id"
create_table "taggings", :force => true do |t|
t.integer "tag_id"
t.integer "taggable_id"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -33,9 +33,10 @@ function expand_tools_expand(content) {
$("#expand_tools_expand_invit").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
}
else {
$("#expand_tools_expand").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd");
$("#expand_tools_expand").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt");
$("#expand_tools_expand").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
// $("#expand_tools_expand").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd");
// $("#expand_tools_expand").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt");
// $("#expand_tools_expand").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
$("#navContent").toggle(500);
}
// 修改数字控制速度, slideUp(500)控制卷起速度
@ -58,7 +59,22 @@ function show_more_msg() {
arrow.attr("src", "/images/jiantou.jpg")
}
}
function show_more_reply(contentid, id2, id3) {
$(contentid).toggleClass("course_description_none");
var information = $(id2);
var arrow = $(id3);
var val = information.attr("value");
if (val == "show_more") {
$(id2).text("[收起]");
information.attr("value", "hide_more");
arrow.attr("src", "/images/jiantouup.jpg")
}
else {
$(id2).text("[展开]");
information.attr("value", "show_more");
arrow.attr("src", "/images/jiantou.jpg")
}
}
//项目版本库git帮助文档显示
function showhelpAndScrollTo(id) {
@ -84,7 +100,29 @@ function showhelpAndScrollTo(id) {
information.attr("value", "show_help");
}
}
function showhelpAndScrollToMessage(id, id1) {
$('#' + id).toggle();
if(cookieget("repositories_visiable") == "true")
{
cookiesave("repositories_visiable", false,'','','');
}
else
{
cookiesave("repositories_visiable", true,'','','');
}
var information = $(id1);
var val = information.attr("value");
if(val=="show_help")
{
$(id1).text("收起回复");
information.attr("value", "hide_help");
}
else
{
$(id1).text("展开回复");
information.attr("value", "show_help");
}
}
$(function(){

View File

@ -530,6 +530,41 @@ a.wzan_visited{background:url(../images/new_project/public_icon.png) 0px -503px
a.files_tag_icon{ background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px; }
a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #64bdd9; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px;}
/* 20150505讨论区*/
.w664{ width:664px;}
.w140{ width:140px;}
.talklist_box{ }
.talkmain_box{ width:670px; border-bottom:1px dashed #d9d9d9; margin-bottom:20px; margin-top: 10px;}
.talkmain_pic{}
a.talkmain_pic{ display:block; width:42px; height:42px; padding:2px; border:1px solid #e3e3e3;}
a:hover.talkmain_pic{border:1px solid #64bdd9;}
.talkmain_txt{ width:610px; margin-left:10px; color:#333;}
a.talkmain_name{ color:#ff5722;}
a:hover.talkmain_name{ color:#d33503;}
.talkmain_tit{ color:#0781b4; width:450px; display:block; }
.talklist_main{ }
.talkWrapArrow{ display:block; float:right; margin-right:10px;background:url(../images/arrow.png) 0 0 no-repeat; height:7px; width:13px;}
.talkConIpt{ background:#f2f2f2; }
.talkWrapBox{ width:610px; margin-left:60px; }
.inputFeint{ border:1px solid #d9d9d9; background:#fff; width:583px; height:50px; margin:10px; margin-bottom:5px;color:#666;}
.inputFeint02{ border:1px solid #d9d9d9; background:#fff; width:535px; height:30px; margin:5px 0 5px 50px; color:#666;}
.inputFeint03{ border:1px solid #d9d9d9; background:#fff; width:490px; height:30px; margin:5px 0 5px 0px; color:#666;}
.talkWrapMsg{ background:#f2f2f2; padding:10px;}
a.Msg_pic{ display:block; width:34px; height:34px; padding:2px; border:1px solid #e3e3e3; float:left;}
a:hover.Msg_pic{border:1px solid #64bdd9;}
a.Reply_pic{ display:block; width:30px; height:30px; padding:2px; border:1px solid #e3e3e3; float:left;}
a:hover.Reply_pic{border:1px solid #64bdd9;}
.Msg_txt{ float:left; width:540px; margin-left:10px;}
.Msg_txt p{ }
.talkWrapMsg ul li{border-bottom:1px dashed #d9d9d9; padding-bottom:10px; margin-bottom:10px;}
.talkReply{ width:540px; margin-left:50px; border-top:1px dashed #d9d9d9; padding-top:10px; }
.Replybox{ float:left; width:495px; margin-left:5px;}
.talk_nextpage{ border:none; width:410px; margin:0 auto;}
.newtalk { margin-top:8px; margin-right:8px;}
.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;}
#about_newtalk{ display:none;}

View File

@ -175,6 +175,7 @@ a.member_search {width: 43px;height: 22px;background: #15bccf;color: #fff;text-a
/*上传图片处理*/
.upload_img img{max-width: 100%;}
.to_top{width: 19px;height: 74px;position: fixed;top: 50px;right: 1px;color: white;background: #15bccf; line-height: 1.2; padding-top: 10px;padding-left: 5px;font-size: 14px;cursor: pointer;}

View File

@ -49,6 +49,7 @@ a:hover.subnav_green{ background:#14ad5a;}
/*简介*/
.project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;}
.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;}
.project_board_content{overflow: hidden;max-height: 50px;word-break: break-all;word-wrap: break-word;}
.course_description_none{max-height: none;}
.lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;}
.lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;}

View File

@ -692,3 +692,38 @@ tr.open span.expander {background-image: url(../images/bullet_toggle_minus.png);
.icon-file.application-pdf { background-image: url(../images/files/pdf.png); }
.icon-file.application-zip { background-image: url(../images/files/zip.png); }
.icon-file.application-x-gzip { background-image: url(../images/files/zip.png); }
/* 20150505讨论区*/
.w664{ width:664px;}
.w140{ width:140px;}
.talklist_box{ }
.talkmain_box{ width:670px; border-bottom:1px dashed #d9d9d9; margin-bottom:20px; margin-top: 10px;}
.talkmain_pic{}
a.talkmain_pic{ display:block; width:42px; height:42px; padding:2px; border:1px solid #e3e3e3;}
a:hover.talkmain_pic{border:1px solid #64bdd9;}
.talkmain_txt{ width:610px; margin-left:10px; color:#333;}
a.talkmain_name{ color:#ff5722;}
a:hover.talkmain_name{ color:#d33503;}
.talkmain_tit{ color:#0781b4; width:450px; display:block; }
.talklist_main{ }
.talkWrapArrow{ display:block; float:right; margin-right:10px;background:url(../images/arrow.png) 0 0 no-repeat; height:7px; width:13px;}
.talkConIpt{ background:#f2f2f2; }
.talkWrapBox{ width:610px; margin-left:60px; }
.inputFeint{ border:1px solid #d9d9d9; background:#fff; width:583px; height:50px; margin:10px; margin-bottom:5px;color:#666;}
.inputFeint02{ border:1px solid #d9d9d9; background:#fff; width:535px; height:30px; margin:5px 0 5px 50px; color:#666;}
.inputFeint03{ border:1px solid #d9d9d9; background:#fff; width:490px; height:30px; margin:5px 0 5px 0px; color:#666;}
.talkWrapMsg{ background:#f2f2f2; padding:10px;}
a.Msg_pic{ display:block; width:34px; height:34px; padding:2px; border:1px solid #e3e3e3; float:left;}
a:hover.Msg_pic{border:1px solid #64bdd9;}
a.Reply_pic{ display:block; width:30px; height:30px; padding:2px; border:1px solid #e3e3e3; float:left;}
a:hover.Reply_pic{border:1px solid #64bdd9;}
.Msg_txt{ float:left; width:540px; margin-left:10px;}
.Msg_txt p{ }
.talkWrapMsg ul li{border-bottom:1px dashed #d9d9d9; padding-bottom:10px; margin-bottom:10px;}
.talkReply{ width:540px; margin-left:50px; border-top:1px dashed #d9d9d9; padding-top:10px; }
.Replybox{ float:left; width:495px; margin-left:5px;}
.talk_nextpage{ border:none; width:410px; margin:0 auto;}
.newtalk { margin-top:8px; margin-right:8px;}
.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;}
#about_newtalk{ display:none;}

View File

@ -56,7 +56,6 @@ h4{ font-size:14px; color:#3b3b3b;}
.ml10{ margin-left:10px;}
.ml15{ margin-left:15px;}
.ml20{ margin-left:20px;}
.ml25{ margin-left:25px;}
.ml40{ margin-left:40px;}
.ml45{ margin-left:45px;}
.ml55{ margin-left:55px;}
@ -64,6 +63,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.ml60{ margin-left:60px;}
.ml80{ margin-left:80px;}
.ml90{ margin-left:90px;}
.ml100{ margin-left:100px;}
.ml110{ margin-left:110px;}
.mr5{ margin-right:5px;}
.mr10{ margin-right:10px;}
@ -74,13 +74,13 @@ h4{ font-size:14px; color:#3b3b3b;}
.mt5{ margin-top:5px;}
.mt8{ margin-top:8px;}
.mt10{ margin-top:10px;}
.mt13{ margin-top:13px;}
.mt43{ margin-top:43px;}
.mt40{ margin-top:40px;}
.mb5{ margin-bottom:5px;}
.mb10{ margin-bottom:10px;}
.mb13{ margin-bottom:13px;}
.mb20{ margin-bottom:20px;}
.pl15{ padding-left:15px;}
.w20{ width:20px;}
.w60{ width:60px;}
.w70{ width:70px;}
.w90{ width:90px;}
.w210{ width:210px;}
.w150{ width:150px;}
@ -93,8 +93,10 @@ h4{ font-size:14px; color:#3b3b3b;}
.w350{ width:350px;}
.w610{ width:610px;}
.w600{ width:600px;}
.h22{ height:22px;}
.h26{ height:26px;}
.h50{ height:50px;}
.h70{ height:70px;}
.h150{ height:150px;}
/* Font & background Color */