-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix part of #5002: Removed NAV_MODE from side navigation bar #6008
Conversation
@vojtechjelinek |
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! NAV_MODE
is also used in TopNavigationBarDirective.js remove it from there too.
And after you remove all the usage of NAV_MODE
in frontend you should remove it from our codebase completely. So for example from base.html, and in feconf.py there are constants related to NAV_MODE
remove them too.
@@ -26,7 +26,7 @@ oppia.directive('sideNavigationBar', [ | |||
'side_navigation_bar_directive.html'), | |||
controller: ['$scope', '$timeout', function( | |||
$scope, $timeout) { | |||
$scope.NAV_MODE = GLOBALS.NAV_MODE; | |||
$scope.CURRENT_URL = window.location.pathname; |
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.
Use angular version of window.location.pathname
an since now it's not really a constant use camelCase
$scope.CURRENT_URL = window.location.pathname; | |
$scope.currentUrl = $location.path(); |
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.
@vojtechjelinek after this change in SideNavigationBarDirective.js, the side nav bar has stopped working even after making equivalent changes in html. I also added '$location' to controller and function parameters. Still the expected behaviour is not established.
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.
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'm not sure, try to debug it, is there some error in browser console, try to print the value of currentUrl
to check it contains correct value.
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.
@vojtechjelinek
I did all the research possible, and fixed the issue.
But now, a new problem has arised. The $location api doesn't have the capability of reloading the entire page, unlike window.location(Look at the screenshot below). So the url gets changed on clicking a button on side nav bar, but page doesn't get reloaded, resulting the user to stay on the same page as before. What should we do now? Use window.location itself?
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.
Oh I see, we definitely shouldn't modify $locationProvider
, so use window.location.pathname
please.
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.
@vojtechjelinek Alright. Thanks.
…igationBarDirective.js Co-Authored-By: rakshitkumarcse <32777813+rakshitkumarcse@users.noreply.github.com>
Codecov Report
@@ Coverage Diff @@
## develop #6008 +/- ##
=======================================
Coverage 45.3% 45.3%
=======================================
Files 520 520
Lines 30667 30667
Branches 4597 4597
=======================================
Hits 13893 13893
Misses 16774 16774
Continue to review full report at Codecov.
|
@vojtechjelinek thanks for the guidance. This will make it easier for me to work on other parts of the issue. |
@vojtechjelinek The PR is ready for final review and merge. |
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.
Hi, just one comment and nav_mode
is also used in base.html so remove it from there.
@@ -61,7 +61,7 @@ def get(self, collection_id): | |||
|
|||
self.values.update({ | |||
'collection_id': collection.id, | |||
'nav_mode': feconf.NAV_MODE_CREATE, | |||
'nav_mode': 'create', |
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.
Do you need this variable anymore? This is just passed to the Jinja and Jinja will include int the HTML files. And since you removed NAV_MODE from base.html it!s not needed anymore. Ditto for the other files below.
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.
@vojtechjelinek Oh. Removing these then.
Thanks.
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.
@vojtechjelinek Does this look fine now?
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.
Yes
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. LGTM!
@vojtechjelinek Kindly merge. |
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.
LGTM (for changes in core/tests/..
), thanks @rakshitkumarcse!
@apb7 Thanks for the review. |
Explanation
Fixes part of #5002: Removed the constant NAV_MODE and made a new variable CURRENT_URL which stores the url of the current URL(as the name suggests). This variable is then used to determine the active tab/page.
Checklist
python scripts/pre_commit_linter.py
andbash scripts/run_frontend_tests.sh
.