Remove (most) of the tw2 for straight forms.

This commit is contained in:
Nathaniel Case 2013-08-12 11:48:16 -04:00
parent f65033a35b
commit 22398a72af
7 changed files with 77 additions and 51 deletions

View File

@ -1,29 +0,0 @@
import tw2.core
import tw2.forms
class CharsheetForm(tw2.forms.FormPage):
title = 'Accounts'
class child(tw2.forms.TableForm):
buttons = [tw2.forms.SubmitButton(id='submit', value='Generate')]
action = '/submit'
id = tw2.forms.HiddenField()
master = tw2.forms.TextField('master', label='All')
# I just made github a hidden field because removing it broke
# the code. I believe other code gets data from it. Anyway, the
# user doesn't need to fill it out anymore because OAuth has
# been implemented.
github = tw2.forms.HiddenField()
github_token = tw2.forms.HiddenField('github_token')
ohloh = tw2.forms.TextField('ohloh', label='Ohloh')
coderwall = tw2.forms.TextField('coderwall', label='Coderwall')
class HandleSearchForm(tw2.forms.FormPage):
title = 'Handle Search'
class child(tw2.forms.TableForm):
buttons = [tw2.forms.SubmitButton(id='submit', value='Search')]
action = '/handle_search'
username = tw2.forms.TextField('handle', label='Handle')

View File

@ -29,7 +29,7 @@
here</a>.
</p>
<div id="home_form">
${handle_search_form.display() | n}
${self.search_form()}
</div>
<!-- SLIDESHOW COMMENTED OUT UNTIL I FINISH REDESIGN
<div class="slideshow">
@ -46,7 +46,7 @@
</div>
<div class="grid_6">
<div id='home_form'>
${charsheet_form.display() | n}
${self.generate_form()}
<form action="${github_login_url}" method="post">
<input class="button" type="submit"
value="Login with GitHub" />
@ -66,3 +66,78 @@
</%def>
<%def name='title()'>Charsheet</%def>
<%def name='search_form()'>
<link media="all" href="/resources/tw2.forms/static/forms.css"
type="text/css" rel="stylesheet">
<title>Handle Search</title>
<h1>Handle Search</h1>
<form method="post" enctype="multipart/form-data"
id="handlesearchform:form" action="/handle_search">
<span class="error"></span>
<table id="handlesearchform">
<tbody>
<tr id="handlesearchform:handle:container" class="odd">
<th><label for="handle">Handle</label></th>
<td>
<input type="text" id="handlesearchform:handle" name="handlesearchform:handle">
<span id="handlesearchform:handle:error"></span>
</td>
</tr>
<tr class="error"><td colspan="2">
<span id="handlesearchform:error"></span>
</td></tr>
</tbody>
</table>
<input type="submit" id="submit" value="Search">
</form>
</%def>
<%def name='generate_form()'>
<link media="all" href="/resources/tw2.forms/static/forms.css"
type="text/css" rel="stylesheet">
<title>Accounts</title>
<h1>Accounts</h1>
<form method="post" enctype="multipart/form-data"
id="charsheetform:form" action="/submit">
<span class="error"></span>
<table id="charsheetform">
<tbody>
<tr id="charsheetform:master:container" class="odd">
<th><label for="master">All</label></th>
<td>
<input type="text" id="charsheetform:master" name="charsheetform:master">
<span id="charsheetform:master:error"></span>
</td>
</tr>
<tr id="charsheetform:ohloh:container" class="even">
<th><label for="ohloh">Ohloh</label></th>
<td>
<input type="text" id="charsheetform:ohloh" name="charsheetform:ohloh">
<span id="charsheetform:ohloh:error"></span>
</td>
</tr>
<tr id="charsheetform:coderwall:container" class="odd">
<th><label for="coderwall">Coderwall</label></th>
<td>
<input type="text" id="charsheetform:coderwall" name="charsheetform:coderwall">
<span id="charsheetform:coderwall:error"></span>
</td>
</tr>
<tr class="error"><td colspan="2">
<input type="hidden" id="charsheetform:id" name="charsheetform:id">
<input type="hidden" id="charsheetform:github" name="charsheetform:github">
<input type="hidden" id="charsheetform:github_token" name="charsheetform:github_token">
<span id="charsheetform:error"></span>
</td></tr>
</tbody>
</table>
<input type="submit" id="submit" value="Generate">
</form>
</%def>

View File

@ -15,16 +15,12 @@ from pyramid.security import (
from velruse import login_url
import datetime
import forms
import data
@view_config(route_name='home', renderer='home.mak')
def home_view(request):
return {
'handle_search_form': forms.HandleSearchForm,
'charsheet_form': forms.CharsheetForm,
'github_login_url': login_url(request, 'github'),
}

View File

@ -31,12 +31,8 @@ port = 6543
[pipeline:main]
pipeline =
tw2.core
charsheet
[filter:tw2.core]
use = egg:tw2.core#middleware
# Begin logging configuration
[loggers]

View File

@ -39,12 +39,8 @@ port = 8080
[pipeline:main]
pipeline =
tw2.core
charsheet
[filter:tw2.core]
use = egg:tw2.core#middleware
# Begin logging configuration
[loggers]

View File

@ -39,12 +39,8 @@ port = 6543
[pipeline:main]
pipeline =
tw2.core
charsheet
[filter:tw2.core]
use = egg:tw2.core#middleware
# Begin logging configuration
[loggers]

View File

@ -13,11 +13,7 @@ requires = [
'pyramid',
'SQLAlchemy',
'transaction',
'tw2.core',
'tw2.forms',
'tw2.dynforms',
'tw2.sqla',
'tw2.jqplugins.jqgrid',
'pygithub3',
'pyramid_tm',
'pyramid_debugtoolbar',