Skip to content

Commit 63f5dc5

Browse files
2 parents 26c0925 + 79dd7a2 commit 63f5dc5

File tree

9 files changed

+120
-38
lines changed

9 files changed

+120
-38
lines changed

app/assets/javascripts/trip.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $(document).ready(function(){
55
$('#trip_form').hide();
66
$('#expense_form').show();
77
});
8-
$('input#expense_location_id').geocomplete();
8+
// $('input#expense_location_id').geocomplete();
99

1010
$('form').on('click','.add_fields', function(event){
1111
event.preventDefault();
@@ -19,10 +19,11 @@ $(document).ready(function(){
1919
// })
2020

2121
$('body').on('click','.location',function(e){
22-
$(this).geocomplete();
22+
// $(this).geocomplete();
2323
});
2424

25-
$('#expenses_grid').on('click','#add-expense',function(e){
25+
$('#expenses_grid').on('click','#add-expense', function(e){
26+
e.preventDefault();
2627
console.log("clicked");
2728
$('#new_expense').show();
2829
$('#add-expense').hide();

app/assets/stylesheets/dashboard.css

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,17 @@ body {
77
padding-top: 50px;
88
}
99

10+
#expenses_grid h2 {
11+
text-align: left;
12+
}
13+
14+
#expenses_grid {
15+
text-align: center;
16+
}
1017

18+
#expenses_grid #new_expense {
19+
display: none;
20+
}
1121
/*
1222
* Global add-ons
1323
*/
@@ -30,9 +40,36 @@ body {
3040
*/
3141

3242
/* Hide for mobile, show later */
43+
.col-sm-2 {
44+
background-color: #50C8C6;
45+
color: white;
46+
height: 700px;
47+
margin-top: 50px;
48+
padding-top: 25px;
49+
}
50+
51+
.col-sm-2 ul {
52+
list-style-type: none;
53+
}
54+
55+
.col-sm-2 a:hover {
56+
color: #E1F5C4;
57+
text-decoration: none;
58+
}
59+
60+
61+
.col-sm-2 h4 {
62+
text-align: left;
63+
}
64+
65+
.col-sm-2 a {
66+
color: white;
67+
}
68+
3369
.sidebar {
3470
display: none;
3571
}
72+
3673
@media (min-width: 768px) {
3774
.sidebar {
3875
position: fixed;
@@ -51,19 +88,26 @@ body {
5188

5289
/* Sidebar navigation */
5390
.nav-sidebar {
91+
background-color: #50C8C6;
5492
margin-right: -21px; /* 20px padding + 1px border */
55-
margin-bottom: 20px;
56-
margin-left: -20px;
93+
margin-bottom: 15px;
94+
margin-left: 0px;
5795
}
96+
5897
.nav-sidebar > li > a {
98+
background-color: #50C8C6;
99+
margin-right: -21px; /* 20px padding + 1px border */
100+
margin-bottom: 20px;
101+
margin-left: -20px;
59102
padding-right: 20px;
60103
padding-left: 20px;
61104
}
105+
62106
.nav-sidebar > .active > a,
63107
.nav-sidebar > .active > a:hover,
64108
.nav-sidebar > .active > a:focus {
65109
color: #fff;
66-
background-color: #428bca;
110+
background-color: #50C8C6;
67111
}
68112

69113

@@ -72,8 +116,9 @@ body {
72116
*/
73117

74118
.main {
75-
padding: 20px;
119+
padding: 80px;
76120
}
121+
77122
@media (min-width: 768px) {
78123
.main {
79124
padding-right: 40px;
@@ -91,6 +136,7 @@ body {
91136

92137
.placeholders {
93138
margin-bottom: 30px;
139+
width:100%;
94140
text-align: center;
95141
}
96142
.placeholders h4 {
@@ -103,3 +149,18 @@ body {
103149
display: inline-block;
104150
border-radius: 50%;
105151
}
152+
153+
.location {
154+
width: 40%;
155+
}
156+
157+
.currency {
158+
width: 13%;
159+
}
160+
161+
.item_box {
162+
padding-top: 10px;
163+
width: 70%;
164+
margin-left: auto;
165+
margin-right: auto;
166+
}

app/assets/stylesheets/user_trips_show.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sidebar {
1+
sidebar {
22
width: 15%;
33
height: 100%;
44
float: left;
@@ -9,8 +9,6 @@ sidebar {
99
padding-top: 20px;
1010
}
1111

12-
13-
1412
sidebar article {
1513
margin-left: auto;
1614
margin-right: auto;

app/views/layouts/application.html.erb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
<html>
33
<head>
44
<title>GoBug</title>
5+
%= stylesheet_link_tag 'application', media: 'all' %>
6+
<%= stylesheet_link_tag 'dashboard', media: 'all' %>
7+
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
8+
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
9+
<script src="/jquery.geocomplete.js"></script>
10+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
11+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
12+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
13+
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
14+
<%= javascript_include_tag 'application' %>
15+
16+
517
<%= stylesheet_link_tag 'application', media: 'all' %>
618
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
719
<%= javascript_include_tag 'application' %>
@@ -12,6 +24,7 @@
1224
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
1325
<!-- Latest compiled and minified JavaScript -->
1426
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
27+
1528
<%= csrf_meta_tags %>
1629
</head>
1730
<body>
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
<div id="expenses_grid" >
2-
<%= render partial: 'expenses_list', locals: {expenses: expenses, wishlist: false} %>
3-
</div>
1+
<%= render partial: 'expenses_list', locals: {expenses: expenses, wishlist: false} %>

app/views/users/_expenses_list.html.erb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<% if @trip %>
2-
<h2>Items for <%= @trip.name %></h2>
2+
<h2 class="page-header"><%= @trip.name %></h2>
33
<button id="add-expense">Add Expense</button>
44
<% elsif wishlist %>
55
<h2>Wishlist for <%= @wishlist.name %></h2>
66
<% end %>
77

88
<% if @trip %>
99

10+
<div class="row placeholders">
1011
<%= form_for [@trip, @expense] do |f| %>
1112
<% if @expense.errors.any? %>
1213
<div id="error_explanation">
@@ -20,26 +21,27 @@
2021
</div>
2122
<% end %>
2223

23-
<%= f.text_field :location_id, class: "location", placeholder: "Enter a location" %>
24+
<%= f.text_field :location_id, class: "location", placeholder: "Enter a location" %><br>
2425
<%= f.text_field :cost, class: "currency", placeholder: "Enter cost" %>
2526
<%= f.select :currency_id, Currency.all.collect {|currency| [ currency.code, currency.id ] }, {:include_blank => "Currency"}, class: "currency" %>
26-
<%= f.text_field :usd_cost, readonly: true, placeholder: "USD", class: "currency" %>
27+
<%= f.text_field :usd_cost, readonly: true, placeholder: "USD", class: "currency" %><br>
2728
<%= f.hidden_field :description, value: "Enter a description" %>
2829

29-
<%= f.select :category_id, Category.all.collect {|category| [ category.name, category.id ] }, {:include_blank => "Select Category"} %>
30+
<%= f.select :category_id, Category.all.collect {|category| [ category.name, category.id ] }, {:include_blank => "Select Category"} %><br><br>
3031

31-
<%= f.date_field :date, :value => Time.now.strftime('%Y-%m-%d') %>
32+
<!-- <%= f.date_field :date, :value => Time.now.strftime('%Y-%m-%d') %> -->
3233
<%= f.submit "Submit" %>
3334
<% end %>
35+
</div>
36+
3437

3538
<% expenses.each do |expense| %>
3639
<div class="item_box">
3740
<%= expense.location.name %><br>
3841
<%= expense.currency.code %>
3942
<%= expense.cost %> |
4043
<%= expense.usd_cost %> |
41-
<%= expense.category.name %> |
42-
<%= best_in_place expense, :date %><br>
44+
<%= expense.category.name %><br>
4345
<%= best_in_place expense, :description, type: :textarea %>
4446
<%= button_to "delete", {:controller => :expenses, :action => 'destroy', :id => expense.id }, method: 'delete' %>
4547
</div>
@@ -51,8 +53,7 @@
5153
<div class="item_box">
5254
<%= expense.location.name %><br>
5355
<%= expense.usd_cost %> |
54-
<%= expense.category.name %> |
55-
<%= expense.date %><br>
56+
<%= expense.category.name %><br>
5657
<%= expense.description %>
5758
<%= button_to "delete", {:controller => :expenses, :action => 'destroy', :id => expense.id }, method: 'delete' %>
5859
</div>

app/views/users/_sidebar.html.erb

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
<sidebar>
2-
<h3>Your Trips</h3>
3-
<% @trips.each do |trip| %>
4-
<article class="trip"><%= link_to trip.name, fetch_expenses_path(:trip_id => trip), :remote => true %></article>
5-
<% end %>
6-
<article class="trip"><%= link_to "Add a Trip", fetch_new_trip_path, :remote => true %></article>
7-
<h3>Your WishLists</h3>
8-
<% @wishlists.each do |wishlist| %>
9-
<article class="wishlist"><%= link_to wishlist.name, fetch_wishlist_items_path(:wishlist_id => wishlist), :remote => true %></article>
10-
<% end %>
11-
<article class="wishlist"><%= link_to "Add a Wishlist", new_wishlist_path %></article>
12-
<article class="wishlist"><%= link_to "Browse for Items", expenses_path %></article>
13-
</sidebar>
1+
<h4>Your Trips</h4>
2+
<ul>
3+
<% @trips.each do |trip| %>
4+
<li><%= link_to trip.name, fetch_expenses_path(:trip_id => trip), :remote => true %></li>
5+
<% end %>
6+
<li><%= link_to "Add a Trip", fetch_new_trip_path, :remote => true %></li>
7+
</ul>
8+
<h4>Your WishLists</h4>
9+
<ul>
10+
<% @wishlists.each do |wishlist| %>
11+
<li><%= link_to wishlist.name, fetch_wishlist_items_path(:wishlist_id => wishlist), :remote => true %></li>
12+
<% end %>
13+
<li><%= link_to "Add a Wishlist", new_wishlist_path %></li>
14+
</ul>

app/views/users/show.html.erb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
<div id="container">
2-
<%= render 'sidebar' %>
3-
<%= render partial: 'expense_grid', locals: { expenses: @expenses} %>
1+
<div class="container-fluid">
2+
<!-- <h1 class="page-header"><%= @user.username %></h1> -->
3+
<div class="col-sm-2">
4+
<%= render 'sidebar' %>
5+
</div>
6+
<div class="col-sm-5 col-sm-offset-3 col-md-8 col-md-offset-1 main">
7+
<div id="expenses_grid" >
8+
<%= render partial: 'expense_grid', locals: { expenses: @expenses} %>
9+
</div>
10+
</div>
411
</div>
12+

config/initializers/assets.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Version of your assets, change this if you want to expire all your assets.
44
Rails.application.config.assets.version = '1.0'
5+
Rails.application.config.assets.precompile += %w( dashboard.css )
56

67
# Precompile additional assets.
78
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.

0 commit comments

Comments
 (0)