Re: [web2py] Re: About web2py_component and redirect

2016-11-10 Thread Marco Mansilla
What I did was add a 0 option to select, and the fire a js event with
modal, using $.web2py.component works with a small issue, the first time it
fires opens and closes a new tab.

I will try to share it tonight, maybe someone else could find it useful.

El 10 nov. 2016 4:26 AM, "黄祥"  escribió:

i think you can use comment for that, n modify the css class to your own
css (assuming you have your own css)
e.g.
db.test.user.comment = A(_class="glyphicon glyphicon-plus-sign",
**{"_data-toggle":"modal", "_data-target":"#modal_auth_user"} ) if
has_membership_admin else None

best regards,
stifan

-- 
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/d/optout.

-- 
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/d/optout.


Re: [web2py] Re: About web2py_component and redirect

2016-11-09 Thread 黄祥
i think you can use comment for that, n modify the css class to your own 
css (assuming you have your own css)
e.g.
db.test.user.comment = A(_class="glyphicon glyphicon-plus-sign", 
**{"_data-toggle":"modal", "_data-target":"#modal_auth_user"} ) if 
has_membership_admin else None

best regards,
stifan

-- 
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/d/optout.


Re: [web2py] Re: About web2py_component and redirect

2016-11-09 Thread Marco Mansilla
El Wed, 9 Nov 2016 15:45:55 -0800 (PST)
黄祥  escribió:

> *pls try :*
> *controllers/default.py*
> def modal_auth_user():
> table = db.auth_user
> fields = None
> target_response = '(function($) 
> {$("#modal_auth_user").modal("hide");}(jQuery));'
> form = SQLFORM(table, fields = fields)
> if form.process(formname = 'form_modal').accepted:
> response.js = target_response
> redirect(request.env.http_web2py_component_location, client_side =
> True) elif form.errors:
> response.flash = 'form has errors'
> return dict(form = form)
> 
> *views/default/index.html*
> {{extend 'layout.html'}}
> 
> {{=H3(T('Test'), _class = 'text-info') }}
> 
> {{=LOAD('default', 'test.load', ajax = True, 
> target = 'test') }}
> 
> *views/default/test.load*
> {{=form}}
> 
>  role="dialog" aria-labelledby="myModalLabel">
> 
> 
> 
>  aria-label="Close">×
> {{=DIV(T('User') ) }}
> 
> 
> {{=LOAD('default', 'modal_auth_user.load', ajax = True) }}
> 
> 
> 
> 
> 
> best regards,
> stifan
> 

Thank you both, everything seems to work nice now, so next step would
be create a plugin/widget to add a + button next to item list field. I
think there was a plugin, documented on web2py slices but last time I
tried didn't work for compatibility issues, so will do that by myself.

Thanks for the help, and sorry for the lazy question.

Marco.

-- 
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/d/optout.


Re: [web2py] Re: About web2py_component and redirect

2016-11-09 Thread 黄祥
*pls try :*
*controllers/default.py*
def modal_auth_user():
table = db.auth_user
fields = None
target_response = '(function($) 
{$("#modal_auth_user").modal("hide");}(jQuery));'
form = SQLFORM(table, fields = fields)
if form.process(formname = 'form_modal').accepted:
response.js = target_response
redirect(request.env.http_web2py_component_location, client_side = True)
elif form.errors:
response.flash = 'form has errors'
return dict(form = form)

*views/default/index.html*
{{extend 'layout.html'}}

{{=H3(T('Test'), _class = 'text-info') }}

{{=LOAD('default', 'test.load', ajax = True, 
target = 'test') }}

*views/default/test.load*
{{=form}}





×
{{=DIV(T('User') ) }}


{{=LOAD('default', 'modal_auth_user.load', ajax = True) }}





best regards,
stifan

-- 
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/d/optout.


Re: [web2py] Re: About web2py_component and redirect

2016-11-09 Thread Anthony
No, use response.js. See 
http://web2py.com/books/default/chapter/29/12/components-and-plugins#markmin_client_server_coms.

Anthony

On Wednesday, November 9, 2016 at 4:54:11 PM UTC-5, marco mansilla wrote:
>
> Would please provide minimal examples?... for some reason in controller:
>
> return "jQuery(('.modal').modal('hide'))"
>
> shows the line as text inside .modal-body.
>
> Thanks in advance.
>
> 2016-11-09 13:15 GMT-03:00 Anthony:
>
>> So, fixed it partially with web2py_component in the view, the web2py 
>>> component calls the form in the modal-body, and a few lines of js 
>>> toggle the modal, in this case the info is submited, but the modal 
>>> doesn't close and I would like to know if there's some way to catch the 
>>> web2py_component after de post event.
>>>
>>
>> In the controller that handles the form submission, you could use 
>> response.js to return some Javascript code, which will be evaluated by the 
>> browser when the response is received. Alternatively, you could just add 
>> your own event handler in the browser to react to the form submission.
>>
>> Anthony
>>
>> -- 
>> 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/d/optout.
>>
>
>
>
> -- 
> -BEGIN GEEK CODE BLOCK-
> version 3.1
> GCS/GTW/| d? s+:+>+++ a-- C+++(+) UL>$ P++>+++ L+++>+$ E->+ W++>+ 
> N>+++ o K- w---() 
> O(--) M>-- V-- PS++ PE++>+ Y-->+ PGP+>+++ t-(?) 5? X++ R+ !tv b+++> 
> DI+++ D--- G+++>+ 
> e+++> h* r++>+++ y++ 
> --END GEEK CODE BLOCK--
>

-- 
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/d/optout.


Re: [web2py] Re: About web2py_component and redirect

2016-11-09 Thread Marco Mansilla
Would please provide minimal examples?... for some reason in controller:

return "jQuery(('.modal').modal('hide'))"

shows the line as text inside .modal-body.

Thanks in advance.

2016-11-09 13:15 GMT-03:00 Anthony :

> So, fixed it partially with web2py_component in the view, the web2py
>> component calls the form in the modal-body, and a few lines of js
>> toggle the modal, in this case the info is submited, but the modal
>> doesn't close and I would like to know if there's some way to catch the
>> web2py_component after de post event.
>>
>
> In the controller that handles the form submission, you could use
> response.js to return some Javascript code, which will be evaluated by the
> browser when the response is received. Alternatively, you could just add
> your own event handler in the browser to react to the form submission.
>
> Anthony
>
> --
> 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/d/optout.
>



-- 
-BEGIN GEEK CODE BLOCK-
version 3.1
GCS/GTW/| d? s+:+>+++ a-- C+++(+) UL>$ P++>+++ L+++>+$ E->+ W++>+
N>+++ o K- w---()
O(--) M>-- V-- PS++ PE++>+ Y-->+ PGP+>+++ t-(?) 5? X++ R+ !tv b+++>
DI+++ D--- G+++>+
e+++> h* r++>+++ y++
--END GEEK CODE BLOCK--

-- 
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/d/optout.


[web2py] Re: About web2py_component and redirect

2016-11-09 Thread Anthony

>
> So, fixed it partially with web2py_component in the view, the web2py 
> component calls the form in the modal-body, and a few lines of js 
> toggle the modal, in this case the info is submited, but the modal 
> doesn't close and I would like to know if there's some way to catch the 
> web2py_component after de post event.
>

In the controller that handles the form submission, you could use 
response.js to return some Javascript code, which will be evaluated by the 
browser when the response is received. Alternatively, you could just add 
your own event handler in the browser to react to the form submission.

Anthony

-- 
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/d/optout.