Skip to content

Commit

Permalink
Merge pull request #230 from vaadin/fix-P1-deps
Browse files Browse the repository at this point in the history
Fix Polymer 1.x dependencies. Downgrade demos to ES5 syntax
  • Loading branch information
manolo authored Nov 13, 2017
2 parents 4bb3955 + 6b2ddc7 commit 80480fc
Show file tree
Hide file tree
Showing 7 changed files with 2,344 additions and 2,336 deletions.
10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sudo: true
sudo: false
dist: trusty
language: node_js
node_js: 8.0
Expand All @@ -11,15 +11,9 @@ addons:
firefox: latest
google-chrome: latest

# Temporary fix, currently there are some weird timeout issues in Travis with Chrome 59
# TODO @limonte revisit after Chrome 60 release
before_install:
- wget http://mirror.glendaleacademy.org/chrome/pool/main/g/google-chrome-stable/google-chrome-stable_58.0.3029.110-1_amd64.deb
- sudo dpkg -i google-chrome*.deb

install:
- npm install
- polymer install
- bower install

before_script:
- gulp lint
Expand Down
4 changes: 1 addition & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@
"paper-icon-button": "PolymerElements/paper-icon-button#1 - 2",
"paper-progress": "PolymerElements/paper-progress#1 - 2",
"paper-ripple": "PolymerElements/paper-ripple#1 - 2",
"paper-styles": "PolymerElements/paper-styles#1 - 2",
"vaadin-themable-mixin": "^1.1.0"
"paper-styles": "PolymerElements/paper-styles#1 - 2"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#1 - 2",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^2.0.0",
"iron-test-helpers": "PolymerElements/iron-test-helpers#1 - 2",
"mock-http-request": "abuinitski/MockHttpRequest#npm_fix",
"paper-toast": "PolymerElements/paper-toast#1 - 2",
"test-fixture": "PolymerElements/test-fixture#^3.0.0",
"web-component-tester": "Polymer/web-component-tester#^6.1.5",
"webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0",
Expand Down
1 change: 0 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<link rel="import" href="../../paper-styles/default-theme.html">
<script src="../../mock-http-request/lib/mock.js"></script>
<link rel="import" href="../vaadin-upload.html">
<link rel="import" href="../../paper-toast/paper-toast.html">

<vaadin-component-demo config-src="demos.json"></vaadin-component-demo>
</body>
Expand Down
49 changes: 14 additions & 35 deletions demo/upload-advanced-demos.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ <h3>Customizing the Upload Request</h3>

<script>
window.addDemoReadyListener('#upload-advanced-demos-customizing-the-upload-request', function(document) {
var upload1 = document.querySelector('vaadin-upload#requestDemo');
var upload = document.querySelector('vaadin-upload#requestDemo');

upload1.addEventListener('upload-before', function(event) {
upload.addEventListener('upload-before', function(event) {
console.log('upload xhr before open: ', event.detail.xhr);

// Prevent the upload request:
Expand All @@ -50,20 +50,20 @@ <h3>Customizing the Upload Request</h3>
var file = event.detail.file;

// Custom upload request url for file
file.uploadTarget = upload1.target + '/' + file.name;
file.uploadTarget = upload.target + '/' + file.name;

// Custom name in the Content-Disposition header
file.formDataName = 'attachment';
});

upload1.addEventListener('upload-request', function(event) {
upload.addEventListener('upload-request', function(event) {
console.log('upload xhr after open: ', event.detail.xhr);

event.detail.xhr.setRequestHeader('X-File-Name', event.detail.file.name);
event.detail.formData.append('documentId', 1234);
});

upload1.addEventListener('upload-start', function(event) {
upload.addEventListener('upload-start', function(event) {
console.log('upload xhr after send: ', event.detail.xhr);
});
});
Expand All @@ -79,9 +79,9 @@ <h3>Sending Files Without Wrapping in FormData</h3>

<script>
window.addDemoReadyListener('#upload-advanced-demos-sending-files-without-wrapping-in-formdata', function(document) {
var upload2 = document.querySelector('vaadin-upload#rawDemo');
var upload = document.querySelector('vaadin-upload#rawDemo');

upload2.addEventListener('upload-request', function(event) {
upload.addEventListener('upload-request', function(event) {
event.preventDefault();
event.detail.xhr.send(event.detail.file);
});
Expand All @@ -98,9 +98,9 @@ <h3>Custom Reaction on Server Response</h3>

<script>
window.addDemoReadyListener('#upload-advanced-demos-custom-reaction-on-server-response', function(document) {
var upload3 = document.querySelector('vaadin-upload#responseDemo');
var upload = document.querySelector('vaadin-upload#responseDemo');

upload3.addEventListener('upload-response', function(event) {
upload.addEventListener('upload-response', function(event) {
console.log('upload xhr after server response: ', event.detail.xhr);
event.detail.file.error = 'Custom server error message.';

Expand Down Expand Up @@ -137,32 +137,11 @@ <h3>Pre-Filling the File List in Advance</h3>
<h3>Custom Upload Button</h3>
<vaadin-demo-snippet id='upload-advanced-demos-custom-upload-button'>
<template preserve-content>
<button-events-demo></button-events-demo>

<dom-module id="button-events-demo">
<template preserve-content>
<style>
vaadin-upload {
--vaadin-upload-buttons-primary: {
align-items: center;
};
}
</style>
<vaadin-upload id="upload" max-files="1" max-files-reached="{{maxFilesReached}}">
<button slot="add-button" disabled$="[[maxFilesReached]]">
UPLOAD
</button>
</vaadin-upload>
</template>
<script>
Polymer({
is: 'button-events-demo',
properties: {
maxFilesReached: Boolean
}
});
</script>
</dom-module>
<vaadin-upload id="upload">
<button slot="add-button">
UPLOAD BUTTON
</button>
</vaadin-upload>
</template>
</vaadin-demo-snippet>

Expand Down
6 changes: 1 addition & 5 deletions demo/upload-basic-demos.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,12 @@ <h3>Setting Restrictions on Files to Upload</h3>
<span slot="drop-label">Up to 3 PDF files, 1 MB each</span>
</vaadin-upload>

<paper-toast id="rejectToast"></paper-toast>

<script>
window.addDemoReadyListener('#upload-basic-demos-setting-restrictions-on-files-to-upload', function(document) {
var upload = document.querySelector('vaadin-upload#rejectEventDemo');
var toast = document.querySelector('paper-toast#rejectToast');

upload.addEventListener('file-reject', function(event) {
toast.text = event.detail.file.name + ' error: ' + event.detail.error;
toast.open();
window.alert(event.detail.file.name + ' error: ' + event.detail.error);
});
});
</script>
Expand Down
Loading

0 comments on commit 80480fc

Please sign in to comment.