Skip to content

Commit

Permalink
Merge branch 'master' of github.com:okfn/ckan into 255-update-api-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hammond committed Feb 8, 2013
2 parents 9d468ae + 6af04e7 commit 3939de6
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 69 deletions.
2 changes: 2 additions & 0 deletions ckan/lib/helpers.py
Expand Up @@ -568,6 +568,8 @@ def check_access(action, data_dict=None):

context = {'model': model,
'user': c.user or c.author}
if not data_dict:
data_dict = {}

try:
check_access_logic(action, context, data_dict)
Expand Down
4 changes: 3 additions & 1 deletion ckan/model/meta.py
Expand Up @@ -161,4 +161,6 @@ def engine_is_sqlite():

def engine_is_pg():
# Returns true iff the engine is connected to a postgresql database.
return engine.url.drivername in ['psycopg2', 'postgres']
# According to http://docs.sqlalchemy.org/en/latest/core/engines.html#postgresql
# all Postgres driver names start with `postgresql`
return engine.url.drivername.startswith('postgresql')
40 changes: 23 additions & 17 deletions ckan/public/base/css/main.css
Expand Up @@ -4506,13 +4506,13 @@ ul.icons li .icon-large:before {
.simple-list:after {
clear: both;
}
.simple-list > li {
.simple-list > li {
font-size: 12px;
line-height: 1.1666666666666667em;
padding: 7px 25px;
border-bottom: 1px dotted #cccccc;
}
.simple-list > li:last-of-type {
.simple-list > li:last-of-type {
border-bottom: 0;
}
.simple-list .ckan-icon {
Expand Down Expand Up @@ -4669,8 +4669,6 @@ ul.icons li .icon-large:before {
padding-right: 15px;
}
.module-grid {
margin: 0;
list-style: none;
margin: 0;
list-style: none;
*zoom: 1;
Expand All @@ -4694,7 +4692,6 @@ ul.icons li .icon-large:before {
padding-left: 20px;
padding-bottom: 25px;
float: left;
float: left;
margin-left: 20px;
width: 460px;
padding-top: 10px;
Expand All @@ -4720,10 +4717,10 @@ ul.icons li .icon-large:before {
.ckanext-datapreview {
position: relative;
}
.ckanext-datapreview > iframe {
.ckanext-datapreview > iframe {
min-height: 400px;
}
.ckanext-datapreview > img {
.ckanext-datapreview > img {
max-height: 500px;
max-width: 100%;
overflow: hidden;
Expand Down Expand Up @@ -4887,13 +4884,13 @@ ol.media-grid:after {
.nav-simple:after {
clear: both;
}
.nav-simple > li {
.nav-simple > li {
font-size: 12px;
line-height: 1.1666666666666667em;
padding: 7px 25px;
border-bottom: 1px dotted #cccccc;
}
.nav-simple > li:last-of-type {
.nav-simple > li:last-of-type {
border-bottom: 0;
}
.nav-simple .ckan-icon {
Expand All @@ -4915,12 +4912,10 @@ ol.media-grid:after {
}
.nav-item.active > a {
background: url("../../../base/images/background-tag.png") no-repeat -13px center;
position: relative;
display: block;
font-size: 11px;
line-height: 27px;
color: #187794;
padding-left: 10px;
padding-right: 5px;
margin-right: 11px;
-webkit-box-sizing: border-box;
Expand Down Expand Up @@ -5226,8 +5221,6 @@ textarea {
background-image: url("../../../base/images/sprite-ckan-icons.png");
background-repeat: no-repeat;
background-position: 16px 16px;
width: 17px;
height: 17px;
background-position: -51px -16px;
position: absolute;
display: block;
Expand Down Expand Up @@ -5654,6 +5647,13 @@ textarea {
.control-full .select2-container {
width: 520px !important;
}
.control-group.error .select2-container input:focus,
.control-group.error .select2-container select:focus,
.control-group.error .select2-container textarea:focus {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.dataset-item {
border-bottom: 1px dotted #cccccc;
padding-bottom: 20px;
Expand Down Expand Up @@ -5821,8 +5821,6 @@ textarea {
vertical-align: text-bottom;
position: relative;
top: 2px;
width: 16px;
height: 16px;
background-image: url("../../../base/images/sprite-ckan-icons.png");
background-repeat: no-repeat;
background-position: 16px 16px;
Expand Down Expand Up @@ -6682,7 +6680,6 @@ li .icon-large:before {
float: right;
}
[role=main] .secondary {
float: left;
margin-left: 20px;
width: 220px;
margin-left: 0;
Expand Down Expand Up @@ -7239,9 +7236,18 @@ header.masthead .debug {
display: block;
font-size: 30px;
font-weight: 700;
line-height: 1.2;
line-height: 36px;
margin-left: 0;
}
.profile-info .nums dl dd .smallest {
font-size: 13px;
}
.profile-info .nums dl dd .smaller {
font-size: 16px;
}
.profile-info .nums dl dd .small {
font-size: 21px;
}
.profile-info.editing .module-content {
margin-top: 0;
}
Expand Down
8 changes: 8 additions & 0 deletions ckan/public/base/less/forms.less
Expand Up @@ -686,3 +686,11 @@ textarea {
// sets it on the element.
width: 520px !important;
}

.control-group.error .select2-container {
input:focus,
select:focus,
textarea:focus {
.box-shadow(none);
}
}
16 changes: 8 additions & 8 deletions ckan/templates/admin/authz.html
Expand Up @@ -14,9 +14,9 @@
{% endfor %}
</colgroup>
<tr>
<th>{{ _('User') }}</th>
<th scope="col">{{ _('User') }}</th>
{% for role in roles %}
<th> {{ role }} </th>
<th scope="col"> {{ role }} </th>
{% endfor %}
</tr>
{% for user in users %}
Expand Down Expand Up @@ -49,9 +49,9 @@
{% endfor %}
</colgroup>
<tr>
<th>{{ _('User') }}</th>
<th scope="col">{{ _('User') }}</th>
{% for role in roles %}
<th> {{ role }} </th>
<th scope="col"> {{ role }} </th>
{% endfor %}
</tr>
<tr>
Expand All @@ -77,9 +77,9 @@
{% endfor %}
</colgroup>
<tr>
<th>{{ _('User Group') }}</th>
<th scope="col">{{ _('User Group') }}</th>
{% for role in roles %}
<th> {{ role }} </th>
<th scope="col"> {{ role }} </th>
{% endfor %}
</tr>
{% for user in users %}
Expand Down Expand Up @@ -112,9 +112,9 @@
{% endfor %}
</colgroup>
<tr>
<th>User Group</th>
<th scope="col">User Group</th>
{% for role in roles %}
<th> {{ role }} </th>
<th scope="col"> {{ role }} </th>
{% endfor %}
</tr>
<tr>
Expand Down
8 changes: 4 additions & 4 deletions ckan/templates/ajax_snippets/api_info.html
Expand Up @@ -39,19 +39,19 @@ <h3>
<thead></thead>
<tbody>
<tr>
<th>Create</th>
<th scope="row">Create</th>
<td><code>{{ datastore_root_url }}/datastore_create</code></td>
</tr>
<tr>
<th>Update / Insert</th>
<th scope="row">Update / Insert</th>
<td><code>{{ datastore_root_url }}/datastore_upsert</code></td>
</tr>
<tr>
<th>Query</th>
<th scope="row">Query</th>
<td><code>{{ datastore_root_url }}/datastore_search</code></td>
</tr>
<tr>
<th>Query (via SQL)</th>
<th scope="row">Query (via SQL)</th>
<td><code>{{ datastore_root_url }}/datastore_search_sql</code></td>
</tr>

Expand Down
3 changes: 0 additions & 3 deletions ckan/templates/group/read_base.html
Expand Up @@ -26,9 +26,6 @@
<li{% if c.action == 'activity' %} class="active"{% endif %}>
{% link_for _('Activity Stream'), controller='group', action='activity', id=c.group_dict.name, icon='time' %}
</li>
<li{% if c.action == 'admins' %} class="active"{% endif %}>
{% link_for _('Administrators'), controller='group', action='admins', id=c.group_dict.name, icon='cog' %}
</li>
<li{% if c.action == 'about' %} class="active"{% endif %}>
{% link_for _('About'), controller='group', action='about', id=c.group_dict.name, icon='info-sign' %}
</li>
Expand Down
6 changes: 3 additions & 3 deletions ckan/templates/organization/members.html
Expand Up @@ -11,9 +11,9 @@ <h1 class="hide-heading">{{ _('Members') }}</h1>
<col width="15" />
<thead>
<tr>
<th>{{ _('User') }}</th>
<th>{{ _('Role') }}</th>
<th></th>
<th scope="col">{{ _('User') }}</th>
<th scope="col">{{ _('Role') }}</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/organization/read_base.html
Expand Up @@ -33,7 +33,7 @@
{% endblock %}

{% block secondary_content %}
{% snippet 'snippets/organization.html', organization=c.group_dict %}
{% snippet 'snippets/organization.html', organization=c.group_dict, show_nums=true %}

{% if h.user_in_org_or_group(c.group_dict.id) %}
{{ h.snippet('snippets/facet_list.html', title='Visibility', name='capacity', extras={'id':c.group_dict.id}) }}
Expand Down
6 changes: 6 additions & 0 deletions ckan/templates/package/read_base.html
Expand Up @@ -55,6 +55,12 @@

{% block secondary_help_content %}{% endblock %}

{% block package_organization %}
{% if pkg.organization %}
{% snippet "snippets/organization.html", organization=pkg.organization, truncate=70, show_nums=false %}
{% endif %}
{% endblock %}

{% block package_groups %}
{% for group in pkg.groups %}
{% snippet "snippets/group.html", group=group, truncate=70 %}
Expand Down
6 changes: 3 additions & 3 deletions ckan/templates/package/resource_read.html
Expand Up @@ -79,13 +79,13 @@ <h2>Additional Information</h2>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Field</th>
<th>Value</th>
<th scope="col">Field</th>
<th scope="col">Value</th>
</tr>
</thead>
<tbody>
{% for key, value in h.format_resource_items(res.items()) %}
<tr><th>{{ key }}</th><td>{{ value }}</td></tr>
<tr><th scope="row">{{ key }}</th><td>{{ value }}</td></tr>
{% endfor %}
</tbody>
</table>
Expand Down
20 changes: 10 additions & 10 deletions ckan/templates/package/snippets/additional_info.html
Expand Up @@ -3,60 +3,60 @@ <h3>{{ _('Additional Info') }}</h3>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>{{ _('Field') }}</th>
<th>{{ _('Value') }}</th>
<th scope="col">{{ _('Field') }}</th>
<th scope="col">{{ _('Value') }}</th>
</tr>
</thead>
<tbody>
{% if pkg_dict.url %}
<tr>
<th class="dataset-label">{{ _('Source') }}</th>
<th scope="row" class="dataset-label">{{ _('Source') }}</th>
<td class="dataset-details" property="foaf:homepage">{{ h.link_to(pkg_dict.url, pkg_dict.url, rel='foaf:homepage', target='_blank') }}</td>
</tr>
{% endif %}

{% if pkg_dict.author_email %}
<tr>
<th class="dataset-label">{{ _("Author") }}</th>
<th scope="row" class="dataset-label">{{ _("Author") }}</th>
<td class="dataset-details" property="dc:creator">{{ h.mail_to(email_address=pkg_dict.author_email, name=pkg_dict.author) }}</td>
</tr>
{% elif pkg_dict.author %}
<tr>
<th class="dataset-label">{{ _("Author") }}</th>
<th scope="row" class="dataset-label">{{ _("Author") }}</th>
<td class="dataset-details" property="dc:creator">{{ pkg_dict.author }}</td>
</tr>
{% endif %}

{% if pkg_dict.maintainer_email %}
<tr>
<th class="dataset-label">{{ _('Maintainer') }}</th>
<th scope="row" class="dataset-label">{{ _('Maintainer') }}</th>
<td class="dataset-details" property="dc:contributor">{{ h.mail_to(email_address=pkg_dict.maintainer_email, name=pkg_dict.maintainer) }}</td>
</tr>
{% elif pkg_dict.maintainer %}
<tr>
<th class="dataset-label">{{ _('Maintainer') }}</th>
<th scope="row" class="dataset-label">{{ _('Maintainer') }}</th>
<td class="dataset-details" property="dc:contributor">{{ pkg_dict.maintainer }}</td>
</tr>
{% endif %}

{% if pkg_dict.version %}
<tr>
<th class="dataset-label">{{ _("Version") }}</th>
<th scope="row" class="dataset-label">{{ _("Version") }}</th>
<td class="dataset-details">{{ pkg_dict.version }}</td>
</tr>
{% endif %}

{% if h.check_access('package_update',{'id':pkg_dict.id}) %}
<tr>
<th class="dataset-label">{{ _("State") }}</th>
<th scope="row" class="dataset-label">{{ _("State") }}</th>
<td class="dataset-details">{{ pkg_dict.state }}</td>
</tr>
{% endif %}

{% for extra in h.sorted_extras(pkg_dict.extras) %}
{% set key, value = extra %}
<tr rel="dc:relation" resource="_:extra{{ i }}">
<th class="dataset-label" property="rdfs:label">{{ _(key) }}</th>
<th scope="row" class="dataset-label" property="rdfs:label">{{ _(key) }}</th>
<td class="dataset-details" property="rdf:value">{{ value }}</td>
</tr>
{% endfor %}
Expand Down

0 comments on commit 3939de6

Please sign in to comment.