init commit

This commit is contained in:
Sky
2016-03-01 13:50:27 +08:00
parent ad6fa685ed
commit ce60746a90
616 changed files with 170248 additions and 0 deletions

3
.bowerrc Normal file
View File

@@ -0,0 +1,3 @@
{
"directory": "public/libs"
}

1
README.md Normal file
View File

@@ -0,0 +1 @@
## iBlog2

68
app.js Normal file
View File

@@ -0,0 +1,68 @@
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var morgan = require('morgan');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var bodyParser = require('body-parser');
var route = require('./routes/index');
var blog = require('./routes/blog');
var misc = require('./routes/misc');
var auth = require('./routes/auth');
var admin = require('./routes/admin');
var ue = require('./routes/ue');
var logger = require('./utility/logger');
var passport = require('passport');
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
// uncomment after placing your favicon in /public
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(morgan('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(cookieParser());
app.use(session({
secret: 'iblog-exp-session',
cookie: {
maxAge: 24 * 60 * 60 * 1000
},
resave: false,
saveUninitialized: false
}));
app.use(express.static(path.join(__dirname, 'public')));
app.use(passport.initialize());
app.use(passport.session());
app.use('/', route);
app.use('/blog', blog);
app.use('/', misc);
app.use('/', auth);
app.use('/admin', require('connect-ensure-login').ensureLoggedIn(), admin);
app.use('/ue/controller', ue);
// catch 404 and forward to error handler
app.use(function (req, res, next) {
var err = new Error();
err.status = 404;
next(err);
});
// error handlers
app.use(function (err, req, res, next) {
var code = err.status || 500,
message = code === 404 ? '请求的页面已失联~系统已自动记录该错误。' : '服务器出错了~系统已自动记录该错误。';
res.status(code);
logger.errLogger(req, err);
res.render('./shared/error', {
code: code,
message: message
});
});
module.exports = app;

90
bin/www Normal file
View File

@@ -0,0 +1,90 @@
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('iBlog:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}

45
bower.json Normal file
View File

@@ -0,0 +1,45 @@
{
"name": "iBlog2",
"description": "",
"main": "",
"authors": [
"Sky <eshengsky@163.com>"
],
"license": "MIT",
"moduleType": [],
"homepage": "https://github.com/eshengsky/iBlog2",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"public/libs",
"test",
"tests"
],
"dependencies": {
"jquery": "2.2.1",
"bootstrap": "~3.3.6",
"font-awesome": "~4.5.0",
"fuelux": "~3.14.1",
"malihu-custom-scrollbar-plugin": "~3.1.3",
"jquery-qrcode": "https://github.com/lrsjng/jquery-qrcode.git#~0.12.0",
"lightbox2": "^2.8.2",
"scrollNav": "^2.6.0",
"sweetalert": "^1.1.3",
"jQuery-cycleText": "https://github.com/eshengsky/jQuery-cycleText.git",
"ace-builds": "^1.2.3",
"wookmark": "wookmark-jquery#^2.0.1",
"devbridge-autocomplete": "^1.2.24",
"animate.css": "^3.5.1",
"metisMenu": "^2.4.0",
"blueimp-file-upload": "fileupload#^9.11.2",
"bootstrap-table": "^1.10.0",
"lodash": "^4.2.1",
"form.validation": "*",
"jquery-sortable": "^0.9.13",
"js-md5": "^2.1.0",
"codemirror": "^5.11.0",
"switchery": "^0.8.1",
"supersized": "*"
}
}

5
config.json Normal file
View File

@@ -0,0 +1,5 @@
{
"DbPath": "mongodb://localhost/iBlog2",
"RedisHost": "127.0.0.1",
"RedisPort": 6379
}

10
config/about.json Normal file
View File

@@ -0,0 +1,10 @@
{
"FirstLine": "第一行文本",
"SecondLine": "第二行文本",
"PhotoPath": "/images/zhr.jpg",
"ThirdLine": "第三行文本",
"Profile": "个人简介",
"Wechat": "微信号",
"QrcodePath": "",
"Email": "Email地址"
}

5
config/account.json Normal file
View File

@@ -0,0 +1,5 @@
{
"Id": "1",
"UserName": "admin",
"Password": "e10adc3949ba59abbe56e057f20f883e"
}

19
config/settings.json Normal file
View File

@@ -0,0 +1,19 @@
{
"SiteName": "iBlog",
"SiteDomain": "www.example.com",
"RecordNo": "浙ICP备XXX号",
"LogoPath": "/images/zhr.jpg",
"PageSize": "10",
"ExpandMenu": "false",
"CacheExpired": "1800",
"TranslateKey": "",
"EnableStatistics": "true",
"StatisticsId": "",
"EnableShare": "true",
"JiaThisId": "",
"ShowComments": "true",
"ChangyanId": "",
"ChangyanConf": "",
"ShowGuestbook": "true",
"YouyanId": ""
}

130
config/ue.json Normal file
View File

@@ -0,0 +1,130 @@
{
"imageActionName": "uploadimage",
"imageFieldName": "upfile",
"imageMaxSize": 2048000,
"imageAllowFiles": [
".png",
".jpg",
".jpeg",
".gif",
".bmp",
".svg"
],
"imageCompressEnable": true,
"imageCompressBorder": 1600,
"imageInsertAlign": "none",
"imageUrlPrefix": "",
"imagePathFormat": "",
"scrawlActionName": "uploadscrawl",
"scrawlFieldName": "upfile",
"scrawlPathFormat": "",
"scrawlMaxSize": 2048000,
"scrawlUrlPrefix": "",
"scrawlInsertAlign": "none",
"fileActionName": "uploadfile",
"fileFieldName": "upfile",
"filePathFormat": "",
"fileUrlPrefix": "",
"fileMaxSize": 51200000,
"fileAllowFiles": [
".png",
".jpg",
".jpeg",
".gif",
".bmp",
".flv",
".swf",
".mkv",
".avi",
".rm",
".rmvb",
".mpeg",
".mpg",
".ogg",
".ogv",
".mov",
".wmv",
".mp4",
".webm",
".mp3",
".wav",
".mid",
".rar",
".zip",
".tar",
".gz",
".7z",
".bz2",
".cab",
".iso",
".doc",
".docx",
".xls",
".xlsx",
".ppt",
".pptx",
".pdf",
".txt",
".md",
".xml"
],
"imageManagerActionName": "listimage",
"imageManagerListPath": "upload/image",
"imageManagerListSize": 20,
"imageManagerUrlPrefix": "",
"imageManagerInsertAlign": "none",
"imageManagerAllowFiles": [
".png",
".jpg",
".jpeg",
".gif",
".bmp",
".svg"
],
"fileManagerActionName": "listfile",
"fileManagerListPath": "upload/file",
"fileManagerUrlPrefix": "",
"fileManagerListSize": 20,
"fileManagerAllowFiles": [
".png",
".jpg",
".jpeg",
".gif",
".bmp",
".flv",
".swf",
".mkv",
".avi",
".rm",
".rmvb",
".mpeg",
".mpg",
".ogg",
".ogv",
".mov",
".wmv",
".mp4",
".webm",
".mp3",
".wav",
".mid",
".rar",
".zip",
".tar",
".gz",
".7z",
".bz2",
".cab",
".iso",
".doc",
".docx",
".xls",
".xlsx",
".ppt",
".pptx",
".pdf",
".txt",
".md",
".xml"
]
}

16
models/category.js Normal file
View File

@@ -0,0 +1,16 @@
var db = require('./db'),
mongoose = db.mongoose,
base = db.base;
var categorySchema = base.extend({
//分类名称
CateName: {type: String},
//分类别名
Alias: {type: String},
//图标地址
Img: {type: String},
//链接地址
Link: {type: String}
});
exports.CategoryModel = mongoose.model('category', categorySchema, 'category');

21
models/db.js Normal file
View File

@@ -0,0 +1,21 @@
var dbPath = require('../config').DbPath;
var mongoose = require('mongoose');
var extend = require('mongoose-schema-extend');
mongoose.connect(dbPath);
var db = mongoose.connection;
db.on('error', function (err) {
console.error('MongoDB连接错误: ' + err);
process.exit(1);
});
exports.mongoose = mongoose;
//基础Schema
var base = new mongoose.Schema({
//唯一键
_id: {type: String, unique: true},
//创建时间
CreateTime: {type: Date},
//修改时间
ModifyTime: {type: Date}
});
exports.base = base;

17
models/log.js Normal file
View File

@@ -0,0 +1,17 @@
var db = require('./db'),
mongoose = db.mongoose;
var logSchema = new mongoose.Schema({
//唯一键
_id: {type: mongoose.Schema.Types.ObjectId},
//异常信息
message: {type: String},
//记录时间
timestamp: {type: Date},
//级别
level: {type: String},
//详细信息
meta: {type: mongoose.Schema.Types.Mixed}
});
exports.LogModel = mongoose.model('log', logSchema, 'log');

30
models/post.js Normal file
View File

@@ -0,0 +1,30 @@
var db = require('./db'),
mongoose = db.mongoose,
base = db.base;
var postSchema = base.extend({
//标题
Title: {type: String},
//文章别名
Alias: {type: String},
//摘要
Summary: {type: String},
//来源
Source: {type: String},
//内容
Content: {type: String},
//分类Id
CategoryId: {type: String},
//标签
Labels: {type: String},
//外链Url
Url: {type: String},
//浏览次数
ViewCount: {type: Number},
//是否草稿
IsDraft: {type: Boolean},
//是否有效
IsActive: {type: Boolean, default: true}
});
exports.PostModel = mongoose.model('post', postSchema, 'post');

31
package.json Normal file
View File

@@ -0,0 +1,31 @@
{
"name": "iBlog2",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.13.2",
"connect-ensure-login": "^0.1.1",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"eventproxy": "^0.3.4",
"express": "~4.13.1",
"express-session": "^1.13.0",
"jade": "~1.11.0",
"jquery-file-upload-middleware": "^0.1.7",
"moment": "^2.11.1",
"mongoose": "^4.3.7",
"mongoose-schema-extend": "^0.2.0",
"morgan": "~1.6.1",
"multer": "^1.1.0",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"redis": "^2.4.2",
"serve-favicon": "~2.3.0",
"shortid": "^2.2.4",
"winston": "^2.1.1",
"winston-mongodb": "^1.3.0"
}
}

193
proxy/category.js Normal file
View File

@@ -0,0 +1,193 @@
var categoryModel = require('../models/category').CategoryModel;
var post = require('../models/post').PostModel;
var shortid = require('shortid');
var tool = require('../utility/tool');
var redisClient = require('../utility/redisClient');
//全部分类
var cateAll = {
"_id": "",
"Alias": "",
"CateName": "全部分类",
"Img": "/images/全部分类.svg"
};
//未分类
var cateOther = {
"_id": "other",
"Alias": "other",
"CateName": "未分类",
"Img": "/images/未分类.svg"
};
/**
* 获取分类数据
* @param [isAll] 是否包含全部分类和未分类
* @param [cached] 是否读取缓存
* @param callback 回调函数
*/
exports.getAll = function (isAll, cached, callback) {
if (typeof cached === 'function') {
callback = cached;
cached = true;
} else if (typeof isAll === 'function') {
callback = isAll;
isAll = true;
cached = true;
}
var cache_key = isAll ? 'categories_all' : 'categories';
if (cached) {
redisClient.getItem(cache_key, function (err, categories) {
if (err) {
return callback(err);
}
if (categories) {
return callback(null, categories);
}
categoryModel.find(function (err, categories) {
if (err) {
return callback(err);
}
if (isAll) {
categories.unshift(cateAll);
categories.push(cateOther);
}
if (categories) {
redisClient.setItem(cache_key, categories, redisClient.defaultExpired, function (err) {
if (err) {
return callback(err);
}
})
}
return callback(null, categories);
});
});
} else {
categoryModel.find(function (err, categories) {
if (err) {
return callback(err);
}
if (isAll) {
categories.unshift(cateAll);
categories.push(cateOther);
}
return callback(null, categories);
});
}
};
/**
* 根据分类alias获取分类
* @param alias 分类alias
* @param callback 回调函数
* @returns {*}
*/
exports.getByAlias = function (alias, callback) {
var cache_key = 'category_' + alias;
if (alias) {
if (alias === 'other') {
return callback(null, cateOther);
} else {
redisClient.getItem(cache_key, function (err, category) {
if (err) {
return callback(err);
}
if (category) {
return callback(null, category);
}
categoryModel.findOne({"Alias": alias}, function (err, category) {
if (err) {
return callback(err);
}
if (category) {
redisClient.setItem(cache_key, category, redisClient.defaultExpired, function (err) {
if (err) {
return callback(err);
}
})
}
return callback(null, category);
});
});
}
} else {
return callback(null, cateAll);
}
};
/**
* 保存分类数据
* @param array 分类集合
* @param callback 回调函数
*/
exports.save = function (array, callback) {
var jsonArray = [],
toUpdate = [],
updateQuery = [],
cateNew;
if (array.length > 0) {
array.forEach(function (item) {
jsonArray.push({
_id: item.uniqueid || shortid.generate(),
CateName: item.catename,
Alias: item.alias,
Img: item.img,
Link: item.link,
CreateTime: new Date(),
ModifyTime: new Date()
});
});
}
categoryModel.find(function (err, categories) {
if (err) {
return callback(err);
}
categories.forEach(function (old) {
cateNew = tool.jsonQuery(jsonArray, {"_id": old._id});
if (!cateNew) {
//该分类将被删除
toUpdate.push(old._id);
} else {
//该分类依然存在,则创建时间沿用原创建时间
cateNew.CreateTime = old.CreateTime;
//若该分类未做任何修改,则修改时间沿用原修改时间
if (cateNew.CateName.toString() === old.CateName.toString() && cateNew.Alias.toString() === old.Alias.toString() && cateNew.Img === old.Img && cateNew.Link === old.Link) {
cateNew.ModifyTime = old.ModifyTime;
}
}
});
//将已被删除分类的文章设为"未分类"
if (toUpdate.length > 0) {
toUpdate.forEach(function (cateId) {
updateQuery.push({
"CategoryId": cateId
});
});
post.update({"$or": updateQuery}, {"CategoryId": "other"}, {multi: true}, function (err) {
if (err) {
return callback(err);
}
});
}
//将分类全部删除
categoryModel.remove(function (err) {
if (err) {
return callback(err);
}
if (jsonArray.length > 0) {
//插入全部分类
//categoryModel.create(jsonArray, function (err) {}); //不用这个,因为这个内部实现依然是循环插入,不是真正的批量插入
//这里采用mongodb原生的insert来批量插入多个文档
categoryModel.collection.insert(jsonArray, function (err) {
if (err) {
return callback(err);
}
return callback(null);
});
} else {
return callback(null);
}
});
});
};

43
proxy/log.js Normal file
View File

@@ -0,0 +1,43 @@
var logModel = require('../models/log').LogModel;
/**
* 获取所有日志
* @param params 参数对象
* @param callback 回调函数
*/
exports.getAll = function (params, callback) {
var page = parseInt(params.pageIndex) || 1;
page = page > 0 ? page : 1;
var options = {};
options.skip = (page - 1) * params.pageSize;
options.limit = params.pageSize;
switch (params.sortName) {
case 'level':
options.sort = params.sortOrder === 'desc' ? '-level -timestamp' : 'level timestamp';
break;
default:
options.sort = params.sortOrder === 'desc' ? '-timestamp' : 'timestamp';
break;
}
logModel.find({}, {}, options, function (err, logs) {
if (err) {
return callback(err);
}
return callback(null, logs);
});
};
/**
* 获取日志数
* @param params 参数对象
* @param callback 回调函数
*/
exports.getAllCount = function (params, callback) {
logModel.count(function (err, count) {
if (err) {
return callback(err);
}
return callback(null, count);
});
};

374
proxy/post.js Normal file
View File

@@ -0,0 +1,374 @@
var postModel = require('../models/post').PostModel;
var redisClient = require('../utility/redisClient');
var tool = require('../utility/tool');
/**
* 为首页数据查询构建条件对象
* @param params 查询参数对象
* @returns {{}}
*/
function getPostsQuery(params) {
var query = {};
query.IsActive = true;
query.IsDraft = false;
if (params.cateId) {
query.CategoryId = params.cateId;
}
if (params.keyword) {
switch (params.filterType) {
case '1':
query.Title = {"$regex": params.keyword, "$options": "gi"};
break;
case '2':
query.Labels = {"$regex": params.keyword, "$options": "gi"};
break;
case '3':
query.CreateTime = {"$regex": params.keyword, "$options": "gi"};
break;
default:
query.$or = [{
"Title": {
"$regex": params.keyword,
"$options": "gi"
}
}, {
'Labels': {
"$regex": params.keyword,
"$options": "gi"
}
}, {
'Summary': {
"$regex": params.keyword,
"$options": "gi"
}
}, {
'Content': {
"$regex": params.keyword,
"$options": "gi"
}
}];
}
}
return query;
}
/**
* 获取首页的文章数据
* @param params 参数对象
* @param callback 回调函数
*/
exports.getPosts = function (params, callback) {
var cache_key = tool.generateKey('posts', params);
redisClient.getItem(cache_key, function (err, posts) {
if (err) {
return callback(err);
}
if (posts) {
return callback(null, posts);
}
var page = parseInt(params.pageIndex) || 1;
page = page > 0 ? page : 1;
var options = {};
options.skip = (page - 1) * params.pageSize;
options.limit = params.pageSize;
options.sort = params.sortBy === 'title' ? 'Title -CreateTime' : '-CreateTime';
var query = getPostsQuery(params);
postModel.find(query, {}, options, function (err, posts) {
if (err) {
return callback(err);
}
if (posts) {
redisClient.setItem(cache_key, posts, redisClient.defaultExpired, function (err) {
if (err) {
return callback(err);
}
})
}
return callback(null, posts);
});
});
};
/**
* 获取首页的文章数
* @param params 参数对象
* @param callback 回调函数
*/
exports.getPostsCount = function (params, callback) {
var cache_key = tool.generateKey('posts_count', params);
redisClient.getItem(cache_key, function (err, pageCount) {
if (err) {
return callback(err);
}
if (pageCount) {
return callback(null, pageCount);
}
var query = getPostsQuery(params);
postModel.count(query, function (err, count) {
if (err) {
return callback(err);
}
var pageCount = count % params.pageSize === 0 ? parseInt(count / params.pageSize) : parseInt(count / params.pageSize) + 1;
redisClient.setItem(cache_key, pageCount, redisClient.defaultExpired, function (err) {
if (err) {
return callback(err);
}
});
return callback(null, pageCount);
});
});
};
/**
* 根据alias获取文章
* @param alias 文章alias
* @param callback 回调函数
*/
exports.getPostByAlias = function (alias, callback) {
var cache_key = 'article_' + alias;
//此处不需要等待MongoDB的响应所以不想传一个回调函数但如果不传回调函数则必须在调用Query对象上的exec()方法!
//postModel.update({"Alias": alias}, {"ViewCount": 1}, function () {});
postModel.update({"Alias": alias}, {"$inc": {"ViewCount": 1}}).exec();
redisClient.getItem(cache_key, function (err, article) {
if (err) {
return callback(err);
}
if (article) {
return callback(null, article);
}
postModel.findOne({"Alias": alias}, function (err, article) {
if (err) {
return callback(err);
}
if (article) {
redisClient.setItem(cache_key, article, redisClient.defaultExpired, function (err) {
if (err) {
return callback(err);
}
});
}
return callback(null, article);
})
});
};
/**
* 为后台数据查询构建条件对象
* @param params
* @returns {{}}
*/
function getArticlesQuery(params) {
var query = {};
if (params.cateId) {
query.CategoryId = params.cateId;
}
if (params.uniqueId) {
query._id = params.uniqueId;
}
if (params.title) {
query.Title = {"$regex": params.title, "$options": "gi"};
}
if (params.searchText) {
query.$or = [{
"Alias": {
"$regex": params.searchText,
"$options": "gi"
}
}, {
"Title": {
"$regex": params.searchText,
"$options": "gi"
}
}, {
"Summary": {
"$regex": params.searchText,
"$options": "gi"
}
}, {
"Content": {
"$regex": params.searchText,
"$options": "gi"
}
}, {
"Labels": {
"$regex": params.searchText,
"$options": "gi"
}
}, {
"Url": {
"$regex": params.searchText,
"$options": "gi"
}
}]
}
return query;
}
/**
* 获取管理页面的文章数据
* @param params 参数对象
* @param callback 回调函数
*/
exports.getArticles = function (params, callback) {
var page = parseInt(params.pageIndex) || 1;
page = page > 0 ? page : 1;
var options = {};
options.skip = (page - 1) * params.pageSize;
options.limit = params.pageSize;
switch (params.sortName) {
case 'ModifyTime':
options.sort = params.sortOrder === 'desc' ? '-ModifyTime -CreateTime' : 'ModifyTime CreateTime';
break;
case 'ViewCount':
options.sort = params.sortOrder === 'desc' ? '-ViewCount -CreateTime' : 'ViewCount CreateTime';
break;
default:
options.sort = params.sortOrder === 'desc' ? '-CreateTime' : 'CreateTime';
break;
}
var query = getArticlesQuery(params);
postModel.find(query, {}, options, function (err, posts) {
if (err) {
return callback(err);
}
return callback(null, posts);
});
};
/**
* 获取管理页面的文章数
* @param params 参数对象
* @param callback 回调函数
*/
exports.getArticlesCount = function (params, callback) {
var query = getArticlesQuery(params);
postModel.count(query, function (err, count) {
if (err) {
return callback(err);
}
return callback(null, count);
});
};
/**
* 判断文章Alias是否唯一
* @param alias 文章Alias
* @param articleId 文章Id
* @param callback 回调函数
*/
exports.checkAlias = function (alias, articleId, callback) {
postModel.findOne({"Alias": alias}, function (err, article) {
if (err) {
return callback(err);
}
if (!article) {
return callback(null, true);
} else {
if (article._id === articleId) {
return callback(null, true);
} else {
return callback(null, false);
}
}
})
};
/**
* 根据id获取文章
* @param id 文章id
* @param callback 回调函数
*/
exports.getById = function (id, callback) {
postModel.findById(id, function (err, article) {
if (err) {
return callback(err);
}
return callback(null, article);
});
};
/**
* 新增或更新文章
* @param params 参数对象
* @param callback 回调函数
*/
exports.save = function (params, callback) {
var _id = params.UniqueId,
entity = new postModel({
Title: params.Title,
Alias: params.Alias,
Summary: params.Summary,
Source: params.Source,
Content: params.Content,
CategoryId: params.CategoryId,
Labels: params.Labels,
Url: params.Url,
IsDraft: params.IsDraft === 'True',
IsActive: true,
ModifyTime: new Date()
});
postModel.findById(_id, function (err, article) {
if (err) {
return callback(err);
}
if (!article) {
//新增
entity._id = _id;
entity.ViewCount = 0;
entity.CreateTime = new Date();
entity.save(function (err) {
if (err) {
return callback(err);
}
return callback(null);
});
} else {
//更新
postModel.update({"_id": _id}, entity, function (err) {
if (err) {
return callback(err);
}
return callback(null);
});
}
})
};
/**
* 软删除文章
* @param ids 文章id多个id以逗号分隔
* @param callback 回调函数
*/
exports.delete = function (ids, callback) {
var idArray = ids.split(','),
hasErr = false,
index = 0;
idArray.forEach(function (id) {
postModel.update({'_id': id}, {'IsActive': false}, function (err) {
index++;
if (err) {
hasErr = true;
}
if (index === idArray.length) {
if (hasErr) {
return callback(err);
}
return callback(null);
}
});
});
};
/**
* 恢复删除的文章
* @param id 文章id
* @param callback 回调函数
*/
exports.undo = function (id, callback) {
postModel.update({'_id': id}, {'IsActive': true}, function (err) {
if (err) {
return callback(err);
}
return callback(null);
});
};

BIN
public/ZeroClipboard.swf Normal file

Binary file not shown.

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
public/images/ErrorBack.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
public/images/s1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
public/images/s2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
public/images/s3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
public/images/zhr.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg style="width:308px;height:308px;" version="1.1" id="图形" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1024px" height="1024px" viewBox="0 0 1024 1024" enable-background="new 0 0 1024 1024" xml:space="preserve">
<path class="svgpath" data-index="path_0" fill="#ea8010" d="M301.919842 115.317399 122.285602 115.317399l0 179.63424c0 0 0 179.63424 179.63424 179.63424l179.63424 0L481.554082 294.951639C481.554082 115.317399 301.919842 115.317399 301.919842 115.317399L301.919842 115.317399zM421.674297 414.706093" />
<path class="svgpath" data-index="path_1" fill="#ea8010" d="M721.068108 115.317399c0 0-179.63424 0-179.63424 179.63424l0 179.63424 179.63424 0c179.63424 0 179.63424-179.63424 179.63424-179.63424L900.702348 115.317399 721.068108 115.317399 721.068108 115.317399zM840.822562 294.951639" />
<path class="svgpath" data-index="path_2" fill="#ea8010" d="M721.068108 534.464641 541.433868 534.464641l0 179.63424c0 179.63424 179.63424 179.63424 179.63424 179.63424l179.63424 0L900.702348 714.098881C900.701325 714.098881 900.701325 534.464641 721.068108 534.464641L721.068108 534.464641z" />
<path class="svgpath" data-index="path_3" fill="#ea8010" d="M122.285602 714.098881l0 179.63424L301.919842 893.733121c0 0 179.63424 0 179.63424-179.63424L481.554082 534.464641 301.919842 534.464641C122.285602 534.464641 122.285602 714.098881 122.285602 714.098881L122.285602 714.098881zM421.674297 714.098881" />
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg style="width:308px;height:308px;" version="1.1" id="图形" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1024px" height="1024px" viewBox="0 0 1024 1024" enable-background="new 0 0 1024 1024" xml:space="preserve">
<path class="svgpath" data-index="path_0" fill="#ea8010" d="M301.919842 115.317399 122.285602 115.317399l0 179.63424c0 0 0 179.63424 179.63424 179.63424l179.63424 0L481.554082 294.951639C481.554082 115.317399 301.919842 115.317399 301.919842 115.317399L301.919842 115.317399zM421.674297 414.706093 301.919842 414.706093c-109.37813 0-119.319549-92.009554-119.754454-119.755478L182.165388 175.196161 301.919842 175.196161c19.998473 0 119.754454 5.78782 119.754454 119.754454L421.674297 414.706093 421.674297 414.706093zM421.674297 414.706093" />
<path class="svgpath" data-index="path_1" fill="#ea8010" d="M721.068108 115.317399c0 0-179.63424 0-179.63424 179.63424l0 179.63424 179.63424 0c179.63424 0 179.63424-179.63424 179.63424-179.63424L900.702348 115.317399 721.068108 115.317399 721.068108 115.317399zM840.822562 294.951639c0 19.998473-5.78782 119.755478-119.754454 119.755478L601.308537 414.707117 601.308537 294.951639c0-109.377106 92.009554-119.318526 119.758548-119.754454l119.754454 0L840.821539 294.951639 840.822562 294.951639zM840.822562 294.951639" />
<path class="svgpath" data-index="path_2" fill="#ea8010" d="M721.068108 534.464641 541.433868 534.464641l0 179.63424c0 179.63424 179.63424 179.63424 179.63424 179.63424l179.63424 0L900.702348 714.098881C900.701325 714.098881 900.701325 534.464641 721.068108 534.464641L721.068108 534.464641zM840.822562 833.854359 721.068108 833.854359c-19.998473 0-119.758548-5.78782-119.758548-119.754454L601.30956 594.340333l119.758548 0c109.374036 0 119.315456 92.009554 119.754454 119.758548L840.822562 833.854359 840.822562 833.854359zM840.822562 833.854359" />
<path class="svgpath" data-index="path_3" fill="#ea8010" d="M122.285602 714.098881l0 179.63424L301.919842 893.733121c0 0 179.63424 0 179.63424-179.63424L481.554082 534.464641 301.919842 534.464641C122.285602 534.464641 122.285602 714.098881 122.285602 714.098881L122.285602 714.098881zM421.674297 714.098881c0 109.374036-92.010577 119.315456-119.754454 119.754454L182.165388 833.853335 182.165388 714.098881c0-19.998473 5.78782-119.758548 119.754454-119.758548l119.754454 0L421.674297 714.098881 421.674297 714.098881zM421.674297 714.098881" />
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,15 @@
$(function () {
$(".my-nav-pills li:contains('关于')").addClass("active").siblings().removeClass("active");
$("#job-title").cycleText();
$(".fa-qrcode").mouseenter(function () {
$(".profile-img").hide();
$(".wechat-img").show();
});
$(".fa-qrcode").mouseleave(function () {
$(".wechat-img").hide();
$(".profile-img").show();
});
});

View File

@@ -0,0 +1,36 @@
$(function () {
$("#side-menu>li:eq(5)").addClass("active");
$(".fileupload").fileupload({
url: "/admin/uploadimg",
dataType: "json",
done: function (e, data) {
$(this).prev("img").attr("src", data.result.files[0].url);
$(this).next(":hidden").val('/images/' + data.result.files[0].name);
}
});
$('#btnSave').on('click', function () {
$.ajax({
url: $('#formAbout')[0].action,
type: $('#formAbout')[0].method,
data: $('#formAbout').serialize(),
success: function () {
swal({
title: "保存成功!",
type: "success",
showConfirmButton: false,
timer: 2000
});
},
error: function () {
swal({
title: "保存失败!",
type: "error",
showConfirmButton: false,
timer: 2000
});
}
});
});
});

View File

@@ -0,0 +1,75 @@
$(function () {
$.supersized({
slide_interval: 3000, // Length between transitions
transition: 1, // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed: 3000, // Speed of transition
performance: 1, // 0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
// Size & Position
min_width: 0, // Min width allowed (in pixels)
min_height: 0, // Min height allowed (in pixels)
vertical_center: 1, // Vertically center background
horizontal_center: 1, // Horizontally center background
fit_always: 0, // Image will never exceed browser width or height (Ignores min. dimensions)
fit_portrait: 1, // Portrait images will not exceed browser height
fit_landscape: 0, // Landscape images will not exceed browser width
// Components
slide_links: 'blank', // Individual links for each slide (Options: false, 'num', 'name', 'blank')
thumbnail_navigation: 0, // Thumbnail navigation
slides: [ // Slideshow Images
{image: "/images/s1.jpg"},
{image: "/images/s2.jpg"},
{image: "/images/s3.jpg"}
],
progress_bar: 1 // Timer for each slide
});
$("#txtUserName").focus();
$("#btnLogin").on("click", function () {
verify();
});
$(document).on({
keypress: function (e) {
if (e.which === 13 || e.which === 10) {
verify();
}
}
}, "#txtUserName, #txtPwd");
});
function verify() {
var userName = $("#txtUserName").val();
var password = $("#txtPwd").val();
if (!userName) {
$("#txtUserName").focus();
return;
}
if (!password) {
$("#txtPwd").focus();
return;
}
password = md5(password);
var $btn = $("#btnLogin");
$btn.find("i").removeClass("fa-sign-in").addClass("fa-circle-o-notch fa-spin");
$btn.attr("disabled", "disabled");
$.ajax({
url: "/login",
type: "Post",
data: {UserName: userName, Password: password},
success: function (data) {
if (data.valid === true) {
window.location.href = data.returnTo;
} else {
swal({
title: data.message,
type: "error",
showConfirmButton: false,
timer: 2000
});
$btn.find("i").removeClass("fa-circle-o-notch fa-spin").addClass("fa-sign-in");
$btn.removeAttr("disabled");
}
}
});
}

140
public/javascripts/admin.js Normal file
View File

@@ -0,0 +1,140 @@
// Custom scripts
$(document).ready(function () {
// MetsiMenu
$('#side-menu').metisMenu();
// Collapse ibox function
$('.collapse-link').click(function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
var content = ibox.find('div.ibox-content');
content.slideToggle(200);
button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
ibox.toggleClass('').toggleClass('border-bottom');
setTimeout(function () {
ibox.resize();
ibox.find('[id^=map-]').resize();
}, 50);
});
// Close ibox function
$('.close-link').click(function () {
var content = $(this).closest('div.ibox');
content.remove();
});
// Small todo handler
$('.check-link').click(function () {
var button = $(this).find('i');
var label = $(this).next('span');
button.toggleClass('fa-check-square').toggleClass('fa-square-o');
label.toggleClass('todo-completed');
return false;
});
// Append config box / Only for demo purpose
//$.get("skin-config.html", function (data) {
// $('body').append(data);
//});
// minimalize menu
$('.navbar-minimalize').click(function () {
$("body").toggleClass("mini-navbar");
SmoothlyMenu();
})
// tooltips
$('.tooltip-demo').tooltip({
selector: "[data-toggle=tooltip]",
container: "body"
})
// Move modal to body
// Fix Bootstrap backdrop issu with animation.css
$('.modal').appendTo("body")
// Full height of sidebar
function fix_height() {
var heightWithoutNavbar = $("body > #wrapper").height() - 61;
$(".sidebard-panel").css("min-height", heightWithoutNavbar + "px");
}
fix_height();
// Fixed Sidebar
// unComment this only whe you have a fixed-sidebar
// $(window).bind("load", function() {
// if($("body").hasClass('fixed-sidebar')) {
// $('.sidebar-collapse').slimScroll({
// height: 'auto',
// railOpacity: 0.9,
// });
// }
// })
$(window).bind("load resize click scroll", function () {
if (!$("body").hasClass('body-small')) {
fix_height();
}
})
$("[data-toggle=popover]")
.popover();
var innerli = $('#side-menu a[href="' + window.location.pathname + '"]').parent();
innerli.addClass("active");
if (innerli.parent('ul.nav-second-level').length > 0) {
innerli.parent('ul.nav-second-level').addClass('in').parent().addClass('active');
}
});
// For demo purpose - animation css script
function animationHover(element, animation) {
element = $(element);
element.hover(
function () {
element.addClass('animated ' + animation);
},
function () {
//wait for animation to finish before removing classes
window.setTimeout(function () {
element.removeClass('animated ' + animation);
}, 2000);
});
};
// Minimalize menu when screen is less than 768px
$(function () {
$(window).bind("load resize", function () {
if ($(this).width() < 769) {
$('body').addClass('body-small')
} else {
$('body').removeClass('body-small')
}
})
});
function SmoothlyMenu() {
if (!$('body').hasClass('mini-navbar') || $('body').hasClass('body-small')) {
// Hide menu in order to smoothly turn on when maximize menu
$('#side-menu').hide();
// For smoothly turn on menu
setTimeout(
function () {
$('#side-menu').fadeIn(500);
}, 100);
} else if ($('body').hasClass('fixed-sidebar')) {
$('#side-menu').hide();
setTimeout(
function () {
$('#side-menu').fadeIn(500);
}, 300);
} else {
// Remove all inline style from jquery fadeIn function to reset menu state
$('#side-menu').removeAttr('style');
}
};

