This commit is contained in:
huang 2015-05-14 15:38:27 +08:00
commit 68986fa1cb
12 changed files with 98 additions and 87 deletions

View File

@ -3,7 +3,7 @@
<%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
<li>
<a href="javascript:void(0)" onclick="show_newtalk();" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
<a href="#" onclick="$('#message-form').submit();" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<a href="#" onclick="submitProjectsBoard('<%= @message.id %>')" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<div class="cl"></div>
</li>
<% end %>

View File

@ -32,7 +32,7 @@
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;" id="topic<%= topic.id %>">
<%= 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 + "" %>

View File

@ -12,7 +12,7 @@
} do |f| %>
<%= render :partial => 'form_project',
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
<a href="#" onclick="$('#message-form<%= topic.id%>').submit();" class="blue_btn fl c_white" ><%= l(:button_submit)%></a>
<a href="#" onclick="submitProjectsBoard('#message-form<%= topic.id%>');" class="blue_btn fl c_white" ><%= l(:button_submit)%></a>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" class="blue_btn grey_btn fl c_white"><%= l(:button_cancel) %></a>
<%#= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %>
</ul>

View File

@ -8,16 +8,16 @@
<%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span" class="ml55"></p>
<p id="subject_span<%= topic.id%>" 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) %>
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span" class="ml55"></p>
<p id="subject_span<%= f.object.id%>" class="ml55"></p>
</li>
<% end %>
<li class="ml60 mb5">
@ -40,12 +40,12 @@
<% 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;" %>
<%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :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个英文字符)" %>
<%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
<% end %>
<div class="cl"></div>
<p id="message_content_span" class="ml55"></p>
<p id="message_content_span<%= f.object.id%>" class="ml55"></p>
</li>
<div class="cl"></div>
<li>

View File

@ -5,19 +5,19 @@
<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) %>
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span" class="ml55"></p>
<p id="subject_span<%= f.object.id%>" 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) %>
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %>
<p id="subject_span" class="ml55"></p>
<p id="subject_span<%= f.object.id%>" class="ml55"></p>
</li>
<% end %>
<li class="ml60 mb5">
@ -36,16 +36,16 @@
<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>
<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;" %>
<%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :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个英文字符)" %>
<%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
<% end %>
<div class="cl"></div>
<p id="message_content_span" class="ml55"></p>
<p id="message_content_span<%= f.object.id%>" class="ml55"></p>
</li>
<div class="cl"></div>
<li>

View File

@ -33,7 +33,7 @@
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
<div class="talkmain_box" id="topic<%= topic.id %>" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
<%= 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 + "" %>
@ -215,20 +215,5 @@
$("#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

@ -25,14 +25,29 @@
<script type="text/javascript">//侧导航
window.onload = function () {
$("p[aa='bb']").each(function() {
alert((this.offsetHeight == '55'));
if(this.offsetHeight == '55') {
this.next.style.dispaly="block";
}
})
var topic_id = getParam('topic_id');
document.getElementById(topic_id).focus();
}
var getParam = function(name){
var search = document.location.search;
var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
var matcher = pattern.exec(search);
var items = null;
if(null != matcher){
try{
items = decodeURIComponent(decodeURIComponent(matcher[1]));
}catch(e){
try{
items = decodeURIComponent(matcher[1]);
}catch(e){
items = matcher[1];
}
}
}
return items;
};
function show_newtalk()
{
$("#about_newtalk").toggle();
@ -42,6 +57,9 @@ function show_newtalk1(id)
{
$(id).toggle();
}
</script>
<% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %>

View File

@ -15,7 +15,7 @@
<span class="fl"> &nbsp;</span>
<span class="fl"> <%= l(:label_new_activity) %></span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
(e.event_type.eql?("bid") ? homework_course_path(@course) : e.event_url),:class => "problem_tit c_dblue fl fb"%>
(e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%>
<br />
<p class="mt5 break_word"><%= e.event_description.html_safe %>
<br />

View File

@ -66,9 +66,7 @@
<%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %></a><span class="fl"> <%= l(:label_new_activity) %> </span>
<%= link_to format_activity_title("#{act.board.name}: #{act.subject}"),
{:controller => 'messages',
:action => 'show',
:board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}),
project_boards_path(@project,:topic_id => act.id),
:class => "problem_tit fl fb " %>
<br />
<p class="mt5 break_word"><%= textAreailizable act,:content %><br />

View File

@ -151,45 +151,48 @@ function submit_edit_course(id)
///////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////课程讨论区
function regexSubject()
{
var content = $.trim($("#message_subject").val());
if(content.length ==0)
{
$("#subject_span").text("主题不能为空");
$("#subject_span").css('color','#ff0000');
function regexSubject(id) {
var subjectid = "#message_subject" + id ;
var content = $.trim($(subjectid).val());
var message = "#subject_span" + id;
if (content.length == 0) {
$(message).text("主题不能为空");
$(message).css('color', '#ff0000');
return false;
}
else
{
$("#subject_span").text("填写正确");
$("#subject_span").css('color','#008000');
else {
$(message).text("填写正确");
$(message).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');
function regexContent(id) {
var contentid = "#message_content" + id;
var message = "#message_content_span"+ id;
var content = $.trim($(contentid).val());
if (content.length == 0) {
$(message).text("描述不能为空");
$(message).css('color', '#ff0000');
return false;
}
else
{
$("#message_content_span").text("填写正确");
$("#message_content_span").css('color','#008000');
else {
$(message).text("填写正确");
$(message).css('color', '#008000');
return true;
}
return false;
}
function submitCoursesBoard()
{
message_content_editor.sync();
if(regexSubject()&&regexContent()){$("#message-form").submit();}
// 项目讨论区编辑和提交
function submitProjectsBoard(id) {
var formid = "#message-form" + id;
if (regexSubject(id) && regexContent(id)) {
$(formid).submit();
}
}
///////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////// 课程通知
function regexTitle()

View File

@ -144,42 +144,49 @@ $(function(){
///////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////项目讨论区
function regexSubject() {
var content = $.trim($("#message_subject").val());
function regexSubject(id) {
var subjectid = "#message_subject" + id ;
var content = $.trim($(subjectid).val());
var message = "#subject_span" + id;
if (content.length == 0) {
$("#subject_span").text("主题不能为空");
$("#subject_span").css('color', '#ff0000');
$(message).text("主题不能为空");
$(message).css('color', '#ff0000');
return false;
}
else {
$("#subject_span").text("填写正确");
$("#subject_span").css('color', '#008000');
$(message).text("填写正确");
$(message).css('color', '#008000');
return true;
}
return false;
}
function regexContent() {
var content = $.trim($("#message_content").val());
function regexContent(id) {
var contentid = "#message_content" + id;
var message = "#message_content_span"+ id;
var content = $.trim($(contentid).val());
if (content.length == 0) {
$("#message_content_span").text("描述不能为空");
$("#message_content_span").css('color', '#ff0000');
$(message).text("描述不能为空");
$(message).css('color', '#ff0000');
return false;
}
else {
$("#message_content_span").text("填写正确");
$("#message_content_span").css('color', '#008000');
$(message).text("填写正确");
$(message).css('color', '#008000');
return true;
}
return false;
}
// 项目讨论区编辑和提交
function submitProjectsBoard() {
if (regexSubject() && regexContent()) {
$("#message-form").submit();
function submitProjectsBoard(id) {
var formid = "#message-form" + id;
if (regexSubject(id) && regexContent(id)) {
$(formid).submit();
}
}
// 提交新闻
function regexTitle() {
var name = $("#news_title").val();

View File

@ -738,6 +738,6 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
.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;}