Frontend tweaks to podcasting + new abstract datatables functionality

This commit is contained in:
Duncan Sommerville 2015-09-21 12:40:05 -04:00
parent 3db20bd3b5
commit 373ff55923
10 changed files with 82 additions and 66 deletions

View file

@ -289,18 +289,23 @@ function getUsabilityHint() {
});
}
function setupTextScrolling(parent, selector) {
parent.on("mouseenter", selector, function () {
var sw = $(this)[0].scrollWidth - parseFloat($(this).css("textIndent")), iw = $(this).innerWidth();
if (sw > iw) {
// Set up text scrolling for all tags matching selector within the calling element(s)
jQuery.fn.textScroll = function(selector) {
this.each(function() {
$(this).on("mouseenter", selector, function () {
var sw = $(this)[0].scrollWidth - parseFloat($(this).css("textIndent")), iw = $(this).innerWidth();
if (sw > iw) {
$(this).stop().animate({
textIndent: "-" + (sw + 1 - iw) + "px"
}, sw * 8);
}
});
$(this).on("mouseleave", selector, function () {
$(this).stop().animate({
textIndent: "-" + (sw + 1 - iw) + "px"
}, sw * 8);
}
textIndent: "0"
}, 500);
});
});
parent.on("mouseleave", selector, function () {
$(this).stop().animate({
textIndent: "0"
}, 500);
});
}
return this; // jQuery chaining
};

View file

@ -1271,7 +1271,7 @@ var AIRTIME = (function(AIRTIME) {
});
mod.podcastDataTable = mod.podcastTableWidget.getDatatable();
}
};
mod.libraryInit = libraryInit;

View file

@ -161,7 +161,7 @@ $(document).ready(function () {
});
};
setupTextScrolling($("#recent_uploads"), "td");
$("#recent_uploads").textScroll("td");
self.isRecentUploadsRefreshTimerActive = false;

View file

@ -42,7 +42,9 @@ var AIRTIME = (function (AIRTIME) {
function _bootstrapAngularApp(podcast) {
podcastApp.value('podcast', JSON.parse(podcast));
angular.bootstrap(AIRTIME.tabs.getActiveTab().find(".podcast-wrapper").get(0), ["podcast"]);
var wrapper = AIRTIME.tabs.getActiveTab().find(".editor_pane_wrapper");
wrapper.attr("ng-controller", "RestController");
angular.bootstrap(wrapper.get(0), ["podcast"]);
}
mod.createUrlDialog = function() {
@ -112,15 +114,21 @@ var AIRTIME = (function (AIRTIME) {
};
mod.initPodcastEpisodeDatatable = function(episodes) {
console.log(episodes);
var aoColumns = [
/* Title */ { "sTitle" : $.i18n._("Title") , "mDataProp" : "title" , "sClass" : "library_title" , "sWidth" : "170px" },
/* Title */ { "sTitle" : $.i18n._("Title") , "mDataProp" : "title" , "sClass" : "podcast_episodes_title" , "sWidth" : "170px" },
/* Author */ { "sTitle" : $.i18n._("Author") , "mDataProp" : "author" , "sClass" : "podcast_episodes_author" , "sWidth" : "170px" },
/* Description */ { "sTitle" : $.i18n._("Description") , "mDataProp" : "description" , "sClass" : "podcast_episodes_description" , "sWidth" : "300px" },
/* Link */ { "sTitle" : $.i18n._("Link") , "mDataProp" : "link" , "sClass" : "podcast_episodes_link" , "sWidth" : "170px" },
/* GUID */ { "sTitle" : $.i18n._("GUID") , "mDataProp" : "guid" , "sClass" : "podcast_episodes_guid" , "sWidth" : "170px" },
/* Publication Date */ { "sTitle" : $.i18n._("Publication Date") , "mDataProp" : "pubDate" , "sClass" : "podcast_episodes_pub_date" , "sWidth" : "170px" }
];
var podcastToolbarButtons = AIRTIME.widgets.Table.getStandardToolbarButtons();
// Set up the div with id "podcast_table" as a datatable.
mod.podcastEpisodesTableWidget = new AIRTIME.widgets.Table(
AIRTIME.tabs.getActiveTab().find('.podcast_episodes'), // DOM node to create the table inside.
AIRTIME.tabs.getActiveTab().find('#podcast_episodes'), // DOM node to create the table inside.
true, // Enable item selection
podcastToolbarButtons, // Toolbar buttons
{ // Datatables overrides.
@ -131,6 +139,7 @@ var AIRTIME = (function (AIRTIME) {
});
mod.podcastEpisodesDatatable = mod.podcastEpisodesTableWidget.getDatatable();
mod.podcastEpisodesDatatable.textScroll("td");
};
return AIRTIME;

View file

@ -205,5 +205,5 @@ var AIRTIME = (function(AIRTIME){
}(AIRTIME || {}));
$(document).ready(function() {
setupTextScrolling($("#show_builder"), ".tab-name");
$("#show_builder").textScroll(".tab-name");
});

View file

@ -36,6 +36,8 @@ var AIRTIME = (function(AIRTIME) {
self._$wrapperDOMNode = $(wrapperDOMNode);
self._toolbarButtons = toolbarButtons;
// Exclude the leftmost column if we're implementing item selection
self._colVisExcludeColumns = bItemSelection ? [0] : [];
//Finish initialization of the datatable since everything is declared by now.
@ -65,6 +67,7 @@ var AIRTIME = (function(AIRTIME) {
}),
"oColVis": {
"sAlign": "right",
"aiExclude": self.colVisExcludeColumns,
"buttonText": $.i18n._("Columns"),
"iOverlayFade": 0
},