Commit 85706b32 authored by Ivanq's avatar Ivanq

Add 'View issue' page

parent c622c6a2
.issue-title {
display: inline-block;
margin-bottom: 8px;
font-size: 32px;
}
.issue-id {
display: inline-block;
vertical-align: middle;
color: #888;
font-size: 16px;
}
.issue-id span {
display: inline-block;
margin: 0 1px;
vertical-align: middle;
font-size: 24px;
}
.issue-status {
display: inline-block;
margin-top: 4px;
margin-right: 16px;
padding: 4px 8px;
background-color: #2B3;
border-radius: 4px;
vertical-align: top;
font-size: 16px;
color: #FFF;
}
.issue-status img {
display: inline-block;
height: 16px;
margin-right: 4px;
vertical-align: middle;
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Git Center</title>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<base href="" target="_top" id="base">
<script>base.href = document.location.href.replace("/media", "").replace("index.html", "").replace(/[&?]wrapper=False/, "").replace(/[&?]wrapper_nonce=[A-Za-z0-9]+/, "")</script>
<link rel="stylesheet" type="text/css" href="../../../css/main.css">
<link rel="stylesheet" type="text/css" href="../../../css/buttons.css">
<link rel="stylesheet" type="text/css" href="../../../css/header.css">
<link rel="stylesheet" type="text/css" href="../../../css/content.css">
<link rel="stylesheet" type="text/css" href="../../css/tabs.css">
<link rel="stylesheet" type="text/css" href="../../css/info.css">
<link rel="stylesheet" type="text/css" href="../../css/comments.css">
<link rel="stylesheet" type="text/css" href="css/issue.css">
</head>
<body>
<header class="header">
<img src="../../../img/logo-white.svg" class="header-logo">
<div class="header-name">Git Center</div>
</header>
<main class="middle">
<h1 id="repo_name"></h1>
<a id="code_link" class="tab">
<img src="../../../img/code.svg" width="16">
Code
</a>
<a id="issues_link" class="tab tab-current">
<img src="../../../img/issue-opened.svg" width="16">
Issues
</a>
<a class="tab">
<img src="../../../img/pr-merged.svg" width="16">
Pull requests
</a>
</main>
<div class="info">
<div class="issue-status"><img src="../../../img/issue-opened-white.svg">Open</div>
<div class="issue-title">
<span id="issue_title"></span>
<span class="issue-id">
#<span id="issue_id"></span>@<span id="issue_json_id"></span>
</span>
</div>
</div>
<div class="comments" id="comments"></div>
<div class="comments">
<textarea class="comment-content-edit" id="comment_content" placeholder="Join the conversation!"></textarea>
<a class="button comment-submit" id="comment_submit">Submit</a>
</div>
<template id="edit_icon_tmpl">
<img src="../../../img/edit.svg" class="edit-icon" id="edit_icon" width="16" height="16">
</template>
<script type="text/javascript" src="../../../js/ZeroFrame.js"></script>
<script type="text/javascript" src="../../../js/ZeroPage.js"></script>
<script type="text/javascript" src="../../../js/ZeroFS.js"></script>
<script type="text/javascript" src="../../../js/ZeroAuth.js"></script>
<script type="text/javascript" src="../../../js/ZeroDB.js"></script>
<script type="text/javascript" src="../../../js/git.js"></script>
<script type="text/javascript" src="../../../js/repo.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/user_common.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
\ No newline at end of file
if(additional.indexOf("@") == -1) {
location.href = "../?" + address;
}
let id = parseInt(additional.substr(0, additional.indexOf("@")));
let jsonId = parseInt(additional.substr(additional.indexOf("@") + 1));
if(isNaN(id) || isNaN(jsonId)) {
location.href = "../?" + address;
}
function showComment(comment) {
console.log(comment);
let node = document.createElement("div");
node.className = "comment" + (jsonId == comment.json_id ? " comment-owned" : "");
let header = document.createElement("div");
header.className = "comment-header";
header.textContent = comment.cert_user_id + " commented on " + repo.translateDate(comment.date_added);
node.appendChild(header);
let content = document.createElement("div");
content.className = "comment-content";
content.textContent = comment.body;
node.appendChild(content);
document.getElementById("comments").appendChild(node);
}
repo.addMerger()
.then(() => {
return repo.getContent();
})
.then(content => {
showTitle(content.title);
showTabs(2);
return repo.getIssue(id, jsonId);
})
.then(issue => {
document.getElementById("issue_title").textContent = issue.title;
document.getElementById("issue_id").textContent = id;
document.getElementById("issue_json_id").textContent = jsonId;
return repo.getIssueComments(id, jsonId);
})
.then(comments => {
comments.forEach(showComment);
document.getElementById("comment_submit").onclick = () => {
let contentNode = document.getElementById("comment_content");
if(contentNode.disabled) {
return;
}
contentNode.disabled = true;
repo.addIssueComment(id, jsonId, contentNode.value)
.then(comment => {
showComment(comment);
contentNode.value = "";
contentNode.disabled = false;
});
};
});
\ No newline at end of file
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