Skip to content

added charts to show page and rails admin panel #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ gem 'high_voltage', '~> 2.1.0'
gem 'clearance'
gem 'paperclip'
gem 'aws-sdk'
gem 'chartkick'
gem 'groupdate'
gem 'rails_admin'

group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
Expand Down
35 changes: 35 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ GEM
sass (>= 3.2.0)
thor
builder (3.1.4)
chartkick (1.2.4)
clearance (1.2.1)
bcrypt
email_validator (~> 1.4)
Expand All @@ -61,6 +62,12 @@ GEM
activemodel
erubis (2.7.0)
execjs (2.0.2)
font-awesome-rails (4.0.3.1)
railties (>= 3.2, < 5.0)
groupdate (2.1.0)
activerecord (>= 3.0.0)
haml (4.0.5)
tilt
high_voltage (2.1.0)
hike (1.2.3)
i18n (0.6.9)
Expand All @@ -70,7 +77,12 @@ GEM
jquery-rails (3.1.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (4.2.0)
railties (>= 3.2.16)
json (1.8.1)
kaminari (0.15.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
Expand All @@ -81,6 +93,7 @@ GEM
neat (1.5.0)
bourbon (>= 2.1)
sass (>= 3.2)
nested_form (0.3.2)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
paperclip (4.1.1)
Expand All @@ -91,6 +104,9 @@ GEM
pg (0.17.1)
polyglot (0.3.4)
rack (1.5.2)
rack-pjax (0.7.0)
nokogiri (~> 1.5)
rack (~> 1.3)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.0.3)
Expand All @@ -101,6 +117,20 @@ GEM
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.3)
sprockets-rails (~> 2.0.0)
rails_admin (0.6.2)
builder (~> 3.1)
coffee-rails (~> 4.0)
font-awesome-rails (>= 3.0)
haml (~> 4.0)
jquery-rails (~> 3.0)
jquery-ui-rails (~> 4.0)
kaminari (~> 0.14)
nested_form (~> 0.3)
rack-pjax (~> 0.7)
rails (~> 4.0)
remotipart (~> 1.0)
safe_yaml (~> 1.0)
sass-rails (~> 4.0)
railties (4.0.3)
actionpack (= 4.0.3)
activesupport (= 4.0.3)
Expand All @@ -109,6 +139,8 @@ GEM
rake (10.2.2)
rdoc (4.1.1)
json (~> 1.4)
remotipart (1.2.1)
safe_yaml (1.0.2)
sass (3.2.19)
sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
Expand Down Expand Up @@ -148,16 +180,19 @@ DEPENDENCIES
aws-sdk
bitters
bourbon
chartkick
clearance
coffee-rails (~> 4.0.0)
dotenv-rails
groupdate
high_voltage (~> 2.1.0)
jbuilder (~> 1.2)
jquery-rails
neat
paperclip
pg
rails (= 4.0.3)
rails_admin
sass
sass-rails (~> 4.0.0)
sdoc
Expand Down
249 changes: 248 additions & 1 deletion app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,251 @@

@import "bourbon";
@import "neat";
@import "bitters/bitters";
@import "bitters/bitters";

$large-screen: new-breakpoint(max-width 1200px 12);

.comment {
$comment-gutter: 1.4em;
$comment-image-padding: .7em;
$comment-image-width: 4em;
$comment-color: $base-font-color;
$comment-background: lighten($base-accent-color, 15);
$comment-detail-color: transparentize($comment-color, .5);
$comment-image-vert-alignment: top;

display: table;
width: 100%;
margin-bottom: $base-line-height;
padding-bottom: 1em;
border-bottom: 1px solid transparentize($comment-color, .9);

.comment-image,
.comment-content {
display: table-cell;
vertical-align: $comment-image-vert-alignment;
}

.comment-image {
padding-right: $comment-gutter;

> img {
width: $comment-image-width;
height: auto;
border-radius: $base-border-radius;
padding: $comment-image-padding;
background: $comment-background;
display: block;
max-width: none;
}

.comment-reverse-order & {
padding-right: 0;
padding-left: 10px;
}
}

.comment-content {
width: 100%;

h1 {
font-size: 1em;
margin-bottom: .5em;
}

p {
margin-bottom: .5em;
}

p.comment-detail {
font-style: italic;
font-size: .9em;
color: $comment-detail-color;
}
}
}

