Commit 01c1473a authored by Van's avatar Van

🚸 fix #12771

parent 596f0883
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# #
# Description: Solo language configurations(en_US). # 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: Liang Ding
# Author: Liyuan Li # Author: Liyuan Li
# Author: Dongxu Wang # Author: Dongxu Wang
...@@ -117,7 +117,6 @@ draftListLabel=Drafts ...@@ -117,7 +117,6 @@ draftListLabel=Drafts
userManageLabel=Users userManageLabel=Users
commonUserLabel=Common User commonUserLabel=Common User
visitorUserLabel=visitor visitorUserLabel=visitor
addCategoryLabel=Add Category
updateUserLabel=Update User updateUserLabel=Update User
updateCategoryLabel=Update Category updateCategoryLabel=Update Category
linkManagementLabel=Links linkManagementLabel=Links
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# #
# Description: Solo default language configurations(zh_CN). # 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: Liang Ding
# Author: Liyuan Li # Author: Liyuan Li
# Author: Dongxu Wang # Author: Dongxu Wang
...@@ -117,7 +117,6 @@ draftListLabel=\u8349\u7A3F\u5939 ...@@ -117,7 +117,6 @@ draftListLabel=\u8349\u7A3F\u5939
userManageLabel=\u7528\u6237\u7BA1\u7406 userManageLabel=\u7528\u6237\u7BA1\u7406
commonUserLabel=\u4E00\u822C\u7528\u6237 commonUserLabel=\u4E00\u822C\u7528\u6237
visitorUserLabel=\u8BBF\u5BA2\u7528\u6237 visitorUserLabel=\u8BBF\u5BA2\u7528\u6237
addCategoryLabel=\u6DFB\u52A0\u5206\u7C7B
updateUserLabel=\u66F4\u65B0\u7528\u6237 updateUserLabel=\u66F4\u65B0\u7528\u6237
updateCategoryLabel=\u66F4\u65B0\u5206\u7C7B updateCategoryLabel=\u66F4\u65B0\u5206\u7C7B
linkManagementLabel=\u94FE\u63A5\u7BA1\u7406 linkManagementLabel=\u94FE\u63A5\u7BA1\u7406
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
</div> </div>
<div class="fn__clear"></div> <div class="fn__clear"></div>
<div class="form form__no-table"> <div class="form form__no-table">
${addCategoryLabel}
<label for="categoryName">${linkTitle1Label}</label> <label for="categoryName">${linkTitle1Label}</label>
<input id="categoryName" type="text"/> <input id="categoryName" type="text"/>
<label for="categoryURI">URI:</label> <label for="categoryURI">URI:</label>
...@@ -37,16 +36,4 @@ ${addCategoryLabel} ...@@ -37,16 +36,4 @@ ${addCategoryLabel}
<button onclick="admin.categoryList.add();" class="fn__right">${saveLabel}</button> <button onclick="admin.categoryList.add();" class="fn__right">${saveLabel}</button>
<div class="fn__clear"></div> <div class="fn__clear"></div>
</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} ${plugins}
This diff is collapsed.
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</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 * @since 2.0.0
*/ */
...@@ -60,14 +60,6 @@ admin.categoryList = { ...@@ -60,14 +60,6 @@ admin.categoryList = {
this.tablePagination.initPagination(); this.tablePagination.initPagination();
this.getList(page); this.getList(page);
$("#categoryUpdate").dialog({
title: $("#categoryUpdate").data('title'),
width: 700,
height: 358,
"modal": true,
"hideFooter": true
});
// For tag auto-completion // For tag auto-completion
$.ajax({// Gets all tags $.ajax({// Gets all tags
url: Label.servePath + "/console/tags", url: Label.servePath + "/console/tags",
...@@ -176,9 +168,16 @@ admin.categoryList = { ...@@ -176,9 +168,16 @@ admin.categoryList = {
"categoryDescription": $("#categoryDesc").val() "categoryDescription": $("#categoryDesc").val()
}; };
var oId = $("#categoryName").data("oId");
var type = "POST"
if (oId) {
requestJSONObject.oId = oId
type = "PUT"
}
$.ajax({ $.ajax({
url: Label.servePath + "/console/category/", url: Label.servePath + "/console/category/",
type: "POST", type: type,
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
success: function(result, textStatus) { success: function(result, textStatus) {
...@@ -188,10 +187,7 @@ admin.categoryList = { ...@@ -188,10 +187,7 @@ admin.categoryList = {
return; return;
} }
$("#categoryName").val(""); if (!oId) {
$("#categoryTags").val("");
$("#categoryURI").val("");
$("#categoryDesc").val("");
if (admin.categoryList.pageInfo.currentCount === Label.PAGE_SIZE && if (admin.categoryList.pageInfo.currentCount === Label.PAGE_SIZE &&
admin.categoryList.pageInfo.currentPage === admin.categoryList.pageInfo.pageCount) { admin.categoryList.pageInfo.currentPage === admin.categoryList.pageInfo.pageCount) {
admin.categoryList.pageInfo.pageCount++; admin.categoryList.pageInfo.pageCount++;
...@@ -200,6 +196,12 @@ admin.categoryList = { ...@@ -200,6 +196,12 @@ admin.categoryList = {
if (admin.categoryList.pageInfo.pageCount !== parseInt(hashList[hashList.length - 1])) { if (admin.categoryList.pageInfo.pageCount !== parseInt(hashList[hashList.length - 1])) {
admin.setHashByPage(admin.categoryList.pageInfo.pageCount); admin.setHashByPage(admin.categoryList.pageInfo.pageCount);
} }
}
$("#categoryName").val("").data("oId", '');
$("#categoryTags").val("");
$("#categoryURI").val("");
$("#categoryDesc").val("");
admin.categoryList.getList(admin.categoryList.pageInfo.pageCount); admin.categoryList.getList(admin.categoryList.pageInfo.pageCount);
...@@ -215,7 +217,6 @@ admin.categoryList = { ...@@ -215,7 +217,6 @@ admin.categoryList = {
get: function(id) { get: function(id) {
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
$("#tipMsg").text(""); $("#tipMsg").text("");
$("#categoryUpdate").dialog("open");
$.ajax({ $.ajax({
url: Label.servePath + "/console/category/" + id, url: Label.servePath + "/console/category/" + id,
...@@ -228,51 +229,15 @@ admin.categoryList = { ...@@ -228,51 +229,15 @@ admin.categoryList = {
return; return;
} }
$("#categoryNameUpdate").val(result.categoryTitle).data("oId", id); $("#categoryName").val(result.categoryTitle).data("oId", id);
$("#categoryURIUpdate").val(result.categoryURI); $("#categoryURI").val(result.categoryURI);
$("#categoryDescUpdate").val(result.categoryDescription); $("#categoryDesc").val(result.categoryDescription);
$("#categoryTagsUpdate").val(result.categoryTags); $("#categoryTags").val(result.categoryTags);
$("#loadMsg").text(""); $("#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 * @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