Merge branch 'develop' into dev_cs

This commit is contained in:
caishi 2017-10-09 09:16:38 +08:00
commit f16fed72fc
27 changed files with 277 additions and 69 deletions

View File

@ -147,7 +147,8 @@ class ForumsController < ApplicationController
reorder(order).
preload(:author, {:last_reply => :author}).
all
@forums = Forum.find_by_sql("SELECT *,topic_count + memo_count tm FROM `forums` order by tm desc;")
#@forums = Forum.find_by_sql("SELECT *,topic_count + memo_count tm FROM `forums` order by tm desc;")
@my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count
@my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count
@errors = params[:errors]

View File

@ -22,6 +22,7 @@ class GamesController < ApplicationController
myshixun_user_login = User.where(:id => @myshixun.user_id).first.try(:login)
myshixun_rep_identifier = Repository.where(:myshixun_id => @myshixun.id, :type => "Repository::Gitlab").first.try(:identifier)
gitlab_address = Redmine::Configuration['gitlab_address']
myshixun_domain = Redmine::Configuration['myshixun_domain']
gitlab_myshixun_url = git_myshixun_url(@myshixun, @myshixun.try(:user_id))
shixun = @myshixun.shixun
gitlab_shixun_url = git_shixun_url(shixun, (shixun.try(:fork_from).blank? ? "educoder" : "eduforge"))
@ -33,7 +34,7 @@ class GamesController < ApplicationController
script = "cd #{path}
git clone #{gitlab_address.to_s+'/'+myshixun_user_login+'/'+ myshixun_rep_identifier}.git
cd #{myshixun_rep_identifier}/
git remote set-url origin https://#{shixun.fork_from.blank? ? "educoder" : "eduforge"}:xinhu1ji2qu3@testbdgit.trustie.net/#{myshixun_user_login}/#{myshixun_rep_identifier}.git
git remote set-url origin https://#{shixun.fork_from.blank? ? "educoder" : "eduforge"}:xinhu1ji2qu3@#{myshixun_domain}/#{myshixun_user_login}/#{myshixun_rep_identifier}.git
git remote add remote_origin #{gitlab_shixun_url}
#git pull
git pull remote_origin master

View File

@ -1532,7 +1532,7 @@ end
@sub_type = 5
@type = trial_authorization_status params[:type]
# sql = select * from apply_actions where dealer_id is null
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type,:dealer_id =>'').order("created_at desc")
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type).order("created_at desc")
search = params[:search]
unless search.blank?
@authorizations = @authorizations.where(:container_id => Shixun.where(:id => @authorizations.map(&:container_id)).where("name like '%#{search}%'").map(&:id)).order("created_at desc")

View File

@ -165,10 +165,9 @@ class MemosController < ApplicationController
@flag = false
respond_to do |format|
if( #@memo.update_column(:subject, params[:memo][:subject]) &&
@memo.update_column(:content, params[:memo][:content]) &&
@memo.update_column(:sticky, params[:memo][:sticky]) &&
@memo.update_column(:lock, params[:memo][:lock]) &&
if( @memo.update_column(:content, params[:memo][:content]) &&
@memo.update_column(:sticky, params[:memo][:sticky].to_i) &&
@memo.update_column(:lock, params[:memo][:lock].to_i) &&
@memo.update_column(:subject,params[:memo][:subject]) &&
@memo.update_column(:updated_at,Time.now))
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))

View File

@ -140,7 +140,7 @@ class ShixunsController < ApplicationController
@content = params[:content]
code_file = g.edit_file(@shixun.gpid, :content => params[:content], :file_path => @path, :branch_name => @rev, :commit_message => "shixun entry")
# if @shixun.try(:status).to_i < 2
shixun_modify_status_without_publish(@shixun, 1)
# shixun_modify_status_without_publish(@shixun, 1)
# end
respond_to do |format|
format.js

View File

