Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
63 changes: 63 additions & 0 deletions src/GitHub.App/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions src/GitHub.App/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,30 @@
<data name="PublishToTitle" xml:space="preserve">
<value>Publish repository to {0}</value>
</data>
<data name="PullRequestCreationTitleValidatorEmpty" xml:space="preserve">
<value>Please enter a title for the Pull Request</value>
</data>
<data name="PullRequestSourceAndTargetBranchTheSame" xml:space="preserve">
<value>Source and target branch cannot be the same</value>
</data>
<data name="PullRequestSourceBranchDoesNotExist" xml:space="preserve">
<value>Source branch doesn't exist remotely, have you pushed it?</value>
</data>
<data name="RepositoryCloneFailedNoSelectedRepo" xml:space="preserve">
<value>No selected repository.</value>
</data>
<data name="RepositoryCreationClonePathEmpty" xml:space="preserve">
<value>Please enter a repository path</value>
</data>
<data name="RepositoryCreationClonePathInvalid" xml:space="preserve">
<value>Please enter a valid path</value>
</data>
<data name="RepositoryCreationClonePathInvalidCharacters" xml:space="preserve">
<value>Path contains invalid characters</value>
</data>
<data name="RepositoryCreationClonePathTooLong" xml:space="preserve">
<value>Path too long</value>
</data>
<data name="RepositoryCreationFailedAlreadyExists" xml:space="preserve">
<value>Repository '{0}/{1}' already exists.</value>
</data>
Expand Down
7 changes: 4 additions & 3 deletions src/GitHub.App/ViewModels/PullRequestCreationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using GitHub.Validation;
using GitHub.Extensions;
using NullGuard;
using GitHub.App;

