refactor<Configure>: remove commit template due to bad implementation

This commit is contained in:
leo 2021-04-06 16:06:36 +08:00
parent c233ffabdd
commit 1366d8e858
5 changed files with 2 additions and 38 deletions

View file

@ -54,10 +54,6 @@ namespace SourceGit.Git {
/// Last 10 Commit message. /// Last 10 Commit message.
/// </summary> /// </summary>
public List<string> CommitMsgRecords { get; set; } = new List<string>(); public List<string> CommitMsgRecords { get; set; } = new List<string>();
/// <summary>
/// Commit template.
/// </summary>
public string CommitTemplate { get; set; }
#endregion #endregion
#region PROPERTIES_RUNTIME #region PROPERTIES_RUNTIME

View file

@ -6,7 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="clr-namespace:SourceGit.Helpers" xmlns:helpers="clr-namespace:SourceGit.Helpers"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="500" Width="500" Height="314"> d:DesignHeight="150" d:DesignWidth="500" Width="500" Height="150">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="36"/> <RowDefinition Height="36"/>
@ -14,10 +14,6 @@
<RowDefinition Height="28"/> <RowDefinition Height="28"/>
<RowDefinition Height="28"/> <RowDefinition Height="28"/>
<RowDefinition Height="18"/> <RowDefinition Height="18"/>
<RowDefinition Height="36"/>
<RowDefinition Height="8"/>
<RowDefinition Height="102"/>
<RowDefinition Height="18"/>
<RowDefinition Height="32"/> <RowDefinition Height="32"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
@ -43,20 +39,8 @@
Text="{Binding ElementName=me, Path=UserEmail, Mode=TwoWay}" Text="{Binding ElementName=me, Path=UserEmail, Mode=TwoWay}"
helpers:TextBoxHelper.Placeholder="{StaticResource Text.Configure.Email.Placeholder}"/> helpers:TextBoxHelper.Placeholder="{StaticResource Text.Configure.Email.Placeholder}"/>
<!-- 提交模板 -->
<Label Grid.Row="5" Grid.ColumnSpan="2" Content="{StaticResource Text.Configure.CommitTemplate}" FontSize="16" FontWeight="DemiBold" Opacity=".85"/>
<Label Grid.Row="7" Grid.Column="0" Content="{StaticResource Text.Configure.Template}" HorizontalAlignment="Right" VerticalAlignment="Top"/>
<TextBox
Grid.Row="7"
Grid.Column="1"
Height="100"
AcceptsReturn="True"
AcceptsTab="True"
Padding="2"
Text="{Binding ElementName=me, Path=CommitTemplate, Mode=TwoWay}"/>
<!-- 操作 --> <!-- 操作 -->
<Grid Grid.Row="9" Grid.ColumnSpan="2"> <Grid Grid.Row="5" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="80"/> <ColumnDefinition Width="80"/>

View file

@ -33,7 +33,6 @@ namespace SourceGit.UI {
UserName = repo.GetConfig("user.name"); UserName = repo.GetConfig("user.name");
UserEmail = repo.GetConfig("user.email"); UserEmail = repo.GetConfig("user.email");
CommitTemplate = repo.CommitTemplate;
InitializeComponent(); InitializeComponent();
} }
@ -54,11 +53,6 @@ namespace SourceGit.UI {
var oldEmail = repo.GetConfig("user.email"); var oldEmail = repo.GetConfig("user.email");
if (oldEmail != UserEmail) repo.SetConfig("user.email", UserEmail); if (oldEmail != UserEmail) repo.SetConfig("user.email", UserEmail);
if (CommitTemplate != repo.CommitTemplate) {
repo.CommitTemplate = CommitTemplate;
App.SaveSetting();
}
Close(sender, e); Close(sender, e);
} }

View file

@ -392,7 +392,6 @@
ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"
helpers:TextBoxHelper.Placeholder="{StaticResource Text.WorkingCopy.CommitMessageTip}" helpers:TextBoxHelper.Placeholder="{StaticResource Text.WorkingCopy.CommitMessageTip}"
helpers:TextBoxHelper.PlaceholderBaseline="Top" helpers:TextBoxHelper.PlaceholderBaseline="Top"
GotFocus="CommitMsgGotFocus"
PreviewMouseWheel="CommitMsgPreviewMouseWheel"> PreviewMouseWheel="CommitMsgPreviewMouseWheel">
<TextBox.Text> <TextBox.Text>
<Binding ElementName="me" Path="CommitMessage" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"> <Binding ElementName="me" Path="CommitMessage" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">

View file

@ -839,15 +839,6 @@ namespace SourceGit.UI {
#endregion #endregion
#region COMMIT_PANEL #region COMMIT_PANEL
private void CommitMsgGotFocus(object sender, RoutedEventArgs e) {
var textBox = sender as TextBox;
if (textBox == null) return;
if (string.IsNullOrEmpty(textBox.Text) && !string.IsNullOrEmpty(Repo.CommitTemplate)) {
textBox.Text = Repo.CommitTemplate;
}
}
private void CommitMsgPreviewMouseWheel(object sender, MouseWheelEventArgs e) { private void CommitMsgPreviewMouseWheel(object sender, MouseWheelEventArgs e) {
var textBox = sender as TextBox; var textBox = sender as TextBox;
if (textBox == null) return; if (textBox == null) return;