examples/api-samples/views/sample21.haml in groupdocs-1.5.7 vs examples/api-samples/views/sample21.haml in groupdocs-1.5.8

- old
+ new

@@ -25,17 +25,17 @@ %font{:color => 'red'} #{(defined? err) ? err : ''} %br/ #requestForm{:style => 'padding:20px; border:1px solid black;'} %p Enter data for request and press "Make request" button %form{:action => '/sample21', :enctype => 'multipart/form-data', :method => 'post'} - %label{:for => 'client_id'} GroupDocs ClientID + %label{:for => 'clientId'} GroupDocs ClientID %br/ - %input{:type=>'text', :name=>'client_id'} + %input{:type=>'text', :name=>'clientId'} %br/ - %label{:for => 'private_key'} GroupDocs PrivateKey + %label{:for => 'privateKey'} GroupDocs PrivateKey %br/ - %input{:type=>'text', :name=>'private_key'} + %input{:type=>'text', :name=>'privateKey'} %br/ %label{:for => 'email'} Email %br/ %input{:type=>'text', :name=>'email'} %br/ @@ -45,18 +45,76 @@ %br/ %label{:for => 'lastName'} Last Name %br/ %input{:type=>'text', :name=>'lastName'} %br/ - %label{:for => 'file'} File + %div.guid_radio + %input{:type=>'radio', :name=>'source', :value=>'guid'} File ID (GUID) + %br/ + %input{:type=>'radio', :name=>'source', :value=>'local', :checked=>'checked'}Upload local file + %br/ + %input{:type=>'radio', :name=>'source', :value=>'url'} Upload file from URL + %br/ + + %div.guid_field{:style=>'display:none;'} + %label{:for=>'fileId', :id=>'guid'} File ID (GUID) + %br/ + %input{:type=>'text', :name=>'fileId'} + + %div.guid_field + %label{:for=>'file'} Upload local file + %br/ + %input{:type=>'file', :name=>'file'} + + %div.guid_field{:style=>'display:none;'} + %label{:for=>'url', :id=>'url'} Upload file from URL + %br/ + %input{:type=>'text', :name=>'url'} + %br/ - %input{:name => 'file', :type => 'file'}/ + %label{:for=>'callback'} + Callback URL + %span.optional (Optional) + %br/ + %font{:color=>'grey'} (For test Callback you can use this URL: http://groupdocs-ruby-samples.herokuapp.com/sample21/signature_callback) + %input{:type=>'text', :size=>'70', :value=>"#{(defined? callback) ? callback : ''}", :name=>'callback'} %br/ + %label{:for => 'basePath'} Base Path + %span{:class => 'optional'} (Optional) %br/ - %input{:type => 'submit', :value => 'Make request'}/ - %div{:style => 'padding:20px; border:1px solid black;'} - %p - Results: - %br/ - #{(defined? iframe) ? iframe : ''} + %input{:type=>'text', :name=>'basePath'} + %br/ + %br/ + %input{:type => 'submit', :value => 'Make request'} + %span{:id=>'results_status', :style=>'color:red;display:none;'} (Please wait for ajax response) + %br/ + %iframe{:id=>'downloadframe', :style=>'display:none'} + %div{:style => 'padding:20px; border:1px solid black;'} + %p + Results: + %br/ + #{(defined? message) ? message : ''} + #{(defined? iframe) ? iframe : ''} -= partial :_others_samples += partial :_others_samples +%script{:src=>'//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'} +:javascript + function check() { + $.get('/sample21/check', function(data) { + $('#results_status').fadeOut("slow"); + $('#downloadframe').attr("src", "/sample21/downloads/" + data); + }, 'text'); + } + + $(function($){ + callbackUrl = $("input[name=callback]").val(); + + if(callbackUrl !== "") { + $('#results_status').fadeIn("slow"); + setTimeout(check, 5000) + } + $('.guid_radio input').change(function(){ + var elementIndex = $(this).parent().children('input').index($(this)); + $('.guid_field').hide(); + $('.guid_field').eq(elementIndex).show(); + }); + }); \ No newline at end of file