-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
188 additions
and
97 deletions.
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
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
84 changes: 84 additions & 0 deletions
84
.../records/assets/semantic-ui/js/{{cookiecutter.package_name}}/search_app_customizations.js
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,84 @@ | ||
{%- include 'misc/header.js' %}{%- raw %} | ||
import React from "react"; | ||
import { overrideStore } from "react-overridable"; | ||
import { Card, Input, 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, idx) => ( | ||
<List.Item key={idx}>{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, idx) => ( | ||
<List.Item key={idx}>{contributor.name}</List.Item> | ||
))} | ||
</List> | ||
)} | ||
</Card.Description> | ||
</Card.Content> | ||
</Card> | ||
); | ||
}; | ||
|
||
overrideStore.add("ResultsGrid.item", {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}ResultsGridItem); | ||
|
||
const {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}SearchBarElement = ({ | ||
placeholder: passedPlaceholder, | ||
queryString, | ||
onInputChange, | ||
executeSearch, | ||
}) => { | ||
const placeholder = passedPlaceholder || "Search"; | ||
const onBtnSearchClick = () => { | ||
executeSearch(); | ||
}; | ||
const onKeyPress = (event) => { | ||
if (event.key === "Enter") { | ||
executeSearch(); | ||
} | ||
}; | ||
return ( | ||
<Input | ||
action={{ | ||
icon: "search", | ||
onClick: onBtnSearchClick, | ||
color: "orange", | ||
className: "invenio-theme-search-button", | ||
}} | ||
placeholder={placeholder} | ||
onChange={(event, { value }) => { | ||
onInputChange(value); | ||
}} | ||
value={queryString} | ||
onKeyPress={onKeyPress} | ||
/> | ||
); | ||
}; | ||
|
||
overrideStore.add("SearchBar.element", {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}SearchBarElement); | ||
{% endraw %} |
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
11 changes: 0 additions & 11 deletions
11
...t_shortname}}/{{cookiecutter.package_name}}/records/static/templates/records/results.html
This file was deleted.
Oops, something went wrong.
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
8 changes: 8 additions & 0 deletions
8
...ortname}}/{{cookiecutter.package_name}}/records/templates/semantic-ui/records/search.html
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,8 @@ | ||
{%- include 'misc/header.tpl' -%} | ||
{%- raw -%} | ||
{%- extends "semantic-ui/invenio_search_ui/search.html" %} | ||
|
||
{% block javascript_searchapp_customization %} | ||
{{ webpack['{%- endraw -%}{{cookiecutter.project_shortname}}{%- raw -%}-search-app.js'] }} | ||
{% endblock javascript_searchapp_customization %} | ||
{%- endraw -%} |
23 changes: 23 additions & 0 deletions
23
{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/webpack.py
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,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" | ||
} | ||
) | ||
} | ||
) |
21 changes: 0 additions & 21 deletions
21
.../{{cookiecutter.package_name}}/theme/assets/scss/{{cookiecutter.package_name}}/theme.scss
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...ookiecutter.package_name}}/theme/assets/scss/{{cookiecutter.package_name}}/variables.scss
This file was deleted.
Oops, something went wrong.
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
15 changes: 15 additions & 0 deletions
15
...r.package_name}}/theme/templates/semantic-ui/{{cookiecutter.package_name}}/frontpage.html
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,15 @@ | ||
{%- include 'misc/header.tpl' -%} | ||
{%- raw -%} | ||
{%- extends "semantic-ui/invenio_theme/frontpage.html" %} | ||
|
||
{% block page_body %} | ||
<div class="ui container grid"> | ||
<div class="row"> | ||
<div class="column"> | ||
{%- endraw -%} | ||
<h1 class="ui header centered">Welcome to {{cookiecutter.project_name}}.</h1> | ||
{%- raw -%} | ||
</div> | ||
</div> | ||
{% endblock %} | ||
{%- endraw -%} |
15 changes: 8 additions & 7 deletions
15
...s/{{cookiecutter.package_name}}/page.html → ...i/{{cookiecutter.package_name}}/page.html
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 |
---|---|---|
@@ -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 -%} |
15 changes: 0 additions & 15 deletions
15
...{cookiecutter.package_name}}/theme/templates/{{cookiecutter.package_name}}/frontpage.html
This file was deleted.
Oops, something went wrong.
23 changes: 13 additions & 10 deletions
23
{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/webpack.py
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 |
---|---|---|
@@ -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... | ||
} | ||
) | ||
} | ||
) |