Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ntarocco committed May 14, 2020
1 parent 7ce93c0 commit b9ef2c3
Show file tree
Hide file tree
Showing 17 changed files with 142 additions and 88 deletions.
2 changes: 1 addition & 1 deletion {{cookiecutter.project_shortname}}/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name = "pypi"
[packages]
Babel = ">=2.4.0"
Flask-BabelEx = ">=0.9.3"
invenio = { version = ">=3.2.0,<3.3.0", extras = ["base", "auth", "metadata", "files", "{{ cookiecutter.database }}", "elasticsearch{{ cookiecutter.elasticsearch }}" ]}
invenio = { version = ">=3.4.0,<3.5.0", extras = ["base", "auth", "metadata", "files", "{{ cookiecutter.database }}", "elasticsearch{{ cookiecutter.elasticsearch }}" ]}
lxml = ">=3.5.0,<4.2.6"
marshmallow = ">=3.0.0,<4.0.0"
uwsgi = ">=2.0"
Expand Down
17 changes: 10 additions & 7 deletions {{cookiecutter.project_shortname}}/scripts/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ set -e

{% raw %}
script_path=$(dirname "$0")
pipfile_lock_path="$script_path/../Pipfile.lock"
# pipfile_lock_path="$script_path/../Pipfile.lock"

if [ ! -f $pipfile_lock_path ]; then
echo "'Pipfile.lock' not found. Generating via 'pipenv lock --dev'..."
pipenv lock --dev
fi
# if [ ! -f $pipfile_lock_path ]; then
# echo "'Pipfile.lock' not found. Generating via 'pipenv lock --dev'..."
# pipenv lock --dev
# fi

# # Installs all packages specified in Pipfile.lock
# pipenv sync --dev

pipenv run pip install -e git+https://github.com/ntarocco/invenio.git@v34#egg=invenio["base","auth","metadata","files","postgresql","elasticsearch7"]

# Installs all packages specified in Pipfile.lock
pipenv sync --dev
# Install application code and entrypoints from 'setup.py'
pipenv run pip install -e $script_path/..
# Build assets
Expand Down
1 change: 1 addition & 0 deletions {{cookiecutter.project_shortname}}/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
],
'invenio_assets.webpack': [
'{{ cookiecutter.package_name }}_theme = {{ cookiecutter.package_name }}.theme.webpack:theme',
'{{ cookiecutter.package_name }}_search_app = {{ cookiecutter.package_name }}.records.webpack:search_app',
],
'invenio_config.module': [
'{{ cookiecutter.package_name }} = {{ cookiecutter.package_name }}.config',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def _(x):

# Theme configuration
# ===================
#: Site name
#: The Invenio theme.
APP_THEME = ['semantic-ui']
#: Site name.
THEME_SITENAME = _('{{cookiecutter.project_name}}')
#: Use default frontpage.
THEME_FRONTPAGE = True
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{% include 'misc/header.js' %}
{% raw %}
import React from "react";
import { overrideStore } from "react-overridable";
import { Card, Item, List } from "semantic-ui-react";

const {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}ResultsListItem = ({ result, index }) => {
const contributors = result.metadata.contributors || [];
return (
<Item key={index} href={`/records/{{ result.id }}`}>
<Item.Content>
<Item.Header>{result.metadata.title}</Item.Header>
<Item.Description>
{contributors && (
<List horizontal relaxed>
{contributors.map((contributor) => (
<List.Item>{contributor.name}</List.Item>
))}
</List>
)}
</Item.Description>
</Item.Content>
</Item>
);
};

overrideStore.add("ResultsList.item", {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}ResultsListItem);

const {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}ResultsGridItem = ({ result, index }) => {
const contributors = result.metadata.contributors || [];
return (
<Card fluid key={index} href={`/records/{{ result.id }}`}>
<Card.Content>
<Card.Header>{result.metadata.title}</Card.Header>
<Card.Description>
{contributors && (
<List horizontal relaxed>
{contributors.map((contributor) => (
<List.Item>{contributor.name}</List.Item>
))}
</List>
)}
</Card.Description>
</Card.Content>
</Card>
);
};

overrideStore.add("ResultsGrid.item", {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}ResultsGridItem);
{% endraw %}
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def _(x):
)
"""Records UI for {{cookiecutter.project_shortname}}."""

SEARCH_UI_JSTEMPLATE_RESULTS = 'templates/records/results.html'
"""Result list template."""
SEARCH_UI_SEARCH_TEMPLATE = '{{cookiecutter.package_name}}/records/search.html'

