From be3a3fbd9fb17e9916fe656e146f5ee00d950caf Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Mon, 19 Oct 2015 12:57:18 -0400 Subject: [PATCH] * Fix error in automatic podcast ingest * Switch from text-scrolling to using title attributes to display overflowing text strings --- .../application/common/PodcastManager.php | 4 ++-- .../public/js/airtime/common/common.js | 24 ++++++++++++++++--- .../public/js/airtime/library/plupload.js | 2 +- .../public/js/airtime/library/podcast.js | 3 +-- .../public/js/airtime/showbuilder/tabs.js | 2 +- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/application/common/PodcastManager.php b/airtime_mvc/application/common/PodcastManager.php index f7be607c8..76fe8273c 100644 --- a/airtime_mvc/application/common/PodcastManager.php +++ b/airtime_mvc/application/common/PodcastManager.php @@ -31,14 +31,14 @@ class PodcastManager { $episodes = array(); foreach ($autoIngestPodcasts as $podcast) { /** @var ImportedPodcast $podcast */ - $podcastArray = Application_Service_PodcastService::getPodcastById($podcast->getDbId()); + $podcastArray = Application_Service_PodcastService::getPodcastById($podcast->getDbPodcastId()); // A bit hacky... sort the episodes by publication date to get the most recent usort($podcastArray["episodes"], array(static::class, "_sortByEpisodePubDate")); $episodeData = $podcastArray["episodes"][0]; $episode = PodcastEpisodesQuery::create()->findOneByDbEpisodeGuid($episodeData["guid"]); // Make sure there's no existing episode placeholder or import, and that the data is non-empty if (empty($episode) && !empty($episodeData)) { - $placeholder = $service->addPodcastEpisodePlaceholder($podcast->getDbId(), $episodeData); + $placeholder = $service->addPodcastEpisodePlaceholder($podcast->getDbPodcastId(), $episodeData); array_push($episodes, $placeholder); } } diff --git a/airtime_mvc/public/js/airtime/common/common.js b/airtime_mvc/public/js/airtime/common/common.js index 14bf97ee0..a5dc01b54 100644 --- a/airtime_mvc/public/js/airtime/common/common.js +++ b/airtime_mvc/public/js/airtime/common/common.js @@ -304,9 +304,27 @@ function getUsabilityHint() { }); } -// Set up text scrolling for all tags matching selector within the calling element(s) -jQuery.fn.textScroll = function(selector) { +/** + * Add title attributes (whose values are their inner text) to all elements in the calling parent matching selector + * + * @param selector jQuery selector to search descendants + * @returns {jQuery} + */ +jQuery.fn.addTitles = function(selector) { this.each(function() { + // Put this in a mouseenter event handler so it's dynamic + // (newly created elements will have the title applied on hover) + $(this).on("mouseenter", selector, function () { + $(this).attr("title", $(this).text()); + }); + }); + + return this; // jQuery chaining +}; + +// XXX: Old code to pan selector text; keeping this around in case we want to use it later - Duncan +jQuery.fn.scrollText = 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) { @@ -322,5 +340,5 @@ jQuery.fn.textScroll = function(selector) { }); }); - return this; // jQuery chaining + return this; }; diff --git a/airtime_mvc/public/js/airtime/library/plupload.js b/airtime_mvc/public/js/airtime/library/plupload.js index 95eefbe13..670f21b3a 100644 --- a/airtime_mvc/public/js/airtime/library/plupload.js +++ b/airtime_mvc/public/js/airtime/library/plupload.js @@ -162,7 +162,7 @@ $(document).ready(function () { }); }; - $("#recent_uploads").textScroll("td"); + $("#recent_uploads").addTitles("td"); self.isRecentUploadsRefreshTimerActive = false; diff --git a/airtime_mvc/public/js/airtime/library/podcast.js b/airtime_mvc/public/js/airtime/library/podcast.js index 74c5874f3..f7d8cedaf 100644 --- a/airtime_mvc/public/js/airtime/library/podcast.js +++ b/airtime_mvc/public/js/airtime/library/podcast.js @@ -18,7 +18,6 @@ var AIRTIME = (function (AIRTIME) { //when you're creating a new podcast, we already have the object from the result of the POST. We're saving //a roundtrip by not fetching it again here. $scope.podcast = podcast; - console.log(podcast); tab.setName($scope.podcast.title); $scope.savePodcast = function() { @@ -168,7 +167,7 @@ var AIRTIME = (function (AIRTIME) { } }); - podcastEpisodesTableWidget.getDatatable().textScroll("td"); + podcastEpisodesTableWidget.getDatatable().addTitles("td"); return podcastEpisodesTableWidget; }; diff --git a/airtime_mvc/public/js/airtime/showbuilder/tabs.js b/airtime_mvc/public/js/airtime/showbuilder/tabs.js index c6d1e284f..93f30f281 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/tabs.js +++ b/airtime_mvc/public/js/airtime/showbuilder/tabs.js @@ -339,7 +339,7 @@ var AIRTIME = (function(AIRTIME){ $(document).ready(function() { // Add text scrolling to tab names - $("#show_builder").textScroll(".tab-name"); + $("#show_builder").addTitles(".tab-name"); // Initialize the ScheduleTab AIRTIME.tabs.initScheduleTab(); });