diff --git a/static/js/app/app.js b/static/js/app/app.js index 674c57e..d0e8c45 100644 --- a/static/js/app/app.js +++ b/static/js/app/app.js @@ -207,7 +207,7 @@ var AppRouter = Backbone.Router.extend({ $('#site-content-fill').html(''); }, loginRedirect: function () { - com.podnoms.utils.showAlert("Success", "Thank you for logging in.", "alert-success", true); + com.podnoms.utils.showAlert("Success", "Thank you for logging in."); this.defaultRoute(); }, connectAccounts: function () { diff --git a/static/js/app/social.js b/static/js/app/social.js index 23853ec..1768c22 100644 --- a/static/js/app/social.js +++ b/static/js/app/social.js @@ -11,23 +11,7 @@ postFacebookLike = function (mixId) { $.getJSON( 'social/like/' + mixId + '/', function (data) { - com.podnoms.utils.showAlert("Posted your like to facebook, you can stop this in your settings page.", "Cheers feen", "alert-success", true); - /* - if (data.value) { - FB.api( - '/me/deepsouthsounds:like', - 'post', - { mix:'http://' + window.location.host + '/social/redirect/mix/' + mixId}, - function (response) { - if (!response || response.error) { - com.podnoms.utils.showAlert(response.error.message, 'Error occurred: ', "alert-error", true); - } else { - com.podnoms.utils.showAlert("Posted your like to facebook, you can stop this in your settings page.", "Cheers feen", "alert-success", true); - } - } - ); - } - */ + com.podnoms.utils.showAlert("Posted your like to facebook, you can stop this in your settings page.", "Cheers feen"); } ); }; @@ -54,19 +38,19 @@ sharePageToTwitter = function (model) { }; sharePageToFacebook = function (model) { FB.ui({ - method:'feed', - name:'Check out this mix on Deep South Sounds', - display:'popup', - link:'http://' + window.location.host + "/" + model.get('item_url'), - picture:model.get('mix_image'), - caption:model.get('title'), - description:model.get('description') + method: 'feed', + name: 'Check out this mix on Deep South Sounds', + display: 'popup', + link: 'http://' + window.location.host + "/" + model.get('item_url'), + picture: model.get('mix_image'), + caption: model.get('title'), + description: model.get('description') }, function (response) { if (response && response.post_id) { - com.podnoms.utils.showAlert("Success", "Post shared to facebook", "alert-success", true); + com.podnoms.utils.showAlert("Success", "Post shared to facebook"); } else { - com.podnoms.utils.showAlert("Error", "Failure sharing post", "alert-error", true); + com.podnoms.utils.showError("Error", "Failure sharing post"); } } ); diff --git a/static/js/app/views/comment.js b/static/js/app/views/comment.js index c0632ad..28edfc0 100644 --- a/static/js/app/views/comment.js +++ b/static/js/app/views/comment.js @@ -38,7 +38,7 @@ window.CommentListView = Backbone.View.extend({ view.render(); }, error:function () { - com.podnoms.utils.showAlert("Error", "Unable to save comment", "alert-error"); + com.podnoms.utils.showError("Error", "Unable to save comment"); }}); $('textarea[name=new-comment]').val(''); } diff --git a/static/js/app/views/event.js b/static/js/app/views/event.js index c06d185..8e9e11c 100644 --- a/static/js/app/views/event.js +++ b/static/js/app/views/event.js @@ -89,7 +89,7 @@ var EventCreateView = DSSEditableView.extend({ this.model.set('event_date', $('#event_date', this.el).val()); this._saveChanges({ success:function () { - com.podnoms.utils.showAlert("Success", "Event successfully added", "alert-info", true); + com.podnoms.utils.showAlert("Success", "Event successfully added"); Backbone.router.navigate('/event/' + model.get('id')); } }); diff --git a/static/js/app/views/header.js b/static/js/app/views/header.js index e1dab4c..4972fe2 100644 --- a/static/js/app/views/header.js +++ b/static/js/app/views/header.js @@ -34,7 +34,7 @@ window.HeaderView = Backbone.View.extend({ }); }, logout: function () { - com.podnoms.utils.showAlert("Success", "You are now logged out", "alert-success", true); + com.podnoms.utils.showAlert("Success", "You are now logged out"); }, trackChanged:function (data) { $(this.el).find('#track-description').text(data.title); diff --git a/static/js/app/views/mix.js b/static/js/app/views/mix.js index ad864fd..9790590 100644 --- a/static/js/app/views/mix.js +++ b/static/js/app/views/mix.js @@ -93,10 +93,10 @@ window.MixListItemView = Backbone.View.extend({ var result = JSON.parse(data); if (result.value == "Liked") { parent.setLikeButton(id, true); - com.podnoms.utils.showAlert("Success", "Thanks for liking!!", "alert-success", true); + com.podnoms.utils.showAlert("Success", "Thanks for liking!!"); } else if (result.value == "Unliked") { parent.setLikeButton(id, false); - com.podnoms.utils.showAlert("Success", "Mix unliked!!", "alert-success", true); + com.podnoms.utils.showAlert("Success", "Mix unliked!!"); } } ); @@ -352,7 +352,7 @@ window.MixCreateView = DSSEditableView.extend({ } }, error: function (model, response) { - com.podnoms.utils.showAlert("Error", "Something went wrong
Nerd stuff is: " + response, "alert-info", false); + com.podnoms.utils.showError("Error", "Something went wrong
Nerd stuff is: " + response); } }); return false; diff --git a/static/js/app/views/release.js b/static/js/app/views/release.js index 3ecdd24..f0aaeab 100644 --- a/static/js/app/views/release.js +++ b/static/js/app/views/release.js @@ -106,7 +106,7 @@ var ReleaseCreateView = DSSEditableView.extend({ this._saveChanges({ success:function () { - com.podnoms.utils.showAlert("Success", "Release successfully added", "alert-info", true); + com.podnoms.utils.showAlert("Success", "Release successfully added"); Backbone.history.navigate('/release/' + model.get('id'), {trigger:true}); } }); diff --git a/static/js/app/views/user.js b/static/js/app/views/user.js index 87113b0..6c86bb4 100644 --- a/static/js/app/views/user.js +++ b/static/js/app/views/user.js @@ -50,11 +50,11 @@ window.UserView = DSSEditableView.extend({ var model = this.model; this._saveChanges({ success:function () { - com.podnoms.utils.showAlert("Success", "Successfully updated yourself", "alert-info", true); + com.podnoms.utils.showAlert("Success", "Successfully updated yourself"); Backbone.history.navigate('/me', {trigger:true}); }, error:function () { - com.podnoms.utils.showAlert("Success", "Successfully updated yourself", "alert-info", false); + com.podnoms.utils.showAlert("Success", "Successfully updated yourself"); alert("Error"); } }); diff --git a/static/js/com.podnoms.player.js b/static/js/com.podnoms.player.js index 280dc1d..2493721 100644 --- a/static/js/com.podnoms.player.js +++ b/static/js/com.podnoms.player.js @@ -64,7 +64,7 @@ com.podnoms.player = { this.playButtonEl .removeClass('play-button-small-loading') .addClass('play-button-small-pause'); - this.trackLoaded = true;r r sharing + this.trackLoaded = true; } this.currentPosition = this.currentSound.position; var duration = this._getDurationEstimate(this.currentSound); diff --git a/static/js/com.podnoms.utils.js b/static/js/com.podnoms.utils.js index 89013d8..b67ee37 100644 --- a/static/js/com.podnoms.utils.js +++ b/static/js/com.podnoms.utils.js @@ -35,7 +35,7 @@ com.podnoms.utils = { this.addValidationError(key, messages[key]); } } - this.showAlert('Warning!', 'Fix validation errors and try again', 'alert-warning'); + this.showWarning('Warning!', 'Fix validation errors and try again'); }, addValidationError: function (field, message) { var controlGroup = $('#' + field).parent().parent(); @@ -64,20 +64,13 @@ com.podnoms.utils = { } }, showError: function (title, message) { - this.showAlert(title, message, 'alert-error', true); + toastr.error(message, title); }, - showAlert: function (title, text, klass, fade) { - $('.alert').removeClass("alert-error alert-warning alert-success alert-info"); - $('.alert').addClass(klass); - $('.alert').html('' + title + ' ' + text); - $('.alert').show(); - if (fade) { - $('.alert').fadeOut(5000, function () { - }); - } - $('.alert').click(function () { - this.hideAlert(); - }); + showWarning: function(title, message){ + toastr.warning(message, title); + }, + showAlert: function (title, message) { + toastr.success(message, title); }, showAlertModal: function (title, message) { $('#alert-proxy-title').text(title); diff --git a/templates/base.html b/templates/base.html index 7e5c294..dc81320 100644 --- a/templates/base.html +++ b/templates/base.html @@ -19,6 +19,7 @@ + {% endcompress %} {% block headerscripts %} {% endblock %} @@ -89,6 +90,7 @@ +