mirror of https://gitee.com/karson/fastadmin.git
修复特殊字段导致生成Model的错误
修复Toastr在首页弹出位置的错误 移除Category的diyname字段 移动统计代码到index.js文件中,去除视图中的统计代码pull/323483/MERGE
parent
cbfc382d8c
commit
3a29ac2e4a
|
|
@ -548,6 +548,10 @@ class Crud extends Command
|
|||
|
||||
protected function getAttr(&$getAttr, $field, $itemArr = '', $inputType = '')
|
||||
{
|
||||
if (preg_match("/[_\-]+/", $field))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!in_array($inputType, ['datetime', 'select', 'multiple', 'checkbox', 'radio']))
|
||||
return;
|
||||
$attrField = ucfirst($field);
|
||||
|
|
@ -595,6 +599,10 @@ EOD;
|
|||
|
||||
protected function setAttr(&$setAttr, $field, $itemArr = '', $inputType = '')
|
||||
{
|
||||
if (preg_match("/[_\-]+/", $field))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ($inputType != 'datetime')
|
||||
return;
|
||||
$field = ucfirst($field);
|
||||
|
|
@ -614,6 +622,10 @@ EOD;
|
|||
|
||||
protected function appendAttr(&$appendAttrList, $field)
|
||||
{
|
||||
if (preg_match("/[_\-]+/", $field))
|
||||
{
|
||||
return;
|
||||
}
|
||||
$appendAttrList[] = <<<EOD
|
||||
'{$field}_text'
|
||||
EOD;
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@
|
|||
<label for="nickname" class="control-label">{:__('Nickname')}:</label>
|
||||
<input type="text" class="form-control" id="nickname" name="row[nickname]" value="" required="required" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="diyname" class="control-label">{:__('Diyname')}:</label>
|
||||
<input type="text" class="form-control" id="diyname" name="row[diyname]" value="" required="required" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="keywords" class="control-label">{:__('Keywords')}:</label>
|
||||
<input type="text" class="form-control" id="keywords" name="row[keywords]" value="" />
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@
|
|||
<label for="nickname" class="control-label">{:__('Nickname')}:</label>
|
||||
<input type="text" class="form-control" id="nickname" name="row[nickname]" value="{$row.nickname}" required="required" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="diyname" class="control-label">{:__('Diyname')}:</label>
|
||||
<input type="text" class="form-control" id="diyname" name="row[diyname]" value="{$row.diyname}" required="required" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="keywords" class="control-label">{:__('Keywords')}:</label>
|
||||
<input type="text" class="form-control" id="keywords" name="row[keywords]" value="{$row.keywords}" />
|
||||
|
|
|
|||
|
|
@ -2,17 +2,6 @@
|
|||
<html lang="{$config.language}">
|
||||
<head>
|
||||
{include file="common/meta" /}
|
||||
|
||||
<script>
|
||||
//此处为FastAdmin的统计代码,正式使用请移除
|
||||
var _hmt = _hmt || [];
|
||||
(function () {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?58347d769d009bcf6074e9a0ab7ba05e";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
<body class="hold-transition skin-green sidebar-mini fixed" id="tabs">
|
||||
<div class="wrapper">
|
||||
|
|
|
|||
|
|
@ -73,6 +73,10 @@ body {
|
|||
.searchit {
|
||||
border-bottom: 1px dashed #3c8dbc;
|
||||
}
|
||||
.toast-top-right-index {
|
||||
top: 62px;
|
||||
right: 12px;
|
||||
}
|
||||
/*
|
||||
* RIBBON
|
||||
*/
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -347,6 +347,9 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], function ($
|
|||
init: function () {
|
||||
//公共代码
|
||||
//配置Toastr的参数
|
||||
if (Config.controllername == 'index') {
|
||||
Backend.config.toastr.positionClass = "toast-top-right-index";
|
||||
}
|
||||
Toastr.options = Backend.config.toastr;
|
||||
//点击包含.btn-dialog的元素时弹出dialog
|
||||
$(document).on('click', '.btn-dialog,.dialogit', function (e) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
|
|||
{field: 'id', title: 'ID'},
|
||||
{field: 'name', title: __('Name'), align: 'left'},
|
||||
{field: 'nickname', title: __('Nickname')},
|
||||
{field: 'type', title: __('Type')},
|
||||
{field: 'flag', title: __('Flag'), formatter: Table.api.formatter.flag},
|
||||
{field: 'weigh', title: __('Weigh')},
|
||||
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
|
||||
|
|
|
|||
|
|
@ -24,13 +24,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
{field: 'id', title: 'ID', operate: false},
|
||||
//使用Table.api.formatter.search可直接响应搜索
|
||||
{field: 'username', title: __('Username'), formatter: Table.api.formatter.search},
|
||||
{field: 'title', title: __('Title')},
|
||||
{field: 'title', title: __('Title'),
|
||||
operate: 'LIKE %...%',
|
||||
placeholder: '模糊搜索,*表示任意字符',
|
||||
style: 'width:200px',
|
||||
process: function (value, arg) {
|
||||
return value.replace(/\*/g, '%');
|
||||
}
|
||||
},
|
||||
{field: 'url', title: __('Url'), align: 'left', formatter: Controller.api.formatter.url},
|
||||
//点击IP时同时执行搜索此IP
|
||||
{field: 'ip', title: __('IP'), events: Controller.api.events.ip, formatter: Controller.api.formatter.ip},
|
||||
//点击IP时同时执行搜索此IP,同时普通搜索使用下拉列表的形式
|
||||
{field: 'ip', title: __('IP'), searchList: ['127.0.0.1', '127.0.0.2'], events: Controller.api.events.ip, formatter: Controller.api.formatter.ip},
|
||||
//browser是一个不存在的字段
|
||||
//通过formatter来渲染数据,同时为它添加上事件
|
||||
{field: 'browser', title: __('Browser'), operate: false, events: Controller.api.events.browser, formatter: Controller.api.formatter.browser},
|
||||
//启用时间段搜索
|
||||
{field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'BETWEEN', type: 'datetime', addclass: 'datetimepicker', data: 'data-date-format="YYYY-MM-DD HH:mm:ss"'},
|
||||
//我们向操作栏额外添加上一个详情按钮,并保留已有的编辑和删除控制,同时为这个按钮添加上点击事件
|
||||
{field: 'operate', title: __('Operate'), events: Controller.api.events.operate, formatter: Controller.api.formatter.operate}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,12 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
|
|||
e.stopPropagation();
|
||||
});
|
||||
|
||||
//此处为FastAdmin的统计代码,正式使用请移除
|
||||
var s = document.createElement("script");
|
||||
s.type = "text/javascript";
|
||||
s.src = "https://hm.baidu.com/hm.js?58347d769d009bcf6074e9a0ab7ba05e";
|
||||
$("head").append(s);
|
||||
|
||||
//读取FastAdmin的更新信息
|
||||
$.ajax({
|
||||
url: 'http://demo.fastadmin.net/index/index/news',
|
||||
|
|
|
|||
|
|
@ -6663,7 +6663,7 @@ define('backend',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], f
|
|||
});
|
||||
},
|
||||
addtabs: function (url, title, icon) {
|
||||
var dom = ".sidebar-menu li a[url='{url}']"
|
||||
var dom = "a[url='{url}']"
|
||||
var leftlink = top.window.$(dom.replace(/\{url\}/, url));
|
||||
if (leftlink.size() > 0) {
|
||||
leftlink.trigger("click");
|
||||
|
|
@ -6690,7 +6690,7 @@ define('backend',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], f
|
|||
var id = Math.floor(new Date().valueOf() * Math.random());
|
||||
icon = typeof icon != 'undefined' ? icon : 'fa fa-circle-o';
|
||||
title = typeof title != 'undefined' ? title : '';
|
||||
top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({url: url, addtabs: id}).appendTo(top.window.document.body).trigger("click");
|
||||
top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({url: url, addtabs: id}).addClass("hide").appendTo(top.window.document.body).trigger("click");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6764,6 +6764,9 @@ define('backend',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'moment'], f
|
|||
init: function () {
|
||||
//公共代码
|
||||
//配置Toastr的参数
|
||||
if (Config.controllername == 'index') {
|
||||
Backend.config.toastr.positionClass = "toast-top-right-index";
|
||||
}
|
||||
Toastr.options = Backend.config.toastr;
|
||||
//点击包含.btn-dialog的元素时弹出dialog
|
||||
$(document).on('click', '.btn-dialog,.dialogit', function (e) {
|
||||
|
|
@ -10939,9 +10942,9 @@ define('form',['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator'
|
|||
stopOnError: true,
|
||||
valid: function (ret) {
|
||||
//验证通过提交表单
|
||||
Form.api.submit(form, onBeforeSubmit, function (data) {
|
||||
Form.api.submit($(ret), onBeforeSubmit, function (data) {
|
||||
if (typeof onAfterSubmit == 'function') {
|
||||
if (!onAfterSubmit.call(form, data)) {
|
||||
if (!onAfterSubmit.call($(ret), data)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -11102,7 +11105,7 @@ define('form',['jquery', 'bootstrap', 'backend', 'toastr', 'upload', 'validator'
|
|||
$(document).on('click', ".fachoose", function () {
|
||||
var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
|
||||
var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
|
||||
Backend.api.open("general/attachment/select?callback=refreshchoose&element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype="+mimetype, __('Choose'));
|
||||
Backend.api.open("general/attachment/select?callback=refreshchoose&element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype, __('Choose'));
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -97,6 +97,11 @@ body {
|
|||
border-bottom:1px dashed @link-color;
|
||||
}
|
||||
|
||||
.toast-top-right-index{
|
||||
top:62px;
|
||||
right:12px;
|
||||
}
|
||||
|
||||
/*
|
||||
* RIBBON
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue