取消回复帖子时对主题的js验证
This commit is contained in:
parent
e220f100d6
commit
cf9f33fce7
|
@ -181,7 +181,7 @@
|
||||||
<div id="reply" style="display:none;">
|
<div id="reply" style="display:none;">
|
||||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
||||||
<%= render :partial => 'form', :locals => {:f => f, :replying => true} %>
|
<%= render :partial => 'form', :locals => {:f => f, :replying => true} %>
|
||||||
<input type="button" class="enterprise" value="<%=l(:button_submit) %>" onmousemove="regexContent()" onclick="submit_message_replay();" >
|
<input type="button" class="enterprise" value="<%=l(:button_submit) %>" onclick="submit_message_replay();" >
|
||||||
<% end %>
|
<% end %>
|
||||||
<div id="preview" class="wiki"></div>
|
<div id="preview" class="wiki"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -190,7 +190,7 @@
|
||||||
<% html_title @topic.subject %>
|
<% html_title @topic.subject %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var flag = false
|
var flag = false;
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
transpotUrl('#content');
|
transpotUrl('#content');
|
||||||
});
|
});
|
||||||
|
|
|
@ -46,7 +46,11 @@
|
||||||
<span class="required"> * </span>
|
<span class="required"> * </span>
|
||||||
</label>
|
</label>
|
||||||
<br/>
|
<br/>
|
||||||
|
<% if replying %>
|
||||||
|
<%= f.text_field :subject, { size: 60, style: "width: 99%;", id: "message_subject" }.merge(extra_option) %>
|
||||||
|
<% else %>
|
||||||
<%= f.text_field :subject, { size: 60, style: "width: 99%;", id: "message_subject", onblur: "regexSubject();" }.merge(extra_option) %>
|
<%= f.text_field :subject, { size: 60, style: "width: 99%;", id: "message_subject", onblur: "regexSubject();" }.merge(extra_option) %>
|
||||||
|
<% end %>
|
||||||
<span id="subject_span"></span>
|
<span id="subject_span"></span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -181,15 +181,38 @@
|
||||||
<div id="reply" style="display:none;">
|
<div id="reply" style="display:none;">
|
||||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
||||||
<%= render :partial => 'form', :locals => {:f => f, :replying => true} %>
|
<%= render :partial => 'form', :locals => {:f => f, :replying => true} %>
|
||||||
<%= submit_tag l(:button_submit) %>
|
<input type="button" class="enterprise" value="<%=l(:button_submit) %>" onclick="submit_message_replay();" >
|
||||||
<%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form') %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<div id="preview" class="wiki"></div>
|
<div id="preview" class="wiki"></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% html_title @topic.subject %>
|
<% html_title @topic.subject %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var flag = false;
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
transpotUrl('#content');
|
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>
|
</script>
|
Loading…
Reference in New Issue