commit
15c828197f
@ -1,3 +1,3 @@
|
|||||||
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
|
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
|
||||||
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue).journals.count %>)')
|
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue).journals.count %>)')
|
||||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%");
|
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
|
@ -1,3 +1,3 @@
|
|||||||
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
|
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
|
||||||
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)')
|
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)')
|
||||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%");
|
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
|
@ -1,4 +1,5 @@
|
|||||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_homeworks') %>');
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_homeworks') %>');
|
||||||
showModal('ajax-modal', '1040px');
|
showModal('ajax-modal', '1040px');
|
||||||
$('#ajax-modal').siblings().remove();
|
$('#ajax-modal').siblings().remove();
|
||||||
$('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed").css("border","3px solid #269ac9");
|
$('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed").css("border","3px solid #269ac9");
|
||||||
|
$('#ajax-modal').css("margin","15px");
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
#coding=utf-8
|
||||||
|
|
||||||
|
# elasticsearch 在开发环境下也要打开,很烦人的
|
||||||
|
|
||||||
|
if Rails.env.development?
|
||||||
|
|
||||||
|
require 'elasticsearch/model'
|
||||||
|
module Elasticsearch
|
||||||
|
module Model
|
||||||
|
class NoObject
|
||||||
|
|
||||||
|
instance_methods.each do |m|
|
||||||
|
undef_method(m) unless [:object_id, :__send__, :undef_method, :method_missing].include?(m)
|
||||||
|
end
|
||||||
|
|
||||||
|
def method_missing(method, *args, &block)
|
||||||
|
puts "NoObject #{method} #{args}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def NoObject.included(mod)
|
||||||
|
puts "#{self} included in #{mod}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.extended(mod)
|
||||||
|
puts "#{self} extended in #{mod}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
puts methods
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.included(base)
|
||||||
|
base.instance_eval do
|
||||||
|
def settings(a)
|
||||||
|
end
|
||||||
|
|
||||||
|
def __elasticsearch__
|
||||||
|
@__elasticsearch__ ||= NoObject.new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
base.class_eval do
|
||||||
|
def __elasticsearch__
|
||||||
|
@__elasticsearch__ ||= NoObject.new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -1,9 +1,30 @@
|
|||||||
class Subdomain
|
class Subdomain
|
||||||
|
|
||||||
|
def initialize(opt={})
|
||||||
|
@opt = {}.merge(opt)
|
||||||
|
end
|
||||||
|
|
||||||
def matches?(request)
|
def matches?(request)
|
||||||
o = Organization.where(domain: request.subdomain).first
|
puts request.path_parameters
|
||||||
request.path_parameters[:id] = o.id if o
|
o = Secdomain.where(subname: request.subdomain).first
|
||||||
!o.nil?
|
|
||||||
|
if(@opt[:sub])
|
||||||
|
if o && o.sub_type == 2 && request.path_parameters[:sub_dir_name] == 'news'
|
||||||
|
request.path_parameters[:id] = o.pid
|
||||||
|
request.path_parameters[:controller] = 'org_subfields'
|
||||||
|
request.path_parameters[:action] = 'show'
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if o && o.controller
|
||||||
|
request.path_parameters[:id] = o.pid
|
||||||
|
request.path_parameters[:controller] = o.controller
|
||||||
|
request.path_parameters[:action] = o.action
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,136 @@
|
|||||||
|
function init_des_editor(params){
|
||||||
|
// var minHeight; //最小高度
|
||||||
|
var paramsHeight = params.height; //设定的高度
|
||||||
|
var paramsWidth = params.width == undefined ? "100%" : params.width;
|
||||||
|
|
||||||
|
var editor = params.kindutil.create(params.textarea, {
|
||||||
|
resizeType : 1,minWidth:"1px",width:paramsWidth,
|
||||||
|
height:"30px",// paramsHeight == undefined ? "30px":paramsHeight+"px",
|
||||||
|
minHeight:"30px",// paramsHeight == undefined ? "30px":paramsHeight+"px",
|
||||||
|
items : ['code','emoticons','fontname',
|
||||||
|
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
|
||||||
|
'formatblock', 'fontsize', '|','indent', 'outdent',
|
||||||
|
'|','imagedirectupload','table', 'media', 'preview',"more"
|
||||||
|
],
|
||||||
|
afterChange:function(){//按键事件
|
||||||
|
//nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
||||||
|
var edit = this.edit;
|
||||||
|
var body = edit.doc.body;
|
||||||
|
edit.iframe.height(paramsHeight);
|
||||||
|
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, paramsHeight));
|
||||||
|
},
|
||||||
|
afterCreate:function(){
|
||||||
|
//init
|
||||||
|
var edit = this.edit;
|
||||||
|
var body = edit.doc.body;
|
||||||
|
edit.iframe[0].scroll = 'no';
|
||||||
|
body.style.overflowY = 'hidden';
|
||||||
|
//reset height
|
||||||
|
var edit = this.edit;
|
||||||
|
edit.html(params.textarea.innerHTML);
|
||||||
|
var body = edit.doc.body;
|
||||||
|
paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight;
|
||||||
|
edit.iframe.height(paramsHeight);
|
||||||
|
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight), paramsHeight));
|
||||||
|
|
||||||
|
}
|
||||||
|
}).loadPlugin('paste');
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function nh_check_field(params){
|
||||||
|
var result=true;
|
||||||
|
if(!check_org_title()) {
|
||||||
|
result=false;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
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'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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,
|
||||||
|
//title:params.texttitle,
|
||||||
|
content:params.editor,
|
||||||
|
//titlemsg:params.titlemsg,
|
||||||
|
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.texttitle.empty();
|
||||||
|
params.textarea.empty();
|
||||||
|
if(params.editor != undefined){
|
||||||
|
params.editor.html(params.textarea.html());
|
||||||
|
}
|
||||||
|
params.contentmsg.hide();
|
||||||
|
params.titlemsg.html("");
|
||||||
|
}
|
||||||
|
//第二个参数是高度,可以传,可以不传
|
||||||
|
function init_des_data(){
|
||||||
|
var height = arguments[0] ? arguments[0] : undefined;
|
||||||
|
var width = arguments[1] ? arguments[1] : undefined;
|
||||||
|
KindEditor.ready(function (K) {
|
||||||
|
$("div[nhname='new_topic_form']").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.texttitle = $("#document_title", params.div_form);
|
||||||
|
params.textarea = $("textarea[nhname='description_textarea']", params.div_form);
|
||||||
|
//params.titlemsg = $("#doc_title_hint", params.div_form);
|
||||||
|
params.contentmsg = $("#homework_course_id_span", params.div_form);
|
||||||
|
params.cancel_btn = $("#new_topic_cancel_btn");
|
||||||
|
params.submit_btn = $("#new_topic_submit_btn");
|
||||||
|
params.height = height;
|
||||||
|
params.width = width;
|
||||||
|
if (params.textarea.data('init') == undefined) {
|
||||||
|
params.editor = init_des_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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in new issue