allahu snackbar
This commit is contained in:
parent
d236fd38ec
commit
2cc1062af7
|
@ -8,4 +8,34 @@
|
|||
#= require_tree .
|
||||
|
||||
NProgress.configure
|
||||
showSpinner: false
|
||||
showSpinner: false
|
||||
|
||||
$(document).on "click", "button[name=qb-ask]", ->
|
||||
btn = $(this)
|
||||
btn.button "loading"
|
||||
promote = btn[0].dataset.promote == "true"
|
||||
$("textarea[name=qb-question]").attr "readonly", "readonly"
|
||||
anonymousQuestion = if $("input[name=qb-anonymous]")[0] != undefined
|
||||
$("input[name=qb-anonymous]")[0].checked
|
||||
else
|
||||
true
|
||||
console.log "some AJAX magic should happen here!"
|
||||
btn.button "reset"
|
||||
$("textarea[name=qb-question]").removeAttr "readonly"
|
||||
if true # data.success
|
||||
$("textarea[name=qb-question]").val ''
|
||||
if promote
|
||||
$("div#question-box").hide()
|
||||
$("div#question-box-promote").show()
|
||||
else
|
||||
$.snackbar # allahu snackbar
|
||||
content: "Successfully asked question"
|
||||
style: "snackbar"
|
||||
timeout: 5000
|
||||
|
||||
$(document).on "click", "button#create-account", ->
|
||||
Turbolinks.visit "/sign_up"
|
||||
|
||||
$(document).on "click", "button#new-question", ->
|
||||
$("div#question-box").show()
|
||||
$("div#question-box-promote").hide()
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
#question-box.row
|
||||
.row
|
||||
.col-xs-12
|
||||
%textarea.form-control{:name => "qb_question", :placeholder => "Type your question here…"}
|
||||
%textarea.form-control{:name => "qb-question", :placeholder => "Type your question here…"}
|
||||
.row{:style => "padding-top: 5px; padding-left: 5px; padding-right: 5px;"}
|
||||
.col-xs-6
|
||||
- if user_signed_in? # and @user.allow_anonymous
|
||||
%input{:name => "qb_hidename", :type => "checkbox"}/
|
||||
%input{:name => "qb-anonymous", :type => "checkbox"}/
|
||||
Hide your name
|
||||
%br/
|
||||
.col-xs-6
|
||||
%p.pull-right
|
||||
%input{:name => "qb_to", :type => "hidden", :value => @user.id}/
|
||||
%button#qb_ask.btn.btn-primary{"data-loading-text" => "Asking...", "data-promote" => user_signed_in? ? "true" : "false", :type => "button"} Ask
|
||||
%input{name: 'qb-to', type: 'hidden', :value => @user.id}/
|
||||
%button.btn.btn-primary{name: 'qb-ask', 'data-loading-text' => "Asking...", "data-promote" => user_signed_in? ? "false" : "true", :type => "button"} Ask
|
||||
- unless user_signed_in?
|
||||
#question-box-promote.row{:style => "display: none;"}
|
||||
.row
|
||||
|
|
Loading…
Reference in New Issue