Skip to content

Commit

Permalink
fix minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
giamir committed Jan 22, 2016
1 parent 79549a8 commit 5b7cff3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
19 changes: 11 additions & 8 deletions app/assets/javascripts/endorsements.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
$(document).ready(function() {

var ready;
ready = function() {
$('.endorsements-link').on('click', function(event){
event.preventDefault();
event.stopImmediatePropagation();
event.preventDefault();
event.stopPropagation();

var endorsementCount = $(this).siblings('.endorsements_count');
var endorsementCount = $(this).siblings('.endorsements_count');

$.post(this.href, function(response){
endorsementCount.text(response.new_endorsement_count);
$.post(this.href, function(response){
endorsementCount.text(response.new_endorsement_count);
});
});
});
};

$(document).ready(ready);
$(document).on('page:load', ready);
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ a:hover{
right: 20px;
display: block;
position: absolute;
text-transform: uppercase;
}
2 changes: 1 addition & 1 deletion app/models/review.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Review < ActiveRecord::Base
belongs_to :user
belongs_to :restaurant
has_many :endorsements
has_many :endorsements, dependent: :destroy
validates :rating, inclusion: (1..5)
validates :user, uniqueness: { scope: :restaurant, message: "has reviewed this restaurant already" }
end
2 changes: 1 addition & 1 deletion coverage/.resultset.json
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,6 @@
null
]
},
"timestamp": 1453492086
"timestamp": 1453504205
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5b7cff3

Please sign in to comment.