Skip to content
Permalink
Browse files

issue #32 - 2/3 complete - added localHistory implementation and open…

… / close trigger
  • Loading branch information...
bobbravo2 committed Jul 29, 2015
1 parent 75b506e commit 965e54e8df8de90150ffa2ce34661b256a3efbff
@@ -3,6 +3,7 @@
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/tests/qunit" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
@@ -39,5 +40,6 @@
</library>
</orderEntry>
<orderEntry type="library" name="select2-DefinitelyTyped" level="application" />
<orderEntry type="library" name="JsTestDriver Assertion Framework" level="application" />
</component>
</module>
@@ -3,6 +3,6 @@
<component name="JavaScriptLibraryMappings">
<file url="file://$PROJECT_DIR$/src/modules/addons/enom_pro/js" libraries="{HTML5 / EcmaScript 5, jQuery 1.11.0}" />
<file url="file://$PROJECT_DIR$/src/modules/addons/enom_pro/js/jquery.admin.js" libraries="{HTML5 / EcmaScript 5, jQuery 1.11.0, select2-DefinitelyTyped}" />
<file url="PROJECT" libraries="{jQuery 1.11.0, select2-DefinitelyTyped}" />
<file url="PROJECT" libraries="{JsTestDriver Assertion Framework, jQuery 1.11.0, select2-DefinitelyTyped}" />
</component>
</project>
@@ -0,0 +1,10 @@
load:
- 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js'
- 'http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js'
- src/modules/addons/enom_pro/js/jquery.admin.js

test:
- tests/qunit/*.js

#serve:
# - build/encoded_prep/modules/addons/enom_pro/css/admin.min.css
@@ -483,6 +483,9 @@ Licensed from Orion IP Ventures, LLC
.enom_pro_output #enom_pro_pricing_import_page nav {
text-align: center;
}
.enom_pro_output .close-bulk-editor {
display: none;
}
.enom_pro_output .fixedBulk {
/* Left hand bulk update */
}
@@ -495,22 +498,26 @@ Licensed from Orion IP Ventures, LLC
z-index: 3;
overflow-y: auto;
}
.enom_pro_output .fixedBulk #bulkRightWrap .hidden-turbo,
.enom_pro_output .fixedBulk #bulkLeftWrap .hidden-turbo {
display: none;
}
.enom_pro_output .fixedBulk .close-bulk-editor {
display: block;
position: absolute;
top: 2.5px;
right: 5px;
font-size: 24pt;
}
.enom_pro_output .fixedBulk #bulkLeftWrap {
padding: 3px;
width: 25%;
margin: 0;
border-radius: 0;
}
.enom_pro_output .fixedBulk #bulkLeftWrap .close {
display: none;
}
.enom_pro_output .fixedBulk #bulkLeftWrap #bulkPricingImportWrap .col-xs-12 {
padding: 0;
}
.enom_pro_output .fixedBulk #bulkLeftWrap #bulkPricingImportWrap label[for="percentMarkup"],
.enom_pro_output .fixedBulk #bulkLeftWrap #bulkPricingImportWrap label[for="preferredPercentMarkup"] {
display: none;
}
.enom_pro_output .fixedBulk #bulkLeftWrap #bulkPricingImportWrap .pull-right {
float: none !important;
}
@@ -519,12 +526,6 @@ Licensed from Orion IP Ventures, LLC
width: 100%;
margin: 0;
}
.enom_pro_output .fixedBulk #bulkLeftWrap #bulkPricingImportWrap h3,
.enom_pro_output .fixedBulk #bulkLeftWrap #bulkPricingMetaWrap h3,
.enom_pro_output .fixedBulk #bulkLeftWrap #bulkPricingImportWrap p,
.enom_pro_output .fixedBulk #bulkLeftWrap #bulkPricingMetaWrap p {
display: none;
}
.enom_pro_output .fixedBulk #bulkLeftWrap #bulkPricingMetaWrap {
margin-top: 5px;
}
@@ -538,6 +538,9 @@ Licensed from Orion IP Ventures, LLC
text-align: center;
}
}
.close-bulk-editor {
display: none;
}
//Bulk Pricing Turbo Editor
.fixedBulk {
#bulkRightWrap,
@@ -548,6 +551,16 @@ Licensed from Orion IP Ventures, LLC
height: 100%;
z-index: 3;
overflow-y: auto;
.hidden-turbo {
display: none;
}
}
.close-bulk-editor {
display: block;
position: absolute;
top: 2.5px;
right: 5px;
font-size: 24pt;
}
/* Left hand bulk update */
@leftWidth: 25%;
@@ -558,28 +571,17 @@ Licensed from Orion IP Ventures, LLC
margin: 0;
border-radius: 0;

