jenkins-bot has submitted this change and it was merged.
Change subject: Conform settings to metabook.json spec
......................................................................
Conform settings to metabook.json spec
* Renames showtoc to toc
* Sets the default columns to 2
* Adds auto as an option for the toc
* Fixes handling checkboxes in js
* Puts the settings directly on the metabook object
Bug: 68836
Change-Id: I2e0941925284d32756118d01043f5215ddd51401
---
M Collection.php
M RenderingAPI.php
M i18n/en.json
M i18n/qqq.json
M js/collection.js
5 files changed, 30 insertions(+), 13 deletions(-)
Approvals:
Cscott: Looks good to me, approved
Siebrand: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/Collection.php b/Collection.php
index aa82ba6..7297160 100644
--- a/Collection.php
+++ b/Collection.php
@@ -112,21 +112,26 @@
'papersize' => array(
'type' => 'select',
'label-message' => 'coll-setting-papersize',
- 'default' => 'A4',
+ 'default' => 'a4',
'options' => array(
- 'coll-setting-papersize-a4' => 'A4',
- 'coll-setting-papersize-letter' => 'Letter',
+ 'coll-setting-papersize-a4' => 'a4',
+ 'coll-setting-papersize-letter' => 'letter',
),
),
- 'showtoc' => array(
- 'type' => 'check',
- 'label-message' => 'coll-setting-showtoc',
- 'default' => true,
+ 'toc' => array(
+ 'type' => 'select',
+ 'label-message' => 'coll-setting-toc',
+ 'default' => 'auto',
+ 'options' => array(
+ 'coll-setting-toc-auto' => 'auto',
+ 'coll-setting-toc-yes' => 'yes',
+ 'coll-setting-toc-no' => 'no',
+ )
),
'columns' => array(
'type' => 'select',
'label-message' => 'coll-setting-columns',
- 'default' => 1,
+ 'default' => '2',
'options' => array(
'coll-setting-columns-1' => '1',
'coll-setting-columns-2' => '2',
diff --git a/RenderingAPI.php b/RenderingAPI.php
index c031f6f..ad43420 100644
--- a/RenderingAPI.php
+++ b/RenderingAPI.php
@@ -174,7 +174,9 @@
$result['subtitle'] = $collection['subtitle'];
}
if ( isset( $collection['settings'] ) ) {
- $result['settings'] = $collection['settings'];
+ foreach ( $collection['settings'] as $key => $val ) {
+ $result[$key] = $val;
+ }
}
$items = array();
diff --git a/i18n/en.json b/i18n/en.json
index 8b7986a..b6d019b 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -170,7 +170,10 @@
"coll-setting-papersize": "Paper size:",
"coll-setting-papersize-a4": "A4",
"coll-setting-papersize-letter": "Letter",
- "coll-setting-showtoc": "Include a table of contents",
+ "coll-setting-toc": "Include a table of contents",
+ "coll-setting-toc-auto": "Auto",
+ "coll-setting-toc-yes": "Yes",
+ "coll-setting-toc-no": "No",
"coll-setting-columns": "Columns:",
"coll-setting-columns-1": "1",
"coll-setting-columns-2": "2",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 4844bec..1912a8a 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -182,9 +182,12 @@
"coll-user_book_prefix": "{{notranslate}}",
"coll-community_book_prefix": "{{notranslate}}",
"coll-setting-papersize": "Label for the \"paper size\" option.\n\nSee
also:\n* {{msg-mw|Coll-setting-papersize-a4}}\n*
{{msg-mw|Coll-setting-papersize-letter}}\n{{Identical|Paper size}}",
- "coll-setting-papersize-a4": "{{optional}} Name for the A4 paper
size\nSee also:\n* {{msg-mw|Coll-setting-papersize}}\n*
{{msg-mw|Coll-setting-papersize-letter}}",
+ "coll-setting-papersize-a4": "{{optional}} Name for the A4 paper
size\n\nSee also:\n* {{msg-mw|Coll-setting-papersize}}\n*
{{msg-mw|Coll-setting-papersize-letter}}",
"coll-setting-papersize-letter": "Name for the US Letter paper
size\n\nSee also:\n* {{msg-mw|Coll-setting-papersize}}\n*
{{msg-mw|Coll-setting-papersize-a4}}\n{{Identical|Letter}}",
- "coll-setting-showtoc": "Label for the \"include a table of contents\"
checkbox.\n\nPreceded by {{msg-mw|Coll-setting-papersize}}.\n\nFollowed by
{{msg-mw|Coll-setting-columns}}.",
+ "coll-setting-toc": "Label for the \"include a table of contents\"
option.\n\nPreceded by {{msg-mw|Coll-setting-papersize}}.\n\nFollowed by
{{msg-mw|Coll-setting-columns}}.",
+ "coll-setting-toc-auto": "Used to let the backend service decide
automatically if a table of contents should be added.\n\nSee also:\n*
{{msg-mw|Coll-setting-toc}}",
+ "coll-setting-toc-yes": "Used to indicate a table of contents is
desired.\n\nSee also:\n* {{msg-mw|Coll-setting-toc}}\n{Identical|Yes}}",
+ "coll-setting-toc-no": "Used to indicate a table of contents is not
desired.\n\nSee also:\n* {{msg-mw|Coll-setting-toc}}\n{Identical|No}}",
"coll-setting-columns": "Label for the \"number of columns\"
option.\n\nSee also:\n* {{msg-mw|Coll-setting-columns-1}}\n*
{{msg-mw|Coll-setting-columns-2}}\n{{Identical|Column}}",
"coll-setting-columns-1": "{{optional}}\n\nSee also:\n*
{{msg-mw|Coll-setting-columns}}\n* {{msg-mw|Coll-setting-columns-2}}",
"coll-setting-columns-2": "{{optional}}\n\nSee also:\n*
{{msg-mw|Coll-setting-columns}}\n* {{msg-mw|Coll-setting-columns-1}}",
diff --git a/js/collection.js b/js/collection.js
index 8cbcbe1..cdac10c 100644
--- a/js/collection.js
+++ b/js/collection.js
@@ -136,7 +136,11 @@
function set_titles() {
var settings = {};
$( '[id^="coll-input-setting-"]' ).each( function ( i, e ) {
- settings[e.name] = $( e ).val();
+ if ( $( e ).is(':checkbox') ) {
+ settings[e.name] = $( e ).is(':checked');
+ } else {
+ settings[e.name] = $( e ).val();
+ }
} );
req('SetTitles', [$('#titleInput').val(), $('#subtitleInput').val(),
$.toJSON( settings )], function(result) {
wfCollectionSave(result.collection);
--
To view, visit https://gerrit.wikimedia.org/r/160911
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2e0941925284d32756118d01043f5215ddd51401
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Collection
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits