组织栏目子目录
This commit is contained in:
parent
d5fc0277a2
commit
5d9ce929d9
|
@ -3,6 +3,13 @@ class OrgSubfieldsController < ApplicationController
|
|||
@subfield = OrgSubfield.create(:name => params[:name])
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
@organization.org_subfields << @subfield
|
||||
if !params[:sub_dir].blank?
|
||||
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
|
||||
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
|
||||
if SubfieldSubdomainDir.find_by_sql(sql).count == 0
|
||||
SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir])
|
||||
end
|
||||
end
|
||||
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
|
||||
end
|
||||
|
||||
|
@ -11,9 +18,58 @@ class OrgSubfieldsController < ApplicationController
|
|||
@subfield = @organization.org_subfields.first
|
||||
if @subfield.field_type == 'Post'
|
||||
redirect_to organization_path(@organization, :org_subfield_id => @subfield.id)
|
||||
else
|
||||
|
||||
end
|
||||
@org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+
|
||||
"subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+
|
||||
" org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name=#{params[:name]}").first
|
||||
if params[:sort]
|
||||
params[:sort].split(",").each do |sort_type|
|
||||
order_by = sort_type.split(":")
|
||||
|
||||
case order_by[0]
|
||||
when "filename"
|
||||
attribute = "filename"
|
||||
when "size"
|
||||
attribute = "filesize"
|
||||
when "attach_type"
|
||||
attribute = "attachtype"
|
||||
when "content_type"
|
||||
attribute = "created_on"
|
||||
when "field_file_dense"
|
||||
attribute = "is_public"
|
||||
when "downloads"
|
||||
attribute = "downloads"
|
||||
when "created_on"
|
||||
attribute = "created_on"
|
||||
when "quotes"
|
||||
attribute = "quotes"
|
||||
else
|
||||
attribute = "created_on"
|
||||
end
|
||||
@sort = order_by[0]
|
||||
@order = order_by[1]
|
||||
if order_by.count == 1 && attribute
|
||||
sort += "#{Attachment.table_name}.#{attribute} asc "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
elsif order_by.count == 2 && order_by[1]
|
||||
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
sort = "#{Attachment.table_name}.created_on desc"
|
||||
end
|
||||
@container_type = 2
|
||||
@containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
|
||||
@organization = Organization.find(@containers.first.organization_id)
|
||||
show_attachments @containers
|
||||
@tag_list = attachment_tag_list @all_attachments
|
||||
@page = params[:page] || 1
|
||||
render :layout => 'base_org'
|
||||
# @org_subfield = OrgSubfield.find(params[:id])
|
||||
# @organization = @org_subfield.organization.id
|
||||
# @messages = []
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class OrgSubfield < ActiveRecord::Base
|
||||
belongs_to :organization, :foreign_key => :organization_id
|
||||
has_one :subfield_subdomain_dir
|
||||
has_many :org_document_comments, :dependent => :destroy
|
||||
has_many :files
|
||||
has_many :org_subfield_messages, :dependent => :destroy
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
class SubfieldSubdomainDir < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
belongs_to :org_subfield
|
||||
end
|
|
@ -0,0 +1,581 @@
|
|||
|
||||
<div id="resource_list">
|
||||
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript'>
|
||||
var slideHeight = 29;
|
||||
function readmore(aNode) {
|
||||
// console.log(aNode)
|
||||
// var $td_tags_area = $(aNode).parent().parent();
|
||||
var $td_tags_area = $(aNode).parent().parent().parent().parent();
|
||||
var $tags_area = $td_tags_area.find('.tags_area')
|
||||
var $tags_gradint = $td_tags_area.find('.tags_gradint')
|
||||
var $read_more = $td_tags_area.find('.read-more')
|
||||
var $read_more_a = $td_tags_area.find('.read-more a')
|
||||
var $tags = $td_tags_area.find('#tags')
|
||||
var $icona = $td_tags_area.find('.tags_icona')
|
||||
|
||||
var slideHeight = 13; //px
|
||||
var defHeight = $tags.height();
|
||||
|
||||
var curHeight = $tags_area.height();
|
||||
if (curHeight == slideHeight) {
|
||||
$tags_area.animate({
|
||||
height: defHeight
|
||||
}, 'normal');
|
||||
$read_more_a.html('隐藏');
|
||||
$icona.html('<%=image_tag "/images/sidebar/minus.png"%>')
|
||||
$tags_gradint.fadeOut();
|
||||
} else {
|
||||
$tags_area.animate({
|
||||
height: slideHeight
|
||||
}, 'normal');
|
||||
$read_more_a.html('更多');
|
||||
$icona.html('<%=image_tag "/images/sidebar/add.png"%>')
|
||||
$tags_gradint.fadeIn();
|
||||
}
|
||||
;
|
||||
|
||||
}
|
||||
$(function () {
|
||||
var slideHeight = 20; //px
|
||||
var defHeight = $('.tags_area').height();
|
||||
if (defHeight >= slideHeight) {
|
||||
$('.tags_area').css('height', slideHeight + 'px');
|
||||
}
|
||||
;
|
||||
});
|
||||
|
||||
function eval_ajax(xhr, textStatus) {
|
||||
if (textStatus == 'success') {
|
||||
eval(xhr.responseText);
|
||||
} else if (textStatus == 'error') {
|
||||
alert('error');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function attachment_contenttypes_searchex(value) {
|
||||
<% if @project%>
|
||||
$.ajax({
|
||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: $('#attachment_browse').val(),
|
||||
contentType: encodeURIComponent(value)
|
||||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
<%end%>
|
||||
}
|
||||
|
||||
|
||||
|
||||
function attachtype_edit(value) {
|
||||
<% if @project%>
|
||||
$.ajax({
|
||||
|
||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: $('#attachment_browse').val(),
|
||||
contentType: encodeURIComponent(value)
|
||||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
<%end%>
|
||||
}
|
||||
|
||||
function attachmenttypes_searchex(value) {
|
||||
<% if @project%>
|
||||
$.ajax({
|
||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: encodeURIComponent(value),
|
||||
contentType: $('#attach_sufix_browse').val()
|
||||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
<%end%>
|
||||
}
|
||||
|
||||
function course_attachmenttypes_searchex(value) {
|
||||
<% if @course%>
|
||||
$.ajax({
|
||||
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: encodeURIComponent(value),
|
||||
contentType: $('#attach_sufix_browse').val()
|
||||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
<%end%>
|
||||
}
|
||||
|
||||
function course_attachment_contenttypes_searchex(value) {
|
||||
<% if @course%>
|
||||
$.ajax({
|
||||
|
||||
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: $('#attachment_browse').val(),
|
||||
contentType: encodeURIComponent(value)
|
||||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
<%end%>
|
||||
}
|
||||
function course_attachtype_edit(value) {
|
||||
<% if @course%>
|
||||
$.ajax({
|
||||
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: $('#attachment_browse').val(),
|
||||
contentType: encodeURIComponent(value)
|
||||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
<%end%>
|
||||
}
|
||||
|
||||
function attachmenttypes_change(id, type) {
|
||||
<% if @project%>
|
||||
$.ajax({
|
||||
url: '<%=updateType_attachments_path%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
attachmentid: encodeURIComponent(id),
|
||||
newtype: encodeURIComponent(type)
|
||||
}
|
||||
|
||||
}).complete(function (xhr, textStatus) {
|
||||
|
||||
if (textStatus == 'success') {
|
||||
$.ajax({
|
||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: $('#attachment_browse').val(),
|
||||
contentType: $('#attach_sufix_browse').val()
|
||||
}
|
||||
}).error(function () {
|
||||
alert('error');
|
||||
});
|
||||
} else if (textStatus == 'error') {
|
||||
alert('An error has occurred');
|
||||
}
|
||||
});
|
||||
<%end%>
|
||||
|
||||
}
|
||||
|
||||
|
||||
function org_id_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
$(".orgDirection").text(orgDirection + sendText);
|
||||
}
|
||||
function subfield_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
var sendColumn = $("input[name='subfield']:checked").next().text();
|
||||
$(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
|
||||
}
|
||||
|
||||
|
||||
function course_attachmenttypes_change(id, type) {
|
||||
<% if @course%>
|
||||
$.ajax({
|
||||
url: '<%=updateType_attachments_path%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
attachmentid: encodeURIComponent(id),
|
||||
newtype: encodeURIComponent(type)
|
||||
}
|
||||
|
||||
}).complete(function (xhr, textStatus) {
|
||||
|
||||
if (textStatus == 'success') {
|
||||
$.ajax({
|
||||
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: $('#attachment_browse').val(),
|
||||
contentType: $('#attach_sufix_browse').val()
|
||||
}
|
||||
}).error(function () {
|
||||
alert('error');
|
||||
});
|
||||
} else if (textStatus == 'error') {
|
||||
alert('An error has occurred');
|
||||
}
|
||||
});
|
||||
<%end%>
|
||||
|
||||
}
|
||||
|
||||
// 编辑文件密级
|
||||
function file_dense_edit(id, type) {
|
||||
$.ajax({
|
||||
url: '<%=updateFileDense_attachments_path%>',
|
||||
type: "POST",
|
||||
remote:"true",
|
||||
data: {
|
||||
attachmentid: encodeURIComponent(id),
|
||||
newtype: encodeURIComponent(type)
|
||||
}
|
||||
|
||||
}).complete(function (xhr, textStatus) {
|
||||
});
|
||||
|
||||
}
|
||||
function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) {
|
||||
$('#'+fieldId).each(function() {
|
||||
var $this = $(this);
|
||||
$this.addClass('autocomplete');
|
||||
$this.attr('data-value-was', $this.val());
|
||||
var check = function() {
|
||||
var val = $this.val();
|
||||
if ($this.attr('data-value-was') != val){
|
||||
$this.attr('data-value-was', val);
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'get',
|
||||
data: {search: $this.val(),send_id:send_id,send_ids:send_ids},
|
||||
success: function(data){ },
|
||||
beforeSend: function(){ $this.addClass('ajax-loading'); },
|
||||
complete: function(){ $this.removeClass('ajax-loading'); }
|
||||
});
|
||||
}
|
||||
};
|
||||
var reset = function() {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
timer = setInterval(check, 300);
|
||||
}
|
||||
};
|
||||
var timer = setInterval(check, 300);
|
||||
$this.bind('keyup click mousemove', reset);
|
||||
});
|
||||
}
|
||||
function check_des(event){
|
||||
if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){
|
||||
event.preventDefault();
|
||||
$(".orgDirection").text('目标地址组织不能为空')
|
||||
return false;
|
||||
}else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){
|
||||
event.preventDefault();
|
||||
$(".orgDirection").text('目标地址栏目不能为空')
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
<% if User.current.logged? %>
|
||||
var sendType = '1';
|
||||
var lastSendType ;//初始为发送到我的课程
|
||||
function show_send(id){
|
||||
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if(lastSendType == '1'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if( lastSendType == '3'){//组织
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//id 发送的id
|
||||
//发送的id数组
|
||||
function chooseSendType(res_id,res_ids){
|
||||
|
||||
sendType = $(".resourcesSendType").val();
|
||||
if (sendType === lastSendType) {
|
||||
return;
|
||||
} else if(lastSendType != null) { //不是第一次点击的时候
|
||||
if (sendType == '1') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
} else if(sendType == '2') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}else if(sendType == '3'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
lastSendType = sendType;
|
||||
}
|
||||
<% end %>
|
||||
<% if @course %>
|
||||
var tagNameHtml; //当前双击的链接的父节点的html
|
||||
var tagName; //标签的值
|
||||
var parentCssBorder; //当前双击的链接的父节点
|
||||
var ele; //当前双击的链接
|
||||
var tagId; //标签的id
|
||||
var taggableType; //被标签的类型
|
||||
//这里renameTag有两种情况,一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名
|
||||
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
|
||||
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id,就是第一种情况。如果没有id。就是第二种情况
|
||||
function rename_tag(domEle,name,id,type){
|
||||
if(String(id) != '' || '<%=User.current.allowed_to?(:as_teacher,@course)%>' == 'true' ) { //如果有id ,或者是老师就都能编辑,否则,没有id,不是老师就不能编辑
|
||||
isdb = true; //这是双击
|
||||
//clearTimeout(clickFunction);
|
||||
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
||||
return;
|
||||
}
|
||||
tagNameHtml = domEle.parent().html()
|
||||
tagName = name;
|
||||
parentCssBorder = domEle.parent().css("border");
|
||||
ele = domEle;
|
||||
tagId = id;
|
||||
taggableType = type;
|
||||
width = parseInt(domEle.css('width').replace('px', '')) >= 100 ? parseInt(domEle.css('width').replace('px', '')) : 100
|
||||
domEle.html('<input name="" id="renameTagName" maxlength="120" minlength="1" style="width:' + width + 'px;" value="' + name + '"/>');
|
||||
domEle.parent().css("border", "1px solid #ffffff");
|
||||
$("#renameTagName").focus();
|
||||
}
|
||||
}
|
||||
//监听所有的单击事件
|
||||
$(function(){
|
||||
$("#renameTagName").live("blur",function(){
|
||||
updateTagName();
|
||||
}).live("keypress",function(e){
|
||||
if (e.keyCode == '13') {
|
||||
updateTagName();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//执行修改TAGName方法
|
||||
function updateTagName(){
|
||||
if(isdb){
|
||||
isdb = false;
|
||||
if($("#renameTagName").val() == tagName){ //如果值一样,则恢复原来的状态
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(tagNameHtml);
|
||||
|
||||
}
|
||||
else{
|
||||
$.post(
|
||||
'<%= update_tag_name_path %>',
|
||||
{"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"courseId":<%= @course.id%>}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// $(document.body).click(function(e){
|
||||
// isdb = false; //这是单击
|
||||
// node = document.elementFromPoint(e.clientX, e.clientY);
|
||||
// if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了
|
||||
// isdb = true; //为了防止在编辑的时候又去单击其他tag去过滤。导致tag过滤不可用
|
||||
// return;
|
||||
// }
|
||||
// if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
|
||||
// if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态
|
||||
// ele.parent().css("border","");
|
||||
// ele.parent().html(tagNameHtml);
|
||||
//
|
||||
// }else{ //否则就要更新tag名称了
|
||||
//// if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){ 去掉询问
|
||||
// $.post(
|
||||
// '<%#= update_tag_name_path %>',
|
||||
// {"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"courseId":<%#= @course.id%>}
|
||||
// )
|
||||
//// }else{
|
||||
//// ele.parent().css("border","");
|
||||
//// ele.parent().html(tagNameHtml);
|
||||
//// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
<%end %>
|
||||
|
||||
<% if @project %>
|
||||
var tagNameHtml; //当前双击的链接的父节点的html
|
||||
var tagName; //标签的值
|
||||
var parentCssBorder; //当前双击的链接的父节点
|
||||
var ele; //当前双击的链接
|
||||
var tagId; //标签的id
|
||||
var taggableType; //被标签的类型
|
||||
//这里renameTag有两种情况,一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名
|
||||
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
|
||||
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id,就是第一种情况。如果没有id。就是第二种情况
|
||||
function rename_tag(domEle,name,id,type){
|
||||
if(String(id) != '' || '<%=is_project_manager?(User.current.id, @project.id)%>' == 'true' ) { //如果有id ,或者是老师就都能编辑,否则,没有id,不是老师就不能编辑
|
||||
isdb = true; //这是双击
|
||||
//clearTimeout(clickFunction);
|
||||
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
||||
return;
|
||||
}
|
||||
tagNameHtml = domEle.parent().html()
|
||||
tagName = name;
|
||||
parentCssBorder = domEle.parent().css("border");
|
||||
ele = domEle;
|
||||
tagId = id;
|
||||
taggableType = type;
|
||||
width = parseInt(domEle.css('width').replace('px', '')) >= 100 ? parseInt(domEle.css('width').replace('px', '')) : 100
|
||||
domEle.html('<input name="" id="renameTagName" maxlength="120" minlength="1" style="width:' + width + 'px;" value="' + name + '"/>');
|
||||
domEle.parent().css("border", "1px solid #ffffff");
|
||||
$("#renameTagName").focus();
|
||||
}
|
||||
}
|
||||
//监听所有的单击事件
|
||||
$(function(){
|
||||
$("#renameTagName").live("blur",function(){
|
||||
updateTagName();
|
||||
}).live("keypress",function(e){
|
||||
if (e.keyCode == '13') {
|
||||
updateTagName();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//执行修改TAGName方法
|
||||
function updateTagName(){
|
||||
if(isdb){
|
||||
isdb = false;
|
||||
if($("#renameTagName").val() == tagName){ //如果值一样,则恢复原来的状态
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(tagNameHtml);
|
||||
|
||||
}
|
||||
else{
|
||||
$.post(
|
||||
'<%= update_project_tag_name_path %>',
|
||||
{"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"projectId":<%= @project.id %>}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
<%end %>
|
||||
|
||||
<% if @org_subfield %>
|
||||
var tagNameHtml; //当前双击的链接的父节点的html
|
||||
var tagName; //标签的值
|
||||
var parentCssBorder; //当前双击的链接的父节点
|
||||
var ele; //当前双击的链接
|
||||
var tagId; //标签的id
|
||||
var taggableType; //被标签的类型
|
||||
//这里renameTag有两种情况,一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名
|
||||
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
|
||||
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id,就是第一种情况。如果没有id。就是第二种情况
|
||||
function rename_tag(domEle,name,id,type){
|
||||
if(1) {
|
||||
isdb = true; //这是双击
|
||||
//clearTimeout(clickFunction);
|
||||
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
||||
return;
|
||||
}
|
||||
tagNameHtml = domEle.parent().html()
|
||||
tagName = name;
|
||||
parentCssBorder = domEle.parent().css("border");
|
||||
ele = domEle;
|
||||
tagId = id;
|
||||
taggableType = type;
|
||||
width = parseInt(domEle.css('width').replace('px', '')) >= 100 ? parseInt(domEle.css('width').replace('px', '')) : 100
|
||||
domEle.html('<input name="" id="renameTagName" maxlength="120" minlength="1" style="width:' + width + 'px;" value="' + name + '"/>');
|
||||
domEle.parent().css("border", "1px solid #ffffff");
|
||||
$("#renameTagName").focus();
|
||||
}
|
||||
}
|
||||
//监听所有的单击事件
|
||||
$(function(){
|
||||
$("#renameTagName").live("blur",function(){
|
||||
updateTagName();
|
||||
}).live("keypress",function(e){
|
||||
if (e.keyCode == '13') {
|
||||
updateTagName();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//执行修改TAGName方法
|
||||
function updateTagName(){
|
||||
if(isdb){
|
||||
isdb = false;
|
||||
if($("#renameTagName").val() == tagName){ //如果值一样,则恢复原来的状态
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(tagNameHtml);
|
||||
|
||||
}
|
||||
else{
|
||||
$.post(
|
||||
'<%= tags_update_org_subfield_tag_name_path %>',
|
||||
{"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"org_subfield_id":<%= @org_subfield.id %>}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
<%end %>
|
||||
|
||||
function show_attachments_history(){
|
||||
|
||||
}
|
||||
|
||||
//更新文件版本 表单提交确认,原则是只能有一个更新文件
|
||||
function upload_attachment_version(event){
|
||||
if($("#upload_form").find('.upload_filename').length > 1){
|
||||
$("#upload_file_count").html('(只能上传一个更新文件)')
|
||||
event.preventDefault();
|
||||
|
||||
return false;
|
||||
}else if($("#upload_form").find('.upload_filename').length == 0){
|
||||
$("#upload_file_count").html('(请上传一个更新文件)')
|
||||
event.preventDefault();
|
||||
|
||||
return false;
|
||||
}else{
|
||||
$("#upload_form").submit();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script type='text/javascript'>
|
||||
function tagAddClick(divid, objId, objTag) {
|
||||
alert("OK");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/users/tag_saveEx',
|
||||
data: {
|
||||
tagname: $('tag_name').value,
|
||||
obj_id: encodeURIComponent(objId),
|
||||
obj_flag: encodeURIComponent(objTag)
|
||||
},
|
||||
success: function (data, textStatus) {
|
||||
alert("OK");
|
||||
$(divid).empty();
|
||||
$(divid).html('123');
|
||||
$("#" + divid + " #name").val("");
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
|
@ -114,26 +114,30 @@
|
|||
<div class="fr">
|
||||
<p class="fontBlue fb mb5">新增栏目</p>
|
||||
<%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %>
|
||||
<input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb10" />
|
||||
<div class="mb5">
|
||||
<p class="fontGrey3"><span class="fb">域名目录</span>(用户自定义url,可选)</p>
|
||||
<span class="fl">micros.trustie.net/</span><input class="fl personalUrl ml3" type="text">
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<ul class="orgAddRole">
|
||||
<li class="fontGrey3 fb mb10">栏目类型</li>
|
||||
<li class="fl mr15">
|
||||
<input type="radio" id="orgMng" value="Post" name="field_type" checked="checked"/>
|
||||
<label for="orgMng">帖子</label>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<input type="radio" id="orgMeb" value="Resource" name="field_type" />
|
||||
<label for="orgMeb">资源</label>
|
||||
</li>
|
||||
<li class="cl"></li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class="saveBtn db fl mt10" onclick="add_org_subfield();">确定</a>
|
||||
<input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb10" />
|
||||
<div class="mb5">
|
||||
<p class="fontGrey3"><span class="fb">域名目录</span>(用户自定义url,可选)</p>
|
||||
<% if @organization.domain %>
|
||||
<span class="fl"><%= @organization.domain %>.trustie.net/</span><input class="fl personalUrl ml3" type="text" name="sub_dir">
|
||||
<% else %>
|
||||
<span class="fl">您还没有子域名,请先在左侧信息栏申请子域名</span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<ul class="orgAddRole">
|
||||
<li class="fontGrey3 fb mb10">栏目类型</li>
|
||||
<li class="fl mr15">
|
||||
<input type="radio" id="orgMng" value="Post" name="field_type" checked="checked"/>
|
||||
<label for="orgMng">帖子</label>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<input type="radio" id="orgMeb" value="Resource" name="field_type" />
|
||||
<label for="orgMeb">资源</label>
|
||||
</li>
|
||||
<li class="cl"></li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class="saveBtn db fl mt10" onclick="add_org_subfield();">确定</a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddStatusToOrgMessages < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :org_messages, :status, :integer, :default => 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class CreateSubfieldSubdomainDirs < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :subfield_subdomain_dirs do |t|
|
||||
t.integer :org_subfield_id
|
||||
t.string :name
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160108093752) do
|
||||
ActiveRecord::Schema.define(:version => 20160112085834) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -1656,6 +1656,13 @@ ActiveRecord::Schema.define(:version => 20160108093752) do
|
|||
add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id"
|
||||
add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id"
|
||||
|
||||
create_table "subfield_subdomain_dirs", :force => true do |t|
|
||||
t.integer "org_subfield_id"
|
||||
t.string "name"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "system_messages", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.string "content"
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
FactoryGirl.define do
|
||||
factory :subfield_subdomain_dir do
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe SubfieldSubdomainDir, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue