-
Notifications
You must be signed in to change notification settings - Fork 0
User defined tables #345
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
Merged
Merged
User defined tables #345
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e4858de
merge changes from OwainJones-patch-1 into new branch recreated from …
OwainJones a70251f
Delete table_selector.njk
OwainJones 9191d37
Updates for tables attempting to pass multiple urls to route to
OwainJones ec2177b
Minor updates
OwainJones 9aea24a
Edits to ensure that header identification in tables is working corre…
OwainJones 3270499
Added a get and set table function, updated index.js, and various oth…
OwainJones c0ebbe6
Added some tweaks to review page to accomodate tables,
OwainJones 3cff231
Tidied up code removing several console.debug lines that were used fo…
OwainJones b25aa9f
Some updates to how we handle table header and use it in the final ma…
OwainJones f58711b
Quick comit to ensure any minor local changes are accounted for
OwainJones e80d66a
Merge branch 'main' into user-defined-tables
OwainJones 97d0558
Changes to fix table preview for no table and to fix merge issues
OwainJones fd61d8e
Merge branch 'user-defined-tables' of https://github.com/register-dyn…
OwainJones 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
Binary file not shown.
This file contains hidden or 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,9 @@ | ||
| Table,Sheet,Name,Range ,Columns | ||
| table1,Standard,Soldier,A1:I21,Level; Vitality; Attack; Defence; Fortitude; Reflex; Will; Feats granted; Feat | ||
| table2,Standard,Scout,A23:I43,Level; Vitality; Attack; Defence; Fortitude; Reflex; Will; Feats granted; Feat | ||
| table3,Standard,Scoundrel,A45:I65,Level; Vitality; Attack; Defence; Fortitude; Reflex; Will; Feats granted; Feat | ||
| table4,Jedi,Guardian,A1:K21,Level; Vitality; Force Points; Attack; Defence; Fortitude; Reflex; Will; Feats granted; Feat; Force Powers | ||
| table5,Jedi ,Sentinel,A23:K23,Level; Vitality; Force Points; Attack; Defence; Fortitude; Reflex; Will; Feats granted; Feat; Force Powers | ||
| table6,Jedi ,Consular,A45:K65,Level; Vitality; Force Points; Attack; Defence; Fortitude; Reflex; Will; Feats granted; Feat; Force Powers | ||
| ,,,, | ||
| There is also a third sheet called 'No tables' with no tables in it just a block of data,,,, |
Binary file not shown.
This file contains hidden or 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 hidden or 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 hidden or 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,83 @@ | ||
|
|
||
| {# | ||
| importerTableSelector generates a radio button list which allows the | ||
| user to choose which table is to be used (if any). | ||
|
|
||
| The list of table names is retrieved from the current spreadsheet | ||
| being uploaded. | ||
|
|
||
| It accepts a data object which is taken from the prototype kit's | ||
| session data which is made available on every page, and contains the | ||
| data submitted from forms to the backend, and also the current | ||
| data import session. | ||
|
|
||
| legend is the text that should be used for the legend part of the | ||
| radio buttons, if none is supplied, then a legend is not added. | ||
| #} | ||
| {% from "importer/macros/table_view.njk" import tableView %} | ||
|
|
||
| {% macro importerTableSelector(data, legend) %} | ||
| {% set selectedTable = data['importer.session'].table %} | ||
| {% set tables = importTablePreview(data) %} | ||
| {% set tableRowIndex = tables.length + 2 %} | ||
| {% set error = importerError(data) %} | ||
|
|
||
| <div class="govuk-form {% if error %}govuk-form-group--error{% endif %}"> | ||
| <div class="govuk-form-group "> | ||
| {% if legend %} | ||
| <legend class="govuk-fieldset__legend govuk-fieldset__legend--l"> | ||
| <h1 class="govuk-fieldset__heading"> | ||
| {{ legend }} | ||
| </h1> | ||
| </legend> | ||
| {% endif %} | ||
|
|
||
| {% if error %} | ||
| <p id="upload-error" class="govuk-error-message"> | ||
| <span class="govuk-visually-hidden">Error:</span> {{ error.text }} | ||
| </p> | ||
| {% endif %} | ||
|
|
||
| <div class="govuk-radios rd-sheet-preview" data-module="govuk-radios"> | ||
| {% for table in tables %} | ||
| <div class="govuk-radios__item"> | ||
| <input class="govuk-radios__input" id="{{table.name}}" name="table" type="radio" value="{{table.name}}" {% if selectedTable==table.name %}checked="checked"{% endif %} data-preview-index="{{loop.index0}}"> | ||
| <label class="govuk-label govuk-radios__label" for="{{table.name}}"> | ||
| {{table.name}} | ||
| </label> | ||
| </div> <!-- .govuk-radios__item --> | ||
| {% endfor %} | ||
| <div class="govuk-radios__divider">or</div> | ||
| <div class="govuk-radios__item"> | ||
| <input class="govuk-radios__input" id="no_table" name="table" type="radio" value="no_table" data-preview-index=-1> | ||
| <label class="govuk-label govuk-radios__label" for="no_table"> | ||
| I don't want to use a predefined table | ||
| </label> | ||
| </div> <!-- .govuk-radios__item --> | ||
| </div> | ||
|
|
||
| <div class="rd-sheet-selector-previews"> | ||
| {% for table in tables %} | ||
| <div class="hidden"> | ||
| {% if table.data.rows == null %} | ||
| <div class="govuk-body"> | ||
| Table '{{ table.name }}' is empty | ||
| </div> | ||
| {% else %} | ||
| {% set caption = importerGetTableCaption(data, "First", 10, sheet.name, table.name) %} | ||
| {{ tableView({ | ||
| caption: caption, | ||
| showHeaders: true, | ||
| headers: table.data.headers, | ||
| showRowNumbers: false, | ||
| rows: table.data.rows, | ||
| moreRowsCount: 0 | ||
| } )}} | ||
|
|
||
|
|
||
| {% endif %} | ||
| </div> | ||
| {% endfor %} | ||
| </div> | ||
| </div> | ||
| {% endmacro %} | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
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.
I'd pop a comment here saying why it's +2 specifically