-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tabulator #182
base: master
Are you sure you want to change the base?
Tabulator #182
Changes from 13 commits
de5505f
ccb017a
424dc70
0ef30ed
e0b1e95
1a929bf
a52935f
0939c85
eaa7b5d
5f523e1
223e86b
5a3a925
1f438a3
d76b76c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace StatCan.OrchardCore.Tabulator | ||
{ | ||
public static class FeatureIds | ||
{ | ||
public const string Tabulator = "StatCan.OrchardCore.Tabulator"; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using OrchardCore.Modules.Manifest; | ||
using static StatCan.OrchardCore.Tabulator.FeatureIds; | ||
|
||
[assembly: Module( | ||
Name = "StatCan Table Creator", | ||
Author = "Digital Innovation Team", | ||
Website = "https://digital.statcan.gc.ca", | ||
Version = "1.0.0" | ||
)] | ||
|
||
[assembly: Feature( | ||
Id = Tabulator, | ||
Name = "StatCan.TableCreator - Widgets", | ||
Category = "Content", | ||
Description = "Adds a widget used to create tables", | ||
Dependencies = new[] | ||
{ | ||
"OrchardCore.Widgets", | ||
|
||
} | ||
)] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using OrchardCore.ContentManagement.Metadata; | ||
using OrchardCore.ContentManagement.Metadata.Settings; | ||
using OrchardCore.Data.Migration; | ||
using OrchardCore.Title.Models; | ||
using StatCan.OrchardCore.Extensions; | ||
|
||
namespace StatCan.OrchardCore.Tabulator | ||
{ | ||
public class Migrations : DataMigration | ||
{ | ||
private readonly IContentDefinitionManager _contentDefinitionManager; | ||
public Migrations(IContentDefinitionManager contentDefinitionManager) | ||
{ | ||
_contentDefinitionManager = contentDefinitionManager; | ||
} | ||
|
||
public int Create() | ||
{ | ||
return 1; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
{ | ||
"name": "Table Creator", | ||
"displayName": "Table Creator", | ||
"description": "Creates tables from a JSON formatted data.", | ||
"author": "StatCan Digital Innovation", | ||
"website": "digital.statcan.gc.ca", | ||
"version": "1.0.0", | ||
"issetuprecipe": false, | ||
"categories": [], | ||
"tags": [], | ||
"steps": [ | ||
{ | ||
"name": "feature", | ||
"disable": [], | ||
"enable": [ | ||
"StatCan.OrchardCore.Tabulator" | ||
] | ||
}, | ||
{ | ||
"name": "ContentDefinition", | ||
"ContentTypes": [ | ||
{ | ||
"Name": "TableCreator", | ||
"DisplayName": "TableCreator", | ||
"Settings": { | ||
"ContentTypeSettings": { | ||
"Creatable": true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Widgets usually have the following settings set to |
||
"Listable": true, | ||
"Draftable": true, | ||
"Versionable": true, | ||
"Stereotype": "Widget", | ||
"Securable": true | ||
}, | ||
"FullTextAspectSettings": {} | ||
}, | ||
"ContentTypePartDefinitionRecords": [ | ||
{ | ||
"PartName": "TableCreator", | ||
"Name": "TableCreator", | ||
"Settings": { | ||
"ContentTypePartSettings": { | ||
"Position": "0" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"ContentParts": [ | ||
{ | ||
"Name": "TableCreator", | ||
"Settings": {}, | ||
"ContentPartFieldDefinitionRecords": [ | ||
{ | ||
"FieldName": "TextField", | ||
"Name": "TableData", | ||
"Settings": { | ||
"ContentPartFieldSettings": { | ||
"DisplayName": "TableData", | ||
"Position": "0" | ||
}, | ||
"TextFieldSettings": { | ||
"Hint": "Enter JSON for Table Data here", | ||
"Required": true | ||
} | ||
} | ||
}, | ||
{ | ||
"FieldName": "TextField", | ||
"Name": "ColumnsData", | ||
"Settings": { | ||
"ContentPartFieldSettings": { | ||
"DisplayName": "ColumnsData", | ||
"Position": "1" | ||
}, | ||
"TextFieldSettings": { | ||
"Hint": "To specify the column headers, enter the JSON for the columns here. If using the AutoColumnizer feature, enter an empty set of quotation marks. Eg. \"\".", | ||
"Required": true | ||
} | ||
} | ||
}, | ||
{ | ||
"FieldName": "TextField", | ||
"Name": "AutoColumnizer", | ||
"Settings": { | ||
"ContentPartFieldSettings": { | ||
"DisplayName": "AutoColumnizer", | ||
"Position": "2" | ||
}, | ||
"TextFieldSettings": { | ||
"Hint": "Enter \"true\" to automatically set the columns as per the TableData. Enter \"false\" to set the columns as per the json in the ColumnsData field." | ||
} | ||
} | ||
}, | ||
{ | ||
"FieldName": "NumericField", | ||
"Name": "PaginationSize", | ||
"Settings": { | ||
"ContentPartFieldSettings": { | ||
"DisplayName": "PaginationSize", | ||
"Position": "2" | ||
}, | ||
"NumericFieldSettings": { | ||
"Hint": "Enter the number of rows to be displayed per page. For example, entering \"5\" will display 5 rows per page.", | ||
"Minimum": 1.0, | ||
"Maximum": 100.0 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using OrchardCore.Modules; | ||
using OrchardCore.ResourceManagement; | ||
using OrchardCore.Data.Migration; | ||
|
||
namespace StatCan.OrchardCore.Tabulator | ||
{ | ||
[Feature(FeatureIds.Tabulator)] | ||
public class Startup : StartupBase | ||
{ | ||
public override void ConfigureServices(IServiceCollection serviceCollection) => serviceCollection.AddScoped<IDataMigration, Migrations>(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Razor"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>$(AspNetCoreTargetFramework)</TargetFramework> | ||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc> | ||
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;node_modules\**</DefaultItemExcludes> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<FrameworkReference Include="Microsoft.AspNetCore.App" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="OrchardCore.ContentManagement" Version="$(OrchardCoreVersion)" /> | ||
<PackageReference Include="OrchardCore.Contents" Version="$(OrchardCoreVersion)" /> | ||
<PackageReference Include="OrchardCore.DisplayManagement" Version="$(OrchardCoreVersion)" /> | ||
<PackageReference Include="OrchardCore.ResourceManagement" Version="$(OrchardCoreVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Lib\StatCan.OrchardCore.Extensions\StatCan.OrchardCore.Extensions.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% style name:"styles", src:"https://unpkg.com/tabulator-tables@4.9.3/dist/css/tabulator.min.css" %} | ||
{% script name:"tabulator", src:"https://unpkg.com/tabulator-tables@4.9.3/dist/js/tabulator.min.js", at:"Foot" %} | ||
|
||
|
||
<div id="tabulator-table" style="display:inline-block;width:100%;"></div> | ||
{% block "script", at: "Foot", depends-on: "tabulator"%} | ||
|
||
var table = new Tabulator("#tabulator-table", { | ||
height: "100%", | ||
layout: "fitColumns", //columns will fill the width of the container | ||
pagination: "local", //local pagination | ||
tooltips: true, //displays on hover text | ||
|
||
data: {{Model.ContentItem.Content.TableCreator.TableData.Text | raw}}, | ||
columns: {{Model.ContentItem.Content.TableCreator.ColumnsData.Text | raw}}, | ||
autoColumns: {{Model.ContentItem.Content.TableCreator.AutoColumnizer.Text | raw}}, | ||
paginationSize: {{Model.ContentItem.Content.TableCreator.PaginationSize.Value | raw}}, | ||
|
||
}); | ||
|
||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,10 @@ | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
<head> | ||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet"> | ||
|
||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.0/knockout-min.js"></script> | ||
<script src="https://unpkg.com/survey-knockout@1.8.20/survey.ko.min.js"></script> | ||
<link href="https://unpkg.com/survey-knockout@1.8.20/modern.css" type="text/css" rel="stylesheet"/> | ||
|
||
{{ "ThemeResources" | shape_new | shape_render }} | ||
{% resources type: "Meta" %} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this required ? It is not doing anything