commit
782f7b074e
@ -0,0 +1,50 @@
|
||||
<h3 style="float: left">
|
||||
<%=l(:label_school_plural)%>
|
||||
</h3>
|
||||
<%= form_tag({:controller => 'admin', :action => 'schools' }, :method => :get,:id=>"search_course_form") do %>
|
||||
<%= submit_tag "搜索",:style => "float: right;margin-right: 15px;"%>
|
||||
<input style="float: right;margin-right: 10px;" id="v_subject" placeholder="学校名称" type="text" name="school_name" value="<%= @school_name%>">
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="autoscroll" style="margin-top: 40px;">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 100px;">
|
||||
LOGO
|
||||
</th>
|
||||
<th>
|
||||
学校名称
|
||||
</th>
|
||||
<th style="width: 100px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @schools.each do |school|%>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align:center;vertical-align: middle;">
|
||||
<%= school.id %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= image_tag(school.logo_link,width:40,height:40) %>
|
||||
</td>
|
||||
<td style="text-align:center;vertical-align: middle;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=school.name%>'>
|
||||
<span>
|
||||
<%= link_to school.name,"http://#{Setting.host_course}/?school_id=#{school.id}" %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="buttons" style="vertical-align: middle;">
|
||||
<%= link_to("修改", upload_logo_school_path(school.id,:school_name => @school_name), :class => 'icon icon-copy') %>
|
||||
<%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_project_plural)) -%>
|
@ -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,8 +1,11 @@
|
||||
<% if(User.current.logged? && User.current!=target)%>
|
||||
<% if User.current.logged?%>
|
||||
<% if User.current == target%>
|
||||
<a href="<%= url_for(:controller => 'my', :action => 'account') %>" class="fr gz_btn mr10 ">编辑资料</a>
|
||||
<%else%>
|
||||
<%if(target.watched_by?(User.current))%>
|
||||
<a id="user_watch_id" href="<%= watch_path(:object_type=>
|
||||
'user',:object_id=>target.id,:target_id=>target.id) %>" class="fr qx_btn mr10" data-method="delete" data-remote="true" title="取消关注">取消关注</a>
|
||||
<a id="user_watch_id" href="<%= watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id) %>" class="fr qx_btn mr10" data-method="delete" data-remote="true" title="取消关注">取消关注</a>
|
||||
<% else %>
|
||||
<a id="user_watch_id" href="<%= watch_path(:object_type=>'user',:object_id=>target.id,:target_id=>target.id) %>" class="fr gz_btn mr10" data-method="post" data-remote="true" title="添加关注">关注</a>
|
||||
<a id="user_watch_id" href="<%= watch_path(:object_type=>'user',:object_id=>target.id,:target_id=>target.id) %>" class="fr gz_btn mr10" data-method="post" data-remote="true" title="添加关注">添加关注</a>
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% end %>
|
@ -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})%>');
|
@ -1,25 +1,30 @@
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_statistics) %></h2>
|
||||
</div>
|
||||
<div class="riviseRed fl"></div><div class="fl">修订 是版本库的提交次数, 显示为橘红色。</div><br>
|
||||
<div class="changeBlue fl"></div><div class="fl">变更 是对版本库中文件的修改次数, 显示为蓝色。</div>
|
||||
<p style="padding-top:35px;">
|
||||
<% if @status_commit_count ==0 %>
|
||||
<div class="flash notice">该项目目前还没有提交过代码!</div>
|
||||
<% else %>
|
||||
<div class="riviseRed fl"></div><div class="fl">修订 是版本库的提交次数, 显示为橘红色。</div><br>
|
||||
<div class="changeBlue fl"></div><div class="fl">变更 是对版本库中文件的修改次数, 显示为蓝色。</div>
|
||||
|
||||
<p style="padding-top:35px;">
|
||||
<%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %>
|
||||
</p>
|
||||
<p style="padding-top: 50px;">
|
||||
</p>
|
||||
<p style="padding-top: 50px;">
|
||||
<%# 用户每月提交代码次数 %>
|
||||
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %>
|
||||
</p>
|
||||
<p style="padding-top: 50px;">
|
||||
</p>
|
||||
<p style="padding-top: 50px;">
|
||||
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %>
|
||||
</p>
|
||||
<p style="padding-top: 50px;">
|
||||
</p>
|
||||
<p style="padding-top: 50px;">
|
||||
<%# 用户最近六个月的提交次数 %>
|
||||
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %>
|
||||
</p>
|
||||
<p style="padding-top: 50px;">
|
||||
</p>
|
||||
<p style="padding-top: 50px;">
|
||||
<%# 用户最近六个月的代码量 %>
|
||||
<%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %>
|
||||
</p>
|
||||
<p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
|
||||
<% html_title(l(:label_repository), l(:label_statistics)) -%>
|
||||
</p>
|
||||
<p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
|
||||
<% html_title(l(:label_repository), l(:label_statistics)) -%>
|
||||
<% end %>
|
@ -1,5 +1,28 @@
|
||||
<%= form_tag({action: :upload},method: "post", multipart: true) do %>
|
||||
<%= text_field_tag 'school'%>
|
||||
<%= file_field_tag 'logo' %>
|
||||
<%= submit_tag('Upload') %>
|
||||
<script>
|
||||
function showPreview(source) {
|
||||
var file = source.files[0];
|
||||
if(window.FileReader) {
|
||||
var fr = new FileReader();
|
||||
fr.onloadend = function(e) {
|
||||
document.getElementById("avatar_image").src = e.target.result;
|
||||
};
|
||||
fr.readAsDataURL(file);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<%= form_tag(upload_school_path(@school.id),method: "post", multipart: true) do %>
|
||||
<%#= text_field_tag 'school'%>
|
||||
<div style="margin: 20px;">
|
||||
<input type="hidden" value="<%= @school_name%>" name="school_name">
|
||||
<%= image_tag(@school.logo_link, id: "avatar_image", :class=>"school_avatar")%>
|
||||
<a type="button" onclick="$('#file').click();" style="margin: 90px 0 0 10px;float: left;padding: 2px 5px;border: 1px solid #eaeaea;cursor: pointer;text-decoration: none;width: 55px;">上传图片</a>
|
||||
<%= file_field_tag 'logo',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%>
|
||||
<div style="clear: both;"></div>
|
||||
<div style="margin-top: 10px;">
|
||||
<%= submit_tag('上传') %>
|
||||
<%= submit_tag('取消') %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
@ -1,15 +1,6 @@
|
||||
<div id="tags_show">
|
||||
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
|
||||
<div id="tags">
|
||||
<div id="tags_show">
|
||||
<%= render :partial => "tags/tag_project_new_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
|
||||
</div>
|
||||
</div>
|
||||
<% if User.current.logged?%>
|
||||
<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag01').slideToggle();"><%= l(:label_add_tag)%></a>
|
||||
<span id="add_tag01" style="display:none; vertical-align: middle;" class="ml10 f_l">
|
||||
<%= form_for "tag_for_save",:remote=>true,:url=>save_tag_path,:update => "tags_show",:complete => '$("#put-tag-form").slideUp();' do |f| %>
|
||||
<%= f.text_field :name ,:id => "tags_name",:size=>"20",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:class =>"isTxt w90 f_l" %>
|
||||
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||
<input type="button" class="submit f_l" onclick="$('#tags_name').parent().submit();" />
|
||||
<% end %>
|
||||
</span>
|
||||
<% end%>
|
||||
|
||||
|
@ -0,0 +1,30 @@
|
||||
<% @tags = obj.reload.tag_list %>
|
||||
<% if non_list_all && @tags.size > 0 %>
|
||||
|
||||
<% else %>
|
||||
<!-- 用来显示三大对象的主页中的tag 故是全部显示 -->
|
||||
<% if @tags.size > 0 %>
|
||||
<% @tags.each do |tag| %>
|
||||
<span class="re_tag f_l " id="tag">
|
||||
<%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %>
|
||||
<span class="del">
|
||||
<%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %>
|
||||
</span>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.logged?%>
|
||||
<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag02').slideToggle();"><%= l(:label_add_tag)%></a>
|
||||
<span id="add_tag02" style="display:none; vertical-align: middle;" class="ml10 f_l">
|
||||
<%= form_for "tag_for_save",:remote => true,:url=>save_tag_path,:update => "tags_show",:complete => '$("#put-tag-form").slideUp();' do |f| %>
|
||||
<%= f.text_field :name ,:id => "tags_name2",:size=>"20",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:class =>"isTxt w90 f_l" %>
|
||||
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||
<input type="button" class="submit f_l" onclick="$('#tags_name2').parent().submit();" />
|
||||
<% end %>
|
||||
</span>
|
||||
<% end%>
|
||||
|
||||
|
@ -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