Skip to content
Snippets Groups Projects
Commit 5431af1e authored by anonymous's avatar anonymous
Browse files

save current changes

parent 39455e2b
Branches
Tags
No related merge requests found
Showing with 358 additions and 94 deletions
import logging import logging
import traceback import traceback
import ast import ast
import ckan.logic as logic
import ckan.model as model
from ckan.common import c
get_action = logic.get_action
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
def odsh_openness_score_dataset_html(dataset): def odsh_openness_score_dataset_html(dataset):
score = 0 score = 0
#dataset = json.loads(dataset) #dataset = json.loads(dataset)
...@@ -23,3 +26,12 @@ def odsh_openness_score_dataset_html(dataset): ...@@ -23,3 +26,12 @@ def odsh_openness_score_dataset_html(dataset):
log.error('Error while calculating openness score %s: %s\nException: %s', log.error('Error while calculating openness score %s: %s\nException: %s',
e.__class__.__name__, unicode(e), traceback.format_exc()) e.__class__.__name__, unicode(e), traceback.format_exc())
return score return score
def odsh_get_resource_views(pkg_dict, resource):
context = {'model': model, 'session': model.Session,
'user': c.user, 'for_view': True,
'auth_user_obj': c.userobj}
return get_action('resource_view_list')(
context, {'id': resource['id']})
No preview for this file type
...@@ -19,6 +19,33 @@ msgstr "" ...@@ -19,6 +19,33 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n" "Generated-By: Babel 2.3.4\n"
msgid "Organizations"
msgstr "Herausgeber"
#: ckan/templates/snippets/search_result_text.html:29
msgid "{number} organization found"
msgid_plural "{number} organizations found"
msgstr[0] "{number} Herausgeber"
msgstr[1] "{number} Herausgeber"
msgid "Login"
msgstr "Login"
msgid "do Login"
msgstr "Einloggen"
msgid "Forgotten your password?"
msgstr "Passwort vergessen"
msgid "change password"
msgstr "Passwort ändern"
msgid "Username"
msgstr "Name"
msgid "enter password"
msgstr "Passwort eingeben"
msgid "odsh Create Dataset" msgid "odsh Create Dataset"
msgstr "Datensatz-Upload" msgstr "Datensatz-Upload"
......
...@@ -6,6 +6,7 @@ from ckan.lib.plugins import DefaultDatasetForm ...@@ -6,6 +6,7 @@ from ckan.lib.plugins import DefaultDatasetForm
from ckan.common import OrderedDict from ckan.common import OrderedDict
import ckan.lib.helpers as helpers import ckan.lib.helpers as helpers
import helpers as odsh_helpers import helpers as odsh_helpers
from routes.mapper import SubMapper
import logging import logging
...@@ -85,6 +86,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm ...@@ -85,6 +86,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
'odsh_group_id_selected': odsh_group_id_selected, 'odsh_group_id_selected': odsh_group_id_selected,
'odsh_get_facet_items_dict': odsh_get_facet_items_dict, 'odsh_get_facet_items_dict': odsh_get_facet_items_dict,
'odsh_openness_score_dataset_html': odsh_helpers.odsh_openness_score_dataset_html, 'odsh_openness_score_dataset_html': odsh_helpers.odsh_openness_score_dataset_html,
'odsh_get_resource_views': odsh_helpers.odsh_get_resource_views
} }
def before_map(self, map): def before_map(self, map):
...@@ -122,7 +124,8 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm ...@@ -122,7 +124,8 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
# # toolkit.get_converter('not_empty'), # # toolkit.get_converter('not_empty'),
# toolkit.get_converter('odsh_convert_groups_string')] }) # toolkit.get_converter('odsh_convert_groups_string')] })
schema['resources'].update({ schema['resources'].update({
'url' : [ toolkit.get_converter('not_empty') ] 'url' : [ toolkit.get_converter('not_empty') ],
'name' : [ toolkit.get_converter('not_empty') ]
}) })
def create_package_schema(self): def create_package_schema(self):
......
...@@ -51,7 +51,10 @@ input, button, select, textarea { ...@@ -51,7 +51,10 @@ input, button, select, textarea {
} }
h1{
color:#003064;
font-weight: normal ;
}
/* css for searchresults */ /* css for searchresults */
...@@ -88,6 +91,14 @@ input, button, select, textarea { ...@@ -88,6 +91,14 @@ input, button, select, textarea {
padding: 0; padding: 0;
} }
.page-heading{
font-size: 25px;
color: #003064;
font-weight: 300;
border-bottom: 4px solid #dbdbdb;
padding-bottom: 10px
}
input[type=radio], input[type=checkbox] { input[type=radio], input[type=checkbox] {
top: 0px; top: 0px;
} }
...@@ -189,10 +200,11 @@ input[type=radio], input[type=checkbox] { ...@@ -189,10 +200,11 @@ input[type=radio], input[type=checkbox] {
/* checkbox customize trick, see: https://stackoverflow.com/questions/24322599/css-why-cannot-change-checkbox-color-whatever-i-do */ /* checkbox customize trick, see: https://stackoverflow.com/questions/24322599/css-why-cannot-change-checkbox-color-whatever-i-do */
input[type=checkbox] { .facet_label input[type=checkbox] {
display:none; display:none;
} }
/* input[type=checkbox] + label.checkbox, */
input[type=checkbox] + label.mylabel { input[type=checkbox] + label.mylabel {
background: #fff; background: #fff;
border: 1px solid white; border: 1px solid white;
...@@ -200,8 +212,15 @@ input[type=checkbox] + label.mylabel { ...@@ -200,8 +212,15 @@ input[type=checkbox] + label.mylabel {
width: 8px; width: 8px;
display: inline-block; display: inline-block;
padding: 0 0 0 0px; padding: 0 0 0 0px;
margin-bottom: 0px;
min-height: 8px;
} }
/* input[type=checkbox] + label.checkbox{
border: 1px solid black;
} */
/* input[type=checkbox]:checked + label.checkbox, */
input[type=checkbox]:checked + label.mylabel { input[type=checkbox]:checked + label.mylabel {
background: url(/base/images/checked.png); background: url(/base/images/checked.png);
background-color: #fff; background-color: #fff;
...@@ -209,10 +228,19 @@ input[type=checkbox]:checked + label.mylabel { ...@@ -209,10 +228,19 @@ input[type=checkbox]:checked + label.mylabel {
border: 1px solid black; border: 1px solid black;
height: 8px; height: 8px;
width: 8px; width: 8px;
min-height: 8px;
display:inline-block; display:inline-block;
padding: 0 0px 0 0px; padding: 0 0px 0 0px;
margin-bottom: 0px;
} }
/* .checklabel .controls > .checkbox:first-child {
padding-top: 0px;
} */
.checklabel input[type="checkbox"]
{
float: inherit;
}
label.mylabel { label.mylabel {
margin-right: 3px; margin-right: 3px;
...@@ -473,6 +501,15 @@ label:after { ...@@ -473,6 +501,15 @@ label:after {
background-color: #0089ca; background-color: #0089ca;
} }
.btn-forget-password{
background-color: white;
font-size: 10pt;
padding:2px 10px;
margin-left: 2px;
margin-top: 4px;
display: inline-block;
}
/* remove icon in upload button */ /* remove icon in upload button */
.image-upload .fa-cloud-upload:before { .image-upload .fa-cloud-upload:before {
content: unset; content: unset;
...@@ -607,3 +644,8 @@ label:after { ...@@ -607,3 +644,8 @@ label:after {
.create-dataset-form{ .create-dataset-form{
width: 50%;} width: 50%;}
.organization-image{
height:100px;
max-width: unset;
}
\ No newline at end of file
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
{% block header_logo %} {% block header_logo %}
{% if g.site_logo %} {% if g.site_logo %}
<a class="logo" href="{{ h.url_for('home') }}"><img src="{{ h.url_for_static_or_external(g.site_logo) }}" <a class="logo" href="{{ h.url_for('home') }}"><img src="{{ h.url_for_static_or_external(g.site_logo) }}" alt="{{ g.site_title }}"
alt="{{ g.site_title }}" title="{{ g.site_title }}" /></a> title="{{ g.site_title }}" /></a>
{% else %} {% else %}
<h1> <h1>
<a href="{{ h.url_for('home') }}">{{ g.site_title }}</a> <a href="{{ h.url_for('home') }}">{{ g.site_title }}</a>
...@@ -66,6 +66,24 @@ ...@@ -66,6 +66,24 @@
</nav> </nav>
{% endblock %} {% endblock %}
</div> </div>
<nav class="navigation pull-right">
<ul class="nav nav-pills ">
{% set clazz='active' if c.action=='login' else ''%}
{% if c.userobj %}
<li class='{{clazz}}'>
<a href="{{ h.url_for('/user/_logout') }}" title="logout">
<span class="text">Logout</span>
</a>
</li>
{% else %}
<li class='{{clazz}}'>
<a href="{{ h.url_for('/user/login') }}" title="login">
<span class="text">Login</span>
</a>
</li>
{% endif %}
</nav>
</ul>
</div> </div>
</div> </div>
</div> </div>
......
{% extends "page.html" %}
{% block subtitle %}{{ _('Organizations') }}{% endblock %}
{% block breadcrumb_content %}
<li class="active">{% link_for _('Organizations'), controller='organization', action='index' %}</li>
{% endblock %}
{% block page_header %}{% endblock %}
{% block page_primary_action %}
{% if h.check_access('organization_create') %}
{% link_for _('Add Organization'), controller='organization', action='new', class_='btn btn-primary',
icon='plus-square' %}
{% endif %}
{% endblock %}
{% block primary_content_inner %}
<h1 class="hide-heading">{% block page_heading %}{{ _('Organizations') }}{% endblock %}</h1>
{% block organizations_search_form %}
<div class="row">
{% snippet 'snippets/search_form.html', form_id='organization-search-form', type='organization', query=c.q,
sorting_selected=c.sort_by_selected, count=c.page.item_count, placeholder=_('Search organizations...'),
show_empty=request.params, no_bottom_border=true if c.page.items, hide_sorting=true %}
</div>
{% endblock %}
{% block organizations_list %}
{% if c.page.items or request.params %}
{% if c.page.items %}
{% snippet "organization/snippets/odsh_organization_list.html", organizations=c.page.items %}
{% endif %}
{% else %}
<p class="empty">
{{ _('There are currently no organizations for this site') }}.
{% if h.check_access('organization_create') %}
{% link_for _('How about creating one?'), controller='organization', action='new' %}</a>.
{% endif %}
</p>
{% endif %}
{% endblock %}
{% block page_pagination %}
{{ c.page.pager(q=c.q or '', sort=c.sort_by_selected or '') }}
{% endblock %}
{% endblock %}
{% block secondary%}
{% endblock %}
\ No newline at end of file
{#
Display a grid of organization items.
organizations - A list of organizations.
Example:
{% snippet "organization/snippets/organization_list.html" %}
#}
{% block organization_list %}
{% block organization_list_inner %}
{% for organization in organizations %}
{% snippet "organization/snippets/organization_item.html", organization=organization, position=loop.index,
show_capacity=show_capacity %}
{% endfor %}
{% endblock %}
{% endblock %}
\ No newline at end of file
{#
Renders a media item for a organization. This should be used in a list.
organization - A organization dict.
Example:
<ul class="media-grid">
{% for organization in organizations %}
{% snippet "organization/snippets/organization_item.html", organization=organization %}
{% endfor %}
</ul>
#}
{% set url = h.url_for(organization.type ~ '_read', action='read', id=organization.name) %}
<div class="row">
<div class="span11">
<p>{{ organization.display_name }}</p>
{% if organization.description %}
<p>{{ h.markdown_extract(organization.description, extract_length=300) }}</p>
{% endif %}
</div>
<div class="span1">
<a href="{{ url }}" title="{{ _('View {organization_name}').format(organization_name=organization.display_name) }}">
<img src="{{ organization.image_display_url or h.url_for_static('/base/images/placeholder-organization.png') }}"
alt="{{ organization.name }}" class="organization-image">
</a>
</div>
</div>
\ No newline at end of file
{#
Displays a test for results of a search.
query - The text that was searched for
count - The number of results for the search
type - Search result type (dataset, group, organization)
Example:
{% snippet 'snippets/search_result_text.html', query=query, count=count, type='dataset' %}
#}
{% if type == 'dataset' %}
{% set text_query = ungettext('{number} dataset found for "{query}"', '{number} datasets found for "{query}"', count)
%}
{% set text_query_none = _('No datasets found for "{query}"') %}
{% set text_no_query = ungettext('{number} dataset found', '{number} datasets found', count) %}
{% set text_no_query_none = _('No datasets found') %}
{% elif type == 'group' %}
{% set text_query = ungettext('{number} group found for "{query}"', '{number} groups found for "{query}"', count) %}
{% set text_query_none = _('No groups found for "{query}"') %}
{% set text_no_query = ungettext('{number} group found', '{number} groups found', count) %}
{% set text_no_query_none = _('No groups found') %}
{% elif type == 'organization' %}
{% set text_query = ungettext('{number} organization found for "{query}"', '{number} organizations found for
"{query}"', count) %}
{% set text_query_none = _('No organizations found for "{query}"') %}
{% set text_no_query = ungettext('{number} organization found', '{number} organizations found', count) %}
{% set text_no_query_none = _('No organizations found') %}
{%- endif -%}
{% if query %}
{%- if count -%}
{{ text_query.format(number=h.localised_number(count), query=query) }}
{%- else -%}
{{ text_query_none.format(query=query) }}
{%- endif -%}
{%- else -%}
{%- if count -%}
{{ text_no_query.format(number=h.localised_number(count)) }}
{%- else -%}
{{ text_no_query_none }}
{%- endif -%}
{%- endif -%}
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% block primary_content %} {% block primary_content %}
<section class="module"> <section class="module">
<div class="module-content"> <div class="module-content">
<h1 class="page-heading">{% block page_heading %}{{ _('Login') }}{% endblock %}</h1> <h2 class="page-heading">{% block page_heading %}{{ _('Login') }}{% endblock %}</h2>
{% block form %} {% block form %}
{% snippet "user/snippets/login_form.html", action=c.login_handler, error_summary=error_summary %} {% snippet "user/snippets/login_form.html", action=c.login_handler, error_summary=error_summary %}
{% endblock %} {% endblock %}
...@@ -18,37 +18,15 @@ ...@@ -18,37 +18,15 @@
{% endblock %} {% endblock %}
{% block secondary_content %} {% block secondary_content %}
{% if h.check_access('user_create') %}
{% block help_register %}
<section class="module module-narrow module-shallow">
{% block help_register_inner %}
<h2 class="module-heading">{{ _('Need an Account?') }}</h2>
<div class="module-content">
<p>{% trans %}Then sign right up, it only takes a minute.{% endtrans %}</p>
<p class="action">
{% block help_register_button %}
<a class="btn" href="{{ h.url_for(controller='user', action='register') }}">{{ _('Create an Account') }}</a>
{% endblock %}
</p>
</div>
{% endblock %}
</section>
{% endblock %}
{% endif %}
{% block help_forgotten %} {% block help_forgotten %}
<section class="module module-narrow module-shallow"> <section class="module module-narrow module-shallow">
{% block help_forgotten_inner %} {% block help_forgotten_inner %}
<h2 class="module-heading">{{ _('Forgotten your password?') }}</h2> <span>{{ _('Forgotten your password?') }}:</span>
<div class="module-content">
<p>{% trans %}No problem, use our password recovery form to reset it.{% endtrans %}</p>
<p class="action">
{% block help_forgotten_button %} {% block help_forgotten_button %}
<a class="btn" href="{{ h.url_for(controller='user', action='request_reset') }}">{{ _('Forgot your <a class="btn-forget-password" href="{{ h.url_for(controller='user', action='request_reset') }}">
password?') }}</a> {{ _('change password') }}</a>
{% endblock %} {% endblock %}
</p>
</div>
{% endblock %} {% endblock %}
</section> </section>
{% endblock %} {% endblock %}
......
{#
Renders the login form.
action - The url that the form should be submitted to.
error_summary - A tuple/list of form errors.
Example:
{% snippet "user/snippets/login_form.html", action=c.login_handler, error_summary=error_summary %}
#}
{% import 'macros/form.html' as form %}
{% set username_error = true if error_summary %}
{% set password_error = true if error_summary %}
<form action="{{ action }}" method="post" class="form">
{{ form.errors(errors=error_summary) }}
<div class='row'>
<div class="span6">
{{ form.input('login', label=_("Username"), id='field-login', value="", error=username_error,
classes=["control-full"], placeholder=_('enter name')) }}
</div>
</div>
<div class='row'>
<div class="span6">
{{ form.input('password', label=_("Password"), id='field-password', type="password", value="",
error=password_error, classes=["control-full"],placeholder=_('enter password')) }}
</div>
</div>
{{ form.checkbox('remember', classes=["checklabel"], label=_("Remember me"), id='field-remember', checked=true,
value="63072000") }}
<div class='row'>
<div class="form-actions span6">
{% block login_button %}
<button class="btn btn-primary" type="submit">{{ _('do Login') }}</button>
{% endblock %}
</div>
</div>
</form>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment