Sha256: 1cb96f5dbb39f8b722a215874efba0526b7d8cf0f76885e7bff58afaae8beec0

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

$(document).ready(function() {
  var actionNumber = 1;
  var variableNumber = 1;

  $('#add-action').click(function(event) {
    $('<div class="field"><label class="two-column left">action ' + actionNumber + ':</label><input class="two-column right box" id="action' + actionNumber + '" name="deploy[actions][]" placeholder="action" type="text"></div>').insertBefore($(this).parent());
    actionNumber++;
  });

  $('#add-variable').click(function(event) {
    $('<div class="field"><input class="two-column left box" id="key' + variableNumber + '" name="deploy[variables][keys][]" placeholder="key" type="text"><input class="two-column right box" id="value' + variableNumber + '" name="deploy[variables][values][]" placeholder="value" type="text"></div>').insertBefore($(this).parent());
    variableNumber++;
  });

  if ($('.deep-thought').hasClass('alert')) {
    checkIfDoneDeploying();
  }
});

function checkIfDoneDeploying() {
  $.ajax({
    type:'GET',
    url:'/deploying',
    dataType:'json',
    success: function(data) {
      if (!data.deploying) {
        $('.deep-thought').removeClass('alert')
        $('.deep-thought > h1').text('Deep Thought is finished deploying.');
        $('#deploy').removeClass('disabled').removeAttr('disabled').attr('value', 'deploy');
      }
      else {
        setTimeout(checkIfDoneDeploying, 5000);
      }
    }
  });
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deep_thought-0.2.1 lib/deep_thought/public/assets/javascripts/main.js
deep_thought-0.1.1 lib/deep_thought/public/assets/javascripts/main.js
deep_thought-0.1.0 lib/deep_thought/public/assets/javascripts/main.js