# HG changeset patch # User Marcin Kuzminski # Date 2010-04-07 21:10:43 # Node ID 8e250e86a670e1efca1cb2449957144ac18d90b4 # Parent f6ac79182600cb4fc80d65b7d2e33cb2df8c83ac Css fixes, implemented removal of users, and display draft diff --git a/pylons_app/controllers/repos.py b/pylons_app/controllers/repos.py --- a/pylons_app/controllers/repos.py +++ b/pylons_app/controllers/repos.py @@ -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) diff --git a/pylons_app/controllers/users.py b/pylons_app/controllers/users.py --- a/pylons_app/controllers/users.py +++ b/pylons_app/controllers/users.py @@ -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) diff --git a/pylons_app/lib/auth.py b/pylons_app/lib/auth.py --- a/pylons_app/lib/auth.py +++ b/pylons_app/lib/auth.py @@ -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, diff --git a/pylons_app/public/hg_static/style-monoblue.css b/pylons_app/public/hg_static/style-monoblue.css --- a/pylons_app/public/hg_static/style-monoblue.css +++ b/pylons_app/public/hg_static/style-monoblue.css @@ -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; } diff --git a/pylons_app/templates/base/base.html b/pylons_app/templates/base/base.html --- a/pylons_app/templates/base/base.html +++ b/pylons_app/templates/base/base.html @@ -20,7 +20,7 @@ ${next.main()}
diff --git a/pylons_app/templates/repos_manage.html b/pylons_app/templates/repos.html rename from pylons_app/templates/repos_manage.html rename to pylons_app/templates/repos.html diff --git a/pylons_app/templates/repos_show.html b/pylons_app/templates/repos_show.html new file mode 100644 --- /dev/null +++ b/pylons_app/templates/repos_show.html @@ -0,0 +1,28 @@ +<%inherit file="base/base.html"/> +<%def name="title()"> + ${_('Repository managment')} + +<%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 name="page_nav()"> +
  • ${h.link_to(u'Home',h.url('/'))}
  • +
  • ${_('Admin')}
  • + +<%def name="main()"> + +
    +

    ${_('Mercurial repos')}

    +
    + \ No newline at end of file diff --git a/pylons_app/templates/users_manage.html b/pylons_app/templates/users.html rename from pylons_app/templates/users_manage.html rename to pylons_app/templates/users.html --- a/pylons_app/templates/users_manage.html +++ b/pylons_app/templates/users.html @@ -24,21 +24,25 @@

    ${_('Mercurial users')}

    - +
    - + %for i in c.users_list: - - + + %endfor
    Id UsernamePassword Active AdminAction
    ${i[0]}${i[1]}${i[2]}${h.link_to(i[1],h.url('user', id=i[0]))} ${i[3]} ${i[4]} + ${h.form(url('user', id=i[0]),method='delete')} + ${h.submit('remove','remove',class_="submit")} + ${h.end_form()} +
    diff --git a/pylons_app/templates/users_show.html b/pylons_app/templates/users_show.html new file mode 100644 --- /dev/null +++ b/pylons_app/templates/users_show.html @@ -0,0 +1,28 @@ +<%inherit file="base/base.html"/> +<%def name="title()"> + ${_('User c.user_name')} + +<%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 name="page_nav()"> +
  • ${h.link_to(u'Home',h.url('/'))}
  • +
  • ${_('Admin')}
  • + +<%def name="main()"> + +
    +

    ${_('User')} - ${c.user_name}

    +
    + \ No newline at end of file