can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[ljcom] r11670: LJSUP-11721: Cannot reset PlayList in pr...

Committer: dpetrov
LJSUP-11721: Cannot reset PlayList in profile
U   trunk/htdocs/js/editprofile.js
Modified: trunk/htdocs/js/editprofile.js
===================================================================
--- trunk/htdocs/js/editprofile.js	2012-04-05 08:58:03 UTC (rev 11669)
+++ trunk/htdocs/js/editprofile.js	2012-04-05 11:23:54 UTC (rev 11670)
@@ -390,6 +390,7 @@
 		var select = jQuery('#music-settings-playlist-selection');
 		var playlistID = jQuery('#playlist_id');
 		var playlistName = jQuery('#playlist_name');
+
 		var state = {
 			error: 'music-settings-manage-state-system-error',
 			loading: 'music-settings-manage-state-loading',
@@ -407,7 +408,6 @@
 					var playlist;
 					var currentPlaylist = playlistID.val();
 
-					select.empty();
 					while (index < length) {
 						playlist = playlists[index++];
 						select.append('<option value="' + playlist.id + '">' + playlist.title + '</option>');
@@ -417,6 +417,10 @@
 						}
 					}
 
+					if (currentPlaylist === "-1") {
+						playlistName.text(LiveJournal.getLocalizedStr('.pl.nothingselected'));
+					}
+
 					jQuery(this).addClass(state.loaded);
 				} else {
 					jQuery(this).addClass(state.error);
@@ -427,11 +431,12 @@
 			}).trava('getPlaylists');
 
 		jQuery('#music-settings-playlist-confirm').bind('click', function (evt) {
-			var selectedItem = select.find('option').eq(select.prop('selectedIndex'));
+			var selectedItem = select.find('option').eq(select.prop('selectedIndex')),
+				value = selectedItem.val();
 
 			evt.preventDefault();
-			playlistID.val(selectedItem.val());
-			playlistName.text(selectedItem.text());
+			playlistID.val(value);
+			playlistName.text((value === "-1") ? LiveJournal.getLocalizedStr('.pl.nothingselected') : selectedItem.text());
 		});
 
 		element.find('.music-playlist-system-error a').bind('click', function (evt) {

Tags: can3p, dpetrov, js, ljcom
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments