Changeset - 8e250e86a670
[Not reviewed]
default
2 5 4
Marcin Kuzminski - 16 years ago 2010-04-07 21:10:43
marcin@python-blog.com
Css fixes, implemented removal of users, and display draft
9 files changed with 101 insertions and 15 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/repos.py
Show inline comments
 
@@ -20,7 +20,7 @@ class ReposController(BaseController):
 
    def index(self, format='html'):
 
        """GET /repos: All items in the collection"""
 
        # url('repos')
 
        return render('/repos_manage.html')
 
        return render('/repos.html')
 
    
 
    def create(self):
 
        """POST /repos: Create a new item"""
 
@@ -51,7 +51,7 @@ class ReposController(BaseController):
 
    def show(self, id, format='html'):
 
        """GET /repos/id: Show a specific item"""
 
        # url('repo', id=ID)
 

	
 
        return render('/repos_show.html')
 
    def edit(self, id, format='html'):
 
        """GET /repos/id/edit: Form to edit an existing item"""
 
        # url('edit_repo', id=ID)
pylons_app/controllers/users.py
Show inline comments
 
@@ -16,14 +16,15 @@ class UsersController(BaseController):
 
        c.staticurl = g.statics
 
        c.admin_user = session.get('admin_user')
 
        c.admin_username = session.get('admin_username')
 
        self.conn, self.cur = auth.get_sqlite_conn_cur()
 
        
 
    def index(self, format='html'):
 
        """GET /users: All items in the collection"""
 
        # url('users')
 
        conn, cur = auth.get_sqlite_conn_cur()
 
        cur.execute('SELECT * FROM users')
 
        c.users_list = cur.fetchall()        
 
        return render('/users_manage.html')
 
        
 
        self.cur.execute('SELECT * FROM users')
 
        c.users_list = self.cur.fetchall()        
 
        return render('/users.html')
 
    
 
    def create(self):
 
        """POST /users: Create a new item"""
 
@@ -50,11 +51,22 @@ class UsersController(BaseController):
 
        #    h.form(url('user', id=ID),
 
        #           method='delete')
 
        # url('user', id=ID)
 

	
 
        try:
 
            self.cur.execute("DELETE FROM users WHERE user_id=?", (id,))
 
            self.conn.commit()
 
        except:
 
            self.conn.rollback()
 
            raise
 
        return redirect(url('users'))
 
        
 
    def show(self, id, format='html'):
 
        """GET /users/id: Show a specific item"""
 
        # url('user', id=ID)
 

	
 
        self.cur.execute("SELECT * FROM users WHERE user_id=?", (id,))
 
        ret = self.cur.fetchone()
 
        c.user_name = ret[1]
 
        return render('/users_show.html')
 
    
 
    def edit(self, id, format='html'):
 
        """GET /users/id/edit: Form to edit an existing item"""
 
        # url('edit_user', id=ID)
pylons_app/lib/auth.py
Show inline comments
 
