Merge pull request #151 from ZeusWPI/homepage

Homepage
This commit is contained in:
Eloïse Piret 2017-02-08 17:17:37 +01:00 committed by GitHub
commit 55eb4f23bd
6 changed files with 141 additions and 68 deletions

View file

@ -1,8 +1,20 @@
$ -> $ ->
$.getJSON 'https://zeus.ugent.be/game/top4/show.json', (data) -> $.getJSON 'https://zeus.ugent.be/game/top4/show.json', (data) ->
str = "<ol>" str = "<table>"
for x in data for x in data
str += "<li><a href=\"#{x.github_url}\">#{x.github_name}</a> (#{x.score} Z$)</li>" str += """
str += "</ol>" <tr>
<td class="picture">
<img class="coder-picture" src="#{x.avatar_url}">
</td>
<td class="name">
<a class="coder-name" href="#{x.github_url}">#{x.github_name}</a>
</td>
<td class="score">
#{x.score}
</td>
</tr>
"""
str += "</table>"
$('#gamification-coders').html(str) $('#gamification-coders').html(str)

View file

@ -1,3 +1,5 @@
$top_coder_size: 80px;
a.box { a.box {
&:hover { &:hover {
box-shadow: 0 2px 3px rgba($black, 0.1), 0 0 0 1px $blue box-shadow: 0 2px 3px rgba($black, 0.1), 0 0 0 1px $blue
@ -39,35 +41,46 @@ a.box {
.icon a{ .icon a{
color:$tile-orange; color:$tile-orange;
} }
#gamification-coders { #gamification-coders {
display: flex; display: flex;
justify-content: center; justify-content: center;
ol{
list-style-type: decimal-leading-zero; table {
counter-reset:li; position: relative;
> li{
float:left; tr:first-child {
padding:5px; height: $top_coder_size;
margin:20px; width: $top_coder_size;
margin-bottom:3px; .picture img {
margin-top:3px; height: $top_coder_size;
display:inline; width: $top_coder_size !important;
&:before{ box-shadow: 0 0 0 3px #fff, 0 0 0 4px #999, 0 2px 5px 4px rgba(0,0,0,0.2);
content:counter(li); /* Use the counter as content */ }
counter-increment:li; }
color:$tile-orange; td {
font: bold 18pt helvetica, arial, sans-serif; vertical-align: middle;
background-color:whitesmoke;
height:30px;
width:30px;
display:inline-block;
margin-right:10px;
border-radius:50px;
text-align: center; text-align: center;
line-height: 30px; padding: 0;
&.picture {
width: $top_coder_size !important;
}
&.score {
text-align: right;
padding-right: 10px;
} }
} }
} }
.picture img {
height: 40px;
width: 40px !important;
vertical-align: middle;
margin: 10px 0;
border-radius: 50px;
z-index: 1;
}
} }
#blokmap-tile { #blokmap-tile {
@ -100,3 +113,15 @@ a.box {
} }
} }
} }
.teaser{
font-style: italic;
}
.description{
font-weight: bold;
}
.backgroundimg{
background-position: center;
}

View file

@ -7,29 +7,65 @@
<div id="homepage"> <div id="homepage">
<div class="tile is-vertical is-ancestor"> <div class="tile is-vertical is-ancestor">
<%= if studytime? then render '/tiles/blokmap.*'end %> <%= if studytime? then render '/tiles/blokmap.*'end %>
<div class="tile is-parent is-12"> <div class="tile">
<div class="tile is-child box highlighted"> <!--top coders -->
<div class="tile is-parent is-4">
<div class="tile is-child box ">
<div class="content"> <div class="content">
<h1 class="has-text-centered"><a href="https://zeus.ugent.be/game">Top Zeus WPI coders this week</a></h1> <h1 class="has-text-centered">
<a href="https://zeus.ugent.be/game">
Top Zeus WPI coders this week
</a>
</h1>
<div id="gamification-coders" > <div id="gamification-coders" >
<!-- EMPTY --> <!-- EMPTY -->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!--next event -->
<div class="tile is-parent is-4" >
<%= render '/partials/_tile.*',
article: upcoming_events[0] || all_events[-1],
small_text: if upcoming_events[0] then "Upcoming event" else "Past event" end%>
</div>
<!-- latest blogpost -->
<div class="tile is-4 is-parent">
<%= render '/partials/_tile.*',
article: sorted_articles.first,
small_text: "Latest blogpost",
htmlclass:"highlighted"%>
</div>
</div>
<div class="tile"> <div class="tile">
<div class="tile is-parent is-4"> <div class="tile is-vertical">
<%= render '/partials/_tile.*', article: upcoming_events[0] || all_events[-1], small_text: if upcoming_events[0] then "Upcoming event" else "Past event" end %> <% all_events.reverse[1..3].each do |event| %>
<div class="tile is-parent ">
<%= render '/partials/_tile.*',
article: event,
small_text: upcoming_events.include?(event) ? "Upcoming event" : "Past event",
htmlclass:"highlighted" %>
</div> </div>
<div class="tile is-parent is-4"> <%end%>
<div class="tile is-child box centering"> </div>
<div class="content has-text-centered"> <div class="tile is-vertical">
<div id="quote" > <% sorted_articles[1..3].each do |post| %>
<!-- INTENTIONALLY LEFT BLANK --> <div class="tile is-parent ">
<%= render '/partials/_tile.*',
article: post,
small_text: "Blogpost"%>
</div>
<%end%>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<%= asset :js, :gamification %>
<%= asset :js, :quote %>
<!--
<div class="tile is-parent is-2"> <div class="tile is-parent is-2">
<a class="tile box is-child imgcenter project-tile" href="/projects/#12urenloop"> <a class="tile box is-child imgcenter project-tile" href="/projects/#12urenloop">
<%= asset :img, '12urenloop.png' %> <%= asset :img, '12urenloop.png' %>
@ -40,18 +76,4 @@
<%= asset :img, 'hydra-logo.svg' %> <%= asset :img, 'hydra-logo.svg' %>
</a> </a>
</div> </div>
</div> -->
<div class="tile">
<div class="tile is-4 is-parent">
<%= render '/partials/_tile.*', article: sorted_articles.first, small_text: "Latest blogpost",htmlclass:"highlighted"%>
</div>
<div class="tile is-vertical">
<div class="tile is-parent">
<%= render '/partials/_tile.*', article: upcoming_events[1] || all_events[-2], small_text: if upcoming_events[1] then "Upcoming event" else "Past event" end %>
</div>
</div>
</div>
</div>
</div>
<%= asset :js, :gamification %>
<%= asset :js, :quote %>

View file

@ -1,4 +1,5 @@
<a href="<%= relative_path_to(@article) %>" class="tile is-child box <%= @htmlclass %>"> <a href="<%= @article.path %>" class="tile is-child box backgroundimg <%= @htmlclass %>"
style="background-image:url('<%= @article[:banner] %>');">
<div class="content" > <div class="content" >
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
@ -12,6 +13,11 @@
</small> </small>
</div> </div>
</div> </div>
<div class="description">
<%= @article[:description] %> <%= @article[:description] %>
</div> </div>
<div class="teaser">
<%= get_teaser(@article) %>
</div>
</div>
</a> </a>

View file

@ -0,0 +1,7 @@
module TileHelper
def get_teaser(post)
# excerptize is part of the TextHelper, given by nanoc
# https://nanoc.ws/doc/reference/helpers/#text
excerptize(post.reps[:text].compiled_content, length: 300)
end
end

View file

@ -17,3 +17,4 @@ include SearchHelper
include BlogHelper include BlogHelper
include PreprocessHelper include PreprocessHelper
include TimeHelper include TimeHelper
include TileHelper