Browse Source

First commit

A working prototype with a bit more to be ALPHA
master
sipp11 10 years ago
commit
c3c7725367
  1. 2
      .gitignore
  2. 21
      README.md
  3. 20
      bower.json
  4. 732
      css/bootstrap-combined.no-icons.min.css
  5. 406
      css/normalize.css
  6. 8
      css/style.css
  7. 114
      index.html
  8. 68
      js/app.js
  9. 48219
      js/libs/ember-1.7.0.js
  10. 2595
      js/libs/handlebars-1.1.2.js
  11. 9789
      js/libs/jquery-1.10.2.js
  12. 14
      tests/runner.css
  13. 13
      tests/runner.js
  14. 31
      tests/tests.js
  15. 244
      tests/vendor/qunit-1.12.0.css
  16. 2212
      tests/vendor/qunit-1.12.0.js

2
.gitignore vendored

@ -0,0 +1,2 @@
.DS_Store
bower_components

21
README.md

@ -0,0 +1,21 @@
Showtimes-web
===========
- Open `index.html` in your browser.
Tests
=====
You can run the tests by opening the `index.html?test` page in your browser.
The test is located in the `tests/tests.js` file. You can see how such an
integration test should be written, using QUnit assertions and ember-testing helpers.
For more information about ember-testing package see [ember-testing](http://emberjs.com/guides/testing/integration/).
For more information about the QUnit testing framework, see [QUnit](http://qunitjs.com/).
Contact
====
[www.zzyzx.co](http://www.zzyzx.co)

20
bower.json

@ -0,0 +1,20 @@
{
"name": "showtimes-web",
"version": "0.0.1",
"authors": [
"sipp11 <sipp11@mycapsules.com>"
],
"main": "index.html",
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"showdown": null,
"moment": null
}
}

732
css/bootstrap-combined.no-icons.min.css vendored

File diff suppressed because one or more lines are too long

406
css/normalize.css vendored

@ -0,0 +1,406 @@
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
display: block;
}
/**
* Correct `inline-block` display not defined in IE 8/9.
*/
audio,
canvas,
video {
display: inline-block;
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Address `[hidden]` styling not present in IE 8/9.
* Hide the `template` element in IE, Safari, and Firefox < 22.
*/
[hidden],
template {
display: none;
}
/* ==========================================================================
Base
========================================================================== */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove default margin.
*/
body {
margin: 0;
}
/* ==========================================================================
Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background: transparent;
}
/**
* Address `outline` inconsistency between Chrome and other browsers.
*/
a:focus {
outline: thin dotted;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* ==========================================================================
Typography
========================================================================== */
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari 5, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Address styling not present in IE 8/9, Safari 5, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
*/
b,
strong {
font-weight: bold;
}
/**
* Address styling not present in Safari 5 and Chrome.
*/
dfn {
font-style: italic;
}
/**
* Address differences between Firefox and other browsers.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
/**
* Address styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/**
* Correct font family set oddly in Safari 5 and Chrome.
*/
code,
kbd,
pre,
samp {
font-family: monospace, serif;
font-size: 1em;
}
/**
* Improve readability of pre-formatted text in all browsers.
*/
pre {
white-space: pre-wrap;
}
/**
* Set consistent quote types.
*/
q {
quotes: "\201C" "\201D" "\2018" "\2019";
}
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* ==========================================================================
Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9.
*/
img {
border: 0;
}
/**
* Correct overflow displayed oddly in IE 9.
*/
svg:not(:root) {
overflow: hidden;
}
/* ==========================================================================
Figures
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari 5.
*/
figure {
margin: 0;
}
/* ==========================================================================
Forms
========================================================================== */
/**
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct `color` not being inherited in IE 8/9.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/**
* 1. Correct font family not being inherited in all browsers.
* 2. Correct font size not being inherited in all browsers.
* 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
*/
button,
input,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 2 */
margin: 0; /* 3 */
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
button,
input {
line-height: normal;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
* Correct `select` style inheritance in Firefox 4+ and Opera.
*/
button,
select {
text-transform: none;
}
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default;
}
/**
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/**
* Remove inner padding and search cancel button in Safari 5 and Chrome
* on OS X.
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/**
* 1. Remove default vertical scrollbar in IE 8/9.
* 2. Improve readability and alignment in all browsers.
*/
textarea {
overflow: auto; /* 1 */
vertical-align: top; /* 2 */
}
/* ==========================================================================
Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}

8
css/style.css

@ -0,0 +1,8 @@
/* Put your CSS here */
.ember-application {
margin: 20px;
}
.active {
font-weight: bolder;
}

114
index.html

@ -0,0 +1,114 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Showtimes</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
<link href="/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
</head>
<body>
<script type="text/x-handlebars">
<div class="navbar">
<div class="navbar-inner">
<a class="brand">{{appName}}</a>
<ul class="nav">
<li>{{#link-to 'groups'}}Theaters{{/link-to}}</li>
<li>{{#link-to 'about'}}About{{/link-to}}</a></li>
</ul>
</div>
</div>
{{outlet}}
</script>
<script type="text/x-handlebars" id="groups">
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<table class='table'>
<thead>
<tr><th>Groups</th></tr>
</thead>
<tbody>
{{#each model}}
<tr>
<td>
{{#link-to 'theaters' name}}{{name}} <small class='muted'>#{{id}}</small>{{/link-to}}
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
<div class="span10">
{{outlet}}
</div>
</div>
</div>
</script>
<script type="text/x-handlebars" id="theaters">
<div class="row-fluid">
<div class="span5">
<table class='table'>
<thead>
<tr><th>Theaters</th></tr>
</thead>
<tbody>
{{#each model}}
<tr>
<td>
{{#link-to 'showtimes' code}}{{name}}{{/link-to}}
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
<div class="span7">
{{outlet}}
</div>
</div>
</script>
<script type="text/x-handlebars" id="showtimes">
<table class='table'>
<thead>
<tr><th>Movie Showtimes</th></tr>
</thead>
<tbody>
{{#each model}}
<tr>
<td>
{{movie}} <mark>{{audio}}</mark> <small class='muted'>on {{format-date date}}</small>
<p>{{showtimes}} {{#if cinema}}<small class='muted'>#{{cinema}}</small>{{/if}}</p>
</td>
</tr>
{{/each}}
</tbody>
</table>
</script>
<script type="text/x-handlebars" id="about">
<div class='about'>
<h1>Zzyzx</h1>
<p>Whatever it is, it's quite awesome.</p>
</div>
</script>
<script src="/js/libs/jquery-1.10.2.js"></script>
<script src="/js/libs/handlebars-1.1.2.js"></script>
<script src="/js/libs/ember-1.7.0.js"></script>
<script src="/bower_components/showdown/compressed/showdown.js"></script>
<script src="/bower_components/moment/moment.js"></script>
<script src="/js/app.js"></script>
</body>
</html>

68
js/app.js

@ -0,0 +1,68 @@
App = Ember.Application.create();
App.ApplicationRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('title', "Hello World");
}
});
App.ApplicationController = Ember.Controller.extend({
appName: 'Showtimes'
});
var groups = [
{id: "1", name: "sf"}, {id: "2", name: "major"}
];
var theaters = [
{id: "1", name: 'Sf Emporium', code: "9909"},
{id: "2", name: 'Sf NgamWongWan', code: "9934"}
];
var showtimes = [
{id: "1", name: "The Cove (1999)", showtimes: ['10:30', '13:30']},
{id: "2", name: "The Notebook (2004)", showtimes: ['15:30', '17:30']},
];
var restUrl = 'http://localhost:8888';
App.Router.map(function() {
this.resource('about');
this.resource('groups', {path: '/g'}, function() {
this.resource('theaters', {path: ':name'}, function() {
this.resource('showtimes', {path: ':code'});
});
});
});
App.GroupsRoute = Ember.Route.extend({
model: function() {
return groups;
}
});
App.TheatersRoute = Ember.Route.extend({
model: function(params) {
return $.getJSON(restUrl+'/theaters/'+params.name+'/');
}
});
App.ShowtimesRoute = Ember.Route.extend({
model: function(params) {
var theatersObjs = this.modelFor('theaters');
return $.getJSON(restUrl+'/showtimes/'+theatersObjs[0].group+'/'+params.code+'/');
}
});
var showdown = new Showdown.converter();
Ember.Handlebars.helper('format-markdown', function(input) {
return new Handlebars.SafeString(showdown.makeHtml(input));
});
Ember.Handlebars.helper('format-date', function(date) {
return moment(date).format('ll');
});

48219
js/libs/ember-1.7.0.js

File diff suppressed because it is too large Load Diff

2595
js/libs/handlebars-1.1.2.js

File diff suppressed because it is too large Load Diff

9789
js/libs/jquery-1.10.2.js vendored

File diff suppressed because it is too large Load Diff

14
tests/runner.css

@ -0,0 +1,14 @@
#ember-testing-container {
position: absolute;
bottom: 0;
right: 0;
width: 640px;
height: 384px;
overflow: auto;
z-index: 9999;
border: 1px solid #ccc;
background: white;
}
#ember-testing {
zoom: 50%;
}

13
tests/runner.js

@ -0,0 +1,13 @@
if (window.location.search.indexOf("?test") !== -1) {
document.write(
'<div id="qunit"></div>' +
'<div id="qunit-fixture"></div>' +
'<div id="ember-testing-container">' +
' <div id="ember-testing"></div>' +
'</div>' +
'<link rel="stylesheet" href="tests/runner.css">' +
'<link rel="stylesheet" href="tests/vendor/qunit-1.12.0.css">' +
'<script src="tests/vendor/qunit-1.12.0.js"></script>' +
'<script src="tests/tests.js"></script>'
)
}

31
tests/tests.js

@ -0,0 +1,31 @@
// in order to see the app running inside the QUnit runner
App.rootElement = '#ember-testing';
// Common test setup
App.setupForTesting();
App.injectTestHelpers();
// common QUnit module declaration
module("Integration tests", {
setup: function() {
// before each test, ensure the application is ready to run.
Ember.run(App, App.advanceReadiness);
},
teardown: function() {
// reset the application state between each test
App.reset();
}
});
// QUnit test case
test("/", function() {
// async helper telling the application to go to the '/' route
visit("/");
// helper waiting the application is idle before running the callback
andThen(function() {
equal(find("h2").text(), "Welcome to Ember.js", "Application header is rendered");
equal(find("li").length, 3, "There are three items in the list");
});
});

244
tests/vendor/qunit-1.12.0.css vendored

@ -0,0 +1,244 @@
/**
* QUnit v1.12.0 - A JavaScript Unit Testing Framework
*
* http://qunitjs.com
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
/** Font Family and Sizes */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
}
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
#qunit-tests { font-size: smaller; }
/** Resets */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
margin: 0;
padding: 0;
}
/** Header */
#qunit-header {
padding: 0.5em 0 0.5em 1em;
color: #8699a4;
background-color: #0d3349;
font-size: 1.5em;
line-height: 1em;
font-weight: normal;
border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
}
#qunit-header a {
text-decoration: none;
color: #c2ccd1;
}
#qunit-header a:hover,
#qunit-header a:focus {
color: #fff;
}
#qunit-testrunner-toolbar label {
display: inline-block;
padding: 0 .5em 0 .1em;
}
#qunit-banner {
height: 5px;
}
#qunit-testrunner-toolbar {
padding: 0.5em 0 0.5em 2em;
color: #5E740B;
background-color: #eee;
overflow: hidden;
}
#qunit-userAgent {
padding: 0.5em 0 0.5em 2.5em;
background-color: #2b81af;
color: #fff;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
#qunit-modulefilter-container {
float: right;
}
/** Tests: Pass/Fail */
#qunit-tests {
list-style-position: inside;
}
#qunit-tests li {
padding: 0.4em 0.5em 0.4em 2.5em;
border-bottom: 1px solid #fff;
list-style-position: inside;
}
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
display: none;
}
#qunit-tests li strong {
cursor: pointer;
}
#qunit-tests li a {
padding: 0.5em;
color: #c2ccd1;
text-decoration: none;
}
#qunit-tests li a:hover,
#qunit-tests li a:focus {
color: #000;
}
#qunit-tests li .runtime {
float: right;
font-size: smaller;
}
.qunit-assert-list {
margin-top: 0.5em;
padding: 0.5em;
background-color: #fff;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.qunit-collapsed {
display: none;
}
#qunit-tests table {
border-collapse: collapse;
margin-top: .2em;
}
#qunit-tests th {
text-align: right;
vertical-align: top;
padding: 0 .5em 0 0;
}
#qunit-tests td {
vertical-align: top;
}
#qunit-tests pre {
margin: 0;
white-space: pre-wrap;
word-wrap: break-word;
}
#qunit-tests del {
background-color: #e0f2be;
color: #374e0c;
text-decoration: none;
}
#qunit-tests ins {
background-color: #ffcaca;
color: #500;
text-decoration: none;
}
/*** Test Counts */
#qunit-tests b.counts { color: black; }
#qunit-tests b.passed { color: #5E740B; }
#qunit-tests b.failed { color: #710909; }
#qunit-tests li li {
padding: 5px;
background-color: #fff;
border-bottom: none;
list-style-position: inside;
}
/*** Passing Styles */
#qunit-tests li li.pass {
color: #3c510c;
background-color: #fff;
border-left: 10px solid #C6E746;
}
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
#qunit-tests .pass .test-name { color: #366097; }
#qunit-tests .pass .test-actual,
#qunit-tests .pass .test-expected { color: #999999; }
#qunit-banner.qunit-pass { background-color: #C6E746; }
/*** Failing Styles */
#qunit-tests li li.fail {
color: #710909;
background-color: #fff;
border-left: 10px solid #EE5757;
white-space: pre;
}
#qunit-tests > li:last-child {
border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
}
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
#qunit-tests .fail .test-name,
#qunit-tests .fail .module-name { color: #000000; }
#qunit-tests .fail .test-actual { color: #EE5757; }
#qunit-tests .fail .test-expected { color: green; }
#qunit-banner.qunit-fail { background-color: #EE5757; }
/** Result */
#qunit-testresult {
padding: 0.5em 0.5em 0.5em 2.5em;
color: #2b81af;
background-color: #D2E0E6;
border-bottom: 1px solid white;
}
#qunit-testresult .module-name {
font-weight: bold;
}
/** Fixture */
#qunit-fixture {
position: absolute;
top: -10000px;
left: -10000px;
width: 1000px;
height: 1000px;
}

2212
tests/vendor/qunit-1.12.0.js vendored

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save