Skip to content

Commit

Permalink
Merge fcab2c5 into 711d77d
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-g committed Sep 26, 2014
2 parents 711d77d + fcab2c5 commit ddf113d
Show file tree
Hide file tree
Showing 89 changed files with 564 additions and 119 deletions.
2 changes: 1 addition & 1 deletion build/grunt/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ module.exports = function(grunt) {
process: function(content) {
var compiled = renderer.renderString(content, "inline.js");
if (compiled.serverErrors && compiled.serverErrors.length) {
grunt.fail.fatal("Hashspace compilation " + compiled.serverErrors[0].description);
grunt.fail.fatal("\r\nHashspace compilation of " + file + "\r\n" + compiled.serverErrors[0].description);
return false;
}
return compiled.code;
Expand Down
4 changes: 4 additions & 0 deletions docs/playground/layout.hsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<script>
var splitter = require("./splitter.hsp.js");
var plunkerExport = require("./plunker.js");

Expand Down Expand Up @@ -28,6 +29,7 @@ var DescriptionCtrl = Class({
this.after = parts[1];
}
});
</script>

<template desc using ctrl:DescriptionCtrl>
<div id="description">
Expand Down Expand Up @@ -69,6 +71,7 @@ var DescriptionCtrl = Class({
</div>
</template>

<script>
function splitterReleased(position, data, playground) {
data.splitterPos = position + "px";
editorResize(playground);
Expand Down Expand Up @@ -100,6 +103,7 @@ function hideNavHover(event, data) {
data.navHover = false;
}
}
</script>

<template sampleList(data, playground)>
<div class="samples-list {{'samples-list-collapsed': data.navCollapsed}}"
Expand Down
5 changes: 4 additions & 1 deletion docs/playground/splitter.hsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<script>
var Class = require("hsp/klass");

var SplitterCtrl = Class({
Expand Down Expand Up @@ -71,11 +72,13 @@ var SplitterCtrl = Class({
element.style[this.type === "vertical" ? "top" : "left"] = position + "px";
}
});

</script>

<template splitter using controller:SplitterCtrl>
<div class="splitter" onmousedown="{controller.onMouseDown(event)}"></div>
<div class="splitter-proxy {{'splitter-proxy-hidden': !controller.active}}"></div>
</template>

<script>
module.exports = splitter;
</script>
4 changes: 4 additions & 0 deletions docs/samples/clickhandler/clickhandler.hsp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script>
var msg={text:""}, count=-1;
</script>

<template message(msg)>
<div title="click me!" onclick="{changeMessage()}" onselectstart="return false">
Expand All @@ -7,6 +9,7 @@ var msg={text:""}, count=-1;
</div>
</template>

<script>
function changeMessage() {
count++;
switch(count%3) {
Expand Down Expand Up @@ -36,3 +39,4 @@ module.exports = {
template: message,
data: [msg]
};
</script>
4 changes: 4 additions & 0 deletions docs/samples/clock/clock.hsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<script>
var klass=require("hsp/klass");

var CITIES={
Expand Down Expand Up @@ -41,6 +42,7 @@ var ClockController=klass({
this.cityName = CITIES[this.city].city;
}
});
</script>

<template clock using c:ClockController>
// example from http://www.ractivejs.org/examples/clock/
Expand Down Expand Up @@ -75,8 +77,10 @@ var ClockController=klass({
<#clock city="TYO"/>
</template>

<script>
// Needed by the playground application.
// Update it, but do not remove it!
module.exports = {
template: demo
};
</script>
5 changes: 4 additions & 1 deletion docs/samples/component1/timer.hsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<script>
var klass=require("hsp/klass");

// klass is a utility to create JS objects with constructors & prototypes
Expand All @@ -16,6 +17,7 @@ var Timer=klass({
this.secondsElapsed++;
}
});
</script>

<template timer using t:Timer>
Elapsed time: {t.secondsElapsed}s
Expand All @@ -27,9 +29,10 @@ var Timer=klass({
<#timer initvalue="10"/>
</template>


<script>
// Needed by the playground application.
// Update it, but do not remove it!
module.exports = {
template: test
};
</script>
9 changes: 6 additions & 3 deletions docs/samples/component2/nbrfield.hsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<script>
var klass=require("hsp/klass");

// Component controller
Expand Down Expand Up @@ -68,8 +69,9 @@ function getNumber(s) {
if (!NBR_DIGITS.test(s)) return null;
return Number(s);
}
</script>

// component template associated with the NbrField controller
<!-- component template associated with the NbrField controller -->
<export template nbrfield using c:NbrField>
<span class="nbrfield">
<input type="text" model="{c.internalValue}"
Expand All @@ -78,7 +80,7 @@ function getNumber(s) {
</span>
</template>

// component usage
<!-- component usage -->
<template test(d)>
Component #1: <#nbrfield value="{d.value1}" min="-10" max="1000"/><br/>
Value in the data model: <span class="textValue">{d.value1}</span>
Expand All @@ -88,10 +90,11 @@ function getNumber(s) {
Value in the data model: <span class="textValue">{d.value2}</span>
</template>


<script>
// Needed by the playground application.
// Update it, but do not remove it!
module.exports = {
template: test,
data: [{ value1 : 123 }]
};
</script>
4 changes: 4 additions & 0 deletions docs/samples/component3/pagination.hsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<script>
var klass=require("hsp/klass");

function calculateNoOfPages(collectionSize, pageSize) {
Expand Down Expand Up @@ -42,6 +43,7 @@ var Pagination=klass({
rebuildInternalModel(this);
}
});
</script>

<template pagination using p:Pagination>
<ul class="pagination">
Expand Down Expand Up @@ -71,6 +73,7 @@ var Pagination=klass({

</template>

<script>
var model = {
active: 4,
collectionSize: 99,
Expand All @@ -88,3 +91,4 @@ module.exports = {
template: paginationTest,
data: [model]
};
</script>
6 changes: 5 additions & 1 deletion docs/samples/conditions/conditions.hsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script>
var klass=require("hsp/klass");
</script>

// nt is an instance of NumberTester
<!-- nt is an instance of NumberTester -->
<template test(nt)>
<div>
Number: <span class="textvalue">{nt.number}</span>
Expand All @@ -23,6 +25,7 @@ var klass=require("hsp/klass");
</div>
</template>

<script>
// klass is a little utility to create a JS object constructor
// from a simple JSON structure - main goals are to
// to simplify prototypal inheritance and ease code reading
Expand All @@ -44,3 +47,4 @@ module.exports = {
return [new NumberTester()];
}
};
</script>
2 changes: 2 additions & 0 deletions docs/samples/cssclass/cssclass.hsp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</div>
</template>

<script>
var msg={
text:"Hello World",
urgency:false
Expand All @@ -32,3 +33,4 @@ module.exports = {
template: message,
data: [msg]
};
</script>
2 changes: 2 additions & 0 deletions docs/samples/dynpath/dynpath.hsp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<a href="javascript:void(0)" onclick="{swapC()}">Show/Hide columns C</a>
</template>

<script>
// create dummy data
var list=[], count=5;
for (var i=0;count>i;i++) {
Expand Down Expand Up @@ -57,3 +58,4 @@ module.exports = {
template: grid,
data: [model]
};
</script>
2 changes: 2 additions & 0 deletions docs/samples/dyntemplates/dyntemplates.hsp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
</div>
</template>

<script>
var model={
view: tplA,
msg: "Hello World",
Expand All @@ -33,3 +34,4 @@ module.exports = {
template: test,
data: [model]
};
</script>
4 changes: 4 additions & 0 deletions docs/samples/gestures/gestures.hsp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script>
require('hsp/gestures/index').register();
</script>

<template gestures(msgList)>
<div class="touchboard" style="height:200px; background: #27AAFC;text-align:center;"
Expand All @@ -19,6 +21,7 @@ require('hsp/gestures/index').register();
</div>
</template>

<script>
var eventLog = [];

function addMsg(evt) {
Expand All @@ -36,3 +39,4 @@ module.exports = {
template: gestures,
data: [eventLog]
};
</script>
6 changes: 6 additions & 0 deletions docs/samples/global/global.hsp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script>
var hsp=require("hsp/rt");
</script>

<template item(text,value)>
{if value}
Expand All @@ -9,8 +11,10 @@ var hsp=require("hsp/rt");
{/if}
</template>

<script>
hsp.global.label=item;
hsp.global.ln={personDetails:"Person details"};
</script>

<template test(person)>
<div class="global" title="{ln.personDetails}">
Expand All @@ -19,6 +23,7 @@ hsp.global.ln={personDetails:"Person details"};
</div>
</template>

<script>
// Needed by the playground application.
// Update it, but do not remove it!
module.exports = {
Expand All @@ -28,3 +33,4 @@ module.exports = {
lastName:"Simpson"
}]
};
</script>
7 changes: 6 additions & 1 deletion docs/samples/helloworld/hello.hsp
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
// edit me!
<!--
edit me!
-->

<template hello(name)>
<div class="msg">
Hello {name}!
</div>
</template>

<script>
// Needed by the playground application.
// Update it, but do not remove it!
module.exports = {
template: hello,
data: ["World"]
};
</script>
2 changes: 2 additions & 0 deletions docs/samples/inputsample/inputsample.hsp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
</div>
</template>

<script>
var d={comment:"edit me!", isChecked:false, selection:"B", dtype:"text"}

// Needed by the playground application.
Expand All @@ -39,3 +40,4 @@ module.exports = {
template: inputSample,
data: [d]
};
</script>
2 changes: 2 additions & 0 deletions docs/samples/let/let.hsp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<a href="javascript:void(0)" onclick="{updateModel()}">Change Model</a>
</template>

<script>
var model={
part1:{
part11: {msg: "Message 1.1"}
Expand All @@ -35,3 +36,4 @@ module.exports = {
template: test,
data: [model]
};
</script>
8 changes: 6 additions & 2 deletions docs/samples/list1/list.hsp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<script>
var klass=require("hsp/klass");

// simple list controller
Expand All @@ -12,8 +13,9 @@ var ListController = klass({
"separator": {type:"template"}
}
});
</script>

// simple list template
<!-- simple list template -->
<template list using lc:ListController>
// content is the list of attribute sub-elements
<div class="list {lc.class}">
Expand All @@ -36,7 +38,7 @@ var ListController = klass({
</div>
</template>

// test template
<!-- test template -->
<template test(d)>
<#list head="Static list" class="listcpt">
<@option>First {d.itemName}</@option>
Expand All @@ -60,6 +62,7 @@ var ListController = klass({
</#list>
</template>

<script>
var count=0, model={
itemName: "item",
preferredOption:"My favourite things",
Expand Down Expand Up @@ -87,3 +90,4 @@ module.exports = {
template: test,
data: [model]
};
</script>

0 comments on commit ddf113d

Please sign in to comment.