-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add feature to sidebar, questions code overhaul (#1335)
* add feature to sidebar * reorg of questions assets * work on questions by path not session * feature sidebar final fixes * test fix * questions fixes
- Loading branch information
Showing
16 changed files
with
248 additions
and
326 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
jQuery(document).ready(function(){ | ||
|
||
var check_matched = false; | ||
var stripped_url = document.location.toString().split("#"); | ||
if (stripped_url.length > 1){ | ||
var anchor_value = stripped_url[1]; | ||
if(anchor_value.match('answer-0-comment')){ | ||
check_matched = true; | ||
} | ||
} | ||
|
||
if (check_matched){ | ||
$('.answer-0-comments').show(); | ||
} | ||
else{ | ||
$('.answer-0-comments').slice(-3).show(); | ||
if (<%= @node.comments.length %> > 3){ | ||
$('#answer-0-comment').prepend('<p id="answer-0-expand" style="color: #006dcc;">View ' + comment_select(0).length + ' previous comments</p>'); | ||
$("#answer-0-expand").on('click',function(){ | ||
expand_comments(0); | ||
}); | ||
} | ||
} | ||
|
||
$('#answer-0-comment-form').bind('ajax:send', function(e){ | ||
$('#answer-0-comment-form #loading-spinner').removeClass('hidden'); | ||
$('#answer-0-comment-form #reply-comment').addClass('hidden'); | ||
$('#answer-0-comment-form #submit-comment-button').addClass('disabled'); | ||
$('#answer-0-comment-form #submit-comment').text('Submitting'); | ||
}) | ||
|
||
$('#answer-0-comment-form').bind('ajax:success', function(e, data, status, response){ | ||
$('#answer-0-comment-form #loading-spinner').addClass('hidden'); | ||
$('#answer-0-comment-form #reply-comment').removeClass('hidden'); | ||
$('#answer-0-comment-form #submit-comment').text('Submit'); | ||
$('#answer-0-comment-form #submit-comment-button').removeClass('disabled'); | ||
}) | ||
|
||
$('#answer-0-comment-form').bind('ajax:error', function(e, response){ | ||
$('#answer-0-comment-form #loading-spinner').addClass('hidden'); | ||
$('#answer-0-comment-form #reply-comment').removeClass('hidden'); | ||
$('#answer-0-comment-form #submit-comment').text('Submit'); | ||
$('#answer-0-comment-form #submit-comment-button').removeClass('disabled'); | ||
$('#answer-0-comment-section .help-block').remove() | ||
$('#answer-0-comment-section .inline').last().append('<span class="help-block" style="color: red;">Error: there was a problem.</span>') | ||
}) | ||
}) |
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 |
---|---|---|
|
@@ -23,4 +23,5 @@ | |
*= require search | ||
*= require comments | ||
*= require wiki | ||
*= require question | ||
*/ |
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,117 @@ | ||
.question-show .question { | ||
color: #aaa; | ||
font-style: italic; | ||
} | ||
.question-show .question + a { | ||
text-decoration: none; | ||
} | ||
|
||
.question-show .inline { | ||
display: inline-block; | ||
} | ||
|
||
.question-show .inline img.img-circle { | ||
vertical-align: baseline; | ||
width: 35px; | ||
margin-right: 6px; | ||
} | ||
|
||
.question-show .inline div.img-circle { | ||
vertical-align: middle; | ||
height: 35px; | ||
width: 35px; | ||
margin-right: 6px; | ||
background: #ccc; | ||
} | ||
|
||
#questions_searchform .dropdown-menu { | ||
width: 95%; | ||
} | ||
|
||
.answer p img { | ||
max-width:100%; | ||
} | ||
|
||
.answer-accept { | ||
font-weight: bold; | ||
} | ||
|
||
.answer-accept.btn-success { | ||
color: #fff; | ||
} | ||
|
||
.accepted { | ||
background: #76e276; | ||
} | ||
|
||
.user-answer { | ||
margin-top: 10px; | ||
margin-bottom: 5px; | ||
padding: 10px; | ||
display:none; | ||
background-color: #fff; | ||
border-radius: 5px; | ||
} | ||
|
||
table th a { | ||
color: #333; | ||
text-decoration: underline; | ||
} | ||
|
||
table th a:hover { | ||
color: #aaa; | ||
} | ||
|
||
.expandingArea { | ||
position: relative; | ||
margin-top: 2px; | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
background: #fff; | ||
} | ||
.expandingArea > textarea, | ||
.expandingArea > pre { | ||
padding: 6px 12px; | ||
background: transparent; | ||
border: 0; | ||
/* Make the text soft-wrap */ | ||
white-space: pre-wrap; | ||
word-wrap: break-word; | ||
} | ||
.expandingArea > textarea { | ||
/* The border-box box model is used to allow | ||
* padding whilst still keeping the overall width | ||
* at exactly that of the containing element. | ||
*/ | ||
-webkit-box-sizing: border-box; | ||
-moz-box-sizing: border-box; | ||
-ms-box-sizing: border-box; | ||
box-sizing: border-box; | ||
width: 100%; | ||
} | ||
.expandingArea.active > textarea { | ||
/* Hide any scrollbars */ | ||
overflow: hidden; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
height: 100%; | ||
/* Remove WebKit user-resize widget */ | ||
resize: none; | ||
} | ||
.expandingArea > pre { | ||
display: none; | ||
} | ||
.expandingArea.active > pre { | ||
display: block; | ||
/* Hide the text; just using it for sizing */ | ||
visibility: hidden; | ||
} | ||
|
||
.question-show textarea, | ||
.question-show pre { | ||
margin: 0; | ||
padding: 0; | ||
outline: 0; | ||
border: 0; | ||
} |
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
Oops, something went wrong.