Ind.ie is now Small Technology Foundation.
Commit e27da2b2 authored by Aral Balkan's avatar Aral Balkan

Handling form element state better now on Waystone account creation. Closes #116

parent bfb07a3c
......@@ -1132,7 +1132,7 @@
</subviews>
<nil key="backgroundColor"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="b4B-VU-vU0">
<scroller key="horizontalScroller" verticalHuggingPriority="750" horizontal="YES" id="b4B-VU-vU0">
<rect key="frame" x="1" y="119" width="223" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
......
......@@ -99,6 +99,9 @@ class ProfileImageComponentViewController: NSViewController, NSComboBoxDataSourc
self.changePhotoButton.layer!.opacity = 0.0
self.slider.layer!.opacity = 0.0
self.changePhotoButton.enabled = false
self.slider.enabled = false
}
else
{
......@@ -114,7 +117,9 @@ class ProfileImageComponentViewController: NSViewController, NSComboBoxDataSourc
self.changePhotoButton.layer!.opacity = 1.0
self.slider.layer!.opacity = 1.0
self.changePhotoButton.enabled = true
self.slider.enabled = true
}
}
......
......@@ -71,16 +71,15 @@ class SetupStepTwoViewController: SetupStepViewController
// TODO: Refactor to remove redundancies with animateFormWhenDoneEditing
//
// Mark the Profile Image Component as not editable
// (This will gracefully remove its controls).
// Restore the controls
profileImageComponent.editable = true
self.personNameTextField.drawsBackground = false
self.bioTextField.drawsBackground = false
self.personNameTextField.editable = true
self.bioTextField.editable = true
self.delegate?.enableAllButtons(true)
// // This is a workaround to a visual glitch that otherwise draws boxes around the components.
// self.personNameTextField.drawsBackground = true
// self.personNameTextField.backgroundColor = NSColor(calibratedWhite: 100.0, alpha: 0.0)
// self.bioTextField.drawsBackground = true
// self.bioTextField.backgroundColor = NSColor(calibratedWhite: 100.0, alpha: 0.0)
//
// End animation values for the constraints.
self.profileImagePickerTopSpaceToContainerConstraint.constant = self.profileImagePickerTopSpaceToContainerConstraintOriginalConstant
self.nameTextFieldTopSpaceToProfileImagePickerComponentConstraint.constant = self.nameTextFieldTopSpaceToProfileImagePickerComponentConstraintOriginalConstant
......@@ -109,12 +108,17 @@ class SetupStepTwoViewController: SetupStepViewController
// (This will gracefully remove its controls).
profileImageComponent.editable = false
// Disable all buttons.
self.delegate?.enableAllButtons(false)
// This is a workaround to a visual glitch that otherwise draws boxes around the components.
self.personNameTextField.drawsBackground = true
self.personNameTextField.backgroundColor = NSColor(calibratedWhite: 100.0, alpha: 0.0)
self.personNameTextField.editable = false
self.bioTextField.drawsBackground = true
self.bioTextField.backgroundColor = NSColor(calibratedWhite: 100.0, alpha: 0.0)
self.bioTextField.editable = false
// Save the current constraint constants so we can revert the form back
// if we need to (i.e., if there’s an error while creating the account).
self.profileImagePickerTopSpaceToContainerConstraintOriginalConstant = self.profileImagePickerTopSpaceToContainerConstraint.constant
......
......@@ -25,6 +25,7 @@ protocol SetupDelegate
func showMessage(title:String, body:String)
func showMessage(title:String, body:String, nextButtonTitle:String)
func hideMessage()
func enableAllButtons(state:Bool)
}
......
......@@ -309,7 +309,6 @@ class SetupViewController: NSViewController, SetupDelegate
/* and handle */ response in
println("ℹ️ Call to initialise Heartbeat with Waystone Account returned from Node.\n")
println(response)
if response["error"].boolValue
......@@ -326,7 +325,7 @@ class SetupViewController: NSViewController, SetupDelegate
self.hideProgress()
let errorSheet = NSAlert()
errorSheet.messageText = "Sorry, could not set up your account on Ind.ie."
errorSheet.messageText = "Sorry, could not set up your account."
errorSheet.informativeText = prettyErrorMessage
errorSheet.alertStyle = NSAlertStyle.CriticalAlertStyle
errorSheet.addButtonWithTitle("OK")
......@@ -507,6 +506,13 @@ class SetupViewController: NSViewController, SetupDelegate
showBackButton(false)
}
func enableAllButtons(state:Bool)
{
backButton.enabled = state
nextButton.enabled = state
doneButton.enabled = state
}
//
// MARK: - Notification handlers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment