I would extend your common view with an empty block to hide the
undesired part and avoid passing this argument to views.

On Tue, Jul 1, 2014 at 1:36 PM, Mandar Vaze <mandarv...@gmail.com> wrote:
> Hi,
>
> I have several views which are similar, so I am using common view file using
> "response.view =common_view.html" rather than separate one per controller.
>
> Out of these - 2 or 3 views are slightly different where certain parts of
> the page (layout.html) need to be hidden.
>
> I tried :
>
> return dict(msg=msg, grid=grid, hide_my_div=True)
>
> in the view template I have :
>
> {{if hide_my_div:}}
> <script>
>  $(document).ready(function(){
>       $("#my_div").hide();
>   });
> <script>
> {{pass}}
>
> This works for the small number of views where I want to hide "my_div"
> Unfortunately - this also means I need to pass "hide_my_div=False" from
> large number of controllers.
>
> Is there a way to have hide_my_div=False as a default - so that I do not
> need to return it explicitly - and I can override only when needed (2-3
> controllers)
> Something like optional params with default values ?
>
> May be the way I am handling this is wrong. Is there a better way ?
>
> (I know that I can create separate view files for these "odd ones", but I
> prefer not to, since these are going to be 90% similar to common_view.html
> anyway)
>
> Thanks,
> -Mandar
>
> --
> 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.

Reply via email to