Merge branch 'szzh' into develop

This commit is contained in:
huang 2015-12-18 21:22:42 +08:00
commit a2e35917a1
13 changed files with 77 additions and 19 deletions

View File

@ -153,6 +153,7 @@ class BoardsController < ApplicationController
end
end
@page = params[:page] ? params[:page].to_i + 1 : 0
@message = Message.new(:board => @board)
#modify by nwb
respond_to do |format|

View File

@ -24,7 +24,7 @@ class FilesController < ApplicationController
before_filter :auth_login1, :only => [:index]
before_filter :logged_user_by_apptoken,:only => [:index]
before_filter :find_project_by_project_id#, :except => [:getattachtype]
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,:search_tag_attachment]
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,:search_files_in_subfield]
helper :sort
include SortHelper

View File

@ -2727,6 +2727,10 @@ int main(int argc, char** argv){
opt = {enable_at: false, prettify: false, init_activity: false}.merge default_opt
ss = ''
unless Setting.at_enabled?
opt[:enable_at] = false
end
ss += javascript_include_tag("/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg')
if opt[:enable_at]
ss += javascript_include_tag('/assets/kindeditor/at/jquery.caret.min.js', '/assets/kindeditor/at/jquery.atwho.js', '/assets/kindeditor/at/config.js')

View File

@ -31,4 +31,5 @@
<%= render :partial => 'course_new', :locals => {:f => f, :topic => @message, :edit_mode => false, :course => @board.course} %>
<% end %>
<% end %>
<%= render :partial=> 'course_show_detail',:locals =>{:topics => @topics, :page => 0} %></div>
<%= render :partial=> 'course_show_detail',:locals =>{:topics => @topics, :page => 0} %>
</div>

View File

@ -34,7 +34,11 @@
<% if @homework.homework_type == 3 %>
<span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span>
<span id="max_num_member" style="display: none"><%=@homework.homework_detail_group.max_num %></span>
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %>
<% str = User.current.id.to_s%>
<% @work.student_work_projects.where("is_leader = ?", 0).each do |pro| %>
<% str += ','+pro.user_id.to_s %>
<% end %>
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %>
<% end %>
<div>
<input type="text" name="student_work[name]" id="student_work_name" placeholder="请简洁的概括作品的功能或特性" class="InputBox W700" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">

View File

@ -26,14 +26,18 @@
<% end %>
<div class="calendar_div fl mr10">
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
<% if homework.homework_detail_manual.comment_status.to_i < 3 %>
<%= calendar_for('homework_end_time')%>
<% end %>
</div>
<% if edit_mode %>
<label class="fl c_grey f14" style="margin-top: 4px;">发布日期(可选)</label>
<% end %>
<div class="calendar_div fl">
<input type="text" name="homework_common[publish_time]" id="homework_publish_time" placeholder="发布日期(可选)" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
<% if homework.homework_detail_manual.comment_status.to_i == 0 %>
<%= calendar_for('homework_publish_time')%>
<% end %>
</div>
</div>
<div class="cl"></div>

View File

@ -1,6 +1,6 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<%= javascript_include_tag "user" %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<%= javascript_include_tag "init_KindEditor","user" %>
<% end %>
<style type="text/css">

View File

@ -148,6 +148,10 @@
$("#resources_list").mousedown(function(e) {
//如果是右键的话
if (3 == e.which) {
if( $("#res_name").length != 0 || $("#ajax-indicator").is(":hidden") == false){ //其他ajax在执行的时候阻止操作
e.preventDefault();
return ;
}
document.oncontextmenu = function() {return false;}
pageX = e.clientX;
pageY = e.clientY;
@ -195,6 +199,9 @@
//隐藏右键菜单
//e.preventDefault();
$("#contextMenu").hide();
if( $("#ajax-indicator").is(":hidden") == false && $("#res_name").length != 0 ){ //其他ajax在执行的时候或者res_name仍然存在阻止操作
return ;
}
document.oncontextmenu = function() {return true;}
//如果当前行为空,那么要将当前行的拿到
var ele;
@ -363,7 +370,8 @@
res_link = line.children().eq(1).html();
line.children().eq(1).html(
'<input name="res_name" id="res_name" ' +
'style="height: 2em;line-height: 2em;overflow: hidden;" onblur="restore();" onkeypress="if(event.keyCode==13){event.preventDefault();this.blur();}" ' +
'style="height: 2em;line-height: 2em;overflow: hidden;" onblur="restore();" ' +
' onkeypress="if(event.keyCode==13){event.preventDefault();this.blur();}" ' +
'value="'+res_name+
'"/> <input type="hidden" id ="res_id" name="res_id" value="'+id+'"/>');
$("#res_name").focus();
@ -401,7 +409,7 @@
type:'get',
success:function (data)
{
if (data != 'fail') {//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变
if (data != 'fail' && name != undefined && name != 'undefined') {//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变
last_line.children().eq(1).html(res_link);
last_line.children().eq(1).children().attr('title', name);
last_line.children().eq(1).children().attr('href', data);

View File

@ -1,4 +1,4 @@
<%= form_tag(words_create_reply_path, :remote => true) do %>
<%= form_tag(words_create_reply_path, :remote => true,:id=>"form_#{journal.id}") do %>
<%= text_area_tag 'user_notes', "", :class => 'w520 h50 mb5',
:style => "resize: none;overflow: hidden;",:rows => 4,
:placeholder => l(:label_feedback_respond_content)#,
@ -13,6 +13,20 @@
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<%= submit_tag l(:button_feedback_respond), :name => nil ,
:class => "reply_btn"%>
:class => "reply_btn" ,:onclick=>"form_sub_#{ journal.id}($(this),event)"%>
<input nhname="cancel_btn" type="button" style="display:none;"/>
<% end %>
<script>
var flag_<%= journal.id %> = false;
function form_sub_<%= journal.id%>(dom,event){
if(flag_<%= journal.id %> == true){
//dom.attr('disabled','disabled');
return;
}else{
//dom.removeAttr('disabled');
}
flag_<%= journal.id %> = true;
$("#form_<%= journal.id%>").submit();
event.preventDefault();
}
</script>

View File

@ -279,3 +279,5 @@ plugin_redmine_ckeditor:
toolbar_can_collapse: '0'
toolbar_location: top
toolbar: Source,ShowBlocks,--,Undo,Redo,-,Find,Replace,--,Bold,Italic,Underline,Strike,-,Subscript,Superscript,-,NumberedList,BulletedList,-,Outdent,Indent,Blockquote,-,JustifyLeft,JustifyCenter,JustifyRight,JustifyBlock,-,Link,Unlink,-,richImage,Table,HorizontalRule,/,Styles,Format,Font,FontSize,-,TextColor,BGColor
at_enabled:
default: 1

View File

@ -10,10 +10,11 @@ var enableAt = function(_editor) {
var ifr = editor.edit.iframe[0];
var doc = ifr.contentDocument || iframe.contentWindow.document;
var ifrBody = doc.body;
ifrBody.contentEditable = true;
//ifrBody.contentEditable = false;
$(ifrBody).attr('enable_at', 'true');
console.log("enable at");
$.fn.atwho.debug = true;
//$.fn.atwho.debug = true;
var names = [];
@ -40,7 +41,23 @@ var enableAt = function(_editor) {
limit: 200
};
$inputor = $(ifrBody).atwho(at_config);
$inputor.caret('pos', 47);
$inputor.focus().atwho('run');
console.log(_editor.options);
var input = $(ifrBody);
_editor.options.enable_at = (function(){
var first = true;
return function(){
if(first){
input.atwho(at_config);
first = false;
}
}
})();
//$(ifrBody).atwho(at_config);
//$inputor.caret('pos', 47);
//$inputor.focus().atwho('run');
};

View File

@ -97,7 +97,7 @@ App = (function() {
App.prototype.reg = function(flag, setting) {
var base, controller;
controller = (base = this.controllers)[flag] || (base[flag] = this.$inputor.is('[contentEditable]') ? new EditableController(this, flag) : new TextareaController(this, flag));
controller = (base = this.controllers)[flag] || (base[flag] = this.$inputor.is('[enable_at]') ? new EditableController(this, flag) : new TextareaController(this, flag));
if (setting.alias) {
this.aliasMaps[setting.alias] = flag;
}
@ -1110,7 +1110,7 @@ $.fn.atwho = function(method) {
var _args, result;
_args = arguments;
result = null;
this.filter('textarea, input, [contenteditable=""], [contenteditable=true]').each(function() {
this.filter('textarea, input, [contenteditable=""], [contenteditable=true], [enable_at=true]').each(function() {
var $this, app;
if (!(app = ($this = $(this)).data("atwho"))) {
$this.data('atwho', (app = new App(this)));

View File

@ -4730,6 +4730,9 @@ function _bindTabEvent() {
function _bindFocusEvent() {
var self = this;
K(self.edit.textarea[0], self.edit.win).focus(function(e) {
if(typeof self.options.enable_at === 'function'){
self.options.enable_at();
}
if (self.afterFocus) {
self.afterFocus.call(self, e);
}