{I" class:ETI"ProcessedAsset;FI"logical_path;TI"+forever_style_guide/account-popover.js;FI" pathname;TI"m/Users/zschweitzer/git/forever-style-guide/app/assets/javascripts/forever_style_guide/account-popover.js;FI"content_type;TI"application/javascript;TI" mtime;Tl+ëÆMWI" length;Tiµ I" digest;TI"%6ca1fa74700967fb09698cfa3dbb6b62;FI" source;TI"µ // an 'accounPopover' namespace for additional popover functionality. var accountPopover = (function () { /** Apply 'danger', 'warning' classes to the popover's progress bar and upgrade button. Example ```javascript _addStateClasses($popoverContainer, 'danger'); ``` @private */ var _addStateClasses = function (container, state) { container.find(".account-popover-link-text").addClass("account-popover-link-" + state); container.find(".account-popover-storage-upgrade .btn").addClass("btn-" + state); container.find(".progress-bar").addClass("progress-bar-" + state); }; /** Removes the 'danger' and 'warning' classes to the popover's progress bar and upgrade button. Example ```javascript _resetClasses($popoverContainer); ``` @private */ var _resetClasses = function (container) { container.find(".account-popover-link-danger").removeClass("account-popover-link-danger"); container.find(".account-popover-link-warning").removeClass("account-popover-link-warning"); container.find(".account-popover-storage-upgrade .btn").removeClass("btn-danger btn-warning"); container.find(".progress-bar").removeClass("progress-bar-danger progress-bar-warning"); }; /** Sets the user's storage data in the account popover. Example ```javascript var storage = { membership_type: "Intro Member", percent_used: "35%", total_storage: "3GB" }; accountPopover.setAccountStorage(storage) ``` @public */ var setAccountStorage = function (storage) { if (!storage.membership_type || !storage.percent_used || !storage.total_storage) { return console.warn("argument storage must contain the following keys: 'membership_type', 'percent_used', 'total_storage'"); } var container = $(".account-popover-storage"); var percentAsInt = parseInt(storage.percent_used); _resetClasses(container); container.find(".account-popover-membership_type").html(storage.membership_type); container.find(".account-popover-percent_used, .progress-label").html(storage.percent_used); container.find(".account-popover-total_storage").html(storage.total_storage); container.find(".progress-bar").attr("style", "width: " + storage.percent_used + ";"); if (percentAsInt >= 100) { _addStateClasses(container, "danger"); container.find(".account-popover-storage-upgrade").show(); } else if (percentAsInt >= 90) { _addStateClasses(container, "warning"); } else { container.find(".account-popover-storage-upgrade").hide(); } }; return { setAccountStorage: setAccountStorage }; })(); // Trigger account popovers $(function () { $('[data-toggle="popover-desktop"]').popover({ html: true, content: function () { return $('.account-popover').html(); }, template: '', container: '.account-popover-container', placement: 'bottom' }) $('[data-toggle="popover-mobile"]').popover({ html: true, content: function () { return $('.account-popover').html(); }, template: '', container: '.account-popover-container-mobile', placement: 'bottom' }) }); ;TI"dependency_digest;TI"%06eba7086b98c39006aae7b2b75c9cf9;FI"required_paths;T[I"m/Users/zschweitzer/git/forever-style-guide/app/assets/javascripts/forever_style_guide/account-popover.js;FI"dependency_paths;T[{I" path;TI"m/Users/zschweitzer/git/forever-style-guide/app/assets/javascripts/forever_style_guide/account-popover.js;FI" mtime;TI"2016-05-31T13:16:27-04:00;TI" digest;TI"%6ca1fa74700967fb09698cfa3dbb6b62;FI" _version;TI"%2be930bcbfd3c3e00190e2193dda5c7c;F