-
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
Open
axalrub
wants to merge
14
commits into
master
Choose a base branch
from
tabulator
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Tabulator #182
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
de5505f
initial commit of assessment module
jptissot ccb017a
Merge branch 'master' into assessment
jptissot 424dc70
adds assessment widget v1
axalrub 0ef30ed
Adds Assessment recipe
axalrub e0b1e95
Adds cypress tests
axalrub 1a929bf
initial commit
axalrub a52935f
WIP initial commit
axalrub 0939c85
Adds Tabulator widget
axalrub eaa7b5d
Adds Tabulator recipe and cypress tests
axalrub 5f523e1
Chng tabulator to tableCreator, refactors cypress tests
axalrub 223e86b
changes recipe name
axalrub 5a3a925
removes irrelevant files
axalrub 1f438a3
removes more irrelevant files
axalrub d76b76c
removes recipe, adds Migration instructions
axalrub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
|
||
} | ||
)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using OrchardCore.ContentFields.Settings; | ||
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() | ||
{ | ||
TableCreator(); | ||
return 1; | ||
} | ||
|
||
private void TableCreator() { | ||
_contentDefinitionManager.AlterTypeDefinition("TableCreator", type => type | ||
.DisplayedAs("TableCreator") | ||
.Stereotype("Widget") | ||
.WithPart("TableCreator", part => part | ||
.WithPosition("0") | ||
) | ||
); | ||
|
||
_contentDefinitionManager.AlterPartDefinition("TableCreator", part => part | ||
.WithField("TableData", field => field | ||
.OfType("TextField") | ||
.WithDisplayName("TableData") | ||
.WithPosition("0") | ||
.WithSettings(new TextFieldSettings | ||
{ | ||
Hint = "Enter JSON for Table Data here", | ||
Required = true, | ||
}) | ||
) | ||
.WithField("ColumnsData", field => field | ||
.OfType("TextField") | ||
.WithDisplayName("ColumnsData") | ||
.WithPosition("1") | ||
.WithSettings(new 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, | ||
}) | ||
) | ||
.WithField("AutoColumnizer", field => field | ||
.OfType("TextField") | ||
.WithDisplayName("AutoColumnizer") | ||
.WithPosition("2") | ||
.WithSettings(new 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.", | ||
}) | ||
) | ||
.WithField("PaginationSize", field => field | ||
.OfType("NumericField") | ||
.WithDisplayName("PaginationSize") | ||
.WithPosition("2") | ||
.WithSettings(new NumericFieldSettings | ||
{ | ||
Hint = "Enter the number of rows to be displayed per page. For example, entering \"5\" will display 5 rows per page.", | ||
Minimum = 1, | ||
Maximum = 100, | ||
}) | ||
) | ||
); | ||
} | ||
|
||
|
||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>(); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/Modules/StatCan.OrchardCore.Tabulator/StatCan.OrchardCore.TableCreator.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
19 changes: 19 additions & 0 deletions
19
src/Modules/StatCan.OrchardCore.Tabulator/Views/Widget-TableCreator.liquid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% 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 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" %} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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