Split up landing page for signed in and signed out users, and add new menu

This commit is contained in:
benji 2017-01-11 16:14:21 +01:00
parent 74aa636ae5
commit d388226d32
5 changed files with 111 additions and 61 deletions

View file

@ -20,7 +20,3 @@
*/ */
@import "bootstrap-sprockets"; @import "bootstrap-sprockets";
@import "bootstrap"; @import "bootstrap";
body {
padding: 30px;
}

View file

@ -0,0 +1,53 @@
$background-color: #f3f3f3;
$border-color: #cfcfcf;
$color: #777;
.menu {
width: 100%;
height: 70px;
background: $background-color;
border-bottom: 1px solid $border-color;
.menu-item {
display: inline-block;
vertical-align: middle;
height: 100%;
padding: 20px;
color: $color;
&:hover {
text-decoration: none;
}
}
.menu-heading {
font-weight: bold;
}
.menu-list {
display: inline-block;
border-left: 1px solid $border-color;
height: 100%;
margin: 0;
padding: 0;
.menu-item {
border-right: 1px dotted $border-color;
.badge {
display: inline-block;
min-width: 10px;
padding: 3px 7px;
font-size: 12px;
font-weight: bold;
color: white;
line-height: 1;
vertical-align: baseline;
white-space: nowrap;
text-align: center;
background-color: $color;
border-radius: 10px;
}
}
}
}

View file

@ -1,17 +1,19 @@
.pure-u-1 .pure-u-1
.pure-menu.pure-menu-horizontal .menu
= link_to "Tab", root_path, class: "pure-menu-heading pure-menu-link" = link_to 'Tab', root_path, class: 'menu-heading menu-item'
%ul.pure-menu-list .menu-list
%li.pure-menu-item = link_to 'Transactions', current_user, class: 'menu-item'
= link_to current_user.name.capitalize, current_user, class: "pure-menu-link" = link_to user_requests_path(current_user), class: 'menu-item' do
- if current_user.penning Requests
%li.pure-menu-item %span.badge= current_user.incoming_requests.size
=link_to "Zeus", User.zeus, class: "pure-menu-link" = link_to user_notifications_path(current_user), class: 'menu-item' do
%li.pure-menu-item Notifications
= link_to "Requests (#{User.zeus.incoming_requests.size})", user_requests_path(User.zeus), class: 'pure-menu-link' %span.badge= current_user.notifications.size
%li.pure-menu-item - if current_user.penning
= link_to "Notifications (#{User.zeus.notifications.size})", user_notifications_path(User.zeus), class: 'pure-menu-link' = link_to 'Zeus', User.zeus, class: 'menu-item'
%li.pure-menu-item = link_to user_requests_path(User.zeus), class: 'menu-item' do
= link_to "Requests (#{current_user.incoming_requests.size})", user_requests_path(current_user), class: 'pure-menu-link' Zeus Requests
%li.pure-menu-item %span.badge= User.zeus.incoming_requests.size
= link_to "Notifications (#{current_user.notifications.size})", user_notifications_path(current_user), class: 'pure-menu-link' = link_to user_notifications_path(User.zeus), class: 'menu-item' do
Zeus Notifications
%span.badge= User.zeus.notifications.size

View file

@ -1,43 +1,32 @@
%h1.columns-title Tab %h1.columns-title Tab
= javascript_include_tag "//www.google.com/jsapi", "chartkick" = javascript_include_tag "//www.google.com/jsapi", "chartkick"
- unless user_signed_in? %h2.columns-title Cute Little Statistics
.pure-g.landing_columns .pure-g
.pure-u-1.pure-u-md-1-2 .pure-u-1.pure-u-md-1-2.landing-column
%h2 Authentication %h3.columns-title Pie of Shame
%p Log een keer in en betaal uw schulden! = pie_chart @statistics.shamehash
%p= link_to "Log in met Zeus WPI", user_omniauth_authorize_path(:zeuswpi), class: "pure-button pure-button-primary login-button" %h3.columns-title Table of Shame
.pure-u-1.pure-u-md-1-2 %table.pure-table.full-table
%h2 Pie of Shame %thead
= pie_chart @statistics.shamehash %th Shame on
- else %th Contribution to Zeus' lack of money
%h2.columns-title Cute Little Statistics %tbody
.pure-g - @statistics.shameful_users.each do |user|
.pure-u-1.pure-u-md-1-2.landing-column %tr
%h3.columns-title Pie of Shame %td.shameful-person= user.name
= pie_chart @statistics.shamehash // Won't divide by zero because there won't be any users with
%h3.columns-title Table of Shame // a shameful debt if the total debt is zero.
%table.pure-table.full-table %td.shame-percentage= "#{-100 * user.balance / @statistics.total_debt}%"
%thead .pure-u-1.pure-u-md-1-2.landing-column
%th Shame on %h3.columns-title Distribution of Debt Sources
%th Contribution to Zeus' lack of money = pie_chart @statistics.by_issuer
%tbody %h3.columns-title Top Debt Creators
- @statistics.shameful_users.each do |user| %table.pure-table.full-table
%tr %thead
%td.shameful-person= user.name %th Issuer
// Won't divide by zero because there won't be any users with %th Number of Transactions issued
// a shameful debt if the total debt is zero. %tbody
%td.shame-percentage= "#{-100 * user.balance / @statistics.total_debt}%" - @statistics.creation_counts.each do |name, count|
.pure-u-1.pure-u-md-1-2.landing-column %tr
%h3.columns-title Distribution of Debt Sources %td.shameful-person= name
= pie_chart @statistics.by_issuer %td.shame-percentage= count
%h3.columns-title Top Debt Creators
%table.pure-table.full-table
%thead
%th Issuer
%th Number of Transactions issued
%tbody
- @statistics.creation_counts.each do |name, count|
%tr
%td.shameful-person= name
%td.shame-percentage= count

View file

@ -0,0 +1,10 @@
%h1.columns-title Tab
= javascript_include_tag "//www.google.com/jsapi", "chartkick"
.pure-g.landing_columns
.pure-u-1.pure-u-md-1-2
%h2 Authentication
%p Log een keer in en betaal uw schulden!
%p= link_to "Log in met Zeus WPI", user_omniauth_authorize_path(:zeuswpi), class: "pure-button pure-button-primary login-button"
.pure-u-1.pure-u-md-1-2
%h2 Pie of Shame
= pie_chart @statistics.shamehash