Changeset - 70c2750531d3
[Not reviewed]
default
0 5 0
Marcin Kuzminski - 15 years ago 2010-09-03 07:34:38
marcin@python-works.com
rewrote sorting on main page, to clickable headers.
Update my account with better repo list
some css fixes
5 files changed with 99 insertions and 91 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/hg.py
Show inline comments
 
@@ -28,30 +28,31 @@ from pylons_app.lib.auth import LoginReq
 
from pylons_app.lib.base import BaseController, render
 
from pylons_app.model.hg_model import HgModel
 
import logging
 
log = logging.getLogger(__name__)
 

	
 
class HgController(BaseController):
 

	
 
    @LoginRequired()
 
    def __before__(self):
 
        super(HgController, self).__before__()
 
        
 
    def index(self):
 
        c.current_sort = request.GET.get('sort', 'name')
 
        sort_by = c.current_sort
 
        sortables = ['name', 'description', 'last_change', 'tip', 'contact']
 
        current_sort = request.GET.get('sort', 'name')
 
        current_sort_slug = current_sort.replace('-', '')
 
        
 
        c.cs_slug = sort_by.replace('-', '')
 
        
 
        if c.cs_slug not in sortables:
 
            sort_by = 'name'
 
        
 
        if current_sort_slug not in sortables:
 
            c.sort_by = 'name'
 
            current_sort_slug = c.sort_by
 
        else:
 
            c.sort_by = current_sort
 
        c.sort_slug = current_sort_slug
 
        cached_repo_list = HgModel().get_repos()
 
        
 
        sort_key = c.cs_slug + '_sort'
 
        if sort_by.startswith('-'):
 
        sort_key = current_sort_slug + '_sort'
 
        if c.sort_by.startswith('-'):
 
            c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=True)
 
        else:
 
            c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=False)
 
            
 
        return render('/index.html')
pylons_app/public/css/style.css
Show inline comments
 
@@ -17,24 +17,28 @@ body
 
	font-size: 11px;
 
}
 
 
/* -----------------------------------------------------------
 
	images
 
----------------------------------------------------------- */ 
 
 
img
 
{
 
	border: none;	
 
}
 
 
img.icon{
 
    vertical-align: bottom;
 
 
}
 
/* -----------------------------------------------------------
 
	anchors
 
----------------------------------------------------------- */ 
 
 
a
 
{
 
	color: #0066CC;	
 
	text-decoration: none;
 
	cursor: pointer;
 
}
 
 
a:hover
pylons_app/templates/admin/users/user_edit_my_account.html
Show inline comments
 
@@ -5,105 +5,107 @@
 
    ${c.hg_app_user.username} ${_('account')}
 
</%def>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('My Account')}
 
</%def>
 

	
 
<%def name="page_nav()">
 
	${self.menu('admin')}
 
</%def>
 

	
 
<%def name="main()">
 

	
 
<div class="box box-left">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}       
 
    </div>
 
    <!-- end box / title -->
 
    <div class="ui-tabs-panel ui-widget-content ui-corner-bottom">
 
    ${h.form(url('admin_settings_my_account_update'),method='put')}
 
    <div class="form">
 
        <!-- fields -->
 
        <div class="fields">
 
             <div class="field">
 
                <div class="label">
 
                    <label for="username">${_('Username')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('username')}
 
                </div>
 
             </div>
 
            
 
             <div class="field">
 
                <div class="label">
 
                    <label for="new_password">${_('New password')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.password('new_password')}
 
                </div>
 
             </div>
 
            
 
             <div class="field">
 
                <div class="label">
 
                    <label for="name">${_('Name')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('name')}
 
                </div>
 
             </div>
 
            
 
             <div class="field">
 
                <div class="label">
 
                    <label for="lastname">${_('Lastname')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('lastname')}
 
                </div>
 
             </div>
 
            
 
             <div class="field">
 
                <div class="label">
 
                    <label for="email">${_('Email')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('email')}
 
                </div>
 
             </div>
 
            
 
            <div class="buttons">
 
              ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
            </div>             
 
    	</div>    
 
	    <div class="form">
 
	        <div class="fields">
 
	             <div class="field">
 
	                <div class="label">
 
	                    <label for="username">${_('Username')}:</label>
 
	                </div>
 
	                <div class="input">
 
	                    ${h.text('username')}
 
	                </div>
 
	             </div>
 
	            
 
	             <div class="field">
 
	                <div class="label">
 
	                    <label for="new_password">${_('New password')}:</label>
 
	                </div>
 
	                <div class="input">
 
	                    ${h.password('new_password')}
 
	                </div>
 
	             </div>
 
	            
 
	             <div class="field">
 
	                <div class="label">
 
	                    <label for="name">${_('Name')}:</label>
 
	                </div>
 
	                <div class="input">
 
	                    ${h.text('name')}
 
	                </div>
 
	             </div>
 
	            
 
	             <div class="field">
 
	                <div class="label">
 
	                    <label for="lastname">${_('Lastname')}:</label>
 
	                </div>
 
	                <div class="input">
 
	                    ${h.text('lastname')}
 
	                </div>
 
	             </div>
 
	            
 
	             <div class="field">
 
	                <div class="label">
 
	                    <label for="email">${_('Email')}:</label>
 
	                </div>
 
	                <div class="input">
 
	                    ${h.text('email')}
 
	                </div>
 
	             </div>
 
	            
 
	            <div class="buttons">
 
	              ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
 
	            </div>             
 
	    	</div>
 
	    </div>    	
 
    ${h.end_form()}
 
    </div>
 
    ${h.end_form()}
 
</div>    
 

	
 
<div class="box box-right">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('My repositories')}</h5>   
 
    </div>
 
    <!-- end box / title -->
 
    <div class="table">
 
    <table>
 
     <tbody>
 
     %for repo in c.user_repos:
 
        <tr>
 
            <td>
 
             %if repo.dbrepo.private:
 
                <img alt="${_('private')}" src="/images/icons/lock.png"/>
 
             %else:
 
                <img alt="${_('public')}" src="/images/icons/lock_open.png"/>
 
             %endif
 
                                             
 
            ${h.link_to(repo.name, h.url('summary_home',repo_name=repo.name))}</td> 
 
            ##<td>${_('created')} ${repo.dbrepo.}</td>
 
            <td>${_('last changed')}  ${h.age(repo.last_change)}</td>
 
            <td>${h.link_to(_('[edit]'),h.url('edit_repo',repo_name=repo.name))}</td>
 
        </tr>
 
     %endfor
 
     </tbody>
 
     </table>
 
	    <table>
 
	     <tbody>
 
	     %for repo in c.user_repos:
 
	        <tr>
 
	            <td>
 
	             %if repo.dbrepo.private:
 
	                <img class="icon" alt="${_('private')}" src="/images/icons/lock.png"/>
 
	             %else:
 
	                <img class="icon" alt="${_('public')}" src="/images/icons/lock_open.png"/>
 
	             %endif
 
	                                             
 
	            ${h.link_to(repo.name, h.url('summary_home',repo_name=repo.name))}</td> 
 
	            <td>${_('revision')}: ${repo.revisions[-1]}</td>
 
	            <td>${_('last changed')}: ${h.age(repo.last_change)}</td>
 
	            <td><img class="icon" alt="${_('private')}" src="/images/icons/application_form_edit.png"/> ${h.link_to(_('edit'),h.url('edit_repo',repo_name=repo.name))}</td>
 
	        </tr>
 
	     %endfor
 
	     </tbody>
 
	     </table>
 
    </div>
 
    
 
</div>
 
</%def>  
 
\ No newline at end of file
pylons_app/templates/index.html
Show inline comments
 
@@ -3,35 +3,36 @@
 
