Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,8 +1,233 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<javascript app="forums">
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/forum" javascript_name="ips.forum.forumList.js" javascript_type="controller" javascript_version="101099" javascript_position="1000050"><![CDATA[/**
|
||||
* IPS Community Suite 4
|
||||
* (c) 2013 Invision Power Services - http://www.invisionpower.com
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/forum" javascript_name="ips.forum.flow.js" javascript_type="controller" javascript_version="102002" javascript_position="1000050"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
* ips.forum.flow.js - Flow filter controller
|
||||
*
|
||||
* Author: Matt Mecham, certainly not Rikki Tissier (yet)
|
||||
*/
|
||||
;( function($, _, undefined){
|
||||
"use strict";
|
||||
|
||||
ips.controller.register('forums.front.forum.flow', {
|
||||
|
||||
_ids: [],
|
||||
_button: null,
|
||||
|
||||
initialize: function () {
|
||||
this.on( 'click', '[data-node-id]', this.toggleFilters );
|
||||
|
||||
this.setup();
|
||||
},
|
||||
|
||||
/**
|
||||
* Um, set up...
|
||||
*/
|
||||
setup: function () {
|
||||
/* Populate forum IDs */
|
||||
var _ids = ips.utils.url.getParam( 'forumId' );
|
||||
|
||||
if ( ! _.isUndefined( _ids ) ) {
|
||||
/* Check URL */
|
||||
this._ids = decodeURIComponent( ips.utils.url.getParam( 'forumId' ) ).split(',');
|
||||
} else if( ! _.isUndefined( ips.utils.cookie.get('forums_flowIds') ) ) {
|
||||
/* Check local storage */
|
||||
var _ids = ips.utils.cookie.get('forums_flowIds').split(',');
|
||||
var self = this;
|
||||
if( _.isObject( _ids ) && _.size( _ids ) ){
|
||||
_.each( _ids, function (val, key) {
|
||||
if ( val ) {
|
||||
self.childSelect( val );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this._button = $('body').find('[data-role="fluidForumMobileDesc"]');
|
||||
this._updateButtonText();
|
||||
},
|
||||
|
||||
/**
|
||||
* Event handler for toggling a filter
|
||||
*
|
||||
* @param {event} e Event object
|
||||
* @returns {void}
|
||||
*/
|
||||
toggleFilters: function (e) {
|
||||
e.preventDefault();
|
||||
var link = $( e.currentTarget );
|
||||
var id = link.attr('data-node-id');
|
||||
var parentId = link.attr('data-parent-id');
|
||||
var hasChildren = link.attr('data-has-children');
|
||||
|
||||
if ( _.indexOf( this._ids, id ) == -1 ) {
|
||||
/* Does not exist, so add it */
|
||||
this.childSelect( id );
|
||||
|
||||
} else {
|
||||
/* Exists, so remove it */
|
||||
this.childUnselect( id );
|
||||
}
|
||||
|
||||
this._updateButtonText();
|
||||
|
||||
$( document ).trigger( 'updateTableURL', { forumId: this._ids.join(',') } );
|
||||
},
|
||||
|
||||
/**
|
||||
* Is item selected
|
||||
*
|
||||
*/
|
||||
isSelected: function(id) {
|
||||
return this.scope.find('[data-node-id="' + id + '"]').hasClass('cForumMiniList_selected') ? true : false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Select a child
|
||||
*
|
||||
*/
|
||||
childSelect: function(id) {
|
||||
Debug.log("Select child: " + id );
|
||||
this._ids.push( id );
|
||||
var node = this.scope.find('[data-node-id="' + id + '"]');
|
||||
node.addClass('cForumMiniList_selected');
|
||||
var parentId = node.attr('data-parent-id');
|
||||
|
||||
this.updateCookie();
|
||||
|
||||
/* Now unselect any parents */
|
||||
if ( id != parentId ) {
|
||||
this.parentUnselect( parentId );
|
||||
}
|
||||
|
||||
/* Mark any children, but we do not need to keep individual row markings */
|
||||
if ( node.attr('data-has-children') || id == parentId ) {
|
||||
node.closest('li').addClass('cForumMiniList_categorySelected');
|
||||
|
||||
var self = this;
|
||||
_.each( this.scope.find('[data-parent-id="' + id + '"]'), function( v, k ) {
|
||||
var _cId = $(v).attr('data-node-id');
|
||||
if ( _cId != id ) {
|
||||
self.childUnselect( _cId );
|
||||
}
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Unselect a child
|
||||
*
|
||||
*/
|
||||
childUnselect: function(id) {
|
||||
Debug.log("UNselect child: " + id );
|
||||
/* Remove marking */
|
||||
this.scope.find('[data-node-id="' + id + '"]').removeClass('cForumMiniList_selected');
|
||||
this.scope.find('[data-node-id="' + id + '"]').closest('li').removeClass('cForumMiniList_categorySelected');
|
||||
|
||||
/* Remove from local storage and id stack */
|
||||
this._ids = _.without( this._ids, id );
|
||||
this.updateCookie();
|
||||
|
||||
/* Check for children of this and unselect those too */
|
||||
var self = this;
|
||||
_.each( this.scope.find('[data-parent-id="' + id + '"]'), function( v, k ) {
|
||||
var _cId = $(v).attr('data-node-id');
|
||||
if ( _cId != id ) {
|
||||
self.childUnselect( _cId );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Select a parent
|
||||
*
|
||||
*/
|
||||
parentSelect: function(parentId) {
|
||||
Debug.log("Select parent: " + parentId );
|
||||
/* Mark category and children as selected */
|
||||
this.scope.find('[data-node-id="' + parentId + '"]').addClass('cForumMiniList_selected');
|
||||
this.scope.find('[data-node-id="' + parentId + '"]').closest('li').addClass('cForumMiniList_categorySelected');
|
||||
|
||||
/* Remove children from the arrays as PHP handles this */
|
||||
var self = this;
|
||||
_.each( this.scope.find('[data-parent-id="' + parentId + '"]'), function( v, k ) {
|
||||
var _cId = $(v).attr('data-node-id');
|
||||
|
||||
if ( _cId != parentId ) {
|
||||
self.childUnselect( _cId );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Unselect a parent
|
||||
*
|
||||
*/
|
||||
parentUnselect: function(parentId) {
|
||||
Debug.log("UNselect parent: " + parentId );
|
||||
/* Unselect parent as marked */
|
||||
var node = this.scope.find('[data-node-id="' + parentId + '"]');
|
||||
node.removeClass('cForumMiniList_selected');
|
||||
node.closest('li').removeClass('cForumMiniList_categorySelected');
|
||||
|
||||
this._ids = _.without( this._ids, parentId );
|
||||
this.updateCookie();
|
||||
|
||||
/* Off up the tree we go */
|
||||
Debug.log( "Looking for parent ID " + node.attr('data-parent-id') );
|
||||
var self = this;
|
||||
_.each( this.scope.find('[data-node-id="' + node.attr('data-parent-id') + '"]'), function( v, k ) {
|
||||
var _cId = $(v).attr('data-node-id');
|
||||
if ( _cId != parentId ) {
|
||||
Debug.log( "Found " + _cId );
|
||||
self.parentUnselect( _cId );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the cookie
|
||||
*/
|
||||
updateCookie: function(id) {
|
||||
var cookie = _.uniq( _.values( this._ids ) ).join(',');
|
||||
Debug.log("Updating cookie: " + cookie );
|
||||
|
||||
ips.utils.cookie.set('forums_flowIds', cookie, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the mobile button text based on selected forums
|
||||
*
|
||||
* @param {event} e The submit event
|
||||
* @param {element} elem The element this widget is being created on
|
||||
* @returns {void}
|
||||
*/
|
||||
_updateButtonText: function () {
|
||||
var blobs = this.scope.find('.cForumMiniList_blob');
|
||||
var selectedBlobRows = blobs.filter( function () {
|
||||
if( $( this ).closest('.cForumMiniList_selected, .cForumMiniList_categorySelected').length ){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
var text = '';
|
||||
|
||||
// If the counts are the same, we know we've selected all of them
|
||||
if( blobs.length == selectedBlobRows.length || selectedBlobRows.length === 0 ){
|
||||
text = ips.getString('topicsFromAllForums');
|
||||
} else {
|
||||
text = ips.pluralize( ips.getString( 'topicsFromXForums' ), selectedBlobRows.length );
|
||||
}
|
||||
|
||||
this._button.text( text );
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/forum" javascript_name="ips.forum.forumList.js" javascript_type="controller" javascript_version="102002" javascript_position="1000050"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
* ips.forum.forumList.js - Controller for a forum listing
|
||||
*
|
||||
@@ -67,9 +292,9 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/forum" javascript_name="ips.forum.forumPage.js" javascript_type="controller" javascript_version="101099" javascript_position="1000050">/**
|
||||
* IPS Community Suite 4
|
||||
* (c) 2013 Invision Power Services - http://www.invisionpower.com
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/forum" javascript_name="ips.forum.forumPage.js" javascript_type="controller" javascript_version="102002" javascript_position="1000050">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
* ips.forum.forumPage.js - Forum page controller
|
||||
*
|
||||
@@ -93,25 +318,42 @@
|
||||
markForumRead: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Trigger event on the table to hide unread markets
|
||||
this.triggerOn( 'core.global.core.table', 'markTableRead' );
|
||||
var self = this;
|
||||
|
||||
// Hide the link we've just clicked
|
||||
ips.utils.anim.go( 'fadeOut', $( e.currentTarget ) );
|
||||
ips.ui.alert.show( {
|
||||
type: 'confirm',
|
||||
icon: 'question',
|
||||
message: ips.getString('markForumAsReadConfirm'),
|
||||
subText: '',
|
||||
callbacks: {
|
||||
ok: function () {
|
||||
var url = $( e.currentTarget ).attr('href');
|
||||
|
||||
// Do request to do the marking
|
||||
ips.getAjax()( $( e.currentTarget ).attr('href'), {
|
||||
bypassRedirect: true
|
||||
} )
|
||||
.done( function () {
|
||||
ips.ui.flashMsg.show( ips.getString('forumMarkedRead') );
|
||||
});
|
||||
ips.getAjax()( url, {
|
||||
showLoading: true,
|
||||
bypassRedirect: true
|
||||
})
|
||||
.done( function () {
|
||||
// Trigger event on the table to hide unread markets
|
||||
self.triggerOn( 'core.global.core.table', 'markTableRead' );
|
||||
|
||||
// Hide the link we've just clicked
|
||||
ips.utils.anim.go( 'fadeOut', $( e.currentTarget ) );
|
||||
|
||||
ips.ui.flashMsg.show( ips.getString('forumMarkedRead') );
|
||||
})
|
||||
.fail( function (jqXHR, textStatus, errorThrown) {
|
||||
window.location = url;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/forum" javascript_name="ips.forum.hovercard.js" javascript_type="controller" javascript_version="101099" javascript_position="1000050">/**
|
||||
* IPS Community Suite 4
|
||||
* (c) 2013 Invision Power Services - http://www.invisionpower.com
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/forum" javascript_name="ips.forum.hovercard.js" javascript_type="controller" javascript_version="102002" javascript_position="1000050">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
* ips.forum.hovercard.js - Topic hovercard in forum view
|
||||
*
|
||||
@@ -159,9 +401,9 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="forums" javascript_location="admin" javascript_path="controllers/settings" javascript_name="ips.settings.archiveRules.js" javascript_type="controller" javascript_version="101099" javascript_position="1000050"><![CDATA[/**
|
||||
* IPS Community Suite 4
|
||||
* (c) 2013 Invision Power Services - http://www.invisionpower.com
|
||||
<file javascript_app="forums" javascript_location="admin" javascript_path="controllers/settings" javascript_name="ips.settings.archiveRules.js" javascript_type="controller" javascript_version="102002" javascript_position="1000050"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
* ips.forums.archiveRules.js - makes the progress bar increase as archive rules settings are changed
|
||||
*
|
||||
@@ -224,9 +466,9 @@
|
||||
});
|
||||
}(jQuery, _));
|
||||
]]></file>
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/topic" javascript_name="ips.topic.answers.js" javascript_type="controller" javascript_version="101099" javascript_position="1000100"><![CDATA[/**
|
||||
* IPS Community Suite 4
|
||||
* (c) 2013 Invision Power Services - http://www.invisionpower.com
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/topic" javascript_name="ips.topic.answers.js" javascript_type="controller" javascript_version="102002" javascript_position="1000100"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
* ips.topic.answers.js - Profile body controller
|
||||
*
|
||||
@@ -322,9 +564,9 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/topic" javascript_name="ips.topic.reply.js" javascript_type="controller" javascript_version="101099" javascript_position="1000100">/**
|
||||
* IPS Community Suite 4
|
||||
* (c) 2013 Invision Power Services - http://www.invisionpower.com
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/topic" javascript_name="ips.topic.reply.js" javascript_type="controller" javascript_version="102002" javascript_position="1000100">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
* ips.topic.reply.js - Topic reply controller for "Reply" button
|
||||
*
|
||||
@@ -351,9 +593,9 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/topic" javascript_name="ips.topic.view.js" javascript_type="controller" javascript_version="101099" javascript_position="1000100">/**
|
||||
* IPS Community Suite 4
|
||||
* (c) 2013 Invision Power Services - http://www.invisionpower.com
|
||||
<file javascript_app="forums" javascript_location="front" javascript_path="controllers/topic" javascript_name="ips.topic.view.js" javascript_type="controller" javascript_version="102002" javascript_position="1000100">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
* ips.topic.view.js - Topic view controller
|
||||
*
|
||||
@@ -398,4 +640,6 @@ app.js</order>
|
||||
<order app="global" path="/dev/js//library//jquery">jquery.js
|
||||
jquery.history.js
|
||||
jquery.transform.js</order>
|
||||
<order app="global" path="/dev/js//library//linkify">linkify.min.js
|
||||
linkify-jquery.min.js</order>
|
||||
</javascript>
|
||||
Reference in new issue
Block a user