Explorar el Código

Enable viewing created pages

T180
tags/v1.0
Matt Baer hace 8 años
padre
commit
768bf39bbf
Se han modificado 3 ficheros con 84 adiciones y 4 borrados
  1. +9
    -0
      static/css/core.less
  2. +67
    -0
      static/houses.html
  3. +8
    -4
      templates/editor.html

+ 9
- 0
static/css/core.less Ver fichero

@@ -148,6 +148,15 @@ body {
color: #aaa;
}
}
&#neighborhood {
ul {
list-style: none;
padding: 0;
}
li:before {
content: "\2302\A0";
}
}
}

#editor, #preview-wrap {


+ 67
- 0
static/houses.html Ver fichero

@@ -0,0 +1,67 @@
<!DOCTYPE HTML>
<html>
<head>

<title>my pages | HTMLhouse</title>
<link rel="stylesheet" type="text/css" href="/css/house.css" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="icon" type="image/png" href="/img/favicon-chrome.png" sizes="192x192">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#888888" />

<meta name="description" content="View the pages you've built on HTMLhouse.">
<meta name="application-name" content="HTMLhouse">
<meta name="application-url" content="https://html.house">
<meta itemprop="name" content="my pages on HTMLhouse">
<meta itemprop="description" content="View the pages you've built on HTMLhouse.">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="my pages on HTMLhouse">
<meta name="twitter:description" content="View the pages you've built on HTMLhouse.">
<meta property="og:title" content="my pages on HTMLhouse" />
<meta property="og:site_name" content="HTMLhouse" />
<meta property="og:type" content="object" />
<meta property="og:url" content="https://html.house/houses.html" />
<meta property="og:description" content="View the pages you've built on HTMLhouse." />

</head>
<body id="neighborhood">
<header>
<h1>my pages</h1>
<nav>
<a class="home" href="/">&lt;&#8962;/&gt;</a>
<a href="/about.html">about</a>
<a href="mailto:hello@write.as">contact</a>
<a target="_blank" href="https://twitter.com/htmlhouse">@HTMLhouse</a>
</nav>
</header>

<div id="wrapper">
<ul id="street"></ul>
</div>

<script src="https://write.as/js/h.js"></script>
<script>
var houses = JSON.parse(H.get('neighborhood', '[]'));
var list = document.getElementById('street');
if (houses.length > 0) {
for (var i=houses.length-1; i>=0; i--) {
var entry = document.createElement('li');
entry.innerHTML = "<a href=\"/" + houses[i].id + ".html\">" + houses[i].id + "</a> &ndash; <a href=\"/edit/" + houses[i].id + ".html\">edit</a>";
list.appendChild(entry);
}
} else {
}
</script>
<script type="text/javascript">
(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-47877053-8', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>

+ 8
- 4
templates/editor.html Ver fichero

@@ -54,6 +54,8 @@ var $publishBtn = $("#publish");
{{if .ID}}{{else}}var orig = "{{.Content}}";
$publishBtn.addClass("no");{{end}}

var houses = JSON.parse(H.get('neighborhood', '[]'));
var hasBuilt = houses.length > 0;
function updatePreview() {
var val = editor.getSession().getValue();
$view.contents().find('body').html(val);
@@ -64,7 +66,7 @@ function updatePreview() {
} else {
publishing = true;
$publishBtn.addClass("no");
$publishBtn.text("publish (edit first)");
$publishBtn.text("publish" + (!hasBuilt ? " (edit first)" : ""));
}{{end}}
}
var editor = ace.edit("editor");
@@ -74,15 +76,17 @@ editor.session.setMode("ace/mode/html");
editor.getSession().on('change', updatePreview);
updatePreview();

var token;
var houses = JSON.parse(H.get('neighborhood', '[]'));
if (hasBuilt) {
$('header').append('<a href="/houses.html">my pages</a>');
}
{{if .ID}}var token;
for (var i=0; i<houses.length; i++) {
if (houses[i].id == "{{.ID}}") {
token = houses[i].token;
break;
}
}
{{if .ID}}if (typeof token === "undefined") {
if (typeof token === "undefined") {
$publishBtn.addClass("no");
}{{else}}
{{end}}


Cargando…
Cancelar
Guardar