-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to remove/reset optional variables in fruitsalad #3675
Add ability to remove/reset optional variables in fruitsalad #3675
Conversation
This is my attempt to resolve the learning-unlimited#3674 issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this pull request @Vayras! I've left some comments, please let me know if you have any questions.
$j('#addToPalette').click(function(){ | ||
var newColor = $j('<input>'); | ||
newColor.addClass('palette'); | ||
newColor.attr({ | ||
name: 'palette', | ||
type: 'text', | ||
value: 'black' | ||
}); | ||
$j('#palette_custom_div').append(newColor); | ||
$j('#palette_custom_div').append(" "); | ||
showCustomPalette(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason that you removed this? Removing this breaks the ability to make a custom palette.
// Create the "Reset Color" button | ||
var resetButton = $j('<button class="reset-color">Reset Color</button>').click(function() { | ||
colorInput.spectrum("set", "#000000"); // Reset color to default | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this button is great, but I think we really want a way to remove the optional variables, not to just reset them to black.
// Create the "Reset Color" button | ||
var resetButton = $j('<button class="reset-color">Reset Color</button>').click(function() { | ||
colorInput.spectrum("set", "#000000"); // Reset color to default | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, buttons are "type=submit", so whenever you click a "Reset Color", it submits the form, discarding any changes that have been made.
// Create the "Reset Color" button | ||
var resetButton = $j('<button class="reset-color">Reset Color</button>').click(function() { | ||
colorInput.spectrum("set", "#000000"); // Reset color to default | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we would also have similar buttons next to the optional variables that exist on page load.
Superseded by #3696. |
This is my attempt to resolve the #3674 issue