Skip to content

Commit

Permalink
Merge pull request #1812 from QuizandSurveyMaster/dev
Browse files Browse the repository at this point in the history
Release 7.3.14
  • Loading branch information
etvarun authored Apr 5, 2022
2 parents bbc6275 + c0d2b81 commit c8f4060
Show file tree
Hide file tree
Showing 35 changed files with 467 additions and 321 deletions.
1 change: 1 addition & 0 deletions css/common-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ footer.qsm-popup__footer button.qsm-popup-secondary-button:hover {
bottom: auto;
transform: none;
margin-bottom: 30px;
float: right;
}

.question-type-polar-s {
Expand Down
1 change: 1 addition & 0 deletions css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ footer.qsm-popup__footer button.qsm-popup-secondary-button:hover{
bottom: auto;
transform: none;
margin-bottom: 30px;
float: left;
}
.question-type-polar-s{
height: auto !important;
Expand Down
13 changes: 10 additions & 3 deletions css/qsm-admin-contact.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@

.contact-form-field {
padding: 25px 10px 10px;
margin: 15px 15px;
background: #f1f1f1;
border: 1px solid #dfd4d4;
margin: 15px 15px;
background: #f1f1f1;
border: 1px solid #dfd4d4;
position: relative;
}
.contact-form-field span.dashicons-move {
position: absolute;
right: 8px;
top: 6px;
cursor: pointer;
}

.contact-form-field.new {
Expand Down
37 changes: 27 additions & 10 deletions css/qsm-admin-question-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@

.question,
.question-bank-question {
padding: 15px 10px;
padding: 10px;
background-color: #F3F3F3;
border: 1px solid #cbcbcb;
margin: 15px 10px 0;
margin: 10px 0;
}

.question a {
Expand Down Expand Up @@ -217,19 +217,37 @@
clear: both;
}

.qsm-select-all-label {
margin-left: 5px;
.qsm-question-bank-select .qsm-select-all-label {
margin-left: 15px;
position: relative;
top: 5px;
vertical-align: top;
}

.qsm-question-bank-select{
margin-bottom: 15px;
display: flex;
justify-content: space-between;
align-items: center;
}

#qsm-import-selected-question {
margin-left: 30px;
margin-right: 10px;
}

#question-bank-search-form{
float: right;
}

.qsm-question-bank-header .qsm-popup__close {
position: absolute;
left: 10px;
top: 25px;
}

#qsm-delete-selected-question {
margin-left: 10px;
.qsm-question-bank-header {
border-bottom: 2px solid #e3e3e3ad;
padding-bottom: 15px;
}

.question-bank-question div {
Expand Down Expand Up @@ -391,6 +409,7 @@ div#correct_answer_info_area {
border: 0;
color: #00449e;
text-decoration: none;
cursor: pointer;
}

.qsm-popup__header .qsm-popup__close:before {
Expand Down Expand Up @@ -604,9 +623,7 @@ a.import-button.button.disable_import::before {
}

#question-bank-cat {
float: left;
margin-bottom: 20px;
margin-left: 10px;
width: 150px;
}

.ui-state-highlight {
Expand Down
37 changes: 27 additions & 10 deletions css/qsm-admin-question.css
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@

.question,
.question-bank-question {
padding: 15px 10px;
padding: 10px;
background-color: #F3F3F3;
border: 1px solid #cbcbcb;
margin: 15px 10px 0;
margin: 10px 0;
}

.question a {
Expand Down Expand Up @@ -245,19 +245,37 @@
clear: both;
}

.qsm-select-all-label {
margin-right: 5px;
.qsm-question-bank-select .qsm-select-all-label {
margin-right: 15px;
position: relative;
top: 5px;
vertical-align: top;
}

.qsm-question-bank-select{
margin-bottom: 15px;
display: flex;
justify-content: space-between;
align-items: center;
}

#qsm-import-selected-question {
margin-right: 30px;
margin-left: 10px;
}

#qsm-delete-selected-question {
margin-right: 10px;
#question-bank-search-form{
float: left;
}

.qsm-question-bank-header .qsm-popup__close {
position: absolute;
right: 10px;
top: 25px;
}

.qsm-question-bank-header {
border-bottom: 2px solid #e3e3e3ad;
padding-bottom: 15px;
}

.question-bank-question div {
Expand Down Expand Up @@ -419,6 +437,7 @@ div#correct_answer_info_area {
border: 0;
color: #00449e;
text-decoration: none;
cursor: pointer;
}

.qsm-popup__header .qsm-popup__close:before {
Expand Down Expand Up @@ -632,9 +651,7 @@ a.import-button.button.disable_import::before {
}

#question-bank-cat {
float: right;
margin-bottom: 20px;
margin-right: 10px;
width: 150px;
}

.ui-state-highlight {
Expand Down
2 changes: 1 addition & 1 deletion js/micromodal.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 56 additions & 39 deletions js/qsm-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
},
addField : function( fieldArray ) {
var new_label = fieldArray.label.replace(/"/g, "'");
var contactField = $( '<div class="contact-form-field new">' +
var contactField = $( '<div class="contact-form-field new"><span class="dashicons dashicons-move"></span>' +
'<div class="contact-form-group">' +
'<label class="contact-form-label">Field Type</label>' +
'<select class="contact-form-control wide type-control">' +
Expand Down Expand Up @@ -1086,8 +1086,8 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
'<input type="checkbox" class="required-control">' +
'</div>' +
'<div class="contact-form-group">' +
'<a href="#" class="delete-field">Delete</a> | ' +
'<a href="#" class="copy-field">Duplicate</a>' +
'<a href="javascript:void(0)" class="delete-field">Delete</a> | ' +
'<a href="javascript:void(0)" class="copy-field">Duplicate</a>' +
'</div>' +
'</div>'
);
Expand Down Expand Up @@ -1227,20 +1227,20 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
}
});
$( '.save-contact' ).on( 'click', function() {
QSMContact.save();
QSMContact.save();
});
$( '.contact-form' ).on( 'click', '.delete-field', function( event ) {
event.preventDefault();
QSMContact.deleteField( $( this ) );
event.preventDefault();
QSMContact.deleteField( $( this ) );
});
$( '.contact-form' ).on( 'click', '.copy-field', function( event ) {
event.preventDefault();
QSMContact.duplicateField( $( this ) );
event.preventDefault();
QSMContact.duplicateField( $( this ) );
});
$( '.contact-form' ).sortable({
cursor: 'move',
opacity: 60,
placeholder: "ui-state-highlight"
opacity: 70,
cursor: 'grabbing',
handle: 'span.dashicons-move'
});
});
}
Expand Down Expand Up @@ -1492,14 +1492,15 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
data: {
'quizID': 0,
'page': $('#question_back_page_number').length > 0 ? parseInt($('#question_back_page_number').val()) + 1 : 1,
'category': $('#question-bank-cat').val()
'category': $('#question-bank-cat').val(),
'search': $('#question-bank-search-input').val()
},
success: QSMQuestion.questionBankLoadSuccess
});
},
questionBankLoadSuccess: function (questions) {
var pagination = questions.pagination;
var questions = questions.questions;
questionBankLoadSuccess: function (response) {
var pagination = response.pagination;
var questions = response.questions;
if ($('.qb-load-more-wrapper').length > 0) {
$('.qb-load-more-wrapper').remove();
} else {
Expand All @@ -1511,30 +1512,32 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
if (pagination.total_pages > pagination.current_page) {
var pagination_html = '<div class="qb-load-more-wrapper" style="text-align: center;margin: 20px 0 10px 0;"><input type="hidden" id="question_back_page_number" value="' + pagination.current_page + '"/>';
pagination_html += '<input type="hidden" id="question_back_total_pages" value="' + pagination.total_pages + '"/>';
pagination_html += '<a href="#" class="button button-primary qb-load-more-question">Load More Questions</a></div>';
pagination_html += '<a href="javascript:void(0)" class="button button-primary qb-load-more-question">Load More Questions</a></div>';
$('#question-bank').append(pagination_html);
}
if (pagination.current_page == 1 && qsmQuestionSettings.categories.length > 0) {
var category_arr = qsmQuestionSettings.categories;
$cat_html = '<select name="question-bank-cat" id="question-bank-cat">';
$cat_html += '<option value="">All Questions</option>';
$.each(category_arr, function (index, value) {
if (value.category !== '') {
if (typeof value.cat_id !== 'undefined' && value.cat_id !== '') {
$cat_html += '<option value="' + value.cat_id + '">' + value.category + ' Questions</option>';
} else {
$cat_html += '<option value="' + value.category + '">' + value.category + ' Questions</option>';
}
}
});
$cat_html += '</select>';
$('#question-bank').prepend($cat_html);
$('#question-bank-cat').val(pagination.category);
}
if (pagination.current_page == 1) {
$('#question-bank').prepend('<button class="button button-primary" id="qsm-import-selected-question">Import All Selected Questions</button>');
$('#question-bank').prepend('<button class="button button-default" id="qsm-delete-selected-question">Delete Selected Question from Bank</button>');
$('#question-bank').prepend('<label class="qsm-select-all-label"><input type="checkbox" id="qsm_select_all_question" /> Select All Question</button>');
if ($('#question-bank-search-form').length == 0) {
$('.qsm-question-bank-search').append('<form action="" method="post" id="question-bank-search-form"><input type="search" name="search" value="' + response.search + '" id="question-bank-search-input" placeholder="Search questions"></form>');
if ( qsmQuestionSettings.categories.length > 0) {
var category_arr = qsmQuestionSettings.categories;
$cat_html = '<select name="question-bank-cat" id="question-bank-cat">';
$cat_html += '<option value="">All Categories</option>';
$.each(category_arr, function (index, value) {
if (value.category !== '') {
if (typeof value.cat_id !== 'undefined' && value.cat_id !== '') {
$cat_html += '<option value="' + value.cat_id + '">' + value.category + ' Questions</option>';
} else {
$cat_html += '<option value="' + value.category + '">' + value.category + ' Questions</option>';
}
}
});
$cat_html += '</select>';
$('.qsm-question-bank-search').append($cat_html);
$('#question-bank-cat').val(pagination.category);
}
$('.qsm-question-bank-search').append('<button class="button button-primary" id="qsm-import-selected-question">Add Selected Questions</button>');
}
$('#question-bank').prepend('<div class="qsm-question-bank-select"><label class="qsm-select-all-label"><input type="checkbox" id="qsm_select_all_question" /> Select All Question</label><a href="javascript:void(0)" class="qsm-action-link-delete" id="qsm-delete-selected-question">Delete Selected Items from Question Bank</a>');
}
},
addQuestionToQuestionBank: function (question) {
Expand Down Expand Up @@ -1703,6 +1706,7 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
items: '.question',
opacity: 70,
cursor: 'move',
handle: 'span.dashicons-move',
placeholder: "ui-state-highlight",
connectWith: '.page',
stop: function (evt, ui) {
Expand All @@ -1717,12 +1721,17 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
setTimeout(QSMQuestion.removeNew, 250);
},
addNewQuestion: function (model) {
var default_answers = parseInt(qsmQuestionSettings.default_answers);
var count = 0;
QSMAdmin.displayAlert('Question created!', 'success');
QSMQuestion.addQuestionToPage(model);
QSMQuestion.openEditPopup(model.id, $('.question[data-question-id=' + model.id + ']').find('.edit-question-button'));
QSMQuestion.countTotal();
if ($('#answers').find('.answers-single').length == 0) {
$('#new-answer-button').trigger('click');
if ($('#answers').find('.answers-single').length < default_answers) {
while(count < default_answers){
$('#new-answer-button').trigger('click');
count++;
}
}
},
addQuestionToPage: function (model) {
Expand Down Expand Up @@ -2260,6 +2269,12 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
QSMQuestion.loadQuestionBank('change');
});

//Show searched question
$(document).on('submit', '#question-bank-search-form', function (event) {
event.preventDefault();
QSMQuestion.loadQuestionBank('change');
});

$('.questions').on('click', '.edit-question-button', function (event) {
event.preventDefault();
$('.qsm-category-filter').trigger('keyup');
Expand Down Expand Up @@ -2559,7 +2574,7 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
}
}


$('.qsm_hide_for_other').hide();
if ($('.qsm_show_question_type_' + question_val).length > 0) {
$('.qsm_show_question_type_' + question_val).show();
Expand Down Expand Up @@ -2680,6 +2695,7 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
$('.questions').sortable({
opacity: 70,
cursor: 'move',
handle: 'span.dashicons-move',
placeholder: "ui-state-highlight",
stop: function (evt, ui) {
$('.questions > .page').each(function () {
Expand All @@ -2696,6 +2712,7 @@ if (jQuery('body').hasClass('admin_page_mlw_quiz_options')){
});
$('.page').sortable({
items: '.question',
handle: 'span.dashicons-move',
opacity: 70,
cursor: 'move',
placeholder: "ui-state-highlight",
Expand Down
Loading

0 comments on commit c8f4060

Please sign in to comment.