Skip to content

Commit

Permalink
Fixed 500 internal server error.
Browse files Browse the repository at this point in the history
issue #2 fixed.
  • Loading branch information
jongha committed Jul 16, 2014
1 parent d30caa8 commit a5c9261
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/views/vote/_view_layouts_base_content.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
</div>
<label id="label_vote_count" style="display:none"><%=l(:label_vote_count)%></label>
<% end %>
<% end %>
<% end %>
<input type="hidden" id="vote-base-url" value="<%=url_for :controller => 'welcome' %>" />
17 changes: 12 additions & 5 deletions assets/javascripts/vote.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
$(document).ready(function() {
var baseObj = $("#vote-base-url");
var base = "";

if(baseObj.length > 0) {
base = baseObj.val();
}

if($(".controller-messages").length && $("#vote").length) {
var clr = $("<div></div>").css({ clear: "right" });
var queue = [];
Expand Down Expand Up @@ -30,7 +37,7 @@ $(document).ready(function() {

$.ajax({
type: "GET",
url: "/boards/" + board + "/topics/" + topic + "/vote",
url: base + "boards/" + board + "/topics/" + topic + "/vote",
cache: false,
error: function(jqXHR, textStatus, errorThrown) {
votePoint.html("-");
Expand All @@ -48,7 +55,7 @@ $(document).ready(function() {
var point = $(this).data("point");
$.ajax({
type: "POST",
url: "/boards/" + board + "/topics/" + topic + "/vote",
url: base + "boards/" + board + "/topics/" + topic + "/vote",
data: { point: point },
cache: false,
success: function(data, textStatus, jqXHR) {
Expand Down Expand Up @@ -77,7 +84,7 @@ $(document).ready(function() {

$.ajax({
type: "GET",
url: "/boards/" + match[1] + "/vote/result",
url: base + "boards/" + match[1] + "/vote/result",
cache: false,
success: function(data, textStatus, jqXHR) {
if($(result).length === 0) {
Expand Down Expand Up @@ -111,7 +118,7 @@ $(document).ready(function() {
var _this = $(this);
$.ajax({
type: "GET",
url: "/boards/" + _board + "/topics/" + _topic + "/vote",
url: base + "boards/" + _board + "/topics/" + _topic + "/vote",
cache: false,
success: function(data, textStatus, jqXHR) {
_this.html(data.point);
Expand All @@ -120,4 +127,4 @@ $(document).ready(function() {
}
});
}
});
});

0 comments on commit a5c9261

Please sign in to comment.