Skip to content

Commit

Permalink
NXP-23101: upgrade to Polymer 2.0 legacy API
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonsilva authored and Gabez0r committed Nov 8, 2017
1 parent 8da2f63 commit 83cf745
Show file tree
Hide file tree
Showing 85 changed files with 938 additions and 770 deletions.
43 changes: 30 additions & 13 deletions bower.json
Expand Up @@ -2,23 +2,40 @@
"name": "nuxeo-web-ui",
"private": true,
"dependencies": {
"alloyeditor": "0.7.5",
"iron-elements": "PolymerElements/iron-elements#^1.0.0",
"alloyeditor": "1.4.1",
"jsPlumb": "2.0.4",
"marked-element": "PolymerElements/marked-element#1.1.1",
"marked-element": "PolymerElements/marked-element#^2.0.0",
"moment": "2.10.6",
"nuxeo-elements": "nuxeo/nuxeo-elements#master",
"nuxeo-ui-elements": "nuxeo/nuxeo-ui-elements#master",
"nuxeo-dataviz-elements": "nuxeo/nuxeo-dataviz-elements#master",
"page": "nuxeo/page.js#1.6.6",
"paper-elements": "PolymerElements/paper-elements#^1.0.1",
"polymer": "Polymer/polymer#1.10.1",
"chart-elements": "nuxeo/chart-elements#3.1.0",
"Chart.js": "2.1.6",
"iron-form": "PolymerElements/iron-form#1.1.4",
"iron-list": "PolymerElements/iron-list#1.3.9"
"polymer": "polymer/polymer#^2.0.0",
"chart-elements": "nuxeo/chart-elements#polymer-2",
"nuxeo-elements": "nuxeo/nuxeo-elements#polymer-2",
"nuxeo-ui-elements": "nuxeo/nuxeo-ui-elements#polymer-2",
"nuxeo-dataviz-elements": "nuxeo/nuxeo-dataviz-elements#polymer-2",
"iron-a11y-keys": "PolymerElements/iron-a11y-keys#^2.0.0",
"iron-icons": "PolymerElements/iron-icons#^2.0.0",
"iron-jsonp-library": "PolymerElements/iron-jsonp-library#^2.0.0",
"iron-label": "PolymerElements/iron-label#^2.0.0",
"iron-localstorage": "PolymerElements/iron-localstorage#^2.0.0",
"iron-location": "PolymerElements/iron-location#^2.0.0",
"iron-media-query": "PolymerElements/iron-media-query#^2.0.0",
"iron-pages": "PolymerElements/iron-pages#^2.0.0",
"paper-drawer-panel": "PolymerElements/paper-drawer-panel#^2.0.0",
"paper-header-panel": "PolymerElements/paper-header-panel#^2.0.0",
"paper-listbox": "PolymerElements/paper-listbox#^2.0.0",
"paper-radio-group": "PolymerElements/paper-radio-group#^2.0.0",
"paper-slider": "PolymerElements/paper-slider#^2.0.0",
"paper-fab": "PolymerElements/paper-fab#^2.0.0",
"paper-tabs": "PolymerElements/paper-tabs#^2.0.0",
"paper-badge": "PolymerElements/paper-badge#^2.0.0",
"paper-toolbar": "PolymerElements/paper-toolbar#^2.0.0",
"paper-radio-button": "PolymerElements/paper-radio-button#^2.0.0",
"app-layout": "PolymerElements/app-layout#^2.0.0",
"paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^2.0.0",
"iron-validator-behavior": "PolymerElements/iron-validator-behavior#^2.0.0"
},
"devDependencies": {
"web-component-tester": "^4.0.0"
"web-component-tester": "^6.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0"
}
}
29 changes: 15 additions & 14 deletions elements/directory/nuxeo-vocabulary-management.html
Expand Up @@ -16,6 +16,7 @@
-->

<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../bower_components/nuxeo-elements/nuxeo-resource.html">
<link rel="import" href="../../bower_components/nuxeo-ui-elements/nuxeo-layout.html">
<link rel="import" href="../../bower_components/nuxeo-ui-elements/widgets/nuxeo-select.html">
Expand Down Expand Up @@ -46,47 +47,47 @@
}

