mirror of https://gitee.com/karson/fastadmin.git
Merge remote-tracking branch 'karson/master'
commit
6aa13bb48a
|
|
@ -14,7 +14,6 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
<label for="name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<a href="javascript:;" data-toggle="tooltip" title="提示">测试</a>
|
|
||||||
<input type="text" class="form-control" id="name" name="row[name]" data-placeholder-node="{:__('Node tips')}" data-placeholder-menu="{:__('Menu tips')}" value="" data-rule="required" />
|
<input type="text" class="form-control" id="name" name="row[name]" data-placeholder-node="{:__('Node tips')}" data-placeholder-menu="{:__('Menu tips')}" value="" data-rule="required" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
|
||||||
refreshmenu: function () {
|
refreshmenu: function () {
|
||||||
top.window.$(".sidebar-menu").trigger("refresh");
|
top.window.$(".sidebar-menu").trigger("refresh");
|
||||||
},
|
},
|
||||||
gettablecolumnbutton: function(options){
|
gettablecolumnbutton: function (options) {
|
||||||
if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
|
if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
|
||||||
var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
|
var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
|
||||||
if (tableOptions) {
|
if (tableOptions) {
|
||||||
|
|
@ -226,8 +226,10 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//tooltip和popover
|
//tooltip和popover
|
||||||
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
|
if (!('ontouchstart' in document.documentElement)) {
|
||||||
$('body').tooltip({selector: '[data-toggle="popover"]'});
|
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
|
||||||
|
}
|
||||||
|
$('body').popover({selector: '[data-toggle="popover"]'});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Backend.api = $.extend(Fast.api, Backend.api);
|
Backend.api = $.extend(Fast.api, Backend.api);
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,10 @@ define(['fast', 'template'], function (Fast, Template) {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
//tooltip和popover
|
//tooltip和popover
|
||||||
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
|
if (!('ontouchstart' in document.documentElement)) {
|
||||||
$('body').tooltip({selector: '[data-toggle="popover"]'});
|
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
|
||||||
|
}
|
||||||
|
$('body').popover({selector: '[data-toggle="popover"]'});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Frontend.api = $.extend(Fast.api, Frontend.api);
|
Frontend.api = $.extend(Fast.api, Frontend.api);
|
||||||
|
|
|
||||||
|
|
@ -5330,7 +5330,7 @@ define('backend',['fast', 'template', 'moment'], function (Fast, Template, Momen
|
||||||
refreshmenu: function () {
|
refreshmenu: function () {
|
||||||
top.window.$(".sidebar-menu").trigger("refresh");
|
top.window.$(".sidebar-menu").trigger("refresh");
|
||||||
},
|
},
|
||||||
gettablecolumnbutton: function(options){
|
gettablecolumnbutton: function (options) {
|
||||||
if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
|
if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
|
||||||
var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
|
var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
|
||||||
if (tableOptions) {
|
if (tableOptions) {
|
||||||
|
|
@ -5452,8 +5452,10 @@ define('backend',['fast', 'template', 'moment'], function (Fast, Template, Momen
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//tooltip和popover
|
//tooltip和popover
|
||||||
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
|
if (!('ontouchstart' in document.documentElement)) {
|
||||||
$('body').tooltip({selector: '[data-toggle="popover"]'});
|
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
|
||||||
|
}
|
||||||
|
$('body').popover({selector: '[data-toggle="popover"]'});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Backend.api = $.extend(Fast.api, Backend.api);
|
Backend.api = $.extend(Fast.api, Backend.api);
|
||||||
|
|
@ -10389,14 +10391,14 @@ define("drop", function(){});
|
||||||
var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
|
var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
|
||||||
var url = $(this).attr('url');
|
var url = $(this).attr('url');
|
||||||
var content = options.content ? options.content : $(this).attr('content');
|
var content = options.content ? options.content : $(this).attr('content');
|
||||||
var ajax = $(this).attr('ajax') ? true : false;
|
var ajax = $(this).attr('ajax') === '1' || $(this).attr('ajax') === 'true';
|
||||||
var state = ({
|
var state = ({
|
||||||
url: url, title: title, id: id, content: content, ajax: ajax
|
url: url, title: title, id: id, content: content, ajax: ajax
|
||||||
});
|
});
|
||||||
|
|
||||||
document.title = title;
|
document.title = title;
|
||||||
if (history.pushState && !$(this).data("pushstate")) {
|
if (history.pushState && !$(this).data("pushstate")) {
|
||||||
var pushurl = url.indexOf("ref=addtabs") == -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
|
var pushurl = url.indexOf("ref=addtabs") === -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
|
||||||
try {
|
try {
|
||||||
window.history.pushState(state, title, pushurl);
|
window.history.pushState(state, title, pushurl);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -10414,27 +10416,27 @@ define("drop", function(){});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
navobj.on('click', '.close-tab', function (e) {
|
navobj.on('click', '.close-tab', function () {
|
||||||
id = $(this).prev("a").attr("aria-controls");
|
var id = $(this).prev("a").attr("aria-controls");
|
||||||
_close(id);
|
_close(id);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
navobj.on('dblclick', 'li[role=presentation]', function (e) {
|
navobj.on('dblclick', 'li[role=presentation]', function () {
|
||||||
$(this).find(".close-tab").trigger("click");
|
$(this).find(".close-tab").trigger("click");
|
||||||
});
|
});
|
||||||
navobj.on('click', 'li[role=presentation]', function (e) {
|
navobj.on('click', 'li[role=presentation]', function () {
|
||||||
$("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
|
$("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
if (typeof options.nav == 'object') {
|
if (typeof options.nav === 'object') {
|
||||||
var siblingsWidth = 0;
|
var siblingsWidth = 0;
|
||||||
navobj.siblings().each(function () {
|
navobj.siblings().each(function () {
|
||||||
siblingsWidth += $(this).outerWidth();
|
siblingsWidth += $(this).outerWidth();
|
||||||
});
|
});
|
||||||
navobj.width(navobj.parent().width() - siblingsWidth);
|
navobj.width(navobj.parent().width() - siblingsWidth);
|
||||||
} else {
|
} else {
|
||||||
$("#nav").width($("#header > .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
|
$("#nav").width($("#header").find("> .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
|
||||||
}
|
}
|
||||||
_drop();
|
_drop();
|
||||||
});
|
});
|
||||||
|
|
@ -10446,36 +10448,41 @@ define("drop", function(){});
|
||||||
conid = 'con_' + opts.id;
|
conid = 'con_' + opts.id;
|
||||||
url = opts.url;
|
url = opts.url;
|
||||||
url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
|
url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
|
||||||
|
|
||||||
|
var tabitem = $('#' + tabid, navobj);
|
||||||
|
var conitem = $('#' + conid, tabobj);
|
||||||
|
|
||||||
navobj.find("[role='presentation']").removeClass('active');
|
navobj.find("[role='presentation']").removeClass('active');
|
||||||
tabobj.find("[role='tabpanel']").removeClass('active');
|
tabobj.find("[role='tabpanel']").removeClass('active');
|
||||||
|
|
||||||
//如果TAB不存在,创建一个新的TAB
|
//如果TAB不存在,创建一个新的TAB
|
||||||
if ($("#" + tabid).size() == 0) {
|
if (tabitem.size() === 0) {
|
||||||
//创建新TAB的title
|
//创建新TAB的title
|
||||||
title = $('<li role="presentation" id="' + tabid + '"><a href="#' + conid + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>');
|
tabitem = $('<li role="presentation" id="' + tabid + '"><a href="#' + conid + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>');
|
||||||
//是否允许关闭
|
//是否允许关闭
|
||||||
if (options.close && $("li", navobj).size() > 0) {
|
if (options.close && $("li", navobj).size() > 0) {
|
||||||
title.append(' <i class="close-tab fa fa-remove"></i>');
|
tabitem.append(' <i class="close-tab fa fa-remove"></i>');
|
||||||
}
|
}
|
||||||
//创建新TAB的内容
|
//创建新TAB的内容
|
||||||
content = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
|
conitem = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
|
||||||
//是否指定TAB内容
|
//是否指定TAB内容
|
||||||
if (opts.content) {
|
if (opts.content) {
|
||||||
content.append(opts.content);
|
conitem.append(opts.content);
|
||||||
} else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
|
} else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
|
||||||
var height = options.iframeHeight;
|
var height = options.iframeHeight;
|
||||||
content.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>');
|
conitem.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>');
|
||||||
} else {
|
} else {
|
||||||
$.get(url, function (data) {
|
$.get(url, function (data) {
|
||||||
content.append(data);
|
conitem.append(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//加入TABS
|
//加入TABS
|
||||||
if ($('.tabdrop li').size() > 0) {
|
if ($('.tabdrop li', navobj).size() > 0) {
|
||||||
$('.tabdrop ul').append(title);
|
$('.tabdrop ul', navobj).append(tabitem);
|
||||||
} else {
|
} else {
|
||||||
navobj.append(title);
|
navobj.append(tabitem);
|
||||||
}
|
}
|
||||||
tabobj.append(content);
|
tabobj.append(conitem);
|
||||||
} else {
|
} else {
|
||||||
//强制刷新iframe
|
//强制刷新iframe
|
||||||
if (options.iframeForceRefresh) {
|
if (options.iframeForceRefresh) {
|
||||||
|
|
@ -10486,27 +10493,31 @@ define("drop", function(){});
|
||||||
}
|
}
|
||||||
localStorage.setItem("addtabs", $(this).prop('outerHTML'));
|
localStorage.setItem("addtabs", $(this).prop('outerHTML'));
|
||||||
//激活TAB
|
//激活TAB
|
||||||
$("#" + tabid).addClass('active');
|
tabitem.addClass('active');
|
||||||
$("#" + conid).addClass("active");
|
conitem.addClass("active");
|
||||||
_drop();
|
_drop();
|
||||||
};
|
};
|
||||||
|
|
||||||
var _close = function (id) {
|
var _close = function (id) {
|
||||||
var tabid = 'tab_' + id;
|
var tabid = 'tab_' + id;
|
||||||
var conid = 'con_' + id;
|
var conid = 'con_' + id;
|
||||||
|
var tabitem = $('#' + tabid, navobj);
|
||||||
|
var conitem = $('#' + conid, tabobj);
|
||||||
//如果关闭的是当前激活的TAB,激活他的前一个TAB
|
//如果关闭的是当前激活的TAB,激活他的前一个TAB
|
||||||
if (obj.find("li.active").not('.tabdrop').attr('id') == tabid) {
|
if (obj.find("li.active").not('.tabdrop').attr('id') === tabid) {
|
||||||
if ($("#" + tabid).prev().not(".tabdrop").size() > 0) {
|
var prev = tabitem.prev().not(".tabdrop");
|
||||||
$("#" + tabid).prev().not(".tabdrop").find("a").trigger("click");
|
var next = tabitem.next().not(".tabdrop");
|
||||||
} else if ($("#" + tabid).next().size() > 0) {
|
if (prev.size() > 0) {
|
||||||
$("#" + tabid).next().trigger("click");
|
prev.find('a').trigger("click");
|
||||||
|
} else if (next.size() > 0) {
|
||||||
|
next.find('a').trigger("click");
|
||||||
} else {
|
} else {
|
||||||
$(">li:last > a", navobj).trigger('click');
|
$(">li:not(.tabdrop):last > a", navobj).trigger('click');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//关闭TAB
|
//关闭TAB
|
||||||
$("#" + tabid).remove();
|
tabitem.remove();
|
||||||
$("#" + conid).remove();
|
conitem.remove();
|
||||||
_drop();
|
_drop();
|
||||||
options.callback();
|
options.callback();
|
||||||
};
|
};
|
||||||
|
|
@ -10519,11 +10530,11 @@ define("drop", function(){});
|
||||||
$.fn.refreshAddtabs = function () {
|
$.fn.refreshAddtabs = function () {
|
||||||
var navobj = $(this);
|
var navobj = $(this);
|
||||||
var dropdown = $(".tabdrop", navobj);
|
var dropdown = $(".tabdrop", navobj);
|
||||||
if (dropdown.size() == 0) {
|
if (dropdown.size() === 0) {
|
||||||
var dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
|
dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
|
||||||
'<i class="glyphicon glyphicon-align-justify"></i>' +
|
'<i class="glyphicon glyphicon-align-justify"></i>' +
|
||||||
' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
|
' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
|
||||||
dropdown.appendTo(navobj);
|
dropdown.prependTo(navobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
//检测是否有下拉样式
|
//检测是否有下拉样式
|
||||||
|
|
@ -10538,11 +10549,11 @@ define("drop", function(){});
|
||||||
//检查超过一行的标签页
|
//检查超过一行的标签页
|
||||||
var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
|
var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
|
||||||
var totalwidth = 0;
|
var totalwidth = 0;
|
||||||
litabs.each(function (i, j) {
|
litabs.each(function () {
|
||||||
totalwidth += $(this).outerWidth(true);
|
totalwidth += $(this).outerWidth(true);
|
||||||
});
|
});
|
||||||
if (navobj.width() < totalwidth) {
|
if (navobj.width() < totalwidth) {
|
||||||
litabs.each(function (i, j) {
|
litabs.each(function () {
|
||||||
liwidth += $(this).outerWidth(true);
|
liwidth += $(this).outerWidth(true);
|
||||||
if (liwidth > maxwidth) {
|
if (liwidth > maxwidth) {
|
||||||
dropdown.find('ul').append($(this));
|
dropdown.find('ul').append($(this));
|
||||||
|
|
@ -10551,7 +10562,7 @@ define("drop", function(){});
|
||||||
});
|
});
|
||||||
if (collection > 0) {
|
if (collection > 0) {
|
||||||
dropdown.removeClass('hide');
|
dropdown.removeClass('hide');
|
||||||
if (dropdown.find('.active').length == 1) {
|
if (dropdown.find('.active').length === 1) {
|
||||||
dropdown.addClass('active');
|
dropdown.addClass('active');
|
||||||
} else {
|
} else {
|
||||||
dropdown.removeClass('active');
|
dropdown.removeClass('active');
|
||||||
|
|
|
||||||
|
|
@ -1040,8 +1040,10 @@ define('frontend',['fast', 'template'], function (Fast, Template) {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
//tooltip和popover
|
//tooltip和popover
|
||||||
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
|
if (!('ontouchstart' in document.documentElement)) {
|
||||||
$('body').tooltip({selector: '[data-toggle="popover"]'});
|
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
|
||||||
|
}
|
||||||
|
$('body').popover({selector: '[data-toggle="popover"]'});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Frontend.api = $.extend(Fast.api, Frontend.api);
|
Frontend.api = $.extend(Fast.api, Frontend.api);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue