Skip to content

Commit

Permalink
[#3028] Snippetized followee dropdown and added context to dashboard …
Browse files Browse the repository at this point in the history
…when filtering
  • Loading branch information
johnmartin committed Dec 12, 2012
1 parent 080cef4 commit 6ef49b7
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 46 deletions.
23 changes: 23 additions & 0 deletions ckan/public/base/less/dashboard.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@
}
}

#followee-filter {
.btn {
font-weight: normal;
strong {
max-width: 50px;
overflow: hidden;
text-overflow: ellipsis;
}
}
}

.dashboard-aside-context {
margin: -20px -25px 20px -20px;
padding: 20px;
border-left: 1px solid #DCDCDC;
border-bottom: 1px solid #DCDCDC;
background-color: @moduleHeadingBackgroundColorStart;
.border-radius(0 5px 0 0);
h2 {
margin-bottom: 10px;
}
}

.popover-followee {
.popover-title {
display: none;
Expand Down
6 changes: 6 additions & 0 deletions ckan/templates/ajax_snippets/popover-context-dataset.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@
View Dataset
</a>
</div>
{% if num_resources or num_tags %}
<div class="nums">
{% if num_resources %}
<dl>
<dt>{{ _('Resources') }}</dt>
<dd>{{ num_resources }}</dd>
</dl>
{% endif %}
{% if num_tags %}
<dl>
<dt>{{ _('Tags') }}</dt>
<dd>{{ num_tags }}</dd>
</dl>
{% endif %}
</div>
{% endif %}
</div>
6 changes: 6 additions & 0 deletions ckan/templates/ajax_snippets/popover-context-group.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@
View Group
</a>
</div>
{% if num_followers or num_datasets %}
<div class="nums">
{% if num_followers %}
<dl>
<dt>{{ _('Followers') }}</dt>
<dd>{{ num_followers }}</dd>
</dl>
{% endif %}
{% if num_datasets %}
<dl>
<dt>{{ _('Datasets') }}</dt>
<dd>{{ num_datasets }}</dd>
</dl>
{% endif %}
</div>
{% endif %}
</div>
10 changes: 9 additions & 1 deletion ckan/templates/ajax_snippets/popover-context-user.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,27 @@
<i class="icon-eye-open"></i>
View Profile
</a>
</div>
</div>
{% if num_followers or number_administered_packages or number_of_edits %}
<div class="nums">
{% if num_followers %}
<dl>
<dt>{{ _('Followers') }}</dt>
<dd>{{ num_followers }}</dd>
</dl>
{% endif %}
{% if number_administered_packages %}
<dl>
<dt>{{ _('Datasets') }}</dt>
<dd>{{ number_administered_packages }}</dd>
</dl>
{% endif %}
{% if number_of_edits %}
<dl>
<dt>{{ _('Edits') }}</dt>
<dd>{{ number_of_edits }}</dd>
</dl>
{% endif %}
</div>
{% endif %}
</div>
10 changes: 10 additions & 0 deletions ckan/templates/snippets/popover_context.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{%if type == 'user' %}
<h2>{{ dict.name }}</h2>
{% snippet 'ajax_snippets/popover-context-user.html', id=dict.id, name=dict.name, about=dict.about, is_me='false', num_followers=dict.num_followers, number_administered_packages=dict.number_administered_packages, number_of_edits=dict.number_of_edits %}
{%elif type == 'dataset' %}
<h2>{{ dict.title }}</h2>
{% snippet 'ajax_snippets/popover-context-dataset.html', id=dict.id, name=dict.name, notes=dict.notes, num_resources=dict.num_resources, num_tags=dict.num_tags %}
{%elif type == 'group' %}
<h2>{{ dict.title }}</h2>
{% snippet 'ajax_snippets/popover-context-group.html', id=dict.id, name=dict.name, description=dict.description, num_followers=dict.num_followers, num_datasets=dict.num_datasets %}
{% endif %}
51 changes: 6 additions & 45 deletions ckan/templates/user/dashboard.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
{% extends "page.html" %}

{% macro followee_icon(type) -%}
{% if type == 'dataset' %}
<i class="icon-sitemap"></i>
{% elif type == 'user' %}
<i class="icon-user"></i>
{% elif type == 'group' %}
<i class="icon-group"></i>
{% endif %}
{%- endmacro %}

{% set user = c.user_dict %}

{% block subtitle %}{{ _('Dashboard') }}{% endblock %}
Expand All @@ -28,48 +18,19 @@
<article class="dashboard module">
<div class="module-content">
<section class="dashboard-main" data-module="dashboard">
<div id="followee-filter" class="pull-right">
<a href="#followee-popover" class="btn">
{{ _('Show me:') }}
<span>{{ c.dashboard_activity_stream_context.context }}</span>
<span class="caret"></span>
</a>
<form id="followee-popover" action="/dashboard" class="dropdown js-hide">
<div class="popover-header">
<div class="input-prepend">
<span class="add-on"><i class="icon-search"></i></span>
<input type="text" name="q" placeholder="{{ _('Search list...') }}" value="{{c.dashboard_activity_stream_context.q}}">
</div>
</div>
{% if c.followee_list %}
<ul class="nav nav-pills nav-stacked">
<li{% if c.dashboard_activity_stream_context.selected_id == False %} class="active"{% endif %}>
<a href="{{ h.url_for(controller='user', action='dashboard') }}">
<i class="icon-star"></i>
<span>Everything</span>
</a>
</li>
{% for followee in c.followee_list %}
<li{% if c.dashboard_activity_stream_context.selected_id == followee.dict.id %} class="active"{% endif %}>
<a href="{{ h.url_for(controller='user', action='dashboard', type=followee.type, name=followee.dict.name) }}">
{{followee_icon(followee.type)}}
<span>{{followee.display_name}}</span>
</a>
</li>
{% endfor %}
</ul>
{% else %}
<p class="empty">{{ _('You currently not following anything') }}</p>
{% endif %}
</form>
</div>
{% snippet 'user/snippets/followee_dropdown.html', context=c.dashboard_activity_stream_context, followees=c.followee_list %}
<h2 class="page-heading">
{{ _('News feed') }}
<small>{{ _('Activity from items that you follow') }}</small>
</h2>
{{ c.dashboard_activity_stream }}
</section>
<aside class="dashboard-aside">
{% if not c.dashboard_activity_stream_context.dict == None %}
<div class="dashboard-aside-context">
{% snippet 'snippets/popover_context.html', type=c.dashboard_activity_stream_context.filter_type, dict=c.dashboard_activity_stream_context.dict %}
</div>
{% endif %}
<h2>{{ _('My Datasets') }}</h2>
{% if c.user_dict['datasets'] %}
<ul>
Expand Down
45 changes: 45 additions & 0 deletions ckan/templates/user/snippets/followee_dropdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{% macro followee_icon(type) -%}
{% if type == 'dataset' %}
<i class="icon-sitemap"></i>
{% elif type == 'user' %}
<i class="icon-user"></i>
{% elif type == 'group' %}
<i class="icon-group"></i>
{% endif %}
{%- endmacro %}

<div id="followee-filter" class="pull-right">
<a href="#followee-popover" class="btn">
{{ _('Show me:') }}
<strong>{{ context.context }}</strong>
<span class="caret"></span>
</a>
<form id="followee-popover" action="/dashboard" class="dropdown js-hide">
<div class="popover-header">
<div class="input-prepend">
<span class="add-on"><i class="icon-search"></i></span>
<input type="text" name="q" placeholder="{{ _('Search list...') }}" value="{{context.q}}">
</div>
</div>
{% if followees %}
<ul class="nav nav-pills nav-stacked">
<li{% if context.selected_id == False %} class="active"{% endif %}>
<a href="{{ h.url_for(controller='user', action='dashboard') }}">
<i class="icon-star"></i>
<span>Everything</span>
</a>
</li>
{% for followee in followees %}
<li{% if context.selected_id == followee.dict.id %} class="active"{% endif %}>
<a href="{{ h.url_for(controller='user', action='dashboard', type=followee.type, name=followee.dict.name) }}">
{{followee_icon(followee.type)}}
<span>{{followee.display_name}}</span>
</a>
</li>
{% endfor %}
</ul>
{% else %}
<p class="empty">{{ _('You currently not following anything') }}</p>
{% endif %}
</form>
</div>

0 comments on commit 6ef49b7

Please sign in to comment.