mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
comunication between components
This commit is contained in:
@@ -8,3 +8,11 @@ To install simply run:
|
||||
```
|
||||
bower install --save file-upload
|
||||
```
|
||||
|
||||
# publish-subscribe functionality
|
||||
Add the code below to the main index.html in order to publish an event when a file is uploaded. This event is used by the others components to refresh or make action.
|
||||
|
||||
<template is="dom-bind" id="alfresco-app">
|
||||
<iron-signals on-iron-signal-uploaded="uploadedSignal"></iron-signals>
|
||||
</template>
|
||||
```
|
@@ -17,7 +17,8 @@ Example:
|
||||
|
||||
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
|
||||
<link rel="import" href="../../bower_components/paper-progress/paper-progress.html">
|
||||
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../bower_components/iron-signals/iron-signals.html">
|
||||
|
||||
<dom-module id="file-upload">
|
||||
|
||||
@@ -37,6 +38,14 @@ Example:
|
||||
@apply(--file-upload-upload-border-hover);
|
||||
}
|
||||
|
||||
.file{
|
||||
width: 100%;
|
||||
}
|
||||
.name{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
#UploadBorder{
|
||||
vertical-align: middle;
|
||||
color: #555;
|
||||
@@ -494,6 +503,9 @@ Example:
|
||||
if (xhr.status === 200) {
|
||||
self.fire("success", {xhr: xhr});
|
||||
self.set(prefix + ".complete", true);
|
||||
if(document.querySelector("#alfresco-app")) {
|
||||
document.querySelector('#alfresco-app').fire('iron-signal', {name: "uploaded", data: "uploaded!"});
|
||||
}
|
||||
} else {
|
||||
self.set(prefix + ".error", true);
|
||||
self.set(prefix + ".complete", false);
|
||||
|
Reference in New Issue
Block a user