Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Upgrage js for updating form page.

  • Loading branch information...
commit bbba584b1d95043223f310a478f2aa83c5454e34 1 parent bd62704
@nyumatova nyumatova authored
View
9 project/sass/partials/_form.sass
@@ -28,6 +28,9 @@ $default-text-shadow-blur: 0
+single-text-shadow
text-decoration: none
+.dialogue .lock-botton
+ color: #888
+
.dialogue .report
margin: 1em 0 0 0
font-size: 1.4em
@@ -55,6 +58,12 @@ $default-text-shadow-blur: 0
image: image-url("action-error.png")
color: $dark-color
+.not-valid #id_url
+ border-color: $ref-color
+
+.not-valid #info
+ color: $ref-color
+
.result
margin: 2.5em 0 0 0
display: none
View
27 project/static/css/screen.css
@@ -239,11 +239,16 @@ pre {
}
/* line 31, ../../sass/partials/_form.sass */
+.dialogue .lock-botton {
+ color: #888888;
+}
+
+/* line 34, ../../sass/partials/_form.sass */
.dialogue .report {
margin: 1em 0 0 0;
font-size: 1.4em;
}
-/* line 35, ../../sass/partials/_form.sass */
+/* line 38, ../../sass/partials/_form.sass */
.dialogue .report p {
background-image: url('/static/images/action-waiting.png?1312010126');
background-repeat: no-repeat;
@@ -251,23 +256,33 @@ pre {
padding: 10px 0 0 22px;
color: #bbbbbb;
}
-/* line 43, ../../sass/partials/_form.sass */
+/* line 46, ../../sass/partials/_form.sass */
.dialogue .report .done {
background-image: url('/static/images/action-done.png?1312004913');
color: #23272a;
}
-/* line 48, ../../sass/partials/_form.sass */
+/* line 51, ../../sass/partials/_form.sass */
.dialogue .report .working {
background-image: url('/static/images/ajax-loader.gif?1312096230');
color: #23272a;
}
-/* line 53, ../../sass/partials/_form.sass */
+/* line 56, ../../sass/partials/_form.sass */
.dialogue .report .error {
background-image: url('/static/images/action-error.png?1312013270');
color: #23272a;
}
-/* line 58, ../../sass/partials/_form.sass */
+/* line 61, ../../sass/partials/_form.sass */
+.not-valid #id_url {
+ border-color: #bd2500;
+}
+
+/* line 64, ../../sass/partials/_form.sass */
+.not-valid #info {
+ color: #bd2500;
+}
+
+/* line 67, ../../sass/partials/_form.sass */
.result {
margin: 2.5em 0 0 0;
display: none;
@@ -275,7 +290,7 @@ pre {
text-align: center;
}
-/* line 64, ../../sass/partials/_form.sass */
+/* line 73, ../../sass/partials/_form.sass */
.view {
display: block;
}
View
46 project/static/js/form.js
@@ -34,6 +34,16 @@ $(document).ajaxSend(function(event, xhr, settings) {
}
});
+function lockForm() {
+ $('#id_url').attr('disabled','disabled');
+ $('.button').attr('disabled','disabled').addClass('lock-botton');
+}
+
+function unlockForm() {
+ $('#id_url').removeAttr('disabled');
+ $('.button').removeAttr('disabled').removeClass('lock-botton');
+}
+
function updateDatta() {
$.ajax({
url: __get_status_url__,
@@ -42,39 +52,48 @@ function updateDatta() {
success: function (data) {
var msg = $('#adding').text();
if (data.queue == 'working') {
- msg = 'Adding the project to the task queue...';}
+ lockForm();
+ msg = 'Adding the project to the task queue...';}
else if (data.queue == 'done') {
msg = 'Adding the project to the task queue completed successfully';}
else if (data.queue == 'error') {
- msg = 'Got an error when adding the project to the task queue';}
+ msg = 'Got an error when adding the project to the task queue';
+ unlockForm();}
$('#adding').removeClass('working done error').addClass(data.queue).text(msg);
msg = $('#cloning').text();
if (data.cloning == 'working') {
+ lockForm();
msg = 'Cloning the project...';}
else if (data.cloning == 'done') {
msg = 'Cloning the project completed successfully';}
else if (data.cloning == 'error') {
- msg = 'Got an error when cloning the project';}
+ msg = 'Got an error when cloning the project';
+ unlockForm();}
$('#cloning').removeClass('working done error').addClass(data.cloning).text(msg);
msg = $('#parsing').text();
if (data.parsing == 'working') {
+ lockForm();
msg = 'Parsing the source code...';}
else if (data.parsing == 'done') {
msg = 'Parsing the source code completed successfully';}
else if (data.parsing == 'error') {
- msg = 'Got an error when parsing the source code';}
+ msg = 'Got an error when parsing the source code';
+ unlockForm();}
$('#parsing').removeClass('working done error').addClass(data.parsing).text(msg);
msg = $('#analyzing').text();
if (data.analyzing == 'working') {
+ lockForm();
msg = 'Analyzing the source code...';}
else if (data.analyzing == 'done') {
msg = 'Analyzing the source code completed successfully';
- $('#result').addClass('view');}
+ $('#result').addClass('view');
+ unlockForm();}
else if (data.analyzing == 'error') {
- msg = 'Got an error when analyzing the source code';}
+ msg = 'Got an error when analyzing the source code';
+ unlockForm();}
$('#analyzing').removeClass('working done error').addClass(data.analyzing).text(msg);
}
});
@@ -89,20 +108,27 @@ $(function(){
context: this,
success: function (data) {
if (data.status == 'ok') {
- $('#id_url').css('border-color', '#D9D9D9');
- $('#info').text("You'll have access to the results within 30 days").css('color', '#23272A');
+ $(this).parent().removeClass('not-valid');
+ lockForm();
+ $('#info').text("You'll have access to the results within 30 days");
$('#result').removeClass('view');
$('#result a').attr('href', data.url);
}
else {
- $('#id_url').css('border-color', '#BD2500');
- $('#info').text(data.error).css('color', '#BD2500');
+ $(this).parent().addClass('not-valid');
+ $('#info').text(data.error);
+ unlockForm();
}
}
});
return false;
});
+ $('#id_url').focus(function() {
+ $('.dialogue').removeClass('not-valid');
+ $('#info').text("You'll have access to the results within 30 days");
+ });
+
var timeout = 1000;
updateDatta();
setInterval(updateDatta, timeout);
Please sign in to comment.
Something went wrong with that request. Please try again.