Commit 44c5027b authored by Mikko Ahlroth's avatar Mikko Ahlroth

Add styling for frontpage ticker, bump version to 1.7.0

parent 9f95265a
......@@ -3,7 +3,7 @@ defmodule CodeStats.Mixfile do
def project do
[app: :code_stats,
version: "1.6.2",
version: "1.7.0",
elixir: "~> 1.3",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
......
defmodule CodeStats.PageController do
use CodeStats.Web, :controller
import Ecto.Query, only: [from: 2]
alias CodeStats.{
Repo,
XP,
Pulse,
Language,
CacheService,
ProfileUtils
CacheService
}
@popular_languages_limit 10
def index(conn, _params) do
now = Calendar.DateTime.now_utc()
then = Calendar.DateTime.subtract!(now, 3600 * ProfileUtils.recent_xp_hours)
# Load total language XPs from cache and use them to populate total XP and
# list of most popular languages
total_lang_xps = CacheService.get_total_language_xps()
......
......@@ -97,3 +97,19 @@ form {
}
}
}
// Ticker in the live update for index page
ul.ticker {
list-style: none;
font-family: monospace;
&:after {
position: absolute;
bottom: 0;
height: 100%;
width: 100%;
content: "";
background: linear-gradient(to top, rgba(255, 255, 255, 1) 5%, rgba(255, 255, 255, 0) 30%);
pointer-events: none;
}
}
......@@ -7,7 +7,7 @@ import IndexPage.View exposing (view)
import IndexPage.Ports exposing (..)
-- Maximum number of rows to show in ticker
ticker_max_rows = 5
ticker_max_rows = 15
main =
Html.program
......
......@@ -15,28 +15,14 @@ format_number number =
ticker_row : TickerDataRow -> Html Msg
ticker_row data =
div [ class "row" ] [
div [ class "col-xs-4" ] [
p [] [
strong [] [
text data.username
]
]
],
div [ class "col-xs-4" ] [
p [] [
text "+",
text (format_number data.xp),
text " XP"
]
li [] [
strong [] [
text data.username
],
div [ class "col-xs-4" ] [
p [] [
text data.language
]
]
text " +",
text (format_number data.xp),
text " ",
text data.language
]
view : Model -> Html Msg
......@@ -102,6 +88,12 @@ view model =
],
div [ class "row" ] [
div [ class "col-xs-12" ] (List.map ticker_row model.tickerdata)
div [ class "col-xs-12" ] [
ul [ class "ticker" ]
(case model.tickerdata of
[] -> [li [] [ text "Waiting for incoming XP…" ]]
data -> (List.map ticker_row data))
]
]
]
......@@ -29,6 +29,13 @@
<h2>Changelog</h2>
<h3>1.7.0 – 2016-08-25 – Live updates ✨</h3>
<ul>
<li>Added live update functionality to profile page and index page. XP numbers and progress bars update live using Elm. 📊 Index page includes a ticker that shows users gaining XP live (private profiles are shown as "Private user").</li>
<li>Bumped dependencies. Update of Plug results in a different format for API tokens, but the old ones will still work.</li>
</ul>
<h3>1.6.2 – 2016-08-08 – Small fixes</h3>
<ul>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment