doortts doortts 2016-01-18
watch: Change project watch options
- Turn on watch at project creation and added by member
- Show project watch status at group page
@facd4b6d498e45445e0e0d2537e21b13cd98d03b
app/assets/stylesheets/less/_page.less
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
@@ -6373,3 +6373,20 @@
     }
   }
 }
+
+.stats-wrap {
+    i {
+        font-size: 16px;
+        margin-left: 5px;
+        margin-right: 5px;
+    }
+    .yobicon-lightbulb {
+        &.ramp-on {
+            color: #B6DA54;
+        }
+        &.ramp-off {
+            color: #DADADA;
+        }
+    }
+}
+
app/controllers/ProjectApp.java
--- app/controllers/ProjectApp.java
+++ app/controllers/ProjectApp.java
@@ -196,6 +196,7 @@
         RepositoryService.createRepository(project);
 
         saveProjectMenuSetting(project);
+        Watch.watch(project.asResource());
 
         return redirect(routes.ProjectApp.project(project.owner, project.name));
     }
@@ -840,6 +841,7 @@
         if(HttpUtil.isJSONPreferred(request())){
             return ok("{}");
         }
+        Watch.watch(newMember, project.asResource());
         return redirect(routes.ProjectApp.members(ownerId, projectName));
     }
 
app/views/organization/view.scala.html
--- app/views/organization/view.scala.html
+++ 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 @@
                                 </ul>
                                 <p>
                                     @Html(Messages("project.onmember", User.findUsersByProject(project.id).size))
-                                    <i class="yobicon-eye yobicon-middle"></i> @Html(Messages("project.onwatching", project.getWatchingCount))
+                                <i class="yobicon-eye"></i> @Html(Messages("project.onwatching", project.getWatchingCount))
+                                    @if(User.isWatching(project)) {
+                                        <i class="yobicon-lightbulb ramp-on" data-toggle="tooltip" title="@Messages("project.default.group.watching")"></i>
+                                    } else {
+                                        <i class="yobicon-lightbulb ramp-off" data-toggle="tooltip" title="@Messages("project.you.are.not.watching", "")"></i>
+                                    }
                                 </p>
                             </div>
                         </div>
Add a comment
List