diff --git a/ckanext/opendatani/fanstatic/css/theme.css b/ckanext/opendatani/fanstatic/css/theme.css index dcec05b..2577ee6 100644 --- a/ckanext/opendatani/fanstatic/css/theme.css +++ b/ckanext/opendatani/fanstatic/css/theme.css @@ -849,21 +849,15 @@ h6 { .hierarchy-tree li a { position: relative; } - .hierarchy-tree-top li a span, .hierarchy-tree li a span { position: absolute; right: 0; top: 0; background: #0c6db7; - padding: 4px 5px; + padding: 4px 10px; color: #f6f7f8; } - -.hierarchy-tree-top a span { - padding: 4px 8px; -} - .media-grid .media-view { border: none; } @@ -925,6 +919,7 @@ h6 { margin-bottom: 1px; } + .label { text-shadow: none; letter-spacing: normal; @@ -1070,4 +1065,70 @@ h6 { #no_content:after{ content: '' +} + + + +/* Custom UI Homepage updates */ +.latest-posts.thumbnails { + margin-top:30px; +} + +.latest-posts.thumbnails li{ + border: 1px solid #eee; + margin-left: 17px; +} + +.latest-posts.thumbnails li .post{ + padding:10px; +} + +.sub-heading { + display:inline; + position: relative; + top: 6px; +} + +.more-btn { + margin-left: 10px; + display:inline; +} + +.col-7 { + width:70%; + float:left; +} + +.col-3 { + width:30%; + float:left; + text-align:right; +} + +.showcase-item { + padding: 30px 0; + border-bottom: 1px solid #e1e1e1; +} + +.showcase-item p { + margin-top:10px; + color: #7d7d7d; +} + +.showcase-item .btn { + position: relative; + top: 15px; + padding: 5px 25px; +} + +.showcase-item span{ + background-color: #eee; + font-size: 1.1em; + padding: 6px 15px; + font-weight: 600; + color: #7f7f7f; +} + +.clearfix { + clear:both; } \ No newline at end of file diff --git a/ckanext/opendatani/fanstatic/less/_org-list.less b/ckanext/opendatani/fanstatic/less/_org-list.less index 8578683..cc74f34 100644 --- a/ckanext/opendatani/fanstatic/less/_org-list.less +++ b/ckanext/opendatani/fanstatic/less/_org-list.less @@ -54,14 +54,8 @@ right: 0; top: 0; background: @accent; - padding: 4px 5px; + padding: 4px 10px; color: @lightgrey; } } -} - -.hierarchy-tree-top { - a span { - padding: 4px 8px; - } } \ No newline at end of file diff --git a/ckanext/opendatani/helpers.py b/ckanext/opendatani/helpers.py index ce7ba2a..ec9b495 100644 --- a/ckanext/opendatani/helpers.py +++ b/ckanext/opendatani/helpers.py @@ -8,6 +8,8 @@ import ckan.lib.helpers as h from ckan.plugins import toolkit import ckan.authz as authz +import ckan.lib.dictization.model_dictize as model_dictize +from ckanext.showcase.model import ShowcasePackageAssociation log = logging.getLogger(__name__) @@ -156,3 +158,19 @@ def verify_datasets_exist(org): data_dict['q'] = 'organization:{0}'.format(org) return toolkit.get_action('package_search')({}, data_dict).get('count') > 0 + + +def get_showcase_List(limit): + q = model.Session.query(model.Package) \ + .filter(model.Package.type == 'showcase') \ + .filter(model.Package.state == 'active') + + showcase_list = [] + for pkg in q.limit(limit).all(): + showcase_list.append(model_dictize.package_dictize(pkg, { 'model' : model })) + + for idx, showcase in enumerate(showcase_list): + # get a list of package ids associated with showcase id + pkg_id_list = ShowcasePackageAssociation.get_package_ids_for_showcase(showcase['id']) + showcase_list[idx]['package_count'] = len(pkg_id_list) + return showcase_list \ No newline at end of file diff --git a/ckanext/opendatani/plugin.py b/ckanext/opendatani/plugin.py index 34f636f..2a4dbe0 100644 --- a/ckanext/opendatani/plugin.py +++ b/ckanext/opendatani/plugin.py @@ -66,7 +66,8 @@ def get_helpers(self): 'package_list': package_list, 'ni_activity_list_to_text': helpers.activity_list_to_text, 'verify_datasets_exist': helpers.verify_datasets_exist, - 'is_admin': helpers.is_admin + 'is_admin': helpers.is_admin, + 'showcase_list': helpers.get_showcase_List } # IRoutes diff --git a/ckanext/opendatani/templates/home/index.html b/ckanext/opendatani/templates/home/index.html index fdd07cb..b4b5f9e 100644 --- a/ckanext/opendatani/templates/home/index.html +++ b/ckanext/opendatani/templates/home/index.html @@ -14,24 +14,45 @@
-

Latest

+

Latest

{% trans %}More{% endtrans %} {% set posts = h.get_recent_blog_posts(3) %}
+ +
+
+

Showcases

{% trans %}More{% endtrans %} + +
+ {% for showcase in h.showcase_list(limit=3) %} + +
+ View +
+
+ {{ _(showcase.package_count) }} Datasets +

{{ _(showcase.notes | truncate(300)) }}

+ {% endfor %} +
+
+
{% snippet "home/snippets/twitter.html" %} {% endblock %}