namespace GitHub.ViewModels
{
Expand Down Expand Up @@ -47,15 +48,15 @@ public PullRequestCreationViewModel(IRepositoryHost repositoryHost, ISimpleRepos

var titleObs = this.WhenAny(x => x.PRTitle, x => x.Value);
TitleValidator = ReactivePropertyValidator.ForObservable(titleObs)
.IfNullOrEmpty("Please enter a title for the Pull Request");
.IfNullOrEmpty(Resources.PullRequestCreationTitleValidatorEmpty);

var branchObs = this.WhenAny(
x => x.SourceBranch,
source => source.Value);

BranchValidator = ReactivePropertyValidator.ForObservable(branchObs)
.IfTrue(x => x == null, "Source branch doesn't exist remotely, have you pushed it?")
.IfTrue(x => x.Name == TargetBranch.Name, "Source and target branch cannot be the same");
.IfTrue(x => x == null, Resources.PullRequestSourceBranchDoesNotExist)
.IfTrue(x => x.Name == TargetBranch.Name, Resources.PullRequestSourceAndTargetBranchTheSame);

var whenAnyValidationResultChanges = this.WhenAny(
x => x.TitleValidator.ValidationResult,
Expand Down
8 changes: 4 additions & 4 deletions src/GitHub.App/ViewModels/RepositoryCloneViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ public RepositoryCloneViewModel(
(x, y) => x.Value);

BaseRepositoryPathValidator = ReactivePropertyValidator.ForObservable(baseRepositoryPath)
.IfNullOrEmpty("Please enter a repository path")
.IfTrue(x => x.Length > 200, "Path too long")
.IfContainsInvalidPathChars("Path contains invalid characters")
.IfPathNotRooted("Please enter a valid path")
.IfNullOrEmpty(Resources.RepositoryCreationClonePathEmpty)
.IfTrue(x => x.Length > 200, Resources.RepositoryCreationClonePathTooLong)
.IfContainsInvalidPathChars(Resources.RepositoryCreationClonePathInvalidCharacters)
.IfPathNotRooted(Resources.RepositoryCreationClonePathInvalid)
.IfTrue(IsAlreadyRepoAtPath, Resources.RepositoryNameValidatorAlreadyExists);

var canCloneObservable = this.WhenAny(
Expand Down
8 changes: 4 additions & 4 deletions src/GitHub.App/ViewModels/RepositoryCreationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ public RepositoryCreationViewModel(
browseForDirectoryCommand.Subscribe(_ => ShowBrowseForDirectoryDialog());

BaseRepositoryPathValidator = ReactivePropertyValidator.ForObservable(this.WhenAny(x => x.BaseRepositoryPath, x => x.Value))
.IfNullOrEmpty("Please enter a repository path")
.IfTrue(x => x.Length > 200, "Path too long")
.IfContainsInvalidPathChars("Path contains invalid characters")
.IfPathNotRooted("Please enter a valid path");
.IfNullOrEmpty(Resources.RepositoryCreationClonePathEmpty)
.IfTrue(x => x.Length > 200, Resources.RepositoryCreationClonePathTooLong)
.IfContainsInvalidPathChars(Resources.RepositoryCreationClonePathInvalidCharacters)
.IfPathNotRooted(Resources.RepositoryCreationClonePathInvalid);

var nonNullRepositoryName = this.WhenAny(
x => x.RepositoryName,
Expand Down
36 changes: 36 additions & 0 deletions src/GitHub.VisualStudio.UI/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions src/GitHub.VisualStudio.UI/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@
<data name="browsePathButtonContent" xml:space="preserve">
<value>Browse</value>
</data>
<data name="GetStartedLink" xml:space="preserve">
<value>Get Started</value>
</data>
<data name="couldNotConnectToGitHubText" xml:space="preserve">
<value>Could not connect to github.com</value>
</data>
Expand Down Expand Up @@ -330,4 +327,19 @@
<data name="NotAGitRepositoryMessage" xml:space="preserve">
<value>We couldn't find a git repository here. Open a git project or click "File -&gt; Add to Source Control" in a project to get started.</value>
</data>
<data name="CreateAccountLink" xml:space="preserve">
<value>Create an account</value>
</data>
<data name="filterBranchesText" xml:space="preserve">
<value>Filter branches</value>
</data>
<data name="GetStartedLink" xml:space="preserve">
<value>Get Started</value>
</data>
<data name="GetStartedText" xml:space="preserve">
<value>Get Started</value>
</data>
<data name="SignInLink" xml:space="preserve">
<value>Sign In</value>
</data>
</root>
5 changes: 3 additions & 2 deletions src/GitHub.VisualStudio/UI/Views/LoggedOutView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns:local="clr-namespace:GitHub.VisualStudio.UI.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sampleData="clr-namespace:GitHub.SampleData;assembly=GitHub.App"
xmlns:prop="clr-namespace:GitHub.VisualStudio.UI;assembly=GitHub.VisualStudio.UI"
xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
DataContext="{Binding ViewModel}"
d:DesignHeight="300"
Expand Down Expand Up @@ -52,13 +53,13 @@
<TextBlock
Margin="10,0"
HorizontalAlignment="Center">
<Hyperlink Command="{Binding SignIn}">Sign in</Hyperlink>
<Hyperlink Command="{Binding SignIn}"><TextBlock Text="{x:Static prop:Resources.SignInLink}"/></Hyperlink>
</TextBlock>

<TextBlock
Margin="10,0"
HorizontalAlignment="Center">
<Hyperlink Command="{Binding Register}">Create an account</Hyperlink>
<Hyperlink Command="{Binding Register}"><TextBlock Text="{x:Static prop:Resources.CreateAccountLink}"/></Hyperlink>
</TextBlock>
</StackPanel>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
<Button HorizontalAlignment="Center"
Margin="0,15"
Style="{DynamicResource GitHubVsPrimaryActionButton}"
Command="{Binding Publish}">
Get Started
Command="{Binding Publish}" >
<TextBlock Text="{x:Static prop:Resources.GetStartedText}" />
</Button>
</StackPanel>
</DockPanel>
Expand Down