Skip to content

Commit

Permalink
favorite: Support favrorite menu shortcut key, F
Browse files Browse the repository at this point in the history
  • Loading branch information
doortts committed Aug 10, 2017
1 parent b42987a commit 23840a6
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 22 deletions.
6 changes: 6 additions & 0 deletions app/assets/stylesheets/less/_usermenu.less
Original file line number Diff line number Diff line change
Expand Up @@ -776,5 +776,11 @@
margin-left: 50px;
}

.shortcut-message {
color: white;
background-color: #87c98a;
padding: 3px 6px;
border-radius: 2px;
}


2 changes: 1 addition & 1 deletion app/views/common/scripts.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
}
@requestHeader.session.get("loginId") match {
case Some(v) => { yobi.ShortcutKey.setKeymapLink({
"P": "@routes.UserApp.userInfo(v)"
"U": "@routes.UserApp.userInfo(v)"
}); }
case None => { }
}
Expand Down
2 changes: 1 addition & 1 deletion app/views/common/usermenu.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<li class="divider"></li>
}
<li class="gnb-usermenu-dropdown" id="sidebar-open-btn">
<a href="javascript:void(0);" class="gnb-dropdown-toggle">
<a href="javascript:void(0);" class="gnb-dropdown-toggle" data-toggle="tooltip" data-placement="bottom" title="@Messages("user.menu"), @Messages("title.shortcut") (F)">
<span class="avatar-wrap smaller">
<img src="@currentUser.avatarUrl(32)" />
</span>
Expand Down
27 changes: 8 additions & 19 deletions app/views/help/keymap.scala.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
@**
* Yobi, Project Hosting SW
* Yona, 21st Century Project Hosting SW
*
* Copyright 2013 NAVER Corp.
* http://yobi.io
*
* @author JiHan Kim
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright Yona & Yobi Authors & NAVER Corp & NAVER LABS Corp
* https://yona.io
**@
@(section:String, project:Project)(implicit request: play.api.mvc.RequestHeader)

Expand Down Expand Up @@ -50,7 +36,7 @@ <h5>@Messages("project.projects")</h5>

@if(project != null ) {
@if(project.vcs.equals("GIT")){
<span class="ybtn ybtn-small">F</span>
<span class="ybtn ybtn-small">P</span>
<span class="help-inline">@Messages("menu.pullRequest")</span><br>
}
}
Expand Down Expand Up @@ -103,9 +89,12 @@ <h5>@Messages("title." + section)</h5>
<div class="span7">
<h5>@Messages("site")</h5>

<span class="ybtn ybtn-small">P</span>
<span class="ybtn ybtn-small">U</span>
<span class="help-inline">@Messages("userinfo.profile")</span><br>

<span class="ybtn ybtn-small">F</span>
<span class="help-inline">@Messages("user.menu")</span><br>

@if(isMac){
<span class="ybtn ybtn-small">CTRL</span> +
}
Expand Down
2 changes: 1 addition & 1 deletion app/views/projectMenu.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
,"M": "@routes.MilestoneApp.milestones(project.owner, project.name)"
}
@if(menuSetting.pullRequest && project.vcs.equals("GIT")){
,"F": "@getPullRequestURL(project)"
,"P": "@getPullRequestURL(project)"
}
@requestHeader.session.get("loginId") match {
case Some(role) if role.equals("manager") => { "Q": "@routes.ProjectApp.settingForm(project.owner, project.name)" }
Expand Down
2 changes: 2 additions & 0 deletions conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ title.resetPasswordFor = Reset password for <span class="highlight">{0}</span>
title.search = Search
title.searchByKeyword = Search by keyword
title.sendMail = Send email
title.shortcut = Shortcut
title.signup = Sign up
title.signupFor = Sign up for <span class="highlight">{0}</span>
title.signupConfirmDesc = It is required admission of admin for activation.
Expand Down Expand Up @@ -982,6 +983,7 @@ user.loginId = Login ID
user.loginId.duplicate = Same log in ID already exists.
user.loginWithNewPassword = Please log in with new password!
user.logout.success = You have logged out successfully
user.menu = User menu
user.name = Name
user.newPassword = New password
user.notExists.name = User not exists
Expand Down
2 changes: 2 additions & 0 deletions conf/messages.ko-KR
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@ title.resetPasswordFor = <span class="highlight">{0}</span> 비밀번호 재설
title.search = 검색
title.searchByKeyword = 키워드로 검색
title.sendMail = 메일 발송
title.shortcut = 단축키
title.signup = 멤버 가입
title.signupFor = <span class="highlight">{0}</span> 멤버 가입
title.signupConfirmDesc = 가입 후 사용을 위해서는 관리자의 승인이 필요합니다
Expand Down Expand Up @@ -974,6 +975,7 @@ user.loginId = 아이디
user.loginId.duplicate = 이미 존재하는 아이디입니다.
user.loginWithNewPassword = 새로 설정한 비밀번호로 로그인 하세요
user.logout.success = 로그아웃했습니다
user.menu = 사용자 메뉴
user.name = 이름
user.newPassword = 신규 비밀번호
user.notExists.name = 존재하지 않는 사용자입니다.
Expand Down
14 changes: 14 additions & 0 deletions public/javascripts/common/yona.Usermenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ $(function() {
var PIXEL_CRITERIA_FOR_SMALL_DEVICE = 720; // Criteria to distinguish small devices
var SIDE_BAR_DEFAULT_WIDTH = "420px";

$(document).on("keypress", function openFavoriteMenuWithShortcutKey(event) {
if (isShortcutKeyPressed(event)) {
event.preventDefault();
openSidebar($sidebar);
updateStar();
}
});

function isShortcutKeyPressed(event) {
return (event.which === 102 || event.which === 12601) // keycode => 102: f, 12623: ㄹ
&& $(':focus').length === 0; // avoid already somewhere focused state
}

$("#main").on("click", function(event){
if( $sidebar.width() !== 0 && $(event.target).parents("#mySidenav").length == 0) {
closeSidebar($sidebar);
Expand Down Expand Up @@ -86,6 +99,7 @@ $(function() {
}).on("keydown.moveCursorFromInputform", function(e) {
switch (e.keyCode) {
case 27: // ESC
$('.project-search').blur();
closeSidebar($sidebar);
break;
default:
Expand Down

0 comments on commit 23840a6

Please sign in to comment.