View File

@@ -0,0 +1,61 @@
$(function () {
$(".my-nav-pills li:eq(0)").addClass("active").siblings().removeClass("active");
//如果目录默认为收起状态,则重新计算显示目录按钮的位置
if (expandMenu === 'false') {
$(".btn-menu").css("margin-left", $(".post-content").width() + 31 + "px");
$(".btn-menu").show();
}
//代码高亮
var pres = $('#main-context pre');
pres.each(function (i, pre) {
$(pre).html($('<code></code>').html($(pre).html()))
});
hljs.initHighlightingOnLoad();
//将img套上a标签以使用lightbox显示图片
$("#main-context").find("img").wrap(function (i) {
return "<a href=\"" + this.src + "\" data-lightbox=\"" + i + "\"></a>"
});
//正常目录
$("#main-context").scrollNav({
sections: "h2", //一级目录的元素
subSections: "h3", //二级目录的元素
showHeadline: true,
headlineText: "文章目录",
showTopLink: false,
scrollOffset: 70,
arrowKeys: true,
insertTarget: "#control-wrap",
insertLocation: "prependTo"
});
//收起目录
$(".close-menu").on("click", function () {
$("#control-wrap").hide();
$(".post-content").removeClass("col-md-9").addClass("col-md-12");
//CSS动画完成后再执行
$(".post-content").on('transitionend webkitTransitionEnd oTransitionEnd', function () {
$(".btn-menu").css("margin-left", $(".post-content").width() + 31 + "px");
$(".btn-menu").show();
});
});
//显示目录
$(".btn-menu").on("click", function () {
$(".btn-menu").hide();
$(".post-content").removeClass("col-md-12").addClass("col-md-9");
//CSS动画完成后再执行
$(".post-content").on('transitionend webkitTransitionEnd oTransitionEnd', function () {
$(".btn-menu").hide(); //TODO需隐藏2次否则显示不正常待研究~
$("#control-wrap").show();
});
});
//改变窗口大小后,重置目录,以修正各标题的定位
$(window).on("resize", function () {
$.fn.scrollNav("resetPos");
});
});

View File

@@ -0,0 +1,251 @@
var $table = $("#articles"),
$remove = $("#remove"),
selections = [];
$(function () {
$("#side-menu>li:eq(2)").addClass("active").find("ul").addClass("in").find("li:eq(2)").addClass("active");
if (selections.length == 0) {
$remove.attr("disabled", "disabled");
}
$table.bootstrapTable({
url: "/admin/getArticles",
method: "post",
pagination: true,
paginationFirstText: "<i class=\"fa fa-angle-double-left\"></i>",
paginationPreText: "<i class=\"fa fa-angle-left\"></i>",
paginationNextText: "<i class=\"fa fa-angle-right\"></i>",
paginationLastText: "<i class=\"fa fa-angle-double-right\"></i>",
queryParamsType: "pageIndex",
sidePagination: "server",
pageList: [10, 25, 50, 100, "All"],
search: true,
sortName: "CreateTime",
sortOrder: "desc",
toolbar: "#toolbar",
showRefresh: true,
showColumns: true,
iconsPrefix: "fa",
icons: {
refresh: "fa-refresh",
columns: "fa-th-list"
},
idField: "UniqueId",
filterControl: true,
responseHandler: responseHandler,
columns: [{
field: "state",
checkbox: true,
align: "center",
valign: "middle"
}, {
field: "CateName",
title: "分类",
halign: "center",
valign: "middle",
width: "140px",
filterControl: "select",
filterData: "url:/admin/getCateFilter",
formatter: function (value, row) {
if (row.CategoryAlias) {
return "<a href=\"/blog/" + row.CategoryAlias + "\" target=\"_blank\">" + value + "</a>";
}
}
}, {
field: "UniqueId",
title: "ID",
align: "center",
valign: "middle",
width: "180px",
filterControl: "input",
visible: false
}, {
field: "Title",
title: "标题",
halign: "center",
valign: "middle",
formatter: function (value, row) {
var link = !row.IsActive ? '<span class="label label-danger" title="该文章已删除">已删除</span> ' : '';
link += row.IsDraft ? '<span class="label label-primary" title="这是一篇草稿">草稿</span> ' : '';
if (row.Source === '1') {
link += "<a href=\"" + row.Url + "\" target=\"_blank\"><i class=\"fa fa-link\"></i> " + value + "</a>";
} else {
if (row.CategoryAlias) {
link += "<a href=\"/blog/" + row.CategoryAlias + "/" + row.Alias + "\" target=\"_blank\">" + value + "</a>";
}
}
return link;
},
filterControl: "input"
}, {
field: "CreateTime",
title: "发布时间",
align: "center",
valign: "middle",
width: "180px",
sortable: true
}, {
field: "ModifyTime",
title: "修改时间",
align: "center",
valign: "middle",
width: "180px",
sortable: true
}, {
field: "ViewCount",
title: "浏览次数",
align: "center",
valign: "middle",
width: "120px",
sortable: true,
formatter: function (value, row) {
if (row.Source == 1) {
return "-";
} else {
return value;
}
}
}, {
field: "operate",
title: "操作",
align: "center",
valign: "middle",
width: "120px",
events: {
"click .remove": function (e, value, row, index) {
swal({
title: "确定要删除该文章吗?",
text: "文章标题:" + row.Title,
html: true,
type: "warning",
allowOutsideClick: true,
showCancelButton: true,
cancelButtonText: "取消",
confirmButtonColor: "#d9534f",
confirmButtonText: "确认删除",
closeOnConfirm: false
},
function () {
$(".sweet-alert .confirm").text("提交中...");
$(".sweet-alert .confirm").attr("disabled", "disabled");
deleteArticle(row.UniqueId);
});
},
"click .undo": function (e, value, row, index) {
swal({
title: "确定要恢复该文章吗?",
text: "文章标题:" + row.Title,
html: true,
type: "warning",
allowOutsideClick: true,
showCancelButton: true,
cancelButtonText: "取消",
confirmButtonText: "确认恢复",
closeOnConfirm: false
},
function () {
$(".sweet-alert .confirm").text("提交中...");
$(".sweet-alert .confirm").attr("disabled", "disabled");
undoArticle(row.UniqueId);
});
}
},
formatter: function (value, row) {
if (row.IsActive) {
return "<a class=\"edit btn btn-white\" title=\"编辑\" href=\"/admin/editarticle/" + row.UniqueId + "\"><i class=\"fa fa-pencil\"></i></a> "
+ "<button type=\"button\" class=\"remove btn btn-white\" title=\"删除\"><i class=\"fa fa-trash-o\"></i></button>";
} else {
return "<a class=\"edit btn btn-white\" title=\"编辑\" href=\"/admin/editarticle/" + row.UniqueId + "\"><i class=\"fa fa-pencil\"></i></a> "
+ "<button type=\"button\" class=\"undo btn btn-white\" title=\"恢复\"><i class=\"fa fa-undo\"></i></button>";
}
}
}]
});
$table.on('check.bs.table check-all.bs.table ' +
'uncheck.bs.table uncheck-all.bs.table', function (e, rows) {
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
if (row.IsActive) {
return row.UniqueId;
}
}),
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
selections = _[func](selections, ids);
var selectionLength = selections.length;
if (selectionLength > 0) {
$remove.find(".badge").html(selectionLength);
$remove.find(".badge").show();
} else {
$remove.find(".badge").html("");
$remove.find(".badge").hide();
}
$remove.prop('disabled', !selectionLength);
});
$remove.click(function () {
swal({
title: "确定要删除这 " + selections.length + " 篇文章吗?",
html: true,
type: "warning",
allowOutsideClick: true,
showCancelButton: true,
cancelButtonText: "取消",
confirmButtonColor: "#d9534f",
confirmButtonText: "确认删除",
closeOnConfirm: false
},
function () {
$(".sweet-alert .confirm").text("提交中...");
$(".sweet-alert .confirm").attr("disabled", "disabled");
deleteArticle(selections.join(","));
});
});
});
function deleteArticle(ids) {
$remove.prop("disabled", true);
$.ajax({
url: "/admin/deleteArticles",
type: "post",
data: "ids=" + ids,
complete: function () {
selections = [];
$table.bootstrapTable('selectPage', 1);
$remove.find(".badge").html("");
$remove.find(".badge").hide();
$(".sweet-alert .confirm").removeAttr("disabled");
swal({
title: "删除成功!",
type: "success",
showConfirmButton: false,
timer: 1000
});
}
});
}
function undoArticle(id){
$.ajax({
url: "/admin/undoArticle",
type: "post",
data: "id=" + id,
complete: function () {
$table.bootstrapTable('selectPage', 1);
$(".sweet-alert .confirm").removeAttr("disabled");
swal({
title: "恢复成功!",
type: "success",
showConfirmButton: false,
timer: 1000
});
}
});
}
function responseHandler(res) {
$.each(res.rows, function (i, row) {
row.state = $.inArray(row.UniqueId, selections) !== -1;
});
return res;
}

View File

@@ -0,0 +1,66 @@
$(function () {
$("#side-menu>li:eq(6)").addClass("active");
$('#keyinput').on('changed.fu.combobox', function (evt, data) {
if (data.value) {
$('#cacheKey').val(data.value);
}
});
$("#btnQuery").on("click", function () {
var key = $("#cacheKey").val();
if (key) {
$.ajax({
url: "/admin/getcache",
type: "Post",
data: {
key: key
},
success: function (data) {
var json = data ? JSON.stringify(data, null, 2) : '';
$("#cacheContent").html(json);
$("#cacheContent").focus();
},
error: function () {
swal({
title: "获取失败!",
type: "error",
showConfirmButton: false,
timer: 2000
});
}
});
}
});
$("#btnClear").on("click", function () {
var key = $("#cacheKey").val();
if (key) {
$.ajax({
url: "/admin/clearcache",
type: "Post",
data: {
key: key
},
success: function () {
swal({
title: "成功清除!",
type: "success",
showConfirmButton: false,
timer: 2000
});
$("#cacheContent").html("");
$("#cacheContent").focus();
},
error: function () {
swal({
title: "清除失败!",
type: "error",
showConfirmButton: false,
timer: 2000
});
}
});
}
});
});

View File

@@ -0,0 +1,378 @@
var home_loading_timeout = 2000;
var isLoading = false;
var timeout = 1000;
var contentTimeout = 1500;
var begin = new Date();
var contentBegin = new Date();
var pageCount;
var tooltip_timeout = 1500;
$(function () {
$(".my-nav-pills li:eq(0)").addClass("active").siblings().removeClass("active");
$("#load-list").show();
$("#PageIndex").val(1);
requestData();
$(".category-list").mCustomScrollbar({
axis: "y",
theme: "dark-3"
});
$(window).scroll(function () {
$("[data-toggle='tooltip']").tooltip("hide");
});
$("[data-toggle='tooltip']").tooltip({
container: "body"
});
$(document).on({
click: function () {
$(this).remove();
begin = new Date();
$("#load-list").show();
isLoading = true;
$("#PageIndex").val(parseInt($("#PageIndex").val()) + 1);
requestData();
}
}, "#btn-load");
$(document).on({
click: function () {
var index = $(this).attr("page");
var pageItem = $("#page" + index);
$("html,body").animate({scrollTop: $(pageItem).offset().top - 90}, 1000);
}
}, "#page-nav a");
$(document).on({
click: function () {
$(".bd_weixin_popup").hide();
$(".bd_weixin_popup_bg").hide();
$(".post-cover").fadeIn();
$("body").addClass("modal-open");
var title = $(this).siblings("h4").children("a").html();
var uid = $(this).parent().attr("uid");
$(".post-modal .modal-header h4").html(title);
$("#btnFullMode").attr("href", "/" + uid);
$(".sk-cube-grid").show();
$(".post-content div").hide();
var comments = $(this).parent().find(".cy_cmt_count").text();
$("#modal-comments").text(comments);
$(".post-modal").css("right", 0);
contentBegin = new Date();
$.ajax({
url: "/blog/getPreviewContent",
type: "Post",
data: {alias: uid},
success: function (data) {
var end = new Date();
if (end - contentBegin > contentTimeout) {
appendContent(data);
} else {
var timespan = contentTimeout - (end - contentBegin);
setTimeout(function () {
appendContent(data);
}, timespan);
}
}
});
}
}, ".preview-link");
$(".post-modal .modal-body").mCustomScrollbar({
theme: "dark-3",
scrollButtons: {
enable: true
}
});
$(".post-cover").on("click", function () {
closeModal();
});
$("#btnCloseModal").on("click", function () {
closeModal();
});
$("#btnFullMode").on("click", function () {
setTimeout(closeModal, 800);
});
$(".list-top-left a").on("click", function () {
if (!$(this).hasClass("current")) {
$(this).addClass("current").siblings().removeClass("current");
$(".list-wrap ol").html("");
$("[data-toggle='tooltip']").tooltip("hide");
$("#page-nav").html("");
$("#btn-load").remove();
$("#no-more").remove();
begin = new Date();
$("#load-list").show();
$("#SortBy").val($(this).attr("sort"));
$("#PageIndex").val(1);
requestData();
}
});
$("#Keyword").on("keypress", function (e) {
if (e.which == 13 || e.which == 10) {
searchPost();
}
});
$("#btnFilter").on("click", function () {
searchPost();
});
$(".selectlist").on("changed.fu.selectlist", function (e, data) {
$(this).find("li").removeClass("active");
$(this).find("li[data-value=" + data.value + "]").addClass("active");
});
});
function requestData() {
$.ajax({
url: $('#filterForm')[0].action,
type: $('#filterForm')[0].method,
data: $('#filterForm').serialize(),
success: function (result) {
var end = new Date();
var data = result.posts;
pageCount = result.pageCount;
if (end - begin > timeout) {
addPage($("#PageIndex").val(), data);
} else {
var timespan = timeout - (end - begin);
setTimeout(function () {
addPage($("#PageIndex").val(), data);
}, timespan);
}
}
});
}
function appendContent(data) {
$(".sk-cube-grid").hide();
$(".post-content div").html(data.Content);
var labels = JSON.parse(data.Labels);
$.each(labels, function (key, value) {
$("#label-foot").append("<span title=\"" + value.text + "\" class=\"post-label\">" + value.text + "</span>");
});
$(".post-modal .modal-body").mCustomScrollbar("scrollTo", "top", {
scrollInertia: 0
});
$(".post-content div").fadeIn();
}
function closeModal() {
$(".post-modal").css("right", "-1200px");
$(".post-cover").fadeOut();
$("body").removeClass("modal-open");
resetModal();
}
function resetModal() {
$(".post-modal .modal-header h4").empty();
$(".post-content div").empty();
$("#label-foot").empty();
}
function searchPost() {
$(".list-wrap ol").html("");
$("[data-toggle='tooltip']").tooltip("hide");
$("#page-nav").html("");
$("#btn-load").remove();
$("#no-more").remove();
begin = new Date();
$("#load-list").show();
$("#PageIndex").val(1);
requestData();
}
function addPage(index, data) {
$("#load-list").hide();
if (data.length > 0) {
$(".list-wrap ol").append("<li id=\"page" + index + "\"></li>");
$.each(data, function (key, value) {
var itemHtml;
if (value.Source == "1") {
itemHtml = "<div uid=\""
+ value.Alias
+ "\" class=\"blog-item " + ($(".home-loading").length > 0 ? "" : "animated fadeIn") + "\">"
+ " <h4>"
+ " <a title=\""
+ value.Title
+ "\" target=\"_blank\" href=\""
+ value.Url
+ "\">"
+ "<i class=\"fa fa-link\"></i> " + value.Title
+ " <\/a>"
+ " <\/h4>"
+ " <span title=\"文章分类\">"
+ " <i class=\"fa fa-tasks\">"
+ " <\/i>"
+ " "
+ "<a href=\"/blog/category/" + value.CategoryAlias + "\" target=\"_blank\">" + value.CateName + "</a>"
+ " <\/span>"
+ " <span title=\"发布时间\" class=\"margin-left-20\">"
+ " <i class=\"fa fa-clock-o\">"
+ " <\/i>"
+ " "
+ value.PublishDate
+ " <\/span>"
+ " <a title=\""
+ value.Host
+ "\" target=\"_blank\" href=\""
+ value.Url.substring(0, value.Url.indexOf("://") + 3) + value.Host
+ "\" class=\"pull-right margin-left-20 hidden-xs\">"
+ " "
+ "<i class=\"fa fa-globe\"></i> " + value.Host
+ " <\/a>"
+ " <div class=\"clearfix\">"
+ " <\/div>"
+ " <p>"
+ " "
+ encodeHtml(value.Summary)
+ " <\/p>"
+ "<\/div>"
+ "<div class=\"hr-line-dashed\"></div>";
} else {
itemHtml = "<div class=\"blog-item " + ($(".home-loading").length > 0 ? "" : "animated fadeIn") + "\" uid=\"" + value.Alias + "\"><a class=\"preview-link\"></a><h4><a href=\"/blog/" + value.CategoryAlias + "/" + value.Alias + "\" target=\"_blank\" title=\"" + value.Title + "\">" + value.Title + "</a></h4><span title=\"文章分类\"><i class=\"fa fa-tasks\"></i> " + "<a href=\"/blog/" + value.CategoryAlias + "\" target=\"_blank\">" + value.CateName + "</a>" + "</span> <span class=\"margin-left-20\" title=\"发布时间\"><i class=\"fa fa-clock-o\"></i> " + value.PublishDate + "</span><span class=\"pull-right margin-left-20 hidden-xs\" title=\"评论人数\"><i class=\"fa fa-comments-o\"></i> <span id = \"sourceId::" + value.UniqueId + "\" class = \"cy_cmt_count\" ></span></span><span class=\"pull-right hidden-xs\" title=\"浏览次数\"><i class=\"fa fa-eye\"></i> " + value.ViewCount + "</span><div class=\"clearfix\"></div><p>" + encodeHtml(value.Summary) + "</p></div><div class=\"hr-line-dashed\"></div>";
}
$("#page" + index).append(itemHtml);
});
$("body").append("<script id=\"cy_cmt_num\" src=\"http://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=cyrUoGjWj\"><\/script>");
var item = $("<li><a href=\"javascript:void(0)\" page=\"" + index + "\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"第" + index + "页\"></a></li>");
item.appendTo($("#page-nav"));
var percent = 100 / index;
$("#page-nav li").css("height", percent + "%");
$("[data-toggle='tooltip']:visible").tooltip({
container: "body"
});
item.find("a").tooltip("show");
setTimeout(function () {
item.find("a").tooltip("hide");
}, tooltip_timeout);
if ($("#PageIndex").val() == pageCount) {
if (pageCount != 1) {
$(".list-wrap").append("<div id=\"no-more\" class=\"text-muted text-center\">没有更多数据<\/div>");
}
} else {
$(".list-wrap").append("<button id=\"btn-load\" class=\"btn btn-white btn-block\">下一页</button>");
}
} else {
$(".list-wrap ol").append("<li id=\"page" + index + "\"></li>");
$("#page" + index).append("<div class=\"text-center text-muted\">暂无数据</div>");
}
isLoading = false;
if ($(".home-loading").length > 0) {
var home_loading_end = new Date();
$("[data-toggle='tooltip']").tooltip("hide");
if (home_loading_end - home_loading_begin > home_loading_timeout) {
$(".home-loading").remove();
document.body.style.overflow = "auto";
} else {
var home_loading_timespan = home_loading_timeout - (home_loading_end - home_loading_begin);
setTimeout(function () {
$(".home-loading").remove();
document.body.style.overflow = "auto";
}, home_loading_timespan);
}
}
}
function encodeHtml(s) {
return (typeof s != "string") ? s :
s.replace(/"|&|'|<|>|[\x00-\x20]|[\x7F-\xFF]|[\u0100-\u2700]/g,
function ($0) {
var c = $0.charCodeAt(0), r = ["&#"];
c = (c == 0x20) ? 0xA0 : c;
r.push(c);
r.push(";");
return r.join("");
});
};
//Fixed Tool
$(function () {
$(window).scroll(function () {
var scrollTop = $(window).scrollTop();
if (scrollTop > 0) {
$("#scrollTop").show();
$(".qrcontain").css("top", "-57px");
$(".qrcontain .arrow").css("top", "52%");
} else {
$("#scrollTop").hide();
$(".qrcontain").css("top", "-107px");
$(".qrcontain .arrow").css("top", "86%");
}
});
$("#qrBtn").on("click", function () {
if ($("#ss_toggle").hasClass("close")) {
$("#share-menu").css("transition", "none");
$("#ss_toggle").click();
}
if ($(".qrcontain").is(":hidden")) {
$(".qrcontain").removeClass("fadeOutLeft").addClass("fadeInLeft");
$(".qrcontain").show();
$("#qrBtn").addClass("opened");
} else {
$(".qrcontain").removeClass("fadeInLeft").addClass("fadeOutLeft");
$(".qrcontain").one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function () {
$(".qrcontain").hide();
});
$("#qrBtn").removeClass("opened");
}
$("#share-menu").css("transition", "all 1s ease 0s");
});
$("#scrollTop a").on("click", function () {
$("html,body").animate({scrollTop: 0}, 1000);
});
var toggle = $('#ss_toggle');
var menu = $('#share-menu');
var rot;
$('#ss_toggle').on('click', function (ev) {
if (!$(".qrcontain").is(":hidden")) {
$(".qrcontain").hide();
$("#qrBtn").removeClass("opened");
}
rot = parseInt($(this).data('rot')) - 180;
if (rot / 180 % 2 == 0) {
menu.css('transform', 'rotate(' + rot + 'deg)');
menu.css('webkitTransform', 'rotate(' + rot + 'deg)');
toggle.parent().addClass('ss_active');
toggle.addClass('close');
} else {
menu.css('transform', 'rotate(' + parseInt(rot - 30) + 'deg)');
menu.css('webkitTransform', 'rotate(' + parseInt(rot - 30) + 'deg)');
toggle.parent().removeClass('ss_active');
toggle.removeClass('close');
}
$(this).data('rot', rot);
});
menu.on('transitionend webkitTransitionEnd oTransitionEnd', function () {
if (rot / 180 % 2 == 0) {
$("#share-menu i.fa").addClass('bounce');
} else {
$("#share-menu i.fa").removeClass('bounce');
}
});
var img = document.createElement("img");
img.src = logoPath;
img.onload = function () {
$("#qrcode").qrcode({
text: window.location.href,
size: "100",
ecLevel: 'H',
minVersion: 4,
mode: 4,
image: img,
mSize: 0.3
});
}
});

View File

@@ -0,0 +1,245 @@
$(function () {
getData();
var adjustment;
var group = $("#cate-list").sortable({
group: 'cate-list',
handle: 'i.fa-arrows',
pullPlaceholder: false,
onDrop: function ($item, container, _super) {
var $clonedItem = $('<li/>').css({height: 0});
$item.before($clonedItem);
$clonedItem.animate({'height': $item.height()});
$item.animate($clonedItem.position(), function () {
$clonedItem.detach();
_super($item, container);
});
},
onDragStart: function ($item, container, _super) {
var offset = $item.offset(),
pointer = container.rootGroup.pointer;
adjustment = {
left: pointer.left - offset.left,
top: pointer.top - offset.top
};
_super($item, container);
},
onDrag: function ($item, position) {
$item.css({
left: position.left - adjustment.left,
top: position.top - adjustment.top
});
}
});
$(document).on({
change: function () {
var $input = $(this).parent().parent().next("input");
if ($(this).prop("checked")) {
$input.removeAttr("disabled");
$(this).parents(".list-group-item").data("link", $input.val());
} else {
$input.attr("disabled", "disabled");
$(this).parents(".list-group-item").data("link", "");
}
}
}, "input:checkbox");
$(document).on({
change: function (event) {
var val = $(this).val();
if ($(event.target).hasClass("txtName")) {
$(this).parents(".list-group-item").data("catename", val);
$(this).parents(".list-group-item").attr("data-catename", val);
} else if ($(event.target).hasClass("txtAlias")) {
$(this).parents(".list-group-item").data("alias", val);
$(this).parents(".list-group-item").attr("data-alias", val);
} else {
$(this).parents(".list-group-item").data("link", val);
$(this).parents(".list-group-item").attr("data-link", val);
}
}
}, ".txtName, .txtAlias, .txtLink");
$(document).on({
click: function () {
$(this).parents(".list-group-item").slideUp("normal", function () {
$(this).remove();
});
}
}, ".btn-del-cate");
$(document).on({
click: function () {
var cate = $("<li class=\"list-group-item\" data-uniqueid=\"" + "" + "\" data-catename=\"" + "" + "\" data-alias=\"" + "" + "\" data-img=\"" + "" + "\" data-link=\"" + "" + "\">"
+ "<div class=\"row\">"
+ "<div class=\"col-md-2\">"
+ "<i class=\"fa fa-arrows\"></i> "
+ "<span class=\"fileinput-button\">"
+ "<img src=\"" + "" + "\"/>"
+ "<input type=\"file\" class=\"fileupload\" name=\"file\">"
+ "</span>"
+ "</div>"
+ "<div class=\"col-md-2\">"
+ "<input class=\"form-control txtName\" type=\"text\" value=\"" + "" + "\" placeholder=\"分类名称\"/>"
+ "</div>"
+ "<div class=\"col-md-2\">"
+ "<input class=\"form-control txtAlias\" type=\"text\" value=\"" + "" + "\" placeholder=\"分类alias\"/>"
+ "</div>"
+ "<div class=\"col-md-5\">"
+ "<div class=\"input-group cate-link\">"
+ "<span class=\"input-group-addon\"><label>"
+ "<input type=\"checkbox\"/> 链接"
+ "</label></span>"
+ "<input type=\"text\" class=\"form-control txtLink\" value=\"" + "" + "\" disabled=\"disabled\">"
+ "</div>"
+ "</div>"
+ "<div class=\"col-md-1\">"
+ "<button class=\"btn btn-link btn-del-cate\" title=\"移除分类\"><i class=\"fa fa-times\"></i></button>"
+ "</div>"
+ "</div>"
+ "</li>");
cate.appendTo($("#cate-list"));
bindFileUpload();
}
}, "#btnNew");
$(document).on({
click: function () {
if (isValidData()) {
var $this = $(this);
$this.attr("disabled", "disabled");
$this.find(".fa").removeClass("fa-cloud-upload").addClass("fa-circle-o-notch fa-spin");
var gdata = group.sortable("serialize").get();
var json = JSON.stringify(gdata);
$.ajax({
url: "/admin/saveCategories",
type: "Post",
data: {json: json},
success: function () {
swal({
title: "保存成功!",
type: "success",
showConfirmButton: false,
timer: 2000
});
},
error: function () {
swal({
title: "操作失败!",
type: "error",
showConfirmButton: false,
timer: 2000
});
},
complete: function () {
$this.removeAttr("disabled");
$this.find(".fa").removeClass("fa-circle-o-notch fa-spin").addClass("fa-cloud-upload");
getData();
}
});
}
}
}, "#btnSave");
});
function getData() {
$.ajax({
url: "/admin/getCategories",
type: "Post",
dataType: "json",
success: function (data) {
$("#cate-list").empty();
$.each(data, function (key, value) {
var cate = $("<li class=\"list-group-item\" data-uniqueid=\"" + value._id + "\" data-catename=\"" + value.CateName + "\" data-alias=\"" + value.Alias + "\" data-img=\"" + value.Img + "\" data-link=\"" + value.Link + "\">"
+ "<div class=\"row\">"
+ "<div class=\"col-md-2\">"
+ "<i class=\"fa fa-arrows\"></i> "
+ "<span class=\"fileinput-button\">"
+ "<img src=\"" + value.Img + "\"/>"
+ "<input type=\"file\" class=\"fileupload\" name=\"file\">"
+ "</span>"
+ "</div>"
+ "<div class=\"col-md-2\">"
+ "<input class=\"form-control txtName\" type=\"text\" value=\"" + value.CateName + "\" placeholder=\"分类名称\"/>"
+ "</div>"
+ "<div class=\"col-md-2\">"
+ "<input class=\"form-control txtAlias\" type=\"text\" value=\"" + value.Alias + "\" placeholder=\"分类alias\"/>"
+ "</div>"
+ "<div class=\"col-md-5\">"
+ "<div class=\"input-group cate-link\">"
+ "<span class=\"input-group-addon\"><label>"
+ "<input type=\"checkbox\" " + (value.Link != "" ? "checked=\"checked\"" : "") + "/> 链接"
+ "</label></span>"
+ "<input type=\"text\" class=\"form-control txtLink\" value=\"" + value.Link + "\" " + (value.Link == "" ? "disabled=\"disabled\"" : "") + ">"
+ "</div>"
+ "</div>"
+ "<div class=\"col-md-1\">"
+ "<button class=\"btn btn-link btn-del-cate\" title=\"移除分类\"><i class=\"fa fa-times\"></i></button>"
+ "</div>"
+ "</div>"
+ "</li>");
cate.appendTo($("#cate-list"));
});
},
complete: function () {
bindFileUpload();
}
});
}
function bindFileUpload() {
$(".fileupload").fileupload({
url: "/admin/uploadimg",
dataType: "text",
done: function (e, data) {
$(this).prev().attr("src", '/images/' + data.files[0].name);
$(this).parent().parent().parent().parent().data("img", '/images/' + data.files[0].name);
}
});
}
function isValidData() {
var result = true;
var items = $("#cate-list li");
for (var i = 0; i < items.length; i++) {
var cateName = $(items[i]).data("catename");
var cateAlias = $(items[i]).data("alias");
if (cateName === "" || cateAlias === "") {
swal({
title: "分类名称、分类alias都不能为空",
type: "warning",
showConfirmButton: false,
timer: 2000
});
result = false;
break;
}
if ($("#cate-list li[data-catename='" + cateName + "']").length > 1) {
swal({
title: "分类名称 \"" + cateName + "\" 不唯一!",
type: "warning",
showConfirmButton: false,
timer: 2000
});
result = false;
break;
}
if ($("#cate-list li[data-alias='" + cateAlias + "']").length > 1) {
swal({
title: "分类alias \"" + cateAlias + "\" 不唯一!",
type: "warning",
showConfirmButton: false,
timer: 2000
});
result = false;
break;
}
}
return result;
}

