<?xml version="1.0" encoding="UTF-8"?>
<javascript app="blog">
<file javascript_app="blog" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.grid.js" javascript_type="controller" javascript_version="107643" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
* ips.browse.list.js - Blog browse list controller
*
* Author: Rikki Tissier
*/
;( function($, _, undefined){
"use strict";
ips.controller.register('blog.front.browse.grid', {
initialize: function () {
this.on('click', '.cBlog_grid_item', this.clickNewsItem);
this.setup();
},
setup: function () {
},
clickNewsItem: function (e) {
var link = $( e.currentTarget ).find('[data-role="newsTitle"]');
if( $( e.target ).closest('a').length > 0 ){
return;
}
if( $( e.target ).closest('input').length > 0 ){
return;
}
window.location = link.attr('href');
}
});
}(jQuery, _));]]></file>
<file javascript_app="blog" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.list.js" javascript_type="controller" javascript_version="107643" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
* ips.browse.list.js - Blog browse list controller
*
* Author: Rikki Tissier
*/
;( function($, _, undefined){
"use strict";
ips.controller.register('blog.front.browse.list', {
initialize: function () {
this.on( 'change', '[data-role="moderation"]', this.selectEntry );
},
/**
* Toggles classes when the moderation checkbox is checked
*
* @param {event} e Event object
* @returns {void}
*/
selectEntry: function (e) {
var row = $( e.currentTarget ).closest('.cBlogView_entry');
row.toggleClass( 'cBlogView_entrySelected', $( e.currentTarget ).is(':checked') );
}
});
}(jQuery, _));</file>
<file javascript_app="blog" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.manageCategories.js" javascript_type="controller" javascript_version="107643" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
* ips.view.manageCategories.js - Blog manage categories controller
*
* Author: Matt Mecham
*/
;( function($, _, undefined){
"use strict";
ips.controller.register('blog.front.view.manageCategories', {
_sortableElem: null,
initialize: function () {
this.on( 'click', '[data-action="delete"]', this.delete );
this.on( 'click', '[data-action="edit"]', this.edit );
this.on( 'click', '[data-role="saveChanges"]', this.saveChanges );
this.on( 'click', '[data-role="cancelChanges"]', this.cancelEditing );
/* Cancel edits */
var _this = this;
$( document )
.on( 'keydown', function (e) {
if( e.keyCode == ips.ui.key.ESCAPE ){
_this.cancelEditing();
}
});
/* Save button changes */
$('.ipsTabs ul[role="tablist"] a').on( 'click', this.tabChange );
$('.ipsForm .ipsToolList').append( ips.templates.render('blog.view.addButton') );
$('[data-action="addNew"]').on( 'click', _.bind( this.newRow, this ) );
this.renderList();
this.setup();
},
setup: function () {
var self = this;
ips.loader.get( ['core/interface/jquery/jquery-ui.js'] ).then( function () {
self.scope.find('[data-role="tableRows"]')
.sortable({
placeholder: 'sortable-placeholder',
handle: '[data-role="sortHandle"]',
items: '> li',
forcePlaceholderSize: true,
update: function () {
var data = self.scope.find('[data-role="tableRows"]').sortable( 'toArray', { attribute: 'data-category-id' } )
var url = '?app=blog&module=blogs&controller=view&do=categoriesReorder&id=' + self.scope.attr('data-blog-id');
ips.getAjax()( url, {
data: {
ajax_order: data
},
method: 'POST'
})
.done( function() {
ips.ui.flashMsg.show( ips.getString('entry_cat_order_saved') );
})
.fail( function () {
window.location = url + "&ajax_order=" + data + "&csrfKey=" + ips.getSetting('csrfKey');
});
}
});
Debug.log( "Sortable categories initialized" );
});
if( !$('#form_tab_blog_entry_categories').length ) {
$('button[type="submit"]').addClass('ipsHide');
$('button[data-action="addNew"]').removeClass('ipsHide');
}
},
/**
* Cancel all editing
*
* @param {event} e Event object
* @returns {void}
*/
cancelEditing: function (e) {
e.preventDefault();
var _this = this;
this.scope.find('input[type="text"][name^="blog_name_"]').each( function( i ) {
if ( ! $(this).hasClass('ipsHide') ) {
var id = $(this).attr('data-role').replace( /^input_/, '' );
if( id == 'new' )
{
_this.renderList();
}
else
{
_this._cancelEditingRow( id );
}
}
} );
},
/**
* Cancel the text box editing
*
* @param {int} id Category ID
* @returns {void}
*/
_cancelEditingRow: function( id ) {
this.scope.find('[data-role="title_' + id + '"]').removeClass('ipsHide');
this.scope.find('[data-role="input_' + id + '"]').addClass('ipsHide');
this.scope.find('[data-role="saveChanges"][data-category-id="' + id + '"]').addClass('ipsHide');
this.scope.find('[data-role="cancelChanges"][data-category-id="' + id + '"]').addClass('ipsHide');
},
/**
* Event handler for clicking the edit button
*
* @param {event} e Event object
* @returns {void}
*/
newRow: function (e) {
var listContainer = this.scope.find('[data-role="tableRows"]');
listContainer.append( ips.templates.render( 'blog.view.categoryRow', {
cat: 'new',
name: ''
} ) );
$('[data-action="addNew"]').attr('disabled', true );
$('[data-action="delete"][data-category-id="new"],[data-action="edit"][data-category-id="new"],[data-role="sortHandle"]').hide();
$('body').find('[data-action="edit"][data-category-id="new"]').click();
this.scope.find('[data-role="tableRows"]').sortable( "disable" );
},
/**
* Re-draws the list of categories
*
*/
renderList: function() {
var _this = this;
ips.getAjax()( '?app=blog&module=blogs&controller=view&do=categoriesJson&id=' + this.scope.attr('data-blog-id') )
.done( function (response) {
if( response.categories.length ){
var listContainer = _this.scope.find('[data-role="tableRows"]');
listContainer.html('');
var json = response.categories;
for( var i = 0; i < json.length; i++ ){
listContainer.append( ips.templates.render( 'blog.view.categoryRow', {
cat: json[i].id,
name: json[i].name
} ) );
}
}
} );
$('[data-action="addNew"]').attr('disabled', false );
},
/**
* Event handler for clicking the edit button
*
* @param {event} e Event object
* @returns {void}
*/
tabChange: function (e) {
if ( ! $('#form_tab_blog_entry_categories').hasClass('ipsTabs_activeItem') ) { // This looks back to front but the tab status is changed after this has fired
$('button[type="submit"]').addClass('ipsHide');
$('button[data-action="addNew"]').removeClass('ipsHide');
} else {
$('button[type="submit"]').removeClass('ipsHide');
$('button[data-action="addNew"]').addClass('ipsHide');
}
},
/**
* Event handler for clicking the edit button
*
* @param {event} e Event object
* @returns {void}
*/
edit: function (e) {
e.preventDefault();
var a = $( e.currentTarget );
var id = a.attr('data-category-id');
var title = this.scope.find('[data-role="title_' + id + '"]');
var input = this.scope.find('[data-role="input_' + id + '"]');
var saveButton = this.scope.find('[data-role="saveChanges"][data-category-id="' + id + '"]');
var cancelLink = this.scope.find('[data-role="cancelChanges"][data-category-id="' + id + '"]');
/* Are we already editing? */
if ( ! input.hasClass('ipsHide') ) {
this._cancelEditingRow( id );
return;
}
title.addClass('ipsHide');
input.val( title.html() );
input.removeClass('ipsHide');
saveButton.removeClass('ipsHide');
cancelLink.removeClass('ipsHide');
},
/**
* Event handler for clicking a save changes button
*
* @param {event} e Event object
* @returns {void}
*/
saveChanges: function (e) {
e.preventDefault();
var a = $( e.currentTarget );
var id = a.attr('data-category-id');
var title = this.scope.find('[data-role="title_' + id + '"]');
var input = this.scope.find('[data-role="input_' + id + '"]');
var _this = this;
var langBit = a.html();
a.html(' ').addClass('ipsField_loading');
ips.getAjax()( '?app=blog&module=blogs&controller=view&do=editCategoryName&id=' + this.scope.attr('data-blog-id') + '&cat=' + id, {
data: {
name: input.val()
},
type: 'post'
} )
.done( function (response) {
_this.renderList();
_this.scope.find('[data-role="tableRows"]').sortable( "enable" );
} )
.fail( function (response) {
a.html( langBit ).removeClass('ipsField_loading');
ips.ui.flashMsg.show( response.responseJSON );
} );
},
/**
* Event handler for clicking a delete button
*
* @param {event} e Event object
* @returns {void}
*/
delete: function (e) {
e.preventDefault();
var a = $( e.currentTarget );
var id = a.attr('data-category-id');
var _this = this;
ips.ui.alert.show({
type: 'confirm',
message: ips.getString('blog_category_confirm_delete'),
subText: ips.getString('blog_category_confirm_delete_desc'),
icon: 'info',
callbacks: {
ok: function () {
if ( a.attr('data-category-id') == 'new' ) {
_this.renderList();
} else {
ips.getAjax()( '?app=blog&module=blogs&controller=view&do=deleteCategory&id=' + _this.scope.attr('data-blog-id') + '&cat=' + id )
.done( function (response) {
_this.renderList();
} )
.fail( function (response) {
ips.ui.flashMsg.show( response.responseJSON );
} );
}
}
}
});
return false;
}
});
}(jQuery, _));]]></file>
<file javascript_app="blog" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.view.js" javascript_type="template" javascript_version="107643" javascript_position="1000150"><![CDATA[/* CLASS LIST TEMPLATES */
ips.templates.set('blog.view.addButton', "\
<button type=\"button\" class=\"ipsButton ipsButton_primary ipsHide\" data-action=\"addNew\">{{#lang}}manage_cats_new_row{{/lang}}</button>\
");
ips.templates.set('blog.view.categoryRow', "\
<li class=\"ipsDataItem ipsClearfix\" itemprop=\"itemListElement\" data-category-id=\"{{cat}}\">\
<div class=\"ipsDataItem_main\">\
<span data-role=\"sortHandle\" class=\"ipsCursor_drag\"><i class=\"fa fa-bars\"></i></span> \
<span class=\"ipsDataItem_title\" data-role=\"title_{{cat}}\">{{name}}</span>\
<input type=\"text\" name=\"blog_name_{{cat}}\" value=\"\" data-role=\"input_{{cat}}\" class=\"ipsHide\">\
<a href=\"#\" data-role=\"saveChanges\" data-category-id=\"{{cat}}\" class=\"ipsHide ipsButton ipsButton_verySmall ipsButton_light ipsButton_narrow\" data-ipstooltip=\"\" title=\"{{#lang}}save{{/lang}}\">{{#lang}}save{{/lang}}</a>\
<a href=\"#\" data-role=\"cancelChanges\" data-category-id=\"{{cat}}\" class=\"ipsHide\" data-ipstooltip=\"\" title=\"{{#lang}}cancel{{/lang}}\">{{#lang}}cancel{{/lang}}</a>\
</div>\
<div class=\"ipsDataItem_generic ipsDataItem_size3 cBlog_manage_edit ipsPos_top ipsType_right\">\
<a href=\"#\" data-action=\"delete\" data-category-id=\"{{cat}}\" class=\"ipsButton ipsButton_verySmall ipsButton_light ipsButton_narrow ipsPos_right\" data-ipstooltip title=\"{{#lang}}delete{{/lang}}\"><i class=\"fa fa-times-circle\"></i></a>\
<a href=\"#\" data-action=\"edit\" data-category-id=\"{{cat}}\" class=\"ipsButton ipsButton_verySmall ipsButton_light ipsButton_narrow ipsPos_right\" data-ipstooltip title=\"{{#lang}}edit{{/lang}}\"><i class\=\"fa fa-pencil\"></i></a>\
</div>\
</li>\
");
]]></file>
<order app="global" path="/dev/js//framework/">templates
common/ips.loader.js
common/ui
common/utils
common
controllers</order>
<order app="global" path="/dev/js//library/">underscore
jquery
mustache
IntersectionObserver
Debug.js
app.js</order>
<order app="global" path="/dev/js//library//jquery">jquery.js
jquery-migrate.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>