Skip to content

Commit

Permalink
Add hero image settings
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Mar 26, 2024
1 parent e501779 commit a9b16aa
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 27 deletions.
1 change: 1 addition & 0 deletions src/app/MZikmund/ViewModels/Admin/PostEditorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ private async Task SaveAsync()
Post.Categories = Categories;
Post.IsPublished = true;
Post.PublishedDate = DateTimeOffset.UtcNow; // TODO: Don't always publish!
Post.Content = PostContent;

if (Post.Id == Guid.Empty)
{
Expand Down
67 changes: 40 additions & 27 deletions src/app/MZikmund/Views/Admin/PostEditorView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,65 +8,78 @@
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">

<Grid
<Grid
Padding="20"
ColumnDefinitions="*, *"
ColumnSpacing="8"
RowDefinitions="Auto, 100, *, Auto"
RowDefinitions="Auto, Auto, *, Auto"
RowSpacing="8">
<TextBox
<TextBox
Grid.ColumnSpan="1"
FontSize="20"
Header="Title"
Text="{x:Bind ViewModel.PostTitle, Mode=TwoWay}" />
<TextBox
<TextBox
Grid.Column="1"
Grid.ColumnSpan="1"
FontSize="20"
Header="Route"
Text="{x:Bind ViewModel.PostRouteName, Mode=TwoWay}" />
<StackPanel
<StackPanel
Grid.Row="1"
Grid.Column="1"
Orientation="Vertical">
<TextBlock Text="Categories" />
<Button
<TextBlock Text="Categories" />
<Button
Margin="0,0,0,4"
HorizontalAlignment="Stretch"
Command="{x:Bind ViewModel.PickCategoriesCommand}"
Content="{x:Bind ViewModel.CategoriesText, Mode=OneWay}" />
<TextBlock Text="Tags" />
<TextBox Grid.Row="1" Text="{x:Bind ViewModel.Tags, Mode=TwoWay}" />
</StackPanel>
<TextBox
<TextBlock Text="Tags" />
<TextBox Text="{x:Bind ViewModel.Tags, Mode=TwoWay}" />
<TextBlock Text="Hero image URL" />
<TextBox Text="{x:Bind ViewModel.Post.HeroImageUrl, Mode=TwoWay}" />
<TextBlock Text="Hero image ALT" />
<TextBox Text="{x:Bind ViewModel.Post.HeroImageAlt, Mode=TwoWay}" />
</StackPanel>
<TextBox
Grid.Row="1"
AcceptsReturn="True"
FontFamily="{StaticResource CodeFont}"
Header="Abstract"
Text="{x:Bind ViewModel.Post.Abstract, Mode=TwoWay}"
TextWrapping="Wrap" />
<TextBox
<TextBox
Grid.Row="2"
AcceptsReturn="True"
FontFamily="{StaticResource CodeFont}"
Header="Content"
Text="{x:Bind ViewModel.PostContent, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />

<Grid Grid.Row="2" Grid.Column="1" RowSpacing="4">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="Preview" />
<ContentControl x:Name="PreviewWebViewContainer" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Row="1" />
</Grid>
<Grid
Grid.Row="2"
Grid.Column="1"
RowSpacing="4">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="Preview" />
<ContentControl
x:Name="PreviewWebViewContainer"
Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />
</Grid>

<Button Grid.Row="3" Command="{x:Bind ViewModel.SaveCommand}">
<StackPanel Orientation="Horizontal" Spacing="8">
<SymbolIcon Symbol="Save" />
<TextBlock Text="Save" />
</StackPanel>
</Button>
</Grid>
<Button Grid.Row="3" Command="{x:Bind ViewModel.SaveCommand}">
<StackPanel Orientation="Horizontal" Spacing="8">
<SymbolIcon Symbol="Save" />
<TextBlock Text="Save" />
</StackPanel>
</Button>
</Grid>
</local:PostEditorViewBase>

0 comments on commit a9b16aa

Please sign in to comment.