Skip to content

Commit

Permalink
UI for the reset password window 😋
Browse files Browse the repository at this point in the history
  • Loading branch information
camsaul committed Nov 25, 2015
1 parent e5da336 commit d4d6be3
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 6 deletions.
10 changes: 10 additions & 0 deletions OSX/Metabase.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
D18853F91BB0D37C00D89803 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D18853F81BB0D37B00D89803 /* WebKit.framework */; };
D18854041BB0DC2600D89803 /* metabase.jar in Resources */ = {isa = PBXBuildFile; fileRef = D18854021BB0DB6000D89803 /* metabase.jar */; };
D18855611BB1C8D700D89803 /* jre in Resources */ = {isa = PBXBuildFile; fileRef = D188555E1BB1C86F00D89803 /* jre */; };
D1BDAC681C053E0A0075D3AC /* ResetPasswordWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = D1BDAC671C053E0A0075D3AC /* ResetPasswordWindowController.m */; };
D1BDAC6A1C053E220075D3AC /* ResetPasswordWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D1BDAC691C053E220075D3AC /* ResetPasswordWindowController.xib */; };
D1CB9FE81BCEDE9A009A61FB /* LoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = D1CB9FE71BCEDE9A009A61FB /* LoadingView.m */; };
D1CB9FEA1BCEDEA5009A61FB /* LoadingView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D1CB9FE91BCEDEA5009A61FB /* LoadingView.xib */; };
D1CB9FED1BCEDF02009A61FB /* Loading_View_Inner.png in Resources */ = {isa = PBXBuildFile; fileRef = D1CB9FEB1BCEDF02009A61FB /* Loading_View_Inner.png */; };
Expand Down Expand Up @@ -119,6 +121,9 @@
D18853F81BB0D37B00D89803 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
D18854021BB0DB6000D89803 /* metabase.jar */ = {isa = PBXFileReference; lastKnownFileType = archive.jar; path = metabase.jar; sourceTree = "<group>"; };
D188555E1BB1C86F00D89803 /* jre */ = {isa = PBXFileReference; lastKnownFileType = folder; name = jre; path = Metabase/jre; sourceTree = "<group>"; };
D1BDAC661C053E0A0075D3AC /* ResetPasswordWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResetPasswordWindowController.h; sourceTree = "<group>"; };
D1BDAC671C053E0A0075D3AC /* ResetPasswordWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResetPasswordWindowController.m; sourceTree = "<group>"; };
D1BDAC691C053E220075D3AC /* ResetPasswordWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ResetPasswordWindowController.xib; sourceTree = "<group>"; };
D1CB9FE61BCEDE9A009A61FB /* LoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadingView.h; sourceTree = "<group>"; };
D1CB9FE71BCEDE9A009A61FB /* LoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoadingView.m; sourceTree = "<group>"; };
D1CB9FE91BCEDEA5009A61FB /* LoadingView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingView.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -245,6 +250,9 @@
D1CB9FE61BCEDE9A009A61FB /* LoadingView.h */,
D1CB9FE71BCEDE9A009A61FB /* LoadingView.m */,
D1CB9FE91BCEDEA5009A61FB /* LoadingView.xib */,
D1BDAC661C053E0A0075D3AC /* ResetPasswordWindowController.h */,
D1BDAC671C053E0A0075D3AC /* ResetPasswordWindowController.m */,
D1BDAC691C053E220075D3AC /* ResetPasswordWindowController.xib */,
);
path = UI;
sourceTree = "<group>";
Expand Down Expand Up @@ -409,6 +417,7 @@
D1CB9FEE1BCEDF02009A61FB /* Loading_View_Outer.png in Resources */,
D105B23D1BB5BE4A00A5D850 /* [email protected] in Resources */,
D121FD691BC5B4E7002101B0 /* dsa_pub.pem in Resources */,
D1BDAC6A1C053E220075D3AC /* ResetPasswordWindowController.xib in Resources */,
D18855611BB1C8D700D89803 /* jre in Resources */,
D162C4AE1BC87D2B009F678F /* MainMenu.xib in Resources */,
D105B2401BB5BE4A00A5D850 /* [email protected] in Resources */,
Expand Down Expand Up @@ -471,6 +480,7 @@
D105B2271BB378C100A5D850 /* INAppStoreWindow.m in Sources */,
D162C4A91BC87D2B009F678F /* MetabaseTask.m in Sources */,
D162C4A81BC87D2B009F678F /* AppDelegate.m in Sources */,
D1BDAC681C053E0A0075D3AC /* ResetPasswordWindowController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
21 changes: 15 additions & 6 deletions OSX/Metabase/UI/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5053" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
<plugIn identifier="com.apple.WebKitIBPlugin" version="8191"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/>
<plugIn identifier="com.apple.WebKitIBPlugin" version="5053"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
Expand Down Expand Up @@ -160,14 +159,24 @@
</menuItem>
<menuItem title="Help" id="wpr-3q-Mcd">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" id="3h4-7P-k86">
<items>
<menuItem title="Reset Password..." id="nSX-ZV-AqB">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="resetPassword:" target="8au-ff-PAw" id="CAh-3G-VDo"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
<window allowsToolTipsWhenApplicationIsInactive="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="INAppStoreWindow">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="335" y="390" width="1473" height="901"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
<value key="minSize" type="size" width="1000" height="800"/>
<view key="contentView" canDrawConcurrently="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="1473" height="901"/>
Expand Down Expand Up @@ -202,7 +211,7 @@
<customView translatesAutoresizingMaskIntoConstraints="NO" id="V9v-oH-CLo">
<rect key="frame" x="64" y="0.0" width="523" height="32"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="BVV-jo-b9C">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BVV-jo-b9C">
<rect key="frame" x="229" y="8" width="65" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" sendsActionOnEndEditing="YES" title="Metabase" id="Vvp-PZ-SY5">
<font key="font" metaFont="system"/>
Expand Down
6 changes: 6 additions & 0 deletions OSX/Metabase/UI/MainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#import "LoadingView.h"
#import "MainViewController.h"
#import "ResetPasswordWindowController.h"
#import "SettingsManager.h"
#import "TaskHealthChecker.h"

Expand Down Expand Up @@ -201,6 +202,11 @@ - (IBAction)copyURLToClipboard:(id)sender {
[[NSAlert alertWithMessageText:@"Link Copied" defaultButton:@"Ok" alternateButton:nil otherButton:nil informativeTextWithFormat:@"A link to this page has been copied to your clipboard."] runModal];
}

- (IBAction)resetPassword:(id)sender {
ResetPasswordWindowController *resetPasswordWindowController = [[ResetPasswordWindowController alloc] init];
[[NSApplication sharedApplication] runModalForWindow:resetPasswordWindowController.window];
}


#pragma mark - WebResourceLoadDelegate

Expand Down
13 changes: 13 additions & 0 deletions OSX/Metabase/UI/ResetPasswordWindowController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// ResetPasswordWindowController.h
// Metabase
//
// Created by Cam Saul on 11/24/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//

@import Cocoa;

@interface ResetPasswordWindowController : NSWindowController

@end
44 changes: 44 additions & 0 deletions OSX/Metabase/UI/ResetPasswordWindowController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// ResetPasswordWindowController.m
// Metabase
//
// Created by Cam Saul on 11/24/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//

#import "ResetPasswordWindowController.h"

@interface ResetPasswordWindowController () <NSTextFieldDelegate>
@property (weak) IBOutlet NSButton *resetPasswordButton;
@property (weak) IBOutlet NSTextField *emailAddressTextField;

@end


@implementation ResetPasswordWindowController

#pragma mark - Lifecycle

- (NSString *)windowNibName {
return NSStringFromClass(self.class);
}

- (void)windowDidLoad {
[super windowDidLoad];
}


#pragma mark - Actions

- (IBAction)resetPasswordButtonPressed:(NSButton *)sender {
NSLog(@"RESET PASSWORD!");
}


#pragma mark - NSTextFieldDelegate

- (void)controlTextDidChange:(NSNotification *)obj {
self.resetPasswordButton.enabled = self.emailAddressTextField.stringValue.length > 5;
}

@end
101 changes: 101 additions & 0 deletions OSX/Metabase/UI/ResetPasswordWindowController.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5053" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ResetPasswordWindowController">
<connections>
<outlet property="emailAddressTextField" destination="SGZ-eW-nZQ" id="aMf-FE-ey1"/>
<outlet property="resetPasswordButton" destination="1wF-h5-c8o" id="N1J-e1-a4y"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="FU9-gs-izu">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="283" y="305" width="492" height="242"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
<view key="contentView" id="3rs-Tz-giP">
<rect key="frame" x="0.0" y="0.0" width="492" height="242"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QaQ-Qx-Ypt">
<rect key="frame" x="185" y="207" width="122" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" title="Reset Password" id="Kcn-M1-bVY">
<font key="font" metaFont="system" size="16"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="249" verticalHuggingPriority="249" horizontalCompressionResistancePriority="240" verticalCompressionResistancePriority="800" translatesAutoresizingMaskIntoConstraints="NO" id="oEx-8w-YG4">
<rect key="frame" x="14" y="157" width="464" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="460" id="qwI-wW-wTd"/>
</constraints>
<textFieldCell key="cell" enabled="NO" refusesFirstResponder="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="center" title="Enter the email address you used to create your Metabase account on this computer and we'll get started changing your password." id="Lgy-GU-YOj">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1wF-h5-c8o">
<rect key="frame" x="178" y="9" width="136" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Reset Password" bezelStyle="rounded" alignment="center" enabled="NO" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="YII-IA-Kyg">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="resetPasswordButtonPressed:" target="-2" id="Y6X-98-Hsn"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8ft-6m-5T0">
<rect key="frame" x="200" y="108" width="92" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" title="Email Address" id="ETj-8f-dsZ">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SGZ-eW-nZQ">
<rect key="frame" x="118" y="78" width="256" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="width" constant="256" id="8Fr-91-TXf"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="[email protected]" drawsBackground="YES" id="mP8-DI-PfW">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<outlet property="delegate" destination="-2" id="h0P-Zb-hJJ"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="oEx-8w-YG4" firstAttribute="leading" secondItem="3rs-Tz-giP" secondAttribute="leading" constant="16" id="056-xy-j5r"/>
<constraint firstItem="8ft-6m-5T0" firstAttribute="top" relation="greaterThanOrEqual" secondItem="oEx-8w-YG4" secondAttribute="bottom" constant="32" id="2Jb-ua-CCI"/>
<constraint firstAttribute="centerX" secondItem="SGZ-eW-nZQ" secondAttribute="centerX" id="90I-fl-PKI"/>
<constraint firstItem="1wF-h5-c8o" firstAttribute="top" relation="greaterThanOrEqual" secondItem="SGZ-eW-nZQ" secondAttribute="bottom" constant="32" id="CM1-Nh-mnk"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="SGZ-eW-nZQ" secondAttribute="trailing" constant="16" id="NHO-1C-XOJ"/>
<constraint firstItem="SGZ-eW-nZQ" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="3rs-Tz-giP" secondAttribute="leading" constant="16" id="On6-0w-5PF"/>
<constraint firstAttribute="bottom" secondItem="1wF-h5-c8o" secondAttribute="bottom" constant="16" id="VRO-Qm-4vb"/>
<constraint firstItem="oEx-8w-YG4" firstAttribute="top" secondItem="QaQ-Qx-Ypt" secondAttribute="bottom" constant="16" id="bMB-cF-PJe"/>
<constraint firstItem="SGZ-eW-nZQ" firstAttribute="top" secondItem="8ft-6m-5T0" secondAttribute="bottom" constant="8" id="e7T-c5-OYs"/>
<constraint firstAttribute="centerX" secondItem="QaQ-Qx-Ypt" secondAttribute="centerX" id="kFE-8l-poc"/>
<constraint firstAttribute="centerY" secondItem="SGZ-eW-nZQ" secondAttribute="centerY" constant="-32" id="mTu-yO-Smv"/>
<constraint firstAttribute="trailing" secondItem="oEx-8w-YG4" secondAttribute="trailing" constant="16" id="shZ-a7-r8y"/>
<constraint firstItem="QaQ-Qx-Ypt" firstAttribute="top" secondItem="3rs-Tz-giP" secondAttribute="top" constant="16" id="uRv-1M-0Si"/>
<constraint firstAttribute="centerX" secondItem="1wF-h5-c8o" secondAttribute="centerX" id="vH7-Xk-LcO"/>
<constraint firstAttribute="centerX" secondItem="8ft-6m-5T0" secondAttribute="centerX" id="vh8-pN-ohL"/>
</constraints>
</view>
</window>
</objects>
</document>

0 comments on commit d4d6be3

Please sign in to comment.