Commit 01c1473a authored by Van's avatar Van

🚸 fix #12771

parent 596f0883
......@@ -18,7 +18,7 @@
#
# Description: Solo language configurations(en_US).
# Version: 2.33.0.1, Apr 19, 2019
# Version: 2.33.0.2, Apr 28, 2019
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
......@@ -117,7 +117,6 @@ draftListLabel=Drafts
userManageLabel=Users
commonUserLabel=Common User
visitorUserLabel=visitor
addCategoryLabel=Add Category
updateUserLabel=Update User
updateCategoryLabel=Update Category
linkManagementLabel=Links
......
......@@ -18,7 +18,7 @@
#
# Description: Solo default language configurations(zh_CN).
# Version: 2.33.0.1, Apr 19, 2019
# Version: 2.33.0.2, Apr 28, 2019
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
......@@ -117,7 +117,6 @@ draftListLabel=\u8349\u7A3F\u5939
userManageLabel=\u7528\u6237\u7BA1\u7406
commonUserLabel=\u4E00\u822C\u7528\u6237
visitorUserLabel=\u8BBF\u5BA2\u7528\u6237
addCategoryLabel=\u6DFB\u52A0\u5206\u7C7B
updateUserLabel=\u66F4\u65B0\u7528\u6237
updateCategoryLabel=\u66F4\u65B0\u5206\u7C7B
linkManagementLabel=\u94FE\u63A5\u7BA1\u7406
......
......@@ -23,7 +23,6 @@
</div>
<div class="fn__clear"></div>
<div class="form form__no-table">
${addCategoryLabel}
<label for="categoryName">${linkTitle1Label}</label>
<input id="categoryName" type="text"/>
<label for="categoryURI">URI:</label>
......@@ -37,16 +36,4 @@ ${addCategoryLabel}
<button onclick="admin.categoryList.add();" class="fn__right">${saveLabel}</button>
<div class="fn__clear"></div>
</div>
<div id="categoryUpdate" class="fn__none form__no-table form" data-title="${updateCategoryLabel}">
<label for="categoryNameUpdate">${linkTitle1Label}</label>
<input id="categoryNameUpdate" type="text"/>
<label for="categoryURIUpdate">URI:</label>
<input id="categoryURIUpdate" type="text"/>
<label for="categoryDescUpdate">${linkDescription1Label}</label>
<input id="categoryDescUpdate" type="text"/>
<label for="categoryTagsUpdate">${tags1Label}</label>
<input id="categoryTagsUpdate" type="text"/> <br><br>
<button onclick="admin.categoryList.update();" class="fn__right">${updateLabel}</button>
<div class="fn__clear"></div>
</div>
${plugins}
This diff is collapsed.
......@@ -20,7 +20,7 @@
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.3.1, Oct 24, 2018
* @version 1.2.0.0, Apr 28, 2019
* @since 2.0.0
*/
......@@ -60,14 +60,6 @@ admin.categoryList = {
this.tablePagination.initPagination();
this.getList(page);
$("#categoryUpdate").dialog({
title: $("#categoryUpdate").data('title'),
width: 700,
height: 358,
"modal": true,
"hideFooter": true
});
// For tag auto-completion
$.ajax({// Gets all tags
url: Label.servePath + "/console/tags",
......@@ -176,9 +168,16 @@ admin.categoryList = {
"categoryDescription": $("#categoryDesc").val()
};
var oId = $("#categoryName").data("oId");
var type = "POST"
if (oId) {
requestJSONObject.oId = oId
type = "PUT"
}
$.ajax({
url: Label.servePath + "/console/category/",
type: "POST",
type: type,
cache: false,
data: JSON.stringify(requestJSONObject),
success: function(result, textStatus) {
......@@ -188,19 +187,22 @@ admin.categoryList = {
return;
}
$("#categoryName").val("");
$("#categoryTags").val("");
$("#categoryURI").val("");
$("#categoryDesc").val("");
if (admin.categoryList.pageInfo.currentCount === Label.PAGE_SIZE &&
admin.categoryList.pageInfo.currentPage === admin.categoryList.pageInfo.pageCount) {
if (!oId) {
if (admin.categoryList.pageInfo.currentCount === Label.PAGE_SIZE &&
admin.categoryList.pageInfo.currentPage === admin.categoryList.pageInfo.pageCount) {
admin.categoryList.pageInfo.pageCount++;
}
var hashList = window.location.hash.split("/");
if (admin.categoryList.pageInfo.pageCount !== parseInt(hashList[hashList.length - 1])) {
}
var hashList = window.location.hash.split("/");
if (admin.categoryList.pageInfo.pageCount !== parseInt(hashList[hashList.length - 1])) {
admin.setHashByPage(admin.categoryList.pageInfo.pageCount);
}
}
$("#categoryName").val("").data("oId", '');
$("#categoryTags").val("");
$("#categoryURI").val("");
$("#categoryDesc").val("");
admin.categoryList.getList(admin.categoryList.pageInfo.pageCount);
$("#loadMsg").text("");
......@@ -215,7 +217,6 @@ admin.categoryList = {
get: function(id) {
$("#loadMsg").text(Label.loadingLabel);
$("#tipMsg").text("");
$("#categoryUpdate").dialog("open");
$.ajax({
url: Label.servePath + "/console/category/" + id,
......@@ -228,51 +229,15 @@ admin.categoryList = {
return;
}
$("#categoryNameUpdate").val(result.categoryTitle).data("oId", id);
$("#categoryURIUpdate").val(result.categoryURI);
$("#categoryDescUpdate").val(result.categoryDescription);
$("#categoryTagsUpdate").val(result.categoryTags);
$("#categoryName").val(result.categoryTitle).data("oId", id);
$("#categoryURI").val(result.categoryURI);
$("#categoryDesc").val(result.categoryDescription);
$("#categoryTags").val(result.categoryTags);
$("#loadMsg").text("");
}
});
},
/*
* 更新分类
*/
update: function() {
if (this.validate("Update")) {
$("#loadMsg").text(Label.loadingLabel);
$("#tipMsg").text("");
var requestJSONObject = {
"categoryTitle": $("#categoryNameUpdate").val(),
"oId": $("#categoryNameUpdate").data("oId"),
"categoryTags": $("#categoryTagsUpdate").val(),
"categoryURI": $("#categoryURIUpdate").val(),
"categoryDescription": $("#categoryDescUpdate").val()
};
$.ajax({
url: Label.servePath + "/console/category/",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
success: function(result, textStatus) {
$("#categoryUpdate").dialog("close");
$("#tipMsg").text(result.msg);
if (!result.sc) {
$("#loadMsg").text("");
return;
}
admin.categoryList.getList(admin.categoryList.pageInfo.currentPage);
$("#loadMsg").text("");
}
});
}
},
/*
* 删除分类
* @id 分类 id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment