socialforge/app/views/poll/_edit_head.html.erb

43 lines
1.9 KiB
Plaintext

<%= form_for @poll,:remote => true do |f|%>
<div class="ur_editor ur_title_editor"> <!--编辑头部start-->
<div class="ur_title_editor_title">
<input type="text" maxlength="100" name="polls_name" id="polls_title" value="<%= @poll.polls_name %>" class="input_title" placeholder="问卷标题"/>
</div>
<div class="ur_title_editor_prefix">
<div contenteditable="true" id="polls_description_div" class="ur_textbox" style="min-height: 150px;width: 100%;background-color: #ffffff" onkeyup="edit_head();">
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
</div>
<textarea name="polls_description" maxlength="300" id="polls_description" class="textarea_editor" style="display: none">
<%= @poll.polls_description%>
</textarea>
</div>
<div class="ur_editor_footer" style="padding-top: 10px;">
<a class="btn_submit c_white" data-button="ok" onclick="pollsSubmit($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="pollsCancel();">
<%= l(:button_cancel)%>
</a>
</div>
<div class="cl"></div>
</div><!--编辑头部 end-->
<% end%>
<script type="text/javascript">
$(function(){
if($('#polls_description_div').html().trim() == '') {
$('#polls_description_div').html("<p style='color:#999999'>问卷描述</p>");
}
});
$('#polls_description_div').focus(function(){
//alert($('#polls_description_div').html().trim());
if(/^\s*<\w*\s*\w*\=\"\w*\:\s*\#\d*\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test($('#polls_description_div').html().trim())) {
$('#polls_description_div').html('');
}
}).blur(function(){
if($('#polls_description_div').html().trim() == '') {
$('#polls_description_div').html("<p style='color:#999999'>问卷描述</p>");
}
});
</script>