View File

@@ -0,0 +1,26 @@
Date.prototype.dateFormat = function (fmt) {
return getDateStr(this, fmt);
};
String.prototype.jsonDateFormat = function (fmt) {
var date = new Date(parseInt(this.replace("/Date(", "").replace(")/", ""), 10));
return getDateStr(date, fmt);
};
function getDateStr(date, fmt) {
var o = {
"M+": date.getMonth() + 1, //月份
"d+": date.getDate(), //日
"H+": date.getHours(), //小时
"m+": date.getMinutes(), //分
"s+": date.getSeconds(), //秒
"q+": Math.floor((date.getMonth() + 3) / 3), //季度
"S": date.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}

View File

@@ -0,0 +1,248 @@
$(function () {
$("#side-menu>li:eq(2)").addClass("active").find("ul").addClass("in").find("li:eq(2)").addClass("active");
refreshCate();
if (source == "1") {
$("#soruceLink").radio("check")
} else {
$("#soruceLocal").radio("check")
}
$("#myPillbox").pillbox("addItems", 0, JSON.parse($('#Labels').val()));
var editor = UE.getEditor("editor", {
allowDivTransToP: false,
initialFrameHeight: 300,
textarea: "Content"
});
editor.ready(function () {
$("[data-toggle=tooltip]").tooltip({
container: "body"
});
});
$(".btn-alias").on("click", function () {
var appid,
key,
salt,
query = $("#Title").val(),
from,
to,
str1,
sign;
if (query) {
var that = this;
$(that).addClass("disabled");
appid = '20151219000008011';
key = translateKey;
salt = (new Date).getTime();
from = 'zh';
to = 'en';
str1 = appid + query + salt + key;
sign = md5(str1);
$.ajax({
url: 'http://api.fanyi.baidu.com/api/trans/vip/translate',
type: 'get',
dataType: 'jsonp',
data: {
q: query,
appid: appid,
salt: salt,
from: from,
to: to,
sign: sign
},
success: function (data) {
var en = data.trans_result[0].dst;
var result = en.trim().toLowerCase().split(' ').join('-');
$("#Alias").val(result).focus();
$('#postForm').formValidation('revalidateField', 'Alias');
},
complete: function () {
$(that).removeClass("disabled");
}
});
}
});
$("#postForm").on('init.field.fv', function (e, data) {
var $parent = data.element.parents('.form-group'),
$icon = $parent.find('.form-control-feedback[data-fv-icon-for="' + data.field + '"]');
$icon.on('click.clearing', function () {
if ($icon.hasClass('fa-remove')) {
data.fv.resetField(data.element);
}
});
}).formValidation({
framework: 'bootstrap',
icon: {
valid: 'fa fa-check',
invalid: 'fa fa-remove',
validating: 'fa fa-refresh'
},
err: {
container: 'tooltip'
},
fields: {
Title: {
validators: {
notEmpty: {
message: '标题不能为空'
}
}
},
Alias: {
validators: {
notEmpty: {
message: 'Alias不能为空'
},
remote: {
url: '/admin/checkArticleAlias',
type: 'POST',
data: '{"uid":"' + $('#UniqueId').val() + '"}',
delay: 1000,
message: 'Alias不唯一'
}
}
},
Summary: {
validators: {
notEmpty: {
message: '摘要不能为空'
}
}
},
Url: {
validators: {
notEmpty: {
message: 'Url不能为空'
},
uri: {
message: 'Url地址不正确'
}
}
}
}
})
.on('err.field.fv', function (e, data) {
data.fv.disableSubmitButtons(false);
})
.on('success.field.fv', function (e, data) {
data.fv.disableSubmitButtons(false);
})
.on('success.form.fv', function (e) {
var isPublish = $('#btnPublish').length > 0;
e.preventDefault();
$("#Labels").val(JSON.stringify($("#myPillbox").pillbox("items")));
$('#IsDraft').val('False');
swal({
title: isPublish ? '确定要发布该文章吗?' : '确定提交更新吗?',
text: $("#CategoryId").val() === "other" ? "<span style='color:#d9534f;'>注意:当前选择的文章分类为\"未分类\"</span>" : null,
html: true,
type: "warning",
allowOutsideClick: true,
showCancelButton: true,
cancelButtonText: "取消",
confirmButtonColor: "#d9534f",
confirmButtonText: isPublish ? '确定发布' : '确定提交',
closeOnConfirm: false
},
function () {
$(".sweet-alert .confirm").text(isPublish ? '发布中...' : '提交中...');
$(".sweet-alert .confirm").attr("disabled", "disabled");
$.ajax({
url: $("#postForm")[0].action,
type: $("#postForm")[0].method,
data: $("#postForm").serialize(),
success: function () {
if (isPublish) {
swal({
title: '发布成功!',
type: "success",
showConfirmButton: false,
timer: 2000
}, function () {
window.location.href = "/admin/articlemanage";
});
} else {
swal({
title: '更新成功!',
type: "success",
showConfirmButton: false,
timer: 2000
});
}
},
error: function () {
swal({
title: isPublish ? '发布失败!' : '更新失败!',
type: "error",
showConfirmButton: false,
timer: 2000
});
},
complete: function () {
$(".sweet-alert .confirm").removeAttr("disabled");
}
});
});
});
$('#btnSave').on('click', function () {
var $this = $(this);
$("#Labels").val(JSON.stringify($("#myPillbox").pillbox("items")));
$('#IsDraft').val('True');
$this.attr('disabled', 'disabled');
$.ajax({
url: $("#postForm")[0].action,
type: $("#postForm")[0].method,
data: $("#postForm").serialize(),
success: function () {
swal({
title: '草稿保存成功!',
type: 'success',
showConfirmButton: false,
timer: 2000
});
},
error: function () {
swal({
title: "草稿保存失败!",
type: "error",
showConfirmButton: false,
timer: 2000
});
},
complete: function () {
$this.removeAttr("disabled");
}
});
});
$(".selectlist").on("changed.fu.selectlist", function (e, data) {
$(this).find("li").removeClass("active");
$(this).find("li[data-value=" + data.value + "]").addClass("active");
});
});
function refreshCate() {
$.ajax({
url: "/admin/getCategories",
type: "Post",
success: function (data) {
$("#Categorylist ul").html("");
$.each(data, function (key, value) {
if (!value.Link) {
$("#Categorylist ul").append("<li data-value=\"" + value._id + "\">"
+ "<a href=\"#\">" + value.CateName + "</a>"
+ "</li>");
}
});
$("#Categorylist ul").append("<li data-value=\"other\"><a href=\"#\">未分类</a></li>");
$("#Categorylist").selectlist("enable");
$("#Categorylist").selectlist("selectByValue", categoryId);
$("#Categorylist li[data-value=" + categoryId + "]").addClass("active");
}
});
}

View File

@@ -0,0 +1,67 @@
var $table = $("#exceptions");
$(function () {
$("#side-menu>li:eq(7)").addClass("active");
$table.bootstrapTable({
url: "/admin/getExceptions",
method: "post",
pagination: true,
paginationFirstText: "<i class=\"fa fa-angle-double-left\"></i>",
paginationPreText: "<i class=\"fa fa-angle-left\"></i>",
paginationNextText: "<i class=\"fa fa-angle-right\"></i>",
paginationLastText: "<i class=\"fa fa-angle-double-right\"></i>",
queryParamsType: "pageIndex",
sidePagination: "server",
pageList: [10, 25, 50, 100, "All"],
sortName: "timestamp",
sortOrder: "desc",
showRefresh: true,
showColumns: true,
iconsPrefix: "fa",
icons: {
refresh: "fa-refresh",
columns: "fa-th-list",
detailOpen: "fa-plus",
detailClose: "fa-minus"
},
idField: "_id",
detailView: true,
detailFormatter: function (index, row) {
return '<div style="white-space:pre-wrap;">' + JSON.stringify(row.meta, null, 2) + '</div>';
},
columns: [{
field: "meta.os.hostname",
title: "主机名",
align: "center",
valign: "middle",
width: "120px",
}, {
field: "meta.code",
title: "Code",
align: "center",
valign: "middle",
width: "80px",
}, {
field: "message",
title: "异常信息",
halign: "center",
valign: "middle"
}, {
field: "time",
title: "记录时间",
align: "center",
valign: "middle",
width: "200px",
sortable: true
}, {
field: "level",
title: "等级",
align: "center",
valign: "middle",
width: "120px",
sortable: true
}]
})
;
});

View File

@@ -0,0 +1,3 @@
$(function () {
$(".my-nav-pills li:contains('留言')").addClass("active").siblings().removeClass("active");
});

File diff suppressed because one or more lines are too long

309
public/javascripts/index.js Normal file
View File

@@ -0,0 +1,309 @@
var home_loading_timeout = 2000;
var isLoading = false;
var timeout = 1000;
var contentTimeout = 1500;
var begin = new Date();
var contentBegin = new Date();
var pageCount;
var tooltip_timeout = 1500;
$(function () {
$(".my-nav-pills li:eq(0)").addClass("active").siblings().removeClass("active");
$("#load-list").show();
$("#PageIndex").val(1);
requestData();
$(".category-list").mCustomScrollbar({
axis: "y",
theme: "dark-3"
});
$(window).scroll(function () {
$("[data-toggle='tooltip']").tooltip("hide");
});
$("[data-toggle='tooltip']").tooltip({
container: "body"
});
$(document).on({
click: function () {
$(this).remove();
begin = new Date();
$("#load-list").show();
isLoading = true;
$("#PageIndex").val(parseInt($("#PageIndex").val()) + 1);
requestData();
}
}, "#btn-load");
$(document).on({
click: function () {
var index = $(this).attr("page");
var pageItem = $("#page" + index);
$("html,body").animate({scrollTop: $(pageItem).offset().top - 90}, 1000);
}
}, "#page-nav a");
$(document).on({
click: function () {
var $this = $(this);
$(".bd_weixin_popup").hide();
$(".bd_weixin_popup_bg").hide();
$(".post-cover").fadeIn();
$("body").addClass("modal-open");
$(".post-modal").css("right", 0);
var alias = $(this).parent().attr("uid");
if ($('body').data('preview') === alias) {
return;
}
resetModal();
var title = $(this).siblings("h4").children("a").html();
$(".post-modal .modal-header h4").html(title);
$("#btnFullMode").attr("href", $(this).next('h4').children('a').attr('href'));
$(".post-content div").hide();
var previewData = $this.data('preview-data');
if (previewData) {
appendContent(previewData);
return;
}
$(".sk-cube-grid").show();
contentBegin = new Date();
$.ajax({
url: "/blog/getPreviewContent",
type: "Post",
data: {alias: alias},
success: function (data) {
var end = new Date();
$this.data('preview-data', data);
if (end - contentBegin > contentTimeout) {
appendContent(data);
} else {
var timespan = contentTimeout - (end - contentBegin);
setTimeout(function () {
appendContent(data);
}, timespan);
}
}
});
}
}, ".preview-link");
$(".post-modal .modal-body").mCustomScrollbar({
theme: "dark-3",
scrollButtons: {
enable: true
}
});
$(".post-cover").on("click", function () {
closeModal();
});
$("#btnCloseModal").on("click", function () {
closeModal();
});
$("#btnFullMode").on("click", function () {
setTimeout(closeModal, 800);
});
$(".list-top-left a").on("click", function () {
if (!$(this).hasClass("current")) {
$(this).addClass("current").siblings().removeClass("current");
$(".list-wrap ol").html("");
$("[data-toggle='tooltip']").tooltip("hide");
$("#page-nav").html("");
$("#btn-load").remove();
$("#no-more").remove();
begin = new Date();
$("#load-list").show();
$("#SortBy").val($(this).attr("sort"));
$("#PageIndex").val(1);
requestData();
}
});
$("#Keyword").on("keypress", function (e) {
if (e.which == 13 || e.which == 10) {
searchPost();
}
});
$("#btnFilter").on("click", function () {
searchPost();
});
$(".selectlist").on("changed.fu.selectlist", function (e, data) {
$(this).find("li").removeClass("active");
$(this).find("li[data-value=" + data.value + "]").addClass("active");
});
});
function requestData() {
$.ajax({
url: $('#filterForm')[0].action,
type: $('#filterForm')[0].method,
data: $('#filterForm').serialize(),
success: function (result) {
var end = new Date();
var data = result.posts;
pageCount = result.pageCount;
if (end - begin > timeout) {
addPage($("#PageIndex").val(), data);
} else {
var timespan = timeout - (end - begin);
setTimeout(function () {
addPage($("#PageIndex").val(), data);
}, timespan);
}
}
});
}
function appendContent(data) {
$(".sk-cube-grid").hide();
$(".post-content div").html(data.Content);
var labels = JSON.parse(data.Labels);
$.each(labels, function (key, value) {
$("#label-foot").append("<span title=\"" + value.text + "\" class=\"post-label\">" + value.text + "</span>");
});
$(".post-modal .modal-body").mCustomScrollbar("scrollTo", "top", {
scrollInertia: 0
});
$(".post-content div").fadeIn();
var pres = $('.post-content pre');
pres.each(function (i, pre) {
$(pre).html($('<code></code>').html($(pre).html()));
hljs.highlightBlock($(pre).children('code')[0]);
});
}
function closeModal() {
$(".post-modal").css("right", "-1200px");
$(".post-cover").fadeOut();
$("body").removeClass("modal-open");
}
function resetModal() {
$(".post-modal .modal-header h4").empty();
$(".post-content div").empty();
$("#label-foot").empty();
}
function searchPost() {
$(".list-wrap ol").html("");
$("[data-toggle='tooltip']").tooltip("hide");
$("#page-nav").html("");
$("#btn-load").remove();
$("#no-more").remove();
begin = new Date();
$("#load-list").show();
$("#PageIndex").val(1);
requestData();
}
function addPage(index, data) {
$("#load-list").hide();
if (data.length > 0) {
$(".list-wrap ol").append("<li id=\"page" + index + "\"></li>");
$.each(data, function (key, value) {
var itemHtml;
if (value.Source == "1") {
itemHtml = "<div uid=\""
+ value.Alias
+ "\" class=\"blog-item " + ($(".home-loading").length > 0 ? "" : "animated fadeIn") + "\">"
+ " <h4>"
+ " <a title=\""
+ value.Title
+ "\" target=\"_blank\" href=\""
+ value.Url
+ "\">"
+ "<i class=\"fa fa-link\"></i> " + value.Title
+ " <\/a>"
+ " <\/h4>"
+ " <span title=\"文章分类\">"
+ " <i class=\"fa fa-map-signs\">"
+ " <\/i>"
+ " "
+ "<a href=\"/blog/" + value.CategoryAlias + "\" target=\"_blank\">" + value.CateName + "</a>"
+ " <\/span>"
+ " <span title=\"发布时间\" class=\"margin-left-20\">"
+ " <i class=\"fa fa-clock-o\">"
+ " <\/i>"
+ " "
+ value.PublishDate
+ " <\/span>"
+ " <a title=\""
+ value.Host
+ "\" target=\"_blank\" href=\""
+ value.Url.substring(0, value.Url.indexOf("://") + 3) + value.Host
+ "\" class=\"pull-right margin-left-20 hidden-xs\">"
+ " "
+ "<i class=\"fa fa-globe\"></i> " + value.Host
+ " <\/a>"
+ " <div class=\"clearfix\">"
+ " <\/div>"
+ " <p>"
+ " "
+ encodeHtml(value.Summary)
+ " <\/p>"
+ "<\/div>"
+ "<div class=\"hr-line-dashed\"></div>";
} else {
itemHtml = "<div class=\"blog-item " + ($(".home-loading").length > 0 ? "" : "animated fadeIn") + "\" uid=\"" + value.Alias + "\"><a class=\"preview-link\" title=\"点击预览\"></a><h4><a href=\"/blog/"
+ value.CategoryAlias + "/" + value.Alias + "\" target=\"_blank\" title=\"" + value.Title + "\">" + value.Title + "</a></h4><span title=\"文章分类\"><i class=\"fa fa-map-signs\"></i> " + "<a href=\"/blog/" + value.CategoryAlias + "\" target=\"_blank\">" + value.CateName + "</a>" + "</span> <span class=\"margin-left-20\" title=\"发布时间\"><i class=\"fa fa-clock-o\"></i> " + value.PublishDate + "</span><div class=\"clearfix\"></div><p>" + encodeHtml(value.Summary) + "</p></div><div class=\"hr-line-dashed\"></div>";
}
$("#page" + index).append(itemHtml);
});
$("body").append("<script id=\"cy_cmt_num\" src=\"http://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=cyrUoGjWj\"><\/script>");
var item = $("<li><a href=\"javascript:void(0)\" page=\"" + index + "\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"第" + index + "页\"></a></li>");
item.appendTo($("#page-nav"));
var percent = 100 / index;
$("#page-nav li").css("height", percent + "%");
$("[data-toggle='tooltip']:visible").tooltip({
container: "body"
});
item.find("a").tooltip("show");
setTimeout(function () {
item.find("a").tooltip("hide");
}, tooltip_timeout);
if ($("#PageIndex").val() == pageCount) {
if (pageCount != 1) {
$(".list-wrap").append("<div id=\"no-more\" class=\"text-muted text-center\">没有更多数据<\/div>");
}
} else {
$(".list-wrap").append("<button id=\"btn-load\" class=\"btn btn-white btn-block\">下一页</button>");
}
} else {
$(".list-wrap ol").append("<li id=\"page" + index + "\"></li>");
$("#page" + index).append("<div class=\"text-center text-muted\">暂无数据</div>");
}
isLoading = false;
if ($(".home-loading").length > 0) {
var home_loading_end = new Date();
$("[data-toggle='tooltip']").tooltip("hide");
if (home_loading_end - home_loading_begin > home_loading_timeout) {
$(".home-loading").remove();
document.body.style.overflow = "auto";
} else {
var home_loading_timespan = home_loading_timeout - (home_loading_end - home_loading_begin);
setTimeout(function () {
$(".home-loading").remove();
document.body.style.overflow = "auto";
}, home_loading_timespan);
}
}
}
function encodeHtml(s) {
return (typeof s != "string") ? s :
s.replace(/"|&|'|<|>|[\x00-\x20]|[\x7F-\xFF]|[\u0100-\u2700]/g,
function ($0) {
var c = $0.charCodeAt(0), r = ["&#"];
c = (c == 0x20) ? 0xA0 : c;
r.push(c);
r.push(";");
return r.join("");
});
};

View File

@@ -0,0 +1,237 @@
$(function () {
$("#side-menu>li:eq(2)").addClass("active").find("ul").addClass("in").find("li:eq(0)").addClass("active");
$("#Title").focus();
refreshCate();
var editor = UE.getEditor("editor", {
allowDivTransToP: false,
initialFrameHeight: 300,
initialContent: "请输入文章正文",
autoClearinitialContent: true,
textarea: "Content"
});
editor.ready(function () {
$("[data-toggle=tooltip]").tooltip({
container: "body"
});
});
$(".btn-alias").on("click", function () {
var appid,
key,
salt,
query = $("#Title").val(),
from,
to,
str1,
sign;
if (query) {
var that = this;
$(that).addClass("disabled");
appid = '20151219000008011';
key = translateKey;
salt = (new Date).getTime();
from = 'zh';
to = 'en';
str1 = appid + query + salt + key;
sign = md5(str1);
$.ajax({
url: 'http://api.fanyi.baidu.com/api/trans/vip/translate',
type: 'get',
dataType: 'jsonp',
data: {
q: query,
appid: appid,
salt: salt,
from: from,
to: to,
sign: sign
},
success: function (data) {
var en = data.trans_result[0].dst;
var result = en.trim().toLowerCase().split(' ').join('-');
$("#Alias").val(result).focus();
$('#postForm').formValidation('revalidateField', 'Alias');
},
complete: function () {
$(that).removeClass("disabled");
}
});
}
});
$("#postForm").on('init.field.fv', function (e, data) {
var $parent = data.element.parents('.form-group'),
$icon = $parent.find('.form-control-feedback[data-fv-icon-for="' + data.field + '"]');
$icon.on('click.clearing', function () {
if ($icon.hasClass('fa-remove')) {
data.fv.resetField(data.element);
}
});
}).formValidation({
framework: 'bootstrap',
icon: {
valid: 'fa fa-check',
invalid: 'fa fa-remove',
validating: 'fa fa-refresh'
},
err: {
container: 'tooltip'
},
fields: {
Title: {
validators: {
notEmpty: {
message: '标题不能为空'
}
}
},
Alias: {
validators: {
notEmpty: {
message: 'Alias不能为空'
},
remote: {
url: '/admin/checkArticleAlias',
type: 'POST',
data: '{"uid":"' + $('#UniqueId').val() + '"}',
delay: 1000,
message: 'Alias不唯一'
}
}
},
Summary: {
validators: {
notEmpty: {
message: '摘要不能为空'
}
}
},
Url: {
validators: {
notEmpty: {
message: 'Url不能为空'
},
uri: {
message: 'Url地址不正确'
}
}
}
}
})
.on('err.field.fv', function (e, data) {
data.fv.disableSubmitButtons(false);
})
.on('success.field.fv', function (e, data) {
data.fv.disableSubmitButtons(false);
})
.on('success.form.fv', function (e) {
e.preventDefault();
$("#Labels").val(JSON.stringify($("#myPillbox").pillbox("items")));
$('#IsDraft').val('False');
swal({
title: "确定要发布该文章吗?",
text: $("#CategoryId").val() === "other" ? "<span style='color:#d9534f;'>注意:当前选择的文章分类为\"未分类\"</span>" : null,
html: true,
type: "warning",
allowOutsideClick: true,
showCancelButton: true,
cancelButtonText: "取消",
confirmButtonColor: "#d9534f",
confirmButtonText: "确定发布",
closeOnConfirm: false
},
function () {
$(".sweet-alert .confirm").text("发布中...");
$(".sweet-alert .confirm").attr("disabled", "disabled");
$.ajax({
url: $("#postForm")[0].action,
type: $("#postForm")[0].method,
data: $("#postForm").serialize(),
success: function () {
swal({
title: "发布成功!",
type: "success",
showConfirmButton: false,
timer: 2000
}, function () {
window.location.href = "/admin/articlemanage";
});
},
error: function () {
swal({
title: "发布失败!",
type: "error",
showConfirmButton: false,
timer: 2000
});
},
complete: function () {
$(".sweet-alert .confirm").removeAttr("disabled");
}
});
});
});
$('#btnSave').on('click', function () {
var $this = $(this);
$("#Labels").val(JSON.stringify($("#myPillbox").pillbox("items")));
$('#IsDraft').val('True');
$this.attr('disabled', 'disabled');
$.ajax({
url: $("#postForm")[0].action,
type: $("#postForm")[0].method,
data: $("#postForm").serialize(),
success: function () {
swal({
title: '草稿保存成功!',
type: 'success',
showConfirmButton: false,
timer: 2000
}, function () {
window.location.href = '/admin/editarticle/' + $('#UniqueId').val();
});
},
error: function () {
swal({
title: "草稿保存失败!",
type: "error",
showConfirmButton: false,
timer: 2000
});
},
complete: function () {
$this.removeAttr("disabled");
}
});
});
$(".selectlist").on("changed.fu.selectlist", function (e, data) {
$(this).find("li").removeClass("active");
$(this).find("li[data-value=" + data.value + "]").addClass("active");
});
});
function refreshCate() {
$.ajax({
url: "/admin/getCategories",
type: "Post",
success: function (data) {
$("#Categorylist ul").html("");
$.each(data, function (key, value) {
if (!value.Link) {
$("#Categorylist ul").append("<li data-value=\"" + value._id + "\">"
+ "<a href=\"#\">" + value.CateName + "</a>"
+ "</li>");
}
});
$("#Categorylist ul").append("<li data-value=\"other\"><a href=\"#\">未分类</a></li>");
$("#Categorylist").selectlist("enable");
$("#Categorylist").selectlist("selectByValue", "other");
$("#Categorylist li[data-value=other]").addClass("active");
}
});
}

View File

@@ -0,0 +1,288 @@
/*
* Fuel UX Selectlist
* https://github.com/ExactTarget/fuelux
*
* Copyright (c) 2014 ExactTarget
* Licensed under the BSD New license.
*/
// -- BEGIN UMD WRAPPER PREFACE --
// For more information on UMD visit:
// https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
(function (factory) {
if (typeof define === 'function' && define.amd) {
// if AMD loader is available, register as an anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// OR use browser globals if AMD is not present
factory(jQuery);
}
}(function ($) {
// -- END UMD WRAPPER PREFACE --
// -- BEGIN MODULE CODE HERE --
var old = $.fn.selectlist;
// SELECT CONSTRUCTOR AND PROTOTYPE
var Selectlist = function (element, options) {
this.$element = $(element);
this.options = $.extend({}, $.fn.selectlist.defaults, options);
this.$button = this.$element.find('.btn.dropdown-toggle');
this.$hiddenField = this.$element.find('.hidden-field');
this.$label = this.$element.find('.selected-label');
this.$dropdownMenu = this.$element.find('.dropdown-menu');
this.$element.on('click.fu.selectlist', '.dropdown-menu a', $.proxy(this.itemClicked, this));
this.setDefaultSelection();
if (options.resize === 'auto' || this.$element.attr('data-resize') === 'auto') {
this.resize();
}
// if selectlist is empty or is one item, disable it
var items = this.$dropdownMenu.children('li');
if (items.length === 0) {
this.disable();
this.doSelect($(this.options.emptyLabelHTML));
}
// support jumping focus to first letter in dropdown when key is pressed
this.$element.on('shown.bs.dropdown', function () {
var $this = $(this);
// attach key listener when dropdown is shown
$(document).on('keypress.fu.selectlist', function (e) {
// get the key that was pressed
var key = String.fromCharCode(e.which);
// look the items to find the first item with the first character match and set focus
$this.find("li").each(function (idx, item) {
if ($(item).text().charAt(0).toLowerCase() === key) {
$(item).children('a').focus();
return false;
}
});
});
});
// unbind key event when dropdown is hidden
this.$element.on('hide.bs.dropdown', function () {
$(document).off('keypress.fu.selectlist');
});
};
Selectlist.prototype = {
constructor: Selectlist,
destroy: function () {
this.$element.remove();
// any external bindings
// [none]
// empty elements to return to original markup
// [none]
// returns string of markup
return this.$element[0].outerHTML;
},
doSelect: function ($item) {
var $selectedItem;
this.$selectedItem = $selectedItem = $item;
this.$hiddenField.val(this.$selectedItem.attr('data-value'));
this.$label.html($(this.$selectedItem.children()[0]).html());
// clear and set selected item to allow declarative init state
// unlike other controls, selectlist's value is stored internal, not in an input
this.$element.find('li').each(function () {
if ($selectedItem.is($(this))) {
$(this).attr('data-selected', true);
} else {
$(this).removeData('selected').removeAttr('data-selected');
}
});
},
itemClicked: function (e) {
this.$element.trigger('clicked.fu.selectlist', this.$selectedItem);
e.preventDefault();
// ignore if a disabled item is clicked
if ($(e.currentTarget).parent('li').is('.disabled, :disabled')) { return; }
// is clicked element different from currently selected element?
if (!($(e.target).parent().is(this.$selectedItem))) {
this.itemChanged(e);
}
// return focus to control after selecting an option
this.$element.find('.dropdown-toggle').focus();
},
itemChanged: function (e) {
//selectedItem needs to be <li> since the data is stored there, not in <a>
this.doSelect($(e.target).closest('li'));
// pass object including text and any data-attributes
// to onchange event
var data = this.selectedItem();
// trigger changed event
this.$element.trigger('changed.fu.selectlist', data);
},
resize: function () {
var width = 0;
var newWidth = 0;
var sizer = $('<div/>').addClass('selectlist-sizer');
if (Boolean($(document).find('html').hasClass('fuelux'))) {
// default behavior for fuel ux setup. means fuelux was a class on the html tag
$(document.body).append(sizer);
} else {
// fuelux is not a class on the html tag. So we'll look for the first one we find so the correct styles get applied to the sizer
$('.fuelux:first').append(sizer);
}
sizer.append(this.$element.clone());
this.$element.find('a').each(function () {
sizer.find('.selected-label').text($(this).text());
newWidth = sizer.find('.selectlist').outerWidth();
newWidth = newWidth + sizer.find('.sr-only').outerWidth();
if (newWidth > width) {
width = newWidth;
}
});
if (width <= 1) {
return;
}
this.$button.css('width', width);
this.$dropdownMenu.css('width', width);
sizer.remove();
},
selectedItem: function () {
var txt = this.$selectedItem.text();
return $.extend({
text: txt
}, this.$selectedItem.data());
},
selectByText: function (text) {
var $item = $([]);
this.$element.find('li').each(function () {
if ((this.textContent || this.innerText || $(this).text() || '').toLowerCase() === (text || '').toLowerCase()) {
$item = $(this);
return false;
}
});
this.doSelect($item);
},
selectByValue: function (value) {
var selector = 'li[data-value="' + value + '"]';
this.selectBySelector(selector);
},
selectByIndex: function (index) {
// zero-based index
var selector = 'li:eq(' + index + ')';
this.selectBySelector(selector);
},
selectBySelector: function (selector) {
var $item = this.$element.find(selector);
this.doSelect($item);
},
setDefaultSelection: function () {
var $item = this.$element.find('li[data-selected=true]').eq(0);
if ($item.length === 0) {
$item = this.$element.find('li').has('a').eq(0);
}
this.doSelect($item);
},
enable: function () {
this.$element.removeClass('disabled');
this.$button.removeClass('disabled');
},
disable: function () {
this.$element.addClass('disabled');
this.$button.addClass('disabled');
}
};
// SELECT PLUGIN DEFINITION
$.fn.selectlist = function (option) {
var args = Array.prototype.slice.call(arguments, 1);
var methodReturn;
var $set = this.each(function () {
var $this = $(this);
var data = $this.data('fu.selectlist');
var options = typeof option === 'object' && option;
if (!data) {
$this.data('fu.selectlist', (data = new Selectlist(this, options)));
}
if (typeof option === 'string') {
methodReturn = data[option].apply(data, args);
}
});
return (methodReturn === undefined) ? $set : methodReturn;
};
$.fn.selectlist.defaults = {
emptyLabelHTML: '<li data-value=""><a href="#">No items</a></li>'
};
$.fn.selectlist.Constructor = Selectlist;
$.fn.selectlist.noConflict = function () {
$.fn.selectlist = old;
return this;
};
// DATA-API
$(document).on('mousedown.fu.selectlist.data-api', '[data-initialize=selectlist]', function (e) {
var $control = $(e.target).closest('.selectlist');
if (!$control.data('fu.selectlist')) {
$control.selectlist($control.data());
}
});
// Must be domReady for AMD compatibility
$(function () {
$('[data-initialize=selectlist]').each(function () {
var $this = $(this);
if (!$this.data('fu.selectlist')) {
$this.selectlist($this.data());
}
});
});
// -- BEGIN UMD WRAPPER AFTERWORD --
}));
// -- END UMD WRAPPER AFTERWORD --

View File

@@ -0,0 +1,52 @@
$(function () {
$("#side-menu>li:eq(8)").addClass("active");
var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
elems.forEach(function (el) {
var switchery = new Switchery(el, { color: '#1AB394' });
});
$(document).on({
change: function () {
$(this).prev(":hidden").val(this.checked);
}
}, ".js-switch");
$(".fileupload").fileupload({
url: "/admin/uploadimg",
dataType: "text",
done: function (e, data) {
$(this).prev("img").attr("src", data.result);
$(this).next(":hidden").val(data.result);
}
});
$('#btnSave').on('click', function () {
var $this = $(this);
$this.attr('disabled', 'disabled');
$.ajax({
url: $("#postForm")[0].action,
type: $("#postForm")[0].method,
data: $("#postForm").serialize(),
success: function () {
swal({
title: '保存成功!',
type: 'success',
showConfirmButton: false,
timer: 2000
});
},
error: function () {
swal({
title: "保存失败!",
type: "error",
showConfirmButton: false,
timer: 2000
});
},
complete: function () {
$this.removeAttr("disabled");
}
});
});
});

92
public/javascripts/top.js Normal file
View File

@@ -0,0 +1,92 @@
$(function () {
var shows = window.tools || [0, 1, 2],
toggle = $('#ss_toggle'),
menu = $('#share-menu'),
rot,
img;
if (shows.indexOf(0) >= 0) {
$('ul.fixed-tool li.share-li').show();
$('#ss_toggle').on('click', function () {
if (!$(".qrcontain").is(":hidden")) {
$(".qrcontain").hide();
$("#qrBtn").removeClass("opened");
}
rot = parseInt($(this).data('rot')) - 180;
if (rot / 180 % 2 == 0) {
menu.css('transform', 'rotate(' + rot + 'deg)');
menu.css('webkitTransform', 'rotate(' + rot + 'deg)');
toggle.parent().addClass('ss_active');
toggle.addClass('close');
} else {
menu.css('transform', 'rotate(' + parseInt(rot - 30) + 'deg)');
menu.css('webkitTransform', 'rotate(' + parseInt(rot - 30) + 'deg)');
toggle.parent().removeClass('ss_active');
toggle.removeClass('close');
}
$(this).data('rot', rot);
});
menu.on('transitionend webkitTransitionEnd oTransitionEnd', function () {
if (rot / 180 % 2 == 0) {
$("#share-menu i.fa").addClass('bounce');
} else {
$("#share-menu i.fa").removeClass('bounce');
}
});
}
if (shows.indexOf(1) >= 0) {
$('ul.fixed-tool li.qr-li').show();
$("#qrBtn").on("click", function () {
if ($("#ss_toggle").hasClass("close")) {
$("#share-menu").css("transition", "none");
$("#ss_toggle").click();
}
if ($(".qrcontain").is(":hidden")) {
$(".qrcontain").removeClass("fadeOutLeft").addClass("fadeInLeft");
$(".qrcontain").show();
$("#qrBtn").addClass("opened");
} else {
$(".qrcontain").removeClass("fadeInLeft").addClass("fadeOutLeft");
$(".qrcontain").one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function () {
$(".qrcontain").hide();
});
$("#qrBtn").removeClass("opened");
}
$("#share-menu").css("transition", "all 1s ease 0s");
});
img = document.createElement("img");
img.src = logoPath;
img.onload = function () {
$("#qrcode").qrcode({
text: window.location.href,
size: "100",
ecLevel: 'H',
minVersion: 4,
mode: 4,
image: img,
mSize: 0.3
});
};
}
if (shows.indexOf(2) >= 0) {
$('ul.fixed-tool li.top-li').show();
$(window).scroll(function () {
var scrollTop = $(window).scrollTop();
if (scrollTop > 0) {
$("#scrollTop").show();
$(".qrcontain").css("top", "-57px");
$(".qrcontain .arrow").css("top", "52%");
} else {
$("#scrollTop").hide();
$(".qrcontain").css("top", "-107px");
$(".qrcontain .arrow").css("top", "86%");
}
});
$("#scrollTop a").on("click", function () {
$("html,body").animate({scrollTop: 0}, 800);
});
}
});

