@@ -53,6 +53,8 @@ var Story = Backbone.Model.extend({
5353 } else {
5454 this . set ( "is_starred" , true ) ;
5555 }
56+
57+ if ( this . shouldSave ( ) ) this . save ( ) ;
5658 } ,
5759
5860 close : function ( ) {
@@ -92,6 +94,7 @@ var StoryView = Backbone.View.extend({
9294 this . listenTo ( this . model , 'change:open' , this . itemOpened ) ;
9395 this . listenTo ( this . model , 'change:is_read' , this . itemRead ) ;
9496 this . listenTo ( this . model , 'change:keep_unread' , this . itemKeepUnread ) ;
97+ this . listenTo ( this . model , 'change:is_starred' , this . itemStarred ) ;
9598 } ,
9699
97100 render : function ( ) {
@@ -119,11 +122,16 @@ var StoryView = Backbone.View.extend({
119122 if ( ! this . $el . visible ( ) ) window . scrollTo ( 0 , this . $el . offset ( ) . top ) ;
120123 } ,
121124
122- itemKeepUnread : function ( ) {
125+ itemKeepUnread : function ( ) {
123126 var icon = this . model . get ( "keep_unread" ) ? "icon-check" : "icon-check-empty" ;
124127 this . $ ( ".story-keep-unread > i" ) . attr ( "class" , icon ) ;
125128 } ,
126129
130+ itemStarred : function ( ) {
131+ var icon = this . model . get ( "is_starred" ) ? "icon-star" : "icon-star-empty" ;
132+ this . $ ( ".story-starred > i" ) . attr ( "class" , icon ) ;
133+ } ,
134+
127135 storyClicked : function ( ) {
128136 this . model . toggle ( ) ;
129137 window . scrollTo ( 0 , this . $el . offset ( ) . top ) ;
0 commit comments