Changeset - 19daa8d761dc
[Not reviewed]
beta
0 3 2
Marcin Kuzminski - 13 years ago 2012-07-16 23:19:34
marcin@python-works.com
Improvements to my account page
- lazy load repositories via ajax results in much faster page load
- added pull requests tab to see my pullrequests and the ones i participate in
- new style tabs
5 files changed with 142 insertions and 66 deletions:
0 comments (0 inline, 0 general)
rhodecode/config/routing.py
Show inline comments
 
@@ -293,12 +293,17 @@ def make_map(config):
 
        m.connect("admin_settings_my_account", "/my_account",
 
                  action="my_account", conditions=dict(method=["GET"]))
 
        m.connect("admin_settings_my_account_update", "/my_account_update",
 
                  action="my_account_update", conditions=dict(method=["PUT"]))
 
        m.connect("admin_settings_create_repository", "/create_repository",
 
                  action="create_repository", conditions=dict(method=["GET"]))
 
        m.connect("admin_settings_my_repos", "/my_account/repos",
 
                  action="my_account_my_repos", conditions=dict(method=["GET"]))
 
        m.connect("admin_settings_my_pullrequests", "/my_account/pull_requests",
 
                  action="my_account_my_pullrequests", conditions=dict(method=["GET"]))
 

	
 

	
 
    #NOTIFICATION REST ROUTES
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/notifications') as m:
 
        m.connect("notifications", "/notifications",
 
                  action="create", conditions=dict(method=["POST"]))
rhodecode/public/css/style.css
Show inline comments
 
@@ -1093,12 +1093,16 @@ tbody .yui-dt-editable { cursor: pointer
 
}
 
 
#content div.box div.title .link-white{
 
	color: #FFFFFF;
 
}
 
 
#content div.box div.title .link-white.current{
 
    color: #BFE3FF;
 
}
 
 
#content div.box div.title ul.links li {
 
	list-style: none;
 
	float: left;
 
	margin: 0;
 
	padding: 0;
 
}
 
@@ -4333,12 +4337,21 @@ form.comment-inline-form {
 
.notification-body{
 
	clear:both;
 
	margin: 34px 2px 2px 8px
 
}
 
 
/****
 
PULL REQUESTS
 
*****/
 
.pullrequests_section_head {
 
   padding:10px 10px 10px 0px;
 
   font-size:16px;
 
   font-weight: bold;
 
}
 
 
/****
 
  PERMS
 
*****/
 
#perms .perms_section_head {
 
   padding:10px 10px 10px 0px;
 
   font-size:16px;
 
   font-weight: bold;
rhodecode/templates/admin/users/user_edit_my_account.html
Show inline comments
 
@@ -25,73 +25,33 @@
 
</div>
 

	
 
<div class="box box-right">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>
 
        <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}"/>
 
        <a id="show_my" class="link-white" href="#my">${_('My repos')}</a> / <a id="show_perms" class="link-white" href="#perms">${_('My permissions')}</a>
 
        <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/>
 
        </h5>
 
         %if h.HasPermissionAny('hg.admin','hg.create.repository')():
 
         <ul class="links">
 
         <ul class="links" style="color:#DADADA">
 
           <li>
 
             <span><a id="show_perms" class="link-white current" href="#perms">${_('My permissions')}</a> </span>
 
           </li>
 
           <li>
 
             <span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span>
 
           </li>
 
           <li>
 
             <span>${h.link_to(_('ADD'),h.url('admin_settings_create_repository'))}</span>
 
             <span><a id="show_pullrequests" class="link-white" href="#perms">${_('My pull requests')}</a> </span>
 
           </li>
 
           %if h.HasPermissionAny('hg.admin','hg.create.repository')():
 
             <li>
 
               <span>${h.link_to(_('Add repo'),h.url('admin_settings_create_repository'))}</span>
 
             </li>
 
           %endif
 
         </ul>
 
         %endif
 
    </div>
 
    <!-- end box / title -->
 
    <div id="my" class="table">
 
        <div id='repos_list_wrap' class="yui-skin-sam">
 
        <table id="repos_list">
 
	    <thead>
 
            <tr>
 
            <th></th>
 
            <th class="left">${_('Name')}</th>
 
            <th class="left">${_('Revision')}</th>
 
            <th class="left">${_('Action')}</th>
 
            <th class="left">${_('Action')}</th>
 
	    </thead>
 
	     <tbody>
 
         <%namespace name="dt" file="/data_table/_dt_elements.html"/>
 
	     %if c.user_repos:
 
		     %for repo in c.user_repos:
 
		        <tr>
 
                    ##QUICK MENU
 
                    <td class="quick_repo_menu">
 
                      ${dt.quick_menu(repo['name'])}
 
                    </td>
 
                    ##REPO NAME AND ICONS
 
                    <td class="reponame">
 
                      ${dt.repo_name(repo['name'],repo['dbrepo']['repo_type'],repo['dbrepo']['private'],repo['dbrepo_fork'].get('repo_name'))}
 
                    </td>
 
                    ##LAST REVISION
 
                    <td>
 
                        ${dt.revision(repo['name'],repo['rev'],repo['tip'],repo['author'],repo['last_msg'])}
 
                    </td>
 
		            <td><a href="${h.url('repo_settings_home',repo_name=repo['name'])}" title="${_('edit')}"><img class="icon" alt="${_('private')}" src="${h.url('/images/icons/application_form_edit.png')}"/></a></td>
 
		            <td>
 
	                  ${h.form(url('repo_settings_delete', repo_name=repo['name']),method='delete')}
 
	                    ${h.submit('remove_%s' % repo['name'],'',class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo['name']+"');")}
 
	                  ${h.end_form()}
 
		            </td>
 
		        </tr>
 
		     %endfor
 
	     %else:
 
            <div style="padding:5px 0px 10px 0px;">
 
	     	${_('No repositories yet')}
 
	     	%if h.HasPermissionAny('hg.admin','hg.create.repository')():
 
	     		${h.link_to(_('create one now'),h.url('admin_settings_create_repository'),class_="ui-btn")}
 
	     	%endif
 
            </div>
 
	     %endif
 
	     </tbody>
 
	     </table>
 
       </div>
 
    </div>
 
    <div id="perms" class="table" style="display:none">
 
    <div id="perms" class="table">
 
           %for section in sorted(c.rhodecode_user.permissions.keys()):
 
            <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
 

	
 
            <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
 
            <table id="tbl_list_${section}">
 
              <thead>
 
