Skip to content

Commit

Permalink
view: Move some buttons to right side menu
Browse files Browse the repository at this point in the history
  • Loading branch information
doortts committed Sep 24, 2017
1 parent a35a14e commit 523abbb
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 77 deletions.
28 changes: 28 additions & 0 deletions app/assets/stylesheets/less/_page.less
Original file line number Diff line number Diff line change
Expand Up @@ -2747,6 +2747,7 @@ label.inline-list {

.posting-history {
display: inline-block;
margin-left: 10px;
}

.content {
Expand All @@ -2764,6 +2765,30 @@ label.inline-list {
textarea.content {
padding:6px;
}
.right-menu-icons {
button.icon {
line-height: 30px;
font-size: 22px;
color: lightgray;
.yobicon-lang {
font-size: 20px;
}
&.disabled {
color: #eee !important;
}
&:hover {
color: #51aacc;
opacity: 1;
}
}
.pt5px {
padding-top: 5px;
}
}

.count {
margin-left: -3px;
}
}

.empty-result {
Expand Down Expand Up @@ -3905,6 +3930,9 @@ label.issue-item-row {
margin-left:3px;
font-size:@base-font-size;
vertical-align:middle;
a:hover {
text-decoration: none;
}

.ybtn {
padding:3px 12px !important;
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/less/_responsive.less
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@
display: block !important;
}

.show-in-mobile-inline {
display: inline-block !important;
}

.hide-in-mobile {
display: none !important;
}
Expand Down
8 changes: 7 additions & 1 deletion app/models/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,13 @@ public void removeVoter(User user) {
* @return True if the user has voted, if not False
*/
public boolean isVotedBy(User user) {
return this.voters.contains(user);
for(User voter: this.voters) {
play.Logger.debug(user + " : " + voter);
if(voter != null && user != null && voter.loginId.equals(user.loginId)) {
return true;
}
}
return false;
}

public String getDueDateString() {
Expand Down
61 changes: 37 additions & 24 deletions app/views/board/view.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@
<strong class="name">@Messages("common.noAuthor")</strong>
}
</a>
</div>
@if(StringUtils.isNotEmpty(post.history)){
@if(UserApp.currentUser().isAnonymous){
<div class="posting-history">
<a href="@routes.UserApp.loginForm()[email protected](project.owner, project.name, post.getNumber)" data-toggle="modal">@Messages("change.history")</a>
</div>
} else {
<div class="posting-history">
<a href="#-yona-posting-history" data-toggle="modal">@Messages("change.history")</a>
@common.partial_history(post)
</div>
@if(StringUtils.isNotEmpty(post.history)){
@if(UserApp.currentUser().isAnonymous){
<div class="posting-history">
<a href="@routes.UserApp.loginForm()[email protected](project.owner, project.name, post.getNumber)" data-toggle="modal">@Messages("change.history")</a>
</div>
} else {
<div class="posting-history">
<a href="#-yona-posting-history" data-toggle="modal">@Messages("change.history")</a>
@common.partial_history(post)
</div>
}
}
}
</div>
@if(StringUtils.isEmpty(post.body)){
<div class="content empty-content"></div>
} else {
Expand All @@ -98,20 +98,21 @@
</div>
</div>

@if(StringUtils.isNotBlank(IssueApi.TRANSLATION_API)){
<button type="button" id="translate" class="icon btn-transparent-with-fontsize-lineheight ml10" data-toggle="tooltip" title="@Messages("button.translation")"><i class="yobicon-lang"></i></button>
}

@if(isAllowed(UserApp.currentUser(), post.asResource(), Operation.UPDATE)) {
<button type="button" class="icon btn-transparent-with-fontsize-lineheight ml10 pt5px" data-toggle="tooltip" title="@Messages("button.edit")" onclick="window.location='@routes.BoardApp.editPostForm(project.owner, project.name, post.getNumber)'"><i class="yobicon-edit-2"></i></button>
} else {
<a href="@routes.BoardApp.editPostForm(project.owner, project.name, post.getNumber)"><button type="button" class="icon btn-transparent-with-fontsize-lineheight ml10 pt5px" data-toggle="tooltip" title="@Messages("button.show.original")"><i class="yobicon-edit-2"></i></button></a>
@if(StringUtils.isNotBlank(IssueApi.TRANSLATION_API)) {
<button type="button" id="translate" class="icon btn-transparent-with-fontsize-lineheight ml10" data-toggle="tooltip" title="@Messages("button.translation")"><i class="yobicon-lang"></i></button>
}
<span class="hide show-in-mobile-inline">
@if(isAllowed(UserApp.currentUser(), post.asResource(), Operation.UPDATE)) {
<button type="button" class="icon btn-transparent-with-fontsize-lineheight ml10 pt5px" data-toggle="tooltip" title="@Messages("button.edit")" onclick="window.location = '@routes.BoardApp.editPostForm(project.owner, project.name, post.getNumber)'"><i class="yobicon-edit-2"></i></button>
} else {
<a href="@routes.BoardApp.editPostForm(project.owner, project.name, post.getNumber)"><button type="button" class="icon btn-transparent-with-fontsize-lineheight ml10 pt5px" data-toggle="tooltip" title="@Messages("button.show.original")"><i class="yobicon-edit-2"></i></button></a>
}

@if(isAllowed(UserApp.currentUser(), post.asResource(), Operation.DELETE)) {
<a href="#deleteConfirm" data-toggle="modal">
<button type="button" class="icon btn-transparent-with-fontsize-lineheight ml6" data-toggle='tooltip' title="@Messages("button.delete")"><i class="yobicon-trash"></i></button></a>
}
@if(isAllowed(UserApp.currentUser(), post.asResource(), Operation.DELETE)) {
<a href="#deleteConfirm" data-toggle="modal">
<button type="button" class="icon btn-transparent-with-fontsize-lineheight ml6" data-toggle='tooltip' title="@Messages("button.delete")"><i class="yobicon-trash"></i></button></a>
}
</span>
</div>
<div class="watcher-list"></div>
@** Comment **@
Expand Down Expand Up @@ -144,6 +145,18 @@
}
}
@**<!-- // -->**@
<div class="right-menu-icons">
@if(isAllowed(UserApp.currentUser(), post.asResource(), Operation.UPDATE)) {
<button type="button" class="icon btn-transparent-with-fontsize-lineheight ml10 pt5px" data-toggle="tooltip" title="@Messages("button.edit")" onclick="window.location='@routes.BoardApp.editPostForm(project.owner, project.name, post.getNumber)'"><i class="yobicon-edit-2"></i></button>
} else {
<a href="@routes.BoardApp.editPostForm(project.owner, project.name, post.getNumber)"><button type="button" class="icon btn-transparent-with-fontsize-lineheight ml10 pt5px" data-toggle="tooltip" title="@Messages("button.show.original")"><i class="yobicon-edit-2"></i></button></a>
}

@if(isAllowed(UserApp.currentUser(), post.asResource(), Operation.DELETE)) {
<a href="#deleteConfirm" data-toggle="modal">
<button type="button" class="icon btn-transparent-with-fontsize-lineheight ml6" data-toggle='tooltip' title="@Messages("button.delete")"><i class="yobicon-trash"></i></button></a>
}
</div>
</div>
</div>
</div>
Expand Down
34 changes: 17 additions & 17 deletions app/views/issue/partial_voters.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
<li>@Html(getUserAvatar(UserApp.currentUser, "smaller"))</li>
}

@defining(VoteApp.getVotersExceptCurrentUser(issue.voters)) { issueVoters =>
@for(voter <- VoteApp.getVotersForAvatar(issueVoters, numOfAvatars)) {
<li>@Html(getUserAvatar(voter, "smaller"))</li>
}
@if(issueVoters.size > numOfAvatars) {
<li data-toggle="tooltip" data-html="true"
title="
@for(voter <- VoteApp.getVotersForName(issueVoters, numOfAvatars, numOfNames)) {
@voter.name <br>
}
@if(issueVoters.size > numOfAvatars + numOfNames) {
&hellip;
}">
<a href="#voters" data-toggle="modal">
@Messages("issue.voters.more", issueVoters.size - numOfAvatars)
</a>
</li>
@for(voter <- VoteApp.getVotersForAvatar(issue.voters, numOfAvatars)) {
@if(voter != UserApp.currentUser) {
<li>@Html(getUserAvatar(voter, "smaller"))</li>
}
}
@if(issue.voters.size > numOfAvatars) {
<li data-toggle="tooltip" data-html="true"
title="
@for(voter <- VoteApp.getVotersForName(issue.voters, numOfAvatars, numOfNames)) {
@voter.name <br>
}
@if(issue.voters.size > numOfAvatars + numOfNames) {
&hellip;
}">
<a href="#voters" data-toggle="modal">
@Messages("issue.voters.more", issue.voters.size - numOfAvatars)
</a>
</li>
}
</ul>
</div>

Expand Down
93 changes: 58 additions & 35 deletions app/views/issue/view.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,20 @@
}
}

@isVotedByCurrentUser = @{
issue.isVotedBy(UserApp.currentUser)
}

@urlToVote = @{
if(issue.isVotedBy(UserApp.currentUser)){
if(isVotedByCurrentUser){
routes.VoteApp.unvote(project.owner, project.name, issue.getNumber).toString
} else {
routes.VoteApp.vote(project.owner, project.name, issue.getNumber).toString
}
}

@getVoteButtonTitle = {
@if(issue.isVotedBy(UserApp.currentUser)){
@if(isVotedByCurrentUser){
@Messages("issue.unvote.description")
} else {
@Messages("issue.vote.description")
Expand Down Expand Up @@ -135,19 +139,20 @@
<strong class="name">@Messages("issue.noAuthor")</strong>
}
</a>
</div>
@if(StringUtils.isNotEmpty(issue.history)){
@if(UserApp.currentUser().isAnonymous){
<div class="posting-history">
<a href="@routes.UserApp.loginForm()[email protected](project.owner, project.name, issue.getNumber)" data-toggle="modal">@Messages("change.history")</a>
</div>
} else {
<div class="posting-history">
<a href="#-yona-posting-history" data-toggle="modal">@Messages("change.history")</a>
@common.partial_history(issue)
</div>
@if(StringUtils.isNotEmpty(issue.history)){
@if(UserApp.currentUser().isAnonymous){
<div class="posting-history">
<a href="@routes.UserApp.loginForm()[email protected](project.owner, project.name, issue.getNumber)" data-toggle="modal">@Messages("change.history")</a>
</div>
} else {
<div class="posting-history">
<a href="#-yona-posting-history" data-toggle="modal">@Messages("change.history")</a>
@common.partial_history(issue)
</div>
}
}
}
</div>

@if(StringUtils.isEmpty(issue.body)){
<div class="content empty-content"></div>
} else {
Expand All @@ -167,35 +172,37 @@
}
</button>
}
<div id="vote" class="vote-wrap">
@if(isResourceCreatable(UserApp.currentUser, issue.asResource(), ResourceType.ISSUE_COMMENT)) {
<a href="@urlToVote" class="ybtn @if(issue.isVotedBy(UserApp.currentUser)){ybtn-watching}" title="@getVoteButtonTitle"
data-request-method="post" data-toggle="tooltip">
<span class="heart"><i class="yobicon-hearts"></i></span>
@if(issue.voters.size > 0) {
<strong class="count">@issue.voters.size</strong>
}
</a>
} else {
<span class="ybtn ybtn-disabled" style="color:#777;" data-toggle="tooltip" title="@Messages("user.login.alert")" data-login="required">
<span class="heart"><i class="yobicon-hearts"></i></span>
@if(issue.voters.size > 0) {
<strong class="count">@issue.voters.size</strong>
}
</span>
}

@if(issue.voters.size > 0){
@partial_voters(issue, 3)
}
</div>
</div>
</div>

<div id="vote" class="vote-wrap">
@if(issue.voters.size > 0) {
@partial_voters(issue, 3)
}
@if(isResourceCreatable(UserApp.currentUser, issue.asResource(), ResourceType.ISSUE_COMMENT)) {
<a href="@urlToVote" class="@if(issue.isVotedBy(UserApp.currentUser)) {ybtn-watching}" title="@getVoteButtonTitle"
data-request-method="post" data-toggle="tooltip">
<span class="heart"><i class="yobicon-hearts"></i></span>
@if(issue.voters.size > 0) {
<strong class="count">@issue.voters.size</strong>
}
</a>
} else {
<span class="ybtn-disabled" style="color: #777;" data-toggle="tooltip" title="@Messages("user.login.alert")" data-login="required">
<span class="heart"><i class="yobicon-hearts"></i></span>
@if(issue.voters.size > 0) {
<strong class="count">@issue.voters.size</strong>
}
</span>
}

</div>
@if(StringUtils.isNotBlank(IssueApi.TRANSLATION_API)){
<button type="button" id="translate" class="icon btn-transparent-with-fontsize-lineheight ml10" data-toggle="tooltip" title="@Messages("button.translation")"><i class="yobicon-lang"></i></button>
}

<span class="act-row hide show-in-mobile-inline">
@if(isAllowed(UserApp.currentUser(), issue.asResource(), Operation.UPDATE)) {
<button type="button" class="icon btn-transparent-with-fontsize-lineheight ml10 pt5px" data-toggle="tooltip" title="@Messages("button.edit")" onclick="window.location='@routes.IssueApp.editIssueForm(project.owner, project.name, issue.getNumber)'"><i class="yobicon-edit-2"></i></button>
} else {
Expand All @@ -209,6 +216,7 @@
} else {
<button type="button" class="icon disabled btn-transparent-with-fontsize-lineheight ml6" data-toggle='popover' data-trigger="hover" data-placement="top" data-content="@Messages("issue.can.not.be.deleted")"><i class="yobicon-trash"></i></button>
}
</span>
</div>
<div class="watcher-list"></div>
<div class="subtasks">
Expand Down Expand Up @@ -360,6 +368,21 @@
@partial_show_selected_label(issue.labels.toList, routes.IssueApp.issues(project.owner, project.name, issue.state.state(), "html", 1).toString)
}
}
<div class="act-row right-menu-icons">
@if(isAllowed(UserApp.currentUser(), issue.asResource(), Operation.UPDATE)) {
<button type="button" class="icon btn-transparent-with-fontsize-lineheight ml10 pt5px" data-toggle="tooltip" title="@Messages("button.edit")" onclick="window.location='@routes.IssueApp.editIssueForm(project.owner, project.name, issue.getNumber)'"><i class="yobicon-edit-2"></i></button>
} else {
<a href="@routes.IssueApp.editIssueForm(project.owner, project.name, issue.getNumber)"><button type="button" class="icon btn-transparent-with-fontsize-lineheight ml10 pt5px" data-toggle="tooltip" title="@Messages("button.show.original")"><i class="yobicon-edit-2"></i></button></a>
}
@if(issue.canBeDeleted) {
@if(isAllowed(UserApp.currentUser(), issue.asResource(), Operation.DELETE)) {
<a href="#deleteConfirm" data-toggle="modal">
<button type="button" class="icon btn-transparent-with-fontsize-lineheight ml6" data-toggle='tooltip' title="@Messages("button.delete")"><i class="yobicon-trash"></i></button></a>
}
} else {
<button type="button" class="icon disabled btn-transparent-with-fontsize-lineheight ml6" data-toggle='popover' data-trigger="hover" data-placement="top" data-content="@Messages("issue.can.not.be.deleted")"><i class="yobicon-trash"></i></button>
}
</div>
@**<!-- // -->**@
</form>
</div>
Expand Down

0 comments on commit 523abbb

Please sign in to comment.