.close {
display: none;
}
#bulkPricingImportWrap {
.col-xs-12 {
padding: 0;
}
label[for="percentMarkup"],
label[for="preferredPercentMarkup"] {
display: none;
}

.pull-right {
float: none !important;
}
}
#bulkPricingImportWrap, #bulkPricingMetaWrap {
width: 100%;
margin: 0;
h3, p {
display: none;
}
}
#bulkPricingMetaWrap {
margin-top: 5px;
@@ -160,7 +160,7 @@ class="clear_all btn btn-default btn-xs">Clear All Pricing</a> before saving.</
<div id="bulkRightWrap">

<form method="GET" id="tldSearchForm">
<h4>Search</h4>
<h4 class="hidden-turbo">Search</h4>
<input type="hidden" name="module" value="enom_pro" />
<input type="hidden" name="view" value="pricing_import" />

@@ -1,14 +1,8 @@
<div class="well row" id="bulkLeftWrap">
<button type="button"
class="close"
data-dismiss="alert"
aria-hidden="true">&uarr;</button>

<div class="col-lg-6" id="bulkPricingImportWrap">
<div class="enom-pro-icon enom-pro-icon-cancel-circle close-bulk-editor" title="Close Bulk Pricing editor"></div>

<h3>Bulk Import</h3>

<p>Import all TLDs on this page</p>
<h3 class="hidden-turbo"><span class="btn btn-primary btn-lg open-bulk-editor"><span class="enom-pro-icon enom-pro-icon-tag"></span> Bulk Import <span class="badge">New!</span></h3>