.top.actions {
@apply(--layout-horizontal);
@apply(--layout-center);
@apply(--layout-end-justified);
@apply --layout-horizontal;
@apply --layout-center;
@apply --layout-end-justified;
margin: 1em 0 1em 0;
}

nuxeo-select {
max-width: 223px;
}

::content paper-dialog {
paper-dialog {
min-width: 480px;
}

@media (max-width: 1024px) {
::content paper-dialog {
paper-dialog {
min-width: 0;
width: 90%;
}
}

::content paper-dialog ::content .buttons {
@apply(--layout-horizontal);
@apply(--layout-justified);
paper-dialog .buttons {
@apply --layout-horizontal;
@apply --layout-justified;
margin-top: 16px;
background-color: var(--nuxeo-dialog-buttons-bar, white);
}

::content label {
@apply(--nuxeo-label);
label {
@apply --nuxeo-label;
}
</style>

<nuxeo-resource id="directory" path="/directory"></nuxeo-resource>

<nuxeo-page>
<div class="header layout horizontal">
<div slot="header">
<span>[[i18n('vocabularyManagement.heading')]]</span>
</div>

<div class="content">
<div>
<paper-card elevation="0" class="block">
<nuxeo-select label="[[i18n('vocabularyManagement.vocabulary')]]"
placeholder="[[i18n('vocabularyManagement.select')]]"
Expand Down Expand Up @@ -290,7 +291,7 @@ <h2>[[i18n('vocabularyManagement.popup.editEntry')]]</h2>

_deleteEntry: function(e) {
if (confirm(this.i18n('vocabularyManagement.confirmDelete'))) {
var item = e.model.dataHost.parentNode.item;
var item = e.target.parentNode.item;
this.$.directory.path = '/directory/' + item.directoryName + '/' + item.properties.id;
this.$.directory.remove().then(function() {
this._refresh();
Expand All @@ -309,7 +310,7 @@ <h2>[[i18n('vocabularyManagement.popup.editEntry')]]</h2>

_editEntry: function(e) {
this._new = false;
this._selectedEntry = e.model.dataHost.parentNode.item;
this._selectedEntry = e.target.parentNode.item;
this.$.dialog.toggle();
},

Expand Down
Expand Up @@ -46,7 +46,7 @@
empty-label="[[i18n('collections.noDocument')]]"
empty-label-when-filtered="[[i18n('collections.noDocumentWhenFiltered')]]"
hide-content-view-actions>
<div class="selectionActions">
<div slot="selectionActions">
<nuxeo-slot slot="COLLECTION_ACTIONS" model="[[actionContext]]"></nuxeo-slot>
</div>
</nuxeo-default-results>
Expand Down
Expand Up @@ -46,7 +46,7 @@
empty-label="[[i18n('collections.noDocument')]]"
empty-label-when-filtered="[[i18n('collections.noDocumentWhenFiltered')]]"
hide-content-view-actions>
<div class="selectionActions">
<div slot="selectionActions">
<nuxeo-slot slot="COLLECTION_ACTIONS" model="[[actionContext]]"></nuxeo-slot>
</div>
</nuxeo-default-results>
Expand Down
2 changes: 1 addition & 1 deletion elements/document/file/nuxeo-file-metadata-layout.html
Expand Up @@ -22,8 +22,8 @@
-->

<dom-module id="nuxeo-file-metadata-layout">

<template>
<style include="nuxeo-styles"></style>
<div role="widget">
<label>[[i18n('label.dublincore.title')]]</label>
<div name="title">[[document.properties.dc:title]]</div>
Expand Down
5 changes: 5 additions & 0 deletions elements/document/file/nuxeo-file-view-layout.html
Expand Up @@ -23,6 +23,11 @@
<dom-module id="nuxeo-file-view-layout">

<template>
<style>
nuxeo-document-viewer, nuxeo-document-attachments {
@apply --paper-card;
}
</style>
<nuxeo-document-viewer role="widget" document="[[document]]"></nuxeo-document-viewer>
</template>

Expand Down
9 changes: 8 additions & 1 deletion elements/document/note/nuxeo-note-create-layout.html
Expand Up @@ -83,7 +83,10 @@
/**
* @doctype Note
*/
document: Object,
document: {
type: Object,
observer: '_documentChanged'
},
formats: Array
},

Expand All @@ -94,6 +97,10 @@
{id: 'text/xml', label: this.formatMimeType('text/xml')},
{id: 'text/x-web-markdown', label: this.formatMimeType('text/x-web-markdown')}
]
},

_documentChanged: function() {
this.document.properties['dc:title'] = 'Default title';
}
});
</script>
Expand Down
53 changes: 30 additions & 23 deletions elements/document/nuxeo-document-create.html
Expand Up @@ -16,7 +16,8 @@
-->

<link rel="import" href="../../bower_components/polymer/polymer.html">

<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../../bower_components/iron-resizable-behavior/iron-resizable-behavior.html">
<link rel="import" href="../../bower_components/iron-pages/iron-pages.html">
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
Expand All @@ -37,11 +38,11 @@
<dom-module id="nuxeo-document-create">

<template>
<style>
<style include="iron-flex iron-flex-alignment">
:host {
display: block;
@apply(--layout-flex);
@apply(--layout-vertical);
@apply --layout-flex;
@apply --layout-vertical;
}

nuxeo-path-suggestion {
Expand Down Expand Up @@ -121,15 +122,15 @@
}

.buttons {
@apply(--buttons-bar);
@apply --buttons-bar;
}

::content label {
@apply(--nuxeo-label);
label {
@apply --nuxeo-label;
padding-top: 8px;
}

::content paper-dropdown-menu {
paper-dropdown-menu {
width: 100%;
}

Expand All @@ -145,8 +146,8 @@
margin: 1rem 0;
}

::content *[role=widget] {
@apply(--layout-vertical);
*[role=widget] {
@apply --layout-vertical;
box-sizing: border-box;
margin-bottom: .5rem;
}
Expand All @@ -155,6 +156,15 @@
margin-right: 8px;
}

.vertical {
@apply --layout-flex;
@apply --layout-vertical;
}

iron-pages {
@apply --layout-flex;
@apply --layout-vertical;
}
</style>

<nuxeo-document id="docRequest"
Expand All @@ -164,10 +174,10 @@
enrichers="permissions, subtypes"
response="{{createResponse}}"></nuxeo-document>

<iron-pages selected="[[stage]]" attr-for-selected="name" class="vertical layout flex">
<iron-pages selected="[[stage]]" attr-for-selected="name">

<!--Stage: allow user to choose a doc type-->
<div name="choose" class="vertical layout flex">
<div name="choose" class="vertical">
<div class="editor flex container">
<div class="suggester">
<nuxeo-path-suggestion id="pathSuggesterChoose" value="{{targetPath}}"
Expand Down Expand Up @@ -214,10 +224,12 @@
always-float-label></nuxeo-path-suggestion>
<span class$="horizontal layout [[_formatErrorMessage(errorMessage)]]">&#8203;[[errorMessage]]</span>
</div>
<form is="iron-form" id="form" class="form vertical layout flex">
<iron-a11y-keys keys="enter" on-keys-pressed="_submitKeyHandler"></iron-a11y-keys>
<nuxeo-document-layout id="document-create" layout="create" document="[[document]]"></nuxeo-document-layout>
</form>
<iron-form id="form">
<form class="form vertical layout flex">
<iron-a11y-keys keys="enter" on-keys-pressed="_submitKeyHandler"></iron-a11y-keys>
<nuxeo-document-layout id="document-create" layout="create" document="[[document]]"></nuxeo-document-layout>
</form>
</iron-form>
</div>
<div class="buttons horizontal end-justified layout">
<div class="flex start-justified">
Expand Down Expand Up @@ -309,14 +321,9 @@
// run our custom validation function first to allow setting custom native validity
var valid = this.$['document-create'].validate();

// fake submit to trigger native validation checks and UI
if (valid) {
this.$.form._doFakeSubmitForValidation();
}

// XXX: could rely on onsubmit to avoid rechecking for validity
return this.$.form.validate() && this.$.form.checkValidity() &&
valid && this._isValidType(this.selectedDocType);
return this.$.form.validate() && valid
&& this._isValidType(this.selectedDocType);
},

_create: function() {
Expand Down

0 comments on commit 83cf745

Please sign in to comment.