View File

@@ -0,0 +1,38 @@
{
"name": "bootstrap-table",
"homepage": "https://github.com/wenzhixin/bootstrap-table",
"authors": [
"zhixin <wenzhixin2010@gmail.com>"
],
"description": "An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features.",
"main": [
"src/bootstrap-table.js",
"src/bootstrap-table.css"
],
"keywords": [
"bootstrap",
"table",
"bootstrap table"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"docs",
"assets"
],
"version": "1.10.0",
"_release": "1.10.0",
"_resolution": {
"type": "version",
"tag": "1.10.0",
"commit": "11c7a2f4d12f82d881f7b8612163179df741d8f2"
},
"_source": "git://github.com/wenzhixin/bootstrap-table.git",
"_target": "^1.10.0",
"_originalSource": "bootstrap-table",
"_direct": true
}

View File

@@ -0,0 +1,356 @@
## ChangeLog
### 1.10.0
- [bug] Fixed #1619: sub-table checkbox selects all the table.
- [bug] Fixed icons for ability customizing.
- [bug] Fixed #1677: paginationSwitch for server-side.
- [bug] Fixed #1613: padding in footer.
- [bug] Fixed #1742: showRow & hideRow param checks.
- [bug] Fixed getItemField bug.
- [bug] Fixed #617: server side pagination uses `this.options.searchText`.
- [bug] Fixed class name does not apply to checkbox field bug.
- [bug] Fixed clear function and searchFormatter option of filter-control extension.
- [bug] Fixed year computation on cookie extension.
- [bug] Fixed ReorderRows init when reorderable is false.
- [bug] Fix #1660: removed powerpoint type of export extension.
- [enh] Added `title` attribute to pagination controls defining the page number.
- [enh] Added `escape` option.
- [enh] Added `searchOnEnterKey` option.
- [enh] Added `updateFormatText` method.
- [enh] Added a third parameter to `detailFormatter` method passing the jQuery element.
- [enh] Added new param for `updateCell` method to avoid table reinitialization.
- [enh] Removed outline of th.
- [enh] Added extension.json and composer.json files.
- [enh] Added alternative group-by extension.
- [enh] Added sticky-header extension.
- [enh] Added filterLocal option to filter-control extension.
- [enh] Enabled data attributes for editable column.
- [enh] Added IconSize option to export extension.
- [enh] Added tooltip for filter-control toolbar button.
### 1.9.1
- [bug] Removed no records events.
- [bug] Fixed cardView fieldIndex error.
- [bug] Fixed #1130: table-condensed is not working.
- [bug] Fixed #1482: export all server sidePagination bug(export extension).
- [bug] Fixed #1248: IE8 does not support indexOf function.
- [bug] Fixed #1491: (un)check event element argument missing.
- [bug] Fixed Italian translation.
- [bug] Unified naming of MS in type names(export extension).
- [bug] Fixed selectPage method fails(cookie extension).
- [bug] Add ja-JP and ms-MY translation for formatAllRows.
- [enh] UniqueId can also be stored in a row's data property.
- [enh] Use default settings when cookie settings don't exist(cookie extension).
- [enh] Expand `filterBy` to accept and array of values.
- [enh] Added `updateByUniqueId` method.
- [doc] Added `iconSize` docs.
### 1.9.0
- [enh] Update bootstrap-table-cookie.js.
- [enh] Use options for detailView's open/close icons.
- [enh] Added `refreshOptions` and `gtHiddenColumns` method.
- [enh] Added `datepicker` option to Filter Control.
- [bug] Fix #936 Sort carets should not be inline-styled by JS.
- [bug] Fix table header width bug when setting table to no bordered.
- [bug] Fix #938, fix #940: Multiple Sort and Hide/Show column.
- [bug] Fix #970: `click`and `dblclick` bug on no-rows table.
- [bug] Fix #967: unselected column while column sorted display error.
- [enh] Support title feature in cells.
- [enh] Improved cookie, mobile extension.
- [enh] Added group-by, angular extension.
- [enh] Added option for setting locale.
- [enh] Added `exportDataType` option for export extension.
- [enh] Add fa-IR, ca-ES, es-ES, et-EE and af-ZA locales.
- [enh] Supported complex header with `rowspans` and `colspans`.
- [enh] Added `searchFomatter` column option.
- [bug] Fixed ResetRow function and undefined column search bug.
- [bug] Fixed #639: footer resizing problem.
- [enh] Added resetSearch method to reset the search text.
- [enh] Supported flat json.
- [enh] Improved reorder-columns extension.
- [enh] Added multiple-search, accent-neutralise extension.
- [enh] Added fixed-columns extension.
- [enh] Added `$.fn.bootstrapTable.utils` tools.
- [enh] Added `expandRow` and `collapseRow` methods.
- [enh] Updated `showRow`, `hideRow` and `updateCell` methods.
- [bug] Fix #1390: radio maintainSelected bug.
- [bug] Fix #1421: checkBy filter enabled.
- [bug] Remove `bootstrap-table-all.js` and `bootstrap-table-all.min.js`.
### 1.8.1
- [enh] Accessing field name in formatter.
- [enh] Improve function option to support string format for example formatter.
- [enh] Added multiple sort extension.
- [enh] Improve filter control extension.
- [enh] Added jsdelivr CDN.
- [bug] Fix #912: Bug when switching to card view.
- [bug] Fix #914: extra empty toolbar div bug.
- [bug] Fix bootstrap-table-pt-PT.js typo.
### 1.8.0
- [enh] Added state saving for visible columns and the ability to use extension with multiple simultaneous tables.
- [enh] Added `ajax` option to replace jquery ajax method.
- [enh] Added `resetWidth` method to reset header and footer width.
- [enh] Added key-events, mobile, filter-control, reorder-columns, reorder-rows, resizable, natural-sorting, toolbar extensions, and update the extensions name.
- [enh] Added `onToggle`, `onCheckSome` and `onUncheckSome` events.
- [enh] Added `getScrollPosition`, `removeAll`, `removeByUniqueId` methods.
- [bug] Fix double header bug after table show from hidden.
- [bug] Fix #279: scrollWidth bug.
- [enh] `getData` method support to get the current page data.
- [enh] Added 'getAllSelections' method to get checked rows across all pages.
- [enh] Added `ro-RO` locale.
- [enh] Added `table-no-bordered` class to remove table-bordered style.
- [enh] Added `bootstrap-table-all.js` and `bootstrap-table-locale-all.js` files to dist.
- [enh] Added detail view feature.
- [enh] Added `updateCell` method.
- [enh] Added `onClickCell` and `onDblClickCell` events.
- [bug] Fix #672: Column Fixed Width in Percentage bug.
- [bug] Fix row state field value bug when there are disabled rows.
- [bug] Fix #762: save tr's data-* attributes.
- [bug] Fix #823, #850: break rowspan bug, data-attribute bug.
### 1.7.0
- [enh] Add `showFooter`, `keyEvents`, `searchText` and `uniqueId` options.
- [enh] Add `cardVisible` column options.
- [enh] Add `checkBy` and `uncheckBy`, `showRow` and `hideRow` and `getRowsHidden` methods.
- [enh] Add nb-NO, ar-SA, es-MX, ka-GE locales.
- [enh] Add cookie, resizable, natural-sorting, toolbar extensions.
- [enh] Add exportOptions to export extension.
- [enh] Fix #263: prepend method support object and array.
- [enh] Card View support checkbox and radio.
- [bug] Fix Card View events bug.
- [enh] Keep all `data-*` attributes when transform from normal table.
- [enh] Load method support fixedScroll param.
- [enh] Added 'all' option in pagination.
- [enh] Added pagination detail align.
### 1.6.0
- [bug] Fix queryParams bug when use `sidePagination='server'`.
- [enh] Add uk-UA, sv-SE, pt-PT, ms-MY, ja-JP locales.
- [enh] Add `searchTimeOut` option.
- [bug] Fix #220: state column hideColumn bug.
- [bug] Fix #221: cellStyle bug.
- [enh] Add `iconsPrefix` and `icons` options to support custom icons.
- [enh] Add i18n support for docs.
- [enh] Allow `query` params to be specified during refresh.
- [bug] Fix bug of ellipsis string.
- [bug] Fix pageList smartDisplay.
- [bug] Fix #188: Export Button is not shown only use `showExport=true`.
- [bug] Fix page-change event params bug.
- [enh] Add limit and offset params only if pagination is activated.
- [enh] Add `ajaxOptions` option to custom $.ajax options.
- [enh] Add a toggle pagination toolbar button.
- [enh] Add `iconSize` option.
- [enh] Add `buttonsAlign` option and update `toolbarAlign` option.
- [enh] Add `prepend`, `insertRow` and `toggleView` methods.
- [enh] Add `editable-save.bs.table` event to editatble extension.
- [enh] #431: load method support pagination.
### 1.5.0
- [bug] Fix #144: `onCheck` and `onUncheck` events are reversed when using `clickToSelect` option. (jQuery 1.7.2 bug).
- [bug] Fix IE browser display header bug when use `mergeCells` method.
- [bug] Fix #269: array as row bug.
- [bug] Fix #314: `rowStyle` bug.
- [enh] Add de-DE, hu-HU, sk-SK locales.
- [enh] Fix #261: add namespace to `.table` style.
- [bug] Fix #160, #323: operate events don't work in card view.
- [enh] Add `filterBy`, `scrollTo`, `prevPage` and `nextPage`, `check` and `uncheck` methods.
- [enh] Add `onPreBody` and `onPostBody` events.
- [enh] Add `searchable` column option.
- [enh] Fix #59: support load multiple locale files.
- [enh] Modify the scope of the column events.
- [enh] Improve editable extension.
### 1.4.0
- [enh] Fix #119, #123: Save all `id` and `class` of `tr` and `td` for html table.
- [enh] Fix #149: Hide empty data on Card view.
- [enh] Fix #131: Add `onPageChange` event.
- [enh] Add `onSearch` event.
- [enh] Apply `width` column option to row style.
- [enh] Add bootstrap-table-filter extension.
- [enh] Add cs-CZ, es-CR, es-NI, pl-PL, ur-PK, ko-KR, th-TH locales.
- [bug] Fix `minimumCountColumns` option init error.
- [bug] Fix #161: `undefined` or `null` string sort bug.
- [bug] Fix #171: IE disabled button can be clicked bug.
- [bug] Fix #185: Reset the page to the first page when changing the url with `refresh` method.
- [bug] Fix #202: updateRow method keep the scroll position.
- [enh] Add `smartDisplay` option.
- [enh] Add `searchAlign` and `toolbarAlign` options.
- [enh] Fix #193: Add `dataType` option.
- [enh] Add flatJSON and editable extensions.
- [enh] Add `rowAttributes` option.
- [enh] Update documentation.
### 1.3.0
- [enh] Take `showHeader` option effect to the card view.
- [enh] Rename and update locale files.
- [bug] Fix #102: Wrong `options.columns` initialization.
- [enh] Fix #121: Add extensions for bootstrap table.
- [bug] Fix #138: IE8 search data and remove method error.
- [bug] Fix bug: sorter and check all do not work in some case.
- [enh] Add `bootstrap-table-nl-NL.js` and `bootstrap-table-el-GR.js`.
- [enh] Support search without data-field set, trim search input.
- [enh] Fix #81: Allow the `class` to be applied to the radio or checkbox row.
- [bug] Fix #135, #142: Search use formatted data.
- [enh] Verify search text before send queryParams.
- [bug] Fix #148: column events support namespace.
- [enh] Support to disable radio or checkbox column by formatter.
### 1.2.4
* [enh] Fix #23: Add css and classes parameters to column cell.
* [enh] Fix #64: Add support for change remote url.
* [enh] Fix #112: update the `refresh` method.
* [bug] Fix #113: Using radio type and cardView error.
* [enh] Fix #117: Add `updateRow` method.
* [enh] Fix #96, #103: apply `class` option to td elements.
* [enh] Fix #97: add `sortable` class to header cells instead of `cursor: pointer`.
* [enh] Fix #124: change `queryParams` and `queryParamsType` default option.
* [enh] Remove the `eval` method.
* [enh] Add `bootstrap-table-it-IT.js` locale.
### 1.2.3
* [bug] Fix the selected row class reset after toggle column bug.
* [bug] Fix #86: invisible column are still searchable.
* [bug] Fix search result error when toggle column display.
* [enh] Add `clickToSelect` to columns.
* [bug] Fix click-row event bug.
* [enh] When field is undefined, use index instead.
* [enh] Add `cache` option for AJAX calls.
* [enh] Improve zh-TW translation.
* [enh] #82: Add `getData` method.
* [enh] #82: Add `remove` method.
### 1.2.2
* Fix #68: Add `showColumn`/`hideColumn` methods.
* Fix #69: Add `bootstrap-table-es_AR.js` locale.
* Fix #88: Add `bootstrap-table-fr_BE.js` locale.
* Fix #85: Select row and add row class.
* Add `halign` column option.
### 1.2.1
* Fix #56: Pagination issue in bootstrap 2.3.
* Fix #76: After refreshing table data, search no longer works.
* Fix #77: After searching and then clearing the search field, table is no longer sortable.
* Add `sortable` option, `false` to disable sortable of all columns.
* Support localization for docs.
### 1.2.0
* Fix bootstrap 2 table border bug.
* Fix loading and not found record display bug.
* Update ```minimunCountColumns``` option to ```minimumCountColumns```.
* Fix sort order bug.
### 1.1.5
* Fix the bottom border bug on Chrome.
* Add horizontal scroll for support.
* Fix scroll header width error.
* Add ```showRefresh``` and ```showToggle``` options.
### 1.1.4
* Fix ```destroy``` method bug.
* Initialize table data from HTML.
* Fix the hidden table reset header bug.
### 1.1.3
* Add ```events``` column option.
* Add ```checkboxHeader``` option.
* Add ```queryParamsType``` option.
* Fix ie class bug, and fix duplicated data error.
### 1.1.2
* Add switchable column option.
* Add ```data-toggle``` attribute.
* Add support for number search.
* Use html function instead of text in header th.
### 1.1.1
* Remove ```bootstrapVerion``` option.
* Add ```data-page-list``` attribute.
* Fix search data error.
* Non case sensitive search in client side.
* Added support for Danish translation.
### 1.1.0
* Fix old firefox browser display error.
* Add minimunCountColumns option.
* Update the table body header implementation and resetView method.
* Remove bootstrapVersion option.
* Fix search data error.
### 1.0.6
* Add jQuery events.
* Add ```onDblClickRow``` event and ```onAll``` event.
* Add ```singleSelect``` option.
* Search improvent: add a timeout and trigger the search event when the text has changed to improve the search.
* Scroll to top after data loaded.
* Add ```toolbar``` option.
* Add ```rowStyle``` option.
* Add ```bootstrapVersion``` option.
### 1.0.5
* Update the pagination list position.
* Update ```queryParams``` option.
* Add ```contentType``` and ```onBeforeLoad``` options.
* Add server side pagination(```pageSize, pageNumber, searchText, sortName, sortOrder```).
* Add ```COLUMN_DEFAULTS```.
* Add ```refresh``` method.
* Add ```index``` argument in ```formatter``` function.
* Update card view display.
### 1.0.4
* Add ```showLoading``` and ```hideLoading``` methods.
* Add ```onLoadSuccess``` and ```onLoadError``` events.
* Add ```clickToSelect``` option.
* Add ```cardView``` option.
* Add loading with ```formatLoadingMessage``` function.
* Add ```idField``` option.
### 1.0.3
* Update fixed headers.
* Add zh-TW locale file.
* Add ```showColumns``` option and ```visible``` column option.
* Update ```hideHeader``` option to ```showHeader```.
* Add ```formatNoMatches``` locale function.
* Add table events.
### 1.0.2
* Add i18n support.
* Add ```selectItemName``` option.
* Update the ```pageList``` default.
* Add ```search``` option.
* Add ```destroy``` method.
* Add page list support.
### 1.0.1
* Add ```pagination``` support.
### 1.0.0
* Initial release

View File

@@ -0,0 +1,206 @@
# Contributing to Bootstrap Table
Looking to contribute something to Bootstrap Table?
**Here's how you can help.**
Please take a moment to review this document in order to make the contribution
process easy and effective for everyone involved.
Following these guidelines helps to communicate that you respect the time of
the developers managing and developing this open source project. In return,
they should reciprocate that respect in addressing your issue or assessing
patches and features.
## Using the issue tracker
The [issue tracker](https://github.com/wenzhixin/bootstrap-table/issues) is
the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests)
and [submitting pull requests](#pull-requests), but please respect the following
restrictions:
* Please **do not** use the issue tracker for personal support requests. Stack
Overflow ([`bootstrap-table`](http://stackoverflow.com/questions/tagged/bootstrap-table) tag is better place to get help.
* Please **do not** derail or troll issues. Keep the discussion on topic and
respect the opinions of others.
* Please **do not** open issues or pull requests regarding the code in [`bootstrap-table-examples`](https://github.com/wenzhixin/bootstrap-table-examples) and [`extensions plugin dependence`](https://github.com/wenzhixin/bootstrap-table/tree/develop/src/extensions) (open them in their respective repositories), the dependence list:
* Table Editable: [x-editable](https://github.com/vitalets/x-editable)
* Table Export: [tableExport.jquery.plugin](https://github.com/hhurz/tableExport.jquery.plugin)
* Table Filter: [bootstrap-table-filter](https://github.com/lukaskral/bootstrap-table-filter)
* Table flat-json: [bootstrap-table-flat-json](https://github.com/djhvscf/bootstrap-table-flatJSON)
* Table Reorder: [jquery-ui](https://code.jquery.com/ui/) and [dragTable](https://github.com/akottr/dragtable/)
* Table Resizable: [colResizable](https://github.com/alvaro-prieto/colResizable)
## Issues and labels
Our bug tracker utilizes several labels to help organize and identify issues. Here's what they represent and how we use them:
- `awaiting reply` - Issues that are awaiting reply, will be closed if there is no any response in 7 days.
- `browser bug` - Issues that are reported to us, but actually are the result of a browser-specific bug. These are diagnosed with reduced test cases and result in an issue opened on that browser's own bug tracker.
- `confirmed` - Issues that have been confirmed with a reduced test case and identify a bug in Bootstrap Table.
- `css` - Issues stemming from our compiled CSS or source CSS files.
- `docs` - Issues for improving or updating our documentation.
- `extension` - Issues for adding or updating our extension.
- `feature` - Issues asking for a new feature to be added, or an existing one to be extended or modified.
- `grunt` - Issues with our included JavaScript-based Gruntfile, which is used to run all our tests, concatenate and compile source files, and more.
- `help wanted` - Issues we need or would love help from the community to resolve.
- `js` - Issues stemming from our compiled or source JavaScript files.
- `resource` - Issues with helpful resources to improve Bootstrap Table.
For a complete look at our labels, see the [project labels page](https://github.com/wenzhixin/bootstrap-table/labels).
## Bug reports
A bug is a _demonstrable problem_ that is caused by the code in the repository.
Good bug reports are extremely helpful, so thanks!
Guidelines for bug reports:
0. **Validate and lint your code** &mdash; [validate your HTML](http://html5.validator.nu)
and [lint your HTML](https://github.com/twbs/bootlint) to ensure your
problem isn't caused by a simple error in your own code.
1. **Use the GitHub issue search** &mdash; check if the issue has already been
reported.
2. **Check if the issue has been fixed** &mdash; try to reproduce it using the
latest `master` or development branch in the repository.
3. **Isolate the problem** &mdash; ideally create a live example.
The web tool [jsfiddle](http://jsfiddle.net/) is a very helpful for this. Consider to use these templates:
* [Table from html](http://jsfiddle.net/wenyi/e3nk137y/11/light/)
* [Table from data](http://jsfiddle.net/wenyi/e3nk137y/13/light/)
* [Table from url](http://jsfiddle.net/wenyi/e3nk137y/14/light/)
* Other templates can also be found at [jsFiddle Bootstrap](http://bootstrap-table.wenzhixin.net.cn/examples/#basic)
A good bug report shouldn't leave others needing to chase you up for more
information. Please try to be as detailed as possible in your report. What is
your environment? What steps will reproduce the issue? What browser(s) and OS
experience the problem? Do other browsers show the bug differently? What
would you expect to be the outcome? All these details will help people to fix
any potential bugs.
Example:
> Short and descriptive example bug report title
>
> A summary of the issue and the browser/OS environment in which it occurs. If
> suitable, include the steps required to reproduce the bug.
>
> 1. This is the first step
> 2. This is the second step
> 3. Further steps, etc.
>
> `<url>` - a link to the reduced test case
>
> Any other information you want to share that is relevant to the issue being
> reported. This might include the lines of code that you have identified as
> causing the bug, and potential solutions (and your opinions on their
> merits).
## Feature requests
Feature requests are welcome. But take a moment to find out whether your idea
fits with the scope and aims of the project. It's up to *you* to make a strong
case to convince the project's developers of the merits of this feature. Please
provide as much detail and context as possible.
## Pull requests
Good pull requests—patches, improvements, new features—are a fantastic
help. They should remain focused in scope and avoid containing unrelated
commits.
**Please ask first** before embarking on any significant pull request (e.g.
implementing features, refactoring code, porting to a different language),
otherwise you risk spending a lot of time working on something that the
project's developers might not want to merge into the project.
Please adhere to the [coding guidelines](#code-guidelines) used throughout the
project (indentation, accurate comments, etc.) and any other requirements
(such as test coverage).
**Do not edit files of `dist` directly!** Those files are automatically generated. You should edit the
source files in [`/src/`](https://github.com/wenzhixin/bootstrap-table/tree/develop/src) instead.
Similarly, when contributing to Bootstrap's documentation, you should edit the
documentation source files in
[the `/docs/` directory of the `develop` branch](https://github.com/wenzhixin/bootstrap-table/tree/develop/docs).
Adhering to the following process is the best way to get your work
included in the project:
1. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork,
and configure the remotes:
```bash
# Clone your fork of the repo into the current directory
git clone https://github.com/<your-username>/bootstrap-table.git
# Navigate to the newly cloned directory
cd bootstrap-table
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/wenzhixin/bootstrap-table.git
```
2. If you cloned a while ago, get the latest changes from upstream:
```bash
git checkout develop
git pull upstream develop
```
3. Create a new topic branch (off the main project development branch) to
contain your feature, change, or fix:
```bash
git checkout -b <topic-branch-name>
```
4. Commit your changes in logical chunks. Please adhere to these [git commit
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
or your code is unlikely be merged into the main project. Use Git's
[interactive rebase](https://help.github.com/articles/about-git-rebase/)
feature to tidy up your commits before making them public.
5. Locally merge (or rebase) the upstream development branch into your topic branch:
```bash
git pull [--rebase] upstream develop
```
6. Push your topic branch up to your fork:
```bash
git push origin <topic-branch-name>
```
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
with a clear title and description against the `develop` branch.
**IMPORTANT**: By submitting a patch, you agree to allow the project owners to
license your work under the terms of the [MIT License](LICENSE) (if it
includes code changes) and under the terms of the
[Creative Commons Attribution 3.0 Unported License](docs/LICENSE)
(if it includes documentation changes).
## Code guidelines
- Readability
- Need semicolons
- 4 spaces (no tabs)
- strict mode
- "Attractive"
## License
By contributing your code, you agree to license your contribution under the [MIT License](LICENSE).
By contributing to the documentation, you agree to license your contribution under the [Creative Commons Attribution 3.0 Unported License](docs/LICENSE).

View File

@@ -0,0 +1,41 @@
## List of donators
* Richard C Jordan - $35
* Janet Moery - $5
* Rene Halskov - $10
* Angel Arambula Garcia - $5
* David Graham - $5
* Paul Abbott - $20
* Philip Tepfer - $10
* Marcus Eddy - $5
* Keith Rockhold - $50
* Ramon Sosa Diaz - $10
* Goncalo Cordeiro - $25
* Marzena Wspanialy - $10
* Nicolas Pascual - $10
* Hassan Ejaz - $10
* Frank Hines - $100
* Luis Triana Vega - $10
* PROMOTUX DI FRANCESCO MELONI E C. S.N.C. - $15
* Emmanuel Kielichowski - $15
* 우공이산 우공이산 - $50
* Empirica srl - $15
* Hassan Gareballa - $10
* Jihwang Yi - $10
## 支付宝
* 萃华10.18元
* 小马哥5元
*20元
* 懒虫8.8元
* rainc50元
*10元
* 大个子50元
* 拓海真一100元
* IO芒果7元
## 微信
*50元
* 一牛九毛100元

View File

@@ -0,0 +1,90 @@
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('bootstrap-table.jquery.json'),
banner: '/*\n' +
'* <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage : "" %>\n' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
'* Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' +
'*/\n',
// Task configuration.
clean: ['dist', 'docs/dist'],
concat: {
//basic_target: {
// src: ['src/<%= pkg.name %>.js', 'src/extensions/**/*.js'],
// dest: 'dist/<%= pkg.name %>-all.js'
//},
locale_target: {
src: ['src/locale/**/*.js'],
dest: 'dist/<%= pkg.name %>-locale-all.js'
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
basic_target: {
files: {
'dist/<%= pkg.name %>.min.js': ['src/<%=pkg.name %>.js'],
//'dist/<%= pkg.name %>-all.min.js': ['dist/<%=pkg.name %>-all.js'],
'dist/<%= pkg.name %>-locale-all.min.js': ['dist/<%=pkg.name %>-locale-all.js']
}
},
locale_target: {
files: [{
expand: true,
cwd: 'src/locale',
src: '**/*.js',
dest: 'dist/locale',
ext: '.min.js' // replace .js to .min.js
}]
},
extensions_target: {
files: [{
expand: true,
cwd: 'src/extensions',
src: '**/*.js',
dest: 'dist/extensions',
ext: '.min.js' // replace .js to .min.js
}]
}
},
cssmin: {
add_banner: {
options: {
banner: '<%= banner %>'
},
files: {
'dist/<%= pkg.name %>.min.css': ['src/<%=pkg.name %>.css']
}
}
},
copy: {
source: {
cwd: 'src', // set working folder / root to copy
src: ['**/*.js', '**/*.css'], // copy all files and subfolders
dest: 'dist', // destination folder
expand: true // required when using cwd
},
files: {
cwd: 'dist', // set working folder / root to copy
src: '**/*', // copy all files and subfolders
dest: 'docs/dist', // destination folder
expand: true // required when using cwd
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', ['clean', 'concat', 'uglify', 'cssmin', 'copy']);
};

View File

@@ -0,0 +1,21 @@
(The MIT License)
Copyright (c) 2012-2016 Zhixin Wen <wenzhixin2010@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,103 @@
# [Bootstrap Table](http://bootstrap-table.wenzhixin.net.cn)
[![Build Status](https://travis-ci.org/wenzhixin/bootstrap-table.svg)](https://travis-ci.org/wenzhixin/bootstrap-table)
[![GitHub version](https://badge.fury.io/gh/wenzhixin%2Fbootstrap-table.svg)](http://badge.fury.io/gh/wenzhixin%2Fbootstrap-table)
[![Bower version](https://badge.fury.io/bo/bootstrap-table.svg)](http://badge.fury.io/bo/bootstrap-table)
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDHP676FQDUT6)
An extended Bootstrap table with radio, checkbox, sort, pagination, extensions and other added features.
To get started, check out:
* [Docs](http://bootstrap-table.wenzhixin.net.cn)
* [Examples](https://github.com/wenzhixin/bootstrap-table-examples)
* [Questions/Helps](http://stackoverflow.com/questions/tagged/bootstrap-table)
* [问题/帮助](http://segmentfault.com/t/bootstrap-table)
[**List of donators**](https://github.com/wenzhixin/bootstrap-table/blob/master/DONATORS.md)
## LICENSE
**NOTE:** Bootstrap Table is licensed under the [The MIT License](https://github.com/wenzhixin/bootstrap-table/blob/master/LICENSE). Completely free, you can arbitrarily use and modify this plugin. If this plugin is useful to you, you can **Star** this repo, your support is my biggest motive force, thanks.
## Features
* Created for Bootstrap 3 (Bootstrap 2 supported)
* Responsive web design
* Scrollable Table with fixed headers
* Fully configurable
* Via data attributes
* Show/Hide columns
* Show/Hide headers
* Show/Hide footers
* Get data in JSON format using AJAX
* Simple column sorting with a click
* Format column
* Single or multiple row selection
* Powerful pagination
* Card view
* Detail view
* Localization
* Extensions
## How to get it
### Manual download
Use [Releases page](https://github.com/wenzhixin/bootstrap-table/releases) or [the source](https://github.com/wenzhixin/bootstrap-table/archive/master.zip).
### Bower
```
bower install bootstrap-table
```
### Npm
```
npm install bootstrap-table
```
### CDN
You can source bootstrap-table directly from a CDN like [CDNJS](http://www.cdnjs.com/libraries/bootstrap-table) or [bootcss](http://open.bootcss.com/bootstrap-table/) or [jsdelivr](http://www.jsdelivr.com/#!bootstrap.table).
## Contributing
For feature requests, bug reports or submitting pull requests, please ensure you first read [CONTRIBUTING.md](https://github.com/wenzhixin/bootstrap-table/blob/master/CONTRIBUTING.md).
## Reporting Issues
As stated above, please read [CONTRIBUTING.md](https://github.com/wenzhixin/bootstrap-table/blob/master/CONTRIBUTING.md), especially [Bug Reports](https://github.com/wenzhixin/bootstrap-table/blob/master/CONTRIBUTING.md#bug-reports)
And as stated there, please provide jsFiddle when creating issues!
It's really saves much time.
You can also use these for templates:
[jsFiddle Bootstrap Table](http://bootstrap-table.wenzhixin.net.cn/examples/#basic)
Your feedback is very appreciated!
## Acknowledgements
Thanks to everyone who have given feedback and submitted pull requests. A list of all the contributors can be found [here](https://github.com/wenzhixin/bootstrap-table/graphs/contributors).
## Release History
Look at the [Change Log](https://github.com/wenzhixin/bootstrap-table/blob/master/CHANGELOG.md)
## Local build
To build bootstrap-table locally please run:
```
grunt build
```
Result will appear in `dist` directory.

View File

@@ -0,0 +1,31 @@
# Dependencies
markdown: redcarpet
redcarpet:
extensions:
- fenced_code_blocks
- tables
- autolink
highlighter: rouge
# Permalinks
permalink: pretty
# Server
source: docs
destination: _gh_pages
host: 0.0.0.0
port: 4000
url: http://bootstrap-table.wenzhixin.net.cn
encoding: UTF-8
# Languages
languages: ["en", "zh-cn", "es"]
languages_string: ["English", "简体中文", "Español"]
# Custom vars
current_version: 1.10.0
repo: https://github.com/wenzhixin/bootstrap-table
website: http://wenzhixin.net.cn
repos: http://repos.wenzhixin.net.cn
email: wenzhixin2010@gmail.com
master_zip: https://github.com/wenzhixin/bootstrap-table/archive/master.zip

View File

@@ -0,0 +1,28 @@
{
"name": "bootstrap-table",
"version": "1.10.0",
"title": "Bootstrap Table",
"description": "An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features.",
"author": {
"name": "zhixin wen",
"email": "wenzhixin2010@gmail.com",
"url": "http://wenzhixin.net.cn/"
},
"licenses": [
{
"type": "MIT License",
"url": "http://opensource.org/licenses/MIT"
}
],
"dependencies": {
"jquery": ">=1.7"
},
"keywords": ["bootstrap.table"],
"homepage": "https://github.com/wenzhixin/bootstrap-table",
"demo": "http://bootstrap-table.wenzhixin.net.cn",
"bugs": {
"url": "https://github.com/wenzhixin/bootstrap-table/issues"
},
"docs": "https://github.com/wenzhixin/bootstrap-table",
"download": "https://github.com/wenzhixin/bootstrap-table/archive/master.zip"
}

View File

@@ -0,0 +1,27 @@
{
"name": "bootstrap-table",
"homepage": "https://github.com/wenzhixin/bootstrap-table",
"authors": [
"zhixin <wenzhixin2010@gmail.com>"
],
"description": "An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features.",
"main": [
"src/bootstrap-table.js",
"src/bootstrap-table.css"
],
"keywords": [
"bootstrap",
"table",
"bootstrap table"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"docs",
"assets"
]
}

View File

@@ -0,0 +1,17 @@
{
"name": "wenzhixin/bootstrap-table",
"description": "An extended Bootstrap table with radio, checkbox, sort, pagination and other features.",
"keywords": ["bootstrap","table","tablesort","pagination"],
"type": "component",
"homepage": "https://github.com/wenzhixin/bootstrap-table",
"license": "MIT",
"require": {
"twitter/bootstrap": ">=2.3.0"
},
"authors": [
{
"name": "wenzhixin2010",
"email": "wenzhixin2010@gmail.com"
}
]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,302 @@
/**
* @author zhixin wen <wenzhixin2010@gmail.com>
* version: 1.10.0
* https://github.com/wenzhixin/bootstrap-table/
*/
.bootstrap-table .table {
margin-bottom: 0 !important;
border-bottom: 1px solid #dddddd;
border-collapse: collapse !important;
border-radius: 1px;
}
.bootstrap-table .table:not(.table-condensed),
.bootstrap-table .table:not(.table-condensed) > tbody > tr > th,
.bootstrap-table .table:not(.table-condensed) > tfoot > tr > th,
.bootstrap-table .table:not(.table-condensed) > thead > tr > td,
.bootstrap-table .table:not(.table-condensed) > tbody > tr > td,
.bootstrap-table .table:not(.table-condensed) > tfoot > tr > td {
padding: 8px;
}
.bootstrap-table .table.table-no-bordered > thead > tr > th,
.bootstrap-table .table.table-no-bordered > tbody > tr > td {
border-right: 2px solid transparent;
}
.fixed-table-container {
position: relative;
clear: both;
border: 1px solid #dddddd;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
}
.fixed-table-container.table-no-bordered {
border: 1px solid transparent;
}
.fixed-table-footer,
.fixed-table-header {
overflow: hidden;
}
.fixed-table-footer {
border-top: 1px solid #dddddd;
}
.fixed-table-body {
overflow-x: auto;
overflow-y: auto;
height: 100%;
}
.fixed-table-container table {
width: 100%;
}
.fixed-table-container thead th {
height: 0;
padding: 0;
margin: 0;
border-left: 1px solid #dddddd;
}
.fixed-table-container thead th:focus {
outline: 0 solid transparent;
}
.fixed-table-container thead th:first-child {
border-left: none;
border-top-left-radius: 4px;
-webkit-border-top-left-radius: 4px;
-moz-border-radius-topleft: 4px;
}
.fixed-table-container thead th .th-inner,
.fixed-table-container tbody td .th-inner {
padding: 8px;
line-height: 24px;
vertical-align: top;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.fixed-table-container thead th .sortable {
cursor: pointer;
background-position: right;
background-repeat: no-repeat;
padding-right: 30px;
}
.fixed-table-container thead th .both {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC');
}
.fixed-table-container thead th .asc {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==');
}
.fixed-table-container thead th .desc {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= ');
}
.fixed-table-container th.detail {
width: 30px;
}
.fixed-table-container tbody td {
border-left: 1px solid #dddddd;
}
.fixed-table-container tbody tr:first-child td {
border-top: none;
}
.fixed-table-container tbody td:first-child {
border-left: none;
}
/* the same color with .active */
.fixed-table-container tbody .selected td {
background-color: #f5f5f5;
}
.fixed-table-container .bs-checkbox {
text-align: center;
}
.fixed-table-container .bs-checkbox .th-inner {
padding: 8px 0;
}
.fixed-table-container input[type="radio"],
.fixed-table-container input[type="checkbox"] {
margin: 0 auto !important;
}
.fixed-table-container .no-records-found {
text-align: center;
}
.fixed-table-pagination div.pagination,
.fixed-table-pagination .pagination-detail {
margin-top: 10px;
margin-bottom: 10px;
}
.fixed-table-pagination div.pagination .pagination {
margin: 0;
}
.fixed-table-pagination .pagination a {
padding: 6px 12px;
line-height: 1.428571429;
}
.fixed-table-pagination .pagination-info {
line-height: 34px;
margin-right: 5px;
}
.fixed-table-pagination .btn-group {
position: relative;
display: inline-block;
vertical-align: middle;
}
.fixed-table-pagination .dropup .dropdown-menu {
margin-bottom: 0;
}
.fixed-table-pagination .page-list {
display: inline-block;
}
.fixed-table-toolbar .columns-left {
margin-right: 5px;
}
.fixed-table-toolbar .columns-right {
margin-left: 5px;
}
.fixed-table-toolbar .columns label {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.428571429;
}
.fixed-table-toolbar .bars,
.fixed-table-toolbar .search,
.fixed-table-toolbar .columns {
position: relative;
margin-top: 10px;
margin-bottom: 10px;
line-height: 34px;
}
.fixed-table-pagination li.disabled a {
pointer-events: none;
cursor: default;
}
.fixed-table-loading {
display: none;
position: absolute;
top: 42px;
right: 0;
bottom: 0;
left: 0;
z-index: 99;
background-color: #fff;
text-align: center;
}
.fixed-table-body .card-view .title {
font-weight: bold;
display: inline-block;
min-width: 30%;
text-align: left !important;
}
/* support bootstrap 2 */
.fixed-table-body thead th .th-inner {
box-sizing: border-box;
}
.table th, .table td {
vertical-align: middle;
box-sizing: border-box;
}
.fixed-table-toolbar .dropdown-menu {
text-align: left;
max-height: 300px;
overflow: auto;
}
.fixed-table-toolbar .btn-group > .btn-group {
display: inline-block;
margin-left: -1px !important;
}
.fixed-table-toolbar .btn-group > .btn-group > .btn {
border-radius: 0;
}
.fixed-table-toolbar .btn-group > .btn-group:first-child > .btn {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.fixed-table-toolbar .btn-group > .btn-group:last-child > .btn {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.bootstrap-table .table > thead > tr > th {
vertical-align: bottom;
border-bottom: 1px solid #ddd;
}
/* support bootstrap 3 */
.bootstrap-table .table thead > tr > th {
padding: 0;
margin: 0;
}
.bootstrap-table .fixed-table-footer tbody > tr > td {
padding: 0 !important;
}
.bootstrap-table .fixed-table-footer .table {
border-bottom: none;
border-radius: 0;
padding: 0 !important;
}
.pull-right .dropdown-menu {
right: 0;
left: auto;
}
/* calculate scrollbar width */
p.fixed-table-scroll-inner {
width: 100%;
height: 200px;
}
div.fixed-table-scroll-outer {
top: 0;
left: 0;
visibility: hidden;
width: 200px;
height: 150px;
overflow: hidden;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,182 @@
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.0.0
*/
!function ($) {
'use strict';
var diacriticsMap = {};
var defaultAccentsDiacritics = [
{'base':'A', 'letters':'\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F'},
{'base':'AA','letters':'\uA732'},
{'base':'AE','letters':'\u00C6\u01FC\u01E2'},
{'base':'AO','letters':'\uA734'},
{'base':'AU','letters':'\uA736'},
{'base':'AV','letters':'\uA738\uA73A'},
{'base':'AY','letters':'\uA73C'},
{'base':'B', 'letters':'\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181'},
{'base':'C', 'letters':'\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E'},
{'base':'D', 'letters':'\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779'},
{'base':'DZ','letters':'\u01F1\u01C4'},
{'base':'Dz','letters':'\u01F2\u01C5'},
{'base':'E', 'letters':'\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E'},
{'base':'F', 'letters':'\u0046\u24BB\uFF26\u1E1E\u0191\uA77B'},
{'base':'G', 'letters':'\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E'},
{'base':'H', 'letters':'\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D'},
{'base':'I', 'letters':'\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197'},
{'base':'J', 'letters':'\u004A\u24BF\uFF2A\u0134\u0248'},
{'base':'K', 'letters':'\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2'},
{'base':'L', 'letters':'\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780'},
{'base':'LJ','letters':'\u01C7'},
{'base':'Lj','letters':'\u01C8'},
{'base':'M', 'letters':'\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C'},
{'base':'N', 'letters':'\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4'},
{'base':'NJ','letters':'\u01CA'},
{'base':'Nj','letters':'\u01CB'},
{'base':'O', 'letters':'\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C'},
{'base':'OI','letters':'\u01A2'},
{'base':'OO','letters':'\uA74E'},
{'base':'OU','letters':'\u0222'},
{'base':'OE','letters':'\u008C\u0152'},
{'base':'oe','letters':'\u009C\u0153'},
{'base':'P', 'letters':'\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754'},
{'base':'Q', 'letters':'\u0051\u24C6\uFF31\uA756\uA758\u024A'},
{'base':'R', 'letters':'\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782'},
{'base':'S', 'letters':'\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784'},
{'base':'T', 'letters':'\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786'},
{'base':'TZ','letters':'\uA728'},
{'base':'U', 'letters':'\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244'},
{'base':'V', 'letters':'\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245'},
{'base':'VY','letters':'\uA760'},
{'base':'W', 'letters':'\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72'},
{'base':'X', 'letters':'\u0058\u24CD\uFF38\u1E8A\u1E8C'},
{'base':'Y', 'letters':'\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE'},
{'base':'Z', 'letters':'\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762'},
{'base':'a', 'letters':'\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250'},
{'base':'aa','letters':'\uA733'},
{'base':'ae','letters':'\u00E6\u01FD\u01E3'},
{'base':'ao','letters':'\uA735'},
{'base':'au','letters':'\uA737'},
{'base':'av','letters':'\uA739\uA73B'},
{'base':'ay','letters':'\uA73D'},
{'base':'b', 'letters':'\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253'},
{'base':'c', 'letters':'\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184'},
{'base':'d', 'letters':'\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A'},
{'base':'dz','letters':'\u01F3\u01C6'},
{'base':'e', 'letters':'\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD'},
{'base':'f', 'letters':'\u0066\u24D5\uFF46\u1E1F\u0192\uA77C'},
{'base':'g', 'letters':'\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F'},
{'base':'h', 'letters':'\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265'},
{'base':'hv','letters':'\u0195'},
{'base':'i', 'letters':'\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131'},
{'base':'j', 'letters':'\u006A\u24D9\uFF4A\u0135\u01F0\u0249'},
{'base':'k', 'letters':'\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3'},
{'base':'l', 'letters':'\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747'},
{'base':'lj','letters':'\u01C9'},
{'base':'m', 'letters':'\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F'},
{'base':'n', 'letters':'\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5'},
{'base':'nj','letters':'\u01CC'},
{'base':'o', 'letters':'\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275'},
{'base':'oi','letters':'\u01A3'},
{'base':'ou','letters':'\u0223'},
{'base':'oo','letters':'\uA74F'},
{'base':'p','letters':'\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755'},
{'base':'q','letters':'\u0071\u24E0\uFF51\u024B\uA757\uA759'},
{'base':'r','letters':'\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783'},
{'base':'s','letters':'\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B'},
{'base':'t','letters':'\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787'},
{'base':'tz','letters':'\uA729'},
{'base':'u','letters': '\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289'},
{'base':'v','letters':'\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C'},
{'base':'vy','letters':'\uA761'},
{'base':'w','letters':'\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73'},
{'base':'x','letters':'\u0078\u24E7\uFF58\u1E8B\u1E8D'},
{'base':'y','letters':'\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF'},
{'base':'z','letters':'\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763'}
];
var initNeutraliser = function () {
for (var i=0; i < defaultAccentsDiacritics.length; i++){
var letters = defaultAccentsDiacritics[i].letters;
for (var j=0; j < letters.length ; j++){
diacriticsMap[letters[j]] = defaultAccentsDiacritics[i].base;
}
}
};
var removeDiacritics = function (str) {
return str.replace(/[^\u0000-\u007E]/g, function(a){
return diacriticsMap[a] || a;
});
};
$.extend($.fn.bootstrapTable.defaults, {
searchAccentNeutralise: false
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_init = BootstrapTable.prototype.init,
_initSearch = BootstrapTable.prototype.initSearch;
BootstrapTable.prototype.init = function () {
if (this.options.searchAccentNeutralise) {
initNeutraliser();
}
_init.apply(this, Array.prototype.slice.apply(arguments));
};
BootstrapTable.prototype.initSearch = function () {
var that = this;
if (this.options.sidePagination !== 'server') {
var s = this.searchText && this.searchText.toLowerCase();
var f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
// Check filter
this.data = f ? $.grep(this.options.data, function (item, i) {
for (var key in f) {
if (item[key] !== f[key]) {
return false;
}
}
return true;
}) : this.options.data;
this.data = s ? $.grep(this.data, function (item, i) {
for (var key in item) {
key = $.isNumeric(key) ? parseInt(key, 10) : key;
var value = item[key],
column = that.columns[$.fn.bootstrapTable.utils.getFieldIndex(that.columns, key)],
j = $.inArray(key, that.header.fields);
if (column && column.searchFormatter) {
value = $.fn.bootstrapTable.utils.calculateObjectValue(column,
that.header.formatters[j], [value, item, i], value);
}
var index = $.inArray(key, that.header.fields);
if (index !== -1 && that.header.searchables[index] && (typeof value === 'string' || typeof value === 'number')) {
if (that.options.searchAccentNeutralise) {
value = removeDiacritics(value);
s = removeDiacritics(s);
}
if (that.options.strictSearch) {
if ((value + '').toLowerCase() === s) {
return true;
}
} else {
if ((value + '').toLowerCase().indexOf(s) !== -1) {
return true;
}
}
}
}
return false;
}) : this.data;
}
};
}(jQuery);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,105 @@
// JavaScript source code
(function () {
if (typeof angular === 'undefined') {
return;
}
angular.module('bsTable', []).directive('bsTableControl', function () {
var CONTAINER_SELECTOR = '.bootstrap-table';
var SCROLLABLE_SELECTOR = '.fixed-table-body';
var SEARCH_SELECTOR = '.search input';
var bsTables = {};
function getBsTable (el) {
var result;
$.each(bsTables, function (id, bsTable) {
if (!bsTable.$el.closest(CONTAINER_SELECTOR).has(el).length) return;
result = bsTable;
return true;
});
return result;
}
$(window).resize(function () {
$.each(bsTables, function (id, bsTable) {
bsTable.$el.bootstrapTable('resetView');
});
});
function onScroll () {
var bsTable = this;
var state = bsTable.$s.bsTableControl.state;
bsTable.$s.$applyAsync(function () {
state.scroll = bsTable.$el.bootstrapTable('getScrollPosition');
});
}
$(document)
.on('post-header.bs.table', CONTAINER_SELECTOR+' table', function (evt) { // bootstrap-table calls .off('scroll') in initHeader so reattach here
var bsTable = getBsTable(evt.target);
if (!bsTable) return;
bsTable.$el
.closest(CONTAINER_SELECTOR)
.find(SCROLLABLE_SELECTOR)
.on('scroll', onScroll.bind(bsTable));
})
.on('sort.bs.table', CONTAINER_SELECTOR+' table', function (evt, sortName, sortOrder) {
var bsTable = getBsTable(evt.target);
if (!bsTable) return;
var state = bsTable.$s.bsTableControl.state;
bsTable.$s.$applyAsync(function () {
state.sortName = sortName;
state.sortOrder = sortOrder;
});
})
.on('page-change.bs.table', CONTAINER_SELECTOR+' table', function (evt, pageNumber, pageSize) {
var bsTable = getBsTable(evt.target);
if (!bsTable) return;
var state = bsTable.$s.bsTableControl.state;
bsTable.$s.$applyAsync(function () {
state.pageNumber = pageNumber;
state.pageSize = pageSize;
});
})
.on('search.bs.table', CONTAINER_SELECTOR+' table', function (evt, searchText) {
var bsTable = getBsTable(evt.target);
if (!bsTable) return;
var state = bsTable.$s.bsTableControl.state;
bsTable.$s.$applyAsync(function () {
state.searchText = searchText;
});
})
.on('focus blur', CONTAINER_SELECTOR+' '+SEARCH_SELECTOR, function (evt) {
var bsTable = getBsTable(evt.target);
if (!bsTable) return;
var state = bsTable.$s.bsTableControl.state;
bsTable.$s.$applyAsync(function () {
state.searchHasFocus = $(evt.target).is(':focus');
});
});
return {
restrict: 'EA',
scope: {bsTableControl: '='},
link: function ($s, $el) {
var bsTable = bsTables[$s.$id] = {$s: $s, $el: $el};
$s.instantiated = false;
$s.$watch('bsTableControl.options', function (options) {
if (!options) options = $s.bsTableControl.options = {};
var state = $s.bsTableControl.state || {};
if ($s.instantiated) $el.bootstrapTable('destroy');
$el.bootstrapTable(angular.extend(angular.copy(options), state));
$s.instantiated = true;
// Update the UI for state that isn't settable via options
if ('scroll' in state) $el.bootstrapTable('scrollTo', state.scroll);
if ('searchHasFocus' in state) $el.closest(CONTAINER_SELECTOR).find(SEARCH_SELECTOR).focus(); // $el gets detached so have to recompute whole chain
}, true);
$s.$watch('bsTableControl.state', function (state) {
if (!state) state = $s.bsTableControl.state = {};
$el.trigger('directive-updated.bs.table', [state]);
}, true);
$s.$on('$destroy', function () {
delete bsTables[$s.$id];
});
}
};
})
})();

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!function(){"undefined"!=typeof angular&&angular.module("bsTable",[]).directive("bsTableControl",function(){function a(a){var b;return $.each(f,function(d,e){return e.$el.closest(c).has(a).length?(b=e,!0):void 0}),b}function b(){var a=this,b=a.$s.bsTableControl.state;a.$s.$applyAsync(function(){b.scroll=a.$el.bootstrapTable("getScrollPosition")})}var c=".bootstrap-table",d=".fixed-table-body",e=".search input",f={};return $(window).resize(function(){$.each(f,function(a,b){b.$el.bootstrapTable("resetView")})}),$(document).on("post-header.bs.table",c+" table",function(e){var f=a(e.target);f&&f.$el.closest(c).find(d).on("scroll",b.bind(f))}).on("sort.bs.table",c+" table",function(b,c,d){var e=a(b.target);if(e){var f=e.$s.bsTableControl.state;e.$s.$applyAsync(function(){f.sortName=c,f.sortOrder=d})}}).on("page-change.bs.table",c+" table",function(b,c,d){var e=a(b.target);if(e){var f=e.$s.bsTableControl.state;e.$s.$applyAsync(function(){f.pageNumber=c,f.pageSize=d})}}).on("search.bs.table",c+" table",function(b,c){var d=a(b.target);if(d){var e=d.$s.bsTableControl.state;d.$s.$applyAsync(function(){e.searchText=c})}}).on("focus blur",c+" "+e,function(b){var c=a(b.target);if(c){var d=c.$s.bsTableControl.state;c.$s.$applyAsync(function(){d.searchHasFocus=$(b.target).is(":focus")})}}),{restrict:"EA",scope:{bsTableControl:"="},link:function(a,b){f[a.$id]={$s:a,$el:b};a.instantiated=!1,a.$watch("bsTableControl.options",function(d){d||(d=a.bsTableControl.options={});var f=a.bsTableControl.state||{};a.instantiated&&b.bootstrapTable("destroy"),b.bootstrapTable(angular.extend(angular.copy(d),f)),a.instantiated=!0,"scroll"in f&&b.bootstrapTable("scrollTo",f.scroll),"searchHasFocus"in f&&b.closest(c).find(e).focus()},!0),a.$watch("bsTableControl.state",function(c){c||(c=a.bsTableControl.state={}),b.trigger("directive-updated.bs.table",[c])},!0),a.$on("$destroy",function(){delete f[a.$id]})}}})}();

View File

@@ -0,0 +1,335 @@
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.2.0
*
* @update zhixin wen <wenzhixin2010@gmail.com>
*/
(function ($) {
'use strict';
var cookieIds = {
sortOrder: 'bs.table.sortOrder',
sortName: 'bs.table.sortName',
pageNumber: 'bs.table.pageNumber',
pageList: 'bs.table.pageList',
columns: 'bs.table.columns',
searchText: 'bs.table.searchText',
filterControl: 'bs.table.filterControl'
};
var getCurrentHeader = function (that) {
var header = that.$header;
if (that.options.height) {
header = that.$tableHeader;
}
return header;
};
var getCurrentSearchControls = function (that) {
var searchControls = 'select, input';
if (that.options.height) {
searchControls = 'table select, table input';
}
return searchControls;
};
var cookieEnabled = function () {
return !!(navigator.cookieEnabled);
};
var inArrayCookiesEnabled = function (cookieName, cookiesEnabled) {
var index = -1;
for (var i = 0; i < cookiesEnabled.length; i++) {
if (cookieName.toLowerCase() === cookiesEnabled[i].toLowerCase()) {
index = i;
break;
}
}
return index;
};
var setCookie = function (that, cookieName, cookieValue) {
if ((!that.options.cookie) || (!cookieEnabled()) || (that.options.cookieIdTable === '')) {
return;
}
if (inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
return;
}
cookieName = that.options.cookieIdTable + '.' + cookieName;
if (!cookieName || /^(?:expires|max\-age|path|domain|secure)$/i.test(cookieName)) {
return false;
}
document.cookie = encodeURIComponent(cookieName) + '=' + encodeURIComponent(cookieValue) + calculateExpiration(that.options.cookieExpire) + (that.options.cookieDomain ? '; domain=' + that.options.cookieDomain : '') + (that.options.cookiePath ? '; path=' + that.options.cookiePath : '') + (that.cookieSecure ? '; secure' : '');
return true;
};
var getCookie = function (that, tableName, cookieName) {
if (!cookieName) {
return null;
}
if (inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
return null;
}
cookieName = tableName + '.' + cookieName;
return decodeURIComponent(document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + encodeURIComponent(cookieName).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1')) || null;
};
var hasCookie = function (cookieName) {
if (!cookieName) {
return false;
}
return (new RegExp('(?:^|;\\s*)' + encodeURIComponent(cookieName).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=')).test(document.cookie);
};
var deleteCookie = function (tableName, cookieName, sPath, sDomain) {
cookieName = tableName + '.' + cookieName;
if (!hasCookie(cookieName)) {
return false;
}
document.cookie = encodeURIComponent(cookieName) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT' + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '');
return true;
};
var calculateExpiration = function(cookieExpire) {
var time = cookieExpire.replace(/[0-9]*/, ''); //s,mi,h,d,m,y
cookieExpire = cookieExpire.replace(/[A-Za-z]/, ''); //number
switch (time.toLowerCase()) {
case 's':
cookieExpire = +cookieExpire;
break;
case 'mi':
cookieExpire = cookieExpire * 60;
break;
case 'h':
cookieExpire = cookieExpire * 60 * 60;
break;
case 'd':
cookieExpire = cookieExpire * 24 * 60 * 60;
break;
case 'm':
cookieExpire = cookieExpire * 30 * 24 * 60 * 60;
break;
case 'y':
cookieExpire = cookieExpire * 365 * 24 * 60 * 60;
break;
default:
cookieExpire = undefined;
break;
}
return cookieExpire === undefined ? '' : '; max-age=' + cookieExpire;
};
$.extend($.fn.bootstrapTable.defaults, {
cookie: false,
cookieExpire: '2h',
cookiePath: null,
cookieDomain: null,
cookieSecure: null,
cookieIdTable: '',
cookiesEnabled: ['bs.table.sortOrder', 'bs.table.sortName', 'bs.table.pageNumber', 'bs.table.pageList', 'bs.table.columns', 'bs.table.searchText', 'bs.table.filterControl'],
//internal variable
filterControls: [],
filterControlValuesLoaded: false
});
$.fn.bootstrapTable.methods.push('deleteCookie');
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_init = BootstrapTable.prototype.init,
_initTable = BootstrapTable.prototype.initTable,
_onSort = BootstrapTable.prototype.onSort,
_onPageNumber = BootstrapTable.prototype.onPageNumber,
_onPageListChange = BootstrapTable.prototype.onPageListChange,
_onPageFirst = BootstrapTable.prototype.onPageFirst,
_onPagePre = BootstrapTable.prototype.onPagePre,
_onPageNext = BootstrapTable.prototype.onPageNext,
_onPageLast = BootstrapTable.prototype.onPageLast,
_toggleColumn = BootstrapTable.prototype.toggleColumn,
_selectPage = BootstrapTable.prototype.selectPage,
_onSearch = BootstrapTable.prototype.onSearch;
BootstrapTable.prototype.init = function () {
var timeoutId = 0;
this.options.filterControls = [];
this.options.filterControlValuesLoaded = false;
this.options.cookiesEnabled = typeof this.options.cookiesEnabled === 'string' ?
this.options.cookiesEnabled.replace('[', '').replace(']', '').replace(/ /g, '').toLowerCase().split(',') : this.options.cookiesEnabled;
if (this.options.filterControl) {
var that = this;
this.$el.on('column-search.bs.table', function (e, field, text) {
var isNewField = true;
for (var i = 0; i < that.options.filterControls.length; i++) {
if (that.options.filterControls[i].field === field) {
that.options.filterControls[i].text = text;
isNewField = false;
break;
}
}
if (isNewField) {
that.options.filterControls.push({
field: field,
text: text
});
}
setCookie(that, cookieIds.filterControl, JSON.stringify(that.options.filterControls));
}).on('post-body.bs.table', function () {
setTimeout(function () {
if (!that.options.filterControlValuesLoaded) {
that.options.filterControlValuesLoaded = true;
var filterControl = JSON.parse(getCookie(that, that.options.cookieIdTable, cookieIds.filterControl));
if (filterControl) {
var field = null,
result = [],
header = getCurrentHeader(that),
searchControls = getCurrentSearchControls(that);
header.find(searchControls).each(function (index, ele) {
field = $(this).closest('[data-field]').data('field');
result = $.grep(filterControl, function (valueObj) {
return valueObj.field === field;
});
if (result.length > 0) {
$(this).val(result[0].text);
that.onColumnSearch({currentTarget: $(this)});
}
});
}
}
}, 250);
});
}
_init.apply(this, Array.prototype.slice.apply(arguments));
};
BootstrapTable.prototype.initTable = function () {
_initTable.apply(this, Array.prototype.slice.apply(arguments));
this.initCookie();
};
BootstrapTable.prototype.initCookie = function () {
if (!this.options.cookie) {
return;
}
if ((this.options.cookieIdTable === '') || (this.options.cookieExpire === '') || (!cookieEnabled())) {
throw new Error("Configuration error. Please review the cookieIdTable, cookieExpire properties, if those properties are ok, then this browser does not support the cookies");
return;
}
var sortOrderCookie = getCookie(this, this.options.cookieIdTable, cookieIds.sortOrder),
sortOrderNameCookie = getCookie(this, this.options.cookieIdTable, cookieIds.sortName),
pageNumberCookie = getCookie(this, this.options.cookieIdTable, cookieIds.pageNumber),
pageListCookie = getCookie(this, this.options.cookieIdTable, cookieIds.pageList),
columnsCookie = JSON.parse(getCookie(this, this.options.cookieIdTable, cookieIds.columns)),
searchTextCookie = getCookie(this, this.options.cookieIdTable, cookieIds.searchText);
//sortOrder
this.options.sortOrder = sortOrderCookie ? sortOrderCookie : this.options.sortOrder;
//sortName
this.options.sortName = sortOrderNameCookie ? sortOrderNameCookie : this.options.sortName;
//pageNumber
this.options.pageNumber = pageNumberCookie ? +pageNumberCookie : this.options.pageNumber;
//pageSize
this.options.pageSize = pageListCookie ? pageListCookie === this.options.formatAllRows() ? pageListCookie : +pageListCookie : this.options.pageSize;
//searchText
this.options.searchText = searchTextCookie ? searchTextCookie : '';
if (columnsCookie) {
$.each(this.columns, function (i, column) {
column.visible = $.inArray(column.field, columnsCookie) !== -1;
});
}
};
BootstrapTable.prototype.onSort = function () {
_onSort.apply(this, Array.prototype.slice.apply(arguments));
setCookie(this, cookieIds.sortOrder, this.options.sortOrder);
setCookie(this, cookieIds.sortName, this.options.sortName);
};
BootstrapTable.prototype.onPageNumber = function () {
_onPageNumber.apply(this, Array.prototype.slice.apply(arguments));
setCookie(this, cookieIds.pageNumber, this.options.pageNumber);
};
BootstrapTable.prototype.onPageListChange = function () {
_onPageListChange.apply(this, Array.prototype.slice.apply(arguments));
setCookie(this, cookieIds.pageList, this.options.pageSize);
};
BootstrapTable.prototype.onPageFirst = function () {
_onPageFirst.apply(this, Array.prototype.slice.apply(arguments));
setCookie(this, cookieIds.pageNumber, this.options.pageNumber);
};
BootstrapTable.prototype.onPagePre = function () {
_onPagePre.apply(this, Array.prototype.slice.apply(arguments));
setCookie(this, cookieIds.pageNumber, this.options.pageNumber);
};
BootstrapTable.prototype.onPageNext = function () {
_onPageNext.apply(this, Array.prototype.slice.apply(arguments));
setCookie(this, cookieIds.pageNumber, this.options.pageNumber);
};
BootstrapTable.prototype.onPageLast = function () {
_onPageLast.apply(this, Array.prototype.slice.apply(arguments));
setCookie(this, cookieIds.pageNumber, this.options.pageNumber);
};
BootstrapTable.prototype.toggleColumn = function () {
_toggleColumn.apply(this, Array.prototype.slice.apply(arguments));
var visibleColumns = [];
$.each(this.columns, function (i, column) {
if (column.visible) {
visibleColumns.push(column.field);
}
});
setCookie(this, cookieIds.columns, JSON.stringify(visibleColumns));
};
BootstrapTable.prototype.selectPage = function (page) {
_selectPage.apply(this, Array.prototype.slice.apply(arguments));
setCookie(this, cookieIds.pageNumber, page);
};
BootstrapTable.prototype.onSearch = function () {
var target = Array.prototype.slice.apply(arguments);
_onSearch.apply(this, target);
if ($(target[0].currentTarget).parent().hasClass('search')) {
setCookie(this, cookieIds.searchText, this.searchText);
}
};
BootstrapTable.prototype.deleteCookie = function (cookieName) {
if ((cookieName === '') || (!cookieEnabled())) {
return;
}
deleteCookie(this.options.cookieIdTable, cookieIds[cookieName], this.options.cookiePath, this.options.cookieDomain);
};
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,128 @@
/**
* @author zhixin wen <wenzhixin2010@gmail.com>
* extensions: https://github.com/vitalets/x-editable
*/
!function ($) {
'use strict';
$.extend($.fn.bootstrapTable.defaults, {
editable: true,
onEditableInit: function () {
return false;
},
onEditableSave: function (field, row, oldValue, $el) {
return false;
},
onEditableShown: function (field, row, $el, editable) {
return false;
},
onEditableHidden: function (field, row, $el, reason) {
return false;
}
});
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
'editable-init.bs.table': 'onEditableInit',
'editable-save.bs.table': 'onEditableSave',
'editable-shown.bs.table': 'onEditableShown',
'editable-hidden.bs.table': 'onEditableHidden'
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initTable = BootstrapTable.prototype.initTable,
_initBody = BootstrapTable.prototype.initBody;
BootstrapTable.prototype.initTable = function () {
var that = this;
_initTable.apply(this, Array.prototype.slice.apply(arguments));
if (!this.options.editable) {
return;
}
$.each(this.columns, function (i, column) {
if (!column.editable) {
return;
}
var editableOptions = {}, editableDataMarkup = [], editableDataPrefix = 'editable-';
var processDataOptions = function(key, value) {
// Replace camel case with dashes.
var dashKey = key.replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();});
if (dashKey.slice(0, editableDataPrefix.length) == editableDataPrefix) {
var dataKey = dashKey.replace(editableDataPrefix, 'data-');
editableOptions[dataKey] = value;
}
};
$.each(that.options, processDataOptions);
var _formatter = column.formatter;
column.formatter = function (value, row, index) {
var result = _formatter ? _formatter(value, row, index) : value;
$.each(column, processDataOptions);
$.each(editableOptions, function (key, value) {
editableDataMarkup.push(' ' + key + '="' + value + '"');
});
return ['<a href="javascript:void(0)"',
' data-name="' + column.field + '"',
' data-pk="' + row[that.options.idField] + '"',
' data-value="' + result + '"',
editableDataMarkup.join(''),
'>' + '</a>'
].join('');
};
});
};
BootstrapTable.prototype.initBody = function () {
var that = this;
_initBody.apply(this, Array.prototype.slice.apply(arguments));
if (!this.options.editable) {
return;
}
$.each(this.columns, function (i, column) {
if (!column.editable) {
return;
}
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
.off('save').on('save', function (e, params) {
var data = that.getData(),
index = $(this).parents('tr[data-index]').data('index'),
row = data[index],
oldValue = row[column.field];
$(this).data('value', params.submitValue);
row[column.field] = params.submitValue;
that.trigger('editable-save', column.field, row, oldValue, $(this));
});
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
.off('shown').on('shown', function (e, editable) {
var data = that.getData(),
index = $(this).parents('tr[data-index]').data('index'),
row = data[index];
that.trigger('editable-shown', column.field, row, $(this), editable);
});
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
.off('hidden').on('hidden', function (e, reason) {
var data = that.getData(),
index = $(this).parents('tr[data-index]').data('index'),
row = data[index];
that.trigger('editable-hidden', column.field, row, $(this), reason);
});
});
this.trigger('editable-init');
};
}(jQuery);

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";a.extend(a.fn.bootstrapTable.defaults,{editable:!0,onEditableInit:function(){return!1},onEditableSave:function(){return!1},onEditableShown:function(){return!1},onEditableHidden:function(){return!1}}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"editable-init.bs.table":"onEditableInit","editable-save.bs.table":"onEditableSave","editable-shown.bs.table":"onEditableShown","editable-hidden.bs.table":"onEditableHidden"});var b=a.fn.bootstrapTable.Constructor,c=b.prototype.initTable,d=b.prototype.initBody;b.prototype.initTable=function(){var b=this;c.apply(this,Array.prototype.slice.apply(arguments)),this.options.editable&&a.each(this.columns,function(c,d){if(d.editable){var e={},f=[],g="editable-",h=function(a,b){var c=a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()});if(c.slice(0,g.length)==g){var d=c.replace(g,"data-");e[d]=b}};a.each(b.options,h);var i=d.formatter;d.formatter=function(c,g,j){var k=i?i(c,g,j):c;return a.each(d,h),a.each(e,function(a,b){f.push(" "+a+'="'+b+'"')}),['<a href="javascript:void(0)"',' data-name="'+d.field+'"',' data-pk="'+g[b.options.idField]+'"',' data-value="'+k+'"',f.join(""),"></a>"].join("")}}})},b.prototype.initBody=function(){var b=this;d.apply(this,Array.prototype.slice.apply(arguments)),this.options.editable&&(a.each(this.columns,function(c,d){d.editable&&(b.$body.find('a[data-name="'+d.field+'"]').editable(d.editable).off("save").on("save",function(c,e){var f=b.getData(),g=a(this).parents("tr[data-index]").data("index"),h=f[g],i=h[d.field];a(this).data("value",e.submitValue),h[d.field]=e.submitValue,b.trigger("editable-save",d.field,h,i,a(this))}),b.$body.find('a[data-name="'+d.field+'"]').editable(d.editable).off("shown").on("shown",function(c,e){var f=b.getData(),g=a(this).parents("tr[data-index]").data("index"),h=f[g];b.trigger("editable-shown",d.field,h,a(this),e)}),b.$body.find('a[data-name="'+d.field+'"]').editable(d.editable).off("hidden").on("hidden",function(c,e){var f=b.getData(),g=a(this).parents("tr[data-index]").data("index"),h=f[g];b.trigger("editable-hidden",d.field,h,a(this),e)}))}),this.trigger("editable-init"))}}(jQuery);

View File

@@ -0,0 +1,112 @@
/**
* @author zhixin wen <wenzhixin2010@gmail.com>
* extensions: https://github.com/kayalshri/tableExport.jquery.plugin
*/
(function ($) {
'use strict';
var sprintf = $.fn.bootstrapTable.utils.sprintf;
var TYPE_NAME = {
json: 'JSON',
xml: 'XML',
png: 'PNG',
csv: 'CSV',
txt: 'TXT',
sql: 'SQL',
doc: 'MS-Word',
excel: 'MS-Excel',
powerpoint: 'MS-Powerpoint',
pdf: 'PDF'
};
$.extend($.fn.bootstrapTable.defaults, {
showExport: false,
exportDataType: 'basic', // basic, all, selected
// 'json', 'xml', 'png', 'csv', 'txt', 'sql', 'doc', 'excel', 'powerpoint', 'pdf'
exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
exportOptions: {}
});
$.extend($.fn.bootstrapTable.defaults.icons, {
export: 'glyphicon-export icon-share'
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initToolbar = BootstrapTable.prototype.initToolbar;
BootstrapTable.prototype.initToolbar = function () {
this.showToolbar = this.options.showExport;
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
if (this.options.showExport) {
var that = this,
$btnGroup = this.$toolbar.find('>.btn-group'),
$export = $btnGroup.find('div.export');
if (!$export.length) {
$export = $([
'<div class="export btn-group">',
'<button class="btn btn-default' +
sprintf(' btn-%s', this.options.iconSize) +
' dropdown-toggle" ' +
'data-toggle="dropdown" type="button">',
sprintf('<i class="%s %s"></i> ', this.options.iconsPrefix, this.options.icons.export),
'<span class="caret"></span>',
'</button>',
'<ul class="dropdown-menu" role="menu">',
'</ul>',
'</div>'].join('')).appendTo($btnGroup);
var $menu = $export.find('.dropdown-menu'),
exportTypes = this.options.exportTypes;
if (typeof this.options.exportTypes === 'string') {
var types = this.options.exportTypes.slice(1, -1).replace(/ /g, '').split(',');
exportTypes = [];
$.each(types, function (i, value) {
exportTypes.push(value.slice(1, -1));
});
}
$.each(exportTypes, function (i, type) {
if (TYPE_NAME.hasOwnProperty(type)) {
$menu.append(['<li data-type="' + type + '">',
'<a href="javascript:void(0)">',
TYPE_NAME[type],
'</a>',
'</li>'].join(''));
}
});
$menu.find('li').click(function () {
var type = $(this).data('type'),
doExport = function () {
that.$el.tableExport($.extend({}, that.options.exportOptions, {
type: type,
escape: false
}));
};
if (that.options.exportDataType === 'all' && that.options.pagination) {
that.$el.one('load-success.bs.table page-change.bs.table', function () {
doExport();
that.togglePagination();
});
that.togglePagination();
} else if (that.options.exportDataType === 'selected') {
var data = that.getData(),
selectedData = that.getAllSelections();
that.load(selectedData);
doExport();
that.load(data);
} else {
doExport();
}
});
}
}
};
})(jQuery);

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";var b=a.fn.bootstrapTable.utils.sprintf,c={json:"JSON",xml:"XML",png:"PNG",csv:"CSV",txt:"TXT",sql:"SQL",doc:"MS-Word",excel:"MS-Excel",powerpoint:"MS-Powerpoint",pdf:"PDF"};a.extend(a.fn.bootstrapTable.defaults,{showExport:!1,exportDataType:"basic",exportTypes:["json","xml","csv","txt","sql","excel"],exportOptions:{}}),a.extend(a.fn.bootstrapTable.defaults.icons,{"export":"glyphicon-export icon-share"});var d=a.fn.bootstrapTable.Constructor,e=d.prototype.initToolbar;d.prototype.initToolbar=function(){if(this.showToolbar=this.options.showExport,e.apply(this,Array.prototype.slice.apply(arguments)),this.options.showExport){var d=this,f=this.$toolbar.find(">.btn-group"),g=f.find("div.export");if(!g.length){g=a(['<div class="export btn-group">','<button class="btn btn-default'+b(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown" type="button">',b('<i class="%s %s"></i> ',this.options.iconsPrefix,this.options.icons["export"]),'<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">',"</ul>","</div>"].join("")).appendTo(f);var h=g.find(".dropdown-menu"),i=this.options.exportTypes;if("string"==typeof this.options.exportTypes){var j=this.options.exportTypes.slice(1,-1).replace(/ /g,"").split(",");i=[],a.each(j,function(a,b){i.push(b.slice(1,-1))})}a.each(i,function(a,b){c.hasOwnProperty(b)&&h.append(['<li data-type="'+b+'">','<a href="javascript:void(0)">',c[b],"</a>","</li>"].join(""))}),h.find("li").click(function(){var b=a(this).data("type"),c=function(){d.$el.tableExport(a.extend({},d.options.exportOptions,{type:b,escape:!1}))};if("all"===d.options.exportDataType&&d.options.pagination)d.$el.one("load-success.bs.table page-change.bs.table",function(){c(),d.togglePagination()}),d.togglePagination();else if("selected"===d.options.exportDataType){var e=d.getData(),f=d.getAllSelections();d.load(f),c(),d.load(e)}else c()})}}}}(jQuery);

View File

@@ -0,0 +1,520 @@
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.0.0
*/
!function ($) {
'use strict';
var sprintf = $.fn.bootstrapTable.utils.sprintf;
var addOptionToSelectControl = function (selectControl, value, text) {
value = $.trim(value);
selectControl = $(selectControl.get(selectControl.length - 1));
if (existOptionInSelectControl(selectControl, value)) {
selectControl.append($("<option></option>")
.attr("value", value)
.text($('<div />').html(text).text()));
// Sort it. Not overly efficient to do this here
var $opts = selectControl.find('option:gt(0)');
$opts.sort(function (a, b) {
a = $(a).text().toLowerCase();
b = $(b).text().toLowerCase();
if ($.isNumeric(a) && $.isNumeric(b)) {
// Convert numerical values from string to float.
a = parseFloat(a);
b = parseFloat(b);
}
return a > b ? 1 : a < b ? -1 : 0;
});
selectControl.find('option:gt(0)').remove();
selectControl.append($opts);
}
};
var existOptionInSelectControl = function (selectControl, value) {
var options = selectControl.get(selectControl.length - 1).options;
for (var i = 0; i < options.length; i++) {
if (options[i].value === value.toString()) {
//The value is not valid to add
return false;
}
}
//If we get here, the value is valid to add
return true;
};
var fixHeaderCSS = function (that) {
that.$tableHeader.css('height', '77px');
};
var getCurrentHeader = function (that) {
var header = that.$header;
if (that.options.height) {
header = that.$tableHeader;
}
return header;
};
var getCurrentSearchControls = function (that) {
var searchControls = 'select, input';
if (that.options.height) {
searchControls = 'table select, table input';
}
return searchControls;
};
var copyValues = function (that) {
var header = getCurrentHeader(that),
searchControls = getCurrentSearchControls(that);
that.options.valuesFilterControl = [];
header.find(searchControls).each(function () {
that.options.valuesFilterControl.push(
{
field: $(this).closest('[data-field]').data('field'),
value: $(this).val()
});
});
};
var setValues = function(that) {
var field = null,
result = [],
header = getCurrentHeader(that),
searchControls = getCurrentSearchControls(that);
if (that.options.valuesFilterControl.length > 0) {
header.find(searchControls).each(function (index, ele) {
field = $(this).closest('[data-field]').data('field');
result = $.grep(that.options.valuesFilterControl, function (valueObj) {
return valueObj.field === field;
});
if (result.length > 0) {
$(this).val(result[0].value);
}
});
}
};
var collectBootstrapCookies = function cookiesRegex() {
var cookies = [],
foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
if (foundCookies) {
$.each(foundCookies, function (i, cookie) {
if (/./.test(cookie)) {
cookie = cookie.split(".").pop();
}
if ($.inArray(cookie, cookies) === -1) {
cookies.push(cookie);
}
});
return cookies;
}
};
var createControls = function (that, header) {
var addedFilterControl = false,
isVisible,
html,
timeoutId = 0;
$.each(that.columns, function (i, column) {
isVisible = 'hidden';
html = [];
if (!column.visible) {
return;
}
if (!column.filterControl) {
html.push('<div style="height: 34px;"></div>');
} else {
html.push('<div style="margin: 0 2px 2px 2px;" class="filterControl">');
var nameControl = column.filterControl.toLowerCase();
if (column.searchable && that.options.filterTemplate[nameControl]) {
addedFilterControl = true;
isVisible = 'visible';
html.push(that.options.filterTemplate[nameControl](that, column.field, isVisible));
}
}
$.each(header.children().children(), function (i, tr) {
tr = $(tr);
if (tr.data('field') === column.field) {
tr.find('.fht-cell').append(html.join(''));
return false;
}
});
if (column.filterData !== undefined && column.filterData.toLowerCase() !== 'column') {
var filterDataType = column.filterData.substring(0, 3);
var filterDataSource = column.filterData.substring(4, column.filterData.length);
var selectControl = $('.' + column.field);
addOptionToSelectControl(selectControl, '', '');
switch (filterDataType) {
case 'url':
$.ajax({
url: filterDataSource,
type: "post",
dataType: 'json',
success: function (data) {
$.each(data, function (key, value) {
if (!value.Link) {
addOptionToSelectControl(selectControl, value._id, value.CateName);
}
});
}
});
break;
case 'var':
var variableValues = window[filterDataSource];
for (var key in variableValues) {
addOptionToSelectControl(selectControl, key, variableValues[key]);
}
break;
}
}
});
if (addedFilterControl) {
header.off('keyup', 'input').on('keyup', 'input', function (event) {
clearTimeout(timeoutId);
timeoutId = setTimeout(function () {
that.onColumnSearch(event);
}, that.options.searchTimeOut);
});
header.off('change', 'select').on('change', 'select', function (event) {
clearTimeout(timeoutId);
timeoutId = setTimeout(function () {
that.onColumnSearch(event);
}, that.options.searchTimeOut);
});
header.off('mouseup', 'input').on('mouseup', 'input', function (event) {
var $input = $(this),
oldValue = $input.val();
if (oldValue === "") {
return;
}
setTimeout(function(){
var newValue = $input.val();
if (newValue === "") {
clearTimeout(timeoutId);
timeoutId = setTimeout(function () {
that.onColumnSearch(event);
}, that.options.searchTimeOut);
}
}, 1);
});
if (header.find('.date-filter-control').length > 0) {
$.each(that.columns, function (i, column) {
if (column.filterControl !== undefined && column.filterControl.toLowerCase() === 'datepicker') {
header.find('.date-filter-control.' + column.field).datepicker(column.filterDatepickerOptions)
.on('changeDate', function (e) {
//Fired the keyup event
$(e.currentTarget).keyup();
});
}
});
}
} else {
header.find('.filterControl').hide();
}
};
var getDirectionOfSelectOptions = function (alignment) {
alignment = alignment === undefined ? 'left' : alignment.toLowerCase();
switch (alignment) {
case 'left':
return 'ltr';
case 'right':
return 'rtl';
case 'auto':
return 'auto';
default:
return 'ltr'
}
};
$.extend($.fn.bootstrapTable.defaults, {
filterControl: false,
onColumnSearch: function (field, text) {
return false;
},
filterShowClear: false,
alignmentSelectControlOptions: undefined,
//internal variables
valuesFilterControl: [],
filterTemplate: {
input: function (that, field, isVisible) {
return sprintf('<input type="text" class="form-control %s" style="width: 100%; visibility: %s">', field, isVisible);
},
select: function (that, field, isVisible) {
return sprintf('<select class="%s form-control" style="width: 100%; visibility: %s" dir="%s"></select>',
field, isVisible, getDirectionOfSelectOptions(that.options.alignmentSelectControlOptions))
},
datepicker: function (that, field, isVisible) {
return sprintf('<input type="text" class="date-filter-control %s form-control" style="width: 100%; visibility: %s">', field, isVisible);
}
}
});
$.extend($.fn.bootstrapTable.COLUMN_DEFAULTS, {
filterControl: undefined,
filterData: undefined,
filterDatepickerOptions: undefined,
filterStrictSearch: false
});
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
'column-search.bs.table': 'onColumnSearch'
});
$.extend($.fn.bootstrapTable.defaults.icons, {
clear: 'glyphicon-trash icon-clear'
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_init = BootstrapTable.prototype.init,
_initToolbar = BootstrapTable.prototype.initToolbar,
_initHeader = BootstrapTable.prototype.initHeader,
_initBody = BootstrapTable.prototype.initBody,
_initSearch = BootstrapTable.prototype.initSearch;
BootstrapTable.prototype.init = function () {
//Make sure that the filterControl option is set
if (this.options.filterControl) {
var that = this;
//Make sure that the internal variables are set correctly
this.options.valuesFilterControl = [];
this.$el.on('reset-view.bs.table', function () {
//Create controls on $tableHeader if the height is set
if (!that.options.height) {
return;
}
//Avoid recreate the controls
if (that.$tableHeader.find('select').length > 0 || that.$tableHeader.find('input').length > 0) {
return;
}
createControls(that, that.$tableHeader);
}).on('post-header.bs.table', function () {
setValues(that);
}).on('post-body.bs.table', function () {
if (that.options.height) {
fixHeaderCSS(that);
}
}).on('column-switch.bs.table', function() {
setValues(that);
});
}
_init.apply(this, Array.prototype.slice.apply(arguments));
};
$.extend($.fn.bootstrapTable.locales, {
formatClearFilters: function () {
return 'Clear Filters';
}
});
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
BootstrapTable.prototype.initToolbar = function () {
if ((!this.showToolbar) && (this.options.filterControl)) {
this.showToolbar = this.options.filterControl;
}
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
if (this.options.filterControl && this.options.filterShowClear) {
var $btnGroup = this.$toolbar.find('>.btn-group'),
$btnClear = $btnGroup.find('div.export');
if (!$btnClear.length) {
$btnClear = $([
'<button class="btn btn-default" ',
sprintf('type="button" title="%s">', this.options.formatClearFilters()),
sprintf('<i class="%s %s"></i> ', this.options.iconsPrefix, this.options.icons.clear),
'</button>',
'</ul>'].join('')).appendTo($btnGroup);
$btnClear.off('click').on('click', $.proxy(this.clearFilterControl, this));
}
}
};
BootstrapTable.prototype.initHeader = function () {
_initHeader.apply(this, Array.prototype.slice.apply(arguments));
if (!this.options.filterControl) {
return;
}
createControls(this, this.$header);
};
BootstrapTable.prototype.initBody = function () {
_initBody.apply(this, Array.prototype.slice.apply(arguments));
var that = this,
data = this.options.data,
pageTo = this.pageTo < this.options.data.length ? this.options.data.length : this.pageTo;
for (var i = this.pageFrom - 1; i < pageTo; i++) {
var item = data[i];
$.each(this.header.fields, function (j, field) {
var value = item[field],
column = that.columns[$.fn.bootstrapTable.utils.getFieldIndex(that.columns, field)];
value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[j], [value, item, i], value);
if ((!column.checkbox) || (!column.radio)) {
if (column.filterControl !== undefined && column.filterControl.toLowerCase() === 'select' && column.searchable) {
if (column.filterData === undefined || column.filterData.toLowerCase() === 'column') {
var selectControl = $('.' + column.field);
if (selectControl !== undefined && selectControl.length > 0) {
if (selectControl.get(selectControl.length - 1).options.length === 0) {
//Added the default option
addOptionToSelectControl(selectControl, '', '');
}
//Added a new value
addOptionToSelectControl(selectControl, value, value);
}
}
}
}
});
}
};
BootstrapTable.prototype.initSearch = function () {
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
if (!this.options.sidePagination !== 'server') {
return;
}
var that = this;
var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
//Check partial column filter
this.data = fp ? $.grep(this.data, function (item, i) {
for (var key in fp) {
var thisColumn = that.columns[$.fn.bootstrapTable.utils.getFieldIndex(that.columns, key)];
var fval = fp[key].toLowerCase();
var value = item[key];
// Fix #142: search use formated data
if (thisColumn && thisColumn.searchFormatter) {
value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
that.header.formatters[$.inArray(key, that.header.fields)],
[value, item, i], value);
}
if (thisColumn.filterStrictSearch) {
if (!($.inArray(key, that.header.fields) !== -1 &&
(typeof value === 'string' || typeof value === 'number') &&
value.toString().toLowerCase() === fval.toString().toLowerCase())) {
return false;
}
}
else {
if (!($.inArray(key, that.header.fields) !== -1 &&
(typeof value === 'string' || typeof value === 'number') &&
(value + '').toLowerCase().indexOf(fval) !== -1)) {
return false;
}
}
}
return true;
}) : this.data;
};
BootstrapTable.prototype.onColumnSearch = function (event) {
copyValues(this);
var text = $.trim($(event.currentTarget).val());
var $field = $(event.currentTarget).closest('[data-field]').data('field');
if ($.isEmptyObject(this.filterColumnsPartial)) {
this.filterColumnsPartial = {};
}
if (text) {
this.filterColumnsPartial[$field] = text;
} else {
delete this.filterColumnsPartial[$field];
}
this.options.pageNumber = 1;
//this.onSearch(event);
this.updatePagination();
this.trigger('column-search', $field, text);
};
BootstrapTable.prototype.clearFilterControl = function () {
if (this.options.filterControl && this.options.filterShowClear) {
var that = this,
cookies = collectBootstrapCookies(),
header = getCurrentHeader(that),
table = header.closest('table'),
controls = header.find(getCurrentSearchControls(that)),
search = that.$toolbar.find('.search input'),
timeoutId = 0;
$.each(that.options.valuesFilterControl, function (i, item) {
item.value = '';
});
setValues(that);
// Clear each type of filter if it exists.
// Requires the body to reload each time a type of filter is found because we never know
// which ones are going to be present.
if (controls.length > 0) {
this.filterColumnsPartial = {};
$(controls[0]).trigger(controls[0].tagName === 'INPUT' ? 'keyup' : 'change');
}
if (search.length > 0) {
that.resetSearch();
}
// use the default sort order if it exists. do nothing if it does not
if (that.options.sortName !== table.data('sortName') || that.options.sortOrder !== table.data('sortOrder')) {
var sorter = sprintf(header.find('[data-field="%s"]', $(controls[0]).closest('table').data('sortName')));
that.onSort(table.data('sortName'), table.data('sortName'));
$(sorter).find('.sortable').trigger('click');
}
// clear cookies once the filters are clean
clearTimeout(timeoutId);
timeoutId = setTimeout(function () {
if (cookies && cookies.length > 0) {
$.each(cookies, function (i, item) {
that.deleteCookie(item);
});
}
}, that.options.searchTimeOut);
}
};
}(jQuery);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,67 @@
/**
* @author zhixin wen <wenzhixin2010@gmail.com>
* extensions: https://github.com/lukaskral/bootstrap-table-filter
*/
!function($) {
'use strict';
$.extend($.fn.bootstrapTable.defaults, {
showFilter: false
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_init = BootstrapTable.prototype.init,
_initSearch = BootstrapTable.prototype.initSearch;
BootstrapTable.prototype.init = function () {
_init.apply(this, Array.prototype.slice.apply(arguments));
var that = this;
this.$el.on('load-success.bs.table', function () {
if (that.options.showFilter) {
$(that.options.toolbar).bootstrapTableFilter({
connectTo: that.$el
});
}
});
};
BootstrapTable.prototype.initSearch = function () {
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
if (this.options.sidePagination !== 'server') {
if (typeof this.searchCallback === 'function') {
this.data = $.grep(this.options.data, this.searchCallback);
}
}
};
BootstrapTable.prototype.getData = function () {
return (this.searchText || this.searchCallback) ? this.data : this.options.data;
};
BootstrapTable.prototype.getColumns = function () {
return this.columns;
};
BootstrapTable.prototype.registerSearchCallback = function (callback) {
this.searchCallback = callback;
};
BootstrapTable.prototype.updateSearch = function () {
this.options.pageNumber = 1;
this.initSearch();
this.updatePagination();
};
BootstrapTable.prototype.getServerUrl = function () {
return (this.options.sidePagination === 'server') ? this.options.url : false;
};
$.fn.bootstrapTable.methods.push('getColumns',
'registerSearchCallback', 'updateSearch',
'getServerUrl');
}(jQuery);

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";a.extend(a.fn.bootstrapTable.defaults,{showFilter:!1});var b=a.fn.bootstrapTable.Constructor,c=b.prototype.init,d=b.prototype.initSearch;b.prototype.init=function(){c.apply(this,Array.prototype.slice.apply(arguments));var b=this;this.$el.on("load-success.bs.table",function(){b.options.showFilter&&a(b.options.toolbar).bootstrapTableFilter({connectTo:b.$el})})},b.prototype.initSearch=function(){d.apply(this,Array.prototype.slice.apply(arguments)),"server"!==this.options.sidePagination&&"function"==typeof this.searchCallback&&(this.data=a.grep(this.options.data,this.searchCallback))},b.prototype.getData=function(){return this.searchText||this.searchCallback?this.data:this.options.data},b.prototype.getColumns=function(){return this.columns},b.prototype.registerSearchCallback=function(a){this.searchCallback=a},b.prototype.updateSearch=function(){this.options.pageNumber=1,this.initSearch(),this.updatePagination()},b.prototype.getServerUrl=function(){return"server"===this.options.sidePagination?this.options.url:!1},a.fn.bootstrapTable.methods.push("getColumns","registerSearchCallback","updateSearch","getServerUrl")}(jQuery);

View File

@@ -0,0 +1,62 @@
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.3.0
*/
(function ($) {
'use strict';
var flat = function (element, that) {
var result = {};
function recurse(cur, prop) {
if (Object(cur) !== cur) {
result[prop] = cur;
} else if ($.isArray(cur)) {
for (var i = 0, l = cur.length; i < l; i++) {
recurse(cur[i], prop ? prop + that.options.flatSeparator + i : "" + i);
if (l == 0) {
result[prop] = [];
}
}
} else {
var isEmpty = true;
for (var p in cur) {
isEmpty = false;
recurse(cur[p], prop ? prop + that.options.flatSeparator + p : p);
}
if (isEmpty) {
result[prop] = {};
}
}
}
recurse(element, "");
return result;
};
var flatHelper = function (data, that) {
var flatArray = [];
$.each(!$.isArray(data) ? [data] : data, function (i, element) {
flatArray.push(flat(element, that));
});
return flatArray;
};
$.extend($.fn.bootstrapTable.defaults, {
flat: false,
flatSeparator: '.'
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initData = BootstrapTable.prototype.initData;
BootstrapTable.prototype.initData = function (data, type) {
if (this.options.flat) {
data = flatHelper(data ? data : this.options.data, this);
}
_initData.apply(this, [data, type]);
};
})(jQuery);

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";var b=function(b,c){function d(b,f){if(Object(b)!==b)e[f]=b;else if(a.isArray(b))for(var g=0,h=b.length;h>g;g++)d(b[g],f?f+c.options.flatSeparator+g:""+g),0==h&&(e[f]=[]);else{var i=!0;for(var j in b)i=!1,d(b[j],f?f+c.options.flatSeparator+j:j);i&&(e[f]={})}}var e={};return d(b,""),e},c=function(c,d){var e=[];return a.each(a.isArray(c)?c:[c],function(a,c){e.push(b(c,d))}),e};a.extend(a.fn.bootstrapTable.defaults,{flat:!1,flatSeparator:"."});var d=a.fn.bootstrapTable.Constructor,e=d.prototype.initData;d.prototype.initData=function(a,b){this.options.flat&&(a=c(a?a:this.options.data,this)),e.apply(this,[a,b])}}(jQuery);

View File

@@ -0,0 +1,7 @@
.bootstrap-table .table > tbody > tr.groupBy {
cursor: pointer;
}
.bootstrap-table .table > tbody > tr.groupBy.expanded {
}

View File

@@ -0,0 +1,226 @@
/**
* @author: Yura Knoxville
* @version: v1.0.0
*/
!function ($) {
'use strict';
var initBodyCaller,
tableGroups;
// it only does '%s', and return '' when arguments are undefined
var sprintf = function (str) {
var args = arguments,
flag = true,
i = 1;
str = str.replace(/%s/g, function () {
var arg = args[i++];
if (typeof arg === 'undefined') {
flag = false;
return '';
}
return arg;
});
return flag ? str : '';
};
var groupBy = function (array , f) {
var groups = {};
array.forEach(function(o) {
var group = f(o);
groups[group] = groups[group] || [];
groups[group].push(o);
});
return groups;
};
$.extend($.fn.bootstrapTable.defaults, {
groupBy: false,
groupByField: ''
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initSort = BootstrapTable.prototype.initSort,
_initBody = BootstrapTable.prototype.initBody,
_updateSelected = BootstrapTable.prototype.updateSelected;
BootstrapTable.prototype.initSort = function () {
_initSort.apply(this, Array.prototype.slice.apply(arguments));
var that = this;
tableGroups = [];
if ((this.options.groupBy) && (this.options.groupByField !== '')) {
if ((this.options.sortName != this.options.groupByField)) {
this.data.sort(function(a, b) {
return a[that.options.groupByField].localeCompare(b[that.options.groupByField]);
});
}
var that = this;
var groups = groupBy(that.data, function (item) {
return [item[that.options.groupByField]];
});
var index = 0;
$.each(groups, function(key, value) {
tableGroups.push({
id: index,
name: key
});
value.forEach(function(item) {
if (!item._data) {
item._data = {};
}
item._data['parent-index'] = index;
});
index++;
});
}
}
BootstrapTable.prototype.initBody = function () {
initBodyCaller = true;
_initBody.apply(this, Array.prototype.slice.apply(arguments));
if ((this.options.groupBy) && (this.options.groupByField !== '')) {
var that = this,
checkBox = false,
visibleColumns = 0;
this.columns.forEach(function(column) {
if (column.checkbox) {
checkBox = true;
} else {
if (column.visible) {
visibleColumns += 1;
}
}
});
if (this.options.detailView && !this.options.cardView) {
visibleColumns += 1;
}
tableGroups.forEach(function(item){
var html = [];
html.push(sprintf('<tr class="info groupBy expanded" data-group-index="%s">', item.id));
if (that.options.detailView && !that.options.cardView) {
html.push('<td class="detail"></td>');
}
if (checkBox) {
html.push('<td class="bs-checkbox">',
'<input name="btSelectGroup" type="checkbox" />',
'</td>'
);
}
html.push('<td',
sprintf(' colspan="%s"', visibleColumns),
'>', item.name, '</td>'
);
html.push('</tr>');
that.$body.find('tr[data-parent-index='+item.id+']:first').before($(html.join('')));
});
this.$selectGroup = [];
this.$body.find('[name="btSelectGroup"]').each(function() {
var self = $(this);
that.$selectGroup.push({
group: self,
item: that.$selectItem.filter(function () {
return ($(this).closest('tr').data('parent-index') ===
self.closest('tr').data('group-index'));
})
});
});
this.$container.off('click', '.groupBy')
.on('click', '.groupBy', function() {
$(this).toggleClass('expanded');
that.$body.find('tr[data-parent-index='+$(this).closest('tr').data('group-index')+']').toggleClass('hidden');
});
this.$container.off('click', '[name="btSelectGroup"]')
.on('click', '[name="btSelectGroup"]', function (event) {
event.stopImmediatePropagation();
var self = $(this);
var checked = self.prop('checked');
that[checked ? 'checkGroup' : 'uncheckGroup']($(this).closest('tr').data('group-index'));
});
}
initBodyCaller = false;
this.updateSelected();
};
BootstrapTable.prototype.updateSelected = function () {
if (!initBodyCaller) {
_updateSelected.apply(this, Array.prototype.slice.apply(arguments));
if ((this.options.groupBy) && (this.options.groupByField !== '')) {
this.$selectGroup.forEach(function (item) {
var checkGroup = item.item.filter(':enabled').length ===
item.item.filter(':enabled').filter(':checked').length;
item.group.prop('checked', checkGroup);
});
}
}
};
BootstrapTable.prototype.getGroupSelections = function (index) {
var that = this;
return $.grep(this.data, function (row) {
return (row[that.header.stateField] && (row._data['parent-index'] === index));
});
};
BootstrapTable.prototype.checkGroup = function (index) {
this.checkGroup_(index, true);
};
BootstrapTable.prototype.uncheckGroup = function (index) {
this.checkGroup_(index, false);
};
BootstrapTable.prototype.checkGroup_ = function (index, checked) {
var rows;
var filter = function() {
return ($(this).closest('tr').data('parent-index') === index);
};
if (!checked) {
rows = this.getGroupSelections(index);
}
this.$selectItem.filter(filter).prop('checked', checked);
this.updateRows();
this.updateSelected();
if (checked) {
rows = this.getGroupSelections(index);
}
this.trigger(checked ? 'check-all' : 'uncheck-all', rows);
};
}(jQuery);

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";var b,c,d=function(a){var b=arguments,c=!0,d=1;return a=a.replace(/%s/g,function(){var a=b[d++];return"undefined"==typeof a?(c=!1,""):a}),c?a:""},e=function(a,b){var c={};return a.forEach(function(a){var d=b(a);c[d]=c[d]||[],c[d].push(a)}),c};a.extend(a.fn.bootstrapTable.defaults,{groupBy:!1,groupByField:""});var f=a.fn.bootstrapTable.Constructor,g=f.prototype.initSort,h=f.prototype.initBody,i=f.prototype.updateSelected;f.prototype.initSort=function(){g.apply(this,Array.prototype.slice.apply(arguments));var b=this;if(c=[],this.options.groupBy&&""!==this.options.groupByField){this.options.sortName!=this.options.groupByField&&this.data.sort(function(a,c){return a[b.options.groupByField].localeCompare(c[b.options.groupByField])});var b=this,d=e(b.data,function(a){return[a[b.options.groupByField]]}),f=0;a.each(d,function(a,b){c.push({id:f,name:a}),b.forEach(function(a){a._data||(a._data={}),a._data["parent-index"]=f}),f++})}},f.prototype.initBody=function(){if(b=!0,h.apply(this,Array.prototype.slice.apply(arguments)),this.options.groupBy&&""!==this.options.groupByField){var e=this,f=!1,g=0;this.columns.forEach(function(a){a.checkbox?f=!0:a.visible&&(g+=1)}),this.options.detailView&&!this.options.cardView&&(g+=1),c.forEach(function(b){var c=[];c.push(d('<tr class="info groupBy expanded" data-group-index="%s">',b.id)),e.options.detailView&&!e.options.cardView&&c.push('<td class="detail"></td>'),f&&c.push('<td class="bs-checkbox">','<input name="btSelectGroup" type="checkbox" />',"</td>"),c.push("<td",d(' colspan="%s"',g),">",b.name,"</td>"),c.push("</tr>"),e.$body.find("tr[data-parent-index="+b.id+"]:first").before(a(c.join("")))}),this.$selectGroup=[],this.$body.find('[name="btSelectGroup"]').each(function(){var b=a(this);e.$selectGroup.push({group:b,item:e.$selectItem.filter(function(){return a(this).closest("tr").data("parent-index")===b.closest("tr").data("group-index")})})}),this.$container.off("click",".groupBy").on("click",".groupBy",function(){a(this).toggleClass("expanded"),e.$body.find("tr[data-parent-index="+a(this).closest("tr").data("group-index")+"]").toggleClass("hidden")}),this.$container.off("click",'[name="btSelectGroup"]').on("click",'[name="btSelectGroup"]',function(b){b.stopImmediatePropagation();var c=a(this),d=c.prop("checked");e[d?"checkGroup":"uncheckGroup"](a(this).closest("tr").data("group-index"))})}b=!1,this.updateSelected()},f.prototype.updateSelected=function(){b||(i.apply(this,Array.prototype.slice.apply(arguments)),this.options.groupBy&&""!==this.options.groupByField&&this.$selectGroup.forEach(function(a){var b=a.item.filter(":enabled").length===a.item.filter(":enabled").filter(":checked").length;a.group.prop("checked",b)}))},f.prototype.getGroupSelections=function(b){var c=this;return a.grep(this.data,function(a){return a[c.header.stateField]&&a._data["parent-index"]===b})},f.prototype.checkGroup=function(a){this.checkGroup_(a,!0)},f.prototype.uncheckGroup=function(a){this.checkGroup_(a,!1)},f.prototype.checkGroup_=function(b,c){var d,e=function(){return a(this).closest("tr").data("parent-index")===b};c||(d=this.getGroupSelections(b)),this.$selectItem.filter(e).prop("checked",c),this.updateRows(),this.updateSelected(),c&&(d=this.getGroupSelections(b)),this.trigger(c?"check-all":"uncheck-all",d)}}(jQuery);

View File

@@ -0,0 +1,53 @@
table.treetable tbody tr td {
cursor: default;
}
table.treetable span {
background-position: center left;
background-repeat: no-repeat;
padding: .2em 0 .2em 1.5em;
}
table.treetable tr.collapsed span.indenter a {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiG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Xa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHlJREFUeNrcU1sNgDAQ6wgmcAM2MICGGlg1gJnNzWQcvwQGy1j4oUl/7tH0mpwzM7SgQyO+EZAUWh2MkkzSWhJwuRAlHYsJwEwyvs1gABDuzqoJcTw5qxaIJN0bgQRgIjnlmn1heSO5PE6Y2YXe+5Cr5+h++gs12AcAS6FS+7YOsj4AAAAASUVORK5CYII=);
padding-right: 12px;
}
table.treetable tr.expanded span.indenter a {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQ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zyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHFJREFUeNpi/P//PwMlgImBQsA44C6gvhfa29v3MzAwOODRc6CystIRbxi0t7fjDJjKykpGYrwwi1hxnLHQ3t7+jIGBQRJJ6HllZaUUKYEYRYBPOB0gBShKwKGA////48VtbW3/8clTnBIH3gCKkzJgAGvBX0dDm0sCAAAAAElFTkSuQmCC);
padding-right: 12px;
}
table.treetable tr.branch {
background-color: #f9f9f9;
}
table.treetable tr.selected {
background-color: #3875d7;
color: #fff;
}
table.treetable tr span.indenter a {
outline: none; /* Expander shows outline after upgrading to 3.0 (#141) */
}
table.treetable tr.collapsed.selected span.indenter a {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBN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AVYHsjyZ1x7QAAAABJRU5ErkJggg==);
}
table.treetable tr.expanded.selected span.indenter a {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYS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ZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAFtJREFUeNpi/P//PwMlgImBQsA44C6giQENDAwM//HgBmLCAF/AMBLjBUeixf///48L7/+PCvZjU4fPAAc0AxywqcMXCwegGJ1NckL6jx5wpKYDxqGXEkkCgAEAmrqBIejdgngAAAAASUVORK5CYII=);
}
table.treetable tr.accept {
background-color: #a3bce4;
color: #fff
}
table.treetable tr.collapsed.accept td span.indenter a {
background-image: url(data:image/x-png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkK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R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAFpJREFUeNpi/P//PwMlgHHADWD4//8/NtyAQxwD45KAAQdKDfj//////fgMIsYAZIMw1DKREFwODAwM/4kNRKq64AADA4MjFDOQ6gKyY4HodMA49PMCxQYABgAVYHsjyZ1x7QAAAABJRU5ErkJggg==);
}
table.treetable tr.expanded.accept td span.indenter a {
background-image: url(data:image/x-png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUK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Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAFtJREFUeNpi/P//PwMlgImBQsA44C6giQENDAwM//HgBmLCAF/AMBLjBUeixf///48L7/+PCvZjU4fPAAc0AxywqcMXCwegGJ1NckL6jx5wpKYDxqGXEkkCgAEAmrqBIejdgngAAAAASUVORK5CYII=);
}

View File

@@ -0,0 +1,243 @@
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.1.0
*/
!function ($) {
'use strict';
var originalRowAttr,
dataTTId = 'data-tt-id',
dataTTParentId = 'data-tt-parent-id',
obj = {},
parentId = undefined;
var getParentRowId = function (that, id) {
var parentRows = that.$body.find('tr').not('[' + 'data-tt-parent-id]');
for (var i = 0; i < parentRows.length; i++) {
if (i === id) {
return $(parentRows[i]).attr('data-tt-id');
}
}
return undefined;
};
var sumData = function (that, data) {
var sumRow = {};
$.each(data, function (i, row) {
if (!row.IsParent) {
for (var prop in row) {
if (!isNaN(parseFloat(row[prop]))) {
if (that.columns[$.fn.bootstrapTable.utils.getFieldIndex(that.columns, prop)].groupBySumGroup) {
if (sumRow[prop] === undefined) {
sumRow[prop] = 0;
}
sumRow[prop] += +row[prop];
}
}
}
}
});
return sumRow;
};
var rowAttr = function (row, index) {
//Call the User Defined Function
originalRowAttr.apply([row, index]);
obj[dataTTId.toString()] = index;
if (!row.IsParent) {
obj[dataTTParentId.toString()] = parentId === undefined ? index : parentId;
} else {
parentId = index;
delete obj[dataTTParentId.toString()];
}
return obj;
};
var setObjectKeys = function () {
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
Object.keys = function (o) {
if (o !== Object(o)) {
throw new TypeError('Object.keys called on a non-object');
}
var k = [],
p;
for (p in o) {
if (Object.prototype.hasOwnProperty.call(o, p)) {
k.push(p);
}
}
return k;
}
};
var getDataArrayFromItem = function (that, item) {
var itemDataArray = [];
for (var i = 0; i < that.options.groupByField.length; i++) {
itemDataArray.push(item[that.options.groupByField[i]]);
}
return itemDataArray;
};
var getNewRow = function (that, result, index) {
var newRow = {};
for (var i = 0; i < that.options.groupByField.length; i++) {
newRow[that.options.groupByField[i].toString()] = result[index][0][that.options.groupByField[i]];
}
newRow.IsParent = true;
return newRow;
};
var groupBy = function (array, f) {
var groups = {};
$.each(array, function (i, o) {
var group = JSON.stringify(f(o));
groups[group] = groups[group] || [];
groups[group].push(o);
});
return Object.keys(groups).map(function (group) {
return groups[group];
});
};
var makeGrouped = function (that, data) {
var newData = [],
sumRow = {};
var result = groupBy(data, function (item) {
return getDataArrayFromItem(that, item);
});
for (var i = 0; i < result.length; i++) {
result[i].unshift(getNewRow(that, result, i));
if (that.options.groupBySumGroup) {
sumRow = sumData(that, result[i]);
if (!$.isEmptyObject(sumRow)) {
result[i].push(sumRow);
}
}
}
newData = newData.concat.apply(newData, result);
if (!that.options.loaded && newData.length > 0) {
that.options.loaded = true;
that.options.originalData = that.options.data;
that.options.data = newData;
}
return newData;
};
$.extend($.fn.bootstrapTable.defaults, {
groupBy: false,
groupByField: [],
groupBySumGroup: false,
groupByInitExpanded: undefined, //node, 'all'
//internal variables
loaded: false,
originalData: undefined
});
$.fn.bootstrapTable.methods.push('collapseAll', 'expandAll', 'refreshGroupByField');
$.extend($.fn.bootstrapTable.COLUMN_DEFAULTS, {
groupBySumGroup: false
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_init = BootstrapTable.prototype.init,
_initData = BootstrapTable.prototype.initData;
BootstrapTable.prototype.init = function () {
//Temporal validation
if (!this.options.sortName) {
if ((this.options.groupBy) && (this.options.groupByField.length > 0)) {
var that = this;
// Compatibility: IE < 9 and old browsers
if (!Object.keys) {
setObjectKeys();
}
//Make sure that the internal variables are set correctly
this.options.loaded = false;
this.options.originalData = undefined;
originalRowAttr = this.options.rowAttributes;
this.options.rowAttributes = rowAttr;
this.$el.on('post-body.bs.table', function () {
that.$el.treetable({
expandable: true,
onNodeExpand: function () {
if (that.options.height) {
that.resetHeader();
}
},
onNodeCollapse: function () {
if (that.options.height) {
that.resetHeader();
}
}
}, true);
if (that.options.groupByInitExpanded !== undefined) {
if (typeof that.options.groupByInitExpanded === 'number') {
that.expandNode(that.options.groupByInitExpanded);
} else if (that.options.groupByInitExpanded.toLowerCase() === 'all') {
that.expandAll();
}
}
});
}
}
_init.apply(this, Array.prototype.slice.apply(arguments));
};
BootstrapTable.prototype.initData = function (data, type) {
//Temporal validation
if (!this.options.sortName) {
if ((this.options.groupBy) && (this.options.groupByField.length > 0)) {
this.options.groupByField = typeof this.options.groupByField === 'string' ?
this.options.groupByField.replace('[', '').replace(']', '')
.replace(/ /g, '').toLowerCase().split(',') : this.options.groupByField;
data = makeGrouped(this, data ? data : this.options.data);
}
}
_initData.apply(this, [data, type]);
};
BootstrapTable.prototype.expandAll = function () {
this.$el.treetable('expandAll');
};
BootstrapTable.prototype.collapseAll = function () {
this.$el.treetable('collapseAll');
};
BootstrapTable.prototype.expandNode = function (id) {
id = getParentRowId(this, id);
if (id !== undefined) {
this.$el.treetable('expandNode', id);
}
};
BootstrapTable.prototype.refreshGroupByField = function (groupByFields) {
if (!$.fn.bootstrapTable.utils.compareObjects(this.options.groupByField, groupByFields)) {
this.options.groupByField = groupByFields;
this.load(this.options.originalData);
}
};
}(jQuery);

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";var b,c="data-tt-id",d="data-tt-parent-id",e={},f=void 0,g=function(b,c){for(var d=b.$body.find("tr").not("[data-tt-parent-id]"),e=0;e<d.length;e++)if(e===c)return a(d[e]).attr("data-tt-id");return void 0},h=function(b,c){var d={};return a.each(c,function(c,e){if(!e.IsParent)for(var f in e)isNaN(parseFloat(e[f]))||b.columns[a.fn.bootstrapTable.utils.getFieldIndex(b.columns,f)].groupBySumGroup&&(void 0===d[f]&&(d[f]=0),d[f]+=+e[f])}),d},i=function(a,g){return b.apply([a,g]),e[c.toString()]=g,a.IsParent?(f=g,delete e[d.toString()]):e[d.toString()]=void 0===f?g:f,e},j=function(){Object.keys=function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,c=[];for(b in a)Object.prototype.hasOwnProperty.call(a,b)&&c.push(b);return c}},k=function(a,b){for(var c=[],d=0;d<a.options.groupByField.length;d++)c.push(b[a.options.groupByField[d]]);return c},l=function(a,b,c){for(var d={},e=0;e<a.options.groupByField.length;e++)d[a.options.groupByField[e].toString()]=b[c][0][a.options.groupByField[e]];return d.IsParent=!0,d},m=function(b,c){var d={};return a.each(b,function(a,b){var e=JSON.stringify(c(b));d[e]=d[e]||[],d[e].push(b)}),Object.keys(d).map(function(a){return d[a]})},n=function(b,c){for(var d=[],e={},f=m(c,function(a){return k(b,a)}),g=0;g<f.length;g++)f[g].unshift(l(b,f,g)),b.options.groupBySumGroup&&(e=h(b,f[g]),a.isEmptyObject(e)||f[g].push(e));return d=d.concat.apply(d,f),!b.options.loaded&&d.length>0&&(b.options.loaded=!0,b.options.originalData=b.options.data,b.options.data=d),d};a.extend(a.fn.bootstrapTable.defaults,{groupBy:!1,groupByField:[],groupBySumGroup:!1,groupByInitExpanded:void 0,loaded:!1,originalData:void 0}),a.fn.bootstrapTable.methods.push("collapseAll","expandAll","refreshGroupByField"),a.extend(a.fn.bootstrapTable.COLUMN_DEFAULTS,{groupBySumGroup:!1});var o=a.fn.bootstrapTable.Constructor,p=o.prototype.init,q=o.prototype.initData;o.prototype.init=function(){if(!this.options.sortName&&this.options.groupBy&&this.options.groupByField.length>0){var a=this;Object.keys||j(),this.options.loaded=!1,this.options.originalData=void 0,b=this.options.rowAttributes,this.options.rowAttributes=i,this.$el.on("post-body.bs.table",function(){a.$el.treetable({expandable:!0,onNodeExpand:function(){a.options.height&&a.resetHeader()},onNodeCollapse:function(){a.options.height&&a.resetHeader()}},!0),void 0!==a.options.groupByInitExpanded&&("number"==typeof a.options.groupByInitExpanded?a.expandNode(a.options.groupByInitExpanded):"all"===a.options.groupByInitExpanded.toLowerCase()&&a.expandAll())})}p.apply(this,Array.prototype.slice.apply(arguments))},o.prototype.initData=function(a,b){this.options.sortName||this.options.groupBy&&this.options.groupByField.length>0&&(this.options.groupByField="string"==typeof this.options.groupByField?this.options.groupByField.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.groupByField,a=n(this,a?a:this.options.data)),q.apply(this,[a,b])},o.prototype.expandAll=function(){this.$el.treetable("expandAll")},o.prototype.collapseAll=function(){this.$el.treetable("collapseAll")},o.prototype.expandNode=function(a){a=g(this,a),void 0!==a&&this.$el.treetable("expandNode",a)},o.prototype.refreshGroupByField=function(b){a.fn.bootstrapTable.utils.compareObjects(this.options.groupByField,b)||(this.options.groupByField=b,this.load(this.options.originalData))}}(jQuery);

View File

@@ -0,0 +1,80 @@
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.0.0
*
* @update zhixin wen <wenzhixin2010@gmail.com>
*/
!function ($) {
'use strict';
$.extend($.fn.bootstrapTable.defaults, {
keyEvents: false
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_init = BootstrapTable.prototype.init;
BootstrapTable.prototype.init = function () {
_init.apply(this, Array.prototype.slice.apply(arguments));
this.initKeyEvents();
};
BootstrapTable.prototype.initKeyEvents = function () {
if (this.options.keyEvents) {
var that = this;
$(document).off('keydown').on('keydown', function (e) {
var $search = that.$toolbar.find('.search input'),
$refresh = that.$toolbar.find('button[name="refresh"]'),
$toggle = that.$toolbar.find('button[name="toggle"]'),
$paginationSwitch = that.$toolbar.find('button[name="paginationSwitch"]');
if (document.activeElement === $search.get(0)) {
return true;
}
switch (e.keyCode) {
case 83: //s
if (!that.options.search) {
return;
}
$search.focus();
return false;
case 82: //r
if (!that.options.showRefresh) {
return;
}
$refresh.click();
return false;
case 84: //t
if (!that.options.showToggle) {
return;
}
$toggle.click();
return false;
case 80: //p
if (!that.options.showPaginationSwitch) {
return;
}
$paginationSwitch.click();
return false;
case 37: // left
if (!that.options.pagination) {
return;
}
that.prevPage();
return false;
case 39: // right
if (!that.options.pagination) {
return;
}
that.nextPage();
return;
}
});
}
};
}(jQuery);

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";a.extend(a.fn.bootstrapTable.defaults,{keyEvents:!1});var b=a.fn.bootstrapTable.Constructor,c=b.prototype.init;b.prototype.init=function(){c.apply(this,Array.prototype.slice.apply(arguments)),this.initKeyEvents()},b.prototype.initKeyEvents=function(){if(this.options.keyEvents){var b=this;a(document).off("keydown").on("keydown",function(a){var c=b.$toolbar.find(".search input"),d=b.$toolbar.find('button[name="refresh"]'),e=b.$toolbar.find('button[name="toggle"]'),f=b.$toolbar.find('button[name="paginationSwitch"]');if(document.activeElement===c.get(0))return!0;switch(a.keyCode){case 83:if(!b.options.search)return;return c.focus(),!1;case 82:if(!b.options.showRefresh)return;return d.click(),!1;case 84:if(!b.options.showToggle)return;return e.click(),!1;case 80:if(!b.options.showPaginationSwitch)return;return f.click(),!1;case 37:if(!b.options.pagination)return;return b.prevPage(),!1;case 39:if(!b.options.pagination)return;return void b.nextPage()}})}}}(jQuery);

View File

@@ -0,0 +1,136 @@
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.1.0
*/
!function ($) {
'use strict';
var showHideColumns = function (that, checked) {
if (that.options.columnsHidden.length > 0 ) {
$.each(that.columns, function (i, column) {
if (that.options.columnsHidden.indexOf(column.field) !== -1) {
if (column.visible !== checked) {
that.toggleColumn($.fn.bootstrapTable.utils.getFieldIndex(that.columns, column.field), checked, true);
}
}
});
}
};
var resetView = function (that) {
if (that.options.height || that.options.showFooter) {
setTimeout(function(){
that.resetView.call(that);
}, 1);
}
};
var changeView = function (that, width, height) {
if (that.options.minHeight) {
if ((width <= that.options.minWidth) && (height <= that.options.minHeight)) {
conditionCardView(that);
} else if ((width > that.options.minWidth) && (height > that.options.minHeight)) {
conditionFullView(that);
}
} else {
if (width <= that.options.minWidth) {
conditionCardView(that);
} else if (width > that.options.minWidth) {
conditionFullView(that);
}
}
resetView(that);
};
var conditionCardView = function (that) {
changeTableView(that, false);
showHideColumns(that, false);
};
var conditionFullView = function (that) {
changeTableView(that, true);
showHideColumns(that, true);
};
var changeTableView = function (that, cardViewState) {
that.options.cardView = cardViewState;
that.toggleView();
};
var debounce = function(func,wait) {
var timeout;
return function() {
var context = this,
args = arguments;
var later = function() {
timeout = null;
func.apply(context,args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
};
$.extend($.fn.bootstrapTable.defaults, {
mobileResponsive: false,
minWidth: 562,
minHeight: undefined,
heightThreshold: 100, // just slightly larger than mobile chrome's auto-hiding toolbar
checkOnInit: true,
columnsHidden: []
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_init = BootstrapTable.prototype.init;
BootstrapTable.prototype.init = function () {
_init.apply(this, Array.prototype.slice.apply(arguments));
if (!this.options.mobileResponsive) {
return;
}
if (!this.options.minWidth) {
return;
}
if (this.options.minWidth < 100 && this.options.resizable) {
console.log("The minWidth when the resizable extension is active should be greater or equal than 100");
this.options.minWidth = 100;
}
var that = this,
old = {
width: $(window).width(),
height: $(window).height()
};
$(window).on('resize orientationchange',debounce(function (evt) {
// reset view if height has only changed by at least the threshold.
var height = $(this).height(),
width = $(this).width();
if (Math.abs(old.height - height) > that.options.heightThreshold || old.width != width) {
changeView(that, width, height);
old = {
width: width,
height: height
};
}
},200));
if (this.options.checkOnInit) {
var height = $(window).height(),
width = $(window).width();
changeView(this, width, height);
old = {
width: width,
height: height
};
}
};
}(jQuery);

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";var b=function(b,c){b.options.columnsHidden.length>0&&a.each(b.columns,function(d,e){-1!==b.options.columnsHidden.indexOf(e.field)&&e.visible!==c&&b.toggleColumn(a.fn.bootstrapTable.utils.getFieldIndex(b.columns,e.field),c,!0)})},c=function(a){(a.options.height||a.options.showFooter)&&setTimeout(function(){a.resetView.call(a)},1)},d=function(a,b,d){a.options.minHeight?b<=a.options.minWidth&&d<=a.options.minHeight?e(a):b>a.options.minWidth&&d>a.options.minHeight&&f(a):b<=a.options.minWidth?e(a):b>a.options.minWidth&&f(a),c(a)},e=function(a){g(a,!1),b(a,!1)},f=function(a){g(a,!0),b(a,!0)},g=function(a,b){a.options.cardView=b,a.toggleView()},h=function(a,b){var c;return function(){var d=this,e=arguments,f=function(){c=null,a.apply(d,e)};clearTimeout(c),c=setTimeout(f,b)}};a.extend(a.fn.bootstrapTable.defaults,{mobileResponsive:!1,minWidth:562,minHeight:void 0,heightThreshold:100,checkOnInit:!0,columnsHidden:[]});var i=a.fn.bootstrapTable.Constructor,j=i.prototype.init;i.prototype.init=function(){if(j.apply(this,Array.prototype.slice.apply(arguments)),this.options.mobileResponsive&&this.options.minWidth){this.options.minWidth<100&&this.options.resizable&&(console.log("The minWidth when the resizable extension is active should be greater or equal than 100"),this.options.minWidth=100);var b=this,c={width:a(window).width(),height:a(window).height()};if(a(window).on("resize orientationchange",h(function(){var e=a(this).height(),f=a(this).width();(Math.abs(c.height-e)>b.options.heightThreshold||c.width!=f)&&(d(b,f,e),c={width:f,height:e})},200)),this.options.checkOnInit){var e=a(window).height(),f=a(window).width();d(this,f,e),c={width:f,height:e}}}}}(jQuery);

View File

@@ -0,0 +1,67 @@
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.0.0
*/
!function ($) {
'use strict';
$.extend($.fn.bootstrapTable.defaults, {
multipleSearch: false
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initSearch = BootstrapTable.prototype.initSearch;
BootstrapTable.prototype.initSearch = function () {
if (this.options.multipleSearch) {
var strArray = this.searchText.split(" "),
that = this,
f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns,
dataFiltered = [];
if (strArray.length === 1) {
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
} else {
for (var i = 0; i < strArray.length; i++) {
var str = strArray[i].trim();
dataFiltered = str ? $.grep(dataFiltered.length === 0 ? this.options.data : dataFiltered, function (item, i) {
for (var key in item) {
key = $.isNumeric(key) ? parseInt(key, 10) : key;
var value = item[key],
column = that.columns[$.fn.bootstrapTable.utils.getFieldIndex(that.columns, key)],
j = $.inArray(key, that.header.fields);
// Fix #142: search use formated data
if (column && column.searchFormatter) {
value = $.fn.bootstrapTable.utils.calculateObjectValue(column,
that.header.formatters[j], [value, item, i], value);
}
var index = $.inArray(key, that.header.fields);
if (index !== -1 && that.header.searchables[index] && (typeof value === 'string' || typeof value === 'number')) {
if (that.options.strictSearch) {
if ((value + '').toLowerCase() === str) {
return true;
}
} else {
if ((value + '').toLowerCase().indexOf(str) !== -1) {
return true;
}
}
}
}
return false;
}) : this.data;
}
this.data = dataFiltered;
}
} else {
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
}
};
}(jQuery);

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";a.extend(a.fn.bootstrapTable.defaults,{multipleSearch:!1});var b=a.fn.bootstrapTable.Constructor,c=b.prototype.initSearch;b.prototype.initSearch=function(){if(this.options.multipleSearch){var b=this.searchText.split(" "),d=this,e=(a.isEmptyObject(this.filterColumns)?null:this.filterColumns,[]);if(1===b.length)c.apply(this,Array.prototype.slice.apply(arguments));else{for(var f=0;f<b.length;f++){var g=b[f].trim();e=g?a.grep(0===e.length?this.options.data:e,function(b,c){for(var e in b){e=a.isNumeric(e)?parseInt(e,10):e;var f=b[e],h=d.columns[a.fn.bootstrapTable.utils.getFieldIndex(d.columns,e)],i=a.inArray(e,d.header.fields);h&&h.searchFormatter&&(f=a.fn.bootstrapTable.utils.calculateObjectValue(h,d.header.formatters[i],[f,b,c],f));var j=a.inArray(e,d.header.fields);if(-1!==j&&d.header.searchables[j]&&("string"==typeof f||"number"==typeof f))if(d.options.strictSearch){if((f+"").toLowerCase()===g)return!0}else if(-1!==(f+"").toLowerCase().indexOf(g))return!0}return!1}):this.data}this.data=e}}else c.apply(this,Array.prototype.slice.apply(arguments))}}(jQuery);

View File

@@ -0,0 +1,378 @@
/**
* @author Nadim Basalamah <dimbslmh@gmail.com>
* @version: v1.0.0
* https://github.com/dimbslmh/bootstrap-table/tree/master/src/extensions/multiple-sort/bootstrap-table-multiple-sort.js
*/
(function($) {
'use strict';
var isSingleSort = false;
var sort_order = {
asc: 'Ascending',
desc: 'Descending'
};
var showSortModal = function(that) {
var _selector = that.$sortModal.selector,
_id = _selector.substr(1);
if (!$(_id).hasClass("modal")) {
var sModal = ' <div class="modal fade" id="' + _id + '" tabindex="-1" role="dialog" aria-labelledby="' + _id + 'Label" aria-hidden="true">';
sModal += ' <div class="modal-dialog">';
sModal += ' <div class="modal-content">';
sModal += ' <div class="modal-header">';
sModal += ' <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>';
sModal += ' <h4 class="modal-title" id="' + _id + 'Label">' + that.options.formatMultipleSort() + '</h4>';
sModal += ' </div>';
sModal += ' <div class="modal-body">';
sModal += ' <div class="bootstrap-table">';
sModal += ' <div class="fixed-table-toolbar">';
sModal += ' <div class="bars">';
sModal += ' <div id="toolbar">';
sModal += ' <button id="add" type="button" class="btn btn-default"><i class="' + that.options.iconsPrefix + ' ' + that.options.icons.plus + '"></i> ' + that.options.formatAddLevel() + '</button>';
sModal += ' <button id="delete" type="button" class="btn btn-default" disabled><i class="' + that.options.iconsPrefix + ' ' + that.options.icons.minus + '"></i> ' + that.options.formatDeleteLevel() + '</button>';
sModal += ' </div>';
sModal += ' </div>';
sModal += ' </div>';
sModal += ' <div class="fixed-table-container">';
sModal += ' <table id="multi-sort" class="table">';
sModal += ' <thead>';
sModal += ' <tr>';
sModal += ' <th></th>';
sModal += ' <th><div class="th-inner">' + that.options.formatColumn() + '</div></th>';
sModal += ' <th><div class="th-inner">' + that.options.formatOrder() + '</div></th>';
sModal += ' </tr>';
sModal += ' </thead>';
sModal += ' <tbody></tbody>';
sModal += ' </table>';
sModal += ' </div>';
sModal += ' </div>';
sModal += ' </div>';
sModal += ' <div class="modal-footer">';
sModal += ' <button type="button" class="btn btn-default" data-dismiss="modal">' + that.options.formatCancel() + '</button>';
sModal += ' <button type="button" class="btn btn-primary">' + that.options.formatSort() + '</button>';
sModal += ' </div>';
sModal += ' </div>';
sModal += ' </div>';
sModal += ' </div>';
$("body").append($(sModal));
that.$sortModal = $(_selector);
var $rows = that.$sortModal.find("tbody > tr");
that.$sortModal.off('click', '#add').on('click', '#add', function() {
var total = that.$sortModal.find('.multi-sort-name:first option').length,
current = that.$sortModal.find('tbody tr').length;
if (current < total) {
current++;
that.addLevel();
that.setButtonStates();
}
});
that.$sortModal.off('click', '#delete').on('click', '#delete', function() {
var total = that.$sortModal.find('.multi-sort-name:first option').length,
current = that.$sortModal.find('tbody tr').length;
if (current > 1 && current <= total) {
current--;
that.$sortModal.find('tbody tr:last').remove();
that.setButtonStates();
}
});
that.$sortModal.off('click', '.btn-primary').on('click', '.btn-primary', function() {
var $rows = that.$sortModal.find("tbody > tr"),
$alert = that.$sortModal.find('div.alert'),
fields = [],
results = [];
that.options.sortPriority = $.map($rows, function(row) {
var $row = $(row),
name = $row.find('.multi-sort-name').val(),
order = $row.find('.multi-sort-order').val();
fields.push(name);
return {
sortName: name,
sortOrder: order
};
});
var sorted_fields = fields.sort();
for (var i = 0; i < fields.length - 1; i++) {
if (sorted_fields[i + 1] == sorted_fields[i]) {
results.push(sorted_fields[i]);
}
}
if (results.length > 0) {
if ($alert.length === 0) {
$alert = '<div class="alert alert-danger" role="alert"><strong>' + that.options.formatDuplicateAlertTitle() + '</strong> ' + that.options.formatDuplicateAlertDescription() + '</div>';
$($alert).insertBefore(that.$sortModal.find('.bars'));
}
} else {
if ($alert.length === 1) {
$($alert).remove();
}
that.options.sortName = "";
that.onMultipleSort();
that.$sortModal.modal('hide');
}
});
if (that.options.sortPriority === null || that.options.sortPriority.length === 0) {
if (that.options.sortName) {
that.options.sortPriority = [{
sortName: that.options.sortName,
sortOrder: that.options.sortOrder
}];
}
}
if (that.options.sortPriority !== null && that.options.sortPriority.length > 0) {
if ($rows.length < that.options.sortPriority.length && typeof that.options.sortPriority === 'object') {
for (var i = 0; i < that.options.sortPriority.length; i++) {
that.addLevel(i, that.options.sortPriority[i]);
}
}
} else {
that.addLevel(0);
}
that.setButtonStates();
}
};
$.extend($.fn.bootstrapTable.defaults, {
showMultiSort: false,
sortPriority: null,
onMultipleSort: function() {
return false;
}
});
$.extend($.fn.bootstrapTable.defaults.icons, {
sort: 'glyphicon-sort',
plus: 'glyphicon-plus',
minus: 'glyphicon-minus'
});
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
'multiple-sort.bs.table': 'onMultipleSort'
});
$.extend($.fn.bootstrapTable.locales, {
formatMultipleSort: function() {
return 'Multiple Sort';
},
formatAddLevel: function() {
return "Add Level";
},
formatDeleteLevel: function() {
return "Delete Level";
},
formatColumn: function() {
return "Column";
},
formatOrder: function() {
return "Order";
},
formatSortBy: function() {
return "Sort by";
},
formatThenBy: function() {
return "Then by";
},
formatSort: function() {
return "Sort";
},
formatCancel: function() {
return "Cancel";
},
formatDuplicateAlertTitle: function() {
return "Duplicate(s) detected!";
},
formatDuplicateAlertDescription: function() {
return "Please remove or change any duplicate column.";
}
});
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initToolbar = BootstrapTable.prototype.initToolbar;
BootstrapTable.prototype.initToolbar = function() {
this.showToolbar = true;
var that = this,
sortModalId = '#sortModal_' + this.$el.attr('id');
this.$sortModal = $(sortModalId);
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
if (this.options.showMultiSort) {
var $btnGroup = this.$toolbar.find('>.btn-group').first(),
$multiSortBtn = this.$toolbar.find('div.multi-sort');
if (!$multiSortBtn.length) {
$multiSortBtn = ' <button class="multi-sort btn btn-default' + (this.options.iconSize === undefined ? '' : ' btn-' + this.options.iconSize) + '" type="button" data-toggle="modal" data-target="' + sortModalId + '" title="' + this.options.formatMultipleSort() + '">';
$multiSortBtn += ' <i class="' + this.options.iconsPrefix + ' ' + this.options.icons.sort + '"></i>';
$multiSortBtn += '</button>';
$btnGroup.append($multiSortBtn);
showSortModal(that);
}
this.$el.on('sort.bs.table', function() {
isSingleSort = true;
});
this.$el.on('multiple-sort.bs.table', function() {
isSingleSort = false;
});
this.$el.on('load-success.bs.table', function() {
if (!isSingleSort && that.options.sortPriority !== null && typeof that.options.sortPriority === 'object') {
that.onMultipleSort();
}
});
this.$el.on('column-switch.bs.table', function(field, checked) {
for (var i = 0; i < that.options.sortPriority.length; i++) {
if (that.options.sortPriority[i].sortName === checked) {
that.options.sortPriority.splice(i, 1);
}
}
that.assignSortableArrows();
that.$sortModal.remove();
showSortModal(that);
});
this.$el.on('reset-view.bs.table', function() {
if (!isSingleSort && that.options.sortPriority !== null && typeof that.options.sortPriority === 'object') {
that.assignSortableArrows();
}
});
}
};
BootstrapTable.prototype.onMultipleSort = function() {
var that = this;
var cmp = function(x, y) {
return x > y ? 1 : x < y ? -1 : 0;
};
var arrayCmp = function(a, b) {
var arr1 = [],
arr2 = [];
for (var i = 0; i < that.options.sortPriority.length; i++) {
var order = that.options.sortPriority[i].sortOrder === 'desc' ? -1 : 1,
aa = a[that.options.sortPriority[i].sortName],
bb = b[that.options.sortPriority[i].sortName];
if (aa === undefined || aa === null) {
aa = '';
}
if (bb === undefined || bb === null) {
bb = '';
}
if ($.isNumeric(aa) && $.isNumeric(bb)) {
aa = parseFloat(aa);
bb = parseFloat(bb);
}
if (typeof aa !== 'string') {
aa = aa.toString();
}
arr1.push(
order * cmp(aa, bb));
arr2.push(
order * cmp(bb, aa));
}
return cmp(arr1, arr2);
};
this.data.sort(function(a, b) {
return arrayCmp(a, b);
});
this.initBody();
this.assignSortableArrows();
this.trigger('multiple-sort');
};
BootstrapTable.prototype.addLevel = function(index, sortPriority) {
var text = index === 0 ? this.options.formatSortBy() : this.options.formatThenBy();
this.$sortModal.find('tbody')
.append($('<tr>')
.append($('<td>').text(text))
.append($('<td>').append($('<select class="form-control multi-sort-name">')))
.append($('<td>').append($('<select class="form-control multi-sort-order">')))
);
var $multiSortName = this.$sortModal.find('.multi-sort-name').last(),
$multiSortOrder = this.$sortModal.find('.multi-sort-order').last();
$.each(this.columns, function (i, column) {
if (column.sortable === false || column.visible === false) {
return true;
}
$multiSortName.append('<option value="' + column.field + '">' + column.title + '</option>');
});
$.each(sort_order, function(value, order) {
$multiSortOrder.append('<option value="' + value + '">' + order + '</option>');
});
if (sortPriority !== undefined) {
$multiSortName.find('option[value="' + sortPriority.sortName + '"]').attr("selected", true);
$multiSortOrder.find('option[value="' + sortPriority.sortOrder + '"]').attr("selected", true);
}
};
BootstrapTable.prototype.assignSortableArrows = function() {
var that = this,
headers = that.$header.find('th');
for (var i = 0; i < headers.length; i++) {
for (var c = 0; c < that.options.sortPriority.length; c++) {
if ($(headers[i]).data('field') === that.options.sortPriority[c].sortName) {
$(headers[i]).find('.sortable').removeClass('desc asc').addClass(that.options.sortPriority[c].sortOrder);
}
}
}
};
BootstrapTable.prototype.setButtonStates = function() {
var total = this.$sortModal.find('.multi-sort-name:first option').length,
current = this.$sortModal.find('tbody tr').length;
if (current == total) {
this.$sortModal.find('#add').attr('disabled', 'disabled');
}
if (current > 1) {
this.$sortModal.find('#delete').removeAttr('disabled');
}
if (current < total) {
this.$sortModal.find('#add').removeAttr('disabled');
}
if (current == 1) {
this.$sortModal.find('#delete').attr('disabled', 'disabled');
}
};
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,57 @@
/**
* @author: Brian Huisman
* @webSite: http://www.greywyvern.com
* @version: v1.0.0
* JS functions to allow natural sorting on bootstrap-table columns
* add data-sorter="alphanum" or data-sorter="numericOnly" to any th
*
* @update Dennis Hernández <http://djhvscf.github.io/Blog>
* @update Duane May
*/
function alphanum(a, b) {
function chunkify(t) {
var tz = [],
x = 0,
y = -1,
n = 0,
i,
j;
while (i = (j = t.charAt(x++)).charCodeAt(0)) {
var m = (i === 46 || (i >= 48 && i <= 57));
if (m !== n) {
tz[++y] = "";
n = m;
}
tz[y] += j;
}
return tz;
}
var aa = chunkify(a);
var bb = chunkify(b);
for (x = 0; aa[x] && bb[x]; x++) {
if (aa[x] !== bb[x]) {
var c = Number(aa[x]),
d = Number(bb[x]);
if (c == aa[x] && d == bb[x]) {
return c - d;
} else {
return (aa[x] > bb[x]) ? 1 : -1;
}
}
}
return aa.length - bb.length;
}
function numericOnly(a, b) {
function stripNonNumber(s) {
s = s.replace(new RegExp(/[^0-9]/g), "");
return parseInt(s, 10);
}
return stripNonNumber(a) - stripNonNumber(b);
}

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
function alphanum(a,b){function c(a){for(var b,c,d=[],e=0,f=-1,g=0;b=(c=a.charAt(e++)).charCodeAt(0);){var h=46===b||b>=48&&57>=b;h!==g&&(d[++f]="",g=h),d[f]+=c}return d}var d=c(a),e=c(b);for(x=0;d[x]&&e[x];x++)if(d[x]!==e[x]){var f=Number(d[x]),g=Number(e[x]);return f==d[x]&&g==e[x]?f-g:d[x]>e[x]?1:-1}return d.length-e.length}function numericOnly(a,b){function c(a){return a=a.replace(new RegExp(/[^0-9]/g),""),parseInt(a,10)}return c(a)-c(b)}

View File

@@ -0,0 +1,121 @@
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.1.0
*/
!function ($) {
'use strict';
$.extend($.fn.bootstrapTable.defaults, {
reorderableColumns: false,
maxMovingRows: 10,
onReorderColumn: function (headerFields) {
return false;
},
dragaccept: null
});
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
'reorder-column.bs.table': 'onReorderColumn'
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initHeader = BootstrapTable.prototype.initHeader,
_toggleColumn = BootstrapTable.prototype.toggleColumn,
_toggleView = BootstrapTable.prototype.toggleView,
_resetView = BootstrapTable.prototype.resetView;
BootstrapTable.prototype.initHeader = function () {
_initHeader.apply(this, Array.prototype.slice.apply(arguments));
if (!this.options.reorderableColumns) {
return;
}
this.makeRowsReorderable();
};
BootstrapTable.prototype.toggleColumn = function () {
_toggleColumn.apply(this, Array.prototype.slice.apply(arguments));
if (!this.options.reorderableColumns) {
return;
}
this.makeRowsReorderable();
};
BootstrapTable.prototype.toggleView = function () {
_toggleView.apply(this, Array.prototype.slice.apply(arguments));
if (!this.options.reorderableColumns) {
return;
}
if (this.options.cardView) {
return;
}
this.makeRowsReorderable();
};
BootstrapTable.prototype.resetView = function () {
_resetView.apply(this, Array.prototype.slice.apply(arguments));
if (!this.options.reorderableColumns) {
return;
}
this.makeRowsReorderable();
};
BootstrapTable.prototype.makeRowsReorderable = function () {
var that = this;
try {
$(this.$el).dragtable('destroy');
} catch (e) {}
$(this.$el).dragtable({
maxMovingRows: that.options.maxMovingRows,
dragaccept: that.options.dragaccept,
clickDelay:200,
beforeStop: function() {
var ths = [],
formatters = [],
columns = [],
columnsHidden = [],
columnIndex = -1;
that.$header.find('th').each(function (i) {
ths.push($(this).data('field'));
formatters.push($(this).data('formatter'));
});
//Exist columns not shown
if (ths.length < that.columns.length) {
columnsHidden = $.grep(that.columns, function (column) {
return !column.visible;
});
for (var i = 0; i < columnsHidden.length; i++) {
ths.push(columnsHidden[i].field);
formatters.push(columnsHidden[i].formatter);
}
}
for (var i = 0; i < ths.length; i++ ) {
columnIndex = $.fn.bootstrapTable.utils.getFieldIndex(that.columns, ths[i]);
if (columnIndex !== -1) {
columns.push(that.columns[columnIndex]);
that.columns.splice(columnIndex, 1);
}
}
that.columns = that.columns.concat(columns);
that.header.fields = ths;
that.header.formatters = formatters;
that.resetView();
that.trigger('reorder-column', ths);
}
});
};
}(jQuery);

View File

@@ -0,0 +1,7 @@
/*
* bootstrap-table - v1.10.0 - 2016-01-18
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";a.extend(a.fn.bootstrapTable.defaults,{reorderableColumns:!1,maxMovingRows:10,onReorderColumn:function(){return!1},dragaccept:null}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"reorder-column.bs.table":"onReorderColumn"});var b=a.fn.bootstrapTable.Constructor,c=b.prototype.initHeader,d=b.prototype.toggleColumn,e=b.prototype.toggleView,f=b.prototype.resetView;b.prototype.initHeader=function(){c.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&this.makeRowsReorderable()},b.prototype.toggleColumn=function(){d.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&this.makeRowsReorderable()},b.prototype.toggleView=function(){e.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&(this.options.cardView||this.makeRowsReorderable())},b.prototype.resetView=function(){f.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&this.makeRowsReorderable()},b.prototype.makeRowsReorderable=function(){var b=this;try{a(this.$el).dragtable("destroy")}catch(c){}a(this.$el).dragtable({maxMovingRows:b.options.maxMovingRows,dragaccept:b.options.dragaccept,clickDelay:200,beforeStop:function(){var c=[],d=[],e=[],f=[],g=-1;if(b.$header.find("th").each(function(){c.push(a(this).data("field")),d.push(a(this).data("formatter"))}),c.length<b.columns.length){f=a.grep(b.columns,function(a){return!a.visible});for(var h=0;h<f.length;h++)c.push(f[h].field),d.push(f[h].formatter)}for(var h=0;h<c.length;h++)g=a.fn.bootstrapTable.utils.getFieldIndex(b.columns,c[h]),-1!==g&&(e.push(b.columns[g]),b.columns.splice(g,1));b.columns=b.columns.concat(e),b.header.fields=c,b.header.formatters=d,b.resetView(),b.trigger("reorder-column",c)}})}}(jQuery);

View File

@@ -0,0 +1,14 @@
.reorder_rows_onDragClass td {
background-color: #eee;
-webkit-box-shadow: 11px 5px 12px 2px #333, 0 1px 0 #ccc inset, 0 -1px 0 #ccc inset;
-webkit-box-shadow: 6px 3px 5px #555, 0 1px 0 #ccc inset, 0 -1px 0 #ccc inset;
-moz-box-shadow: 6px 4px 5px 1px #555, 0 1px 0 #ccc inset, 0 -1px 0 #ccc inset;
-box-shadow: 6px 4px 5px 1px #555, 0 1px 0 #ccc inset, 0 -1px 0 #ccc inset;
}
.reorder_rows_onDragClass td:last-child {
-webkit-box-shadow: 8px 7px 12px 0 #333, 0 1px 0 #ccc inset, 0 -1px 0 #ccc inset;
-webkit-box-shadow: 1px 8px 6px -4px #555, 0 1px 0 #ccc inset, 0 -1px 0 #ccc inset;
-moz-box-shadow: 0 9px 4px -4px #555, 0 1px 0 #ccc inset, 0 -1px 0 #ccc inset, -1px 0 0 #ccc inset;
-box-shadow: 0 9px 4px -4px #555, 0 1px 0 #ccc inset, 0 -1px 0 #ccc inset, -1px 0 0 #ccc inset;
}

View File

@@ -0,0 +1,116 @@
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.0.0
*/
!function ($) {
'use strict';
var isSearch = false;
var rowAttr = function (row, index) {
return {
id: 'customId_' + index
};
};
$.extend($.fn.bootstrapTable.defaults, {
reorderableRows: false,
onDragStyle: null,
onDropStyle: null,
onDragClass: "reorder_rows_onDragClass",
dragHandle: null,
useRowAttrFunc: false,
onReorderRowsDrag: function (table, row) {
return false;
},
onReorderRowsDrop: function (table, row) {
return false;
},
onReorderRow: function (newData) {
return false;
}
});
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
'reorder-row.bs.table': 'onReorderRow'
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_init = BootstrapTable.prototype.init,
_initSearch = BootstrapTable.prototype.initSearch;
BootstrapTable.prototype.init = function () {
if (!this.options.reorderableRows) {
_init.apply(this, Array.prototype.slice.apply(arguments));
return;
}
var that = this;
if (this.options.useRowAttrFunc) {
this.options.rowAttributes = rowAttr;
}
var onPostBody = this.options.onPostBody;
this.options.onPostBody = function () {
setTimeout(function () {
that.makeRowsReorderable();
onPostBody.apply();
}, 1);
};
_init.apply(this, Array.prototype.slice.apply(arguments));
};
BootstrapTable.prototype.initSearch = function () {
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
if (!this.options.reorderableRows) {
return;
}
//Known issue after search if you reorder the rows the data is not display properly
//isSearch = true;
};
BootstrapTable.prototype.makeRowsReorderable = function () {
if (this.options.cardView) {
return;
}
var that = this;
this.$el.tableDnD({
onDragStyle: that.options.onDragStyle,
onDropStyle: that.options.onDropStyle,
onDragClass: that.options.onDragClass,
onDrop: that.onDrop,
onDragStart: that.options.onReorderRowsDrag,
dragHandle: that.options.dragHandle
});
};
BootstrapTable.prototype.onDrop = function (table, droppedRow) {
var tableBs = $(table),
tableBsData = tableBs.data('bootstrap.table'),
tableBsOptions = tableBs.data('bootstrap.table').options,
row = null,
newData = [];
for (var i = 0; i < table.tBodies[0].rows.length; i++) {
row = $(table.tBodies[0].rows[i]);
newData.push(tableBsOptions.data[row.data('index')]);
row.data('index', i).attr('data-index', i);
}
tableBsOptions.data = newData;
//Call the user defined function
tableBsOptions.onReorderRowsDrop.apply(table, [table, droppedRow]);
//Call the event reorder-row
tableBsData.trigger('reorder-row', newData);
};
}(jQuery);

Some files were not shown because too many files have changed in this diff Show More