Skip to content

Commit

Permalink
Merge branch 'release/0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
garex committed Nov 16, 2014
2 parents 9b641d9 + ff671cd commit 602da6f
Show file tree
Hide file tree
Showing 62 changed files with 4,037 additions and 64 deletions.
9 changes: 9 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[main]
host = https://www.transifex.com

[wp-testing.wp-testing]
file_filter = languages/wp-testing-<lang>.po
source_file = languages/wp-testing.pot
source_lang = en
type = PO
minimum_perc = 80
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
## Changelog ##


## 0.5 ##
Localization and quick fill

* Localize to six languages with help of [Transifiex](https://www.transifex.com/projects/p/wp-testing/)
* Add understandable labels for no-questions/no-answers and other no-something cases in test editor
* Quick fill questions from text
* Quick fill scores from questions separated by commas
* Update docs and add screenshots


### 0.4.2 ###
Fix pages disapperance and form formatting

Expand Down
37 changes: 31 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**Tags:** psychological, testing, test, quiz
**Requires at least:** 3.2
**Tested up to:** 3.9
**Stable tag:** 0.4.2
**Stable tag:** 0.5
**License:** GPLv3
**License URI:** http://www.gnu.org/licenses/gpl-3.0.html

Expand All @@ -15,17 +15,25 @@ Create psychological tests/quizes with scales connected with results through sim

With the help of this plugin now you can create typical and advanced psychological tests (quizes, assessments).

Typical psychological test consists of questions and answers. A respondent answers all of the qoestions and gets results. This is how the box outside looks like.
Typical psychological test consists of **questions** and **answers**. A respondent answers all of the questions and gets **results**. This is how the box outside looks like.

Inside the box we also have scales each connected with the particular answer with scores and results, that are calculated with the help of simple formulas like: "extraversion > 50%". Where "extraversion" is a sum of respondent's scores from extraversion scale. We didn't invent anything new — all this has been already invented in 19th century.
Inside the box we also have **scales** each connected with the particular answer with **scores** and **results**, that are calculated with the help of **simple formulas** like: "extraversion > 50%". Where "extraversion" is a sum of respondent's scores from extraversion scale. We didn't invent anything new — all this has been already invented in 19th century.

Test answers, scales, results and categories are edited through wordpress standard editors, similar to categories editor. You can associate them in sidebar. Whether test questions, answers and formulas are edited with standard wordpress metaboxes, behind content. You can even reorder them if you like. At the top of content editor you have button for quick access to those metaboxes: Add New Questions, Edit Questions, Edit Formulas.
Test answers, scales, results and categories are edited through **wordpress standard editors**, similar to categories editor. You can associate them in sidebar. Whether test questions, answers and formulas are edited with standard wordpress metaboxes, behind content. You can even reorder them if you like. At the top of content editor you have **button for quick access** to those metaboxes: Add New Questions, Edit Questions and Scores, Edit Formulas.

As to formulas you can be sure — we have simple formula editor, that has buttons for each scale (with sum of it's scores) and allowed comparisions.
As to **formulas** you can be sure — we have simple formula editor, that has buttons for each scale (with sum of it's scores) and allowed comparisions.

Tests are treated for WordPress like posts — they appear on home page and inside their categories pages if selected. But if you don't want your test to appear on home page you can uncheck **"Publish on the home page"** in "Publish" metabox and this particular test will not appear on homepage.

To minimize author's time we have **Quick Fill** for questions and scores. You can **quick fill questions from text** and they will fill appropriate fields. Same way you can **Quick Fill Scores** in many questions some answer+scale combination.

Wp-testing localized in six languages: English, Russian (native speaker), German, French, Dutch and Swedish. English and Russian have good quality — others need review. You can easily add your language through excellent [Transifiex](https://www.transifex.com/projects/p/wp-testing/) service. **Translators** and *reviewers* are kindly welcome!

**Quality** and **compatibility** are taken really seriously. Plugin tested on [37 combinations](https://travis-ci.org/garex/wp-testing) of WordPress (from 3.2 to 4.0) and PHP (from 5.2 to 5.5) plus one custom combination for old MySQL storage engine (MyISAM). So you can be sure, that it will just work, even if you don't have the latest WordPress or your hosting doesn't have the latest versions of PHP/MySQL. [Build status image](https://travis-ci.org/garex/wp-testing.svg?branch=develop) is available.

[![Build Status](https://travis-ci.org/garex/wp-testing.svg?branch=develop)](https://travis-ci.org/garex/wp-testing)

ps: **If something broken or not works**, pls create new topic in "Support" tab here!
PS: **If something broken or doesn't work**, pls create new topic in ["Support" tab](https://wordpress.org/support/plugin/wp-testing)!

## Installation ##

Expand All @@ -41,3 +49,20 @@ ps: **If something broken or not works**, pls create new topic in "Support" tab
* WordPress version **3.2** or higher.
* PHP version **5.2.4** or higher.
* MySQL version **5.0** or higher.

## Screenshots ##

1. Test editing section with menu in admin
2. Test editing section. There are fast acces buttons like "add new questions" at the top of the page. The choise of answers and scales is available in the sidebar.
3. Here we can see "Edit Questions and Scores" box where every scale has a sum of scores
4. The "Quick Fill Scores" box is opened that allows us quickly enter scores from the questions separated by commas
5. Fast adding questions from text
6. Editing formulas
7. Ready test on the home page
8. The page with the description of the test, questions and answers
9. The button is desabled untill all questions are not answered
10. Get test results after all questions are answered
11. The results page
12. The result page contains both the result of the test and the scales that create a result
13. The example of the test without scores
14. A test without scores is shown like a "Test is under construction"
Binary file added assets-wp-repo/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/icon.xcf
Binary file not shown.
Binary file added assets-wp-repo/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets-wp-repo/screenshot-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,42 @@ table.wpt_formulas_helper {
.wpt_formulas .wpt_formula input {
width: 100%;
}

#wpt_quick_fill_scores,
#wpt_quick_fill_questions {
margin-bottom: 1em;
}

#wpt_quick_fill_questions textarea {
height: 30em;
width: 100%;
}

table.wpt_quick_scores {
margin-bottom: 0.5em;
}

table.wpt_quick_scores th {
text-align: center;
}

table.wpt_quick_scores th.questions {
width: 90%;
}
table.wpt_quick_scores td {
white-space: nowrap;
}
table.wpt_quick_scores td.answer {
text-align: center;
}
table.wpt_quick_scores th.score,
table.wpt_quick_scores td.score {
padding-right: 0em;
}
table.wpt_quick_scores td.score input {
text-align: center;
width: 5em;
}
table.wpt_quick_scores td.questions input {
width: 100%;
}
43 changes: 43 additions & 0 deletions css/public.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,46 @@
.wpt_test .get_results .content {
color: gray;
}

/* @see gootstrap .bs-callout */
/* common */
.wpt_danger,
.wpt_warning,
.wpt_info {
padding: 1.2em;
margin: 1.2em 0;
border: 1px solid #eee;
border-left-width: 5px;
border-radius: 3px;
}
.wpt_danger h1, .wpt_danger h2, .wpt_danger h3, .wpt_danger h4,
.wpt_warning h1, .wpt_warning h2, .wpt_warning h3, .wpt_warning h4,
.wpt_info h1, .wpt_info h2, .wpt_info h3, .wpt_info h4 {
margin-top: 0;
margin-bottom: 1em;
font-weight: bold;
}
.wpt_danger p:last-child,
.wpt_warning p:last-child,
.wpt_info p:last-child {
margin-bottom: 0em;
}
/* colors */
.wpt_danger {
border-left-color: #d9534f;
}
.wpt_danger h1, .wpt_danger h2, .wpt_danger h3, .wpt_danger h4 {
color: #d9534f;
}
.wpt_warning {
border-left-color: #f0ad4e;
}
.wpt_warning h1, .wpt_warning h2, .wpt_warning h3, .wpt_warning h4 {
color: #f0ad4e;
}
.wpt_info {
border-left-color: #5bc0de;
}
.wpt_info h1, .wpt_info h2, .wpt_info h3, .wpt_info h4 {
color: #5bc0de;
}
10 changes: 10 additions & 0 deletions db/sql/scales-min-max-sum.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SELECT
SUM(IF(score_value > 0, 0, score_value)) AS total_negative,
SUM(IF(score_value > 0, score_value, 0)) AS total_positive
FROM
wp_t_scores
WHERE
question_id IN (84 , 85, 0)
AND scale_id = 15
GROUP BY scale_id
HAVING total_positive > total_negative;
77 changes: 77 additions & 0 deletions js/test-quick-questions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
jQuery(document).ready(function($) {
var box = $('#wpt_quick_fill_questions'),
toggle = box.find('.toggle'),
panel = box.find('.wp-hidden-child'),
ok = box.find('.button'),
text = box.find('textarea'),
table = $('#wpt_add_questions table.wpt_questions');

toggle.click(function() {
panel.toggle();
return false;
});

ok.click(function() {
var source = text.val(),
questions = parseQuestions(source);

fillQuestions(questions);

text.val('');
panel.toggle();
});

function parseQuestions(source) {
var result = [];

source = $.trim(source);
if (source == '') {
return result;
}

result = source.split(/[\r\n]+/);

jQuery.each(result, function(i, row) {
result[i] = $.trim(row.replace(/^\w{1,3}[^\w\s]\s+/, ''));
});

return result;
};

function fillQuestions(newQuestions) {
if (newQuestions.length == 0) {
return;
}

// Merge existing questions with new
var questions = [];
table.find('input:text').each(function() {
if ($(this).val() != '') {
questions.push($(this).val());
}
});
$(newQuestions).each(function(i, newQuestion) {
questions.push(newQuestion);
});

// Redraw table
var startFrom = table.data('startFrom'),
firstRow = table.find('tr:first').removeClass('bar').remove();

table.find('tr').remove();

$(questions).each(function(i, question) {
var inputNameKey = 'wpt_question_title[' + JSON.stringify({"i": startFrom + i, "id": ''}) + ']';
firstRow
.clone()
.addClass(i % 2 ? 'alternate' : 'bar')
.appendTo(table)
.find('input')
.val(question)
.attr('name', inputNameKey)
.attr('id', 'wpt_question_title_' + (startFrom + i));
});

};

});
61 changes: 61 additions & 0 deletions js/test-quick-scores.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
jQuery(document).ready(function($) {
var box = $('#wpt_quick_fill_scores'),
sourceRows = box.find('table tr.quick-score'),
targetTable = $('#wpt_edit_questions table.wpt_questions'),
toggle = box.find('.toggle'),
panel = box.find('.wp-hidden-child'),
ok = box.find('.button');

toggle.click(function() {
fillUpSourceTableFromTarget();
panel.toggle();
return false;
});

ok.click(function() {
sourceRows.each(function() {
var quickClass = $(this).data('quickScoreClass'),
score = $(this).find('.score input').val(),
questions = $(this).find('.questions input').val().split(/[^\d]+/),
target = targetTable.find('.' + quickClass);

target.val('');
$(questions).each(function(i, questionNumber) {
if ('' == questionNumber) {
return;
}
target.filter('.question-' + questionNumber).val(score);
});
});

panel.toggle();
});

function fillUpSourceTableFromTarget() {
sourceRows.each(function() {
var quickClass = $(this).data('quickScoreClass'),
target = targetTable.find('.' + quickClass),
questions = [];
scores = [];

target.each(function() {
var value = $(this).val();
if ('' == value) {
return;
}
scores.push(value);
questions.push($(this).data('questionNumber'));
});
$(this).find('.questions input').val(questions.join(', '));

scores = _.uniq(scores);
var score = 1;
if (scores.length == 1) {
score = scores[0];
} else if (scores.length > 1) {
score = '';
}
$(this).find('.score input').val(score);
});
};
});
Loading

0 comments on commit 602da6f

Please sign in to comment.