Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Update Find Courses for Non Mobile Courses (#913)
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir authored Mar 16, 2017
1 parent 226e13e commit c53bb06
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 30 deletions.
15 changes: 0 additions & 15 deletions Source/EnrolledCoursesFooterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ import Foundation
class EnrolledCoursesFooterView : UIView {
private let promptLabel = UILabel()
private let findCoursesButton = UIButton(type:.System)
private let missingCourseButton = UIButton(type: .System)

private let container = UIView()

var findCoursesAction : (() -> Void)?
var missingCoursesAction : (() -> Void)?

private var findCoursesTextStyle : OEXTextStyle {
return OEXTextStyle(weight: .Normal, size: .Base, color: OEXStyles.sharedStyles().neutralDark())
Expand All @@ -28,15 +26,12 @@ class EnrolledCoursesFooterView : UIView {
addSubview(container)
container.addSubview(promptLabel)
container.addSubview(findCoursesButton)
container.addSubview(missingCourseButton)

self.promptLabel.attributedText = findCoursesTextStyle.attributedStringWithText(Strings.EnrollmentList.findCoursesPrompt)
self.promptLabel.textAlignment = .Center

self.findCoursesButton.applyButtonStyle(OEXStyles.sharedStyles().filledPrimaryButtonStyle, withTitle: Strings.EnrollmentList.findCourses.oex_uppercaseStringInCurrentLocale())

self.missingCourseButton.applyButtonStyle(OEXStyles.sharedStyles().linkButtonStyle, withTitle: Strings.EnrollmentList.lookingForCourse)

container.backgroundColor = OEXStyles.sharedStyles().standardBackgroundColor()
container.applyBorderStyle(BorderStyle())

Expand All @@ -57,22 +52,12 @@ class EnrolledCoursesFooterView : UIView {
make.leading.equalTo(promptLabel)
make.trailing.equalTo(promptLabel)
make.top.equalTo(promptLabel.snp_bottom).offset(StandardVerticalMargin)
}

self.missingCourseButton.snp_makeConstraints {make in
make.leading.equalTo(promptLabel)
make.trailing.equalTo(promptLabel)
make.top.equalTo(findCoursesButton.snp_bottom).offset(StandardVerticalMargin)
make.bottom.equalTo(container).offset(-StandardVerticalMargin)
}

findCoursesButton.oex_addAction({[weak self] _ in
self?.findCoursesAction?()
}, forEvents: .TouchUpInside)

missingCourseButton.oex_addAction({[weak self] _ in
self?.missingCoursesAction?()
}, forEvents: .TouchUpInside)
}

required init?(coder aDecoder: NSCoder) {
Expand Down
12 changes: 0 additions & 12 deletions Source/EnrolledCoursesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ class EnrolledCoursesViewController : OfflineSupportViewController, CoursesTable
footer.findCoursesAction = {[weak self] in
self?.environment.router?.showCourseCatalog(nil)
}
footer.missingCoursesAction = {[weak self] in
self?.showCourseNotListedAlert()
}

footer.sizeToFit()
self.tableController.tableView.tableFooterView = footer
Expand Down Expand Up @@ -161,15 +158,6 @@ class EnrolledCoursesViewController : OfflineSupportViewController, CoursesTable
}
}

private func showCourseNotListedAlert() {
let alertController = UIAlertController().showAlertWithTitle(nil, message: Strings.courseNotListed, cancelButtonTitle: nil, onViewController: self)
alertController.addButtonWithTitle(Strings.ok, actionBlock: { (action) in
dispatch_async(dispatch_get_main_queue(), {
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, self.navigationItem.leftBarButtonItem)
})
})
}

private func showVersionUpgradeSnackBarIfNecessary() {
if let _ = VersionUpgradeInfoController.sharedController.latestVersion {
var infoString = Strings.VersionUpgrade.newVersionAvailable
Expand Down
4 changes: 1 addition & 3 deletions Source/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,7 @@
/* Prompt shown to users on the course list encouraging them to find new courses */
"ENROLLMENT_LIST.FIND_COURSES_PROMPT" = "Looking for a new challenge?";
/* Button title opening course catalog */
"ENROLLMENT_LIST.FIND_COURSES" = "Find a mobile-friendly course";
/* Button title showing screen providing information about why a course may not be visible */
"ENROLLMENT_LIST.LOOKING_FOR_COURSE" = "Can't find one of your courses?";
"ENROLLMENT_LIST.FIND_COURSES" = "Find a course";
/* Error message when user is not enrolled to any course and course discovery is also disabled.*/
"ENROLLMENT_LIST.NO_ENROLLMENT" = "It looks like you are not enrolled in any courses yet.";
/* Prompt indicating user needs to enter an email address */
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...ests.EnrolledCoursesViewControllerTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...Tests.EnrolledCoursesViewControllerTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...s.EnrolledCoursesViewControllerTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...rolledCoursesViewControllerTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...ts.EnrolledCoursesViewControllerTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...nrolledCoursesViewControllerTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c53bb06

Please sign in to comment.