Skip to content

Commit

Permalink
Fixed #139, fixed #143
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Sikorsky committed Nov 7, 2017
1 parent 440ace3 commit fafdcef
Show file tree
Hide file tree
Showing 63 changed files with 284 additions and 96 deletions.
Binary file added platformus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 9 additions & 6 deletions postgresql_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,19 @@ ALTER SEQUENCE "Cultures_Id_seq" RESTART WITH 3;
INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (1,'string','singleLinePlainText','Single line plain text',1);
INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (2,'string','multilinePlainText','Multiline plain text',2);
INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (3,'string','html','Html',3);
INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (4,'string','image','Image',4);
INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (5,'datetime','date','Date',5);
ALTER SEQUENCE "DataTypes_Id_seq" RESTART WITH 6;
INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (4,'integer','integerNumber','Integer number',4);
INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (5,'decimal','decimalNumber','Decimal number',5);
INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (6,'integer','booleanFlag','Boolean flag',6);
INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (7,'string','image','Image',7);
INSERT INTO public."DataTypes" ("Id","StorageDataType","JavaScriptEditorClassName","Name","Position") VALUES (8,'datetime','date','Date',8);
ALTER SEQUENCE "DataTypes_Id_seq" RESTART WITH 9;
INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (1,1,'checkbox','IsRequired','Is required');
INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (2,1,'numericTextBox','MaxLength','Max length');
INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (3,2,'checkbox','IsRequired','Is required');
INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (4,2,'numericTextBox','MaxLength','Max length');
INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (5,4,'numericTextBox','Width','Width');
INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (6,4,'numericTextBox','Height','Height');
INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (7,5,'checkbox','IsRequired','Is required');
INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (5,7,'numericTextBox','Width','Width');
INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (6,7,'numericTextBox','Height','Height');
INSERT INTO public."DataTypeParameters" ("Id","DataTypeId","JavaScriptEditorClassName","Code","Name") VALUES (7,8,'checkbox','IsRequired','Is required');
ALTER SEQUENCE "DataTypeParameters_Id_seq" RESTART WITH 8;

--
Expand Down
21 changes: 12 additions & 9 deletions sqlite_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,18 @@ INSERT INTO "Cultures" VALUES (2,'en','English',0,1,1);
INSERT INTO "DataTypes" VALUES (1,'string','singleLinePlainText','Single line plain text',1);
INSERT INTO "DataTypes" VALUES (2,'string','multilinePlainText','Multiline plain text',2);
INSERT INTO "DataTypes" VALUES (3,'string','html','Html',3);
INSERT INTO "DataTypes" VALUES (4,'string','image','Image',4);
INSERT INTO "DataTypes" VALUES (5,'datetime','date','Date',5);
INSERT INTO "DataTypes" VALUES (4,'integer','integerNumber','Integer number',4);
INSERT INTO "DataTypes" VALUES (5,'decimal','decimalNumber','Decimal number',5);
INSERT INTO "DataTypes" VALUES (6,'integer','booleanFlag','Boolean flag',6);
INSERT INTO "DataTypes" VALUES (7,'string','image','Image',7);
INSERT INTO "DataTypes" VALUES (8,'datetime','date','Date',8);
INSERT INTO "DataTypeParameters" VALUES (1,1,'checkbox','IsRequired','Is required');
INSERT INTO "DataTypeParameters" VALUES (2,1,'numericTextBox','MaxLength','Max length');
INSERT INTO "DataTypeParameters" VALUES (3,2,'checkbox','IsRequired','Is required');
INSERT INTO "DataTypeParameters" VALUES (4,2,'numericTextBox','MaxLength','Max length');
INSERT INTO "DataTypeParameters" VALUES (5,7,'numericTextBox','Width','Width');
INSERT INTO "DataTypeParameters" VALUES (6,7,'numericTextBox','Height','Height');
INSERT INTO "DataTypeParameters" VALUES (7,8,'checkbox','IsRequired','Is required');

