Skip to content

Instantly share code, notes, and snippets.

@nelsonsilva
Created July 21, 2014 16:55
Show Gist options
  • Select an option

  • Save nelsonsilva/35a0cc9031d0397d74b8 to your computer and use it in GitHub Desktop.

Select an option

Save nelsonsilva/35a0cc9031d0397d74b8 to your computer and use it in GitHub Desktop.
designer
<link rel="import" href="../nuxeo-elements/nx-connection.html">
<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-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../nuxeo-elements/nx-resource.html">
<link rel="import" href="../paper-button/paper-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
box-sizing: border-box;
}
#nx_connection {
left: 610px;
top: 180px;
position: absolute;
}
</style>
<nx-connection id="nx_connection"></nx-connection>
<core-scaffold>
<core-header-panel mode="seamed" navigation flex>
<core-toolbar></core-toolbar>
<core-menu>
<core-item label="Users" icon="account-box" horizontal center layout>
<a href="#/user"></a>
</core-item>
<core-item label="Groups" icon="account-circle" horizontal center layout>
<a href="#/group"></a>
</core-item>
</core-menu>
</core-header-panel>
<div tool>{{ resourcePath }}</div>
<div tool class="search">
<core-field center horizontal layout>
<core-icon icon="search"></core-icon>
<core-input placeholder="Search..." inputvalue="*" value="{{ filter }}"></core-input>
</core-field>
</div>
<div class="container" layout vertical>
<nx-resource path="/search" params='{"q": "*"}' auto id="search"></nx-resource>
<nx-resource path="/" id="resource"></nx-resource>
<core-list id="list" data on-core-activate="{{ edit }}">
<template></template>
</core-list>
</div>
</core-scaffold>
<paper-dialog id="form" transition="paper-dialog-transition-center">
<template if="{{$.resource.type == 'user'}}"></template>
<template if="{{$.resource.type == 'group'}}"></template>
<paper-button label="Cancel" affirmative></paper-button>
<paper-button label="Save" affirmative default on-click="{{ save }}"></paper-button>
</paper-dialog>
</template>
<script>
Polymer('my-element', {
filter: '*',
edit: function(e, detail) {
this.$.resource.data = detail.data;
// TODO(nfgs): update type when data is set
this.$.resource.type = detail.data['entity-type'];
this.$.form.setAttribute("heading", "Edit " + ((this.$.resource.type == 'user') ? this.$.resource.data.id : this.$.resource.data.groupname));
this.$.form.toggle();
}
});
</script>
</polymer-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment