Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1126] First working version of row/column based homepage off of sim…
…ple JSON config
- Loading branch information
1 parent
0a339db
commit d44132b
Showing
9 changed files
with
97 additions
and
91 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
Empty file.
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,18 @@ | ||
import logging | ||
|
||
import ckan.plugins as p | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
class ContentModulePlugin(p.SingletonPlugin): | ||
p.implements(p.IConfigurer, inherit=True) | ||
p.implements(p.IConfigurable, inherit=True) | ||
|
||
def update_config(self, config): | ||
p.toolkit.add_template_directory(config, 'theme/templates') | ||
|
||
# def get_helpers(self): | ||
# return { | ||
# 'featured_organizations': self.featured_orgs, | ||
# 'featured_groups': self.featured_groups, | ||
# } |
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,6 @@ | ||
{% ckan_extends %} | ||
|
||
{% block content_primary_nav %} | ||
{{ super() }} | ||
{{ h.build_nav_icon('ckanadmin_homepage', _('Homepage')) }} | ||
{% endblock %} |
3 changes: 3 additions & 0 deletions
3
ckanext/content_module/theme/templates/content_module/carousel.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,3 @@ | ||
<div class="carousel"> | ||
|
||
</div> |
3 changes: 3 additions & 0 deletions
3
ckanext/content_module/theme/templates/content_module/intro.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,3 @@ | ||
<header> | ||
{{ module.config.message }} | ||
</header> |
20 changes: 20 additions & 0 deletions
20
ckanext/content_module/theme/templates/content_module/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,20 @@ | ||
<div class="module module-shallow module-narrow module-dark box"> | ||
<form class="module-content search-form" method="get" action="{% url_for controller='package', action='search' %}"> | ||
<h3 class="heading">{{ module.config.title }}</h3> | ||
{{ config }} | ||
<div class="search-input control-group search-giant"> | ||
<input type="text" class="search" name="q" value="" autocomplete="off" placeholder="{{ module.config.placeholder }}" /> | ||
<button type="submit"> | ||
<i class="icon-search"></i> | ||
<span>{{ _('Search') }}</span> | ||
</button> | ||
</div> | ||
</form> | ||
<div class="tags"> | ||
<h3>{{ _('Popular Tags') }}</h3> | ||
{% set tags = h.get_facet_items_dict('tags', limit=module.config.limit) %} | ||
{% for tag in tags %} | ||
<a class="tag" href="{% url_for controller='package', action='search', tags=tag.name %}">{{ h.truncate(tag.display_name, 22) }}</a> | ||
{% endfor %} | ||
</div> | ||
</div> |
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,42 @@ | ||
{% ckan_extends %} | ||
|
||
{# imagine this is set via the controller really... #} | ||
{% set content_bands = [ | ||
{ | ||
"type": "hero", | ||
"columns": [ | ||
[ | ||
{ "type": "intro", "config": { "message": g.site_intro_text or "Test" } }, | ||
{ "type": "carousel", "config": false }, | ||
], | ||
[ | ||
{ "type": "search", "config": { | ||
"limit": 3, | ||
"title": _("Search Your Data"), | ||
"placeholder": _("eg. Gold Prices") | ||
} }, | ||
] | ||
] | ||
}, | ||
] %} | ||
|
||
{% block primary_content %} | ||
|
||
{% for band in content_bands %} | ||
<div class="band {{ band.type }}"> | ||
<div class="container"> | ||
<div class="row"> | ||
{% for column in band.columns %} | ||
{% set column_size = ( 12 / loop.length )|int %} | ||
<div class="span{{ column_size }}"> | ||
{% for module in column %} | ||
{% snippet 'content_module/'~module.type~'.html', module=module %} | ||
{% endfor %} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
</div> | ||
{% endfor %} | ||
|
||
{% 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