Skip to content

Commit 56739a3

Browse files
committed
import notifications
1 parent 07043a4 commit 56739a3

File tree

9 files changed

+38
-23
lines changed

9 files changed

+38
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ To run the app, follow these steps.
5555
git branch -D gh-pages
5656
git checkout -b gh-pages
5757
gulp build
58-
jspm bundle 'config' + 'main' + 'util' + 'editing/*' + 'github/*' + 'import/*' + 'ui/*' + 'ui/embed/*' + 'worker/*' + 'ui/embed/*.html!text' + 'ui/*.html!text' + npm:[email protected] + npm:[email protected] + npm:[email protected] + npm:[email protected] + npm:[email protected] + npm:[email protected] + npm:[email protected] + split.js + text dist/bundle.js --inject
58+
jspm bundle 'config' + 'main' + 'util' + 'editing/*' + 'github/*' + 'import/*' + 'ui/*' + 'ui/embed/*' + 'worker/*' + 'ui/embed/*.html!text' + 'ui/*.html!text' + npm:[email protected] + npm:[email protected] + npm:[email protected] + npm:[email protected] + npm:[email protected] + npm:[email protected] + npm:[email protected] + alertify.js + split.js + text dist/bundle.js --inject
5959
git add dist/bundle.js -f
6060
git add jspm_packages/system.js -f
6161
git add jspm_packages/github/ajaxorg/[email protected] -f

config.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ System.config({
1616

1717
map: {
1818
"ace": "github:ajaxorg/[email protected]",
19+
"alertify.js": "npm:[email protected]",
1920
"aurelia-bootstrapper": "npm:[email protected]",
2021
"aurelia-event-aggregator": "npm:[email protected]",
2122
"aurelia-framework": "npm:[email protected]",
@@ -51,7 +52,7 @@ System.config({
5152
"core-js": "npm:[email protected]"
5253
},
5354
54-
"aurelia-event-aggregator": "npm:[email protected]",
55+
"aurelia-event-aggregator": "npm:[email protected].1.1",
5556
"aurelia-framework": "npm:[email protected]",
5657
"aurelia-history": "npm:[email protected]",
5758
"aurelia-history-browser": "npm:[email protected]",
@@ -72,9 +73,6 @@ System.config({
7273
"aurelia-pal": "npm:[email protected]",
7374
"core-js": "npm:[email protected]"
7475
},
75-
76-
"aurelia-logging": "npm:[email protected]"
77-
},
7876
7977
"aurelia-logging": "npm:[email protected]"
8078
},
@@ -122,7 +120,7 @@ System.config({
122120
},
123121
124122
"aurelia-dependency-injection": "npm:[email protected]",
125-
"aurelia-event-aggregator": "npm:[email protected]",
123+
"aurelia-event-aggregator": "npm:[email protected].1.1",
126124
"aurelia-history": "npm:[email protected]",
127125
"aurelia-logging": "npm:[email protected]",
128126
"aurelia-path": "npm:[email protected]",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"jspm": {
6060
"dependencies": {
6161
"ace": "github:ajaxorg/ace-builds@^1.2.2",
62+
"alertify.js": "npm:alertify.js@^1.0.9",
6263
"aurelia-bootstrapper": "npm:aurelia-bootstrapper@^1.0.0-beta.1",
6364
"aurelia-event-aggregator": "npm:aurelia-event-aggregator@^1.0.0-beta.1.1.1",
6465
"aurelia-framework": "npm:aurelia-framework@^1.0.0-beta.1",

src/github/gists.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ export class Gists {
2121
// todo: handle truncated files
2222
return response.json();
2323
}
24-
// todo: handle rate limit, etc
25-
throw new Error('unable to get gist');
24+
if (response.status === 404) {
25+
return Promise.reject('Gist not found.');
26+
}
27+
return Promise.reject('Error loading Gist.');
2628
});
2729
}
2830

src/import/jsfiddle.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ export class JSFiddleImporter {
3737

3838
import(urlOrId) {
3939
return fetch(`https://crossorigin.me/${urlOrId}`)
40-
.then(response => response.text())
40+
.then(response => {
41+
if (response.ok) {
42+
return response.text();
43+
}
44+
if (response.status === 404) {
45+
return Promise.reject('jsFiddle not found.');
46+
}
47+
return Promise.reject('Error loading jsFiddle.');
48+
})
4149
.then(page => this.fiddleHtmlToGist(page));
4250
}
4351
}

src/import/plunker.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ export class PlunkerImporter {
88
import(urlOrId) {
99
let plunkerID = urlRegex.exec(urlOrId)[1];
1010
return fetch(`https://api.plnkr.co/plunks/${plunkerID}`)
11-
.then(response => response.json())
11+
.then(response => {
12+
if (response.ok) {
13+
return response.json();
14+
}
15+
if (response.status === 404) {
16+
return Promise.reject('Plunk not found.');
17+
}
18+
return Promise.reject('Error loading plunk.');
19+
})
1220
.then(plunk => {
1321
let gist = { description: plunk.description, files: {} };
1422
for (let name in plunk.files) {

src/ui/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {QueryString} from '../editing/query-string';
55
import {defaultGist} from '../github/default-gist';
66
import {Importer} from '../import/importer';
77
import {Focus} from './focus';
8+
import alertify from 'alertify.js';
89

910
@inject(EditSessionFactory, Importer, QueryString, Focus)
1011
export class App {
@@ -58,6 +59,7 @@ export class App {
5859
this.queryString.write(gist, true);
5960
return this.editSessionFactory.create(gist);
6061
})
61-
.then(editSesson => this.setEditSession(editSesson));
62+
.then(editSesson => this.setEditSession(editSesson))
63+
.then(() => alertify.success('Import successful.'), reason => alertify.error(reason));
6264
}
6365
}

styles/app-styles.css

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,6 @@ result-panel iframe {
138138
border-color: #dad3a3;
139139
}
140140

141-
.btn-danger {
142-
color: #900;
143-
}
144-
145-
.btn-danger:hover {
146-
color: #fff;
147-
background-color: #b33630;
148-
background-image: -webkit-linear-gradient(#dc5f59, #b33630);
149-
background-image: linear-gradient(#dc5f59, #b33630);
150-
border-color: #cd504a;
151-
}
152-
153141
.btn-primary {
154142
color: #fff;
155143
text-shadow: 0 -1px 0 rgba(0,0,0,0.15);

styles/base-styles.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,11 @@ rate-alert {
4141
rate-alert > .flash {
4242
margin-bottom: 15px;
4343
}
44+
45+
.alertify-logs > .success {
46+
background-color: rgba(86, 158, 61, 0.8);
47+
}
48+
49+
.alertify-logs > .error {
50+
background-color: rgba(179, 54, 48, 0.8);
51+
}

0 commit comments

Comments
 (0)