-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from datamade/master
- Loading branch information
Showing
11 changed files
with
142 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ | |
//= require responsive | ||
//= require forms | ||
//= require rails.validations | ||
//= require sign_on_user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$(".sign-on-user").click -> | ||
self = $(this) | ||
$.ajax | ||
url: "/signatures?question_id=" + self.data("question-id") | ||
type: "POST" | ||
success: (resp) -> | ||
self.after "<a class='sign_on'>Signed On</a>" | ||
self.hide() | ||
question_id = self.data("question-id") | ||
current_count = $("[data-signature-question-id='" + question_id + "']") | ||
current_count.html parseInt(current_count.html()) + 1 | ||
|
||
error: (resp) -> | ||
console.log "coundnt save!" | ||
|
||
false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
class SignaturesController < ApplicationController | ||
respond_to :html, :js | ||
respond_to :json | ||
before_filter :authenticate_user! | ||
|
||
def create | ||
@signature = current_user.signatures.create!(question_id: params[:question_id]) | ||
respond_with(@signature) # @todo redirect if HTML, success if JS, rescue and failure if uniqueness validations fail | ||
@signature = current_user.signatures.new(question_id: params[:question_id]) | ||
|
||
if @signature.save | ||
render json: @signature, status: :created | ||
else | ||
render json: @signature.errors, status: :unprocessable_entity | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters