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;
|
using Orchard.Localization;
|
||||||
|
|
||||||
namespace Orchard.Projections.FilterEditors.Forms {
|
namespace Orchard.Projections.FilterEditors.Forms {
|
||||||
|
|
||||||
public class StringFilterForm : IFormProvider {
|
public class StringFilterForm : IFormProvider {
|
||||||
public const string FormName = "StringFilter";
|
public const string FormName = "StringFilter";
|
||||||
|
|
||||||
@@ -20,46 +19,44 @@ namespace Orchard.Projections.FilterEditors.Forms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Describe(DescribeContext context) {
|
public void Describe(DescribeContext context) {
|
||||||
Func<IShapeFactory, object> form =
|
object form(IShapeFactory shape) {
|
||||||
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(
|
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Equals), Text = T("Is equal to").Text });
|
||||||
Id: "StringFilter",
|
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotEquals), Text = T("Is not equal to").Text });
|
||||||
_Operator: Shape.SelectList(
|
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Contains), Text = T("Contains").Text });
|
||||||
Id: "operator", Name: "Operator",
|
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.ContainsAny), Text = T("Contains any word").Text });
|
||||||
Title: T("Operator"),
|
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.ContainsAll), Text = T("Contains all words").Text });
|
||||||
Size: 1,
|
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Starts), Text = T("Starts with").Text });
|
||||||
Multiple: false
|
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 });
|
||||||
_Value: Shape.TextBox(
|
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotEnds), Text = T("Does not end with").Text });
|
||||||
Id: "value", Name: "Value",
|
f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotContains), Text = T("Does not contain").Text });
|
||||||
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 });
|
return f;
|
||||||
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;
|
context.Form(FormName, (Func<IShapeFactory, object>)form);
|
||||||
};
|
|
||||||
|
|
||||||
context.Form(FormName, form);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user