Fix up the sign up link section

And actually bind the sign up link so it works.
This commit is contained in:
Haacked 2015-02-26 15:29:57 -08:00
Родитель 9a1488f98f
Коммит 04d3265964
5 изменённых файлов: 27 добавлений и 12 удалений

Просмотреть файл

@ -3,6 +3,7 @@ using System.ComponentModel.Composition;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Windows.Input;
@ -27,13 +28,15 @@ namespace GitHub.ViewModels
readonly Lazy<IEnterpriseProbe> lazyEnterpriseProbe;
const string notEnterpriseServerError = "Not an Enterprise server. Please enter an Enterprise URL";
readonly ReactiveCommand<object> signUpCommand;
public ReactiveCommand<AuthenticationResult> LoginCommand { get; private set; }
public ICommand LoginCmd { get { return LoginCommand; } }
public ReactiveCommand<object> ForgotPasswordCommand { get; private set; }
public ReactiveCommand<object> ShowDotComLoginCommand { get; set; }
public ReactiveCommand<object> ShowEnterpriseLoginCommand { get; set; }
public ReactiveCommand<object> SignupCommand { get; private set; }
public ICommand SignUpCommand { get { return signUpCommand; } }
string enterpriseUrl;
[ValidateIf("IsLoggingInToEnterprise")]
@ -170,8 +173,8 @@ namespace GitHub.ViewModels
LoginCommand.IsExecuting
.ToProperty(this, vm => vm.IsLoginInProgress, out isLoginInProgress);
SignupCommand = ReactiveCommand.Create(Observable.Return(true));
SignupCommand.Subscribe(_ => browser.OpenUrl(GitHubUrls.Plans));
signUpCommand = ReactiveCommand.Create(Observable.Return(true));
signUpCommand.Subscribe(_ => browser.OpenUrl(GitHubUrls.Plans));
// Whenever a host logs on or off we re-evaluate this. If there are no logged on hosts (local excluded)
// then the user may log on to either .com or an enterprise instance. If there's already a logged on host

Просмотреть файл

@ -11,6 +11,7 @@ namespace GitHub.ViewModels
string LoginButtonText { get; }
bool IsLoginInProgress { get; }
ICommand LoginCmd { get; }
ICommand SignUpCommand { get; }
IObservable<AuthenticationResult> AuthenticationResults { get; }
}
}

Просмотреть файл

@ -16,7 +16,7 @@
x:Name="loginStackPanel"
FocusVisualStyle="{x:Null}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="0" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<VisualStateManager.VisualStateGroups>
@ -122,7 +122,7 @@
<VisualState x:Name="Design" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<StackPanel x:Name="fields" Margin="24,0,0,12" Background="{x:Null}" FocusManager.IsFocusScope="True" FocusVisualStyle="{x:Null}" helpers:AccessKeysManagerScoping.IsEnabled="True">
<StackPanel x:Name="fields" Margin="24,0,24,12" Background="{x:Null}" FocusManager.IsFocusScope="True" FocusVisualStyle="{x:Null}" helpers:AccessKeysManagerScoping.IsEnabled="True">
<StackPanel
x:Name="loginLabel"
Visibility="{Binding LoginFailed, Mode=OneWay, Converter={ui:BooleanToInverseVisibilityConverter}}"
@ -196,7 +196,7 @@
Text="{Binding EnterpriseUrl, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
Validation.ErrorTemplate="{DynamicResource ValidationAdorner}" />
<Border HorizontalAlignment="Center" Margin="0,12,0,0">
<Border HorizontalAlignment="Center" Margin="0,12,0,12">
<ui:OcticonCircleButton
x:Name="loginButton"
Icon="check"
@ -205,11 +205,21 @@
IsDefault="True" />
</Border>
<StackPanel x:Name="gitHubSignupStackPanel">
<TextBlock x:Name="signUpLabel" Style="{DynamicResource GitHubH1TextBlock}" Text="Sign up" Margin="0,10,0,0" />
<TextBlock x:Name="description" Style="{DynamicResource GitHubDescriptionTextBlock}" Margin="0"><Run Text="Powerful collaboration, review, and code management for open source and private development projects." /><LineBreak /><Run Text="Build software better, together." FontWeight="Bold"/></TextBlock>
<ui:OcticonLinkButton x:Name="signUpLink" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Icon="link_external" Content="Sign up" ToolTip="go to github.com to sign up for an account" IsTabStop="False" />
</StackPanel>
<Border x:Name="gitHubSignupStackPanel" HorizontalAlignment="Center" Height="40">
<TextBlock
x:Name="description"
Style="{DynamicResource GitHubDescriptionTextBlock}"
Margin="0">
<Run Text="Dont have an account?" />
<ui:OcticonLinkButton
x:Name="signUpLink"
Margin="0,0,0,-3"
VerticalContentAlignment="Bottom"
Icon="link_external"
Content="Sign up"
ToolTip="go to github.com to sign up for an account" />
</TextBlock>
</Border>
</StackPanel>
</Grid>
</UserControl>

Просмотреть файл

@ -31,6 +31,7 @@ namespace GitHub.VisualStudio.UI.Views.Controls
d(this.OneWayBind(ViewModel, vm => vm.LoginButtonText, v => v.loginButton.Content));
d(this.OneWayBind(ViewModel, vm => vm.IsLoginInProgress, v => v.loginButton.IsEnabled, inProgress => !inProgress));
d(this.BindCommand(ViewModel, vm => vm.LoginCmd, v => v.loginButton));
d(this.BindCommand(ViewModel, vm => vm.SignUpCommand, v => v.signUpLink));
});
VisualStateManager.GoToState(this, "DotCom", true);

Просмотреть файл

@ -19,7 +19,7 @@ public class LoginControlViewModelTests
var enterpriseProbe = LazySubstitute.For<IEnterpriseProbe>();
var loginViewModel = new LoginControlViewModel(serviceProvider, repositoryHosts, browser, enterpriseProbe);
loginViewModel.SignupCommand.Execute(null);
loginViewModel.SignUpCommand.Execute(null);
browser.Received().OpenUrl(GitHubUrls.Plans);
}