header.navigation {
$navigation-background: $dark-gray;
$navigation-color: transparentize(white, 0.3);
$navigation-color-hover: white;
$navigation-height: 60px;
$navigation-nav-button-background: $base-accent-color;
$navigation-nav-button-background-hover: lighten($navigation-background, 10);
$navigation-nav-button-border: 1px solid lighten($navigation-nav-button-background, 20);
$navigation-search-background: lighten($navigation-background, 5);
$navigation-search-border: 1px solid darken($navigation-background, 5);

background-color: $navigation-background;
border-bottom: 1px solid darken($navigation-background, 10);
font-family: $sans-serif;
height: $navigation-height;
width: 100%;
z-index: 999;

.menu-wrapper {
@include outer-container;
position: relative;
z-index: 9999;
}

.logo {
float: left;
max-height: $navigation-height;
padding-left: 1em;
padding-right: 2em;

img {
max-height: $navigation-height;
padding: .8em 0;
}
}

.navigation-menu-button {
color: $navigation-color;
cursor: pointer;
display: block;
float: right;
font-family: $sans-serif;
font-weight: 700;
line-height: $navigation-height;
margin: 0;
padding-right: 1em;
text-transform: uppercase;

@include media ($large-screen) {
display: none;
}

&:hover {
color: $navigation-color-hover;
}
}

.nav {
@include media ($large-screen) {
float: left;
}
}

ul#navigation-menu {
clear: both;
-webkit-transform-style: preserve-3d; // stop webkit flicker
display: none;
margin: 0 auto;
overflow: hidden;
padding: 0;
width: 100%;
z-index: 9999;

@include media ($large-screen) {
display: inline;
margin: 0;
padding: 0;
}
}

ul li {
background: $navigation-background;
display: block;
line-height: $navigation-height;
overflow: hidden;
padding-right: .8em;
text-align: right;
width: 100%;
z-index: 9999;

@include media ($large-screen) {
background: transparent;
display: inline;
line-height: $navigation-height;
padding-right: 2em;
text-decoration: none;
width: auto;
}

a {
font-weight: 400;
color: $navigation-color;

&:hover {
color: $navigation-color-hover;
}
}
}

.sign-up {
@include media ($large-screen) {
@include position(absolute, 0px 0px 0 0);
padding-right: 1em;

a {
@include transition (all 0.2s ease-in-out);
background: $navigation-nav-button-background;
border-radius: $base-border-radius;
color: white;
font-size: .8em;
font-weight: 800;
padding: .6em 1em;
text-transform: uppercase;

&:hover {
background: lighten($navigation-nav-button-background, 10);
}
}
}
}

li.navigation-search-bar {
display: none;

@include media($large-screen) {
@include position(absolute, 0px 76px 0 0);
display: inline-block;
line-height: 0 !important;
padding: 13px 30px; // this to get around Firefox/Opera line-height "bug"
}
}

.search-bar {
$search-bar-border-color: $base-border-color;
$search-bar-border: 1px solid $search-bar-border-color;
$search-bar-background: lighten($search-bar-border-color, 10);

width: 19em;
position: relative;
display: inline-block;

input {
@include box-sizing(border-box);
display: block;
}

.search-and-submit {
position: relative;

input[type=search] {
background: $navigation-search-background;
border: $navigation-search-border;
padding: .6em .8em;
font-size: .9em;
font-style: italic;
color: $navigation-color;
border-radius: $base-border-radius * 2;
margin: 0;
}

button[type=submit] {
@include button(simple, lighten($navigation-search-background, 10));
@include position(absolute, 0.3em 0.3em 0.3em 0);
outline: none;
padding: 5px 15px;

img {
height: 12px;
opacity: .7;
}
}
}
}
}
21 changes: 18 additions & 3 deletions app/views/homes/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%= javascript_include_tag "//www.google.com/jsapi", "chartkick" %>
<nav>
<% if current_user.profile %>
<%= link_to "Show Profile", current_user.profile %>
Expand All @@ -7,6 +8,20 @@

<%= link_to "Departments", departments_path %>
</nav>
<% @profile.each do |image| %>
<%= link_to image_tag image.avatar.url %>
<% end %>
<hr>
<div>
<p>New Employee Registrations By Hour:</p>
<%= area_chart User.group_by_hour(:created_at).count %>
</div>
<% @profile.each do |employee| %>
<div class="comment">
<div class="comment-image">
<%= image_tag employee.avatar.url, size: "40x40" %>
</div>
<div class="comment-content">
<h1><%= employee.name %></h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Optio, aspernatur, quia modi minima debitis tempora ducimus quam vero impedit alias earum nemo error tenetur sed.</p>
<p class="comment-detail">Date or details about this post</h2>
</div>
</div>
<% end %>
Loading