Skip to content

Commit

Permalink
Fix part of oppia#5002: Removed NAV_MODE from side navigation bar (op…
Browse files Browse the repository at this point in the history
…pia#6008)

* Fix part of oppia#5002: Removed NAV_MODE from side navigation bar

* Update core/templates/dev/head/components/side_navigation_bar/SideNavigationBarDirective.js

Co-Authored-By: rakshitkumarcse <32777813+rakshitkumarcse@users.noreply.github.com>

* Removed NAV_MODE successfully from side navbar

* Removed NAV_MODE from top nav bar

* Removed NAV_MODE from base.html

* Removed all constants related to NAV_MODE

* Correction
  • Loading branch information
mighty-phoenix authored and apb7 committed Dec 24, 2018
1 parent ef0bd13 commit b27bb32
Show file tree
Hide file tree
Showing 20 changed files with 10 additions and 66 deletions.
7 changes: 0 additions & 7 deletions core/controllers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,6 @@ def render_template(
'Oppia is a free, open-source learning platform. Join the '
'community to create or try an exploration today!')

# nav_mode is used as part of the GLOBALS object in the frontend, but
# not every backend handler declares a nav_mode. Thus, the following
# code is a failsafe to ensure that the nav_mode key is added to all
# page requests.
if 'nav_mode' not in values:
values['nav_mode'] = ''

if redirect_url_on_logout is None:
redirect_url_on_logout = self.request.uri

Expand Down
1 change: 0 additions & 1 deletion core/controllers/collection_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def get(self, collection_id):

self.values.update({
'collection_id': collection.id,
'nav_mode': feconf.NAV_MODE_CREATE,
'SHOW_COLLECTION_NAVIGATION_TAB_HISTORY': (
feconf.SHOW_COLLECTION_NAVIGATION_TAB_HISTORY),
'SHOW_COLLECTION_NAVIGATION_TAB_STATS': (
Expand Down
1 change: 0 additions & 1 deletion core/controllers/collection_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def get(self, collection_id):
raise self.PageNotFoundException

self.values.update({
'nav_mode': feconf.NAV_MODE_COLLECTION,
'can_edit': rights_manager.check_can_edit_activity(
self.user, collection_rights),
'is_logged_in': bool(self.user_id),
Expand Down
2 changes: 0 additions & 2 deletions core/controllers/creator_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class NotificationsDashboardPage(base.BaseHandler):
def get(self):
self.values.update({
'meta_description': feconf.CREATOR_DASHBOARD_PAGE_DESCRIPTION,
'nav_mode': feconf.NAV_MODE_CREATOR_DASHBOARD,
})
self.render_template(
'pages/notifications_dashboard/notifications_dashboard.html',
Expand Down Expand Up @@ -138,7 +137,6 @@ def get(self):
interaction_ids))

self.values.update({
'nav_mode': feconf.NAV_MODE_CREATOR_DASHBOARD,
'allow_yaml_file_upload': feconf.ALLOW_YAML_FILE_UPLOAD,
'DEFAULT_TWITTER_SHARE_MESSAGE_DASHBOARD': (
DEFAULT_TWITTER_SHARE_MESSAGE_DASHBOARD.value),
Expand Down
1 change: 0 additions & 1 deletion core/controllers/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ def get(self, exploration_id):
'interaction_templates': jinja2.utils.Markup(
interaction_templates),
'meta_description': feconf.CREATE_PAGE_DESCRIPTION,
'nav_mode': feconf.NAV_MODE_CREATE,
'value_generators_js': jinja2.utils.Markup(
get_value_generators_js()),
'title': exploration.title,
Expand Down
3 changes: 0 additions & 3 deletions core/controllers/learner_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ class LearnerDashboardPage(base.BaseHandler):
@acl_decorators.can_access_learner_dashboard
def get(self):
"""Handles GET requests."""
self.values.update({
'nav_mode': feconf.NAV_MODE_LEARNER_DASHBOARD
})
self.render_template(
'pages/learner_dashboard/learner_dashboard.html',
redirect_url_on_logout='/')
Expand Down
2 changes: 0 additions & 2 deletions core/controllers/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def get(self):
'meta_description': (
feconf.SEARCH_PAGE_DESCRIPTION if search_mode
else feconf.LIBRARY_PAGE_DESCRIPTION),
'nav_mode': feconf.NAV_MODE_LIBRARY,
'has_fully_registered': bool(
self.user_id and
user_services.has_fully_registered(self.user_id)),
Expand Down Expand Up @@ -163,7 +162,6 @@ def get(self):
self.values.update({
'meta_description': (
feconf.LIBRARY_GROUP_PAGE_DESCRIPTION),
'nav_mode': feconf.NAV_MODE_LIBRARY,
'has_fully_registered': bool(
self.user_id and
user_services.has_fully_registered(self.user_id)),
Expand Down
7 changes: 0 additions & 7 deletions core/controllers/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def get(self):
c_value = self.request.get('c')
self.values.update({
'meta_description': feconf.SPLASH_PAGE_DESCRIPTION,
'nav_mode': feconf.NAV_MODE_SPLASH,
})

if not c_value:
Expand Down Expand Up @@ -77,7 +76,6 @@ def get(self):
"""Handles GET requests."""
self.values.update({
'meta_description': feconf.ABOUT_PAGE_DESCRIPTION,
'nav_mode': feconf.NAV_MODE_ABOUT,
})
self.render_template('pages/about/about.html')

Expand All @@ -90,7 +88,6 @@ def get(self):
"""Handles GET requests."""
self.values.update({
'meta_description': feconf.GET_STARTED_PAGE_DESCRIPTION,
'nav_mode': feconf.NAV_MODE_GET_STARTED,
})
self.render_template('pages/get_started/get_started.html')

Expand All @@ -103,7 +100,6 @@ def get(self):
"""Handles GET requests."""
self.values.update({
'meta_description': feconf.TEACH_PAGE_DESCRIPTION,
'nav_mode': feconf.NAV_MODE_TEACH,
})
self.render_template('pages/teach/teach.html')

Expand All @@ -116,7 +112,6 @@ def get(self):
"""Handles GET requests."""
self.values.update({
'meta_description': feconf.CONTACT_PAGE_DESCRIPTION,
'nav_mode': feconf.NAV_MODE_CONTACT,
})
self.render_template('pages/contact/contact.html')

Expand All @@ -129,7 +124,6 @@ def get(self):
"""Handles GET requests."""
self.values.update({
'meta_description': feconf.DONATE_PAGE_DESCRIPTION,
'nav_mode': feconf.NAV_MODE_DONATE,
})
self.render_template('pages/donate/donate.html')

Expand All @@ -142,7 +136,6 @@ def get(self):
"""Handles GET requests."""
self.values.update({
'meta_description': feconf.THANKS_PAGE_DESCRIPTION,
'nav_mode': feconf.NAV_MODE_THANKS,
})
self.render_template('pages/thanks/thanks.html')

Expand Down
3 changes: 0 additions & 3 deletions core/controllers/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def get(self, username):
raise self.PageNotFoundException

self.values.update({
'nav_mode': feconf.NAV_MODE_PROFILE,
'PROFILE_USERNAME': user_settings.username,
})
self.render_template('pages/profile/profile.html')
Expand Down Expand Up @@ -106,7 +105,6 @@ def get(self):
"""Handles GET requests."""
self.values.update({
'meta_description': feconf.PREFERENCES_PAGE_DESCRIPTION,
'nav_mode': feconf.NAV_MODE_PROFILE,
'LANGUAGE_CODES_AND_NAMES': (
utils.get_all_language_codes_and_names()),
})
Expand Down Expand Up @@ -260,7 +258,6 @@ def get(self):

self.values.update({
'meta_description': feconf.SIGNUP_PAGE_DESCRIPTION,
'nav_mode': feconf.NAV_MODE_SIGNUP,
'CAN_SEND_EMAILS': feconf.CAN_SEND_EMAILS,
})
self.render_template('pages/signup/signup.html')
Expand Down
2 changes: 0 additions & 2 deletions core/controllers/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def _get_exploration_player_data(
- 'is_private': bool. Whether the exploration is private or not.
- 'meta_name': str. Title of exploration.
- 'meta_description': str. Objective of exploration.
- 'nav_mode': str. 'explore'.
"""
try:
exploration = exp_services.get_exploration_by_id(
Expand Down Expand Up @@ -148,7 +147,6 @@ def _get_exploration_player_data(
'meta_name': exploration.title,
# Note that this overwrites the value in base.py.
'meta_description': utils.capitalize_string(exploration.objective),
'nav_mode': feconf.NAV_MODE_EXPLORE,
}


Expand Down
1 change: 0 additions & 1 deletion core/controllers/skill_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def get(self, skill_id):

self.values.update({
'skill_id': skill.id,
'nav_mode': feconf.NAV_MODE_CREATE,
'DEFAULT_OBJECT_VALUES': obj_services.get_default_object_values(),
'additional_angular_modules': additional_angular_modules,
'INTERACTION_SPECS': interaction_registry.Registry.get_all_specs(),
Expand Down
1 change: 0 additions & 1 deletion core/controllers/story_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def get(self, topic_id, story_id):
self.values.update({
'story_id': story.id,
'story_title': story.title,
'nav_mode': feconf.NAV_MODE_STORY_EDITOR
})

self.render_template(
Expand Down
1 change: 0 additions & 1 deletion core/controllers/topic_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def get(self, topic_id):
self.values.update({
'topic_id': topic.id,
'topic_name': topic.name,
'nav_mode': feconf.NAV_MODE_TOPIC_EDITOR,
'DEFAULT_OBJECT_VALUES': obj_services.get_default_object_values(),
'additional_angular_modules': additional_angular_modules,
'INTERACTION_SPECS': interaction_registry.Registry.get_all_specs(),
Expand Down
3 changes: 0 additions & 3 deletions core/controllers/topics_and_skills_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ def get(self):
if not constants.ENABLE_NEW_STRUCTURE_EDITORS:
raise self.PageNotFoundException

self.values.update({
'nav_mode': feconf.NAV_MODE_TOPICS_AND_SKILLS_DASHBOARD
})
self.render_template(
'pages/topics_and_skills_dashboard/'
'topics_and_skills_dashboard.html', redirect_url_on_logout='/')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.currentUrl = window.location.pathname;
$scope.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl;
}]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,35 +88,35 @@
</div>

<ul>
<li ng-class="{'active': NAV_MODE === 'library'}">
<li ng-class="{'active': currentUrl === '/library'}">
<a href="/library" class="protractor-mobile-test-library-link">
<i class="material-icons oppia-sidebar-menu-icon">&#xE88A;</i>
<span translate="I18N_SIDEBAR_LIBRARY_LINK"></span>
</a>
</li>

<li ng-class="{'active': NAV_MODE === 'about'}">
<li ng-class="{'active': currentUrl === '/about'}">
<a href="/about" class="protractor-mobile-test-about-link">
<i class="material-icons oppia-sidebar-menu-icon">&#xE887;</i>
<span translate="I18N_SIDEBAR_ABOUT_LINK"></span>
</a>
</li>

<li ng-class="{'active': NAV_MODE === 'get_started'}">
<li ng-class="{'active': currentUrl === '/get_started'}">
<a href="/get_started" class="protractor-mobile-test-get-started-link">
<i class="oppia-sidebar-menu-icon fa">&#xf135;</i>
<span translate="I18N_SIDEBAR_GET_STARTED"></span>
</a>
</li>

<li ng-class="{'active': NAV_MODE === 'teach'}">
<li ng-class="{'active': currentUrl === '/teach'}">
<a href="/teach" class="protractor-mobile-test-teach-link">
<i class="material-icons oppia-sidebar-menu-icon">&#xE88E;</i>
<span translate="I18N_SIDEBAR_TEACH_WITH_OPPIA"></span>
</a>
</li>

<li ng-class="{'active': NAV_MODE === 'donate'}">
<li ng-class="{'active': currentUrl === '/donate'}">
<a href="/donate" class="protractor-mobile-test-donate-link">
<i class="material-icons oppia-sidebar-menu-icon">&#xE87D;</i>
<span translate="I18N_SIDEBAR_DONATE"></span>
Expand All @@ -130,7 +130,7 @@
</a>
</li>

<li ng-class="{'active': NAV_MODE === 'contact'}">
<li ng-class="{'active': currentUrl === '/contact'}">
<a href="/contact" class="protractor-mobile-test-contact-link">
<i class="material-icons oppia-sidebar-menu-icon">&#xE0BE;</i>
<span translate="I18N_SIDEBAR_CONTACT_US"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ oppia.directive('topNavigationBar', [
var NAV_MODES_WITH_CUSTOM_LOCAL_NAV = [
'create', 'explore', 'collection', 'topics_and_skills_dashboard',
'topic_editor', 'story_editor'];
$scope.NAV_MODE = GLOBALS.NAV_MODE;
$scope.currentUrl = window.location.pathname.split("/")[1];
$scope.LABEL_FOR_CLEARING_FOCUS = LABEL_FOR_CLEARING_FOCUS;
$scope.newStructuresEnabled = constants.ENABLE_NEW_STRUCTURE_EDITORS;
$scope.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl;
Expand All @@ -102,9 +102,9 @@ oppia.directive('topNavigationBar', [
keyCode: 9
}
};
$scope.userMenuIsShown = ($scope.NAV_MODE !== NAV_MODE_SIGNUP);
$scope.userMenuIsShown = ($scope.currentUrl !== NAV_MODE_SIGNUP);
$scope.standardNavIsShown = (
NAV_MODES_WITH_CUSTOM_LOCAL_NAV.indexOf($scope.NAV_MODE) === -1);
NAV_MODES_WITH_CUSTOM_LOCAL_NAV.indexOf($scope.currentUrl) === -1);

$scope.onLoginButtonClicked = function() {
SiteAnalyticsService.registerStartLoginEvent('loginButton');
Expand Down
1 change: 0 additions & 1 deletion core/templates/dev/head/pages/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
csrf_token: JSON.parse('{{csrf_token|js_string}}'),
status_code: JSON.parse('{{status_code}}'),
GCS_RESOURCE_BUCKET_NAME: JSON.parse('{{GCS_RESOURCE_BUCKET_NAME|js_string}}'),
NAV_MODE: JSON.parse('{{nav_mode|js_string}}'),
SITE_FEEDBACK_FORM_URL: JSON.parse('{{SITE_FEEDBACK_FORM_URL|js_string}}'),
iframed: JSON.parse('{{iframed|js_string}}'),
isTopicManager: JSON.parse('{{is_topic_manager|js_string}}'),
Expand Down
1 change: 0 additions & 1 deletion core/tests/build_sources/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
DEV_MODE: JSON.parse('{{DEV_MODE|js_string}}'),
status_code: JSON.parse('{{status_code}}'),
GCS_RESOURCE_BUCKET_NAME: JSON.parse('{{GCS_RESOURCE_BUCKET_NAME|js_string}}'),
NAV_MODE: JSON.parse('{{nav_mode|js_string}}'),
SITE_FEEDBACK_FORM_URL: JSON.parse('{{SITE_FEEDBACK_FORM_URL|js_string}}'),
iframed: JSON.parse('{{iframed|js_string}}'),
isAdmin: JSON.parse('{{is_admin|js_string}}'),
Expand Down
19 changes: 0 additions & 19 deletions feconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,25 +710,6 @@ def get_empty_ratings():
USER_EXPLORATION_EMAILS_PREFIX = '/createhandler/notificationpreferences'
USERNAME_CHECK_DATA_URL = '/usernamehandler/data'

NAV_MODE_ABOUT = 'about'
NAV_MODE_GET_STARTED = 'get_started'
NAV_MODE_COLLECTION = 'collection'
NAV_MODE_CONTACT = 'contact'
NAV_MODE_CREATE = 'create'
NAV_MODE_CREATOR_DASHBOARD = 'creator_dashboard'
NAV_MODE_DONATE = 'donate'
NAV_MODE_EXPLORE = 'explore'
NAV_MODE_LEARNER_DASHBOARD = 'learner_dashboard'
NAV_MODE_LIBRARY = 'library'
NAV_MODE_PROFILE = 'profile'
NAV_MODE_SIGNUP = 'signup'
NAV_MODE_SPLASH = 'splash'
NAV_MODE_STORY_EDITOR = 'story_editor'
NAV_MODE_TEACH = 'teach'
NAV_MODE_THANKS = 'thanks'
NAV_MODE_TOPICS_AND_SKILLS_DASHBOARD = 'topics_and_skills_dashboard'
NAV_MODE_TOPIC_EDITOR = 'topic_editor'

# Event types.
EVENT_TYPE_ALL_STATS = 'all_stats'
EVENT_TYPE_STATE_HIT = 'state_hit'
Expand Down

0 comments on commit b27bb32

Please sign in to comment.