<form class="bulkImport form-inline"
role="form"
@@ -17,7 +11,7 @@ class="close"
<div class="form-group col-xs-12">
<h5 class="ep_pop" title="Minimum Markup" data-placement="auto top" data-content="Enter the minimum acceptable markup. Use this to cover credit card processing fees, for example.">Minimum Markup</h5>
<div class="input-group">
<label for="percentMarkup" class="input-group-addon">Markup</label>
<label for="percentMarkup" class="input-group-addon hidden-turbo">Markup</label>
<input type="number"
min="0"
step="0.01"
@@ -47,7 +41,7 @@ class="form-control input-sm"/>
<div class="form-group col-xs-12">
<h5 class="ep_pop" title="Preferred Markup" data-placement="auto top" data-content="The Markup you'd like to make, while still being protected from under-selling.">Preferred Markup</h5>
<div class="input-group">
<label for="preferredPercentMarkup" class="input-group-addon">Markup</label>
<label for="preferredPercentMarkup" class="input-group-addon hidden-turbo">Markup</label>
<input type="number"
min="0"
max="500"
@@ -128,7 +122,7 @@ class="btn btn-danger dropdown-toggle"
</form>
</div>
<div class="col-lg-6" id="bulkPricingMetaWrap">
<h3>Domain Pricing Meta</h3>
<h3 class="hidden-turbo">Domain Pricing Meta</h3>
Pricing for a total of <?php echo count( $this->getAllDomainsPricing() ) ?> TLDs.
<br/>
Pricing data last updated <?php echo $this->get_price_cache_date(); ?>
@@ -1,5 +1,4 @@
try {

function precise_round(num, decimals) {
return Math.round(num * Math.pow(10, decimals)) / Math.pow(10, decimals);
}
@@ -142,7 +141,7 @@ try {
preferredWholeMarkup = parseFloat($("#preferredWholeMarkup").val()) || 0,
doRound = (round != -1),
newPriceDouble = 0,
$elems = enom_pro.getTLDInputSet();
$elems = enom_pro.getTLDInputSet();
$.each($elems, function (k, value) {
//If min. is lt preferred, use preferred, else use minimum
var $elem = $(value),
@@ -490,7 +489,7 @@ try {
inputSet = [];
$.each(checks, function (k, v) {
var tld = $(v).prop('name'),
filter = $('#overWriteWHMCS').prop('checked') ? ', [data-whmcs]' : '',
filter = $('#overWriteWHMCS').prop('checked') ? ', [data-whmcs]' : '',
$inputs = $("[data-tld='" + tld + "']").filter(':not(a, .btn' + filter + ')');
inputSet = $.merge(inputSet, $inputs);
});
@@ -508,13 +507,28 @@ try {
* @constant int SAVE_INTERVAL_CLICK How long to wait after a click before sending result to server
*/
SAVE_INTERVAL_CLICK: 750,
openBulkPricingEditor: function () {
this.showBulkPricingTurboEditor();
this.setLocalStorage('openBulkPricingEditor', true);
},
closeBulkPricingEditor: function () {
this.hideBulkPricingTurboEditor();
this.setLocalStorage('openBulkPricingEditor', false);
},
/**
* TLD Pricing Import Page
*/
initPricingImport: function () {
this.getLocalStorage('openBulkPricingEditor') === 'true' ? this.showBulkPricingTurboEditor() : null;
$('.close-bulk-editor').on('click', function() {
enom_pro.closeBulkPricingEditor();
});
$('.open-bulk-editor').on('click', function() {
enom_pro.openBulkPricingEditor();
return false;
});
$('.dropdown-toggle').dropdown();
//TODO restore / hide based on localStorage
// this.showBulkPricingTurboEditor();

$('.tldAction').on('click', function () {
var $check = $(this).closest('td').find('input');
@@ -1203,7 +1217,51 @@ try {
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
},
/**
* @constant
*/
LOCAL_STORAGE_PREFIX: 'enom_pro_',
/**
* Gets an item from local storage if supported
* @param key
* @returns {boolean} false of failure
*/
getLocalStorage: function (key) {
if (this.support.localStorage()) {
return window.localStorage.getItem(this.getLocalStorageKey(key));
}
return false;
},
/**
*
* @param key
* @param value
* @returns {boolean} true on set, false on fail
*/
setLocalStorage: function (key, value) {
if (this.support.localStorage()) {
window.localStorage.setItem(this.getLocalStorageKey(key), value);
return true;
}
return false;
},
/**
* @private
* @param unPrefixedKey {string}
* @returns {string}
*/
getLocalStorageKey: function (unPrefixedKey) {
return this.LOCAL_STORAGE_PREFIX + unPrefixedKey;
},
/**
* Simple feature detection
* @property
*/
support: {
/**
* @method localStorage
* @returns {boolean}
*/
localStorage: function () {
try {
return 'localStorage' in window && window['localStorage'] !== null;
@@ -1212,10 +1270,10 @@ try {
}
}
}

});
enom_pro.init();
}); //end jQuery Ready
} catch (err) {
alert('Enom PRO JS Error: ' + err);

}
@@ -0,0 +1,14 @@
TestCase('localStorage', {
testSupportsLocalStorage: function () {
assertTrue('supports', enom_pro.support.localStorage());
},
testGetLocalStorageKey: function () {
var got_key = enom_pro.getLocalStorageKey('key');
assertEquals('key is wrong', 'enom_pro_key', got_key);
},
testSaveLocalStorage: function (){
var set = 'bam';
enom_pro.setLocalStorage('foobar', set);
assertEquals('get localstorage failed', set, enom_pro.getLocalStorage('foobar'));
}
});

0 comments on commit 965e54e

Please sign in to comment.
You can’t perform that action at this time.