diff --git a/package.json b/package.json
index c161675..5503589 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ddms",
- "version": "0.2.2",
+ "version": "0.2.5",
"description": "Data Drive Management System",
"license": "MIT",
"main": "bin/www",
diff --git a/public/js/Core.standalone.js b/public/js/Core.standalone.js
index 2022c44..bde7d66 100644
--- a/public/js/Core.standalone.js
+++ b/public/js/Core.standalone.js
@@ -18,7 +18,7 @@ var util_RequestAnimationFrame, core_LocalStorage, core_Navigator, core_Subject,
var lcst = window.localStorage;
/**
* 读取
- *
+ *
* @method getLocalValue
* @param {String} id item id
* @return {String} value
@@ -32,7 +32,7 @@ var util_RequestAnimationFrame, core_LocalStorage, core_Navigator, core_Subject,
}
/**
* 保存/更新
- *
+ *
* @method setLocalValue
* @param {String}|{Object} id item id
* @param {String} val value
@@ -444,7 +444,7 @@ var util_RequestAnimationFrame, core_LocalStorage, core_Navigator, core_Subject,
var RequestHandler = function () {
/**
* AJAX管理器
- *
+ *
* @param Object option
* option:{
* type : String 请求类型POST/GET
@@ -482,7 +482,7 @@ var util_RequestAnimationFrame, core_LocalStorage, core_Navigator, core_Subject,
}
});
}
- //end AJAXHandler
+ //end AJAXHandler
function JSONP(option) {
if (!option) {
return;
@@ -513,7 +513,7 @@ var util_RequestAnimationFrame, core_LocalStorage, core_Navigator, core_Subject,
option.dataType = 'json';
AJAXHandler(option);
}
- //end postJSON
+ //end postJSON
return {
getJSON: getJSON,
postJSON: postJSON,
@@ -661,7 +661,14 @@ var util_RequestAnimationFrame, core_LocalStorage, core_Navigator, core_Subject,
RequestHandler: RequestHandler,
Event: Event,
randomList: randomList,
- DateHandler: DateHandler
+ DateHandler: DateHandler,
+ GUID: function (len) {
+ var res = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function(c) {
+ var num = Math.random() *16 | 0, v = c === 'x' ? num : (num&0x3|0x8);
+ return v.toString(16);
+ });
+ return len?res.substr(0, len):res;
+ }
};
return _Core;
}
@@ -669,4 +676,4 @@ var util_RequestAnimationFrame, core_LocalStorage, core_Navigator, core_Subject,
return window.Core;
}({});
}());
-}());
\ No newline at end of file
+}());
diff --git a/public/js/components/Forms.add.js b/public/js/components/Forms.add.js
index cfd10d9..4119dcc 100644
--- a/public/js/components/Forms.add.js
+++ b/public/js/components/Forms.add.js
@@ -52,11 +52,10 @@
});
var model = new Model;
-
var SubItem = React.createClass({
getInitialState: function(){
var data = this.props.data;
- return {name: data.name,title: data.title};
+ return {id: data.id,name: data.name,title: data.title};
},
notifyParent: function(){
this.props.handleItemChange(this.props.index,this.state);
@@ -103,7 +102,7 @@
{this.props.items.map(function(key,index){
- return
+ return
})}
@@ -113,7 +112,7 @@
var Item = React.createClass({
getInitialState: function(){
var data = this.props.data;
- return {name: data.name,title: data.title,required: data.required,child: data.child || []};
+ return {id: data.id,name: data.name,title: data.title,required: data.required,child: data.child || []};
},
componentDidMount: function(){
$(this.getDOMNode()).on('click','.init-editor',handleEditor);
@@ -140,7 +139,7 @@
this.notifyParent();
},
handleAddItem: function(){
- this.state.child.push({name: '',title: '',required: true});
+ this.state.child.push({id: Core.GUID(), name: '',title: '',required: true});
this.notifyParent();
},
handleItemRemove: function(index){
@@ -197,7 +196,7 @@
return (
{this.props.items.map(function(key,index){
- return -
+ return
-
})}
);
@@ -224,7 +223,7 @@
},
handleAddItem: function(){
reloadWarning = true;
- var nextItem = this.state.child.concat([{name: '',title: '',required: true,child: []}]);
+ var nextItem = this.state.child.concat([{id: Core.GUID(),name: '',title: '',required: true,child: []}]);
this.setState({child: nextItem});
},
handleItemRemove: function(index){
diff --git a/public/js/components/Forms.edit.js b/public/js/components/Forms.edit.js
index a5d5e31..55b866e 100644
--- a/public/js/components/Forms.edit.js
+++ b/public/js/components/Forms.edit.js
@@ -56,7 +56,7 @@
var SubItem = React.createClass({
getInitialState: function(){
var data = this.props.data;
- return {name: data.name,title: data.title};
+ return {id: data.id,name: data.name,title: data.title};
},
notifyParent: function(){
this.props.handleItemChange(this.props.index,this.state);
@@ -103,7 +103,8 @@
{this.props.items.map(function(key,index){
- return
+ key.id = key.id || Core.GUID();
+ return
})}
@@ -113,7 +114,7 @@
var Item = React.createClass({
getInitialState: function(){
var data = this.props.data;
- return {name: data.name,title: data.title,required: data.required,child: data.child || []};
+ return {id: data.id,name: data.name,title: data.title,required: data.required,child: data.child || []};
},
componentDidMount: function(){
$(this.getDOMNode()).on('click','.init-editor',handleEditor);
@@ -140,7 +141,7 @@
this.notifyParent();
},
handleAddItem: function(){
- this.state.child.push({name: '',title: '',required: true,child: []});
+ this.state.child.push({id: Core.GUID(),name: '',title: '',required: true,child: []});
this.notifyParent();
},
handleItemRemove: function(index){
@@ -197,7 +198,8 @@
return (
{this.props.items.map(function(key,index){
- return -
+ key.id = key.id || Core.GUID();
+ return
-
})}
);
@@ -225,7 +227,7 @@
},
handleAddItem: function(){
reloadWarning = true;
- var nextItem = this.state.child.concat([{required: true}]);
+ var nextItem = this.state.child.concat([[{id: Core.GUID(),name: '',title: '',required: true,child: []}]]);
this.setState({child: nextItem});
},
handleItemRemove: function(index){
diff --git a/views/admin.jsx b/views/admin.jsx
index b8af2b3..4d1c6ab 100644
--- a/views/admin.jsx
+++ b/views/admin.jsx
@@ -52,7 +52,7 @@ var LogList = React.createClass({
$(document).ready(function() {
$('#dataTables-example').DataTable({
responsive: true,
- pageLength: 20,
+ pageLength: 50,
order: [[ 2, 'desc' ]]
});
})
diff --git a/views/forms/list.jsx b/views/forms/list.jsx
index 016a394..9f29cfc 100644
--- a/views/forms/list.jsx
+++ b/views/forms/list.jsx
@@ -83,7 +83,8 @@ module.exports = React.createClass({
diff --git a/views/images/list.jsx b/views/images/list.jsx
index 68437d5..0960853 100644
--- a/views/images/list.jsx
+++ b/views/images/list.jsx
@@ -92,7 +92,8 @@ module.exports = React.createClass({
diff --git a/views/users/list.jsx b/views/users/list.jsx
index effe520..267cc69 100644
--- a/views/users/list.jsx
+++ b/views/users/list.jsx
@@ -77,7 +77,8 @@ module.exports = React.createClass({