1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Advancing on html5 basic theme

This commit is contained in:
Adolfo Gómez 2013-11-08 12:18:10 +00:00
parent fcc7bffb2e
commit aa2e532843
3 changed files with 35 additions and 5 deletions

View File

@ -151,6 +151,7 @@ class UserPreference(object):
self._name = kwargs['name']
self._label = kwargs['label']
self._defValue = kwargs['defvalue'] if kwargs.has_key('defvalue') else None
self._css = 'form-control'
def getName(self):
return self._name
@ -177,7 +178,7 @@ class UserTextPreference(UserPreference):
self._length = kwargs['length'] if kwargs.has_key('length') else None
def formField(self, value):
return forms.CharField(label = _(self._label), initial = value)
return forms.CharField(label = _(self._label), initial = value, attrs = {'class': self._css})
class UserNumericPreference(UserPreference):
@ -188,7 +189,8 @@ class UserNumericPreference(UserPreference):
self._max = kwargs['maxvalue'] if kwargs.has_key('maxvalue') else None
def formField(self, value):
return forms.IntegerField(label = _(self._label), initial = value, min_value = self._min, max_value = self._max)
return forms.IntegerField(label = _(self._label), initial = value, min_value = self._min, max_value = self._max,
widget = forms.TextInput(attrs = {'class': self._css}))
class UserChoicePreference(UserPreference):
TYPE = 'choice'
@ -200,7 +202,8 @@ class UserChoicePreference(UserPreference):
self._values = kwargs['values']
def formField(self, value):
return forms.ChoiceField(label = _(self._label), initial = value, choices = self._values)
return forms.ChoiceField(label = _(self._label), initial = value, choices = self._values,
widget = forms.Select(attrs = {'class': self._css}))
def guiField(self, value):
vals = []

View File

@ -95,3 +95,30 @@ footer {
display: block;
}
/* Preferences form */
.form-preferences {
margin-bottom: 10px;
max-width: 640px;
margin: 0 auto;
}
.form-preferences legend {
margin-top: 20px;
padding-left: 16px;
background-color: #f7f7f7;
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
}
.form-preferences .prefset {
padding: 10px;
background-color: #f7f7f7;
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
}
.form-preferences .btn {
margin-top: 16px;
}

View File

@ -195,7 +195,7 @@ def index(request):
logger.debug('Services: {0}'.format(services))
services = sorted(services, key=lambda s: s['name'])
services = sorted(services, key=lambda s: s['name'].upper())
if len(services) == 1 and GlobalConfig.AUTORUN_SERVICE.get(True) == '1' and len(services[0]['transports']) > 0:
if request.session.get('autorunDone', '0') == '0':
@ -220,7 +220,7 @@ def prefs(request):
UserPrefsManager.manager().processRequestForUserPreferences(request.user, request.POST)
return HttpResponseRedirect(reverse('uds.web.views.index'))
prefs_form = UserPrefsManager().manager().getHtmlForUserPreferences(request.user)
return render_to_response('uds/prefs.html', {'prefs_form' : prefs_form }, context_instance=RequestContext(request))
return render_to_response(theme.template('prefs.html'), {'prefs_form' : prefs_form }, context_instance=RequestContext(request))
@webLoginRequired