admin based on bootstrap, thanks Paolo
This commit is contained in:
@@ -168,7 +168,8 @@ def change_password():
|
||||
form = SQLFORM.factory(Field('current_admin_password', 'password'),
|
||||
Field('new_admin_password',
|
||||
'password', requires=IS_STRONG()),
|
||||
Field('new_admin_password_again', 'password'))
|
||||
Field('new_admin_password_again', 'password'),
|
||||
_class="span4 well")
|
||||
if form.accepts(request.vars):
|
||||
if not verify_password(request.vars.current_admin_password):
|
||||
form.errors.current_admin_password = T('invalid password')
|
||||
@@ -202,12 +203,14 @@ def site():
|
||||
|
||||
is_appname = IS_VALID_APPNAME()
|
||||
form_create = SQLFORM.factory(Field('name', requires=is_appname),
|
||||
table_name='appcreate')
|
||||
table_name='appcreate',
|
||||
_class='well well-small')
|
||||
form_update = SQLFORM.factory(Field('name', requires=is_appname),
|
||||
Field('file', 'upload', uploadfield=False),
|
||||
Field('url'),
|
||||
Field('overwrite', 'boolean'),
|
||||
table_name='appupdate')
|
||||
table_name='appupdate',
|
||||
_class='well well-small')
|
||||
form_create.process()
|
||||
form_update.process()
|
||||
|
||||
@@ -374,6 +377,10 @@ def uninstall():
|
||||
|
||||
dialog = FORM.confirm(T('Uninstall'),
|
||||
{T('Cancel'): URL('site')})
|
||||
dialog['_id'] = 'confirm_form'
|
||||
dialog['_class'] = 'well'
|
||||
for component in dialog.components:
|
||||
component['_class'] = 'btn'
|
||||
|
||||
if dialog.accepted:
|
||||
if MULTI_USER_MODE:
|
||||
@@ -791,7 +798,8 @@ def resolve():
|
||||
diff = TABLE(*[TR(TD(gen_data(i, item)),
|
||||
TD(item[0]),
|
||||
TD(leading(item[2:]),
|
||||
TT(item[2:].rstrip())), _class=getclass(item))
|
||||
TT(item[2:].rstrip())),
|
||||
_class=getclass(item))
|
||||
for (i, item) in enumerate(d) if item[0] != '?'])
|
||||
|
||||
return dict(diff=diff, filename=filename)
|
||||
@@ -834,10 +842,14 @@ def edit_language():
|
||||
# Making the short circuit compatible with <= python2.4
|
||||
k = (s != k) and k or B(k)
|
||||
|
||||
rows.append(P(prefix, k, BR(), elem, TAG.BUTTON(T('delete'),
|
||||
_onclick='return delkey("%s")' % name), _id=name))
|
||||
new_row = DIV(LABEL(prefix, k, _style="font-weight:normal;"),
|
||||
CAT(elem, '\n', TAG.BUTTON(
|
||||
T('delete'),
|
||||
_onclick='return delkey("%s")' % name,
|
||||
_class='btn')), _id=name, _class='span6 well well-small')
|
||||
|
||||
rows.append(INPUT(_type='submit', _value=T('update')))
|
||||
rows.append(DIV(new_row,_class="row-fluid"))
|
||||
rows.append(DIV(INPUT(_type='submit', _value=T('update'), _class="btn btn-primary"), _class='controls'))
|
||||
form = FORM(*rows)
|
||||
if form.accepts(request.vars, keepvalues=True):
|
||||
strs = dict()
|
||||
@@ -868,29 +880,27 @@ def edit_plurals():
|
||||
|
||||
keys = sorted(plurals.keys(), lambda x, y: cmp(
|
||||
unicode(x, 'utf-8').lower(), unicode(y, 'utf-8').lower()))
|
||||
rows = []
|
||||
|
||||
row = [T("Singular Form")]
|
||||
row.extend([T("Plural Form #%s", n + 1) for n in xnplurals])
|
||||
table = TABLE(THEAD(TR(row)))
|
||||
|
||||
tab_rows = []
|
||||
for key in keys:
|
||||
name = md5_hash(key)
|
||||
forms = plurals[key]
|
||||
|
||||
if len(forms) < nplurals:
|
||||
forms.extend(None for i in xrange(nplurals - len(forms)))
|
||||
tab_col1 = DIV(CAT(LABEL(T("Singular Form")), B(key,
|
||||
_class='fake-input')))
|
||||
tab_inputs = [SPAN(LABEL(T("Plural Form #%s", n + 1)), INPUT(_type='text', _name=name + '_' + str(n), value=forms[n], _size=20), _class='span6') for n in xnplurals]
|
||||
tab_col2 = DIV(CAT(*tab_inputs))
|
||||
tab_col3 = DIV(CAT(LABEL(XML(' ')), TAG.BUTTON(T('delete'), _onclick='return delkey("%s")' % name, _class='btn'), _class='span6'))
|
||||
tab_row = DIV(DIV(tab_col1, '\n', tab_col2, '\n', tab_col3, _class='well well-small'), _id=name, _class='row-fluid tab_row')
|
||||
tab_rows.append(tab_row)
|
||||
|
||||
row = [B(key)]
|
||||
row.extend([INPUT(_type='text', _name=name + '_' + str(n),
|
||||
value=forms[n], _size=20) for n in xnplurals])
|
||||
row.append(TD(
|
||||
TAG.BUTTON(T('delete'), _onclick='return delkey("%s")' % name)))
|
||||
rows.append(TR(row, _id=name))
|
||||
if rows:
|
||||
table.append(TBODY(rows))
|
||||
rows = [table, INPUT(_type='submit', _value=T('update'))]
|
||||
form = FORM(*rows)
|
||||
tab_rows.append(DIV(TAG['button'](T('update'), _type='submit',
|
||||
_class='btn btn-primary'),
|
||||
_class='controls'))
|
||||
tab_container = DIV(*tab_rows, **dict(_class="row-fluid"))
|
||||
|
||||
form = FORM(tab_container)
|
||||
if form.accepts(request.vars, keepvalues=True):
|
||||
new_plurals = dict()
|
||||
for key in keys:
|
||||
|
||||
@@ -55,7 +55,7 @@ def index():
|
||||
reset(session)
|
||||
apps = os.listdir(os.path.join(request.folder, '..'))
|
||||
form = SQLFORM.factory(Field('name', requires=[IS_NOT_EMPTY(),
|
||||
IS_ALPHANUMERIC()]))
|
||||
IS_ALPHANUMERIC()]), _class='span5 well well-small')
|
||||
if form.accepts(request.vars):
|
||||
app = form.vars.name
|
||||
session.app['name'] = app
|
||||
@@ -125,19 +125,20 @@ def step1():
|
||||
default=params.get('login_method', 'local')),
|
||||
Field(
|
||||
'login_config', default=params.get('login_config', None)),
|
||||
Field('plugins', 'list:string', requires=IS_IN_SET(plugins, multiple=True)))
|
||||
Field('plugins', 'list:string', requires=IS_IN_SET(plugins, multiple=True)),
|
||||
_class='span7 well well-small')
|
||||
|
||||
if form.accepts(request.vars):
|
||||
session.app['params'] = [(key, form.vars.get(key, None))
|
||||
for key, value in session.app['params']]
|
||||
redirect(URL('step2'))
|
||||
redirect(URL('step2') + '/#xwizard_form')
|
||||
return dict(step='1: Setting Parameters', form=form)
|
||||
|
||||
|
||||
def step2():
|
||||
response.view = 'wizard/step.html'
|
||||
form = SQLFORM.factory(Field('table_names', 'list:string',
|
||||
default=session.app['tables']))
|
||||
default=session.app['tables']), _class="span7 well well-small")
|
||||
if form.accepts(request.vars):
|
||||
table_names = [clean(t) for t in listify(form.vars.table_names)
|
||||
if t.strip()]
|
||||
@@ -157,21 +158,21 @@ def step2():
|
||||
session.app['page_' + name] = \
|
||||
'## Manage %s\n\n{{=form}}' % (table)
|
||||
if session.app['tables']:
|
||||
redirect(URL('step3', args=0))
|
||||
redirect(URL('step3', args=0) + '/#xwizard_form')
|
||||
else:
|
||||
redirect(URL('step4'))
|
||||
redirect(URL('step4') + '/#xwizard_form')
|
||||
return dict(step='2: Tables', form=form)
|
||||
|
||||
|
||||
def step3():
|
||||
response.view = 'wizard/step.html'
|
||||
n = int(request.args(0) or 0)
|
||||
n = int(request.args(-1) or 0)
|
||||
m = len(session.app['tables'])
|
||||
if n >= m:
|
||||
redirect(URL('step2'))
|
||||
table = session.app['tables'][n]
|
||||
form = SQLFORM.factory(Field('field_names', 'list:string',
|
||||
default=session.app.get('table_' + table, [])))
|
||||
default=session.app.get('table_' + table, [])), _class="span7 well well-small")
|
||||
if form.accepts(request.vars) and form.vars.field_names:
|
||||
fields = listify(form.vars.field_names)
|
||||
if table == 'auth_user':
|
||||
@@ -187,9 +188,9 @@ def step3():
|
||||
response.flash = T('invalid circular reference')
|
||||
else:
|
||||
if n < m - 1:
|
||||
redirect(URL('step3', args=n + 1))
|
||||
redirect(URL('step3', args=n + 1) + '/#xwizard_form')
|
||||
else:
|
||||
redirect(URL('step4'))
|
||||
redirect(URL('step4') + '/#xwizard_form')
|
||||
return dict(step='3: Fields for table "%s" (%s of %s)'
|
||||
% (table, n + 1, m), table=table, form=form)
|
||||
|
||||
@@ -197,21 +198,21 @@ def step3():
|
||||
def step4():
|
||||
response.view = 'wizard/step.html'
|
||||
form = SQLFORM.factory(Field('pages', 'list:string',
|
||||
default=session.app['pages']))
|
||||
default=session.app['pages']), _class="span7 well well-small")
|
||||
if form.accepts(request.vars):
|
||||
session.app['pages'] = [clean(t)
|
||||
for t in listify(form.vars.pages)
|
||||
if t.strip()]
|
||||
if session.app['pages']:
|
||||
redirect(URL('step5', args=0))
|
||||
redirect(URL('step5', args=0) + '/#xwizard_form')
|
||||
else:
|
||||
redirect(URL('step6'))
|
||||
redirect(URL('step6') + '/#xwizard_form')
|
||||
return dict(step='4: Pages', form=form)
|
||||
|
||||
|
||||
def step5():
|
||||
response.view = 'wizard/step.html'
|
||||
n = int(request.args(0) or 0)
|
||||
n = int(request.args(-1) or 0)
|
||||
m = len(session.app['pages'])
|
||||
if n >= m:
|
||||
redirect(URL('step4'))
|
||||
@@ -221,13 +222,13 @@ def step5():
|
||||
default=session.app.get('page_' + page, []),
|
||||
comment=A('use markmin',
|
||||
_href=markmin_url, _target='_blank')),
|
||||
formstyle='table2cols')
|
||||
formstyle='table2cols', _class="span7 well well-small")
|
||||
if form.accepts(request.vars):
|
||||
session.app['page_' + page] = form.vars.content
|
||||
if n < m - 1:
|
||||
redirect(URL('step5', args=n + 1))
|
||||
redirect(URL('step5', args=n + 1) + '/#xwizard_form')
|
||||
else:
|
||||
redirect(URL('step6'))
|
||||
redirect(URL('step6') + '/#xwizard_form')
|
||||
return dict(step='5: View for page "%s" (%s of %s)' % (page, n + 1, m), form=form)
|
||||
|
||||
|
||||
@@ -242,7 +243,8 @@ def step6():
|
||||
Field('generate_menu', 'boolean', default=True),
|
||||
Field('apply_layout', 'boolean', default=True),
|
||||
Field('erase_database', 'boolean', default=True),
|
||||
Field('populate_database', 'boolean', default=True))
|
||||
Field('populate_database', 'boolean', default=True),
|
||||
_id="generate_form", _class="form-horizontal span7 well well-small")
|
||||
if form.accepts(request.vars):
|
||||
if DEMO_MODE:
|
||||
session.flash = T('Application cannot be generated in demo mode')
|
||||
|
||||
Reference in New Issue
Block a user