Permalink
Browse files

Merge pull request #1 from akoprow/master

Few minor changes
  • Loading branch information...
2 parents 7aae7b4 + 05393a0 commit 9b906967eae353bb88f8b8adc4c17e40927de8d2 @mads-hartmann committed Nov 25, 2011
Showing with 51 additions and 5 deletions.
  1. +1 −0 Makefile
  2. +2 −0 dotcloud.yml
  3. BIN resources/opa-logo-small.png
  4. +19 −0 resources/style.css
  5. +4 −2 src/game.opa
  6. +24 −2 src/page.opa
  7. +1 −1 src/position.opa
View
@@ -1,5 +1,6 @@
OPA=opa
EXE=chess.exe
+FLAGS = --minimal-version 991
all: $(EXE)
View
@@ -0,0 +1,2 @@
+www:
+ type: opa
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -19,6 +19,9 @@ time, mark, audio, video {
font: inherit;
vertical-align: baseline;
}
+body {
+ font:normal 13px/100% Verdana, Tahoma, sans-serif;
+}
/* line 20, ../../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.3/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
body {
@@ -690,3 +693,19 @@ tr {
.has_errors {
display: block;
}
+/* Footer */
+.footer {
+ width: 445px;
+ position:relative;
+ margin: 0;
+ text-align:right;
+ font-weight:bold;
+ position: absolute;
+ bottom: 10px;
+ right: 45px;
+ font-size:14px;
+}
+.footer, .footer a {color:#8D8D8D;text-decoration:none;}
+.footer span {margin: 0 5px;}
+.footer img {margin:1px 0 0 2px;}
+.footer span, .footer a, .footer img {vertical-align:top;}
View
@@ -159,6 +159,7 @@ Game = {{
game_state = Option.get(Game.get_state())
xml = color ->
+ <>
<div onready={_ -> Network.add_callback(game_finished_recieved, game_observer)}>
<div onready={_ -> Network.add_callback(persistent_game_state_changed(name,_), persistent_game_state)}>
<div onready={_ -> when_ready(name,color, board, game_state, game) } class="game">
@@ -167,7 +168,8 @@ Game = {{
</div>
</div>
</div>
-
+ {Page.footer}
+ </>
if (Option.get(game.white) == user) then
Resource.styled_page("Chess", Page.style, xml({white}))
else
@@ -178,4 +180,4 @@ Game = {{
,User.login_view()) // 404 shouldn't happen
-}}
+}}
View
@@ -19,11 +19,27 @@ Page = {{
*/
fourOfour() = default({ some = "fourofour"}, <h1>404</h1>)
-
+
+ header =
+ <a href="http://github.com/mads379/opa-chess">
+ <img style="position: absolute; top: 0; right: 0; border: 0;"
+ src="https://a248.e.akamai.net/assets.github.com/img/e6bef7a091f5f3138b8cd40bc3e114258dd68ddf/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub"/>
+ </>
+
+ footer =
+ <div class="footer">
+ <span><a target="_blank" href="http://blog.opalang.org/2011/11/spotlight-on-opa-app-opachess-by.html">About the app</a></span> •
+ <span><a target="_blank" href="https://github.com/mads379/opa-chess">Fork on GitHub</a></span> •
+ <span><a target="_blank" href="https://opalang.org">Built with <img src="/resources/opa-logo-small.png" alt="Opa"/></a></span>
+ </>
+ <script src="http://opalang.org/google_analytics.js" />
+
default(idOpt: option(string), content) =
(
id = Option.default("", idOpt)
Resource.styled_page("Chess", style,
+ <>
+ {Page.header}
<div id="{id}" class="container">
<div id="error_container" class="error_container no_errors">
<ul id="errors"></ul>
@@ -32,6 +48,8 @@ Page = {{
{content}
</div>
</div>
+ {Page.footer}
+ </>
)
)
@@ -71,6 +89,8 @@ Page = {{
_)
Resource.styled_page("Chess", style,
+ <>
+ {header}
<div id="lobby" class="container">
<div id="error_container" class="error_container no_errors">
<ul id="errors"></ul>
@@ -103,6 +123,8 @@ Page = {{
</form>
</div>
</div>
+ {footer}
+ </>
)
), User.login_view())
@@ -115,4 +137,4 @@ Page = {{
do Dom.add_class(#error_container,"has_errors")
do Dom.remove_content(#errors)
List.iter( x -> Dom.transform([#errors +<- <li>{x}</li>]), xs)
-}}
+}}
View
@@ -15,7 +15,7 @@ Position = {{
chess_position_from_dom(dom: dom, board): chess_position =
(
// Very hacky. The 7th and 8th chars are the colulm and row number.
- clz = Dom.get_property(dom,"class") |> Option.get(_)
+ clz = Dom.get_attribute(dom,"class") |> Option.get(_)
column = String.get(6, clz)
row = String.get(7, clz) |> String.to_int(_)
Map.get(column, board.chess_positions) |> Option.get(_) |> Map.get(row, _) |> Option.get(_)

0 comments on commit 9b90696

Please sign in to comment.