Skip to content
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
2 changes: 2 additions & 0 deletions app/assets/javascripts/gifts.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# You can use CoffeeScript in this file: http://coffeescript.org/


# Should be consitat with the project and use either all JS
# or all Coffeescript
$ ->
$('.gift').hover (event) ->
console.log("hover triggered")
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/jazController.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ Controller.prototype = {
url: "/gifts.json",
type: "GET",
//'for' loop extracts gift data from the JSON & creates gift objects
// consider moving this anonymous function into a named function
success: function(data) {
// don't commit debugging statements
console.log(data);
self.gifts = [];
for (var i=0; i<data.length; i++) {
Expand Down Expand Up @@ -61,6 +63,8 @@ Controller.prototype = {
// send the html from the template to the view
this.view.showGiftDetails(html);

// don't commit commented out code
// use git and Github to refer to old code instead.
// bind events for the save and delete buttons
// $(this.view.saveButtonSelector).on("click", this.updateGiftDetails.bind(this));
// $(this.view.deleteButtonSelector).on("click", this.deleteGift.bind(this));
Expand Down
1 change: 1 addition & 0 deletions app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class DashboardController < ApplicationController
# Minor niggle but try to remove trailing whitespace

def index
end
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
class ProfilesController < ApplicationController
def show
# Don't commit commented out code
# @user = User.find_by_profile_name(params[:id])
@user = User.find(params[:id])
if @user
# By default the association will give you all gifts for this user so you
# don't need to call all after.
@gifts = @user.gifts.all
render action: :show
else
Expand Down
1 change: 1 addition & 0 deletions app/helpers/dashboard_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Don't commit empty files. Any empty helpers should just be deleted.
module DashboardHelper
end
4 changes: 4 additions & 0 deletions app/models/gift.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
class Gift < ActiveRecord::Base
# Similar to whitespace get the whole team on one type of tab
# I would suggest 2 spaces for a tab. Seems like a small thing
# but different editors show tabs differently and it messes
# with indentation making the code harder to read.
validates :title, presence: true
validates :description, presence: true

Expand Down
2 changes: 2 additions & 0 deletions app/models/request.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Request < ActiveRecord::Base
belongs_to :user
belongs_to :gift
# Should add validations to make sure the
# foreign keys have been added
end
3 changes: 2 additions & 1 deletion app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<% current_user.gifts.each do | gift| %>
<div class="row">
<div class="col-xs-2 ">
<!-- should be using link_to helper here -->
<a href="/gifts/<%= gift.id %>">
<%= gift.title %>
</a>
Expand All @@ -41,4 +42,4 @@
<% end %>

</div>
</div>
</div>
3 changes: 2 additions & 1 deletion app/views/dashboard/requested.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="#my-gifts" role="tab" data-toggle="tab">My Gifts</a></li>
<li><a href="#my-requests" role="tab" data-toggle="tab">My Requests</a></li>
<!-- broken link tag, should use link_to. Also could use helper method here to create whole li tags -->
<li>a href="#profile" role="tab" data-toggle="tab">Profile</a></li>
</ul>

Expand Down Expand Up @@ -43,4 +44,4 @@
<% end %>

</div>
</div>
</div>
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# Jaz JS learning objectives:
get 'gifts/:id/jaz', to: 'gifts#jaz'

# Remove commented out code. I know this is generated by Rails but good to remove
# commented out code ASAP as it just adds noise and hangs around long after it
# is intended to.
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".

Expand Down