--
-- Extension: Platformus.Forms
Expand All @@ -77,12 +87,5 @@ INSERT INTO "FieldTypes" VALUES (3,'Checkbox','Checkbox',3);
INSERT INTO "FieldTypes" VALUES (4,'RadioButtonList','Radio button list',4);
INSERT INTO "FieldTypes" VALUES (5,'DropDownList','Drop down list',5);
INSERT INTO "FieldTypes" VALUES (6,'FileUpload','File upload',6);
INSERT INTO "DataTypeParameters" VALUES (1,1,'checkbox','IsRequired','Is required');
INSERT INTO "DataTypeParameters" VALUES (2,1,'numericTextBox','MaxLength','Max length');
INSERT INTO "DataTypeParameters" VALUES (3,2,'checkbox','IsRequired','Is required');
INSERT INTO "DataTypeParameters" VALUES (4,2,'numericTextBox','MaxLength','Max length');
INSERT INTO "DataTypeParameters" VALUES (5,4,'numericTextBox','Width','Width');
INSERT INTO "DataTypeParameters" VALUES (6,4,'numericTextBox','Height','Height');
INSERT INTO "DataTypeParameters" VALUES (7,5,'checkbox','IsRequired','Is required');

COMMIT;
27 changes: 15 additions & 12 deletions sqlserver_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,23 @@ SET IDENTITY_INSERT [dbo].[DataTypes] ON;
INSERT INTO [dbo].[DataTypes] ([Id], [StorageDataType], [JavaScriptEditorClassName], [Name], [Position]) VALUES (1, N'string', N'singleLinePlainText', N'Single line plain text', 1);
INSERT INTO [dbo].[DataTypes] ([Id], [StorageDataType], [JavaScriptEditorClassName], [Name], [Position]) VALUES (2, N'string', N'multilinePlainText', N'Multiline plain text', 2);
INSERT INTO [dbo].[DataTypes] ([Id], [StorageDataType], [JavaScriptEditorClassName], [Name], [Position]) VALUES (3, N'string', N'html', N'Html', 3);
INSERT INTO [dbo].[DataTypes] ([Id], [StorageDataType], [JavaScriptEditorClassName], [Name], [Position]) VALUES (4, N'string', N'image', N'Image', 4);
INSERT INTO [dbo].[DataTypes] ([Id], [StorageDataType], [JavaScriptEditorClassName], [Name], [Position]) VALUES (5, N'datetime', N'date', N'Date', 5);
INSERT INTO [dbo].[DataTypes] ([Id], [StorageDataType], [JavaScriptEditorClassName], [Name], [Position]) VALUES (4, N'integer', N'integerNumber', N'Integer number', 4);
INSERT INTO [dbo].[DataTypes] ([Id], [StorageDataType], [JavaScriptEditorClassName], [Name], [Position]) VALUES (5, N'decimal', N'decimalNumber', N'Decimal number', 5);
INSERT INTO [dbo].[DataTypes] ([Id], [StorageDataType], [JavaScriptEditorClassName], [Name], [Position]) VALUES (6, N'integer', N'booleanFlag', N'Boolean flag', 6);
INSERT INTO [dbo].[DataTypes] ([Id], [StorageDataType], [JavaScriptEditorClassName], [Name], [Position]) VALUES (7, N'string', N'image', N'Image', 7);
INSERT INTO [dbo].[DataTypes] ([Id], [StorageDataType], [JavaScriptEditorClassName], [Name], [Position]) VALUES (8, N'datetime', N'date', N'Date', 8);
SET IDENTITY_INSERT [dbo].[DataTypes] OFF;

SET IDENTITY_INSERT [dbo].[DataTypeParameters] ON;
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (1, 1, N'checkbox', N'IsRequired', N'Is required');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (2, 1, N'numericTextBox', N'MaxLength', N'Max length');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (3, 2, N'checkbox', N'IsRequired', N'Is required');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (4, 2, N'numericTextBox', N'MaxLength', N'Max length');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (5, 7, N'numericTextBox', N'Width', N'Width');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (6, 7, N'numericTextBox', N'Height', N'Height');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (7, 8, N'checkbox', N'IsRequired', N'Is required');
SET IDENTITY_INSERT [dbo].[DataTypeParameters] OFF;

