Browse Source

Merge pull request #493 from visuddhinanda/master

支持collection 中article删除
visuddhinanda 4 years ago
parent
commit
7b8621c1d2
4 changed files with 35 additions and 4 deletions
  1. 3 0
      app/article/article.js
  2. 6 2
      app/article/index.php
  3. 22 2
      app/article/my_collect.js
  4. 4 0
      app/term/term.css

+ 3 - 0
app/article/article.js

@@ -144,6 +144,9 @@ function set_channal(channalid) {
 }
 function setMode(mode = "read") {
 	let url = "../article/index.php?id=" + _articel_id;
+	if (_collection_id != "") {
+		url += "&collection=" + _collection_id;
+	}
 	if (_channal != "") {
 		url += "&channal=" + _channal;
 	}

+ 6 - 2
app/article/index.php

@@ -125,6 +125,10 @@ span.fancytree-title{
 span.fancytree-node{
 	display: flex;
 }
+#toc_content{
+	max-height: 25vw;
+    width: max-content;
+}
 </style>
 
 <?php
@@ -182,9 +186,9 @@ span.fancytree-node{
 		</div>
 	</div>
 	<div id="right_pannal">
-		<div class="fun_frame">
+		<div class="fun_frame" style="overflow-x: scroll;">
 			<div id = "collect_title" class="title"><?php echo $_local->gui->contents; ?></div>
-			<div id = "toc_content" class="content" style="max-height:25vw;">
+			<div id = "toc_content" class="content" >
 			</div>
 		</div>
 		<div class="fun_frame">

+ 22 - 2
app/article/my_collect.js

@@ -49,6 +49,7 @@ function my_collect_list() {
 }
 var _arrArticleList;
 var _arrArticleOrder = new Array();
+var currSelectNode;
 function my_collect_edit(id) {
 	$.get(
 		"../article/collect_get.php",
@@ -105,8 +106,14 @@ function my_collect_edit(id) {
 						result.article_list +
 						"'/>";
 					html += "</div>";
+
+					html += "<div>";
+					html += "<button onclick='removeTocNode()'>Delete</button>";
+					html += "</div>";
+
 					html += "<div style='display:flex;'>";
 					html += "<div style='flex:4;'>";
+
 					html += "<div id='ul_article_list'>";
 					html += "</div>";
 
@@ -126,6 +133,8 @@ function my_collect_edit(id) {
 
 					$("#ul_article_list").fancytree({
 						autoScroll: true,
+						selectMode: 1, // 1:single, 2:multi, 3:multi-hier
+						checkbox: false, // Show checkboxes.
 						extensions: ["dnd"],
 						source: tocGetTreeData(_arrArticleList),
 						click: function(e, data) {
@@ -168,8 +177,13 @@ function my_collect_edit(id) {
 							}
 						},
 						activate: function(e, data) {
-			//				alert("activate " + data.node);
-						}
+			//				alert("activate " + );
+							currSelectNode = data.node;
+						},
+						select: function(e, data) {
+							// Display list of selected nodes
+							currSelectNode = data.tree.getSelectedNodes();
+						  }
 					});
 				
 
@@ -262,6 +276,12 @@ function editNode(node){
 	  });
   }
 
+function removeTocNode(){
+	if(confirm("Delete article and the sub article?")){
+		currSelectNode.remove();
+	}
+	
+  }
 var arrTocTree = new Array();
 var iTocTreeCurrLevel = 1;
 function getTocTreeData(){

+ 4 - 0
app/term/term.css

@@ -977,4 +977,8 @@ pali>p {
 
 .para_mode .palitext{
 	text-indent: 2em;
+}
+
+.sent_mode>div>p {
+    border-bottom: 0.5em solid var(--btn-color);
 }