@@ -84,7 +84,7 @@ def create_user_table():
 
        log.info('creating table %s', 'users')
 
        cur.execute('''DROP TABLE IF EXISTS users ''')
 
        cur.execute('''CREATE TABLE users
 
                        (id INTEGER PRIMARY KEY AUTOINCREMENT, 
 
                        (user_id INTEGER PRIMARY KEY AUTOINCREMENT, 
 
                         username TEXT, 
 
                         password TEXT,
 
                         active INTEGER,
pylons_app/public/hg_static/style-monoblue.css
Show inline comments
 
@@ -64,7 +64,21 @@ div.page-header {
 
  div.rss_logo a:hover { 
 
    background-color:#ee5500; 
 
  }
 

	
 
input.submit{
 
	background-color:#FF6600;
 
	border-color:#FCC7A5 #7D3302 #3E1A01 #FF954E;
 
	border-style:solid;
 
	border-width:1px;
 
	color:#FFFFFF;
 
	font-family:sans-serif;
 
	font-size:10px;
 
	font-weight:bold;
 
	line-height:8px;
 
	padding:1px 2px;
 
	text-align:center;
 
	text-decoration:none;
 
	cursor: pointer;
 
}
 
  td.indexlinks { 
 
	   white-space: nowrap; 
 
  }
pylons_app/templates/base/base.html
Show inline comments
 
@@ -20,7 +20,7 @@
 
    </div>
 
    ${next.main()}
 
    <div class="page-footer">
 
        Mercurial Repository: ${c.repo_name}
 
        Mercurial
 
    </div>   
 

	
 
    <div id="powered-by">
pylons_app/templates/repos.html
Show inline comments
 
file renamed from pylons_app/templates/repos_manage.html to pylons_app/templates/repos.html
pylons_app/templates/repos_show.html
Show inline comments
 
new file 100644
 
<%inherit file="base/base.html"/>
 
<%def name="title()">
 
    ${_('Repository managment')}
 
</%def>
 
<%def name="breadcrumbs()">
 
    ${h.link_to(u'Home',h.url('/'))}
 
    / 
 
    ${h.link_to(u'Admin',h.url('admin_home'))}
 
    /
 
    ${h.link_to(u'Repos managment',h.url('repos'))}
 
</%def>
 
<%def name="page_nav()">
 
	<li>${h.link_to(u'Home',h.url('/'))}</li>
 
	<li class="current">${_('Admin')}</li>
 
</%def>
 
<%def name="main()">
 
    <ul class="submenu">
 
        <li class="current_submenu">
 
            ${h.link_to(u'Repos',h.url('repos'))}
 
        </li>
 
        <li>
 
            ${h.link_to(u'Users',h.url('users'))}
 
        </li>
 
    </ul>
 
	<div>
 
        <h2>${_('Mercurial repos')}</h2>
 
    </div>
 
</%def>    
 
\ No newline at end of file
pylons_app/templates/users.html
Show inline comments
 
file renamed from pylons_app/templates/users_manage.html to pylons_app/templates/users.html
 
@@ -24,21 +24,25 @@
 
    </ul>
 
	<div>
 
        <h2>${_('Mercurial users')}</h2>
 
        <table cellspacing="0">
 
        <table>
 
         <tr>
 
            <th>Id</th>
 
            <th>Username</th>
 
            <th>Password</th>
 
            <th>Active</th>
 
            <th>Admin</th>
 
            <th>Action</th>
 
         </tr>
 
            %for i in c.users_list:
 
                <tr>
 
                    <td>${i[0]}</td>
 
                    <td>${i[1]}</td>
 
                    <td>${i[2]}</td>
 
                    <td>${h.link_to(i[1],h.url('user', id=i[0]))}</td>
 
                    <td>${i[3]}</td>
 
                    <td>${i[4]}</td>
 
                    <td>
 
	                    ${h.form(url('user', id=i[0]),method='delete')}
 
	                    	${h.submit('remove','remove',class_="submit")}
 
	                    ${h.end_form()}
 
        			</td>
 
                </tr>
 
            %endfor
 
        </table>        
pylons_app/templates/users_show.html
Show inline comments
 
new file 100644
 
<%inherit file="base/base.html"/>
 
<%def name="title()">
 
    ${_('User c.user_name')}
 
</%def>
 
<%def name="breadcrumbs()">
 
    ${h.link_to(u'Home',h.url('/'))}
 
    / 
 
    ${h.link_to(u'Admin',h.url('admin_home'))}
 
    /
 
    ${h.link_to(u'Users',h.url('users'))}
 
</%def>
 
<%def name="page_nav()">
 
	<li>${h.link_to(u'Home',h.url('/'))}</li>
 
	<li class="current">${_('Admin')}</li>
 
</%def>
 
<%def name="main()">
 
    <ul class="submenu">
 
        <li>
 
            ${h.link_to(u'Repos',h.url('repos'))}
 
        </li>
 
        <li class="current_submenu">
 
            ${h.link_to(u'Users',h.url('users'))}
 
        </li>
 
    </ul>
 
	<div>
 
        <h2>${_('User')} - ${c.user_name}</h2>
 
    </div>
 
</%def>    
 
\ No newline at end of file
0 comments (0 inline, 0 general)