Hi All,
I am trying to use angular material with web2py. My layout.html using
angular material looks like this: http://pastebin.com/Fydxwb8w. The layout
looks like this when loaded in browser:
[image: AP4XDAk.png (1823×1041)]
I am trying to create login form. My form style looks like this:
def formstyle_angular_material(form, fields, *args, **kwargs):
def render_row(row_id, label, widget, comment, hidden=False):
input_container = TAG["md-input-container"](_class="md-block")
_class = "form-row row hide" if hidden else "form-row row"
if isinstance(label, LABEL):
label.attributes["_style"] = "color:green"
input_container.append(label)
if isinstance(widget, INPUT):
if "_type" in widget.attributes and \
widget.attributes["_type"] == "checkbox":
# Checkbox
# Label contained here
widget = TAG["md-checkbox"](label.components[0])
return DIV(widget, _class=_class, _id=row_id)
else:
# Normal Input
# Label contained above
input_container.append(widget)
if hasattr(widget, "element"):
submit = widget.element("input", _type="submit")
if submit:
widget = TAG["md-button"](widget.attributes["_value"],
_class="md-raised md-primary",
_type="submit")
return DIV(widget, _class=_class, _id=row_id)
return DIV(input_container, _class=_class, _id=row_id)
parent = TAG[""]()
for row_id, label, widget, comment in fields:
parent.append(render_row(row_id, label, widget, comment))
return parent
The /views/default/user.html looks like this:
{{if request.args(0) == "login":}}
{{include "auth/_login.html"}}
{{pass}}
{{block page_js}}
<script>
jQuery("#web2py_user_form input:visible:enabled:first").focus();
{{if request.args(0)=='register':}}
web2py_validate_entropy(jQuery('#auth_user_password'),100);
{{elif request.args(0)=='change_password':}}
web2py_validate_entropy(jQuery('#no_table_new_password'),100);
{{pass}}
</script>
{{end page_js}}
The /views/auth/_login.html looks like this:
{{sidenav_enabled=True}}
{{menu_enabled=False}}
{{extend "layout.html"}}
{{include "angular_module.html"}}
{{include "../static/angular/controllers/AppCtrl.html"}}
{{include "../static/angular/controllers/LoginCtrl.html"}}
{{include "../static/angular/services/menu.service.html"}}
{{block content}}
<div>{{=form}}</div>
{{end}}
The others are controller and services. But this gives me GET
http://127.0.0.1:8000/favicon.ico 400 (BAD REQUEST) in the browser.
I tried different other combination for views but gives me error in login
while the index page is loaded ok.
Any thing that I am missing here? Any help is much appreciated.
Many Thanks,
Biplov
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.