Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/NewLifeX/NewLife.Cube
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Jan 20, 2024
2 parents 53bf890 + d27dff8 commit ad60f97
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 19 deletions.
52 changes: 34 additions & 18 deletions NewLife.CubeNC/Views/Shared/_Form_BigText.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@using NewLife;
@using NewLife.Cube
@using NewLife.Cube.ViewModels
@using XCode;
@using XCode.Configuration;
@{
Expand All @@ -11,29 +12,44 @@
if (ViewData.ModelState.TryGetValue(field.Name, out var st) && st != null) { err = st.Errors.Count; }

var des = field.Description.TrimStart(field.DisplayName).TrimStart(",", ".", "", "");


var total = 12;
var label = 3;
var span = 4;
if (err == 0 && des.IsNullOrEmpty())
{
span = 0;
}

var input = total - label - span;

}
<label class="control-label col-sm-3 col-md-2 col-lg-1">@field.DisplayName</label>

<label class="control-label col-xs-@label col-sm-1 col-md-@label" ">@field.DisplayName</label>
<div class="input-group col-xs-@(total - label) col-sm-@input">
@if (field.ReadOnly)
{
var row = (Int32)Math.Round(field.Length / 100d);
if (row < 3) row = 3;
@*<label class="form-control">@entity[field.Name]</label>*@
<textarea class="form-control" id="@field.Name" rows="@row" readonly>@entity[field.Name]</textarea>
}
else
{
@*@Html.ForString(field.Name, (String)entity[field.Name], field.Length)*@
@await Html.PartialAsync("_Form_String", new ItemModel(field.Name, entity[field.Name], field.Type) { Length = field.Length })
}
</div>
@if (err > 0)
{
<span class="col-sm-9 alert alert-danger">
<span class="col-sm-@span alert alert-danger">
@Html.ValidationMessage(field.Name)
</span>
}
else if (!des.IsNullOrEmpty())
@if (!des.IsNullOrEmpty())
{
<span class="col-sm-9"><span class="middle">@des</span></span>
<span class="hidden-xs col-sm-@span"><span class="middle">@des</span></span>
}
<div class="input-group col-sm-11 col-md-offset-1">
@if (field.ReadOnly)
{
var row = (Int32)Math.Round(field.Length / 100d);
if (row < 3) row = 3;
@*<label class="form-control">@entity[field.Name]</label>*@
<textarea class="form-control" id="@field.Name" rows="@row" readonly>@entity[field.Name]</textarea>
}
else
{
@*@Html.ForString(field.Name, (String)entity[field.Name], field.Length)*@
@await Html.PartialAsync("_Form_String", new ItemModel(field.Name, entity[field.Name], field.Type) { Length = field.Length })
}
</div>
3 changes: 2 additions & 1 deletion NewLife.CubeNC/Views/Shared/_Form_Group.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@model ValueTuple<IEntity, DataField>
@using NewLife;
@using NewLife.Cube.ViewModels
@using XCode;
@using XCode.Configuration;
@{
Expand All @@ -13,7 +14,7 @@
}
@if (field.IsBigText())
{
<div class="form-group col-md-12">
<div class="form-group col-xs-12 col-md-6">
@await Html.PartialAsync("_Form_BigText", (Object)Model)
</div>
}
Expand Down

0 comments on commit ad60f97

Please sign in to comment.