Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
feat(serve): add windows to lab view for v2 projects
Browse files Browse the repository at this point in the history
  • Loading branch information
tlancina committed Apr 20, 2016
1 parent 25fdea7 commit 87c5ff9
Show file tree
Hide file tree
Showing 2 changed files with 206 additions and 1 deletion.
203 changes: 203 additions & 0 deletions lib/assets/v2preview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
<!doctype html>
<html ng-app="app">
<head>
<meta charset="utf-8">
<title ng-bind="title"></title>
<style>
body {
background-color: #EFF1F5;
font-family: 'Helvetica Neue', 'Helvetica', Arial, sans-serif;
padding: 0;
margin: 0;
-webkit-font-smoothing: antialiased;
}
preview {
display: block;
max-width: 1245px;
margin: 0 auto 0 auto;
overflow: auto;
}
h2 {
color: #fff;
font-weight: 200;
letter-spacing: 1px;
}
#header-left {
position: absolute;
top: 20px;
left: 20px;
line-height: 40px;
}
#header-left span {
margin-left: 10px;
vertical-align: middle;
display: inline-block;
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
color: #6F7582;
font-size: 16px;
}
#header {
}
#header #left {
position: absolute;
left: 20px;
top: 20px;
}
#header {
position: fixed;
top: 30px;
right: 20px;
}
#header a {
color: #fff;
display: inline-block;
margin: 0px 9px;
opacity: 0.4;
font-size: 90%;
letter-spacing: 1px;
text-decoration: none;
}
#header a:hover {
opacity: 1;
}
h2 a {
font-size: 18px;
color: #6F7582;
text-decoration: none;
}
.phone {
float: left;
margin: 40px 20px 0 20px;
}
.frame {
border: none;
border-radius: 3px;
box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.3);
}
#iphone-frame {
top: 109px;
left: 25px;
width: 375px;
height: 667px;
}
#android-frame {
top: 88px;
left: 24px;
width: 375px;
height: 667px;
}
#windows-frame {
top: 88px;
left: 24px;
width: 375px;
height: 667px;
}
#iphone {
}
#android {
}
#logo {
display: inline-block;
width: 48px;
height: 48px;
vertical-align: middle;
background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njXDB7jbedDnWOfy9gbUwxr9vwl1lVAdlrECZtymd/Anq2CWRe5aKnAmfQeYRtauJz8Rd4+MccBflrzD92gScSB8J8Vv6QX6IOw8vhu/ZBJGZVuimNRLcuxj+8mQT0hLeSBb+GYH9FHw/GKlhryY6Cl+Z50teNafxp+Ct8APMBNL9ZwQVCYfwF4O4ueYM+2cEOgQ1zZTnSif77zBYDmAQKIJ/XAjDd7UJf4mar/xfgAEATgzpl/hT4g0AAAAASUVORK5CYII=');
background-repeat: no-repeat;
width: 40px;
height: 40px;
background-size: 100%;
}
#logo:hover {
opacity: 1;
}
#logo img {
max-width: 100%;
}
</style>

<!-- quick and dirty templating, don't touch this -->
<script>
//INSERT_JSON_HERE;
</script>

<script src="angular.min.js"></script>
<script>
angular.module('app', [])
.directive('preview', function() {
return {
restrict: 'E',
scope: true,
link: function($scope, $element, $attr) {
$scope.screenSizes = [
{ label: 'iPhone 5 (320x568)', size: '320x568' }
];
$scope.screenSize = $scope.screenSizes[0];
}
}
})
.run(['$rootScope', function($rootScope) {
$rootScope.appName = BOOTSTRAP && BOOTSTRAP.appName || null;
$rootScope.title = $rootScope.appName && $rootScope.appName + ' - Ionic App' || 'Ionic App';
}]);
</script>

</head>
<body>
<div id="header-left">
<a target="_blank" href="http://ionicframework.com/" id="logo">
</a>
<span ng-bind="appName"></span>
</div>
<!--
<header id="header">
<a target="_blank" href="http://ionicframework.com/docs/components/">CSS</a>
<a target="_blank" href="http://ionicframework.com/docs/api/">API</a>
<a target="_blank" href="http://forum.ionicframework.com/">Forum</a>
<a target="_blank" href="http://ngcordova.com/">ngCordova</a>
<a target="_blank" href="https://github.com/driftyco/ionic">GitHub</a>
</header>
-->
<preview>
<!--
<div id="choice">
<select ng-model="screenSize" ng-options="s.label for s in screenSizes"></select>
</div>
-->
<div class="phone">
<div id="iphone">
<h2><a href="/?ionicplatform=ios" target="_blank">iOS</a></h2>
<iframe id="iphone-frame" src="/?ionicplatform=ios" class="frame"></iframe>
</div>
</div>
<div class="phone">
<div id="android">
<h2><a href="/?ionicplatform=android" target="_blank">Android</a></h2>
<iframe id="android-frame" src="/?ionicplatform=android" class="frame"></iframe>
</div>
</div>
<div class="phone">
<div id="windows">
<h2><a href="/?ionicplatform=windows" target="_blank">Windows</a></h2>
<iframe id="windows-frame" src="/?ionicplatform=windows" class="frame"></iframe>
</div>
</div>
</preview>
<!--
<a href="http://ionicframework.com/" id="logo">
<img src="http://docs.ionic.io/img/ionic-logo.png">
</a>
-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-44023830-9', {
'cookieDomain': 'none'
})
ga('send', 'pageview');
</script>
</body>
</html>
4 changes: 3 additions & 1 deletion lib/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ Serve.loadSettings = function loadSettings(argv, project) {
options.livereloadOptions = {
livereload: path.resolve(__dirname + '/assets/livereload.js')
}
options.v2 = true;
}

return options;
Expand Down Expand Up @@ -377,9 +378,10 @@ Serve.startServer = function startServer(options, app) {
}

if(req.url === IONIC_LAB_URL) {
var previewTemplate = options.v2 ? 'v2preview.html' : 'preview.html';
// Serve the lab page with the given object with template data
var labServeFn = function(context) {
fs.readFile(path.resolve(path.join(__dirname, 'assets/preview.html')), function(err, buf) {
fs.readFile(path.resolve(path.join(__dirname, 'assets/' + previewTemplate)), function(err, buf) {
var html;
if(err) {
res.end('404');
Expand Down

0 comments on commit 87c5ff9

Please sign in to comment.