-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fire: Remove/comment dependencies on IRS (index, vehicle_reports) #1398
base: master
Are you sure you want to change the base?
Conversation
Looks good to me. If vehicle_report is now unused, that should be indicated in its docstring. |
...probably with a todo to clarify why it's unused, and what should be done to make it useful again (e.g. re-implementing the same based on event-module?) |
Is |
Well, just imagine you were new to this code base, had a requirement that would suggest using this function, and would find that docstring: would it help you to understand the purpose of the function, and what you can do in order to make use of it? If that's a yes, then it's good enough. |
Don't mean to be disrespectful, but I don't have to imagine. I am new to the codebase I and have the requirement (resp. my employer has the intention) to use pretty much every functionality which has been already written. I'm chewing through the codebase since mid-June and looking at the number of ticket in our internal system, I'm barely half-way there. So yes, pretty much any comment is good enough. Definitely better than no comment at all. :) Anyway, added the remark about reimplementation in event module. |
Yup, that was exactly my point: from your perspective you can better judge what is "good enough" a comment, whilst I can only name the general requirement and make suggestions. Thus, if you deem your comment useful for others in the same situation as yours, then I'd rely on that. |
modules/s3db/fire.py
Outdated
@@ -193,7 +193,7 @@ def model(self): | |||
), | |||
Field("code", length=10, # Mayon compatibility | |||
label = T("Code"), | |||
represent = lambda v: v or NONE, | |||
represent = lambda v: v or None, |
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.
No, that's actually meant to be NONE not None ;) However, this may be missing:
NONE = current.messages["NONE"]
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.
So, maybe replace NONE
with current.messages["NONE"]
here.
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.
Yup, better.
Can I get a hint for one extra fix, please? In the Fire Zone creation form, there is a Create Zone Type popup link. It opens and loads the popup content as expected, but it doesn't assign |
Why is the form hidden in the first place? It shouldn't be. |
Apparently all |
You're right - I think it's a timing problem with S3.popup_loaded (in S3.js). Apparently it's called before the DOM of the popup is ready, so I' trying to fix that now. |
Timing seems to be OK. Strangely enough, that form simply doesn't do anything on jQuery These don't work:
This works:
I also find strange that Fire Stations is the only module where the problem exists. //Edit: It actually exhibits the same behavior also when directly opened in new window. Even there the |
OK, found the reason. The form contains a textarea with |
Well, this took me a while to grasp...although in hindsight it's plain obvious: The name-attributes of input elements in a form set properties for the DOM Element. E.g. if you have an input with the name "example", then the form Element has a property So far, so good. And when you now have an input with the name "style", then that would obviously become form.style. But that overwrites the Element.style property of the form - which is just exactly the handle that is needed for JavaScript to set Element.style.display='block'. And therefore, jQuery.show for the form will never succeed as long as there is a field "style" in that table. It would of course work if, instead of having a global CSS The other way to fix it is to avoid fields with the name "style" (and thereby inputs with name="style"). This is what I did for this case now, for one, because "mapstyle" is more self-explaining anyway, and for another, the field is currently unused. However, there are other tables with fields "style" (s3db/gis.py), and those can not easily be changed in this way. Nor is it so striking obvious that you shouldn't use "style" as a field name or why. So I think, this needs yet another round of tweaking to make it more robust - namely, to not hide/show the popup form, but rather the form container. That though requires it to be present in all templates, and in all templates equally, so I need to investigate that first. Hence, for now, the fix: |
So...now I additionally changed it to initially hide the container DIV rather than the FORM, because DIVs don't have that vulnerability. It's not the easiest change as touching widgets.css always requires to re-minify each and every theme. I already did a bunch, but I'm growing very tired now, so need to leave the rest for tomorrow to avoid mistakes. Can you confirm whether that solves the problem? |
Ah, you found the root cause before me - saw that only now! (sorry it's really late...) |
I confirm that the Fire Station popup is now popping up correctly along with all the others :) Nice job. |
- Remove/comment dependencies on IRS (index, vehicle_reports) - Fix error while adding fire station without a code - Allow import and display map of fire zones - Add title to Zone Types popup
Rebased and squashed. |
PR for removal Fire Stations dependency on irs as briefly discussed on Google Groups.
vehicle_report
remained and is now unused.