-
Notifications
You must be signed in to change notification settings - Fork 4
#1050 UI:Change behaviour of address field in signup admin page #1098
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this code has some unnecessary checks and can be improved. We can achieve the change in fewer lines of code. Furthermore, these changes dont seem to work properly
vms/vms/static/vms/js/load_city.js
Outdated
$(document).ready(function() { | ||
$("#select_state").change(function() { | ||
/* Disables the city input field until the state input is filled up */ | ||
function hideCity(){ | ||
var state =document.getElementById("select_state"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have jquery already, use $
instead of document.getElementBy-
.
vms/vms/static/vms/js/load_state.js
Outdated
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these extra lines.
Alright , I Will make the required modification. Could you tell me what is not working properly with these changes? Do I need to put some more to the code apart from changing it to jQuery? |
Initially the state and city dropdowns are not disabled. |
As per the GIF, it is happening in mine. |
It is rather weird, if I run the app and navigate to admin signup through homepage, the dropdowns are not disbled by default. Can you show me a gif showing the dropdowns just after navigating t that page? |
. . . . |
Hello @psingh587 . Can you please check if all your commits have been pushed cause I am not able to see it locally after pulling your PR. Furthermore, do address the other review comments, give appropriate spacing link |
@psingh587 any update? |
Really sorry for the delay. There were some technical issues with my laptop. I will work upon this commit tonight and get back to you. |
City Input gets disabled if previous inputs are not filled up.
@rkpattnaik780 |
Codecov Report
@@ Coverage Diff @@
## develop #1098 +/- ##
==========================================
Coverage ? 86.93%
==========================================
Files ? 85
Lines ? 4057
Branches ? 237
==========================================
Hits ? 3527
Misses ? 458
Partials ? 72 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for these changes. It handles all the scenarios. Please make this PR cleaner, there are many unnecessary log statements that need to be removed and please indent properly. You are also required to squash your commits.
@@ -226,18 +225,19 @@ <h2 class="header">{% trans "Sign Up" %}</h2> | |||
{% endfor %} | |||
</select> | |||
</div> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this unnecessary blank line.
vms/vms/static/vms/js/load_city.js
Outdated
function hideCity(){ | ||
var country = $("#select_country"); | ||
var state = $("#select_state"); | ||
var city = $("#select_city"); if(state.prop('disabled') === false) console.log("yessss",state.val()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place this if statement in a proper position.
vms/vms/static/vms/js/load_city.js
Outdated
function hideCity(){ | ||
var country = $("#select_country"); | ||
var state = $("#select_state"); | ||
var city = $("#select_city"); if(state.prop('disabled') === false) console.log("yessss",state.val()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove console log as well.
vms/vms/static/vms/js/load_city.js
Outdated
var country = $("#select_country"); | ||
var state = $("#select_state"); | ||
var city = $("#select_city"); if(state.prop('disabled') === false) console.log("yessss",state.val()) | ||
if(state.prop('disabled') === false && state.val() !== null && state.val() !== "0") { console.log("ji") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove console log
vms/vms/static/vms/js/load_state.js
Outdated
$(document).ready(function() { | ||
$("#select_country").change(function() { | ||
console.log("hi") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove console.log
vms/vms/static/vms/js/load_state.js
Outdated
city.prop("disabled", true); | ||
city.val(""); | ||
} | ||
console.log(state.val()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove console.log
var state = $("#select_state"); | ||
var city = $("#select_city"); | ||
if(state.val() !== "0" && state.val() !== null &&state.prop('disabled') === false) { | ||
city.html(cities); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the indentation here.
vms/vms/static/vms/js/load_state.js
Outdated
} | ||
}); | ||
} | ||
} | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this extra space.
Removed unnecessary logs.
Removed extra logs and white spaces
vms/vms/static/vms/js/load_city.js
Outdated
success: function(cities) { | ||
var state = $("#select_state"); | ||
var city = $("#select_city"); | ||
if(state.val() !== "0" && state.val()!==null && state.prop('disabled') === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the indentation of this if/else block, we shouldn't have two tabs here. Sqaush the commits as well. In many places two tabs have been provided instead of one, please take care of that.
Hey! |
Description
In Sign Up Admin, I have made the city and state input disabled until the country is filled first. The city is disabled until the state is filled first.
Fixes #1050
Type of Change:
How Has This Been Tested?
Checked in my local server. Works well according to me. I have handled all the scenarios.
![inputVMS](https://user-images.githubusercontent.com/51945896/92457160-846ea200-f1e1-11ea-9f23-f378e81a5360.gif)
Checklist: