[web2py] Re: How to use twitter bootstrap style

2014-02-25 Thread Annet


 How do you add the data toggle, data target, etc. as well? 


I had the same problem, Anthony helped me solve it:


See the end of this section in the book: 
http://web2py.com/books/default/chapter/29/05#HTML-helpers

And specifically for data-* attributes, you can now do:

form.element('input[id=what3]').update(
data={'content':'My text', 'toggle':'popover', 'original-title':'My 
title'}, _title='')

HTML helpers can now take a data argument, which is a dict -- the keys of 
the dict will be transformed into HTML attributes of the form data-[key].

Note, if the helper already has a data argument and you want to add more 
data-* attributes, you would update the data dict itself, as follows:

form.element('input[id=what3]')['data'].update(newattribute='newvalue')


I hope Anthony's reply helps you solve the problem.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to use twitter bootstrap style

2014-02-24 Thread Jessica Le
How do you add the data toggle, data target, etc. as well? 

For example:

form.element(_type='submit')(['_class']='btn 
btn-default',['_data-toggle']='modal',['_data-target']='.bs-example-modal-lg')

but that doesn't work...



On Friday, July 6, 2012 12:06:30 PM UTC-5, Annet wrote:

 To change the value of a button, this should work:

 form.element(_type='submit')['_value']='Login'

 To add the info button:

 form[0][-1][1].append(INPUT(_type=button,_value=Info,_onclick=document.location='%s'
  
 %URL('function')))

 To add the classes:

 form.element(_type='submit')['_class']='btn btn-primary'
 form.element(_type='button')['_class']='btn btn-info'


 Annet



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to use twitter bootstrap style

2012-07-06 Thread Annet
This works for me:

In web2py_ajax.html:

response.files.insert(3,URL('static','js/bootstrap.min.js'))
response.files.insert(4,URL('static','css/bootstrap.min.css'))

and in the function:

form=SQLFORM(..)
form.element(_type='submit')['_class']='btn btn-primary'
form.element(_type='button')['_class']='btn btn-info'


Kind regards,

Annet.


Re: [web2py] Re: How to use twitter bootstrap style

2012-07-06 Thread orsomannaro

Il 06/07/2012 10:52, Annet ha scritto:

This works for me:


but not for me :(


my web2py_ajax.html (I tried several changes):

...
{{
response.files.insert(0,URL('static','js/jquery.js'))
response.files.insert(1,URL('static','css/calendar.css'))
response.files.insert(2,URL('static','js/calendar.js'))
response.files.insert(3,URL('static','js/web2py.js'))
response.include_meta()
response.include_files()
}}



I also tried to insert bootstrap.css in layout.html:

response.files.append(URL('static','css/skeleton.css'))
response.files.append(URL('static','css/web2py.css'))
response.files.append(URL('static','css/bootstrap.css'))

and this change a lot of things but not buttons style, so I think that's 
not the corrects way ...


Re: [web2py] Re: How to use twitter bootstrap style

2012-07-06 Thread stefaan



 and this change a lot of things but not buttons style, so I think that's 
 not the corrects way ... 


Not sure if it would solve your problem, but sometimes you need to clear 
the browser cache to see the effect of changes in css.



[web2py] Re: How to use twitter bootstrap style

2012-07-06 Thread orsomannaro

Il 06/07/2012 10:31, orsomannaro ha scritto:

In a SQLFORM form I set:

buttons = [
  INPUT(_type='submit', _value='go', _class='btn btn-primary'),
  INPUT(_type='button', _value='info', _class='btn btn-info'),
]

but buttons have not bootstrap style (btn-primary button are not blue,
there are no space between the two button).



the problem seem to be _value


[web2py] Re: How to use twitter bootstrap style

2012-07-06 Thread Annet
To change the value of a button, this should work:

form.element(_type='submit')['_value']='Login'

To add the info button:

form[0][-1][1].append(INPUT(_type=button,_value=Info,_onclick=document.location='%s'
 
%URL('function')))

To add the classes:

form.element(_type='submit')['_class']='btn btn-primary'
form.element(_type='button')['_class']='btn btn-info'


Annet