Some fix for the issues page.

This commit is contained in:
takezoe
2013-06-25 11:59:05 +09:00
parent 4f873d9296
commit 554508de9b
4 changed files with 65 additions and 26 deletions

View File

@@ -6,11 +6,11 @@ import service._
import util.{WritableRepositoryAuthenticator, ReadableRepositoryAuthenticator, UsersOnlyAuthenticator}
class IssuesController extends IssuesControllerBase
with IssuesService with RepositoryService with AccountService with LabelsService
with IssuesService with RepositoryService with AccountService with LabelsService with MilestonesService
with UsersOnlyAuthenticator with ReadableRepositoryAuthenticator with WritableRepositoryAuthenticator
trait IssuesControllerBase extends ControllerBase {
self: IssuesService with RepositoryService with LabelsService
self: IssuesService with RepositoryService with LabelsService with MilestonesService
with UsersOnlyAuthenticator with ReadableRepositoryAuthenticator with WritableRepositoryAuthenticator =>
case class IssueForm(title: String, content: Option[String])
@@ -32,13 +32,20 @@ trait IssuesControllerBase extends ControllerBase {
val owner = params("owner")
val repository = params("repository")
// search condition
val closed = params.get("state") collect {
case "closed" => true
} getOrElse false
getRepository(owner, repository, baseUrl) match {
case None => NotFound()
case Some(r) => {
// search condition
val closed = params.get("state") collect {
case "closed" => true
} getOrElse false
issues.html.issues(searchIssue(owner, repository, closed), getLabels(owner, repository),
getRepository(owner, repository, baseUrl).get)
issues.html.issues(searchIssue(owner, repository, closed),
getLabels(owner, repository),
getMilestones(owner, repository).filter(_.closedDate.isEmpty),
r, isWritable(owner, repository, context.loginAccount))
}
}
}
get("/:owner/:repository/issues/:id"){

View File

@@ -38,7 +38,7 @@ trait LabelsControllerBase extends ControllerBase {
getRepository(owner, repository, baseUrl) match {
case None => NotFound()
case Some(r) => issues.html.labellist(getLabels(owner, repository), r)
case Some(r) => issues.html.labeleditlist(getLabels(owner, repository), r)
}
})
@@ -65,7 +65,7 @@ trait LabelsControllerBase extends ControllerBase {
case None => NotFound()
case Some(r) => {
updateLabel(owner, repository, labelId, form.labelName, form.color.substring(1))
issues.html.labellist(getLabels(owner, repository), r)
issues.html.labeleditlist(getLabels(owner, repository), r)
}
}
})
@@ -79,7 +79,7 @@ trait LabelsControllerBase extends ControllerBase {
case None => NotFound()
case Some(r) => {
deleteLabel(owner, repository, labelId)
issues.html.labellist(getLabels(owner, repository), r)
issues.html.labeleditlist(getLabels(owner, repository), r)
}
}
})

View File

@@ -1,4 +1,4 @@
@(issues: List[model.Issue], labels: List[model.Label], repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@(issues: List[model.Issue], labels: List[model.Label], milestones: List[model.Milestone], repository: service.RepositoryService.RepositoryInfo, isWrite: Boolean)(implicit context: app.Context)
@import context._
@import view.helpers._
@html.main("Issues - " + repository.owner + "/" + repository.name){
@@ -7,12 +7,40 @@
<div class="row-fluid">
<div class="span3">
<ul class="nav nav-pills nav-stacked">
<li class="active"><a href="#">Everyone's Issues</a></li>
<li><a href="#">Assigned to you</a></li>
<li><a href="#">Created by you</a></li>
<li class="active">
<a href="#">
<span class="count-right">0</span>
Everyone's Issues
</a>
</li>
@if(loginAccount.isDefined){
<li>
<a href="#">
<span class="count-right">0</span>
Assigned to you
</a>
</li>
<li>
<a href="#">
<span class="count-right">0</span>
Created by you
</a>
</li>
}
</ul>
<hr/>
No milestone selected
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">
<i class="icon-cog"></i>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
@milestones.map { milestone =>
<li><a href="#">@milestone.title</a></li>
}
</ul>
</div>
<hr/>
<strong>Labels</strong>
<div>
@@ -30,11 +58,13 @@
</ul>
</div>
</div>
<hr/>
<input type="button" class="btn btn-block" id="manageLabel" data-toggle="button" value="Manage Labels"/>
<br/>
<strong>New label</strong>
@labeledit(None, repository)
@if(isWrite){
<hr/>
<input type="button" class="btn btn-block" id="manageLabel" data-toggle="button" value="Manage Labels"/>
<br/>
<strong>New label</strong>
@labeledit(None, repository)
}
</div>
<div class="span9">
<div class="pagination pull-right">
@@ -80,6 +110,7 @@
</div>
</div>
}
@if(isWrite){
<script>
$(function(){
$('#manageLabel').click(function(){
@@ -96,6 +127,7 @@ $(function(){
});
});
</script>
}
<style type="text/css">
ul.label-list {
list-style-type: none;

View File

@@ -4,8 +4,8 @@
<ul class="label-list nav nav-pills nav-stacked">
@labels.map { label =>
<li style="border: 1px solid white;">
<a href="javascript:void(0);" class="label-edit-link" labelId="@label.labelId" labelName="@label.labelName" color="#@label.color">
<span class="count-right"><i class="icon-remove-circle" labelId="@label.labelId"></i></span>
<a href="javascript:void(0);" class="label-edit-link" data-label-id="@label.labelId">
<span class="count-right"><i class="icon-remove-circle"></i></span>
<span style="background-color: #@label.color;" class="label-color">&nbsp;&nbsp;</span>
@label.labelName
</a>
@@ -15,8 +15,8 @@
<script>
$('i.icon-remove-circle').click(function(e){
e.stopPropagation();
if(confirm('Delete this label. Are you Sure?')){
$.get('@path/@repository.owner/@repository.name/issues/label/' + $(this).attr('labelId') + '/delete',
if(confirm('Are you sure you want to delete this?')){
$.get('@path/@repository.owner/@repository.name/issues/label/' + $(this).parents('a').data('label-id') + '/delete',
function(data){
var parent = $('#label-edit').parent();
$('#label-edit').remove();
@@ -27,10 +27,10 @@
});
$('a.label-edit-link').click(function(e){
if($('input[name=editLabelId]').val() != $(this).attr('labelId')){
if($('input[name=editLabelId]').val() != $(this).data('label-id')){
$('#editLabelArea').remove();
var element = this;
$.get('@path/@repository.owner/@repository.name/issues/label/' + $(this).attr('labelId') + '/edit',
$.get('@path/@repository.owner/@repository.name/issues/label/' + $(this).data('label-id') + '/edit',
function(data){
$(element).parent().append(data);
$('div#label-edit li').css('border', '1px solid white');