Permalink
Browse files

[page.home] Add date line in the flash chat.

  • Loading branch information...
Godzil authored and r3c committed Jan 11, 2019
1 parent bdb6c4f commit daa27adaf6259ce02bd081c77b18b68d09ce952c
@@ -11,6 +11,7 @@
<string key="submit.save">Save</string>
<string key="submit.search">Search</string>
<string key="submit.send">Send</string>
<string key="type.date.relative">{case:{lag:86400,{time}},0,Today,1,Yesterday,{date:{time},d-m}}</string>
<string key="type.datetime.relative">{case:{lag:86400,{time}},0,Today,1,Yesterday,On the {date:{time},Y-m-d}} at {date:{time},h:ia}</string>
<string key="type.time.absolute">{date:{time},h:i:sa}</string>
</section>
@@ -3,6 +3,7 @@
<string key="yn.home">Home</string>
<section prefix="yn.home.">
<string key="chat">FlashChat</string>
<string key="chat.date" alias="base.type.date.relative" />
<string key="chat.form.alert" alias="yn.chat.shout.edit.form.alert" />
<string key="chat.form.field.nick" alias="yn.chat.shout.edit.form.field.nick" />
<string key="chat.form.field.text.placeholder" alias="yn.chat.shout.edit.form.field.text.placeholder" />
@@ -11,6 +11,7 @@
<string key="submit.save">Enregistrer</string>
<string key="submit.search">Rechercher</string>
<string key="submit.send">Envoyer</string>
<string key="type.date.relative">{case:{lag:86400,{time}},0,Aujourd'hui,1,Hier,{date:{time},d/m}}</string>
<string key="type.datetime.relative">{case:{lag:86400,{time}},0,Aujourd'hui,1,Hier,Le {date:{time},d/m/Y}} à {date:{time},H:i}</string>
<string key="type.time.absolute">{date:{time},H:i:s}</string>
</section>
@@ -3,6 +3,7 @@
<string key="yn.home">Index</string>
<section prefix="yn.home.">
<string key="chat">FlashChat</string>
<string key="chat.date" alias="base.type.date.relative" />
<string key="chat.form.alert" alias="yn.chat.shout.edit.form.alert" />
<string key="chat.form.field.nick" alias="yn.chat.shout.edit.form.field.nick" />
<string key="chat.form.field.text.placeholder" alias="yn.chat.shout.edit.form.field.text.placeholder" />
@@ -77,24 +77,31 @@
<div class="flashchat panel">
<div class="panel-header">{{ $ tra ("yn.home.chat") }}</div>
<div class="panel-body">
<ul>
{{ for shout in shouts }}
<li>
{{ if user.is_admin }}
<a href="{{ $ url ("chat.shout.delete", ["shout": shout.id]) }}">
<ul class="groups">
{{ let by_date = (s) => tra("yn.home.chat.date", ["time": s.time]) }}
{{ for day, daily_shouts in group(shouts, by_date, (s) => [s], (a, b) => cat(a, b)) }}
{{ for shout in daily_shouts }}
<li class="item">
{{ if user.is_admin }}
<a href="{{ $ url ("chat.shout.delete", ["shout": shout.id]) }}">
{{ end }}
<em class="time">{{ $ tra ("yn.home.chat.time", ["time": shout.time]) }}</em>
{{ if user.is_admin }}
</a>
{{ end }}
{{ $ " " }}
<strong class="author {{ $ shout.is_guest && "guest" || "user" }}">{{ $ shout.nick }}</strong>
<span class="text">
{{ unwrap }}
{{ $ shout.render_text ("html", router, logger) }}
{{ end }}
</span>
</li>
{{ end }}
<em class="time">{{ $ tra ("yn.home.chat.time", ["time": shout.time]) }}</em>
{{ if user.is_admin }}
</a>
{{ end }}
{{ $ " " }}
<strong class="author {{ $ shout.is_guest && "guest" || "user" }}">{{ $ shout.nick }}</strong>
<span class="text">
{{ unwrap }}
{{ $ shout.render_text ("html", router, logger) }}
{{ end }}
</span>
</li>
<li class="group">
{{ $ day }}
</li>
{{ end }}
{{ end }}
</ul>
<form class="form-cascade form-thick" action="{{ $ url ("chat.shout.new") }}" method="POST">
@@ -730,6 +730,46 @@ strong {
text-align: left;
}
}

ul.groups {
padding: 0;
margin: 0;
overflow: auto;
list-style: none;

li {
padding: 0 0 2px 0;
font-size: 90%;
}

li.group {
text-align: center;
display: block;
overflow: hidden;
color: @em-text;
}

li.group:before,
li.group:after {
content: "";
display: inline-block;
width: 50%;
vertical-align: middle;
border-color: @em-text;
border-style: solid;
border-width: 0 0 1px 0;
}

li.group:before {
margin: 0 .5em 0 -55%;
border-left-width: 1px;
}

li.group:after {
margin: 0 -55% 0 .5em;
border-right-width: 1px;
}
}
}

.panel-footer {
@@ -45,20 +45,8 @@
padding: 0 4px 4px 4px;
}

ul {
padding: 0;
margin: 0;
overflow: auto;
list-style: none;

li {
padding: 0 0 2px 0;
font-size: 90%;

.guest {
color: @guest-text;
}
}
.guest {
color: @guest-text;
}
}

0 comments on commit daa27ad

Please sign in to comment.