PIDSTORE_RECID_FIELD = '{{ cookiecutter.datamodel_pid_name }}'

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% include 'misc/header.tpl' -%}{% raw %}
{%- extends config.RECORDS_UI_BASE_TEMPLATE %}
{%- include 'misc/header.tpl' -%}
{%- raw -%}
{% extends config.RECORDS_UI_BASE_TEMPLATE %}

{% from 'invenio_previewer/macros.html' import file_list, preview_file %}
{% from 'semantic-ui/invenio_previewer/macros.html' import file_list, preview_file %}

{%- macro record_content(data) %}
{% set ignore_list = ['_bucket', '$schema'] %}
Expand Down Expand Up @@ -64,6 +65,6 @@ <h2>{{record.title}}</h2>
{{ file_list(files, pid) }}
{%- endif %}
</div>
{{ webpack['{%- endraw %}{{cookiecutter.project_shortname}}{%- raw %}-preview.js'] }}
{{ webpack['{%- endraw -%}{{cookiecutter.project_shortname}}{%- raw -%}-preview.js'] }}
{%- endblock %}
{% endraw %}
{%- endraw -%}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{%- include 'misc/header.tpl' -%}
{%- raw -%}
{%- extends "semantic-ui/invenio_search_ui/search.html" %}

{% block javascript_override_searchapp %}
{{ webpack['{%- endraw -%}{{cookiecutter.project_shortname}}{%- raw -%}-search-app.js'] }}
{% endblock javascript_override_searchapp %}
{%- endraw -%}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% include 'misc/header.py' %}
"""JS/CSS Webpack bundle to override search results template."""

from invenio_assets.webpack import WebpackThemeBundle

search_app = WebpackThemeBundle(
__name__,
'assets',
default='semantic-ui',
themes={
'semantic-ui': dict(
entry={
'{{ cookiecutter.project_shortname }}-search-app': './js/{{ cookiecutter.package_name }}/search_app_customizations.js',
},
dependencies={
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-overridable": "^0.0.2",
"semantic-ui-react": "^0.88.0"
}
)
}
)

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% include 'misc/header.js' -%}
{%- raw %}
import $ from "jquery";

$("#files")
Expand All @@ -6,3 +8,4 @@ $("#files")
$("#preview").show();
$("#preview-iframe").attr("src", $(event.target).data("url"));
});
{%- endraw %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{%- include 'misc/header.tpl' -%}
{%- raw -%}
{%- extends "semantic-ui/invenio_theme/frontpage.html" %}

{% block page_body %}
<div class="container marketing">
<div class="row">
<div class="col-lg-12">
{%- endraw -%}
<h1 class="text-center">Welcome to {{cookiecutter.project_name}}.</h1>
{%- raw -%}
</div>
</div>
{% endblock %}
{%- endraw -%}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{% include 'misc/header.jinja2' %}
{%- raw %}
{%- extends "invenio_theme/page.html" %}
{%- include 'misc/header.tpl' -%}
{%- raw -%}
{%- extends "semantic-ui/invenio_theme/page.html" %}

{%- block css %}
{{ webpack['{%- endraw %}{{cookiecutter.project_shortname}}{%- raw %}-theme.css'] }}
{% block css %}
{{ super() }}
{{ webpack['{%- endraw -%}{{cookiecutter.project_shortname}}{%- raw -%}-theme.css'] }}
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
{%- endblock %}
{%- endraw %}
{% endblock %}
{%- endraw -%}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
{% include 'misc/header.py' %}
"""JS/CSS Webpack bundles for theme."""

from __future__ import absolute_import, print_function
from invenio_assets.webpack import WebpackThemeBundle

from flask_webpackext import WebpackBundle

theme = WebpackBundle(
theme = WebpackThemeBundle(
__name__,
'assets',
entry={
'{{ cookiecutter.project_shortname }}-theme': './scss/{{ cookiecutter.package_name }}/theme.scss',
'{{ cookiecutter.project_shortname }}-preview': './js/{{ cookiecutter.package_name }}/previewer.js',
},
dependencies={
# add any additional npm dependencies here...
default='semantic-ui',
themes={
'semantic-ui': dict(
entry={
# CHANGE ME TO LESS '{{ cookiecutter.project_shortname }}-theme': './less/{{ cookiecutter.package_name }}/theme.less',
'{{ cookiecutter.project_shortname }}-preview': './js/{{ cookiecutter.package_name }}/previewer.js',
},
dependencies={
# add any additional npm dependencies here...
}
)
}
)

0 comments on commit b9ef2c3

Please sign in to comment.