mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-19 21:04:06 -07:00
Add/edit package unlim patch;
This commit is contained in:
parent
59467f6385
commit
d3390d7ad0
2 changed files with 34 additions and 6 deletions
|
@ -11,9 +11,14 @@ App.Actions.PACKAGE.disable_unlimited = function(elm, source_elm) {
|
||||||
if ($(elm).data('prev_value') && $(elm).data('prev_value').trim() != '') {
|
if ($(elm).data('prev_value') && $(elm).data('prev_value').trim() != '') {
|
||||||
var prev_value = $(elm).data('prev_value').trim();
|
var prev_value = $(elm).data('prev_value').trim();
|
||||||
$(elm).val(prev_value);
|
$(elm).val(prev_value);
|
||||||
|
if (App.Helpers.isUnlimitedValue(prev_value)) {
|
||||||
|
$(elm).val('0');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(elm).val('0');
|
if (App.Helpers.isUnlimitedValue($(elm).val())) {
|
||||||
|
$(elm).val('0');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$(elm).attr('disabled', false);
|
$(elm).attr('disabled', false);
|
||||||
$(source_elm).css('opacity', '0.5');
|
$(source_elm).css('opacity', '0.5');
|
||||||
|
@ -38,16 +43,25 @@ App.Listeners.PACKAGE.checkbox_unlimited_feature = function() {
|
||||||
App.Listeners.PACKAGE.init = function() {
|
App.Listeners.PACKAGE.init = function() {
|
||||||
$('.unlim-trigger').each(function(i, elm) {
|
$('.unlim-trigger').each(function(i, elm) {
|
||||||
var ref = $(elm).prev('.vst-input');
|
var ref = $(elm).prev('.vst-input');
|
||||||
if ($(ref).val().trim() == App.Constants.UNLIM_VALUE || $(ref).val().trim() == App.Constants.UNLIM_TRANSLATED_VALUE) {
|
if (App.Helpers.isUnlimitedValue($(ref).val())) {
|
||||||
$(ref).val('0');
|
|
||||||
App.Actions.PACKAGE.enable_unlimited(ref, elm);
|
App.Actions.PACKAGE.enable_unlimited(ref, elm);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$(ref).data('prev_value', $(ref).val());
|
||||||
App.Actions.PACKAGE.disable_unlimited(ref, elm);
|
App.Actions.PACKAGE.disable_unlimited(ref, elm);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
App.Helpers.isUnlimitedValue = function(value) {
|
||||||
|
var value = value.trim();
|
||||||
|
if (value == App.Constants.UNLIM_VALUE || value == App.Constants.UNLIM_TRANSLATED_VALUE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Page entry point
|
// Page entry point
|
||||||
// Trigger listeners
|
// Trigger listeners
|
||||||
|
|
|
@ -11,9 +11,14 @@ App.Actions.PACKAGE.disable_unlimited = function(elm, source_elm) {
|
||||||
if ($(elm).data('prev_value') && $(elm).data('prev_value').trim() != '') {
|
if ($(elm).data('prev_value') && $(elm).data('prev_value').trim() != '') {
|
||||||
var prev_value = $(elm).data('prev_value').trim();
|
var prev_value = $(elm).data('prev_value').trim();
|
||||||
$(elm).val(prev_value);
|
$(elm).val(prev_value);
|
||||||
|
if (App.Helpers.isUnlimitedValue(prev_value)) {
|
||||||
|
$(elm).val('0');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(elm).val('0');
|
if (App.Helpers.isUnlimitedValue($(elm).val())) {
|
||||||
|
$(elm).val('0');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$(elm).attr('disabled', false);
|
$(elm).attr('disabled', false);
|
||||||
$(source_elm).css('opacity', '0.5');
|
$(source_elm).css('opacity', '0.5');
|
||||||
|
@ -38,16 +43,25 @@ App.Listeners.PACKAGE.checkbox_unlimited_feature = function() {
|
||||||
App.Listeners.PACKAGE.init = function() {
|
App.Listeners.PACKAGE.init = function() {
|
||||||
$('.unlim-trigger').each(function(i, elm) {
|
$('.unlim-trigger').each(function(i, elm) {
|
||||||
var ref = $(elm).prev('.vst-input');
|
var ref = $(elm).prev('.vst-input');
|
||||||
if ($(ref).val().trim() == App.Constants.UNLIM_VALUE || $(ref).val().trim() == App.Constants.UNLIM_TRANSLATED_VALUE) {
|
if (App.Helpers.isUnlimitedValue($(ref).val())) {
|
||||||
$(ref).val('0');
|
|
||||||
App.Actions.PACKAGE.enable_unlimited(ref, elm);
|
App.Actions.PACKAGE.enable_unlimited(ref, elm);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$(ref).data('prev_value', $(ref).val());
|
||||||
App.Actions.PACKAGE.disable_unlimited(ref, elm);
|
App.Actions.PACKAGE.disable_unlimited(ref, elm);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
App.Helpers.isUnlimitedValue = function(value) {
|
||||||
|
var value = value.trim();
|
||||||
|
if (value == App.Constants.UNLIM_VALUE || value == App.Constants.UNLIM_TRANSLATED_VALUE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Page entry point
|
// Page entry point
|
||||||
// Trigger listeners
|
// Trigger listeners
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue