|
35 | 35 | <label for="preview">Preview-Url</label>
|
36 | 36 | <InputText class="form-control" id="preview" @bind-Value="model.PreviewImageUrl"/>
|
37 | 37 | <small for="preview" class="form-text text-muted">The primary image which will be used.</small>
|
38 |
| - <ValidationMessage For="() => model.PreviewImageUrl"></ValidationMessage> |
| 38 | + <ValidationMessage For="() => model.PreviewImageUrl"></ValidationMessage> |
39 | 39 | </div>
|
40 | 40 | <div class="mb-3">
|
41 |
| - <label for="preview">Fallback Preview-Url</label> |
42 |
| - <InputText class="form-control" id="fallback-preview" @bind-Value="model.PreviewImageUrlFallback"/> |
43 |
| - <small for="fallback-preview" class="form-text text-muted">Optional: Used as a fallback if the preview image can't be used by the browser. |
44 |
| - <br>For example using a jpg or png as fallback for avif which is not supported in Safari or Edge.</small> |
45 |
| - <ValidationMessage For="() => model.PreviewImageUrlFallback"></ValidationMessage> |
| 41 | + <label for="preview">Fallback Preview-Url</label> |
| 42 | + <InputText class="form-control" id="fallback-preview" @bind-Value="model.PreviewImageUrlFallback"/> |
| 43 | + <small for="fallback-preview" class="form-text text-muted">Optional: Used as a fallback if the preview image can't be used by the browser. |
| 44 | + <br>For example using a jpg or png as fallback for avif which is not supported in Safari or Edge.</small> |
| 45 | + <ValidationMessage For="() => model.PreviewImageUrlFallback"></ValidationMessage> |
| 46 | + </div> |
| 47 | + <div class="mb-3"> |
| 48 | + <label for="scheduled">Scheduled Publish Date</label> |
| 49 | + <InputDate Type="InputDateType.DateTimeLocal" |
| 50 | + class="form-control" |
| 51 | + id="scheduled" |
| 52 | + @bind-Value="model.ScheduledPublishDate" |
| 53 | + @bind-Value:after="@(() => model.IsPublished &= !IsScheduled)"/> |
| 54 | + <small for="scheduled" class="form-text text-muted">If set the blog post will be published at the given date. |
| 55 | + A blog post with a schedule date can't be set to published.</small> |
| 56 | + <ValidationMessage For="() => model.ScheduledPublishDate"></ValidationMessage> |
46 | 57 | </div>
|
47 | 58 | <div class="form-check">
|
48 |
| - <InputCheckbox class="form-check-input" id="published" @bind-Value="model.IsPublished" /> |
| 59 | + <InputCheckbox class="form-check-input" id="published" @bind-Value="model.IsPublished"/> |
49 | 60 | <label class="form-check-label" for="published">Publish</label><br/>
|
50 |
| - <small for="published" class="form-text text-muted">If this blog post is only draft uncheck the box</small> |
| 61 | + <small for="published" class="form-text text-muted">If this blog post is only draft or it will be scheduled, uncheck the box.</small> |
| 62 | + <ValidationMessage For="() => model.IsPublished"></ValidationMessage> |
51 | 63 | </div>
|
52 | 64 | <div class="mb-3">
|
53 |
| - <label for="tags">Tags</label> |
54 |
| - <InputText class="form-control" id="tags" @bind-Value="model.Tags"/> |
| 65 | + <label for="tags">Tags</label> |
| 66 | + <InputText class="form-control" id="tags" @bind-Value="model.Tags"/> |
55 | 67 | </div>
|
56 |
| - @if (BlogPost != null) |
| 68 | + @if (BlogPost != null && !IsScheduled) |
57 | 69 | {
|
58 | 70 | <div class="form-check">
|
59 | 71 | <InputCheckbox class="form-check-input" id="updatedate" @bind-Value="model.ShouldUpdateDate" />
|
60 | 72 | <label class="form-check-label" for="updatedate">Update Publish Date?</label><br/>
|
61 | 73 | <small for="updatedate" class="form-text text-muted">If set the publish date is set to now,
|
62 |
| - otherwise its original date</small> |
| 74 | + otherwise its original date.</small> |
63 | 75 | </div>
|
64 | 76 | }
|
65 | 77 | <button class="btn btn-primary" type="submit" disabled="@(!canSubmit)">Submit</button>
|
|
101 | 113 |
|
102 | 114 | private bool canSubmit = true;
|
103 | 115 |
|
| 116 | + private bool IsScheduled => model.ScheduledPublishDate.HasValue; |
| 117 | + |
104 | 118 | protected override void OnParametersSet()
|
105 | 119 | {
|
106 | 120 | if (BlogPost == null)
|
|
0 commit comments