mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Code styling in StringFilterForm
This commit is contained in:
+35
-38
@@ -7,7 +7,6 @@ using Orchard.Forms.Services;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Projections.FilterEditors.Forms {
|
||||
|
||||
public class StringFilterForm : IFormProvider {
|
||||
public const string FormName = "StringFilter";
|
||||
|
||||
@@ -20,46 +19,44 @@ namespace Orchard.Projections.FilterEditors.Forms {
|
||||
}
|
||||
|
||||
public void Describe(DescribeContext context) {
|
||||
Func<IShapeFactory, object> form =
|
||||
shape => {
|
||||
object form(IShapeFactory shape) {
|
||||
var f = Shape.Form(
|
||||
Id: "StringFilter",
|
||||
_Operator: Shape.SelectList(
|
||||
Id: "operator", Name: "Operator",
|
||||
Title: T("Operator"),
|
||||
Size: 1,
|
||||
Multiple: false
|
||||
),
|
||||
_Value: Shape.TextBox(
|
||||
Id: "value", Name: "Value",
|
||||
Title: T("Value"),
|
||||
Classes: new[] { "text medium", "tokenized" },
|
||||
Description: T("Enter the value the string should be.")
|
||||
),
|
||||
_IgnoreIfEmptyValue: Shape.Checkbox(
|
||||
Id: "IgnoreFilterIfValueIsEmpty",
|
||||
Name: "IgnoreFilterIfValueIsEmpty",
|
||||
Title: "Ignore filter if value is empty",
|
||||
Description: T("When enabled, the filter will not be applied if the provided value is or evaluates to empty."),
|
||||
Value: "true"
|
||||
));
|
||||
|
||||
var f = Shape.Form(
|
||||
Id: "StringFilter",
|
||||
_Operator: Shape.SelectList(
|
||||
Id: "operator", Name: "Operator",
|
||||
Title: T("Operator"),
|
||||
Size: 1,
|
||||
Multiple: false
|
||||
),
|
||||
_Value: Shape.TextBox(
|
||||
Id: "value", Name: "Value",
|
||||
Title: T("Value"),
|
||||
Classes: new[] { "text medium", "tokenized" },
|
||||
Description: T("Enter the value the string should be.")
|
||||
),
|
||||
_IgnoreIfEmptyValue: Shape.Checkbox(
|
||||
Id: "IgnoreFilterIfValueIsEmpty",
|
||||
Name: "IgnoreFilterIfValueIsEmpty",
|
||||
Title: "Ignore filter if value is empty",
|
||||
Description: T("When enabled, the filter will not be applied if the provided value is or evaluates to empty."),
|
||||
Value: "true"
|
||||
));
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Equals), Text = T("Is equal to").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotEquals), Text = T("Is not equal to").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Contains), Text = T("Contains").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.ContainsAny), Text = T("Contains any word").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.ContainsAll), Text = T("Contains all words").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Starts), Text = T("Starts with").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotStarts), Text = T("Does not start with").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Ends), Text = T("Ends with").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotEnds), Text = T("Does not end with").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotContains), Text = T("Does not contain").Text });
|
||||
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Equals), Text = T("Is equal to").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotEquals), Text = T("Is not equal to").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Contains), Text = T("Contains").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.ContainsAny), Text = T("Contains any word").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.ContainsAll), Text = T("Contains all words").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Starts), Text = T("Starts with").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotStarts), Text = T("Does not start with").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Ends), Text = T("Ends with").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotEnds), Text = T("Does not end with").Text });
|
||||
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotContains), Text = T("Does not contain").Text });
|
||||
return f;
|
||||
}
|
||||
|
||||
return f;
|
||||
};
|
||||
|
||||
context.Form(FormName, form);
|
||||
context.Form(FormName, (Func<IShapeFactory, object>)form);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user