@ -326,6 +326,11 @@ class UsersController < ApplicationController
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@type = 'Memo'
when 'Challenge'
@reply = Discuss.find params[:reply_id]
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@type = 'Challenge'
end
respond_to do |format|
format.js
@ -452,6 +457,20 @@ class UsersController < ApplicationController
comment.subject = "#{@root.subject}"
comment.root_id = reply.root_id
reply.children << comment
when 'Challenge'
@game_challenge = Challenge.where(:id => reply.challenge_id).first
@root = reply.root
comment = Discuss.new
comment.user_id = User.current.id
comment.content = params[:reply_message]
comment.root_id = reply.root_id
comment.challenge_id = reply.challenge_id
comment.dis_type = "Shixun"
comment.dis_id = @game_challenge.shixun.try(:id)
comment.praise_count = 0
reply.children << comment
@discusses = @game_challenge.shixun.discusses.reorder("created_at desc")
@discusses_count = @discusses.count
end
update_course_activity(@root.class.to_s,@root.id)
update_user_activity(@root.class.to_s,@root.id)

View File

@ -2099,7 +2099,7 @@ module ApplicationHelper
elsif @organization
title << (@organization.name.nil? ? "创新源于实践" : @organization.name)
elsif @forum || params[:controller] == "forums"
title << "问吧"
title << "论坛"
elsif @my_syllabuses
title << "我的课堂"
elsif @user
@ -4550,6 +4550,8 @@ def get_reply_by_type type, reply_id
reply = JournalsForMessage.find reply_id
when 'Memo'
reply = Memo.find reply_id
when 'Challenge'
reply = Discuss.find reply_id
end
reply
end

View File

@ -7,4 +7,12 @@ class Discuss < ActiveRecord::Base
acts_as_tree :foreign_key => 'parent_id'
belongs_to :dis, :polymorphic => true
validates_presence_of :dis, :user, :content
def creator_user
User.find(self.user_id)
end
def content_detail
self.content
end
end

View File

@ -17,7 +17,8 @@
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20">
<p class="ml15 fl color-grey3">
<% unless @exercise.is_public %>
<i id="exercise_public_icon_<%= @exercise.id %>" class="fa fa-lock color-grey fl mt8 mr15 font-18"></i> <% end %>
<i id="exercise_public_icon_<%= @exercise.id %>" class="fa fa-lock color-grey fl mt8 mr15 font-18"></i>
<% end %>
<span><%= @exercise.exercise_name %></span>
</p>
<%= link_to "返回", exercise_index_path(:course_id => @course.id), :class => "fr font-12 mr15 mt3 color-grey" %>
@ -42,8 +43,9 @@
<%= link_to "导出成绩", student_exercise_list_exercise_path(@exercise, :course_id => @course.id, :format => 'xls'), :id => "export_exercise_work", :class => "fr white-btn orange-btn ml10 mt8" %>
<div class="edu-find fr mr40 with20 pr">
<div class="edu-find-input">
<input type="text" class="task-form-100 panel-box-sizing" maxlength="20" placeholder="姓名、学号关键字检索" value="<%= @name %>" id="student_user_name">
<i class="fa fa-close mr5 color-grey edu-close" onclick="clear_searchbox();"></i>
<input type="text" class="with100 panel-box-sizing" maxlength="20" placeholder="姓名、学号关键字检索" value="<%= @name %>" id="student_user_name">
<!--<i class="fa fa-close mr5 color-grey edu-close" onclick="colse_searchbox();"></i>-->
<span class="edu-close" onclick="clear_searchbox();" data-tip-down="关闭">×</span>
</div>
<a href="javascript:void(0);" onclick="SearchByName_ex();" class="edu-open font-16 color-grey "><i class="fa fa-search"></i></a>
</div>

View File

@ -41,7 +41,7 @@
<span class="btn-top btn-cir-red mt7 ml5 fl">顶</span>
<% end %>
</p>
<p style="width: 1091px;" class="overellipsis color-dark-grey mb10"><%= memo.content.html_safe %></p>
<div style="width: 1091px; height: 30px;" class="overellipsis color-dark-grey mb10"><%= memo.content.html_safe %></div>
<div class="clearfix">
<a href="<%= user_path(memo.author_id) %>" class="fl"><%= User.find(memo.author_id).try(:show_name) %></a>
<span class="fl ml30"><%= time_from_now memo.updated_at %></span>
@ -86,6 +86,12 @@
</div>
</div>
<% if false %>
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>

