commit
55a7c168b5
@ -0,0 +1,2 @@
|
||||
$("#test_send_<%= @index%>").replaceWith("<a class='<%= @result == 0 ? 'green_btn' : 'red_btn'%> fl ml5 mt1' onclick='programing_test(<%= @index%>)' id='test_send_<%= @index%>'><%= @result == 0 ? '正确' : '错误'%></a>");
|
||||
$("#test_result_<%= @index%>").val("<%= @result%>");
|
@ -1,5 +1,8 @@
|
||||
|
||||
<div class="ur_page_head ur_editor02" ><!--头部显示 start-->
|
||||
|
||||
<a href="javascript:" class="ur_icon_edit" title="编辑" onclick="pollsEdit();"></a>
|
||||
<!-- <a class='ur_icon_add' title='导入' id="import_btn" onclick="importPoll();"></a> -->
|
||||
<h1 class="ur_page_title" id="polls_name_h"><%= poll.polls_name%></h1>
|
||||
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
|
||||
<div class="cl"></div>
|
||||
|
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Created by lizanle on 2015/7/29.
|
||||
*/
|
||||
$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>');
|
@ -0,0 +1,40 @@
|
||||
<% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %>
|
||||
<% if parent_jour%>
|
||||
<div class="mes_box02" id = '<%= reply.id %>'>
|
||||
<%= link_to image_tag(url_to_avatar(reply.user),:width => '32',:height => '32'), user_path(reply.user),:class => "users_pic_sub fl mr5" %>
|
||||
<div class=" mes_box02_info fl">
|
||||
<%= link_to "#{reply.user.login} ".html_safe, user_path(reply.user),:class => 'course_name fl c_blue02 ', :target => "_blank"%>
|
||||
<span class="fl c_grey"> 回复 </span>
|
||||
<%= link_to "#{parent_jour.user.login} : ".html_safe, user_path(parent_jour.user),:class => 'course_name fl c_blue02 mr5 ', :target => "_blank"%>
|
||||
<div class="cl">
|
||||
<%= reply.notes.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<span class="c_grey fr">
|
||||
<%= time_tag(reply.created_on).html_safe%>
|
||||
</span>
|
||||
<div class="fr cr">
|
||||
<%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"sub_reply_btn", :class => "ml5 c_purple" %>
|
||||
<% if User.current.admin? || reply.user == User.current%>
|
||||
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "c_purple ml5", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div nhname='sub_div_form' class="mt10 ml40" style="display:none;">
|
||||
<form action="<%= url_for(:controller => 'words', :action => 'create_reply') %>" data-remote="true" method="post">
|
||||
<input id="reference_id" name="reference_id" type="hidden" value="<%= (reply.m_parent_id.nil? || reply.m_parent_id==0 ) ? reply.id : reply.m_parent_id %>">
|
||||
<input id="reference_user_id" name="reference_user_id" type="hidden" value="<%= reply.user.id %>">
|
||||
<input id="reference_message_id" name="reference_message_id" type="hidden" value="<%= reply.id %>">
|
||||
<input id="show_name" name="show_name" type="hidden" value="true">
|
||||
<textarea name='user_notes' style="display:none;"></textarea>
|
||||
<p nhname='sub_contentmsg'></p>
|
||||
<div nhname='sub_toolbar_container' style="float:left;padding-top:3px;"></div>
|
||||
<a nhname="sub_cancel_btn" href="javascript:void(0);" class="grey_n_btn fr" style="margin-top:3px;">取消</a>
|
||||
<a nhname="sub_submit_btn" href="javascript:void(0);" class="blue_n_btn fr mr5" style="margin-top:3px;">发布</a>
|
||||
</form>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--mes_box02 end-->
|
||||
<% end%>
|
@ -0,0 +1,44 @@
|
||||
<div class="message_list" id="<%= jour.id %>" nhname="rec" data-id="<%= jour.id %>">
|
||||
<%= link_to image_tag(url_to_avatar(jour.user),:width => '46',:height => '46'), user_path(jour.user),:class => "users_pic fl" %>
|
||||
<div class="fl ml5 mes_box mb10" >
|
||||
<div>
|
||||
<%= link_to "#{jour.user.login} : ".html_safe, user_path(jour.user),:class => 'fl c_blue02 f14 fb mb5', :target => "_blank"%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<%= jour.notes.html_safe %>
|
||||
</div>
|
||||
</div><!--mes_box end-->
|
||||
<span class="c_grey fr mb10">
|
||||
<%= time_tag(jour.created_on).html_safe %>
|
||||
</span>
|
||||
<div class="fr cr">
|
||||
<%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"reply_btn", :class => "ml5 c_purple" %>
|
||||
<% if User.current.admin? || jour.user == User.current%>
|
||||
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => jour, :user_id => jour.user},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "ml5 c_purple", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div nhname='div_form' class="mt10 ml80" style="display:none;">
|
||||
<form action="<%= url_for(:controller => 'words', :action => 'create_reply') %>" data-remote="true" method="post">
|
||||
<input id="reference_id" name="reference_id" type="hidden" value="<%= (jour.m_parent_id.nil? || jour.m_parent_id==0 ) ? jour.id : jour.m_parent_id %>">
|
||||
<input id="reference_user_id" name="reference_user_id" type="hidden" value="<%= jour.user.id %>">
|
||||
<input id="reference_message_id" name="reference_message_id" type="hidden" value="<%= jour.id %>">
|
||||
<input id="show_name" name="show_name" type="hidden" value="true">
|
||||
<textarea name='user_notes' style="display:none;"></textarea>
|
||||
<p nhname='contentmsg'></p>
|
||||
<div nhname='toolbar_container' style="float:left;padding-top:3px;"></div>
|
||||
<a nhname="cancel_btn" href="javascript:;" class="grey_n_btn fr" style="margin-top:3px;">取消</a>
|
||||
<a nhname="submit_btn" href="javascript:;" class="blue_n_btn fr mr5" style="margin-top:3px;">发布</a>
|
||||
</form>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div nhname="reply_list">
|
||||
<% fetch_user_leaveWord_reply(jour).each do |reply|%>
|
||||
<%= render :partial => 'user_jour_reply', :locals => {:reply => reply} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div><!--message_list end-->
|
@ -1,7 +1,40 @@
|
||||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
<%= stylesheet_link_tag 'css', :media => 'all' %>
|
||||
<div class="top_new">
|
||||
<span class="<%= (@user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true)) ? 'top_new_bg' : 'top_newcourses_bg'%> fl"></span>
|
||||
<% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %>
|
||||
<a href="<%= url_for(:controller => 'courses', :action => 'new',) %>" class="green_n_btn fr mt2" target="_blank">新建课程</a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'user_jours',
|
||||
:locals => { :journals => @jour, :state => false}
|
||||
%>
|
||||
<% html_title(l(:label_responses)) -%>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"user" %>
|
||||
<div id="RSide" class="fl">
|
||||
<!--<div class="users_r_top">-->
|
||||
<!--<h2 class="users_r_h2">用户留言</h2>-->
|
||||
<!--</div>-->
|
||||
<div class="message_box mb10">
|
||||
<div nhname='new_message' style="display:none;">
|
||||
<%= form_for('new_form',:url => leave_user_message_path(@user.id),:method => "post") do |f|%>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea' name="new_form[user_message]"></textarea>
|
||||
<p nhname='contentmsg'></p>
|
||||
<div nhname='toolbar_container' style="float:left;padding-top:3px;"></div>
|
||||
<a id="new_message_cancel_btn" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:3px;">取消</a>
|
||||
<a id="new_message_submit_btn" href="javascript:void(0)" class="blue_n_btn fr mr5 " style="margin-top:3px;">留言</a>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="message_list_box " id="user_jour_list">
|
||||
<%if @jour%>
|
||||
<% @jour.each do |jour|%>
|
||||
<%= render :partial => 'user_jours_new', :locals => {:jour => jour} %>
|
||||
<%end%>
|
||||
<% end%>
|
||||
|
||||
<ul class="wlist" style=" border:none;">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--message_box end-->
|
||||
</div>
|
@ -0,0 +1,9 @@
|
||||
class AddResultToTest < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :homework_tests, :result, :integer,default: 0
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :homework_tests,:result
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
class AddErrormsgToTest < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :homework_tests,:error_msg,:text
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :homework_tests,:error_msg
|
||||
end
|
||||
end
|
@ -0,0 +1,261 @@
|
||||
//个人动态
|
||||
$(function(){
|
||||
function init_editor(params){
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 1,minWidth:"1px",width:"100%",height:"80px",
|
||||
items:['emoticons'],
|
||||
afterChange:function(){//按键事件
|
||||
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
||||
},
|
||||
afterCreate:function(){
|
||||
var toolbar = $("div[class='ke-toolbar']",params.div_form);
|
||||
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
|
||||
params.toolbar_container.append(toolbar);
|
||||
}
|
||||
}).loadPlugin('paste');
|
||||
return editor;
|
||||
}
|
||||
|
||||
function nh_check_field(params){
|
||||
var result=true;
|
||||
if(params.content!=undefined){
|
||||
if(params.content.isEmpty()){
|
||||
result=false;
|
||||
}
|
||||
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
||||
params.textarea.html(params.content.html());
|
||||
params.content.sync();
|
||||
if(params.content.isEmpty()){
|
||||
params.contentmsg.html('内容不能为空');
|
||||
params.contentmsg.css({color:'#ff0000'});
|
||||
}else{
|
||||
params.contentmsg.html('填写正确');
|
||||
params.contentmsg.css({color:'#008000'});
|
||||
}
|
||||
params.contentmsg.show();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function init_form(params){
|
||||
params.form.submit(function(){
|
||||
var flag = false;
|
||||
if(params.form.attr('data-remote') != undefined ){
|
||||
flag = true
|
||||
}
|
||||
var is_checked = nh_check_field({
|
||||
issubmit:true,
|
||||
content:params.editor,
|
||||
contentmsg:params.contentmsg,
|
||||
textarea:params.textarea
|
||||
});
|
||||
if(is_checked){
|
||||
if(flag){
|
||||
return true;
|
||||
}else{
|
||||
$(this)[0].submit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function nh_reset_form(params){
|
||||
params.form[0].reset();
|
||||
params.textarea.empty();
|
||||
if(params.editor != undefined){
|
||||
params.editor.html(params.textarea.html());
|
||||
}
|
||||
params.contentmsg.hide();
|
||||
}
|
||||
|
||||
KindEditor.ready(function(K){
|
||||
$("a[nhname='reply_btn']").live('click',function(){
|
||||
var params = {};
|
||||
params.kindutil = K;
|
||||
params.container = $(this).parent().parent('div');
|
||||
params.div_form = $("div[nhname='div_form']",params.container);
|
||||
params.form = $("form",params.div_form);
|
||||
params.textarea = $("textarea[name='user_notes']",params.div_form);
|
||||
params.textarea.prev('div').css("height","60px");
|
||||
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
|
||||
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
|
||||
params.cancel_btn = $("a[nhname='cancel_btn']",params.div_form);
|
||||
params.submit_btn = $("a[nhname='submit_btn']",params.div_form);
|
||||
if(params.textarea.data('init') == undefined){
|
||||
params.editor = init_editor(params);
|
||||
init_form(params);
|
||||
params.cancel_btn.click(function(){
|
||||
nh_reset_form(params);
|
||||
toggleAndSettingWordsVal(params.div_form, params.textarea);
|
||||
});
|
||||
params.submit_btn.click(function(){
|
||||
params.form.submit();
|
||||
});
|
||||
params.textarea.data('init',1);
|
||||
}
|
||||
params.cancel_btn.click();
|
||||
setTimeout(function(){
|
||||
if(!params.div_form.is(':hidden')){
|
||||
params.textarea.show();
|
||||
params.textarea.focus();
|
||||
params.textarea.hide();
|
||||
}
|
||||
},300);
|
||||
});
|
||||
|
||||
$("a[nhname='sub_reply_btn']").live('click',function(){
|
||||
var params = {};
|
||||
params.kindutil = K;
|
||||
params.container = $(this).parent().parent('div');
|
||||
params.div_form = $("div[nhname='sub_div_form']",params.container);
|
||||
params.form = $("form",params.div_form);
|
||||
params.textarea = $("textarea[name='user_notes']",params.div_form);
|
||||
params.textarea.prev('div').css("height","60px");
|
||||
params.contentmsg = $("p[nhname='sub_contentmsg']",params.div_form);
|
||||
params.toolbar_container = $("div[nhname='sub_toolbar_container']",params.div_form);
|
||||
params.cancel_btn = $("a[nhname='sub_cancel_btn']",params.div_form);
|
||||
params.submit_btn = $("a[nhname='sub_submit_btn']",params.div_form);
|
||||
if(params.textarea.data('init') == undefined){
|
||||
params.editor = init_editor(params);
|
||||
init_form(params);
|
||||
params.cancel_btn.click(function(){
|
||||
nh_reset_form(params);
|
||||
toggleAndSettingWordsVal(params.div_form, params.textarea);
|
||||
});
|
||||
params.submit_btn.click(function(){
|
||||
params.form.submit();
|
||||
});
|
||||
params.textarea.data('init',1);
|
||||
}
|
||||
params.cancel_btn.click();
|
||||
setTimeout(function(){
|
||||
if(!params.div_form.is(':hidden')){
|
||||
params.textarea.show();
|
||||
params.textarea.focus();
|
||||
params.textarea.hide();
|
||||
}
|
||||
},300);
|
||||
});
|
||||
|
||||
$("div[nhname='new_message']").each(function(){
|
||||
var params = {};
|
||||
params.kindutil = K;
|
||||
params.div_form = $(this);
|
||||
params.form = $("form",params.div_form);
|
||||
if(params.form==undefined || params.form.length==0){
|
||||
return;
|
||||
}
|
||||
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
|
||||
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
|
||||
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
|
||||
params.cancel_btn = $("#new_message_cancel_btn");
|
||||
params.submit_btn = $("#new_message_submit_btn");
|
||||
|
||||
if(params.textarea.data('init') == undefined){
|
||||
params.editor = init_editor(params);
|
||||
init_form(params);
|
||||
params.cancel_btn.click(function(){
|
||||
nh_reset_form(params);
|
||||
});
|
||||
params.submit_btn.click(function(){
|
||||
params.form.submit();
|
||||
});
|
||||
params.textarea.data('init',1);
|
||||
$(this).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
function init_list_more_div(params){
|
||||
var p=params;
|
||||
p.exbtn.click(function(){
|
||||
var isclose = p.container.data('isclose');
|
||||
var hasmore = p.container.data('hasmore');
|
||||
if(isclose == '1'){
|
||||
$("div[nhname='rec']",p.container).show();
|
||||
p.container.data('isclose','0');
|
||||
change_status_4_list_more_div(params);
|
||||
return;
|
||||
}
|
||||
if(hasmore == '0'){
|
||||
change_status_4_list_more_div(params,'get');
|
||||
return;
|
||||
}
|
||||
var url = p.container.data('url');
|
||||
if($("div[nhname='rec']",p.container).length > 0){
|
||||
var lastid = $("div[nhname='rec']",p.container).filter(':last').data('id');
|
||||
url += "?lastid="+lastid;
|
||||
var lasttime = $("div[nhname='rec']",p.container).filter(':last').data('time');
|
||||
if(lasttime != undefined){
|
||||
url += "&lasttime="+lasttime;
|
||||
}
|
||||
}
|
||||
$.ajax( {url:url,dataType:'text',success:function(data){
|
||||
var html = $("<div>"+data+"</div>");
|
||||
var lens = $("div[nhname='rec']",html).length;
|
||||
if(lens < p.size){
|
||||
p.container.data('hasmore','0');
|
||||
}
|
||||
if(lens>0){
|
||||
var currpage = parseInt(p.container.data('currpage'))+1;
|
||||
p.container.data('currpage',currpage);
|
||||
p.container.append(html.html())
|
||||
}
|
||||
change_status_4_list_more_div(params,'get');
|
||||
p.div.show();
|
||||
}} );
|
||||
});
|
||||
p.clbtn.click(function(){
|
||||
var i=0;
|
||||
$("div[nhname='rec']",p.container).each(function(){
|
||||
i++;
|
||||
if(i> p.size){
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
p.container.data('isclose','1');
|
||||
change_status_4_list_more_div(params);
|
||||
});
|
||||
p.exbtn.click();
|
||||
}
|
||||
function change_status_4_list_more_div(params,opt){
|
||||
var p=params;
|
||||
if($("div[nhname='rec']",p.container).length == 0 && opt != 'get'){
|
||||
p.exbtn.click();
|
||||
return;
|
||||
}
|
||||
var show_lens = $("div[nhname='rec']",p.container).length - $("div[nhname='rec']",p.container).filter(':hidden').length;
|
||||
if( show_lens > p.size ){
|
||||
p.clbtn.show();
|
||||
}else{
|
||||
p.clbtn.hide();
|
||||
}
|
||||
if($("div[nhname='rec']",p.container).length == 0){
|
||||
p.exbtn.html(p.nodatamsg);
|
||||
}else if( p.container.data('hasmore') == '1' || p.container.data('isclose')=='1' ){
|
||||
p.exbtn.html('点击展开更多');
|
||||
}else{
|
||||
p.exbtn.html('没有更多了');
|
||||
}
|
||||
}
|
||||
function init_list_more_div_params(div){
|
||||
var params = {};
|
||||
params.div = div;
|
||||
params.container = $("div[nhname='container']",div);
|
||||
params.exbtn = $("a[nhname='expand']",div);
|
||||
params.clbtn = $("a[nhname='close']",div);
|
||||
params.size = params.container.data('pagesize');
|
||||
params.nodatamsg = params.container.data('nodatamsg');
|
||||
if( params.size == undefined ){
|
||||
params.size = 13;
|
||||
}
|
||||
return params;
|
||||
}
|
||||
$(function(){
|
||||
$("div[nhname='list_more_div']").each(function(){
|
||||
var params = init_list_more_div_params($(this));
|
||||
init_list_more_div(params)
|
||||
});
|
||||
});
|
||||
//个人动态 end
|
Loading…
Reference in new issue