Revision f92e7cc9
Added by Walden Raines over 8 years ago
app/assets/javascripts/hidden_values.js | ||
---|---|---|
function turn_textarea_switch(checkbox) {
|
||
var id = checkbox.id.replace(/hidden_value$/,"value");
|
||
var target, session;
|
||
var id = checkbox.id.replace(/hidden_value$/, "value");
|
||
var source = document.getElementById(id);
|
||
var $editorContainer = $('.editor-container');
|
||
|
||
if (checkbox.checked) {
|
||
var target = '<input class="form-control" type="password" id="' + id + '" name="' + source.name + '" value ="' + source.value + '"></input>'
|
||
target = '<input class="form-control" type="password" id="' + id + '" name="' + source.name + '" value ="' + source.value + '"></input>'
|
||
$editorContainer.find('.navbar').hide();
|
||
$editorContainer.find('.ace_editor').remove();
|
||
$(source).replaceWith(target);
|
||
} else {
|
||
var target = '<textarea class="form-control" id="' + id + '" name="' + source.name + '" placeholder="Value" rows="1">' + source.value + '</textarea>'
|
||
target = '<textarea class="form-control editor_source hide" id="' + id + '" name="' + source.name + '" placeholder="Value" rows="1">' + source.value + '</textarea>'
|
||
$editorContainer.find('.navbar').show();
|
||
$(source).replaceWith(target);
|
||
|
||
onEditorLoad();
|
||
session = Editor.getSession();
|
||
session.setValue($(source).val());
|
||
}
|
||
$(source).replaceWith(target);
|
||
}
|
||
|
||
function hidden_value_control(){
|
||
$(".toggle-hidden-value a").click(function(event){
|
||
event.preventDefault();
|
Also available in: Unified diff
Fixes #11689: hide editor container when hidden value.
http://projects.theforeman.org/issues/11689