--- a/web/data/cubicweb.preferences.css Tue May 19 14:31:42 2009 +0200
+++ b/web/data/cubicweb.preferences.css Tue May 19 15:42:32 2009 +0200
@@ -6,17 +6,21 @@
*/
-.preferences .validateButton{
+.preferences .validateButton{
margin-top:0px;
}
-fieldset.preferences{
+fieldset.preferences{
border : 1px solid #CFCEB7;
margin:7px 1em 0;
padding:2px 6px 6px;
}
-div.componentLink{
+div.component {
+ margin-left: 1em;
+}
+
+div.componentLink{
margin-top:0.3em;
}
@@ -39,7 +43,7 @@
font-size:89%;
}
-h2.propertiesform a:hover{
+h2.propertiesform a:hover{
background-color:#cfceb7;
}
@@ -50,57 +54,57 @@
}
div.preffield {
- margin-bottom: 5px;
+ margin-bottom: 5px;
padding:2px 5px;
background:#eeedd9;
}
-div.prefinput{
- margin:.3em;
+div.prefinput{
+ margin:.3em;
}
div.prefinput select.changed,
-div.prefinput input.changed{
+div.prefinput input.changed{
border: 1px solid #000;
font-weight:bold;
}
div.prefinput select,
-div.prefinput input{
+div.prefinput input{
background:#fff;
border: 1px solid #CFCEB7;
}
.prefinput input.error {
/* background:#fff url(error.png) no-repeat scroll 100% 50% !important; */
- border:1px solid red !important;
+ border:1px solid red !important;
color:red;
padding-right:1em;
}
-div.formsg{
+div.formsg{
font-weight:bold;
margin:0.5em 0px;
}
-div.critical{
+div.critical{
color:red;
padding-left:20px;
background:#fff url(critical.png) no-repeat;
}
-div.formsg .msg{
+div.formsg .msg{
color : green;
}
.helper{
font-size: 96%;
color: #555544;
- padding:0;
+ padding:0;
}
div.prefinput .helper:hover {
@@ -108,6 +112,6 @@
cursor: default;
}
-div.openlink{
+div.openlink{
display:inline;
}
--- a/web/data/cubicweb.preferences.js Tue May 19 14:31:42 2009 +0200
+++ b/web/data/cubicweb.preferences.js Tue May 19 15:42:32 2009 +0200
@@ -11,14 +11,14 @@
function closeFieldset(fieldsetid){
var linklabel = _('open all');
- var linkhref = 'javascript:openFieldset("' +fieldsetid + '")'
- _toggleFieldset(fieldsetid, 1, linklabel, linkhref)
+ var linkhref = 'javascript:openFieldset("' +fieldsetid + '")';
+ _toggleFieldset(fieldsetid, 1, linklabel, linkhref);
}
function openFieldset(fieldsetid){
var linklabel = _('close all');
- var linkhref = 'javascript:closeFieldset("'+ fieldsetid + '")'
- _toggleFieldset(fieldsetid, 0, linklabel, linkhref)
+ var linkhref = 'javascript:closeFieldset("'+ fieldsetid + '")';
+ _toggleFieldset(fieldsetid, 0, linklabel, linkhref);
}
@@ -26,13 +26,13 @@
jQuery('#'+fieldsetid).find('div.openlink').each(function(){
var link = A({'href' : "javascript:noop();",
'onclick' : linkhref},
- linklabel)
+ linklabel);
jQuery(this).empty().append(link);
});
jQuery('#'+fieldsetid).find('fieldset[id]').each(function(){
var fieldset = jQuery(this);
if(closeaction){
- fieldset.addClass('hidden')
+ fieldset.addClass('hidden');
}else{
fieldset.removeClass('hidden');
linkLabel = (_('open all'));
@@ -41,7 +41,6 @@
}
function validatePrefsForm(formid){
- freezeFormButtons(formid);
clearPreviousMessages();
clearPreviousErrors(formid);
return validateForm(formid, null, submitSucces, submitFailure);
@@ -79,18 +78,18 @@
function checkValues(form, success){
var unfreezeButtons = false;
- jQuery(form).find('select').each(function () {
+ jQuery(form).find('select').each(function () {
unfreezeButtons = _checkValue(jQuery(this), unfreezeButtons);
});
jQuery(form).find('[type=text]').each(function () {
unfreezeButtons = _checkValue(jQuery(this), unfreezeButtons);
});
- jQuery(form).find('input[type=radio]').each(function () {
+ jQuery(form).find('input[type=radio]').each(function () {
if (jQuery(this).attr('checked')){
unfreezeButtons = _checkValue(jQuery(this), unfreezeButtons);
}
- });
-
+ });
+
if (unfreezeButtons){
unfreezeFormButtons(form.attr('id'));
}else{
@@ -110,14 +109,14 @@
}else{
input.removeClass('changed');
jQuery("span[id=err-" + input.attr('id') + "]").remove();
- }
+ }
input.removeClass('error');
- return unfreezeButtons
+ return unfreezeButtons;
}
function setCurrentValues(form){
- jQuery(form).find('input[name^=current-value]').each(function () {
+ jQuery(form).find('input[name^=current-value]').each(function () {
var currentValueInput = jQuery(this);
var name = currentValueInput.attr('name').split('-')[1];
jQuery(form).find("[name=" + name + "]").each(function (){
@@ -134,17 +133,17 @@
}
function initEvents(){
- jQuery('form').each(function() {
+ jQuery('form').each(function() {
var form = jQuery(this);
freezeFormButtons(form.attr('id'));
- form.find('input[type=text]').keyup(function(){
- checkValues(form);
+ form.find('input[type=text]').keyup(function(){
+ checkValues(form);
});
- form.find('input[type=radio]').change(function(){
- checkValues(form);
+ form.find('input[type=radio]').change(function(){
+ checkValues(form);
});
- form.find('select').change(function(){
- checkValues(form);
+ form.find('select').change(function(){
+ checkValues(form);
});
setCurrentValues(form);
});
--- a/web/views/cwproperties.py Tue May 19 14:31:42 2009 +0200
+++ b/web/views/cwproperties.py Tue May 19 15:42:32 2009 +0200
@@ -123,8 +123,6 @@
req = self.req
_ = req._
w(u'<h1>%s</h1>\n' % _(self.title))
- # we don't want this in each sub-forms XXX
- w(u'<div id="progress">%s</div>' % self.req._('validating...'))
for label, group, form in sorted((_(g), g, f)
for g, f in mainopts.iteritems()):
status = css_class(self._group_status(group))
@@ -141,21 +139,25 @@
w(u'<h2 class="propertiesform">%s</h2>\n' %
(make_togglable_link('fieldset_' + group, label.capitalize())))
w(u'<div id="fieldset_%s" %s>' % (group, status))
-
+
# create selection
sorted_objects = sorted((self.req.__('%s_%s' % (group, o)), o, f)
for o, f in objects.iteritems())
for label, oid, form in sorted_objects:
- w(u'''<div class="componentLink"><a href="javascript:noop();" onclick="javascript:toggleVisibility('field_%(oid)s_%(group)s')" class="componentTitle">%(label)s</a>''' % {'label':label, 'oid':oid, 'group':group})
- w(u''' (<div class="openlink"><a href="javascript:noop();" onclick="javascript:closeFieldset('fieldset_%(group)s')">%(label)s</a></div>)'''
- % {'label':_('close all'), 'group':group})
+ w(u'<div class="component">')
+ w(u'''<div class="componentLink"><a href="javascript:noop();"
+ onclick="javascript:toggleVisibility('field_%(oid)s_%(group)s')"
+ class="componentTitle">%(label)s</a>''' % {'label':label, 'oid':oid, 'group':group})
+ w(u''' (<div class="openlink"><a href="javascript:noop();"
+ onclick="javascript:openFieldset('fieldset_%(group)s')">%(label)s</a></div>)'''
+ % {'label':_('open all'), 'group':group})
w(u'</div>')
docmsgid = '%s_%s_description' % (group, oid)
doc = _(docmsgid)
if doc != docmsgid:
w(u'<div class="helper">%s</div>' % html_escape(doc).capitalize())
-
- w(u'<fieldset id="field_%(oid)s_%(group)s" class="%(group)s preferences">'
+ w(u'</div>')
+ w(u'<fieldset id="field_%(oid)s_%(group)s" class="%(group)s preferences hidden">'
% {'oid':oid, 'group':group})
w(form)
w(u'</fieldset>')
@@ -188,7 +190,7 @@
def form(self, formid, keys, splitlabel=False):
buttons = [SubmitButton()]
form = CompositeForm(self.req, domid=formid, action=self.build_url(),
- form_buttons=buttons,
+ form_buttons=buttons,
onsubmit="return validatePrefsForm('%s')" % formid,
submitmsg=self.req._('changes applied'))
path = self.req.relative_path()
@@ -209,7 +211,7 @@
else:
label = key
subform = EntityFieldsForm(self.req, entity=entity, set_error_url=False)
-
+
subform.append_field(PropertyValueField(name='value', label=label,
eidparam=True))
subform.vreg = self.vreg
@@ -217,7 +219,7 @@
subform.form_add_hidden("current-value:%s" % entity.eid,)
form.form_add_subform(subform)
return subform
-
+
def is_user_prefs(cls, req, rset, row=None, col=0, **kwargs):
return req.user.eid == rset[row or 0][col]
@@ -339,7 +341,7 @@
if vocab is not None:
if callable(vocab):
# list() just in case its a generator function
- self.choices = list(vocab(form.req))
+ self.choices = list(vocab(form.req))
else:
self.choices = vocab
wdg = Select()
@@ -357,7 +359,7 @@
def open_form(self, form, values):
err = '<div class="formsg"></div>'
return super(EPropertiesFormRenderer, self).open_form(form, values) + err
-
+
def _render_fields(self, fields, w, form):
for field in fields:
w(u'<div class="preffield">\n')