Merge pull request #1139 from chef/dr/tutorial-in-www

embed tutorial in website
This commit is contained in:
Christoph Hartmann 2016-09-23 16:42:19 +02:00 committed by GitHub
commit 195cf4a087
8 changed files with 36 additions and 9 deletions

View file

@ -19,21 +19,33 @@ require 'inquirer'
require_relative 'shared.rb' require_relative 'shared.rb'
namespace :www do namespace :www do
desc 'Builds the site locally' desc 'Builds the tutorial contents'
task :build do task :tutorial do
Log.section 'Build the online tutorial in www/tutorial/' Log.section 'Build the online tutorial in www/tutorial/'
system([ system([
'cd www/tutorial/', 'cd www/tutorial/',
'npm install', 'npm install',
'gulp build', 'gulp build',
].join(' && ')) ].join(' && '))
end
desc 'Builds the middleman site'
task :site do
Log.section 'Build middleman project in www/' Log.section 'Build middleman project in www/'
Bundler.with_clean_env { Bundler.with_clean_env {
system('cd www/ && bundle install && bundle exec middleman build') system('cd www/ && bundle install && bundle exec middleman build')
} }
end end
desc 'Assemble the website site from middleman and the tutorial'
task :assemble do
Log.section 'Copy only tutorial into middleman build directory'
system('rsync -a --exclude=index.html www/tutorial/dist/* www/build/')
end
desc 'Builds the full site locally'
task build: ['www:tutorial', 'www:site', 'www:assemble']
desc 'Releases the site to gh-pages' desc 'Releases the site to gh-pages'
task :release do task :release do
# This folder contains the built files # This folder contains the built files

View file

@ -6,7 +6,7 @@ nav#main-nav
ul.main-nav--links ul.main-nav--links
li.main-nav--link-ctas li.main-nav--link-ctas
a.button.transparent href="" Try the Demo a.button.transparent.try-demo href="#" Try the Demo
a.button.secondary href="" Download a.button.secondary href="" Download
li.main-nav--link li.main-nav--link
a href="/overview" a href="/overview"
@ -38,5 +38,5 @@ nav#main-nav
span.main-nav--link-text Contribute span.main-nav--link-text Contribute
nav#main-nav-ctas nav#main-nav-ctas
a.button.transparent href="" Try the Demo a.button.transparent.try-demo href="#" Try the Demo
a.button.secondary href="" Download a.button.secondary href="" Download

View file

@ -8,6 +8,7 @@ html
title = current_page.data.title || "InSpec" title = current_page.data.title || "InSpec"
link href='//fonts.googleapis.com/css?family=Lato:300,400' rel='stylesheet' type='text/css' link href='//fonts.googleapis.com/css?family=Lato:300,400' rel='stylesheet' type='text/css'
link rel='stylesheet' type='text/css' href='css/inspec_tutorial.css'
== stylesheet_link_tag :site == stylesheet_link_tag :site
@ -20,6 +21,19 @@ html
= partial "layouts/footer" = partial "layouts/footer"
script src='scripts/inspec_tutorial.js'
script src='dist/inspec_tutorial.js'
div inspec-tutorial="true" class="inspec-tutorial" hidden="true"
= "Loading"
== javascript_include_tag "all" == javascript_include_tag "all"
javascript: javascript:
$(document).foundation(); $(document).foundation();
$('.try-demo').click(function(event){
event.stopPropagation();
$('.inspec-tutorial').show()
$('.quit-inspec-tutorial').click(function(event){
event.stopPropagation();
$('.inspec-tutorial').hide()
})
});

View file

@ -1,7 +1,7 @@
.tutorial-nav { .tutorial-nav {
display: inline-block; display: inline-block;
position: fixed; position: fixed;
top: 10; top: 10px;
right: 0; right: 0;
width: 150px; width: 150px;
height: 60px; height: 60px;
@ -24,7 +24,7 @@ img {
width: 100px; width: 100px;
padding-bottom: 5px; padding-bottom: 5px;
position: fixed; position: fixed;
bottom: 10; bottom: 10px;
right: 30px; right: 30px;
z-index: 100; z-index: 100;
} }

View file

@ -2,7 +2,7 @@
<div class="tutorial-nav"> <div class="tutorial-nav">
<i (click)="updateInstructions('prev')" class="icon-angle-circled-left"></i> <i (click)="updateInstructions('prev')" class="icon-angle-circled-left"></i>
<i (click)="updateInstructions('next')" class="icon-angle-circled-right"></i> <i (click)="updateInstructions('next')" class="icon-angle-circled-right"></i>
<i class="icon-cancel-circled"></i> <i class="icon-cancel-circled quit-inspec-tutorial"></i>
</div> </div>
<div class="tutorial-wrapper"> <div class="tutorial-wrapper">

View file

@ -9,7 +9,7 @@ const SH_PROMPT = '$ ';
const INSPEC_PROMPT = 'inspec> '; const INSPEC_PROMPT = 'inspec> ';
@Component({ @Component({
selector: 'my-app', selector: '[inspec-tutorial]',
templateUrl: 'app/app.component.html', templateUrl: 'app/app.component.html',
styleUrls: ['app/app.component.css'], styleUrls: ['app/app.component.css'],
providers: [ HTTP_PROVIDERS ], providers: [ HTTP_PROVIDERS ],

View file

@ -24,6 +24,6 @@
<script src="dist/inspec_tutorial.js"></script> <script src="dist/inspec_tutorial.js"></script>
<my-app class="inspec-tutorial">Loading...</my-app> <div inspec-tutorial class="inspec-tutorial">Loading...</div>
</body> </body>
</html> </html>

View file

@ -8,4 +8,5 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
z-index: 100;
} }