Skip to content

Commit

Permalink
docs: get latest release information from github
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Oct 3, 2017
1 parent d17c1dd commit b2ddf54
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
Install via Package managers such as [npm][npm] or [yarn][yarn]

```bash
npm install ngx-editor@1.0.0-beta.3 --save
npm install ngx-editor --save
# or
yarn add ngx-editor@1.0.0-beta.3
yarn add ngx-editor
```

### Usage
Expand Down
4 changes: 2 additions & 2 deletions docs/3rdpartylicenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ THE SOFTWARE.
MIT
MIT

@angular/platform-browser@4.4.4
@angular/common@4.4.4
MIT
MIT

@angular/common@4.4.4
@angular/platform-browser@4.4.4
MIT
MIT
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>NgxEditor</title><base href="ngx-editor"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"><link href="styles.f6a07fb204943f53af55.bundle.css" rel="stylesheet"/></head><body><app-root></app-root><script async defer="defer" src="https://buttons.github.io/buttons.js"></script><script type="text/javascript" src="inline.7eef625e0f903a1a7c53.bundle.js"></script><script type="text/javascript" src="polyfills.8eba0ab53b5457105d75.bundle.js"></script><script type="text/javascript" src="vendor.dd8fdb61ced359145657.bundle.js"></script><script type="text/javascript" src="main.8baad82eb9253e961f35.bundle.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>NgxEditor</title><base href="ngx-editor"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"><link href="styles.f6a07fb204943f53af55.bundle.css" rel="stylesheet"/></head><body><app-root></app-root><script async defer="defer" src="https://buttons.github.io/buttons.js"></script><script type="text/javascript" src="inline.bb74abda4bb5e241dfea.bundle.js"></script><script type="text/javascript" src="polyfills.8eba0ab53b5457105d75.bundle.js"></script><script type="text/javascript" src="vendor.0aaa6fe23ea3764cdb3e.bundle.js"></script><script type="text/javascript" src="main.8cb86c4fbf8e5523fd7d.bundle.js"></script></body></html>
1 change: 0 additions & 1 deletion docs/inline.7eef625e0f903a1a7c53.bundle.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/inline.bb74abda4bb5e241dfea.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/main.8baad82eb9253e961f35.bundle.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/main.8cb86c4fbf8e5523fd7d.bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/vendor.0aaa6fe23ea3764cdb3e.bundle.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/vendor.dd8fdb61ced359145657.bundle.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="logo">
<img src="assets/icons/ngx-editor.svg" alt="ngx-Editor">
<h6>WYSIWYG Editor for Angular Applications.</h6>
<p>(v1.0.0-beta.3)</p>
<p>({{latestRelease['name']}})</p>
<a class="github-button" href="https://github.com/Sibiraj-S" aria-label="Follow @Sibiraj-S on GitHub">Follow @Sibiraj-S</a>
<a class="github-button" href="https://github.com/Sibiraj-S/ngx-editor/fork" aria-label="Fork Sibiraj-S/ngx-editor on GitHub">Fork</a>
<a class="github-button" href="https://github.com/Sibiraj-S/ngx-editor" aria-label="Star Sibiraj-S/ngx-editor on GitHub">Star</a>
Expand Down
3 changes: 2 additions & 1 deletion src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { NgxEditorModule } from './ngx-editor/ngx-editor.module';
import { HttpClientModule } from '@angular/common/http';

describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [NgxEditorModule],
imports: [NgxEditorModule, HttpClientModule],
declarations: [
AppComponent
],
Expand Down
24 changes: 21 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { AppService } from './app.service';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
styleUrls: ['./app.component.scss'],
providers: [AppService]
})

export class AppComponent {
export class AppComponent implements OnInit {
title = 'ngx-editor';
latestRelease: any = {};

editorConfig = {
editable: true,
Expand All @@ -18,4 +21,19 @@ export class AppComponent {

htmlContent = '<span>WYSIWYG Editor for Angular Applications.</span>';

constructor(private _appService: AppService) { }

getLatestRelease() {
this._appService.getLatestRelease().subscribe(
data => this.latestRelease = data,
error => { console.log(error); },
() => {
// console.log('latest release: ' + this.latestRelease['name']);
});
}

ngOnInit() {
this.getLatestRelease();
}

}
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';

import { AppComponent } from './app.component';

Expand All @@ -11,7 +12,8 @@ import { NgxEditorModule } from './ngx-editor/ngx-editor.module';
],
imports: [
BrowserModule,
NgxEditorModule
NgxEditorModule,
HttpClientModule
],
providers: [],
bootstrap: [AppComponent]
Expand Down
17 changes: 17 additions & 0 deletions src/app/app.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { TestBed, inject } from '@angular/core/testing';
import { HttpClientModule } from '@angular/common/http';

import { AppService } from './app.service';

describe('AppService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientModule],
providers: [AppService]
});
});

it('should be created', inject([AppService], (service: AppService) => {
expect(service).toBeTruthy();
}));
});
26 changes: 26 additions & 0 deletions src/app/app.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Response } from '@angular/http';
import 'rxjs/add/operator/map';

@Injectable()
export class AppService {

private releaseURL = 'https://api.github.com/repos/Sibiraj-S/ngx-editor/releases';

constructor(private _http: HttpClient) { }

getLatestRelease() {

return this._http.get(this.releaseURL)
.map((response) => {
if (response && response['length'] !== 0) {
return response[0];
} else {
return [];
}
});
}


}

0 comments on commit b2ddf54

Please sign in to comment.