File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
scala/gitbucket/notifications/model
twirl/gitbucket/notifications Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,10 @@ case class Watch(
2424)
2525
2626object 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. " )
3131
3232 object Notification {
3333 val values : Seq [Notification ] = Seq (Watching , NotWatching , Ignoring )
Original file line number Diff line number Diff line change 11@(notification: gitbucket.notifications.model.Watch.Notification,
22 repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
33@import gitbucket.core.view.helpers
4- @gitbucket.core.helper.html.dropdown("Notifications" ){
4+ @gitbucket.core.helper.html.dropdown(value = notification.name, right = true ){
55 @gitbucket.notifications.model.Watch.Notification.values.map { n =>
66 < li >
77 < 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 >
911 </ a >
1012 </ li >
1113 }
1214}
1315< script >
1416$ ( function ( ) {
1517 $ ( 'a.watch' ) . click ( function ( ) {
16- var notification = $ ( this ) . data ( 'id' ) ;
18+ var selected = $ ( this ) ;
19+ var notification = selected . data ( 'id' ) ;
1720 $ . post ( '@helpers.url(repository)/watch' ,
1821 { notification : notification } ,
1922 function ( ) {
2023 $ ( 'a.watch i.octicon-check' ) . removeClass ( 'octicon-check' ) ;
2124 $ ( '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 ) ;
2229 }
2330 ) ;
2431 return false ;
You can’t perform that action at this time.
0 commit comments