visuddhinanda 4 лет назад
Родитель
Сommit
802a078280
2 измененных файлов с 43 добавлено и 56 удалено
  1. 37 55
      app/term/note.js
  2. 6 1
      app/term/term.css

+ 37 - 55
app/term/note.js

@@ -373,6 +373,15 @@ function render_channal_list(channalinfo) {
 	}
 	output += "<div class='list_with_head " + selected + "'>";
 
+	output += '<div class="tool_bar">';
+	output += '<div class="right">';
+	output += '<div class="pop_menu">';
+	output += render_icon_button("copy", "commit_init({src:'" + channalinfo.id + "'})", gLocal.gui.copy_to);
+	output += render_icon_button("ic_mode_edit", "", gLocal.gui.modify);
+	output += "</div>";
+	output += "</div>";
+	output += "</div>";
+
 	output +=
 		'<div class="channel_select"><input type="checkbox" ' + checked + " channal_id='" + channalinfo.id + "'></div>";
 	output += "<div class='head'>";
@@ -753,6 +762,20 @@ function sent_commit(src, id) {
 		express: false,
 	});
 }
+
+function render_icon_button(icon_id, event, tiptitle) {
+	let html = "";
+	html += "<button class='icon_btn tooltip' onclick=\"" + event + '">';
+	html += '<svg class="icon" >';
+	html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#' + icon_id + '"></use>';
+	html += "</svg>";
+	html += "<span class='tooltiptext tooltip-top'>";
+	html += tiptitle;
+	html += "</span>";
+	html += "</button>";
+	return html;
+}
+
 function render_one_sent_tran_a(iterator, diff = false) {
 	let mChannel = get_channel_by_id(iterator.channal);
 
@@ -816,66 +839,30 @@ function render_one_sent_tran_a(iterator, diff = false) {
 		if (typeof iterator.is_pr_editor != "undefined" && iterator.is_pr_editor == true) {
 			//提交人
 			//修改按钮
-			html += "<button class='icon_btn tooltip' onclick='sent_tran_edit(this)'>";
-			html += '<svg class="icon" >';
-			html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#ic_mode_edit"></use>';
-			html += "</svg>";
-			html += "<span class='tooltiptext tooltip-top'>";
-			html += gLocal.gui.modify;
-			html += "</span>";
-			html += "</button>";
-
+			html += render_icon_button("ic_mode_edit", "sent_tran_edit(this)", gLocal.gui.modify);
 			//删除按钮
-			html += "<button class='icon_btn tooltip' onclick='sent_pr_del(this)'>";
-			html += '<svg class="icon" >';
-			html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#ic_delete"></use>';
-			html += "</svg>";
-			html += "<span class='tooltiptext tooltip-top'>";
-			html += gLocal.gui.delete;
-			html += "</span>";
-			html += "</button>";
+			html += render_icon_button("ic_delete", "sent_pr_del(this)", gLocal.gui.delete);
 		} else {
 			//非提交人
 			if (parseInt(iterator.mypower) >= 20) {
 				//有权限 采纳按钮
-				html += "<button class='icon_btn tooltip' onclick=\"sent_pr_merge('" + iterator.id + "')\">";
-				html += '<svg class="icon" >';
-				html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#accept_copy"></use>';
-				html += "</svg>";
-				html += "<span class='tooltiptext tooltip-top'>";
-				html += gLocal.gui.accept_copy;
-				html += "</span>";
-				html += "</button>";
+				html += render_icon_button(
+					"accept_copy",
+					"sent_pr_merge('" + iterator.id + "')",
+					gLocal.gui.accept_copy
+				);
 			}
 			//点赞按钮
-			html += "<button class='icon_btn tooltip' onclick='sent_pr_like(this)'>";
-			html += '<svg class="icon" >';
-			html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#like"></use>';
-			html += "</svg>";
-			html += "<span class='tooltiptext tooltip-top'>";
-			html += gLocal.gui.like;
-			html += "</span>";
-			html += "</button>";
+			html += render_icon_button("like", "sent_pr_like(this)", gLocal.gui.like);
 		}
 	} else {
 		//非pr列表里的句子
 		//编辑按钮
-		html += "<button class='icon_btn tooltip' onclick='sent_tran_edit(this)'>";
-		html += '<svg class="icon" >';
 		if (parseInt(iterator.mypower) < 20) {
-			html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#my_idea"></use>';
+			html += render_icon_button("my_idea", "sent_tran_edit(this)", gLocal.gui.suggest);
 		} else {
-			html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#ic_mode_edit"></use>';
+			html += render_icon_button("ic_mode_edit", "sent_tran_edit(this)", gLocal.gui.edit);
 		}
-		html += "</svg>";
-		html += "<span class='tooltiptext tooltip-top'>";
-		if (parseInt(iterator.mypower) < 20) {
-			html += gLocal.gui.suggest;
-		} else {
-			html += gLocal.gui.edit;
-		}
-		html += "</span>";
-		html += "</button>";
 
 		//推送按钮
 		let commitIcon = "";
@@ -895,24 +882,18 @@ function render_one_sent_tran_a(iterator, diff = false) {
 				commitTipText = gLocal.gui.copy_to;
 			}
 		}
-		html += "<button class='icon_btn tooltip' ";
-		html += " onclick=\"sent_commit('" + iterator.channal + "','" + sid + "')\">";
-		html += '<svg class="icon" >';
-		html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#' + commitIcon + '"></use>';
-		html += "</svg>";
-		html += "<span class='tooltiptext tooltip-top'>";
-		html += commitTipText;
-		html += "</span>";
-		html += "</button>";
+		html += render_icon_button(commitIcon, "sent_commit('" + iterator.channal + "','" + sid + "')", commitTipText);
 		//推送按钮结束
 
 		//更多按钮
 		html += '<div class="case_dropdown">';
+
 		html += "<button class='icon_btn'>";
 		html += '<svg class="icon" >';
 		html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#ic_more"></use>';
 		html += "</svg>";
 		html += "</button>";
+
 		html += '<div class="case_dropdown-content menu_space_between" style="right:0;">';
 		//时间线
 		html += "<a onclick=\"history_show('" + iterator.id + "')\">";
@@ -950,6 +931,7 @@ function render_one_sent_tran_a(iterator, diff = false) {
 
 	html += "</div>";
 	//句子菜单结束
+
 	html += "</div>";
 	html += "</div>";
 	//tool_bar 结束

+ 6 - 1
app/term/term.css

@@ -679,7 +679,12 @@ pw {
 .sent_tran_inner:hover .tool_bar > .right {
 	display: block;
 }
-
+.list_with_head:hover .tool_bar > .right {
+	display: block;
+}
+.list_with_head {
+	position: relative;
+}
 .body > .edit {
 	display: none;
 }