--
-- Extension: Platformus.Forms
-- Version: beta1
Expand All @@ -105,14 +118,4 @@ INSERT INTO [dbo].[FieldTypes] ([Id], [Code], [Name], [Position]) VALUES (5, N'D
INSERT INTO [dbo].[FieldTypes] ([Id], [Code], [Name], [Position]) VALUES (6, N'FileUpload', N'File upload', 6);
SET IDENTITY_INSERT [dbo].[FieldTypes] OFF;

SET IDENTITY_INSERT [dbo].[DataTypeParameters] ON;
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (1, 1, N'checkbox', N'IsRequired', N'Is required');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (2, 1, N'numericTextBox', N'MaxLength', N'Max length');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (3, 2, N'checkbox', N'IsRequired', N'Is required');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (4, 2, N'numericTextBox', N'MaxLength', N'Max length');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (5, 4, N'numericTextBox', N'Width', N'Width');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (6, 4, N'numericTextBox', N'Height', N'Height');
INSERT INTO [dbo].[DataTypeParameters] ([Id], [DataTypeId], [JavaScriptEditorClassName], [Code], [Name]) VALUES (7, 5, N'checkbox', N'IsRequired', N'Is required');
SET IDENTITY_INSERT [dbo].[DataTypeParameters] OFF;

COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,31 @@
$.fn.val = function (value) {
if (arguments.length == 0) {
if (this.hasClass("checkbox")) {
return this.find("input").val() == true.toString();
var value = this.find("input").val();

if (this.data("useIntegerNumber")) {
return value == "1";
}

return value == "true";
}

return $val.call(this);
}

if (this.hasClass("checkbox")) {
var result = this.find("input").val(value);
var result = null;
var input = this.find("input");

value = value == true || value == "true" || value == 1 || value == "1";

if (this.data("useIntegerNumber")) {
input.val(value ? 1 : 0);
}

else {
input.val(value ? true : false);
}

this.trigger("change");
return result;
Expand All @@ -39,7 +56,17 @@

function checkboxClickHandler() {
$(this).find(".checkbox__indicator").toggleClass("checkbox__indicator--checked");
$(this).val((!$(this).val()).toString());

var value = $(this).val();

if ($(this).data("useIntegerNumber")) {
$(this).val(value ? "0" : "1");
}

else {
$(this).val(value ? "false" : "true");
}

return false;
}
})(window.platformus = window.platformus || {});
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
.attr("id", descriptor.identity)
.attr("href", "#");

if (descriptor.useIntegerNumber) {
checkbox.attr("data-use-integer-number", true);
}

createIndicator(descriptor).appendTo(checkbox);
createLabel(descriptor).appendTo(checkbox);
createInput(descriptor).appendTo(checkbox);
Expand All @@ -19,7 +23,7 @@
function createIndicator(descriptor) {
var indicator = $("<div>").addClass("checkbox__indicator");

if (descriptor.value == "true")
if (getValue(descriptor))
indicator.addClass("checkbox__indicator--checked");

return indicator;
Expand All @@ -33,6 +37,21 @@
return $("<input>")
.attr("name", descriptor.identity)
.attr("type", "hidden")
.attr("value", platformus.string.isNullOrEmpty(descriptor.value) ? "false" : descriptor.value);
.attr("value", formatValue(descriptor));
}

function formatValue(descriptor) {
var value = getValue(descriptor);

if (descriptor.useIntegerNumber) {
return value ? 1 : 0;
}

return value ? true : false;
}

function getValue(descriptor) {
return platformus.string.isNullOrEmpty(descriptor.value) ?
false : descriptor.value == true || descriptor.value == "true" || descriptor.value == 1 || descriptor.value == "1";
}
})(window.platformus = window.platformus || {});
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
color: #fff;
}

.table__image {
max-width: 100px;
max-height: 100px;
}

