Now have the tiles working properly. Also, user interface somewhat improved.

This commit is contained in:
Simon Brooke 2014-07-04 22:24:45 +01:00
parent 53c7d1ca87
commit 257d306d5d
21 changed files with 9891 additions and 18 deletions

View file

@ -1,5 +1,5 @@
(defproject mw-ui "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:description "Web-based user interface for MicroWorld"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.6.0"]
[mw-engine "0.1.0-SNAPSHOT"]

View file

@ -9,13 +9,14 @@ body {
width:80%;
margin: 0 10%;
padding: 0;
padding-top: 8em;
padding-top: 12em;
padding-bottom: 2em;
}
/* footer of the document, within #main-container */
#footer {
clear: both;
font-size: smaller;
padding: 0 2em;
text-align: center;
color:white;
@ -33,15 +34,18 @@ body {
#header {
width:100%;
margin: -10px;
padding: 0.5em 10%;
padding: 0.25em 10%;
position: fixed;
z-index: 149;
background-color: black;
background-image: "../img/earth-space-strip.jpg";
background-repeat: no-repeat;
color: white;
}
#header h1 {
background-color: transparent;
}
#header-logo {
float: left;
padding-right: 2.5em;
@ -80,6 +84,10 @@ li.nav-item a:active { background: gray; color: white; }
border: thin solid white;
}
.world {
font-size: 8pt;
}
div.error {
width: 100%;
}
@ -97,7 +105,7 @@ h1 {
h1, h2, h3, h4, h5 {
background-color: black;
color: white;
padding-left: 20px;
padding-left: -20px;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 977 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

View file

@ -1,8 +1,6 @@
{% extends "templates/base.html" %}
{% block content %}
<div>
<h1>{{title}}</h1>
{{content|safe}}
</div>
{% endblock %}

View file

@ -19,14 +19,16 @@
<meta content="{{seconds}}" http-equiv="{{maybe-refresh}}" />
</head>
<body>
<div id="header">
<div id="header" style=" background-image: url( '{{servlet-context}}/img/earth-space-strip.jpg');"
>
<div id="nav">
<a class="navbar-brand" href="{{servlet-context}}/">MicroWorld</a>
<ul class="nav">
<li class="{{home-selected}}"><a href="{{servlet-context}}/">Home</a></li>
<li class="{{about-selected}}"><a href="{{servlet-context}}/about">About</a></li>
<li class="{{world-selected}}"><a href="{{servlet-context}}/world">World</a></li>
<li class="{{docs-selected}}"><a href="{{servlet-context}}/docs">Documentation</a></li>
</ul>
<h1>{{title}}</h1>
</div>
</div>

View file

@ -0,0 +1,14 @@
{% extends "templates/base.html" %}
{% block content %}
<div>
<ul>
{% for component in components %}
<li>
<a href="{{servlet-context}}/docs/{{component}}/uberdoc.html">
{{component}}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}

View file

@ -1,7 +1,6 @@
{% extends "templates/base.html" %}
{% block content %}
<div>
<h1>{{title}}</h1>
<form action="world">
<p class="widget">
<label for="y">Size of your world: rows</label>

View file

@ -1,8 +1,6 @@
{% extends "templates/base.html" %}
{% block content %}
<div>
<h1>{{title}}</h1>
{{content|safe}}
</div>
{% endblock %}

View file

@ -23,7 +23,7 @@
[cell]
(let [state (:state cell)]
[:td {:class (format-css-class state)}
[:img {:alt (world/format-cell cell) :img (format-image-path state)}]]))
[:img {:alt (world/format-cell cell) :src (format-image-path state)}]]))
(defn render-world-row
"Render this world row as a Hiccup table row."
@ -41,7 +41,8 @@
rules/init-rules))
rules (or (session/get :rules) rules/natural-rules)
generation (+ (or (session/get :generation) 0) 1)
w2 (engine/transform-world world rules)]
w2 (engine/transform-world world rules)
]
(session/put! :world w2)
(session/put! :generation generation)
[:div {:class "world"}
@ -64,6 +65,5 @@
[:link {:href "css/states.css" :type "text/css" :rel "stylesheet"}]
[:meta {:http-equiv "refresh" :content "5"}]]
[:body
[:h1 "MicroWorld"]
(render-world-table)
]]))

View file

@ -14,9 +14,17 @@
(layout/render "about.html" {:title "About MicroWorld" :content (util/md->html "/md/about.md")}))
(defn world-page []
(layout/render "world.html" {:title "Watch your world grow" :content (html (world/render-world-table)) :seconds (or (session/get :seconds) 5) :maybe-refresh "refresh"}))
(layout/render "world.html" {:title "Watch your world grow"
:content (html (world/render-world-table))
:seconds (or (session/get :seconds) 5)
:maybe-refresh "refresh"}))
(defn docs-page []
(layout/render "docs.html" {:title "Documentation"
:components ["mw-engine" "mw-parser" "mw-ui"]}))
(defroutes home-routes
(GET "/" [] (home-page))
(GET "/about" [] (about-page))
(GET "/world" [] (world-page)))
(GET "/world" [] (world-page))
(GET "/docs" [] (docs-page)))