Phoenix303 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/181953
Change subject: Enable Save button in collection on changing its content
......................................................................
Enable Save button in collection on changing its content
The commit changes has been made to enable save button on keypress event
of title and subtitle, on change of papersize, toc or columns, on
creating new chapter and on sorting alphabetically. I have used Ajax for
"Sorting alphabetically" while originally "Sorting
alphabetically" sorts the articles and then refreshes the page.
Bug: T62574
Change-Id: I552a5f8997a7a17fd68f89b574cd1de13b019471
---
M Collection.php
M Collection.templates.php
M js/collection.js
3 files changed, 23 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Collection
refs/changes/53/181953/1
diff --git a/Collection.php b/Collection.php
index 181f7cc..ff2997a 100644
--- a/Collection.php
+++ b/Collection.php
@@ -498,3 +498,10 @@
}
$wgAjaxExportList[] = 'wfAjaxCollectionSuggestUndoArticle';
+//Bug T62574
+function wfAjaxCollectionSortItems( $items_string ) {
+ SpecialCollection::sortItems();
+ return wfAjaxCollectionGetItemList();
+}
+
+$wgAjaxExportList[] = 'wfAjaxCollectionSortItems';
diff --git a/Collection.templates.php b/Collection.templates.php
index 1d89aca..c0317b0 100644
--- a/Collection.templates.php
+++ b/Collection.templates.php
@@ -246,7 +246,7 @@
<div class="collection-create-chapter-links">
<a class="makeVisible" style="<?php if ( !isset( $this->data['is_ajax'] ) ) {
echo ' display:none;'; } ?>" onclick="return coll_create_chapter()"
href="javascript:void(0);"><?php $this->msg( 'coll-create_chapter' ) ?></a>
<?php if ( count( $this->data['collection']['items'] ) > 0 ) { ?>
-<a href="<?php echo htmlspecialchars( SkinTemplate::makeSpecialUrl( 'Book',
array( 'bookcmd' => 'sort_items' ) ) ) ?>"><?php $this->msg(
'coll-sort_alphabetically' ) ?></a>
+<a class="makeVisible" style="<?php if ( !isset( $this->data['is_ajax'] ) ) {
echo ' display:none;'; } ?>" onclick="return coll_sort_items()"
href="javascript:void(0);"><?php $this->msg( 'coll-sort_alphabetically' ) ?></a>
<a onclick="return coll_clear_collection()" href="<?php echo htmlspecialchars(
SkinTemplate::makeSpecialUrl( 'Book', array( 'bookcmd' => 'clear_collection' )
) ) ?>"><?php $this->msg( 'coll-clear_collection' ) ?></a>
<?php } ?>
</div>
diff --git a/js/collection.js b/js/collection.js
index 724a7fe..c85eabf 100644
--- a/js/collection.js
+++ b/js/collection.js
@@ -108,6 +108,7 @@
if (name) {
name = name.substring(0, chapter_max_len);
req('AddChapter', [name], refresh_list);
+ update_buttons(); // Bug T62574
}
return false;
}
@@ -201,6 +202,16 @@
make_sortable();
update_buttons();
}
+// Bug T62574
+function sort_items(){
+ req('SortItems', [], refresh_list);
+ return false;
+}
+function update_titles_button(){
+
+ set_titles();
+ update_buttons();
+}
$(function() {
if ($('#collectionList').length) {
@@ -209,6 +220,7 @@
window.coll_remove_item = remove_item;
window.coll_rename_chapter = rename_chapter;
window.coll_clear_collection = clear_collection;
+ window.coll_sort_items = sort_items;
update_buttons();
make_sortable();
$('#coll-orderbox
li.collection-partner.coll-more_info.collapsed').css(
@@ -237,8 +249,10 @@
$('#personalCollType').change(update_buttons);
$('#communityCollType').change(update_buttons);
$('#titleInput').change(set_titles);
+ $('#titleInput').keypress(update_buttons);
$('#subtitleInput').change(set_titles);
- $( '[id^="coll-input-setting-"]' ).change(set_titles);
+ $('#subtitleInput').keypress(update_buttons);
+ $( '[id^="coll-input-setting-"]' ).change(update_titles_button);
}
if (typeof collection_rendering != 'undefined') {
getMWServeStatus();
--
To view, visit https://gerrit.wikimedia.org/r/181953
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I552a5f8997a7a17fd68f89b574cd1de13b019471
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Collection
Gerrit-Branch: master
Gerrit-Owner: Phoenix303 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits