Skip to content

Instantly share code, notes, and snippets.

@dmonad
Last active August 29, 2015 14:08
Show Gist options
  • Save dmonad/ec83d2ae0eff198c9f21 to your computer and use it in GitHub Desktop.
Save dmonad/ec83d2ae0eff198c9f21 to your computer and use it in GitHub Desktop.
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-pages/core-pages.html">
<link rel="import" href="../paper-input/paper-input.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
box-sizing: border-box;
}
#core_scaffold {
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
width: 100%;
height: 100%;
}
#core_header_panel {
background-color: rgb(255, 255, 255);
}
#core_toolbar {
color: rgb(255, 255, 255);
background-color: rgb(79, 125, 201);
}
#core_menu {
font-size: 16px;
}
#core_pages {
width: 100%;
height: 100%;
border: 1px solid silver;
left: 0px;
top: 0px;
position: absolute;
}
#paper_input {
left: 373px;
top: 95px;
position: absolute;
}
#top_bar {
width: 100%;
}
</style>
<core-scaffold id="core_scaffold">
<core-header-panel mode="seamed" id="core_header_panel" navigation flex>
<core-toolbar id="core_toolbar"></core-toolbar>
<core-menu selected="Configure" valueattr="label" selectedindex="0" id="core_menu" theme="core-light-theme">
<core-item id="item_configure" icon="settings" label="Connect" horizontal center layout active></core-item>
<core-item id="item_text_editing" icon="settings" label="Text Editing" horizontal center layout></core-item>
<core-item id="item_elements" icon="settings" label="Collaborative Elements" horizontal center layout></core-item>
<core-item id="item_role_sdk" icon="settings" label="Role SDK" horizontal center layout></core-item>
</core-menu>
</core-header-panel>
<div id="top_bar" horizontal layout justified tool>
<div id="div">{{ $.core_menu.selected }}</div>
<div>{{ user_id }}
</div>
</div>
<core-pages selected="{{ $.core_menu.selectedIndex }}" selectedindex="0" notap id="core_pages">
<section id="section_configure" active>
<h1> Connect to another peer </h1>
<paper-input label="Peer Id" willvalidate id="paper_input" on-change={{connectToPeer}}></paper-input>
<paper-toast id="toast_connected" text="You are now connected :)" onclick="discardDraft(el)"></paper-toast>
</section>
<section id="section_text_editing">Page Two</section>
<section id="section_elements">Page Two</section>
<section id="section_role-sdk">Page Two</section>
</core-pages>
</core-scaffold>
<yatta-element id="yatta" yatta user_id>
<yatta-attribute name="x" val></yatta-attribute>
<yatta-attribute name="slider" val></yatta-attribute>
<yatta-attribute name="input" val type="mutable" defaultval="Text"></yatta-attribute>
</yatta-element>
</template>
<script>
Polymer({
ready: function (){
this.slider = 300;
this.user_id = ""+Math.floor(Math.random()*1000);
},
yattaChanged: function (){
window.yatta = this.yatta;
},
connectToPeer: function (){
console.log("connecting");
this.$.yatta.connectToPeer(arguments[2].value);
this.$.toast_connected.show();
}
});
</script>
</polymer-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment