Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
Issues
- #5 "XafBootstrapLookupPropertyEditor problem": enhanced
- #6 "Color chooser request": added support of color displaying to
XafBootstrapTable

Changes
- Added support of filter row, footer summaries and column sorting to
XafBootstrapTable
- Added Placeholder attribute (defines placeholder text for properties)
- Minor changes and updates
  • Loading branch information
Terricks committed Sep 7, 2015
1 parent c47679d commit f1f8132
Show file tree
Hide file tree
Showing 42 changed files with 1,897 additions and 526 deletions.
33 changes: 33 additions & 0 deletions 14.2/Content/bootstrap_css/bootstrap-dx.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,41 @@ table.xaf-bootstrap thead th {
border-right: 1px solid rgba(0, 0, 0, 0.04);
}

.table-filter-button {
position: absolute;
width: 24px;
height: 28px;
margin-left: -24px;
margin-top: 5px;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
vertical-align: middle;
border: 1px solid rgba(0, 0, 0, 0.14);
}

.table-filter-button>span
{
line-height: 28px;
padding-left: 5px;
}

table.xaf-bootstrap .filter-header {
padding-top: 2px;
padding-bottom: 2px;
}

table.xaf-bootstrap tbody td, table.xaf-bootstrap tbody th {
border-right: 1px solid rgba(0, 0, 0, 0.04);
border-bottom: 1px solid rgba(0, 0, 0, 0.01);
}

table.xaf-bootstrap tfoot {
background-color: rgba(0, 0, 0, 0.04);
}

table.xaf-bootstrap tfoot td {
border-right: 1px solid rgba(0, 0, 0, 0.04);
}


.DialogContent .ContentCell {
Expand Down Expand Up @@ -134,4 +163,8 @@ table.xaf-bootstrap tbody td, table.xaf-bootstrap tbody th {
.loading-progress {
margin: 0;
height: 5px;
}

.table-responsive {
-webkit-overflow-scrolling: touch;
}
2 changes: 1 addition & 1 deletion 14.2/Content/xaf_bootstrap_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20150731
20150820
1 change: 1 addition & 0 deletions 14.2/Controllers/XafBootstrapDetailViewRootController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void ObjectSpace_Committed(object sender, EventArgs e)
{
IsObjectChanged = true;
}


void ObjectSpace_ObjectChanged(object sender, ObjectChangedEventArgs e)
{
Expand Down
4 changes: 2 additions & 2 deletions 14.2/Controls/ActionContainerHolder/ActionContainerHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected override void OnInit(EventArgs e)
{
Callback = new CallbackHandler(UniqueID + "_Callback");
Callback.OnCallback += Callback_OnCallback;
}
}
}
protected override void OnUnload(EventArgs e)
{
Expand Down Expand Up @@ -385,7 +385,7 @@ void Callback_OnCallback(object source, CallbackEventArgs e)
Helpers.ProcessAction(action);
}

}
}
EnsureChildControls();
}

Expand Down
506 changes: 390 additions & 116 deletions 14.2/Controls/XafBootstrapTable.cs

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion 14.2/Controls/XafBootstrapTagSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ public void InnerRender()
Content.Text = "";

var values = String.Concat(Value).Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
var selectedItems = Items.List.Where(f => values.IndexOf(f.Value) > -1).ToList();
var selectedItems = new List<XafBootstrapTagSelectorItem>();
foreach(var value in values) {
var item = Items.List.FirstOrDefault(f => f.Value == value);
if (item != null && selectedItems.IndexOf(item) == -1)
selectedItems.Add(item);
}

if (TextOnly)
Content.Text += String.Format(@"<span>{0}</span>", String.Join(", ", selectedItems.Select(f => String.Format(@"{0}", f.Text))));
Expand Down
4 changes: 2 additions & 2 deletions 14.2/DatabaseUpdate/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ private static void CopyResource(string resourceName, string file, Boolean copyO
}
}

private static void CheckResource(string location, string resourceName, Boolean copyOnlyIfNotExists = true)
public static void CheckResource(string location, string resourceName, Boolean copyOnlyIfNotExists = true, String Path = "XAF_Bootstrap.Content")
{
CopyResource(String.Format("XAF_Bootstrap.Content.{0}.{1}", location, resourceName), AssemblyDirectory + location.Replace(".", "\\") + "\\" + resourceName, copyOnlyIfNotExists);
CopyResource(String.Format("{2}.{0}.{1}", location, resourceName, Path), AssemblyDirectory + location.Replace(".", "\\") + "\\" + resourceName, copyOnlyIfNotExists);
}

