add success indication to podcast settings save

This commit is contained in:
ryan 2018-12-15 06:09:31 -06:00
parent bde87c7afb
commit 91e3bdfd2f
2 changed files with 38 additions and 19 deletions

View file

@ -4166,7 +4166,9 @@ li .ui-state-hover {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.podcast-metadata-row .success {
margin-top: 10px;
}
.podcast_episodes_imported { .podcast_episodes_imported {
text-align: center !important; text-align: center !important;
} }

View file

@ -35,6 +35,11 @@ var AIRTIME = (function (AIRTIME) {
view.find("table").attr("id", "podcast_episodes_" + podcast.id); view.find("table").attr("id", "podcast_episodes_" + podcast.id);
self.onSaveCallback = function () { self.onSaveCallback = function () {
var successMsg = $('.active-tab .btn-toolbar .success')
successMsg.text($.i18n._("Podcast settings saved")).show("fast");
setTimeout(function () {
successMsg.hide("fast");
}, 5000);
AIRTIME.library.podcastDataTable.fnDraw(); AIRTIME.library.podcastDataTable.fnDraw();
}; };
@ -62,18 +67,29 @@ var AIRTIME = (function (AIRTIME) {
title: $scope.podcast.title title: $scope.podcast.title
}, },
function() { function() {
// show success message
var successMsg = $('.active-tab .pc-sb-success') var successMsg = $('.active-tab .pc-sb-success')
successMsg.text($.i18n._('Smartblock and playlist generated')); successMsg.text($.i18n._('Smartblock and playlist generated'));
successMsg.show(); successMsg.show("fast");
setTimeout(function(){ setTimeout(function(){
successMsg.hide(); successMsg.hide("fast");
}, 5000); }, 5000);
// save podcast but do not display notification beside save button below
$http.put(endpoint + $scope.podcast.id,
{
csrf_token: $scope.csrf,
podcast: $scope.podcast
})
.success(function () {
AIRTIME.library.podcastDataTable.fnDraw();
});
// redraw list of smartblocks just in case they have it visible on the left
dt = $('table[id="library_display"]').dataTable(); dt = $('table[id="library_display"]').dataTable();
dt.fnStandingRedraw(); dt.fnStandingRedraw();
} }
); );
// save podcast
$scope.savePodcast();
}; };
/** /**
* Close the tab and discard any changes made to the podcast data. * Close the tab and discard any changes made to the podcast data.
@ -129,20 +145,21 @@ var AIRTIME = (function (AIRTIME) {
function StationPodcastController($scope, $http, podcast, tab) { function StationPodcastController($scope, $http, podcast, tab) {
// Super call to parent controller // Super call to parent controller
PodcastController.call(this, $scope, $http, podcast, tab); PodcastController.call(this, $scope, $http, podcast, tab);
this.onSaveCallback = function () { // @frecuencialibre commenting this out since i think it is never called. @todo delete once confirmed
$http({ // this.onSaveCallback = function () {
method: 'POST', // $http({
url: '/preference/station-podcast-settings', // method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}, // url: '/preference/station-podcast-settings',
data: { stationPodcastPrivacy: $("#podcast-settings").find("input:checked").val() } // headers: {'Content-Type': 'application/x-www-form-urlencoded'},
}).success(function (data) { // data: { stationPodcastPrivacy: $("#podcast-settings").find("input:checked").val() }
jQuery.extend($scope.podcast, data); // }).success(function (data) {
$(".success").text($.i18n._("Podcast settings saved")).slideDown("fast"); // jQuery.extend($scope.podcast, data);
setTimeout(function () { // $(".success").text($.i18n._("Podcast settings saved")).slideDown("fast");
$(".success").slideUp("fast"); // setTimeout(function () {
}, 2000); // $(".success").slideUp("fast");
}); // }, 2000);
}; // });
// };
return this; return this;
} }