<button id="install" style="display:none;" class="recommend">
  Install this App
</button>
<script>
	if('mozApps' in  navigator){
		(function(ic){
			ic.onsuccess = function(){
				if(ic.result){
					$('button#install').hide();
				}else{
					$('button#install').click(function(e){
						e.preventDefault();
						// install the app
						var request = navigator.mozApps.install(location.origin+'/bugs.webapp');
						request.onsuccess = function(data){
							replaceState('page-index');
						};
						request.onerror = function(){
							// App wasn't installed, info is in
							// installapp.error.name
							error(request.error.name);
						};
						return false;
					}).show();
				};
			};
		})(navigator.mozApps.checkInstalled(location.origin+"/bugs.webapp"));
	}
</script>
<h3>
	Welcome to Bugs
</h3>
<p>
	Bugs is a project issue tracker.
</p>
{{#if key}}
	<div>
		<section data-type="list">
			<header>
				Latest Activity
			</header>
			<ul>
				{{#each activity}}
					<li>
						<aside class="pack-end">
							<time style="font-size:smaller;" class="timeago">
								{{timestamp}}
							</time>
						</aside>
						<a href="{{url}}">
							<p>
								{{rel.title}}
							</p>
							<p>
								{{action}}
							</p>
						</a>
					</li>
				{{/each}}
			</ul>
			<a class="more">
				latest
			</a>
		</section>
	</div>
{{else}}
	<a class="button" href="#page-register">
		Register
	</a>
	<a class="button" href="#page-login">
		Login
	</a>
{{/if}}