public static string AssemblyDirectory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public XafBootstrapDecimalPropertyEditor(Type objectType, IModelMemberViewItem i
private void InitEdit()
{
Edit = new XafBootstrapNumericEdit();
Edit.Placeholder = this.Caption;
Edit.Placeholder = EditorHelper.GetPlaceholder(this, this.Caption);
Edit.IsPassword = Model.IsPassword;
Edit.PropertyName = PropertyName;
Edit.RowCount = Model.RowCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using XAF_Bootstrap.Templates;

namespace XAF_Bootstrap.Editors.XafBootstrapPropertyEditors
{
Expand All @@ -47,7 +48,7 @@ protected override void SetupControl(System.Web.UI.WebControls.WebControl contro
private void InitEdit()
{
Edit = new XafBootstrapStringEdit();
Edit.Placeholder = this.Caption;
Edit.Placeholder = EditorHelper.GetPlaceholder(this, this.Caption);
Edit.IsPassword = Model.IsPassword;
Edit.PropertyName = PropertyName;
Edit.RowCount = Model.RowCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public XafBootstrapIntegerPropertyEditor(Type objectType, IModelMemberViewItem i
private void InitEdit()
{
Edit = new XafBootstrapNumericEdit();
Edit.Placeholder = this.Caption;
Edit.Placeholder = EditorHelper.GetPlaceholder(this, this.Caption);
Edit.IsPassword = Model.IsPassword;
Edit.PropertyName = PropertyName;
Edit.RowCount = Model.RowCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
using DevExpress.ExpressApp.Web;
using DevExpress.ExpressApp.Web.Editors.ASPx;
using DevExpress.Persistent.Base;
using DevExpress.Xpo;
using XAF_Bootstrap.Controls;
using XAF_Bootstrap.Templates;
using System;
Expand Down Expand Up @@ -66,16 +65,16 @@ protected override void SetupControl(System.Web.UI.WebControls.WebControl contro

private void InitEdit()
{
var attr = this.MemberInfo.FindAttribute<LookupEditorModeAttribute>();
IsSelector = (attr == null || attr.Mode != LookupEditorMode.AllItems);

var Helper = new LookupEditorHelper(Application, ObjectSpace.CreateNestedObjectSpace(), MemberInfo.MemberTypeInfo, Model);
var Helper = new LookupEditorHelper(Application, ObjectSpace.CreateNestedObjectSpace(), MemberInfo.MemberTypeInfo, Model);
IsSelector = Helper.EditorMode == LookupEditorMode.Search;

CollectionSourceBase cs = null;

if (!IsSelector || Helper.EditorMode == LookupEditorMode.Auto)
if (!IsSelector)
{
cs = Helper.CreateCollectionSource(Helper.ObjectSpace.GetObject(CurrentObject));
IsSelector = cs.List.Count > 20 || cs.List.Count == 0;
if (Helper.EditorMode == LookupEditorMode.Auto || Helper.EditorMode == LookupEditorMode.AllItemsWithSearch)
IsSelector = cs != null && cs.List.Count > 20;
}

String displayFormat = String.Concat(DisplayFormat);
Expand Down Expand Up @@ -113,24 +112,25 @@ private void InitEdit()
DropDown = new XafBootstrapDropdownEdit();
DropDown.OnClickScript = GetImmediatePostDataScript();
var listView = (IModelListView)App.Model.Views[App.FindLookupListViewId(MemberInfo.MemberType)];
foreach (var obj in cs.List)
{
var item = DropDown.Items.Add();
var cols = listView.Columns.Where(f => f.Index == null || f.Index > -1).OrderBy(f => f.Index);
if (cols.Count() > 1) {
var builder = new List<String>();
foreach (var col in cols)
{
builder.Add(String.Format(new ObjectFormatter(), "{0:" + col.GetValue<String>("FieldName") + "}", obj));
if (cs != null)
foreach (var obj in cs.List)
{
var item = DropDown.Items.Add();
var cols = listView.Columns.Where(f => f.Index == null || f.Index > -1).OrderBy(f => f.Index);
if (cols.Count() > 1) {
var builder = new List<String>();
foreach (var col in cols)
{
builder.Add(String.Format(new ObjectFormatter(), "{0:" + col.GetValue<String>("FieldName") + "}", obj));
}
builder = builder.Where(f => String.Concat(f) != "").ToList();
item.Text = builder.First();
item.Hint = String.Join("<br>", builder.Skip(1).Take(builder.Count-1));
} else {
item.Text = String.Format(new ObjectFormatter(), String.Concat(displayFormat) == "" ? "{0}" : displayFormat, obj);
}
builder = builder.Where(f => String.Concat(f) != "").ToList();
item.Text = builder.First();
item.Hint = String.Join("<br>", builder.Skip(1).Take(builder.Count-1));
} else {
item.Text = String.Format(new ObjectFormatter(), String.Concat(displayFormat) == "" ? "{0}" : displayFormat, obj);
item.Value = ObjectSpace.GetObject(obj);
}
item.Value = ObjectSpace.GetObject(obj);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using XAF_Bootstrap.Templates;

namespace XAF_Bootstrap.Editors.XafBootstrapPropertyEditors
{
Expand All @@ -40,7 +41,7 @@ public class XafBootstrapStringPropertyEditor : ASPxPropertyEditor, IXafBootstra
private void InitEdit()
{
Edit = new XafBootstrapStringEdit();
Edit.Placeholder = this.Caption;
Edit.Placeholder = EditorHelper.GetPlaceholder(this, this.Caption);
Edit.IsPassword = Model.IsPassword;
Edit.PropertyName = PropertyName;
Edit.RowCount = Model.RowCount;
Expand Down
16 changes: 16 additions & 0 deletions 14.2/Helpers/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
using System.Web.UI;
using DevExpress.ExpressApp.SystemModule;
using System.Web.UI.HtmlControls;
using XAF_Bootstrap.ModelExtensions.Attributes;

namespace XAF_Bootstrap.Templates
{
Expand All @@ -62,6 +63,21 @@ public class DynamicControl
public DevExpress.ExpressApp.View View;
}

public static class EditorHelper
{
public static String GetPlaceholder(PropertyEditor editor, String defaultValue = "")
{
String ret = defaultValue;
if (editor != null && editor.MemberInfo != null)
{
var placeholder = editor.MemberInfo.FindAttribute<PlaceholderAttribute>();
if (placeholder != null)
ret = placeholder.Placeholder;
}
return ret;
}
}

public static class Helpers
{
public const String JoinString = "_ibn_";
Expand Down
44 changes: 44 additions & 0 deletions 14.2/ModelExtensions/Attributes/PlaceholderAtrribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#region Copyright (c) 2014-2015 DevCloud Solutions
/*
{********************************************************************************}
{ }
{ Copyright (c) 2014-2015 DevCloud Solutions }
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{********************************************************************************}
*/
#endregion

using System;
using System.Collections.Generic;
using System.Linq;

namespace XAF_Bootstrap.ModelExtensions.Attributes
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class PlaceholderAttribute : Attribute
{
private String _Placeholder;

public PlaceholderAttribute(String Placeholder)
{
_Placeholder = Placeholder;
}

public String Placeholder
{
get { return _Placeholder; }
}
}
}
24 changes: 23 additions & 1 deletion 14.2/ModelExtensions/TagSelector/TagSourceAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
using DevExpress.Data.Filtering;
#region Copyright (c) 2014-2015 DevCloud Solutions
/*
{********************************************************************************}
{ }
{ Copyright (c) 2014-2015 DevCloud Solutions }
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{********************************************************************************}
*/
#endregion

using DevExpress.Data.Filtering;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
24 changes: 23 additions & 1 deletion 14.2/ModelExtensions/TagSelector/TagSourceKind.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
using System;
#region Copyright (c) 2014-2015 DevCloud Solutions
/*
{********************************************************************************}
{ }
{ Copyright (c) 2014-2015 DevCloud Solutions }
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{********************************************************************************}
*/
#endregion

using System;
using System.Collections.Generic;
using System.Linq;

Expand Down
4 changes: 2 additions & 2 deletions 14.2/Templates/ContentTemplate.ascx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
Tag="button" ItemClass="btn btn-info btn-sm" LeftDirection="False" />
</cc3:XafUpdatePanel>
</span>
<span class="panel">
<span>
<!-- View -->
<cc3:XafUpdatePanel ID="UPEI" runat="server">
<cc1:XafBootstrapErrorInfoControl ID="ErrorInfo" Style="margin: 10px 0px 10px 0px" runat="server" />
Expand Down Expand Up @@ -173,7 +173,7 @@
window.modalsStartZIndex = 1050;
function ShowXafMessage(caption, confirmationMessage, callback, buttonOKCaption, isCancelButtonNeeded) {
var modals = $('.modal.in');
if (buttonOKCaption == '')
if (buttonOKCaption == '' || buttonOKCaption == undefined)
buttonOKCaption = '<%= XAF_Bootstrap.Templates.Helpers.GetLocalizedText(@"DialogButtons", "OK") %>';
var cancelButton = '';
if (isCancelButtonNeeded + "" != 'false')
Expand Down

0 comments on commit f1f8132

Please sign in to comment.