* finish task #2164.

This commit is contained in:
Catouse
2014-12-10 15:10:12 +08:00
parent 85ba11c7ea
commit eff1aed20e
7 changed files with 64 additions and 32 deletions
+7 -3
View File
@@ -2,10 +2,14 @@
.ke-outline .ke-icon-savetemplate {background-image: url(theme/default/images/kindeditor/save.gif); background-position: center; width: 56px; height: 20px;}
/* template box */
#tplBox .list-group-item {padding: 6px 6px;}
#tplBox .list-group-item:hover {background: #f1f1f1}
#tplBox .list-group-item a {color: #333}
.bootbox-prompt .modal-dialog {width: 500px; margin-top: 10%;}
#buildBoxActions {padding-left: 15px;}
#tplBoxWrapper {position: relative; z-index: 10;}
#tplBoxWrapper > .btn-toolbar {position: absolute; right: 5px; top: 2px;}
#tplBoxWrapper .btn {padding: 2px 8px}
#tplBox li {position: relative;}
#tplBox li .btn-delete {position: absolute; right: 0; top: 0; display: block; width: 40px; text-align:center;}
#tplBox li .tpl-name {padding-right: 40px;}
+33 -16
View File
@@ -41,29 +41,46 @@ function setAssignedTo(moduleID, productID)
});
}
/* Save template. */
KindEditor.plugin('savetemplate', function(K)
$(function()
{
var self = this, name = 'savetemplate';
self.plugin.savetemplate =
$('#saveTplBtn').on('click', function()
{
click: function(id)
var content = $('#steps').val();
bootbox.prompt(setTemplateTitle, function(r)
{
content = self.html();
bootbox.prompt(setTemplateTitle, function(r)
if(!r || !content) return;
saveTemplateLink = createLink('bug', 'saveTemplate');
$.post(saveTemplateLink, {title:r, content:content}, function(data)
{
if(!r || !content) return;
saveTemplateLink = createLink('bug', 'saveTemplate');
$.post(saveTemplateLink, {title:r, content:content}, function(data)
{
$('#tplBox').html(data);
});
$('#tplBox').html(data);
});
}
};
self.clickToolbar(name, self.plugin.savetemplate.click);
});
});
});
// /* Save template. */
// KindEditor.plugin('savetemplate', function(K)
// {
// var self = this, name = 'savetemplate';
// self.plugin.savetemplate =
// {
// click: function(id)
// {
// content = self.html();
// bootbox.prompt(setTemplateTitle, function(r)
// {
// if(!r || !content) return;
// saveTemplateLink = createLink('bug', 'saveTemplate');
// $.post(saveTemplateLink, {title:r, content:content}, function(data)
// {
// $('#tplBox').html(data);
// });
// });
// }
// };
// self.clickToolbar(name, self.plugin.savetemplate.click);
// });
/* Set template. */
function setTemplate(templateID)
{
+1
View File
@@ -160,6 +160,7 @@ $lang->bug->confirmDelete = 'Are you sure to delete this bug?';
$lang->bug->setTemplateTitle = 'Please input the template title:';
$lang->bug->remindTask = 'This bug has been to be a task, update the task:%s or not?';
$lang->bug->skipClose = 'The status of bug:%s are not resolved, so can not close!';
$lang->bug->applyTemplate = 'Apply template';
/* Templates. */
$lang->bug->tplStep = "<p>[Steps]</p>\n";
+1
View File
@@ -160,6 +160,7 @@ $lang->bug->confirmDelete = '您确认要删除该Bug吗?';
$lang->bug->setTemplateTitle = '请输入bug模板标题(保存之前请先填写bug重现步骤):';
$lang->bug->remindTask = '该Bug已经转化为任务,是否更新任务(编号:%s)状态 ?';
$lang->bug->skipClose = 'Bug %s 不是已解决状态,不能关闭。';
$lang->bug->applyTemplate = '应用模版';
/* 模板。*/
$lang->bug->tplStep = "<p>[步骤]</p>\n";
+3 -4
View File
@@ -1,13 +1,12 @@
<script language='Javascript'>
setTemplateTitle = '<?php echo $lang->bug->setTemplateTitle;?>';
KindEditor.lang({'savetemplate' : '<?php echo $lang->bug->saveTemplate;?>'});
</script>
<?php
foreach($templates as $key => $template)
{
echo "<li id='tplBox$template->id' class='nobr list-group-item'>";
echo "<i class='text-muted icon-angle-left'></i> <a id='tplTitleBox$template->id' href='javascript:setTemplate($template->id)'>$template->title</a>";
echo "&nbsp; <a href='javascript:void();' onclick='deleteTemplate($template->id)' class='pull-right'><i class='icon-remove'></i></a>";
echo "<li id='tplBox$template->id'>";
echo "<a title='{$lang->bug->applyTemplate}' class='tpl-name' id='tplTitleBox$template->id' href='javascript:setTemplate($template->id)'>$template->title</a>";
echo "<a href='javascript:void();' onclick='deleteTemplate($template->id)' class='btn-delete'><i class='icon-remove'></i></a>";
echo "<span id='template$template->id' class='hidden'>$template->content</span>";
echo '</li>';
}
+18 -8
View File
@@ -31,11 +31,11 @@ js::set('refresh', $lang->refresh);
<table class='table table-form'>
<tr>
<th class='w-110px'><?php echo $lang->bug->lblProductAndModule;?></th>
<td class='w-p25-f'>
<td class='w-p35-f'>
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value) class='form-control chosen' autocomplete='off'");?>
</td>
<td>
<div class='input-group w-p25-f' id='moduleIdBox'>
<div class='input-group w-p35-f' id='moduleIdBox'>
<?php
echo html::select('module', $moduleOptionMenu, $moduleID, "onchange='loadModuleRelated()' class='form-control chosen'");
if(count($moduleOptionMenu) == 1)
@@ -48,7 +48,7 @@ js::set('refresh', $lang->refresh);
}
?>
</div>
</td><td class='w-150px'></td>
</td>
</tr>
<tr>
<th><?php echo $lang->bug->project;?></th>
@@ -73,17 +73,27 @@ js::set('refresh', $lang->refresh);
</tr>
<tr>
<th><?php echo $lang->bug->steps;?></th>
<td colspan='2'><?php echo html::textarea('steps', $steps, "rows='10' class='form-control'");?></td>
<td style='vertical-align: top;'>
<ul id='tplBox' class='list-group'><?php echo $this->fetch('bug', 'buildTemplates');?></ul>
<td colspan='2'>
<div id='tplBoxWrapper'>
<div class='btn-toolbar'>
<div class='btn-group'><button id='saveTplBtn' type='button' class='btn btn-mini'><?php echo $lang->bug->saveTemplate?></button></div>
<div class="btn-group">
<button type='button' class='btn btn-mini dropdown-toggle' data-toggle='dropdown'><?php echo $lang->bug->applyTemplate?> <span class='caret'></span></button>
<ul id='tplBox' class='dropdown-menu pull-right'>
<?php echo $this->fetch('bug', 'buildTemplates');?>
</ul>
</div>
</div>
</div>
<?php echo html::textarea('steps', $steps, "rows='10' class='form-control'");?>
</td>
</tr>
</tr>
<tr>
<th><?php echo $lang->bug->lblStory;?></th>
<td colspan='2'>
<span id='storyIdBox'><?php echo html::select('story', $stories, $storyID, "class='form-control chosen'");?></span>
</td>
</tr>
</tr>
<tr>
<th><?php echo $lang->bug->task;?></th>
<td colspan='2'><span id='taskIdBox'><?php echo html::select('task', '', $taskID, "class='form-control chosen'");?></span></td>