commit f92e7cc9b0e1d9e4feecef072ceb973a87222c46
Author: Walden Raines <walden@redhat.com>
Date:   Thu Sep 10 11:20:04 2015 -0400

    Fixes #11689: hide editor container when hidden value.
    
    http://projects.theforeman.org/issues/11689

diff --git a/app/assets/javascripts/hidden_values.js b/app/assets/javascripts/hidden_values.js
index 60a1af45a..763ea085b 100644
--- a/app/assets/javascripts/hidden_values.js
+++ b/app/assets/javascripts/hidden_values.js
@@ -1,14 +1,24 @@
 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();
diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb
index db99c2f13..c1c3a50a7 100644
--- a/app/helpers/layout_helper.rb
+++ b/app/helpers/layout_helper.rb
@@ -201,7 +201,9 @@ module LayoutHelper
     error       = f.object.errors[attr] if f && f.object.respond_to?(:errors)
     help_inline = help_inline(options.delete(:help_inline), error)
     size_class  = options.delete(:size) || "col-md-4"
-    label = add_label(options, f, attr)
+    wrapper_class = options.delete(:wrapper_class) || "form-group"
+
+    label = options[:no_label] ? "" : add_label(options, f, attr)
 
     if table_field
       add_help_to_label(size_class, label, help_inline) do
@@ -211,7 +213,7 @@ module LayoutHelper
       help_block = content_tag(:span, options.delete(:help_block), :class => "help-block")
 
       content_tag(:div, :class => "clearfix") do
-        content_tag :div, :class => "form-group #{error.empty? ? "" : 'has-error'}",
+        content_tag :div, :class => "#{wrapper_class} #{error.empty? ? "" : 'has-error'}",
                     :id => options.delete(:control_group_id) do
           input = if options[:fullscreen]
                     content_tag(:div, yield.html_safe + fullscreen_input, :class => "input-group")
diff --git a/app/views/common_parameters/_form.html.erb b/app/views/common_parameters/_form.html.erb
index 4df82d3a5..9c2e800b3 100644
--- a/app/views/common_parameters/_form.html.erb
+++ b/app/views/common_parameters/_form.html.erb
@@ -1,26 +1,33 @@
 <%= form_for @common_parameter, :html => { :onsubmit => 'submit_code();' } do |f| %>
-  <%= base_errors_for @common_parameter %>
-  <%= text_f f, :name %>
-  <% if @common_parameter.hidden_value? %>
-    <%= password_f f, :value, :size => "col-md-8", :value => @common_parameter.value %>
-  <% else %>
+    <%= base_errors_for @common_parameter %>
+    <%= text_f f, :name %>
     <div class='form-group'>
       <label class="control-label col-md-2" for="common_parameter_value"><%= _("Value") %></label>
 
       <div class="col-md-9">
         <div class="editor-container">
           <%= render :partial => 'editor/toolbar', :locals => {:show_preview => false} %>
-          <%= f.text_area(:value,
-                         :class => "form-control value editor_source",
-                         :rows => line_count(f, :value),
-                         :placeholder => _("Value")) %>
+
+          <% if @common_parameter.hidden_value? %>
+              <%= password_f f, :value, :size => "", :no_label => true, :wrapper_class => "", :value => @common_parameter.value %>
+          <% else %>
+              <%= f.text_area(:value,
+                              :class => "form-control value editor_source",
+                              :rows => line_count(f, :value),
+                              :placeholder => _("Value")) %>
+          <% end %>
         </div>
       </div>
     </div>
-  <% end %>
-  <%= checkbox_f f, :hidden_value, :class => 'hidden_value_textarea_switch', :onchange => 'turn_textarea_switch(this)', :checked => f.object.hidden_value? %>
-  <%= submit_or_cancel f %>
+    <%= checkbox_f f, :hidden_value, :class => 'hidden_value_textarea_switch', :onchange => 'turn_textarea_switch(this)', :checked => f.object.hidden_value? %>
+    <%= submit_or_cancel f %>
 
-  <input type="hidden" id="old" value="<%= @common_parameter.value %>" />
-  <input type="hidden" id="new" value="<%= @common_parameter.value %>" />
+    <input type="hidden" id="old" value="<%= @common_parameter.value %>" />
+    <input type="hidden" id="new" value="<%= @common_parameter.value %>" />
 <% end %>
+
+<% if @common_parameter.hidden_value? %>
+  <script type="text/javascript">
+    $('.editor-container').find('.navbar').hide();
+  </script>
+<% end %>
\ No newline at end of file
diff --git a/test/integration/common_parameter_test.rb b/test/integration/common_parameter_test.rb
index f2a43e52a..2d2d99d6d 100644
--- a/test/integration/common_parameter_test.rb
+++ b/test/integration/common_parameter_test.rb
@@ -21,4 +21,11 @@ class CommonParameterIntegrationTest < ActionDispatch::IntegrationTest
     assert_submit_button(common_parameters_path)
     assert page.has_content? 'mynewvalue'
   end
+
+  test "does not display editor on hidden value" do
+    visit common_parameters_path
+    click_link "test"
+    check "common_parameter_hidden_value"
+    page.assert_no_selector 'editor_source'
+  end
 end
