Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
dd883cd
FAQ and About us external link added. (#398)
mamjad00 Mar 13, 2018
2cb16f4
FAQ and About us external link added. (#398) (#399)
mamjad00 Mar 13, 2018
f1fff52
FAQ link re-direct to platform.
mamjad00 Mar 13, 2018
0335782
Merge pull request #400 from philanthropy-u/faq-link-revert
muhammadnadeem Mar 14, 2018
dc11286
Links optimization. (#401)
mamjad00 Mar 14, 2018
ad49270
LP-819
muhammadnadeem Mar 14, 2018
99bc739
Replace single quotes with double
muhammadnadeem Mar 14, 2018
69d968d
Merge pull request #402 from philanthropy-u/mnadeem/onboarding-arbiso…
muhammadnadeem Mar 14, 2018
9f3e343
FAQ link to website.
mamjad00 Mar 14, 2018
ec08957
Merge branch 'staging' into develop
muhammadnadeem Mar 14, 2018
cf968bb
Merge pull request #405 from philanthropy-u/mamjad00/faq-linkto-website
mamjad00 Mar 14, 2018
baf1182
Merge pull request #403 from philanthropy-u/develop
muhammadnadeem Mar 14, 2018
41e8f31
Update redirection logic for account settings
muhammadnadeem Mar 14, 2018
7d163d8
Merge pull request #406 from philanthropy-u/mnadeem/onboarding-arbiso…
muhammadnadeem Mar 14, 2018
a4ee53c
Merge pull request #407 from philanthropy-u/develop
muhammadnadeem Mar 14, 2018
c044a26
Mark user as first_learner in new selected organization
muhammadnadeem Mar 14, 2018
773cfae
Merge pull request #408 from philanthropy-u/mnadeem/onboarding-arbiso…
zee-pk Mar 14, 2018
8540ba6
Merge pull request #409 from philanthropy-u/develop
muhammadnadeem Mar 14, 2018
5f873a9
About us link to website.
mamjad00 Mar 14, 2018
7f387b0
Merge pull request #410 from philanthropy-u/about-us-link-update
zee-pk Mar 14, 2018
b0a9034
Merge pull request #411 from philanthropy-u/develop
muhammadnadeem Mar 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions lms/djangoapps/onboarding/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ def __init__(self, *args, **kwargs):
self.fields['country_of_employment'].required = False
self.fields['city_of_employment'].required = False

if not self.instance.organization:
self.fields['role_in_org'].required = False
self.fields['start_month_year'].required = False
self.fields['hours_per_week'].required = False

focus_area_choices = ((field_name, label) for field_name, label in
UserExtendedProfile.FUNCTIONS_LABELS.items())

Expand Down Expand Up @@ -174,12 +179,13 @@ def clean_language(self):
raise forms.ValidationError(ugettext_noop('Please select language.'))

def clean_start_month_year(self):
start_month_year = datetime.strptime(
self.cleaned_data['start_month_year'],
'%m/%Y')
if self.instance.organization:
start_month_year = datetime.strptime(
self.cleaned_data['start_month_year'],
'%m/%Y')

if start_month_year > datetime.now():
raise forms.ValidationError(ugettext_noop("Please enter a valid start month/year"))
if start_month_year > datetime.now():
raise forms.ValidationError(ugettext_noop("Please enter a valid start month/year"))

return self.cleaned_data['start_month_year']

Expand Down Expand Up @@ -711,7 +717,10 @@ def save(self, user=None, commit=True):
prev_org = extended_profile.organization
extended_profile.organization = organization_to_assign

# Reset organizations under my administrations if i updated my organization + ask for org details
if organization_to_assign.users_count() == 0:
extended_profile.is_first_learner = True

# Reset organizations under my administrations if i updated my organization & ask for org details
if not prev_org == organization_to_assign:
Organization.objects.filter(admin=user).update(admin=None)
extended_profile.is_organization_metrics_submitted = False
Expand All @@ -731,6 +740,13 @@ def save(self, user=None, commit=True):
extended_profile.organization.admin = None
extended_profile.organization.save()

if extended_profile.is_first_learner:
extended_profile.is_first_learner = False

extended_profile.role_in_org = None
extended_profile.start_month_year = None
extended_profile.hours_per_week = 0

extended_profile.organization = None
extended_profile.is_organization_metrics_submitted = False

Expand Down
4 changes: 3 additions & 1 deletion lms/djangoapps/onboarding/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,9 @@ def get_normal_user_attend_surveys(self):
"""
attended_list = []

if self.user.profile.level_of_education and self.start_month_year and self.english_proficiency:
if (not self.organization and self.user.profile.level_of_education and self.english_proficiency) or (
self.organization and self.user.profile.level_of_education and self.start_month_year and
self.english_proficiency):
attended_list.append(self.SURVEYS_LIST[0])
if self.is_interests_data_submitted:
attended_list.append(self.SURVEYS_LIST[1])
Expand Down
17 changes: 11 additions & 6 deletions lms/djangoapps/onboarding/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def user_info(request):
is_under_age = False

template = 'onboarding/tell_us_more_survey.html'
next_page_url = reverse('interests')
redirect_to_next = True

if request.path == reverse('additional_information'):
Expand Down Expand Up @@ -98,11 +97,16 @@ def user_info(request):

if form.is_valid() and not is_under_age:
form.save(request)

are_forms_complete = not (bool(user_extended_profile.unattended_surveys(_type='list')))
unattended_surveys = user_extended_profile.unattended_surveys(_type='list')
are_forms_complete = not (bool(unattended_surveys))

if not are_forms_complete and redirect_to_next:
return redirect(next_page_url)
return redirect(unattended_surveys[0])

# this will only executed if user updated his/her employed status from account settings page
# redirect user to account settings page where he come from
if not request.path == "/myaccount/additional_information/":
return redirect(reverse("update_account_settings"))

else:
form = forms.UserInfoModelForm(instance=user_extended_profile, initial=initial)
Expand Down Expand Up @@ -386,10 +390,11 @@ def update_account_settings(request):
form = forms.UpdateRegModelForm(request.POST, instance=user_extended_profile)
if form.is_valid():
user_extended_profile = form.save(user=user_extended_profile.user, commit=True)
are_forms_complete = not (bool(user_extended_profile.unattended_surveys(_type='list')))
unattended_surveys = user_extended_profile.unattended_surveys(_type='list')
are_forms_complete = not (bool(unattended_surveys))

if not are_forms_complete :
return redirect(reverse('organization'))
return redirect(reverse(unattended_surveys[0]))

return redirect(reverse('update_account_settings'))

Expand Down
41 changes: 22 additions & 19 deletions lms/djangoapps/philu_overrides/branding/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ def _auth_footer_navigation_links():
"name": link_name,
"title": link_title,
"url": link_url,
"target": link_target,
}
for link_name, link_url, link_title in [
("about", "https://philanthropyu.org/about-us/", _("About Philanthropy University"))
for link_name, link_url, link_title, link_target in [
("about", "https://philanthropyu.org/about-us/our-story/", _("About Philanthropy University"), "_blank")
]
if link_url and link_url != "#"
]
Expand All @@ -154,10 +155,11 @@ def _auth_footer_courses_communities_links():
"name": link_name,
"title": link_title,
"url": link_url,
"target": link_target,
}
for link_name, link_url, link_title in [
("explore_course", "/courses", _("Explore our Courses")),
("communities", settings.NODEBB_ENDPOINT, _("Be part of our Communities")),
for link_name, link_url, link_title, link_target in [
("explore_course", "/courses", _("Explore our Courses"), "_self"),
("communities", settings.NODEBB_ENDPOINT, _("Be part of our Communities"), "_self"),
]
if link_url and link_url != "#"
]
Expand All @@ -172,11 +174,12 @@ def _footer_navigation_links():
"name": link_name,
"title": link_title,
"url": link_url,
"target": link_target,
}
for link_name, link_url, link_title in [
("about", "https://philanthropyu.org/about-us/", _("About Philanthropy University")),
("explore_course", "/courses", _("Explore our Courses")),
("communities", settings.NODEBB_ENDPOINT, _("Be part of our Communities")),
for link_name, link_url, link_title, link_target in [
("about", "https://philanthropyu.org/about-us/our-story/", _("About Philanthropy University"), "_blank"),
("explore_course", "/courses", _("Explore our Courses"), "_self"),
("communities", settings.NODEBB_ENDPOINT, _("Be part of our Communities"), "_self"),
]
if link_url and link_url != "#"
]
Expand All @@ -185,19 +188,19 @@ def _footer_navigation_links():
def _auth_footer_legal_links():
"""Return the legal footer links (e.g. terms of service). """
links = [
("terms_of_service_and_honor_code", "https://philanthropyu.org/terms-of-use/", _("Terms of Use")),
("privacy_policy", "https://philanthropyu.org/privacy-policy/", _("Privacy Policy")),
("faq", "/faq", _("FAQ")),
("disclaimir", "/disclaimer", _("Disclaimer"))
("terms_of_service_and_honor_code", "https://philanthropyu.org/terms-of-use/", _("Terms of Use"), "_blank"),
("privacy_policy", "https://philanthropyu.org/privacy-policy/", _("Privacy Policy"), "_blank"),
("faq", "https://philanthropyu.org/faq/", _("FAQ"), "_blank")
]

return [
{
"name": link_name,
"title": link_title,
"url": link_url,
"target": link_target,
}
for link_name, link_url, link_title in links
for link_name, link_url, link_title, link_target in links
if link_url and link_url != "#"
]

Expand All @@ -206,19 +209,19 @@ def my_footer_legal_links():
"""Return the legal footer links (e.g. terms of service). """

links = [
("terms_of_service_and_honor_code", "https://philanthropyu.org/terms-of-use/", _("Terms of Use")),
("privacy_policy", "https://philanthropyu.org/privacy-policy/", _("Privacy Policy")),
("faq", "/faq", _("FAQ")),
("disclaimir", "/disclaimer", _("Disclaimer"))
("terms_of_service_and_honor_code", "https://philanthropyu.org/terms-of-use/", _("Terms of Use"), "_blank"),
("privacy_policy", "https://philanthropyu.org/privacy-policy/", _("Privacy Policy"), "_blank"),
("faq", "https://philanthropyu.org/faq/", _("FAQ"), "_blank")
]

return [
{
"name": link_name,
"title": link_title,
"url": link_url,
"target": link_target,
}
for link_name, link_url, link_title in links
for link_name, link_url, link_title, link_target in links
if link_url and link_url != "#"
]

Expand Down