File tree 2 files changed +14
-7
lines changed
scala/gitbucket/notifications/model
twirl/gitbucket/notifications
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,10 @@ case class Watch(
24
24
)
25
25
26
26
object Watch {
27
- abstract sealed class Notification (val id : String , val name : String )
28
- case object Watching extends Notification (" watching" , " Watching" )
29
- case object NotWatching extends Notification (" not_watching" , " Not watching" )
30
- case object Ignoring extends Notification (" ignoring" , " Ignoring" )
27
+ abstract sealed class Notification (val id : String , val name : String , val description : String )
28
+ case object Watching extends Notification (" watching" , " Watching" , " Notify all conversations. " )
29
+ case object NotWatching extends Notification (" not_watching" , " Not watching" , " Notify when participating. " )
30
+ case object Ignoring extends Notification (" ignoring" , " Ignoring" , " Never notify. " )
31
31
32
32
object Notification {
33
33
val values : Seq [Notification ] = Seq (Watching , NotWatching , Ignoring )
Original file line number Diff line number Diff line change 1
1
@(notification: gitbucket.notifications.model.Watch.Notification,
2
2
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
3
3
@import gitbucket.core.view.helpers
4
- @gitbucket.core.helper.html.dropdown("Notifications" ){
4
+ @gitbucket.core.helper.html.dropdown(value = notification.name, right = true ){
5
5
@gitbucket.notifications.model.Watch.Notification.values.map { n =>
6
6
< li >
7
7
< a href ="# " class ="watch " data-id ="@n.id ">
8
- @gitbucket.core.helper.html.checkicon(notification.id == n.id) @n.name
8
+ @gitbucket.core.helper.html.checkicon(notification.id == n.id)
9
+ < span class ="notification-label strong "> @n.name</ span >
10
+ < div class ="muted small "> @n.description</ div >
9
11
</ a >
10
12
</ li >
11
13
}
12
14
}
13
15
< script >
14
16
$ ( function ( ) {
15
17
$ ( 'a.watch' ) . click ( function ( ) {
16
- var notification = $ ( this ) . data ( 'id' ) ;
18
+ var selected = $ ( this ) ;
19
+ var notification = selected . data ( 'id' ) ;
17
20
$ . post ( '@helpers.url(repository)/watch' ,
18
21
{ notification : notification } ,
19
22
function ( ) {
20
23
$ ( 'a.watch i.octicon-check' ) . removeClass ( 'octicon-check' ) ;
21
24
$ ( 'a.watch[data-id=' + notification + '] i' ) . addClass ( 'octicon-check' ) ;
25
+
26
+ // Update button label
27
+ var label = selected . find ( 'span.notification-label' ) . text ( ) . trim ( ) ;
28
+ selected . parents ( 'div.btn-group' ) . find ( 'button>span.strong' ) . text ( label ) ;
22
29
}
23
30
) ;
24
31
return false ;
You can’t perform that action at this time.
0 commit comments