Changeset - f8742e1acf08
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 13 years ago 2012-06-30 23:32:52
marcin@python-works.com
add highlight of current filter in notifications
3 files changed with 19 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/admin/notifications.py
Show inline comments
 
@@ -58,24 +58,32 @@ class NotificationsController(BaseContro
 

	
 
    def index(self, format='html'):
 
        """GET /_admin/notifications: All items in the collection"""
 
        # url('notifications')
 
        c.user = self.rhodecode_user
 
        notif = NotificationModel().get_for_user(self.rhodecode_user.user_id,
 
                                            filter_=request.GET.getall('type'))
 
        p = int(request.params.get('page', 1))
 
        c.notifications = Page(notif, page=p, items_per_page=10)
 
        c.pull_request_type = Notification.TYPE_PULL_REQUEST
 
        c.comment_type = [Notification.TYPE_CHANGESET_COMMENT,
 
                          Notification.TYPE_PULL_REQUEST_COMMENT]
 

	
 
        _current_filter = request.GET.getall('type')
 
        c.current_filter = 'all'
 
        if _current_filter == [c.pull_request_type]:
 
            c.current_filter = 'pull_request'
 
        elif _current_filter == c.comment_type:
 
            c.current_filter = 'comment'
 

	
 
        return render('admin/notifications/notifications.html')
 

	
 
    def mark_all_read(self):
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            nm = NotificationModel()
 
            # mark all read
 
            nm.mark_all_read_for_user(self.rhodecode_user.user_id,
 
                                      filter_=request.GET.getall('type'))
 
            Session.commit()
 
            c.user = self.rhodecode_user
 
            notif = nm.get_for_user(self.rhodecode_user.user_id,
 
                                    filter_=request.GET.getall('type'))
rhodecode/public/css/style.css
Show inline comments
 
@@ -3339,24 +3339,28 @@ div.gravatar img {
 
  background-image: -khtml-gradient(linear, left top, left bottom, from(#62c462), to(#57a957));
 
  background-image: -moz-linear-gradient(top, #62c462, #57a957);
 
  background-image: -ms-linear-gradient(top, #62c462, #57a957);
 
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #62c462), color-stop(100%, #57a957));
 
  background-image: -webkit-linear-gradient(top, #62c462, #57a957);
 
  background-image: -o-linear-gradient(top, #62c462, #57a957);
 
  background-image: linear-gradient(top, #62c462, #57a957);
 
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);
 
  border-color: #57a957 #57a957 #3d773d;
 
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);	
 
}
 
 
.ui-btn.active{
 
    font-weight: bold;
 
}
 
 
ins,div.options a:hover {
 
	text-decoration: none;
 
}
 
 
img,
 
#header #header-inner #quick li a:hover span.normal,
 
#header #header-inner #quick li ul li.last,
 
#content div.box div.form div.fields div.field div.textarea table td table td a,
 
#clone_url,
 
#clone_url_id
 
{
 
	border: none;
rhodecode/templates/admin/notifications/notifications.html
Show inline comments
 
@@ -18,25 +18,25 @@
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
        ##<ul class="links">
 
        ##    <li>
 
        ##      <span style="text-transform: uppercase;"><a href="#">${_('Compose message')}</a></span>
 
        ##    </li>
 
        ##</ul>
 
    </div>
 
    
 
      <div style="padding:14px 18px;text-align: right;float:left">
 
      <span id='all' class="ui-btn"><a href="${h.url.current()}">${_('All')}</a></span>
 
      <span id='pull_request' class="ui-btn"><a href="${h.url.current(type=c.comment_type)}">${_('Comments')}</a></span>
 
      <span id='comment' class="ui-btn"><a href="${h.url.current(type=c.comment_type)}">${_('Comments')}</a></span>
 
      <span id='pull_request' class="ui-btn"><a href="${h.url.current(type=c.pull_request_type)}">${_('Pull requests')}</a></span>
 
      </div>
 
      %if c.notifications:
 
      <div style="padding:14px 18px;text-align: right;float:right">
 
      <span id='mark_all_read' class="ui-btn">${_('Mark all read')}</span>
 
      </div>
 
      %endif
 
  <div id='notification_data'>
 
    <%include file='notifications_data.html'/>
 
  </div>
 
</div>
 
<script type="text/javascript">
 
@@ -45,14 +45,20 @@ YUE.on(YUQ('.delete-notification'),'clic
 
 var notification_id = e.currentTarget.id;
 
 deleteNotification(url_del,notification_id)
 
})
 
YUE.on('mark_all_read','click',function(e){
 
    var url = "${h.url('notifications_mark_all_read', **request.GET.mixed())}";
 
    ypjax(url,'notification_data',function(){
 
    	YUE.on(YUQ('.delete-notification'),'click',function(e){
 
    		 var notification_id = e.currentTarget.id;
 
    		 deleteNotification(url_del,notification_id)
 
    	})
 
    });
 
})
 

	
 
var current_filter = "${c.current_filter}";
 
if (YUD.get(current_filter)){
 
	YUD.addClass(current_filter, 'active');
 
}
 
console.log(current_filter);
 
</script>
 
</%def>
0 comments (0 inline, 0 general)