Mateusz Lewandowski
2016-06-11 16:13:40 UTC
Hi.
I have a polymer core-menu with core items.
I would like to define which options should be vissible depends on user
would by logged or not.
I think that it could be done by dynamic created CoreItems in dart like
CoreItem item=new CoreItem('core-item')
but i do not know how it could be added to core-menu defined in html,
Following is what i acctually have.
Please help and give me some advice.
dart:
@CustomTag('menu-element')
class Menu extends PolymerElement {
// Menu.created() : super.created();
@observable int isLogged;
Menu.created() : super.created()
{
if(window.localStorage['authentication'] !=null)
{
this.isLogged=1;
}
}
void SelectItem(event, detail, target)
{
if(detail['isSelected'])
{
var command=detail['item'].label;
print(detail['item'].label);
switch(command)
{
case 'Ogloszenia':
window.location.assign("index.html");
break;
case 'Logowanie':
window.location.assign("login.html");
break;
case 'Rejestracja':
window.location.assign("register.html");
break;
default:
print("Error");
}
}
}
}
html:
<polymer-element name="menu-element">
<template>
<core-menu on-core-select="{{SelectItem}}">
<core-item icon="dialog" label="Ogloszenia" id="advertisments"></core-item>
<core-item icon="settings" label="Logowanie" id="logon"></core-item>
<core-item icon="search" label="Rejestracja" id="register"></core-item>
<core-item label="Dodaj ogloszenie"></core-item>
</core-menu>
</template>
</polymer-element>
I have a polymer core-menu with core items.
I would like to define which options should be vissible depends on user
would by logged or not.
I think that it could be done by dynamic created CoreItems in dart like
CoreItem item=new CoreItem('core-item')
but i do not know how it could be added to core-menu defined in html,
Following is what i acctually have.
Please help and give me some advice.
dart:
@CustomTag('menu-element')
class Menu extends PolymerElement {
// Menu.created() : super.created();
@observable int isLogged;
Menu.created() : super.created()
{
if(window.localStorage['authentication'] !=null)
{
this.isLogged=1;
}
}
void SelectItem(event, detail, target)
{
if(detail['isSelected'])
{
var command=detail['item'].label;
print(detail['item'].label);
switch(command)
{
case 'Ogloszenia':
window.location.assign("index.html");
break;
case 'Logowanie':
window.location.assign("login.html");
break;
case 'Rejestracja':
window.location.assign("register.html");
break;
default:
print("Error");
}
}
}
}
html:
<polymer-element name="menu-element">
<template>
<core-menu on-core-select="{{SelectItem}}">
<core-item icon="dialog" label="Ogloszenia" id="advertisments"></core-item>
<core-item icon="settings" label="Logowanie" id="logon"></core-item>
<core-item icon="search" label="Rejestracja" id="register"></core-item>
<core-item label="Dodaj ogloszenie"></core-item>
</core-menu>
</template>
</polymer-element>
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.