Skip to content

Commit

Permalink
feat(demo): add button on home page to allow editing demo on `StackBl…
Browse files Browse the repository at this point in the history
…itz`
  • Loading branch information
tinesoft committed May 20, 2018
1 parent b81afd6 commit 8e19a53
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/templates/demo/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/router": "^6.0.0",
"@ng-bootstrap/ng-bootstrap": "2.0.0",
"@stackblitz/sdk":"^1.2.0",
"bootstrap": "4.0.0",
"core-js": "^2.5.4",
"font-awesome": "^4.7.0",
Expand Down
1 change: 1 addition & 0 deletions app/templates/demo/src/app/home/_home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ <h1><%= projectName %></h1>
<p class="buttons">
<a class="btn btn-outline-primary btn-lg" href="https://github.com/<%= githubUsername %>/<%= githubRepoName %>" target="_blank"><i class="fa fa-github fa-lg"></i> Code on Github</a><% if(useCompodoc){%>
<a class="btn btn-outline-primary btn-lg" href="doc/index.html" target="_blank"><i class="fa fa-book fa-lg"></i> Documentation</a><% } %>
<a class="btn btn-outline-primary btn-lg" href="#" (click)="editOnStackBlitz()"><i class="fa fa-bolt fa-lg"></i> Edit on StackBlitz</a>
</p>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions app/templates/demo/src/app/home/_home.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import sdk from '@stackblitz/sdk';

@Component({
selector: 'app-home',
Expand All @@ -14,4 +15,7 @@ export class HomeComponent implements OnInit {
this.titleService.setTitle('Home | <%= projectName %>');
}

editOnStackBlitz() {
sdk.openGithubProject('<%= githubUsername %>/<%= githubRepoName %>/tree/master/demo');
}
}

0 comments on commit 8e19a53

Please sign in to comment.