From ca910474f81039d4bb3cc6a582a6ad92e58261bb Mon Sep 17 00:00:00 2001 From: wangyidong Date: Sun, 25 Jun 2023 18:38:07 +0800 Subject: [PATCH] * Finish story view page. --- module/story/control.php | 2 +- module/story/js/view.ui.js | 8 ++++++++ module/story/ui/view.html.php | 36 +++++++++++++++++++++++++++++------ 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index 1be12a44eb..87b746443b 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -908,7 +908,7 @@ class story extends control if(isonlybody()) return print(js::reload('parent.parent')); $locateLink = $this->session->storyList ? $this->session->storyList : $this->createLink('product', 'browse', "productID={$story->product}"); - return print(js::locate($locateLink, 'parent')); + return $this->send(array('result' => 'success', 'load' => $locateLink)); } } diff --git a/module/story/js/view.ui.js b/module/story/js/view.ui.js index 3830bd9522..65463365f2 100644 --- a/module/story/js/view.ui.js +++ b/module/story/js/view.ui.js @@ -29,3 +29,11 @@ $(document).on('click', '.unlinkStory', function(e) if(res) $.get($this.data('url'), function(){$this.closest('li').remove()}); }); }); + +window.ajaxDelete = function(storyID) +{ + zui.Modal.confirm({message: confirmDeleteTip, icon:'icon-info-sign', iconClass: 'warning-pale rounded-full icon-2x'}).then((res) => + { + if(res) $.get($.createLink('story', 'delete', 'storyID=' + storyID + '&confirm=yes'), function(data){if(data.result == 'success') loadPage(data.load)}); + }); +} diff --git a/module/story/ui/view.html.php b/module/story/ui/view.html.php index 200e0941f7..7d1fd53aed 100644 --- a/module/story/ui/view.html.php +++ b/module/story/ui/view.html.php @@ -10,8 +10,12 @@ declare(strict_types=1); */ namespace zin; +$confirmDelete = $this->lang->story->confirmDelete; +if($story->type == 'requirement') $confirmDelete = str_replace($this->lang->SRCommon, $this->lang->URCommon, $confirmDelete); + jsVar('relievedTip', $lang->story->relievedTip); jsVar('unlinkStoryTip', $lang->story->unlinkStory); +jsVar('confirmDeleteTip', $confirmDelete); $isInModal = isAjaxRequest('modal'); $otherParam = 'storyID=&projectID='; @@ -143,8 +147,23 @@ detailHeader ( to::prefix ( - backBtn(set::icon('back'), set::type('secondary'), $lang->goback), - entityLabel(set(array('entityID' => $story->id, 'level' => 1, 'text' => $story->title))), + $isInModal ? null : backBtn(set::icon('back'), set::type('secondary'), $lang->goback), + div + ( + setClass('entity-label flex items-center gap-x-2'), + label(setClass('circle px-1.5 h-3.5'), $story->id), + $story->parent > 0 ? label($this->lang->story->childrenAB) : null, + span + ( + setClass('article-h1'), + $story->parent > 0 && isset($story->parentName) ? span + ( + a(set::href(inlink('view', "storyID={$story->parent}&version=0¶m=0&storyType=$story->type")), $story->parentName), + ' / ', + ) : null, + $story->title + ), + ), count($versions) > 1 ? dropdown ( btn("#{$version}"), @@ -181,7 +200,12 @@ detailBody set::content(empty($story->verify) ? $lang->noDesc : $story->verify), set::useHtml(true) ), -// $this->fetch('file', 'printFiles', array('files' => $story->files, 'section' => 'true', 'object' => $story, 'method' => 'view', 'showDelete' => false)), + $story->files ? fileList + ( + set::files($story->files), + set::showDelete(false), + set::object($story), + ) : null, empty($story->children) ? null : section ( set::title($story->type == 'requirement' ? $lang->story->story : $lang->story->children), @@ -192,13 +216,13 @@ detailBody ) ), ), - history(), + history(set::commentUrl(helper::createLink('action', 'comment', "objectType=story&objectID=$story->id"))), floatToolbar ( set::object($story), to::prefix(backBtn(set::icon('back'), $lang->goback)), - set::main($menus['mainMenu']), - set::suffix($menus['suffixMenu']), + $story->deleted ? null : set::main($menus['mainMenu']), + $story->deleted ? null : set::suffix($menus['suffixMenu']), ), detailSide (