-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text field editors #2946
Text field editors #2946
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@model OrchardCore.ContentFields.ViewModels.EditTextFieldViewModel | ||
@using OrchardCore.ContentManagement.Metadata.Models | ||
@using OrchardCore.ContentFields.Settings; | ||
|
||
@{ | ||
var settings = Model.PartFieldDefinition.Settings.ToObject<TextFieldSettings>(); | ||
} | ||
|
||
<fieldset class="form-group"> | ||
<label asp-for="Text">@Model.PartFieldDefinition.DisplayName()</label> | ||
<input asp-for="Text" class="form-control content-preview-text" type="color" /> | ||
@if (!String.IsNullOrEmpty(settings.Hint)) | ||
{ | ||
<span class="hint">@settings.Hint</span> | ||
} | ||
</fieldset> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@{ | ||
string currentEditor = Model.Editor; | ||
} | ||
<option value="Color" selected="@String.IsNullOrEmpty(currentEditor)">@T["Color"]</option> | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@model OrchardCore.ContentFields.ViewModels.EditTextFieldViewModel | ||
@using OrchardCore.ContentManagement.Metadata.Models | ||
@using OrchardCore.ContentFields.Settings; | ||
|
||
@{ | ||
var settings = Model.PartFieldDefinition.Settings.ToObject<TextFieldSettings>(); | ||
} | ||
|
||
<fieldset class="form-group"> | ||
<label asp-for="Text">@Model.PartFieldDefinition.DisplayName()</label> | ||
<div class="input-group mb-2"> | ||
<div class="input-group-prepend"> | ||
<div class="input-group-text">@@</div> | ||
</div> | ||
<input asp-for="Text" class="form-control content-preview-text" type="email" /> | ||
</div> | ||
@if (!String.IsNullOrEmpty(settings.Hint)) | ||
{ | ||
<span class="hint">@settings.Hint</span> | ||
} | ||
</fieldset> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@{ | ||
string currentEditor = Model.Editor; | ||
} | ||
<option value="Email" selected="@(currentEditor == "Email")">@T["Email"]</option> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@model OrchardCore.ContentFields.ViewModels.EditTextFieldViewModel | ||
@using OrchardCore.ContentManagement.Metadata.Models | ||
@using OrchardCore.ContentFields.Settings; | ||
|
||
@{ | ||
var settings = Model.PartFieldDefinition.Settings.ToObject<TextFieldSettings>(); | ||
} | ||
|
||
<fieldset class="form-group"> | ||
<label asp-for="Text">@Model.PartFieldDefinition.DisplayName()</label> | ||
<input asp-for="Text" class="form-control content-preview-text" type="tel" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also add a pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" attribute to the input else this will render as a simple textbox. Right now this input has no validation ; I could add letters to it, though someone could say that this is for supporting phone numbers like "1-800-MY-APPLE" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't add any validation, or more patterns. It's very locale specific, and leaving the browser do that is fine right now. Otherwise just remove the editor. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could give the option of a pattern and if the pattern is null then don't render one. Else this field is a textbox. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Too complex. At that point better teach them how to write a custom editor. There are way too many options to handle phone numbers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documentation then |
||
@if (!String.IsNullOrEmpty(settings.Hint)) | ||
{ | ||
<span class="hint">@settings.Hint</span> | ||
} | ||
</fieldset> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@{ | ||
string currentEditor = Model.Editor; | ||
} | ||
<option value="Tel" selected="@String.IsNullOrEmpty(currentEditor)">@T["Phone"]</option> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not right. It should be |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@model OrchardCore.ContentFields.ViewModels.EditTextFieldViewModel | ||
@using OrchardCore.ContentManagement.Metadata.Models | ||
@using OrchardCore.ContentFields.Settings; | ||
|
||
@{ | ||
var settings = Model.PartFieldDefinition.Settings.ToObject<TextFieldSettings>(); | ||
} | ||
|
||
<fieldset class="form-group"> | ||
<label asp-for="Text">@Model.PartFieldDefinition.DisplayName()</label> | ||
<input asp-for="Text" class="form-control content-preview-text" type="url" /> | ||
@if (!String.IsNullOrEmpty(settings.Hint)) | ||
{ | ||
<span class="hint">@settings.Hint</span> | ||
} | ||
</fieldset> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@{ | ||
string currentEditor = Model.Editor; | ||
} | ||
<option value="Url" selected="@String.IsNullOrEmpty(currentEditor)">@T["Url"]</option> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not right. It should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not right. It should be
@(currentEditor == "Color")