회의실 기밀실 템플릿

This commit is contained in:
2019-01-29 23:40:28 +09:00
parent 4fa9346652
commit 6b02384fb8
5 changed files with 87 additions and 38 deletions
+29 -5
View File
@@ -3,8 +3,21 @@
margin: 0 auto;
}
.titleInput{
width:100%;
color:white;
background-color:transparent;
border:none;
margin:1px 5px;
}
.contentInput{
width:100%;
min-height:3em;
color:white;
background-color:transparent;
border:none;
padding:1px 5px;
}
.articleFrame{
@@ -13,13 +26,24 @@
}
.commentText{
width:800px;
width:100%;
}
.authorPlate .date{
float:right;
.authorName, .comment .author{
width:110px;
font-size:85%;
}
.comment .date{
float:right;
.date{
width:125px;
font-size:85%;
}
.text{
text-align:left;
padding:1px 5px;
}
.submitComment{
width:100%;
}
+4 -1
View File
@@ -15,7 +15,7 @@ $text = Util::getReq('text');
increaseRefresh("회의실", 1);
$me = $db->queryFirstRow('SELECT no, nation, name, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
$me = $db->queryFirstRow('SELECT no, nation, name, level, permission, con, turntime, belong, penalty, `picture`,`imgsvr` FROM general WHERE owner=%i', $userID);
$con = checkLimit($me['con']);
if ($con >= 2) {
@@ -57,12 +57,15 @@ else if ($isSecretBoard && $permission < 2) {
]);
}
$icon = GetImageURL($me['imgsvr'], $me['picture']);
$db->insert('board', [
'nation_no'=>$me['nation'],
'is_secret'=>$isSecretBoard,
'date'=>TimeUtil::DatetimeNow(),
'general_no'=>$me['no'],
'author'=>$me['name'],
'author_icon'=>$icon,
'title'=>$title,
'text'=>$text
]);
+13 -3
View File
@@ -90,7 +90,7 @@ function submitComment(){
function drawArticle(idx, articleObj){
var $articleFrame = $('#articleTemplate > .articleFrame');
var $commentFrame = $('#commentTemplate > .comment');
var $commentFrame = $($('#commentTemplate').prop('content'));
var $article = $articleFrame.clone();
$article.addClass('articleObj')
@@ -102,11 +102,14 @@ function drawArticle(idx, articleObj){
$article.find('.authorName').text(articleObj.author);
$article.find('.articleTitle').text(articleObj.title);
$article.find('.date').text(articleObj.date);
if(articleObj.author_icon){
$article.find('.authorIcon').attr('src', articleObj.author_icon);
}
//$article.find('.text').text(articleObj.text);
$article.find('.text').html(nl2br(escapeHtml(articleObj.text)));
//TODO: 바꿀 것
var $articleComment = $article.find('ul.commentList');
var $articleComment = $article.find('.commentList');
$.each(articleObj.comment, function(_, commentObj){
var $comment = $commentFrame.clone();
@@ -150,8 +153,15 @@ function loadArticles(){
});
}
$(function(){
function resizeTextarea($obj){
$obj.height(1).height($obj.prop('scrollHeight')+12 );
}
$(function(){
$('textarea.autosize').on('keydown keyup', function(){
resizeTextarea($(this));
})
$('#submitArticle').click(submitArticle);
loadArticles()
+1
View File
@@ -323,6 +323,7 @@ CREATE TABLE `board` (
`date` DATETIME NOT NULL,
`general_no` INT(11) NOT NULL,
`author` VARCHAR(32) NOT NULL,
`author_icon` VARCHAR(128) NULL DEFAULT NULL,
`title` TEXT NOT NULL,
`text` TEXT NOT NULL,
PRIMARY KEY (`no`),
+40 -29
View File
@@ -63,44 +63,55 @@ var isSecretBoard = <?=($isSecretBoard?'true':'false')?>; //
</head>
<body>
<div id='newArticle'>
<div><span class='articleTitle'>제목</span><input class='titleInput' type='text' maxlength='250'></input></div>
<div class='boardArticle'>
<textarea class="contentInput" rows="10" cols="50"></textarea>
</div>
<table id='newArticle' class='bg0'>
<thead>
<tr><td colspan='2' class='newArticleHeader bg2'>새 게시물 작성</td>
</thead>
<tbody>
<tr><th class='bg1' style='width:66px;'><span class='articleTitle'>제목</span></th><td><input class='titleInput' type='text' maxlength='250' placeholder='제목'></input></td></tr>
<tr><th class='bg1'>내용</th><td class='boardArticle'>
<textarea class="contentInput autosize" placeholder='내용'></textarea>
</td></tr>
</tbody>
<tfoot>
<tr><td colspan="2">
<button type='button' id='submitArticle'>등록</button>
</div>
</td></tr>
</tfoot>
</table>
<div id="board">
</div>
<!-- 설계미스. template와 shadowdom으로 변경 -->
<div id='articleTemplate' style='display:none;'>
<div class='articleFrame'>
<div>#<span class='articleNo'></span> <span class='articleTitle'></span></div>
<div class='authorPlate'><span class='authorIcon'></span><span class='authorName'></span><span class='date'></span></div>
<div class='text'>
</div>
<div class='commentFrame'>
<ul class='commentList'>
</ul>
<div>
<input class='commentText' type='text' maxlength='250'>
<button type='button' class='submitComment'>등록</button>
</div>
</div>
</div>
<table class='articleFrame bg0'>
<thead>
<tr class='bg1'>
<th class='authorName'></th><th class='articleTitle'></th><th class='date'></th>
</tr>
</thead>
<tbody>
<tr>
<td><img class='authorIcon generalIcon' width='64' height='64'></td>
<td class='text' colspan='2'></td>
</tr>
</tbody>
<tbody class='commentList'>
</tbody>
<tfoot>
<tr><td class='bg2'>댓글 달기</td><td><input class='commentText' type='text' maxlength='250'></td><td><button type='button' class='submitComment'>등록</button></td></tr>
</tfoot>
</table>
</div>
<div id='commentTemplate' style='display:none;'>
<li class='comment'>
<span class='author'></span>
<span class='text'></span>
<span class='date'></span>
</li>
</div>
<template id='commentTemplate' style='display:none;'>
<tr class='comment'>
<th class='author'></th>
<td class='text'></td>
<td class='date'></td>
</tr>
</template>
<div style='width=1000px;' class='tb_layout bg0'>
<?=backButton()?><br>