/*
  This function contains initialization code and event bindings for page elements
*/

var $ = jQuery = require('jquery');
require('../../node_modules/bootstrap-sass/assets/javascripts/bootstrap/button.js');
require('../../node_modules/bootstrap-sass/assets/javascripts/bootstrap/modal.js');
require('../../node_modules/jquery-ui/effect-blind.js');
var getValues = require('./getValues');
var picker = require('./picker');


$(document).ready(function() {
  $("#status").hide();
  $("#complete").hide();
  $("#please-review").hide();
  $("#dialog-message").hide();
});


$("#thisForm").submit(function( event ) {
  // Bootstrap button action binding
  var $btn = $("#copyFolderButton").button('loading');
  //$btn.button('reset') // call to reset to original condition
  $("#description").hide("blind");
  $("#status").show("blind");
  getValues.run(picker.selectedFolder);
  event.preventDefault();
});

$("#permissions").click(function() {
  if ($(this).is(":checked")) {
    $('#dialog-message').modal('show');
  }
});

$("#selectFolderButton").click(function() {
  picker.showPicker();
})
@@ -464,16 +464,39 @@
 on() %7B%0D%0A
+  picker.onApiLoad();%0D%0A
   $(%22#st
@@ -894,33 +894,12 @@
 ues.
-run(picker.selectedFolder
+get(
 );%0D%0A
@@ -1052,24 +1052,26 @@
   %7D%0D%0A%7D);%0D%0A%0D%0A
+%0D%0A
 $(%22#selectFo

call onApiLoad() on document load