On Sun, Oct 11, 2009 at 11:04 AM, mdipierro <[email protected]> wrote:
> > I do not think you cannot use decorators this way. > double negatives.... not sure what you intended to say (but logical analysis says "... think you can use decorators this way..."); > But I remind you crud.create is a function that returns SQLFORM which > is a FORM which is a heper as any other helper. Therefore you can do: > > form = crud.create(...) > form['_style']="color:white; background-color:blue; font-weight:bold" > Good point - and addresses the original post (as it could have been more simply done this way); Regardless, then @style( color='white', background-color='blue', font-weight='bold') form = crud.create(...) would still be a readable thing (and just trivial to implement); Alternatively, form.style( ...same kinds of parameters....) could be used; Anyway, this is about readability, and ease of infding this stuff (as this post shows); If there were a member function to FORM to set style, people who not have to stumble upon it. Thoughts? > > > On Oct 11, 10:47 am, Web2py-SuperFan <[email protected]> wrote: > > I really like that suggestion, would be much cleaner code and easier > > to configure different styles that have meaning by variable name > > > > On Oct 10, 9:47 pm, Yarko Tymciurak <[email protected]> wrote: > > > > > I wonder if we could encapsulate, simplify this with a decorator, > something > > > like: > > > > > @button( color='white', background='blue', font='bold' ) > > > form = crud.create(...) > > > > > Something like this could be useful for something like > > > > > @button( my_admin_style ) > > > form = crud.create(....) > > > > > @button( my_warning_style ) > > > form = ... > > > > > .... just thinking out loud.... > > > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan <[email protected] > >wrote: > > > > > > took me a while to dig up the answer/solution, maybe can save someone > > > > else some time > > > > > > form = crud.create(...) > > > > form=DIV( > > > > form, > > > > SCRIPT('''$(document).ready(function() { > > > > $("input[type=submit]").val("Share"); > > > > });'''), > > > > SCRIPT('''$(document).ready(function() { > > > > $("input[type=submit]").css({ > > > > color:'white', > > > > background:'blue', > > > > font: 'bold'}); > > > > });'''), > > > > ) > > > > > > return dict(form=form)- Hide quoted text - > > > > > - Show quoted text - > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