.table__buttons {
padding: 5px;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Platformus.Barebone/Platformus.Barebone.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

<ItemGroup>
<PackageReference Include="CoreCompat.System.Drawing" Version="1.0.0-beta006" />
<PackageReference Include="ExtCore.Data.Abstractions" Version="3.0.0-beta1" />
<PackageReference Include="ExtCore.Events" Version="3.0.0-beta1" />
<PackageReference Include="ExtCore.Infrastructure" Version="3.0.0-beta1" />
<PackageReference Include="MailKit" Version="1.8.1" />
<PackageReference Include="ExtCore.Data.Abstractions" Version="3.0.0" />
<PackageReference Include="ExtCore.Events" Version="3.0.0" />
<PackageReference Include="ExtCore.Infrastructure" Version="3.0.0" />
<PackageReference Include="MailKit" Version="1.18.1.1" />
<PackageReference Include="NUglify" Version="1.5.4" />
<PackageReference Include="runtime.linux-x64.CoreCompat.System.Drawing" Version="1.0.0-beta009" />
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="1.0.1-beta004" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ExtCore.Data.Abstractions" Version="3.0.0-beta1" />
<PackageReference Include="ExtCore.Data.Abstractions" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ExtCore.Data.Entities.Abstractions" Version="3.0.0-beta1" />
<PackageReference Include="ExtCore.Data.Entities.Abstractions" Version="3.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ExtCore.Data.EntityFramework.PostgreSql" Version="3.0.0-beta1" />
<PackageReference Include="ExtCore.Data.EntityFramework.PostgreSql" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ExtCore.Data.EntityFramework.SqlServer" Version="3.0.0-beta1" />
<PackageReference Include="ExtCore.Data.EntityFramework.SqlServer" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ExtCore.Data.EntityFramework.Sqlite" Version="3.0.0-beta1" />
<PackageReference Include="ExtCore.Data.EntityFramework.Sqlite" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Platformus.Domain.Api/Platformus.Domain.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ExtCore.Data.Abstractions" Version="3.0.0-beta1" />
<PackageReference Include="ExtCore.Infrastructure" Version="3.0.0-beta1" />
<PackageReference Include="ExtCore.Data.Abstractions" Version="3.0.0" />
<PackageReference Include="ExtCore.Infrastructure" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@
}

for (var i = 0; i < dataType.dataTypeParameters.length; i++) {
var f = platformus.dataTypeParameterEditors[dataType.dataTypeParameters[i].javaScriptEditorClassName]["create"];
var dataTypeParameterEditor = platformus.dataTypeParameterEditors[dataType.dataTypeParameters[i].javaScriptEditorClassName];

f.call(this, dataTypeParameterEditors, dataType.dataTypeParameters[i]);
if (dataTypeParameterEditor != null) {
var f = dataTypeParameterEditor["create"];

if (f != null) {
f.call(this, dataTypeParameterEditors, dataType.dataTypeParameters[i]);
}
}
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright © 2017 Dmitry Sikorsky. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

(function (platformus) {
platformus.memberEditors = platformus.memberEditors || [];
platformus.memberEditors.booleanFlag = {};
platformus.memberEditors.booleanFlag.create = function (container, member) {
createField(member).appendTo(container);
};

function createField(member) {
var field = $("<div>").addClass("form__field form__field--separated field");

platformus.controls.checkbox.create(
{
identity: platformus.memberEditors.base.getIdentity(member),
text: member.name,
value: member.property.integerValue,
useIntegerNumber: true
}
).appendTo(field);
return field;
}
})(window.platformus = window.platformus || {});
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright © 2017 Dmitry Sikorsky. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

(function (platformus) {
platformus.memberEditors = platformus.memberEditors || [];
platformus.memberEditors.decimalNumber = {};
platformus.memberEditors.decimalNumber.create = function (container, member) {
createField(member).appendTo(container);
};

function createField(member) {
var field = $("<div>").addClass("form__field").addClass("field");

platformus.controls.label.create({ text: member.name }).appendTo(field);
platformus.controls.numericTextBox.create(
{
identity: platformus.memberEditors.base.getIdentity(member),
value: member.property.decimalValue,
validation: {
isRequired: platformus.memberEditors.base.getIsRequiredDataTypeParameterValue(member),
maxLength: platformus.memberEditors.base.getMaxLengthDataTypeParameterValue(member)
}
}
).appendTo(field);

platformus.controls.numericTextBox.createNumericButtons().appendTo(field);
return field;
}
})(window.platformus = window.platformus || {});
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright © 2017 Dmitry Sikorsky. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

(function (platformus) {
platformus.memberEditors = platformus.memberEditors || [];
platformus.memberEditors.integerNumber = {};
platformus.memberEditors.integerNumber.create = function (container, member) {
createField(member).appendTo(container);
};

function createField(member) {
var field = $("<div>").addClass("form__field").addClass("field");

platformus.controls.label.create({ text: member.name }).appendTo(field);
platformus.controls.numericTextBox.create(
{
identity: platformus.memberEditors.base.getIdentity(member),
value: member.property.integerValue,
validation: {
isRequired: platformus.memberEditors.base.getIsRequiredDataTypeParameterValue(member),
maxLength: platformus.memberEditors.base.getMaxLengthDataTypeParameterValue(member)
}
}
).appendTo(field);

platformus.controls.numericTextBox.createNumericButtons().appendTo(field);
return field;
}
})(window.platformus = window.platformus || {});
Loading

0 comments on commit fafdcef

Please sign in to comment.