Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1126] First run at new homepage modules core extension
- Loading branch information
1 parent
ba9f605
commit 3e7f690
Showing
10 changed files
with
150 additions
and
160 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
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,24 @@ | ||
import logging | ||
|
||
import ckan.plugins as p | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
class HomepagePlugin(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_featured_organization(self): | ||
return | ||
|
||
def get_featured_group(self): | ||
return | ||
|
||
def get_helpers(self): | ||
return { | ||
'get_featured_organization': self.get_featured_organization, | ||
'get_featured_group': self.get_featured_group, | ||
} |
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,36 @@ | ||
{% ckan_extends %} | ||
|
||
{% block primary_content %} | ||
<div role="main" class="hero"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="span6 slot1">{{ self.homepage_slot_1() }}</div> | ||
<div class="span6 slot2">{{ self.homepage_slot_2() }}</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div role="main"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="span6 slot3">{{ self.homepage_slot_3() }}</div> | ||
<div class="span6 slot4">{{ self.homepage_slot_4() }}</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block homepage_slot_1 %} | ||
{% snippet 'home/snippets/promoted.html', intro=g.site_intro_text %} | ||
{% endblock %} | ||
|
||
{% block homepage_slot_2 %} | ||
{% snippet 'home/snippets/search.html', query=c.q, tags=h.get_facet_items_dict('tags', limit=3), placeholder=_('eg. Gold Prices') %} | ||
{% endblock %} | ||
|
||
{% block homepage_slot_3 %} | ||
{% snippet 'home/snippets/featured_group.html', group=h.get_featured_group() %} | ||
{% endblock %} | ||
|
||
{% block homepage_slot_4 %} | ||
{% snippet 'home/snippets/featured_organization.html', organization=h.get_featured_organization() %} | ||
{% endblock %} |
3 changes: 3 additions & 0 deletions
3
ckanext/homepage/theme/templates/home/snippets/featured_group.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="box"> | ||
{% snippet 'snippets/group_item.html', group=group, truncate=50, truncate_title=35 %} | ||
</div> |
3 changes: 3 additions & 0 deletions
3
ckanext/homepage/theme/templates/home/snippets/featured_organization.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="box"> | ||
{% snippet 'snippets/organization_item.html', organization=organization, truncate=50, truncate_title=35 %} | ||
</div> |
20 changes: 20 additions & 0 deletions
20
ckanext/homepage/theme/templates/home/snippets/promoted.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-content box"> | ||
<header> | ||
{% if intro %} | ||
{{ h.render_markdown(intro) }} | ||
{% else %} | ||
<h1 class="page-heading">{{ _("Welcome to CKAN") }}</h1> | ||
<p> | ||
{% trans %}This is a nice introductory paragraph about CKAN or the site | ||
in general. We don't have any copy to go here yet but soon we will | ||
{% endtrans %} | ||
</p> | ||
{% endif %} | ||
</header> | ||
<section class="featured media-overlay"> | ||
<h2 class="media-heading">{{ _("This is a featured section") }}</h2> | ||
<a class="media-image" href="#"> | ||
<img src="http://placehold.it/420x220" alt="Placeholder" width="420" height="220" /> | ||
</a> | ||
</section> | ||
</div> |
18 changes: 18 additions & 0 deletions
18
ckanext/homepage/theme/templates/home/snippets/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,18 @@ | ||
<div class="module module-search module-narrow module-shallow box"> | ||
<form class="module-content search-form" method="get" action="{% url_for controller='package', action='search' %}"> | ||
<h3 class="heading">{{ _("Search Your Data") }}</h3> | ||
<div class="search-input control-group search-giant"> | ||
<input type="text" class="search" name="q" value="{{ query }}" autocomplete="off" placeholder="{{ placeholder }}" /> | ||
<button type="submit"> | ||
<i class="icon-search"></i> | ||
<span>{{ _('Search') }}</span> | ||
</button> | ||
</div> | ||
</form> | ||
<div class="tags"> | ||
<h3>{{ _('Popular Tags') }}</h3> | ||
{% 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