View File

@ -81,7 +81,7 @@
<div class="-layout-h -padding-h-16 -horizontal -footer-left" id="bottom_points" style = "position:relative;">
<ul class="-task-ml80 -layout" style="overflow:hidden;align-items:flex-end;flex-wrap:wrap;">
<%= render :partial => "games/shixun_comment_block" %>
<li class="fl mt10 ml20 " style="width:54px;margin-bottom:10px;"><a href="javascript:void(0);" onclick="send_dis_to_shixun()" class="course-bth-blue color_white">发送</a></li>
<li class="fl mt10 ml20 " style="width:54px;margin-bottom:10px;"><a href="javascript:void(0);" onclick="send_dis_to_shixun()" class="course-bth-blue color_white">发送</a></li>
<li class="fl ml20 mt15" style="width:85px;margin-bottom:10px;">
<span data-tip-left="<%= @praise.nil? ? "点赞" : "取消点赞" %>" onclick="game_praise('<%= @game_challenge.id %>', '<%= @game_challenge.class %>')" id="game_praise_tread" class="pt5 color-grey mr20">
<i class="fa fa-thumbs-up font-20 mr3 <%= @praise.nil? ? "" : "color-light-green" %>" alt="赞" ></i><span class="font-12 font-bd" id="game_praise_count"><%= @praise_count %></span>

View File

@ -52,7 +52,7 @@
<% gold_score = @myshixun.shixun.status <= 1 ? 0 : (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) %>
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_exp_<%=challenge.id %>">经验值<span class="color-light-green ml5">+<%= final_score %></span></span>
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_grade_<%=challenge.id %>">金币<span class="<%= gold_score < 0 ? "u-color-light-red" : "color-light-green" %> ml5"><%= gold_score < 0 ? gold_score : "+"+gold_score.to_s %></span></span>
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_tag_<%=challenge.id %>">技能标签<span class="<%= (game.answer_open? || @myshixun.shixun.status <= 1) ? "color-grey" : "color-light-green" %> ml5"><%= (game.answer_open? || @myshixun.shixun.status <= 1) ? "无" : "+"+challenge.challenge_tags.count.to_s %></span></span>
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_tag_<%=challenge.id %>">技能标签<span class="<%= (game.answer_open? || @myshixun.shixun.status <= 1 || challenge.challenge_tags.count ==0 ) ? "color-grey" : "color-light-green" %> ml5"><%= (game.answer_open? || @myshixun.shixun.status <= 1 || challenge.challenge_tags.count ==0 ) ? "无" : "+"+challenge.challenge_tags.count.to_s %></span></span>
<% end %>
</div>
</div>

View File

