diff --git a/.gitignore b/.gitignore index b7e2accd..d3668074 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,9 @@ static/fonts # font files originate from a node module static/fonts/* +static/assets +static/assets/* + # local log files log/* diff --git a/Pipfile b/Pipfile index 31379b86..076d21db 100644 --- a/Pipfile +++ b/Pipfile @@ -17,6 +17,7 @@ flask = "*" flask-sqlalchemy = "*" flask-assets = "*" flask-session = "*" +flask-wtf = "*" [dev-packages] bandit = "*" diff --git a/Pipfile.lock b/Pipfile.lock index ead0c686..2a25ba15 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "9f17530cb96833c424369b9cac305cb43a817cdf19605aaedeb2d98566302857" + "sha256": "0738d50fa0153e356ddd9ce23bcc781914ed0fe860044457a9db9fc0e1cff46b" }, "pipfile-spec": 6, "requires": { @@ -62,6 +62,14 @@ "index": "pypi", "version": "==2.3.2" }, + "flask-wtf": { + "hashes": [ + "sha256:5d14d55cfd35f613d99ee7cba0fc3fbbe63ba02f544d349158c14ca15561cc36", + "sha256:d9a9e366b32dcbb98ef17228e76be15702cd2600675668bca23f63a7947fd5ac" + ], + "index": "pypi", + "version": "==0.14.2" + }, "itsdangerous": { "hashes": [ "sha256:cbb3fcf8d3e33df861709ecaf89d9e6629cff0a217bc2848f1b41cd30d360519" @@ -160,6 +168,7 @@ "sha256:1d936da41ee06216d89fdc7ead1ee9a5da2811a8787515a976b646e110c3f622", "sha256:e4ef42e82b0b493c5849eed98b5ab49d6767caf982127e9a33167f1153b36cc5" ], + "markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", "version": "==2018.5" }, "redis": { @@ -393,6 +402,7 @@ "sha256:b9c40e9750f3d77e6e4d441d8b0266cf555e7cdabdcff33c4fd06366ca761ef8", "sha256:ec9ef8f4a9bc6f71eec99e1806bfa2de401650d996c59330782b89a5555c1497" ], + "markers": "python_version != '3.2.*' and python_version != '3.1.*' and python_version != '3.3.*' and python_version >= '2.7' and python_version != '3.0.*'", "version": "==4.3.4" }, "itsdangerous": { @@ -510,6 +520,7 @@ "sha256:6e3836e39f4d36ae72840833db137f7b7d35105079aee6ec4a62d9f80d594dd1", "sha256:95eb8364a4708392bae89035f45341871286a333f749c3141c20573d2b3876e1" ], + "markers": "python_version != '3.2.*' and python_version != '3.1.*' and python_version != '3.3.*' and python_version >= '2.7' and python_version != '3.0.*'", "version": "==0.7.1" }, "prompt-toolkit": { @@ -532,6 +543,7 @@ "sha256:3fd59af7435864e1a243790d322d763925431213b6b8529c6ca71081ace3bbf7", "sha256:e31fb2767eb657cbde86c454f02e99cb846d3cd9d61b318525140214fdc0e98e" ], + "markers": "python_version != '3.2.*' and python_version != '3.1.*' and python_version != '3.3.*' and python_version >= '2.7' and python_version != '3.0.*'", "version": "==1.5.4" }, "pygments": { @@ -551,11 +563,11 @@ }, "pytest": { "hashes": [ - "sha256:8214ab8446104a1d0c17fbd218ec6aac743236c6ffbe23abc038e40213c60b88", - "sha256:e2b2c6e1560b8f9dc8dd600b0923183fbd68ba3d9bdecde04467be6dd296a384" + "sha256:86a8dbf407e437351cef4dba46736e9c5a6e3c3ac71b2e942209748e76ff2086", + "sha256:e74466e97ac14582a8188ff4c53e6cc3810315f342f6096899332ae864c1d432" ], "index": "pypi", - "version": "==3.7.0" + "version": "==3.7.1" }, "pytest-flask": { "hashes": [ @@ -581,15 +593,11 @@ }, "pyyaml": { "hashes": [ - "sha256:1cbc199009e78f92d9edf554be4fe40fb7b0bef71ba688602a00e97a51909110", "sha256:254bf6fda2b7c651837acb2c718e213df29d531eebf00edb54743d10bcb694eb", "sha256:3108529b78577327d15eec243f0ff348a0640b0c3478d67ad7f5648f93bac3e2", "sha256:3c17fb92c8ba2f525e4b5f7941d850e7a48c3a59b32d331e2502a3cdc6648e76", - "sha256:6f89b5c95e93945b597776163403d47af72d243f366bf4622ff08bdfd1c950b7", "sha256:8d6d96001aa7f0a6a4a95e8143225b5d06e41b1131044913fecb8f85a125714b", - "sha256:be622cc81696e24d0836ba71f6272a2b5767669b0d79fdcf0295d51ac2e156c8", - "sha256:c8a88edd93ee29ede719080b2be6cb2333dfee1dccba213b422a9c8e97f2967b", - "sha256:f39411e380e2182ad33be039e8ee5770a5d9efe01a2bfb7ae58d9ba31c4a2a9d" + "sha256:c8a88edd93ee29ede719080b2be6cb2333dfee1dccba213b422a9c8e97f2967b" ], "version": "==4.2b4" }, diff --git a/README.md b/README.md index 5bfee424..ccb33c69 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,10 @@ To start the app locally in the foreground and watch for changes: script/dev_server +To watch for changes to any js/css assets: + + yarn watch + ### Users There are currently six mock users for development: diff --git a/atst/app.py b/atst/app.py index e08f364b..a9e95c32 100644 --- a/atst/app.py +++ b/atst/app.py @@ -63,6 +63,11 @@ def make_flask_callbacks(app): "atat_permissions": [], } + @app.template_filter('iconSvg') + def _iconSvg(name): + with open('static/icons/'+name+'.svg') as contents: + return contents.read() + def map_config(config): return { diff --git a/atst/assets.py b/atst/assets.py index 72ad5d5e..aaf1f82e 100644 --- a/atst/assets.py +++ b/atst/assets.py @@ -3,10 +3,14 @@ from flask_assets import Environment, Bundle environment = Environment() css = Bundle( - "../scss/atat.scss", - filters="scss", - output="../static/assets/out.%(version)s.css", - depends=("**/*.scss"), + "../static/assets/index.css", + output="../static/assets/index.%(version)s.css", ) environment.register("css", css) + +js = Bundle( + '../static/assets/index.js', + output='../static/assets/index.%(version)s.js' +) +environment.register('js_all', js) diff --git a/js/example.js b/js/example.js new file mode 100644 index 00000000..7cb5b7d1 --- /dev/null +++ b/js/example.js @@ -0,0 +1,4 @@ +window.onload = function() { + console.log('hello from example') +} + diff --git a/js/index.js b/js/index.js new file mode 100644 index 00000000..4f8a3ad3 --- /dev/null +++ b/js/index.js @@ -0,0 +1,5 @@ +import classes from '../styles/atat.scss' + +import './example' + +console.log('hello from index') diff --git a/package.json b/package.json index 5e9a5920..61eddafa 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,19 @@ "description": "ATST Stateless Services", "main": "index.js", "scripts": { + "watch": "parcel watch js/index.js -d static/assets --public-url /static/assets -o index.js --no-autoinstall", + "build": "parcel build js/index.js -d static/assets --public-url /static/assets -o index.js", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "MIT", "dependencies": { "npm": "^6.0.1", - "uswds": "^1.6.3" + "parcel": "^1.9.7", + "uswds": "^1.6.3", + "vue": "^2.5.17" + }, + "devDependencies": { + "node-sass": "^4.9.2" } } diff --git a/script/bootstrap b/script/bootstrap index 2512dde7..e72c4983 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -5,9 +5,6 @@ source "$(dirname "${0}")"/../script/include/global_header.inc.sh -# Set sass compiling command for this app -COMPILE_SASS_CMD="webassets -m atst.assets build" - # Enable python and node package installation INSTALL_PYTHON_PACKAGES="true" INSTALL_NODE_PACKAGES="true" diff --git a/script/cibuild b/script/cibuild index e9d01564..7af22fea 100755 --- a/script/cibuild +++ b/script/cibuild @@ -5,4 +5,19 @@ source "$(dirname "${0}")"/../script/include/global_header.inc.sh # Run lint/style checks and unit tests -source ./script/test +export FLASK_ENV=ci + +# Enable database resetting +RESET_DB="true" + +# Define all relevant python files and directories for this app +PYTHON_FILES="./app.py ./atst ./config" + +# Enable Python testing +RUN_PYTHON_TESTS="true" + +# Compile assets +yarn build + +# Run the shared test script +source ./script/include/run_test diff --git a/script/include b/script/include index 05492977..8cf96c97 160000 --- a/script/include +++ b/script/include @@ -1 +1 @@ -Subproject commit 05492977844309215c122e925159f9f8c62014e3 +Subproject commit 8cf96c9776e7fd73c11d57160d26fc1715bf00da diff --git a/script/ingest_pe_numbers.py b/script/ingest_pe_numbers.py index e3bbecb0..d8b22059 100644 --- a/script/ingest_pe_numbers.py +++ b/script/ingest_pe_numbers.py @@ -7,7 +7,7 @@ import sys parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) sys.path.append(parent_dir) -from atst.app import make_deps, make_config +from atst.app import make_app, make_config from atst.domain.pe_numbers import PENumbers @@ -23,9 +23,11 @@ def make_pe_number_repo(config): if __name__ == "__main__": config = make_config() - url = config["default"]['PE_NUMBER_CSV_URL'] + url = config['PE_NUMBER_CSV_URL'] print("Fetching PE numbers from {}".format(url)) pe_numbers = get_pe_numbers(url) - print("Inserting {} PE numbers".format(len(pe_numbers))) - pe_numbers_repo = make_pe_number_repo(config) - pe_numbers_repo.create_many(pe_numbers) + + app = make_app(config) + with app.app_context(): + print("Inserting {} PE numbers".format(len(pe_numbers))) + PENumbers.create_many(pe_numbers) diff --git a/script/setup b/script/setup index bf83b19a..23a2fce3 100755 --- a/script/setup +++ b/script/setup @@ -8,9 +8,6 @@ source "$(dirname "${0}")"/../script/include/global_header.inc.sh # Turn on sass compiler installation INSTALL_SASS="true" -# Set database name -DATABASE_NAME="atat" - # Enable database resetting RESET_DB="true" diff --git a/script/test b/script/test index 8759a347..bd231db8 100755 --- a/script/test +++ b/script/test @@ -6,9 +6,6 @@ source "$(dirname "${0}")"/../script/include/global_header.inc.sh export FLASK_ENV=test -# Set database name -DATABASE_NAME="atat_test" - # Enable database resetting RESET_DB="true" diff --git a/scss/README.md b/styles/README.md similarity index 100% rename from scss/README.md rename to styles/README.md diff --git a/scss/atat.scss b/styles/atat.scss similarity index 94% rename from scss/atat.scss rename to styles/atat.scss index b4ae7797..ad650bbd 100644 --- a/scss/atat.scss +++ b/styles/atat.scss @@ -1,5 +1,5 @@ @import 'core/variables'; -@import '../node_modules/uswds/src/stylesheets/uswds'; +@import 'node_modules/uswds/src/stylesheets/uswds'; @import 'core/grid'; @import 'core/util'; diff --git a/scss/components/_alerts.scss b/styles/components/_alerts.scss similarity index 100% rename from scss/components/_alerts.scss rename to styles/components/_alerts.scss diff --git a/scss/components/_empty_state.scss b/styles/components/_empty_state.scss similarity index 100% rename from scss/components/_empty_state.scss rename to styles/components/_empty_state.scss diff --git a/scss/components/_footer.scss b/styles/components/_footer.scss similarity index 100% rename from scss/components/_footer.scss rename to styles/components/_footer.scss diff --git a/scss/components/_global_layout.scss b/styles/components/_global_layout.scss similarity index 100% rename from scss/components/_global_layout.scss rename to styles/components/_global_layout.scss diff --git a/scss/components/_global_navigation.scss b/styles/components/_global_navigation.scss similarity index 100% rename from scss/components/_global_navigation.scss rename to styles/components/_global_navigation.scss diff --git a/scss/components/_modal.scss b/styles/components/_modal.scss similarity index 100% rename from scss/components/_modal.scss rename to styles/components/_modal.scss diff --git a/scss/components/_progress_menu.scss b/styles/components/_progress_menu.scss similarity index 96% rename from scss/components/_progress_menu.scss rename to styles/components/_progress_menu.scss index 3ca7bb72..a675dfb7 100644 --- a/scss/components/_progress_menu.scss +++ b/styles/components/_progress_menu.scss @@ -88,7 +88,7 @@ } &--complete:before { - content: url('/static/icons/checkmark.svg'); + content: url('#{$asset-path}/icons/checkmark.svg'); background-color: $color-blue; border: 2px solid $color-blue; font-size: $h6-font-size; @@ -100,4 +100,4 @@ } } -} \ No newline at end of file +} diff --git a/scss/components/_search_bar.scss b/styles/components/_search_bar.scss similarity index 95% rename from scss/components/_search_bar.scss rename to styles/components/_search_bar.scss index f5c031f8..dbc795d2 100644 --- a/scss/components/_search_bar.scss +++ b/styles/components/_search_bar.scss @@ -62,7 +62,7 @@ text-align: center; &:after { - content: url('/static/icons/search.svg'); + content: url('#{$asset-path}/icons/search.svg'); display: inline-block; width: 1.6rem; height: 1.6rem; diff --git a/scss/components/_site_action.scss b/styles/components/_site_action.scss similarity index 100% rename from scss/components/_site_action.scss rename to styles/components/_site_action.scss diff --git a/scss/components/_topbar.scss b/styles/components/_topbar.scss similarity index 100% rename from scss/components/_topbar.scss rename to styles/components/_topbar.scss diff --git a/scss/components/_workspace_layout.scss b/styles/components/_workspace_layout.scss similarity index 100% rename from scss/components/_workspace_layout.scss rename to styles/components/_workspace_layout.scss diff --git a/scss/core/_grid.scss b/styles/core/_grid.scss similarity index 100% rename from scss/core/_grid.scss rename to styles/core/_grid.scss diff --git a/scss/core/_util.scss b/styles/core/_util.scss similarity index 100% rename from scss/core/_util.scss rename to styles/core/_util.scss diff --git a/scss/core/_variables.scss b/styles/core/_variables.scss similarity index 99% rename from scss/core/_variables.scss rename to styles/core/_variables.scss index 79c0e759..19945881 100644 --- a/scss/core/_variables.scss +++ b/styles/core/_variables.scss @@ -129,7 +129,7 @@ $grid-columns-large: 12; // $large: new-breakpoint(min-width $large-screen $grid-columns-large); // Set the base path for assets (used for font and image paths below) -$asset-path: '../'; +$asset-path: '../static/'; // Relative font and image file paths $font-path: '#{$asset-path}fonts'; diff --git a/scss/elements/_action_group.scss b/styles/elements/_action_group.scss similarity index 100% rename from scss/elements/_action_group.scss rename to styles/elements/_action_group.scss diff --git a/scss/elements/_block_lists.scss b/styles/elements/_block_lists.scss similarity index 100% rename from scss/elements/_block_lists.scss rename to styles/elements/_block_lists.scss diff --git a/scss/elements/_buttons.scss b/styles/elements/_buttons.scss similarity index 100% rename from scss/elements/_buttons.scss rename to styles/elements/_buttons.scss diff --git a/scss/elements/_diff.scss b/styles/elements/_diff.scss similarity index 100% rename from scss/elements/_diff.scss rename to styles/elements/_diff.scss diff --git a/scss/elements/_icon_link.scss b/styles/elements/_icon_link.scss similarity index 100% rename from scss/elements/_icon_link.scss rename to styles/elements/_icon_link.scss diff --git a/scss/elements/_icons.scss b/styles/elements/_icons.scss similarity index 100% rename from scss/elements/_icons.scss rename to styles/elements/_icons.scss diff --git a/scss/elements/_inputs.scss b/styles/elements/_inputs.scss similarity index 100% rename from scss/elements/_inputs.scss rename to styles/elements/_inputs.scss diff --git a/scss/elements/_labels.scss b/styles/elements/_labels.scss similarity index 100% rename from scss/elements/_labels.scss rename to styles/elements/_labels.scss diff --git a/scss/elements/_panels.scss b/styles/elements/_panels.scss similarity index 100% rename from scss/elements/_panels.scss rename to styles/elements/_panels.scss diff --git a/scss/elements/_sidenav.scss b/styles/elements/_sidenav.scss similarity index 100% rename from scss/elements/_sidenav.scss rename to styles/elements/_sidenav.scss diff --git a/scss/elements/_tables.scss b/styles/elements/_tables.scss similarity index 100% rename from scss/elements/_tables.scss rename to styles/elements/_tables.scss diff --git a/scss/elements/_typography.scss b/styles/elements/_typography.scss similarity index 100% rename from scss/elements/_typography.scss rename to styles/elements/_typography.scss diff --git a/scss/sections/_login.scss b/styles/sections/_login.scss similarity index 100% rename from scss/sections/_login.scss rename to styles/sections/_login.scss diff --git a/scss/sections/_member_edit.scss b/styles/sections/_member_edit.scss similarity index 100% rename from scss/sections/_member_edit.scss rename to styles/sections/_member_edit.scss diff --git a/scss/sections/_project_edit.scss b/styles/sections/_project_edit.scss similarity index 100% rename from scss/sections/_project_edit.scss rename to styles/sections/_project_edit.scss diff --git a/scss/sections/_projects_list.scss b/styles/sections/_projects_list.scss similarity index 100% rename from scss/sections/_projects_list.scss rename to styles/sections/_projects_list.scss diff --git a/scss/sections/_request_approval.scss b/styles/sections/_request_approval.scss similarity index 100% rename from scss/sections/_request_approval.scss rename to styles/sections/_request_approval.scss diff --git a/templates/base.html b/templates/base.html index 2414f6f1..93dbe8e7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -34,5 +34,8 @@ {% include 'footer.html' %} {% block modal %}{% endblock %} + {% assets "js_all" %} + + {% endassets %} diff --git a/templates/components.html b/templates/components.html deleted file mode 100644 index ea214631..00000000 --- a/templates/components.html +++ /dev/null @@ -1,145 +0,0 @@ -{% macro Icon(name, classes="") -%} - {% autoescape false %} - - {% endautoescape %} -{%- endmacro %} - -{% macro SidenavItem(label, href, active=False, icon=None, subnav=None) -%} -
  • - - {% if icon %} - {{ Icon(icon, classes="sidenav__link-icon") }} - {% endif %} - - {{label}} - - - {% if subnav and active %} - - {% endif %} -
  • -{%- endmacro %} - -{% macro Modal() -%} - -{%- endmacro %} - -{% macro EmptyState(message, actionLabel, actionHref, icon=None) -%} -
    -

    {{ message }}

    - - {% if icon %} - {{ Icon(icon) }} - {% endif %} - - {{ actionLabel }} -
    -{%- endmacro %} - -{% macro Alert(title, message=None, actions=None, level='info') -%} -{% set role = 'alertdialog' if actions else 'alert' %} -{% set levels = { - 'warning': { - 'icon': 'alert', - 'tone': 'assertive' - }, - 'error': { - 'icon': 'alert', - 'tone': 'assertive' - }, - 'info': { - 'icon': 'info', - 'tone': 'polite' - }, - 'success': { - 'icon': 'ok', - 'tone': 'polite' - } -} %} - -
    - {{ Icon(levels.get(level).get('icon'), classes='alert__icon icon--large') }} - -
    -

    {{title}}

    - - {% if message %} -
    {{ message | safe }}
    - {% endif %} - - {% if actions %} -
    {{ actions | safe }}
    - {% endif %} -
    -
    -{%- endmacro %} - -{% macro TextInput(field, placeholder='') -%} -
    - - - {{ field(placeholder=placeholder) | safe }} - - {% if field.errors %} - {% for error in field.errors %} - {{ error }} - {% endfor %} - {% endif %} -
    -{%- endmacro %} - -{% macro OptionsInput(field, inline=False) -%} -
    - -
    - - {{ field.label }} - - {% if field.description %} - {{ field.description | safe }} - {% endif %} - - {% if field.errors %} - {{ Icon('alert') }} - {% endif %} - - - {{ field() }} - - {% if field.errors %} - {% for error in field.errors %} - {{ error }} - {% endfor %} - {% endif %} - -
    -
    - -{%- endmacro %} diff --git a/templates/components/alert.html b/templates/components/alert.html new file mode 100644 index 00000000..d3385d1d --- /dev/null +++ b/templates/components/alert.html @@ -0,0 +1,39 @@ +{% from "components/icon.html" import Icon %} + +{% macro Alert(title, message=None, actions=None, level='info') -%} + {% set role = 'alertdialog' if actions else 'alert' %} + {% set levels = { + 'warning': { + 'icon': 'alert', + 'tone': 'assertive' + }, + 'error': { + 'icon': 'alert', + 'tone': 'assertive' + }, + 'info': { + 'icon': 'info', + 'tone': 'polite' + }, + 'success': { + 'icon': 'ok', + 'tone': 'polite' + } + } %} + +
    + {{ Icon(levels.get(level).get('icon'), classes='alert__icon icon--large') }} + +
    +

    {{title}}

    + + {% if message %} +
    {{ message | safe }}
    + {% endif %} + + {% if actions %} +
    {{ actions | safe }}
    + {% endif %} +
    +
    +{%- endmacro %} diff --git a/templates/components/alert.html.to b/templates/components/alert.html.to deleted file mode 100644 index 05cac613..00000000 --- a/templates/components/alert.html.to +++ /dev/null @@ -1,35 +0,0 @@ -{% set role = 'alertdialog' if actions else 'alert' %} -{% set levels = { - 'warning': { - 'icon': 'alert', - 'tone': 'assertive' - }, - 'error': { - 'icon': 'alert', - 'tone': 'assertive' - }, - 'info': { - 'icon': 'info', - 'tone': 'polite' - }, - 'success': { - 'icon': 'ok', - 'tone': 'polite' - } -} %} - -
    - {% module Icon(levels.get(level).get('icon'), classes='alert__icon icon--large') %} - -
    -

    {{title}}

    - - {% if message %} -
    {% raw message %}
    - {% end %} - - {% if actions %} -
    {% raw actions %}
    - {% end %} -
    -
    diff --git a/templates/components/empty_state.html b/templates/components/empty_state.html new file mode 100644 index 00000000..7dc6f119 --- /dev/null +++ b/templates/components/empty_state.html @@ -0,0 +1,13 @@ +{% from "components/icon.html" import Icon %} + +{% macro EmptyState(message, actionLabel, actionHref, icon=None) -%} +
    +

    {{ message }}

    + + {% if icon %} + {{ Icon(icon) }} + {% endif %} + + {{ actionLabel }} +
    +{%- endmacro %} diff --git a/templates/components/empty_state.html.to b/templates/components/empty_state.html.to deleted file mode 100644 index 30246ddb..00000000 --- a/templates/components/empty_state.html.to +++ /dev/null @@ -1,9 +0,0 @@ -
    -

    {{ message }}

    - - {% if icon %} - {% module Icon(icon) %} - {% end %} - - {{ actionLabel }} -
    diff --git a/templates/components/icon.html b/templates/components/icon.html new file mode 100644 index 00000000..42139e57 --- /dev/null +++ b/templates/components/icon.html @@ -0,0 +1,6 @@ +{% macro Icon(name, classes="") -%} + {% autoescape false %} + + {% endautoescape %} +{%- endmacro %} + diff --git a/templates/components/icon.html.to b/templates/components/icon.html.to deleted file mode 100644 index 99e74b40..00000000 --- a/templates/components/icon.html.to +++ /dev/null @@ -1,2 +0,0 @@ -{% autoescape None %} - diff --git a/templates/components/modal.html b/templates/components/modal.html new file mode 100644 index 00000000..8e483de4 --- /dev/null +++ b/templates/components/modal.html @@ -0,0 +1,9 @@ +{% macro Modal() -%} + +{%- endmacro %} diff --git a/templates/components/modal.html.to b/templates/components/modal.html.to deleted file mode 100644 index 4330adbd..00000000 --- a/templates/components/modal.html.to +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/templates/components/options_input.html b/templates/components/options_input.html new file mode 100644 index 00000000..ff0d8814 --- /dev/null +++ b/templates/components/options_input.html @@ -0,0 +1,29 @@ +{% from "components/icon.html" import Icon %} + +{% macro OptionsInput(field, inline=False) -%} +
    + +
    + + {{ field.label }} + + {% if field.description %} + {{ field.description | safe }} + {% endif %} + + {% if field.errors %} + {{ Icon('alert') }} + {% endif %} + + + {{ field() }} + + {% if field.errors %} + {% for error in field.errors %} + {{ error }} + {% endfor %} + {% endif %} + +
    +
    +{%- endmacro %} diff --git a/templates/components/options_input.html.to b/templates/components/options_input.html.to deleted file mode 100644 index 8a15e041..00000000 --- a/templates/components/options_input.html.to +++ /dev/null @@ -1,25 +0,0 @@ -
    - -
    - - {{ label }} - - {% if description %} - {% raw description %} - {% end %} - - {% if errors %} - {% module Icon('alert') %} - {% end %} - - - {% raw field() %} - - {% if errors %} - {% for error in errors %} - {{ error }} - {% end %} - {% end %} - -
    -
    diff --git a/templates/components/sidenav_item.html b/templates/components/sidenav_item.html new file mode 100644 index 00000000..64f5b765 --- /dev/null +++ b/templates/components/sidenav_item.html @@ -0,0 +1,28 @@ +{% from "components/icon.html" import Icon %} + +{% macro SidenavItem(label, href, active=False, icon=None, subnav=None) -%} +
  • + + {% if icon %} + {{ Icon(icon, classes="sidenav__link-icon") }} + {% endif %} + + {{label}} + + + {% if subnav and active %} + + {% endif %} +
  • +{%- endmacro %} diff --git a/templates/components/text_input.html b/templates/components/text_input.html new file mode 100644 index 00000000..0f50ca89 --- /dev/null +++ b/templates/components/text_input.html @@ -0,0 +1,23 @@ +{% macro TextInput(field, placeholder='') -%} +
    + + + {{ field(placeholder=placeholder) | safe }} + + {% if field.errors %} + {% for error in field.errors %} + {{ error }} + {% endfor %} + {% endif %} +
    +{%- endmacro %} diff --git a/templates/components/text_input.html.to b/templates/components/text_input.html.to deleted file mode 100644 index 2a800abc..00000000 --- a/templates/components/text_input.html.to +++ /dev/null @@ -1,21 +0,0 @@ -
    - - - {% raw field(placeholder=placeholder) %} - - {% if errors %} - {% for error in errors %} - {{ error }} - {% end %} - {% end %} -
    diff --git a/templates/home.html b/templates/home.html index 0df70037..056d62b8 100644 --- a/templates/home.html +++ b/templates/home.html @@ -5,6 +5,7 @@

    Home

    +
    diff --git a/templates/member_edit.html.to b/templates/member_edit.html.to index d454152c..fbe92f35 100644 --- a/templates/member_edit.html.to +++ b/templates/member_edit.html.to @@ -1,5 +1,7 @@ {% extends "base_workspace.html.to" %} +{% from "components/alert.html" import Alert %} + {% block template_vars %} {% set is_new_member = False %} {% set member_name = "Danny Knight" %} @@ -10,11 +12,12 @@ {% block workspace_content %} -{% module Alert( +{{ Alert( "UI Mock", message="

    Please note, this screen is a non-functional UI mockup.

    ", level="info" - ) %} + ) +}}
    diff --git a/templates/navigation/_sidenav_item.html.to b/templates/navigation/_sidenav_item.html.to deleted file mode 100644 index 888245bc..00000000 --- a/templates/navigation/_sidenav_item.html.to +++ /dev/null @@ -1,24 +0,0 @@ -
  • - - {% if icon %} - {% module Icon(icon, classes="sidenav__link-icon") %} - {% end %} - - {{label}} - - - {% if subnav and active %} - - {% end %} -
  • diff --git a/templates/navigation/global_navigation.html b/templates/navigation/global_navigation.html index 594bf574..79728185 100644 --- a/templates/navigation/global_navigation.html +++ b/templates/navigation/global_navigation.html @@ -1,4 +1,5 @@ -{% from "components.html" import SidenavItem %} +{% from "components/sidenav_item.html" import SidenavItem %} +