@@ -131,48 +91,78 @@
 
            %endfor
 
            </tbody>
 
            </table>
 
            </div>
 
           %endfor
 
    </div>
 
    <div id="my" class="table" style="display:none">
 
    </div>    
 
    <div id="pullrequests" class="table" style="display:none">
 
</div>
 
<script type="text/javascript">
 
var filter_activate = function(){
 
    var nodes = YUQ('#my tr td a.repo_name');
 
    var func = function(node){
 
        return node.parentNode.parentNode.parentNode.parentNode;
 
    }
 
    q_filter('q_filter',YUQ('#my tr td a.repo_name'),func);
 
}
 

	
 
YUE.on('show_my','click',function(e){
 
    YUD.setStyle('perms','display','none');
 
    YUD.setStyle('my','display','');
 
    YUD.get('q_filter').removeAttribute('disabled');
 
    filter_activate();
 
YUE.on('show_perms','click',function(e){
 
	YUD.addClass('show_perms', 'current');
 
	YUD.removeClass('show_my','current');
 
	YUD.removeClass('show_pullrequests','current');
 
	
 
    YUD.setStyle('my','display','none');
 
    YUD.setStyle('pullrequests','display','none');
 
    YUD.setStyle('perms','display','');
 
    YUD.setStyle('q_filter','display','none');
 
    YUE.preventDefault(e);
 
})
 
YUE.on('show_perms','click',function(e){
 
YUE.on('show_my','click',function(e){
 
    YUD.addClass('show_my', 'current');
 
    YUD.removeClass('show_perms','current');
 
    YUD.removeClass('show_pullrequests','current');
 
    
 
    YUD.setStyle('perms','display','none');
 
    YUD.setStyle('pullrequests','display','none');
 
    YUD.setStyle('my','display','');
 
    YUD.setStyle('q_filter','display','');
 
    
 
    YUE.preventDefault(e);
 
    var url = "${h.url('admin_settings_my_repos')}";
 
    ypjax(url, 'my', function(){
 
    	table_sort();
 
    	filter_activate();
 
    });
 
})
 
YUE.on('show_pullrequests','click',function(e){
 
    YUD.addClass('show_pullrequests', 'current');
 
    YUD.removeClass('show_my','current');
 
    YUD.removeClass('show_perms','current');
 

	
 
    YUD.setStyle('my','display','none');
 
    YUD.setStyle('perms','display','');
 
    YUD.setAttribute('q_filter','disabled','disabled');
 
    YUD.setStyle('perms','display','none');
 
    YUD.setStyle('pullrequests','display','');
 
    YUD.setStyle('q_filter','display','none');
 
    YUE.preventDefault(e);
 
    var url = "${h.url('admin_settings_my_pullrequests')}";
 
    ypjax(url, 'pullrequests');
 
})
 

	
 

	
 
// main table sorting
 
var myColumnDefs = [
 
    {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
 
    {key:"name",label:"${_('Name')}",sortable:true,
 
        sortOptions: { sortFunction: nameSort }},
 
    {key:"tip",label:"${_('Tip')}",sortable:true,
 
        sortOptions: { sortFunction: revisionSort }},
 
    {key:"action1",label:"",sortable:false},
 
    {key:"action2",label:"",sortable:false},
 
];
 

	
 
function table_sort(){
 
var myDataSource = new YAHOO.util.DataSource(YUD.get("repos_list"));
 
myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
 
myDataSource.responseSchema = {
 
    fields: [
 
        {key:"menu"},
 
        {key:"name"},
 
@@ -221,9 +211,9 @@ myDataSource3.responseSchema = {
 
        {key:"name"},
 
        {key:"perm"},
 
    ]
 
};
 

	
 
new YAHOO.widget.DataTable("tbl_list_wrap_repositories_groups", permsColumnDefs, myDataSource3, trans_defs);
 

	
 
}
 
</script>
 
</%def>
rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html
Show inline comments
 
new file 100644
 

	
 
<div class="pullrequests_section_head">${_('Opened by me')}</div>
 
<ul>
 
    %for pull_request in c.my_pull_requests:
 
    <li>
 
    <a href="${h.url('pullrequest_show',repo_name=pull_request.org_repo.repo_name,pull_request_id=pull_request.pull_request_id)}">
 
    ${_('Pull request #%s opened on %s') % (pull_request.pull_request_id, h.fmt_date(pull_request.created_on))}
 
    </a>
 
    </li>
 
    %endfor
 
</ul>
 

	
 
<div class="pullrequests_section_head">${_('I participate in')}</div>
 
<ul>
 
    %for pull_request in c.participate_in_pull_requests:
 
    <li>
 
    <a href="${h.url('pullrequest_show',repo_name=pull_request.org_repo.repo_name,pull_request_id=pull_request.pull_request_id)}">
 
    ${_('Pull request #%s opened by %s on %s') % (pull_request.pull_request_id, pull_request.author.full_name, h.fmt_date(pull_request.created_on))}
 
    </a>
 
    </li>
 
    %endfor
 
</ul>
rhodecode/templates/admin/users/user_edit_my_account_repos.html
Show inline comments
 
new file 100644
 
<div id='repos_list_wrap' class="yui-skin-sam">
 
  <table id="repos_list">
 
  <thead>
 
      <tr>
 
      <th></th>
 
      <th class="left">${_('Name')}</th>
 
      <th class="left">${_('Revision')}</th>
 
      <th class="left">${_('Action')}</th>
 
      <th class="left">${_('Action')}</th>
 
  </thead>
 
   <tbody>
 
   <%namespace name="dt" file="/data_table/_dt_elements.html"/>
 
   %if c.user_repos:
 
       %for repo in c.user_repos:
 
          <tr>
 
              ##QUICK MENU
 
              <td class="quick_repo_menu">
 
                ${dt.quick_menu(repo['name'])}
 
              </td>
 
              ##REPO NAME AND ICONS
 
              <td class="reponame">
 
                ${dt.repo_name(repo['name'],repo['dbrepo']['repo_type'],repo['dbrepo']['private'],repo['dbrepo_fork'].get('repo_name'))}
 
              </td>
 
              ##LAST REVISION
 
              <td>
 
                  ${dt.revision(repo['name'],repo['rev'],repo['tip'],repo['author'],repo['last_msg'])}
 
              </td>
 
              <td><a href="${h.url('repo_settings_home',repo_name=repo['name'])}" title="${_('edit')}"><img class="icon" alt="${_('private')}" src="${h.url('/images/icons/application_form_edit.png')}"/></a></td>
 
              <td>
 
                ${h.form(url('repo_settings_delete', repo_name=repo['name']),method='delete')}
 
                  ${h.submit('remove_%s' % repo['name'],'',class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo['name']+"');")}
 
                ${h.end_form()}
 
              </td>
 
          </tr>
 
       %endfor
 
   %else:
 
      <div style="padding:5px 0px 10px 0px;">
 
      ${_('No repositories yet')}
 
      %if h.HasPermissionAny('hg.admin','hg.create.repository')():
 
          ${h.link_to(_('create one now'),h.url('admin_settings_create_repository'),class_="ui-btn")}
 
      %endif
 
      </div>
 
   %endif
 
   </tbody>
 
   </table>
 
</div>
 
\ No newline at end of file
0 comments (0 inline, 0 general)