-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
198 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Yobire, Project Hosting SW | ||
* | ||
* @author Suwon Chae | ||
* Copyright 2016 the original author or authors. | ||
*/ | ||
|
||
package controllers; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
import models.IssueLabel; | ||
import models.Posting; | ||
import models.Project; | ||
import play.db.ebean.Transactional; | ||
import play.libs.Json; | ||
import play.mvc.Result; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import static play.libs.Json.toJson; | ||
|
||
public class BoardApi extends AbstractPostingApp { | ||
|
||
@Transactional | ||
public static Result updatePostLabel(String owner, String projectName, Long number) { | ||
JsonNode json = request().body().asJson(); | ||
if(json == null) { | ||
return badRequest("Expecting Json data"); | ||
} | ||
Project project = Project.findByOwnerAndProjectName(owner, projectName); | ||
Posting posting = Posting.findByNumber(project, number); | ||
Set<IssueLabel> labels = new HashSet<>(); | ||
|
||
for(JsonNode node: json){ | ||
System.out.println("node: " + node); | ||
Long labelId = Long.parseLong(node.asText()); | ||
labels.add(IssueLabel.finder.byId(labelId)); | ||
} | ||
|
||
posting.labels = labels; | ||
posting.save(); | ||
|
||
ObjectNode result = Json.newObject(); | ||
result.put("id", project.owner); | ||
result.put("labels", toJson(posting.labels.size())); | ||
return ok(result); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,24 +30,30 @@ | |
|
||
@makeFilterLink(fieldName:String, orderBy:String, orderDir:String, fieldText:String) = { | ||
@if(orderBy.equals(fieldName)) { | ||
<a href="@urlToList?orderBy=@fieldName&orderDir=@if(orderDir.equals("desc")){asc}else{desc}" class="filter active"><i class="ico btn-gray-arrow @if(orderDir.equals("desc")){ down }"></i>@fieldText</a> | ||
<a href="@urlToList?[email protected]&[email protected]&orderBy=@fieldName&orderDir=@if(orderDir.equals("desc")){asc}else{desc}" class="filter active"><i class="ico btn-gray-arrow @if(orderDir.equals("desc")){ down }"></i>@fieldText</a> | ||
} else { | ||
<a href="@urlToList?orderBy=@fieldName&orderDir=desc" class="filter"><i class="ico btn-gray-arrow down"></i>@fieldText</a> | ||
<a href="@urlToList?[email protected]&[email protected]&orderBy=@fieldName&orderDir=desc" class="filter"><i class="ico btn-gray-arrow down"></i>@fieldText</a> | ||
} | ||
} | ||
|
||
@projectLayout(title, project, utils.MenuType.BOARD) { | ||
@projectMenu(project, utils.MenuType.BOARD, "main-menu-only") | ||
<link rel="stylesheet" href="@routes.IssueLabelApp.labelStyles(project.owner, project.name)" type="text/css" /> | ||
<div class="page-wrap-outer"> | ||
<div class="project-page-wrap"> | ||
<div class="post-list project-page-wrap"> | ||
<div class="search-wrap underline"> | ||
<form id="option_form" method="get" class="pull-left"> | ||
<form id="option_form" action="@routes.BoardApp.posts(project.owner, project.name)" method="get" class="pull-left"> | ||
<input type="hidden" name="orderBy" value="@param.orderBy"> | ||
<input type="hidden" name="orderDir" value="@param.orderDir"> | ||
<div class="search-bar"> | ||
<input name="filter" class="textbox" type="text" placeholder="@Messages("project.searchPlaceholder")" value="@param.filter"> | ||
<button type="submit" class="search-btn"><i class="yobicon-search"></i></button> | ||
</div> | ||
<div class="board-labels"> | ||
@if(!IssueLabel.findByProject(project).isEmpty){ | ||
@issue.partial_select_label(IssueLabel.findByProject(project), param.labelIdSet) | ||
} | ||
</div> | ||
</form> | ||
<div class="pull-right"> | ||
<a href="@routes.BoardApp.newPostForm(project.owner, project.name)" class="ybtn ybtn-success">@Messages("post.write")</a> | ||
|
@@ -107,6 +113,11 @@ | |
"N": "@routes.BoardApp.newPostForm(project.owner, project.name)" | ||
}); | ||
} | ||
|
||
$('.board-labels select').on('change', function(e){ | ||
$("#option_form").submit(); | ||
}); | ||
}); | ||
</script> | ||
@common.select2() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# --- !Ups | ||
create table posting_issue_label ( | ||
posting_id bigint not null, | ||
issue_label_id bigint not null, | ||
constraint pk_posting_issue_label primary key (posting_id, issue_label_id)) | ||
; | ||
|
||
alter table posting_issue_label add constraint fk_posting_issue_label_issue_01 foreign key (posting_id) references posting (id) on delete restrict on update restrict; | ||
|
||
alter table posting_issue_label add constraint fk_posting_issue_label_issue_la_02 foreign key (issue_label_id) references issue_label (id) on delete restrict on update restrict; | ||
|
||
# --- !Downs | ||
drop table if exists POSTING_ISSUE_LABEL; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters