From facd4b6d498e45445e0e0d2537e21b13cd98d03b Mon Sep 17 00:00:00 2001 From: Suwon Chae Date: Mon, 18 Jan 2016 03:57:13 +0900 Subject: [PATCH] watch: Change project watch options - Turn on watch at project creation and added by member - Show project watch status at group page --- app/assets/stylesheets/less/_page.less | 17 +++++++++++++++++ app/controllers/ProjectApp.java | 2 ++ app/views/organization/view.scala.html | 13 ++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/less/_page.less b/app/assets/stylesheets/less/_page.less index f853dab3a..251d7a5fb 100644 --- a/app/assets/stylesheets/less/_page.less +++ b/app/assets/stylesheets/less/_page.less @@ -6373,3 +6373,20 @@ div.diff-body[data-outdated="true"] tr:hover .icon-comment { } } } + +.stats-wrap { + i { + font-size: 16px; + margin-left: 5px; + margin-right: 5px; + } + .yobicon-lightbulb { + &.ramp-on { + color: #B6DA54; + } + &.ramp-off { + color: #DADADA; + } + } +} + diff --git a/app/controllers/ProjectApp.java b/app/controllers/ProjectApp.java index 2a75f0a8b..3d9cc9142 100644 --- a/app/controllers/ProjectApp.java +++ b/app/controllers/ProjectApp.java @@ -196,6 +196,7 @@ public static Result newProject() throws Exception { RepositoryService.createRepository(project); saveProjectMenuSetting(project); + Watch.watch(project.asResource()); return redirect(routes.ProjectApp.project(project.owner, project.name)); } @@ -840,6 +841,7 @@ public static Result newMember(String ownerId, String projectName) { if(HttpUtil.isJSONPreferred(request())){ return ok("{}"); } + Watch.watch(newMember, project.asResource()); return redirect(routes.ProjectApp.members(ownerId, projectName)); } diff --git a/app/views/organization/view.scala.html b/app/views/organization/view.scala.html index bb9c3c31f..be862eafa 100644 --- a/app/views/organization/view.scala.html +++ b/app/views/organization/view.scala.html @@ -44,6 +44,12 @@ } } +@amIWatching(project:Project) = { + @if(User.isWatching(project)) { + "watch-on" + } +} + @organizationLayout(org.name, utils.MenuType.NONE, org) { @header(org) @menu(org) @@ -117,7 +123,12 @@

@org.descr

@Html(Messages("project.onmember", User.findUsersByProject(project.id).size)) - @Html(Messages("project.onwatching", project.getWatchingCount)) + @Html(Messages("project.onwatching", project.getWatchingCount)) + @if(User.isWatching(project)) { + + } else { + + }