<%def name="title()">
 
    ${c.hg_app_name}
 
</%def>
 
<%def name="breadcrumbs()">
 
	${c.hg_app_name}
 
</%def>
 
<%def name="page_nav()">
 
	${self.menu('home')}
 
</%def>
 
<%def name="main()">
 
	<%def name="get_sort(name)">
 
		<%name_slug = name.lower().replace(' ','_') %>
 
		%if name_slug == c.cs_slug:
 
			<span style="font-weight: bold;text-decoration: underline;">${name}</span>
 
		
 
		%if name_slug == c.sort_slug:
 
		  %if c.sort_by.startswith('-'):
 
		    <a href="?sort=${name_slug}">${name}&uarr;</a>
 
		  %else:
 
		    <a href="?sort=-${name_slug}">${name}&darr;</a>
 
		  %endif:
 
		%else:
 
			<span style="font-weight: bold">${name}</span>
 
		    <a href="?sort=${name_slug}">${name}</a>
 
		%endif
 
		<a href="?sort=${name_slug}">&darr;</a>
 
		<a href="?sort=-${name_slug}">&uarr;</a>
 
	</%def>
 
	
 
	
 
	
 
    <div class="box">
 
	    <!-- box / title -->
 
	    <div class="title">
 
	        <h5>${_('Dashboard')}</h5>
 
	        %if h.HasPermissionAny('hg.admin','hg.create.repository')():
 
	        <ul class="links">
 
	          <li>
 
	            <span>${h.link_to(u'ADD NEW REPOSITORY',h.url('admin_settings_create_repository'),class_="add_icon")}</span>
 
	          </li>          
 
	        </ul>  	        
 
	        %endif
 
	    </div>
 
@@ -46,27 +47,27 @@
 
			        <th class="left">${get_sort(_('Tip'))}</th>
 
			        <th class="left">${get_sort(_('Contact'))}</th>
 
			        <th class="left">${_('RSS')}</th>
 
			        <th class="left">${_('Atom')}</th>
 
	            </tr>
 
            </thead>
 
                        <tbody>
 
					    %for cnt,repo in enumerate(c.repos_list):
 
					        %if h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(repo['name'],'main page check'):
 
					        <tr class="parity${cnt%2}">
 
					            <td>
 
					             %if repo['repo'].dbrepo.private:
 
					                <img alt="${_('private')}" src="/images/icons/lock.png"/>
 
					                <img class="icon" alt="${_('private')}" src="/images/icons/lock.png"/>
 
					             %else:
 
					                <img alt="${_('public')}" src="/images/icons/lock_open.png"/>
 
					                <img class="icon" alt="${_('public')}" src="/images/icons/lock_open.png"/>
 
					             %endif  
 
					            ${h.link_to(repo['name'],
 
					                h.url('summary_home',repo_name=repo['name']))}</td>
 
					            <td title="${repo['description']}">${h.truncate(repo['description'],60)}</td>
 
					            <td>${h.age(repo['last_change'])}</td>
 
					            <td>${h.link_to_if(repo['rev']>=0,'r%s:%s' % (repo['rev'],repo['tip']),
 
					                h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
 
					                class_="tooltip",
 
					                tooltip_title=h.tooltip(repo['last_msg']))}</td>
 
					            <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
 
					            <td>
 
					                <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon"  href="${h.url('rss_feed_home',repo_name=repo['name'])}"></a>
pylons_app/templates/summary/summary.html
Show inline comments
 
@@ -33,25 +33,25 @@ E.onDOMReady(function(e){
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <!-- end box / title -->
 
	<div class="form">
 
	  <div class="fields">
 
		 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Name')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			      ${c.repo_info.name}
 
			      <span style="font-size: 1.6em;font-weight: bold">${c.repo_info.name}</span>
 
			  </div>
 
			 </div>
 
			
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Description')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			      ${c.repo_info.description}
 
			  </div>
 
			 </div>
0 comments (0 inline, 0 general)