@ -1,43 +1,43 @@
<li class="comment-input fl" id="shixun_comment_block">
<%= form_for('', :url => {:controller => 'discusses', :action => 'create', :dis_id => @shixun.id, :dis_type => "Shixun", :challenge_id => @game_challenge.try(:id)}, :method => "post", :remote => true, :html => {:id => 'new_comment_form'}) do |f| %>
<textarea id="comment_news" name="content" placeholder="我想说点什么~" MultiLine = True ScrollBars = 2 type="text"></textarea>
<input type="hidden" id="dis_reply_id" name="reply_id" value="">
<textarea id="comment_news" name="content" placeholder="我想说点什么~" MultiLine = True ScrollBars = 2 type="text"></textarea>
<input type="hidden" id="dis_reply_id" name="reply_id" value="">
<% end %>
</li>
<script>
$(function(){
autoTextarea(document.getElementById("comment_news"),0,150);
});
var click = true;
function send_dis_to_shixun(){
if($("#comment_news").val() == ""){
return
} else{
if(click){
click = false;
$("#new_comment_form").submit();
$(function(){
autoTextarea(document.getElementById("comment_news"),0,150);
});
var click = true;
function send_dis_to_shixun(){
if($("#comment_news").val() == ""){
return
} else{
if(click){
click = false;
$("#new_comment_form").submit();
return
}
}
}
}
$(".comment-input").on("keydown", "input[name='content']", function(event){
var target, code, tag;
if (!event) {
event = window.event; //针对ie浏览器
code = event.keyCode;
}
else {
code = event.keyCode;
}
if(code == 13) {
send_dis_to_shixun();
return false;
}
});
$("#comment_news").on('blur', function(){
$("#comment_news").attr("placeholder", "我想说点什么~");
$("#dis_reply_id").val();
});
$(".comment-input").on("keydown", "input[name='content']", function(event){
var target, code, tag;
if (!event) {
event = window.event; //针对ie浏览器
code = event.keyCode;
}
else {
code = event.keyCode;
}
if(code == 13) {
send_dis_to_shixun();
return false;
}
});
$("#comment_news").on('blur', function(){
$("#comment_news").attr("placeholder", "我想说点什么~");
$("#dis_reply_id").val();
});
</script>

View File

@ -13,7 +13,7 @@
<%= link_to dis.user.show_name, user_path(dis.user), :class => "fl link-color-grey mr20" ,:style => "display: block" %>
<span class="fl color-grey font-12 mt3 mr20"><%= time_from_now dis.created_at %></span>
<% if dis.try(:challenge_id).present? %>
<span class="fl color-light-green font-12 mt3">[第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关]</span>
<span class="fl color-light-green font-12 mt3">[第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关]</span>
<% end %>
<span class="fr color-grey font-12 color_Purple_grey" id="dis_praise_<%= dis.id %>">
<%= render :partial => "discusses/dis_praise", :locals => {:discuss => dis} %>
@ -78,17 +78,16 @@
<script>
//二次回复的提示结构
var $points = $("<div class = \"points-data-tip-top\">"+
"<div class = \"data-tip-top1 \">请在此输入回复</div>"+
"</div>").appendTo("#bottom_points");
//二次回复的提示结构
var $points = $("<div class = \"points-data-tip-top\">"+
"<div class = \"data-tip-top1 \">请在此输入回复</div>"+
"</div>").appendTo("#bottom_points");
$("#reversion").click(function(){
$points.show();
});
$("#comment_news").bind("input propertychange",function(){
console.log(1);
if($("#comment_news").val() != ''){
$points.hide();
}
if($("#comment_news").val() != ''){
$points.hide();
}
});
</script>

View File

@ -18,7 +18,7 @@
<li><%= link_to "全部实训", shixuns_path, :class => "new-nav-a font-16" %></li>
<li><%= link_to "实训路径", subjects_path, :class => "new-nav-a font-16" %></li>
<li><%= link_to "在线课堂", courses_path, :class => "new-nav-a font-16" %></li>
<!-- <li><%#= link_to "论", forums_path, :class => "new-nav-a font-16" %></li>-->
<li><%= link_to "论", forums_path, :class => "new-nav-a font-16" %></li>
<!-- <li><%#= link_to "论坛", forums_path, :class =>"new-nav-a", :target => "_blank" %></li>-->
<!-- <li><%#= link_to "帮助中心", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "new-nav-a", :target=>"_blank" %></li>-->

View File

@ -1,7 +1,7 @@
<div class="orig_cont clearfix">
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
<div>
<%= render :partial => 'student_work/homework_reply', :locals => {:comment => comment.parent, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %>
<%= render :partial => 'messages/message_reply', :locals => {:comment => comment.parent, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %>
</div>
<% end %>
<%= render :partial => 'student_work/homework_reply_detail', :locals => {:comment => comment, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %>

View File

@ -1,6 +1,6 @@
<div class="<%= User.current.logged? ? 'orig_reply_box' : 'orig_reply_box2' %> borderBottomNone" id="reply_to_message_<%= reply.id%>">
<% if User.current.logged? %>
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="homepagePostReplyPortrait mr15 imageFuzzy fl" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="orig_textarea mb10 fl">
<div nhname='new_message_<%= reply.id%>'>
<% if @type == 'Message' %>

View File

@ -6,7 +6,7 @@
</div>
<div class="task_popup_con">
<div class="newupload_conbox clearfix">
<ul style = "height:200px;overflow-y:hidden;background:#f5f5f5; padding:10px;">
<ul style = "height:200px;overflow-y:auto;background:#f5f5f5; padding:10px;">
<% if @path.present? %>
<a class="f14 fb" href="<%= search_file_list_shixun_path(@shixun) %>" data-remote="true">根目录/</a>
<%

View File

@ -90,6 +90,10 @@
<input type="radio" class="undis" name="language" id="language_Dynamips" value="Dynamips">
<label for="language_Dynamips">Dynamips</label>
</li>
<li class="fl">
<input type="radio" class="undis" name="language" id="language_verilog" value="verilog">
<label for="language_verilog">verilog</label>
</li>
</ul>
</div>
</div>
@ -98,7 +102,7 @@
<div class="fl" style="margin-top:7px">
<li class="edu-dropdown fl ml15 mr5" id="first_select" style="width: 70px">
<a href="javascript:void(0);" class="edu-dropdown-toggle color-grey3" id="all_status">所有状态<i class="fa fa-caret-down ml5"></i></a>
<ul class="edu-dropdown-menu color" id="all_status_list" style="display: none;">
<ul class="edu-dropdown-menu" id="all_status_list" style="display: none;">
<li>
<input type="radio" class="undis" name="shixun_status" id="status_0" value="0">
<label for="status_0">所有状态</label>
@ -119,7 +123,7 @@
</li>
<li class="edu-dropdown fl ml15 mr5" id="thirdly_select" style="width: 70px">
<a href="javascript:void(0);" class="edu-dropdown-toggle color-grey3" id="all_languge">所有难度<i class="fa fa-caret-down ml5"></i></a>
<ul class="edu-dropdown-menu color" id="all_trainee_list" style="display: none;">
<ul class="edu-dropdown-menu" id="all_trainee_list" style="display: none;">
<li>
<input type="radio" class="undis" name="trainee" id="trainee_0" value="">
<label for="trainee_0">所有难度</label>
@ -144,7 +148,7 @@
</li>
<li class="edu-dropdown fl ml15 mr5" id="second_select">
<a href="javascript:void(0);" class="edu-dropdown-toggle color-grey3" id="all_progress">所有进展<i class="fa fa-caret-down ml5"></i></a>
<ul class="edu-dropdown-menu color" id="all_progress_list" style="display: none;">
<ul class="edu-dropdown-menu" id="all_progress_list" style="display: none;">
<li>
<input type="radio" class="undis" name="status" id="progress_1" value="1">
<label for="progress_1">所有进展</label>

View File

@ -7,8 +7,8 @@
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<div class="" onmouseout="$(this).find('.reply-right').hide();" onmouseover="$(this).find('.reply-right').show();">
<div class="orig_right fl" style="width: 90%">
<div class="with90 fl" onmouseout="$(this).find('.reply-right').hide();" onmouseover="$(this).find('.reply-right').show();">
<div class="orig_right" style="width: 96%">
<div class="orig_content clearfix" id="reply_content_<%= comment.id %>">
<%= comment.content_detail.html_safe %>
</div>

View File

@ -1,6 +1,6 @@
<div class="<%= User.current.logged? ? 'orig_reply_box' : 'orig_reply_box2' %> borderBottomNone reply_to_message" id="reply_to_message_<%= reply.id%>">
<% if User.current.logged? %>
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="homepagePostReplyPortrait mr15 imageFuzzy fl" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="orig_textarea mb10 fl">
<div nhname='new_message_<%= reply.id%>'>
<% if @type == 'HomeworkCommon' %>
@ -109,7 +109,15 @@
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
<% end %>
<% else @type == 'Memo' %>
<%= form_for('discuss', :url => {:controller => 'discusses', :action => 'create', :dis_id => reply.dis_id, :dis_type => "Shixun", :challenge_id => reply.try(:challenge_id)}, :method => "post", :remote => true, :html => {:id => 'new_comment_form'}) do |f| %>
<input type="hidden" id="dis_reply_id" name="reply_id" value="<%= reply.id %>">
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id %>' name="content"></textarea>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="mt10 task-btn task-btn-blue fr">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%> <% end %>
</div>
<div class="cl"></div>
</div>

View File

@ -1,6 +1,6 @@
<div class="<%= User.current.logged? ? 'orig_reply_box' : 'orig_reply_box2' %> borderBottomNone mt10" id="reply_to_message_<%= reply.id%>">
<% if User.current.logged? %>
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="homepagePostReplyPortrait mr15 imageFuzzy fl" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="orig_textarea mb10 fl">
<div nhname='new_message_<%= reply.id%>'>
<%= form_for('new_form',:url => {:controller => 'users', :action => 'reply_detail', :reply_id => reply.id, :type => @type, :is_project => @is_project, :user_activity_id => @user_activity_id},:method => "post", :remote => true) do |f| %>

View File

@ -54,5 +54,17 @@ $("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(re
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'syllabuses/syllabus_post_reply', :locals => {:activity => @root, :user_activity_id => @user_activity_id}) %>");
<% elsif @type == 'Memo' %>
window.location.href = "<%=forum_memo_path(@root.forum_id, @root) %>";
<% elsif @type == 'Challenge' %>
$(".-tab-nav li").removeClass("tab_hover");
$('#tab_nav_4').addClass("tab_hover");
$(".tab-info").hide();
$('#tab_con_4').show().html("<%= j(render :partial => "games/shixun_comment_list") %>");
<% if @discusses_count > 0 %>
$("#discusses_count").html("<%= @discusses_count %>");
<% end %>
<% end %>
<% if @discusses_count > 0 %>
$("#discusses_count").html("<%= @discusses_count %>");
//window.location.href = "<%#= myshixun_game_path(@challenge.current_user_game, :myshixun_id => @challenge.current_user_game.try(:myshixun)) %>";
<% end %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");

View File

@ -757,6 +757,8 @@ RedmineApp::Application.routes.draw do
end
member do
get "change_sticky"
post "reply"
match "message_replies", :via => [:get, :post]
end
end
end

View File

@ -0,0 +1,11 @@
class ModifyStickyForMemos < ActiveRecord::Migration
def up
memos = Memo.where(:sticky => nil)
if memos.present?
memos.update_all(:sticky => 0)
end
end
def down
end
end

View File

@ -92,6 +92,96 @@ function sd_create_editor(params){
return editor;
}
function sd_create_shixun_editor(params){
// var minHeight; //最小高度
var paramsHeight = params.height; //设定的高度
var id = arguments[1] ? arguments[1] : undefined;
var type = arguments[2] ? arguments[2] : '';
var paramsWidth = params.width == undefined ? "100%" : params.width;
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"94%",
height:"33px",// == undefined ? "30px":paramsHeight+"px",
minHeight:"33px",// == undefined ? "30px":paramsHeight+"px",
width:params.width,
/*
items:['emoticons','fontname',
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
'formatblock', 'fontsize', '|','indent', 'outdent',
'|','imagedirectupload','more'],*/
items : ['imagedirectupload'],
afterChange:function(){//按键事件
var edit = this.edit;
var body = edit.doc.body;
//edit.iframe.height(paramsHeight);
//this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight+7)) , 15));
},
afterBlur:function(){
//params.toolbar_container.hide();
params.textarea.blur();
sd_check_editor_form_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
if(this.isEmpty()) {
this.edit.html("<span id='hint' style='color:#999999;font-size:12px;'>我要回复</span>");
}
//params.toolbar_container.hide();
$('#reply_image_' + id).addClass('imageFuzzy');
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){
params.submit_btn.hide();
params.toolbar_container.hide();
this.resize("100%", "30px");
}else if(this.edit.html().trim() != ""){
params.submit_btn.show();
params.toolbar_container.show();
}
//params.submit_btn.css("display","none");
$("#dis_reply_id").val("");
},
afterFocus: function(){
var edit = this.edit;
var body = edit.doc.body;
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(edit.html())){
edit.html("");
}
params.submit_btn.show();
params.contentmsg.hide();
params.toolbar_container.show();
// params.toolbar_container.show();
$('#reply_image_' + id).removeClass('imageFuzzy');
//edit.iframe.width(paramsWidth);
console.log(this);
this.resize("100%", "150px");
this.resize(paramsWidth, "150px");
//params.submit_btn.show();
},
afterCreate:function(){
//params.submit_btn.hide();
var toolbar = $("div[class='ke-toolbar']",params.div_form);
toolbar.css('display','inline');
toolbar.css('padding',0);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar);
params.toolbar_container.hide();
params.submit_btn.hide();
//init
var edit = this.edit;
var body = edit.doc.body;
edit.iframe[0].scroll = 'no';
body.style.overflowY = 'hidden';
//reset height
paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight;
edit.iframe.height(paramsHeight);
edit.html("<span id='hint' style='color:#999999;font-size:12px;'>我要回复</span>");
this.resize(null,paramsHeight);// Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ paramsHeight , paramsHeight)
// params.toolbar_container.hide();
if(typeof enableAt === 'function'){
enableAt(this, id, type);
}
}
}).loadPlugin('paste');
return editor;
}
function sd_check_editor_form_field(params){
var result=true;
if(params.content!=undefined){
@ -183,6 +273,51 @@ function sd_create_editor_from_data(id){
});
});
div_form = $("div[nhname='new_message_" + id + "']");
$(".ke-edit", div_form).css("height","33px");
$(".ke-edit-iframe",div_form).css("height","33px");
}
//第二个参数是高度,可以传,可以不传
function sd_create_editor_from_shixun_data(id){
var height = arguments[1] ? arguments[1] : undefined;
var width = arguments[2] ? arguments[2] : undefined;
var type = arguments[3] ? arguments[3] : undefined;
KindEditor.ready(function (K) {
$("div[nhname='new_message_" + id + "']").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_" + id + "']", params.div_form);
params.contentmsg = $("span[nhname='contentmsg_" + id + "']", params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container_" + id + "']", params.div_form);
params.cancel_btn = $("#new_message_cancel_btn_" + id);
params.submit_btn = $("#new_message_submit_btn_" + id);
params.height = height;
params.width = width;
if (params.textarea.data('init') == undefined) {
params.editor = sd_create_shixun_editor(params,id, type);
sd_create_form(params);
params.cancel_btn.click(function () {
sd_reset_editor_form(params);
});
params.submit_btn.click(function () {
params.form.submit();
});
params.textarea.focus(function (){
params.editor.focus();
});
params.textarea.data('init', 1);
$(this).show();
}
});
});
div_form = $("div[nhname='new_message_" + id + "']");
$(".ke-edit", div_form).css("height","33px");
$(".ke-edit-iframe",div_form).css("height","33px");

View File

@ -58,7 +58,6 @@ $colors: #fff, #0072B5, #2C3E50;
.edu-dropdown-menu li{ height:30px; line-height:30px; display: block; padding:0 15px; text-align: left;}
.edu-dropdown-menu li label{ cursor: pointer;}
.edu-dropdown-menu li:hover{ color: #FF7500!important;}
.edu-dropdown-menu.color li:hover{ color: #ff7500!important;}
/*.edu-dropdown:hover .edu-dropdown-menu{ display: block;}*/
.animate{ -webkit-transition: all .3s; -moz-transition: all .3s; -ms-transition: all .3s; -ms-transition: all .3s;
transition: all .3s; backface-visibility:hidden; -webkit-backface-visibility:hidden; /* Chrome and Safari */ -moz-backface-visibility:hidden; /* Firefox */ -ms-backface-visibility:hidden; /* Internet Explorer */}