Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[layout] hello_chat: reindent a bit

  • Loading branch information...
commit 6cb406bca15ef34a32092661dc260066e86a824e 1 parent 806f8e0
François-Régis Sinot authored
View
32 doc/book/hello_chat/hello_chat.opa
@@ -34,10 +34,8 @@ type message = {author: string /**The name of the author (arbitrary string)*/
*/
user_update(x: message) =
line = <div class="row line">
- <div class="span1 columns userpic"></div>
- <div class="span2 columns user">
- {x.author}:
- </div>
+ <div class="span1 columns userpic" />
+ <div class="span2 columns user">{x.author}:</div>
<div class="span13 columns message">{x.text}
</div>
</div>
@@ -52,8 +50,8 @@ user_update(x: message) =
* @param author The name of the author. Will be included in the message broadcasted.
*/
broadcast(author) =
- do Network.broadcast({~author text=Dom.get_value(#entry)}, room)
- Dom.clear_value(#entry)
+ do Network.broadcast({~author text=Dom.get_value(#entry)}, room)
+ Dom.clear_value(#entry)
/**
* Build the user interface for a client.
@@ -63,21 +61,13 @@ broadcast(author) =
* @return The user interface, ready to be sent by the server to the client on connection.
*/
start() =
- author = Random.string(8)
- <div class="topbar">
- <div class="fill">
- <div class="container">
- <div id=#logo></div>
- </div>
- </div>
- </div>
- <div class="container" id=#conversation onready={_ -> Network.add_callback(user_update, room)}></div>
- <div id=#footer>
- <div class="container">
- <input class="xlarge" id=#entry onnewline={_ -> broadcast(author)}/>
- <div class="btn primary" onclick={_ -> broadcast(author)}>Post</div>
- </div>
- </div>
+ author = Random.string(8)
+ <div class="topbar"><div class="fill"><div class="container"><div id=#logo /></div></div></div>
+ <div id=#conversation class="container" onready={_ -> Network.add_callback(user_update, room)}></div>
+ <div id=#footer><div class="container">
+ <input id=#entry class="xlarge" onnewline={_ -> broadcast(author)}/>
+ <div class="btn primary" onclick={_ -> broadcast(author)}>Post</div>
+ </div></div>
/**
* {1 Application}
View
41 doc/book/hello_chat/resources/css.css
@@ -1,37 +1,40 @@
/***Header***/
#logo {
- background: url("/resources/opa-logo.png") no-repeat scroll 0 0 transparent;
- height: 32px;
- margin: 10px 0 5px;
- width: 61px;
+ background: url("/resources/opa-logo.png") no-repeat scroll 0 0 transparent;
+ height: 32px;
+ margin: 10px 0 5px;
+ width: 61px;
}
/***Conversation***/
#conversation {
- margin-top:58px;
- margin-bottom:40px;
- overflow:auto;
+ margin-top:58px;
+ margin-bottom:40px;
+ overflow:auto;
+}
+.line {
+ border-bottom:1px solid #ddd;
+ padding-bottom:8px;
+ margin-bottom:8px !important;
}
-.line {border-bottom:1px solid #ddd;padding-bottom:8px;}
-.line {margin-bottom:8px !important;}
.user, .message {padding-top:8px;}
.userpic {
- background: url("/resources/user.png") no-repeat 0 0;
- height: 40px;
- width:40px;
+ background: url("/resources/user.png") no-repeat 0 0;
+ height: 40px;
+ width:40px;
}
.user {color: #000;font-weight:bold;}
.message{color:#666;}
/***Footer***/
#footer {
- background:#eee;
- position:fixed;
- bottom:0;
- left:0;
- width:100%;
- padding:10px 0;
- text-align:left;
+ background:#eee;
+ position:fixed;
+ bottom:0;
+ left:0;
+ width:100%;
+ padding:10px 0;
+ text-align:left;
}
Please sign in to comment.
Something went wrong with that request. Please try again.