Skip to content

Commit

Permalink
Merge branch 'feature-2375-demo-theme' of github.com:okfn/ckan into f…
Browse files Browse the repository at this point in the history
…eature-2375-demo-theme
  • Loading branch information
tobes committed Jun 8, 2012
2 parents 458d614 + a309254 commit f56ce8a
Show file tree
Hide file tree
Showing 14 changed files with 133 additions and 35 deletions.
1 change: 1 addition & 0 deletions ckan/config/routing.py
Expand Up @@ -170,6 +170,7 @@ def make_map():
'list',
'new',
'new_resource',
'new_metadata',
'autocomplete',
'search'
]))
Expand Down
7 changes: 6 additions & 1 deletion ckan/controllers/package.py
Expand Up @@ -469,10 +469,15 @@ def new(self, data=None, errors=None, error_summary=None):
return render( self._new_template(package_type))

def new_resource(self, data=None, errors=None, error_summary=None):
""" This is a temporary action to allow styling of the forms. """
''' FIXME: This is a temporary action to allow styling of the forms. '''
package_type = self._guess_package_type(True)
return render('package/new_resource.html')

def new_metadata(self, data=None, errors=None, error_summary=None):
''' FIXME: This is a temporary action to allow styling of the forms. '''
package_type = self._guess_package_type(True)
return render('package/new_package_metadata.html')

def edit(self, id, data=None, errors=None, error_summary=None):
package_type = self._get_package_type(id)
context = {'model': model, 'session': model.Session,
Expand Down
20 changes: 14 additions & 6 deletions ckan/lib/helpers.py
Expand Up @@ -961,7 +961,7 @@ def debug_inspect(arg):
''' Output pprint.pformat view of supplied arg '''
return literal('<pre>') + pprint.pformat(arg) + literal('</pre>')

def debug_full_info():
def debug_full_info_as_list():
''' This dumps the template variables for debugging purposes only. '''
out = []
ignored_keys = ['c', 'app_globals', 'g', 'h', 'request', 'tmpl_context',
Expand All @@ -976,20 +976,27 @@ def debug_full_info():
'__template_name', '__template_path',
'__weakref__', 'action', 'environ', 'pylons',
'start_response']

for key in c.__context.keys():
if not key in ignored_keys:
out.append('<b>%s<b> : <pre>%s</pre>' %
(key, escape(c.__context.get(key))))
out.append((key, c.__context.get(key)))

for key in dir(c.__context['tmpl_context']):
if not key in ignored_context_keys:
out.append('<b>%s</b> : <pre>%s</pre>' %
(key, escape(pprint.pformat(getattr(c, key)))))
out.append((key, pprint.pformat(getattr(c, key))))

return literal('<br/>'.join(out))
return out

def debug_full_info():
''' This dumps the template variables for debugging purposes only. '''
out = []
info = debug_full_info_as_list()

for key, value in info:
out.append('<b>%s<b> : <pre>%s</pre>' %
(key, escape(value)))

return literal('<br/>'.join(out))

def popular(type_, number, min=1, title=None):
''' display a popular icon. '''
Expand Down Expand Up @@ -1062,6 +1069,7 @@ def popular(type_, number, min=1, title=None):
'full_current_url',
'popular',
'debug_full_info',
'debug_full_info_as_list',
# imported into ckan.lib.helpers
'literal',
'link_to',
Expand Down
17 changes: 17 additions & 0 deletions ckan/public/base/less/forms.less
Expand Up @@ -124,6 +124,15 @@ textarea {
padding-right: @gutter-x;
}

.form-inline input {
padding-bottom: 9px;
}

.form-inline .btn {
margin-left: 5px;
}


.editor textarea {
.border-radius(@inputBorderRadius @inputBorderRadius 0 0);
border-bottom: none;
Expand Down Expand Up @@ -276,11 +285,19 @@ textarea {
margin-left: -30px;
}

.stages li:last-child:after {
content: none;
}

.stages li.complete:after {
border-top-color: #8cc68a;
border-bottom-color: #8cc68a;
}

.stages.stage-3 li.complete:first-child:after {
content: none;
}

.stages li.active,
.stages li.complete {
background: none;
Expand Down
1 change: 1 addition & 0 deletions ckan/public/base/less/layout.less
Expand Up @@ -3,6 +3,7 @@
padding-top: 27px;
padding-bottom: 27px;
background-color: @layout-background-color;
min-height: 350px;
}

[role=main]:after,
Expand Down
38 changes: 28 additions & 10 deletions ckan/templates/footer.jinja.html
Expand Up @@ -17,16 +17,34 @@
<p><small>Maps powered by Leaflet, map data &copy; OpenStreetMap contributors, CC-BY-SA, map imagery &copy; CloudMade</small></p>
</div>
</div>
{% if config.debug %}
<div class="well" style="color:#333;margin-top:10px;">
<b>Debug info:</b><br/>
Controller : {{ c.controller }}<br/>
Action : {{ c.action }}<br/>
Template name : {{ c.__template_name }}<br/>
Template path : {{ c.__template_path }}<br/>
{% if config.debug %}
<div class="container">
<a id="debug-toggle" href="#debug" style="opacity: 0.6">Debug</a>
<pre id="debug" class="well" style="display:none;color:#333;margin-top:10px;">
<b>Debug info:</b>

{{h.debug_full_info()}}
<b>Controller</b>: {{ c.controller }}
<b>Action</b>: {{ c.action }}
<b>Template name</b>: {{ c.__template_name }}
<b>Template path</b>: {{ c.__template_path }}

</div>
{% endif %}
<b>Context info:</b>

{% for value in h.debug_full_info_as_list() -%}
<b>{{ value.0 }}</b>: {{ value.1 }}
{% endfor -%}
</pre>
<script>
(function toggleDebug() {
var debug = document.getElementById('debug'),
toggle = document.getElementById('debug-toggle');

toggle.onclick = function () {
debug.style.display = debug.style.display === 'block' ? 'none' : 'block';
return false;
};
})();
</script>
</div>
{% endif %}
</footer>
3 changes: 3 additions & 0 deletions ckan/templates/package/new_package_form.html
Expand Up @@ -81,6 +81,9 @@ <h2>Errors in form</h2>
</div>

<div class="form-actions">
<p class="action-info small">Important: By submitting content, you
agree to release your contributions under the Open Database
License.</p>
<a class="btn" href="">Cancel</a>
<button class="btn btn-primary" type="submit" name="save">Next: Add Data</button>
</div>
Expand Down
41 changes: 41 additions & 0 deletions ckan/templates/package/new_package_metadata.html
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://genshi.edgewall.org/i18n"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
<!--! Include matchers nearest first -->
<xi:include href="../page.html" />

<!--! Now include the current page -->
<head>
<title>Add metadata to the dataset</title>
</head>
<body>
<div class="toolbar">
${h.snippet('package/new_breadcrumb.html')}
</div>

<div class="primary">
<section class="module">
<div class="content">
${h.snippet('package/new_stages.html', stage=3)}
<form class="dataset-form dataset-resource-form form-horizontal" method="post" py:with="errors = {}; data = {};">
<div class="form-actions">
<button class="btn btn-primary" type="submit">Finish</button>
</div>
</form>
</div>
</section>
</div>

<div class="secondary">
<section class="module">
<h2 class="heading"><i class="ckan-icon ckan-icon-info"></i> What is data?</h2>
<div class="content">
<p>Data can be any file or link to a file containing useful data.</p>
</div>
</section>
</div>
</body>
</html>
8 changes: 3 additions & 5 deletions ckan/templates/package/new_resource.html
Expand Up @@ -82,11 +82,9 @@
</div>

<div class="form-actions">
<p class="action-info small">Important: By submitting content, you
agree to release your contributions under the Open Database
License.</p>
<a class="btn" href="">Save and close</a>
<button class="btn btn-primary" type="submit">Next: Add Info</button>
<a class="btn" href="">Save</a>
<a class="btn" href="">Save &amp; add another</a>
<button class="btn btn-primary" type="submit">Next: Additional Info</button>
</div>
</form>
</div>
Expand Down
6 changes: 3 additions & 3 deletions ckan/templates/package/new_stages.html
@@ -1,15 +1,15 @@
<py:choose test="stage" xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://genshi.edgewall.org/">
<ol class="stages" py:when="1">
<ol class="stages stage-1" py:when="1">
<li class="active">${h.nav_link(_('Create Dataset'), controller='package', action='new')}</li>
<li>Add data</li>
<li>Additional data</li>
</ol>
<ol class="stages" py:when="2">
<ol class="stages stage-2" py:when="2">
<li class="complete">${h.nav_link(_('Create Dataset'), controller='package', action='new')}</li>
<li class="active"><a href="">Add data</a></li>
<li>Additional data</li>
</ol>
<ol class="stages" py:when="3">
<ol class="stages stage-3" py:when="3">
<li class="complete">${h.nav_link(_('Create Dataset'), controller='package', action='new')}</li>
<li class="complete"><a href="">Add data</a></li>
<li class="active"><a href="">Additional data</a></li>
Expand Down
6 changes: 0 additions & 6 deletions ckan/templates/user/login.html
Expand Up @@ -8,12 +8,6 @@
</ol>
{% endblock %}

{% block actions %}
<ul class="actions">
<li>{{ h.nav_link(_('Register'), controller='user', action='register', class_="btn", icon="head") }}</li>
</ul>
{% endblock %}

{% block primary_content %}
<section class="module">
<div class="content">
Expand Down
12 changes: 12 additions & 0 deletions ckan/templates/user/logout.html
@@ -0,0 +1,12 @@
{% extends "page.jinja.html" %}

{% block title %}{{ _('Logged Out') }} - {{ super() }}{% endblock %}

{% block primary_content %}
<section class="module">
<div class="content">
<h1 class="page-heading">{{ _('Logged Out') }}</h1>
<p>{% trans %}You are now logged out.{% endtrans %}</p>
</div>
</section>
{% endblock %}
4 changes: 2 additions & 2 deletions ckan/templates/user/partials/login_form.html
@@ -1,8 +1,8 @@
{% import 'macros/form.html' as form %}

<form action="{{ c.login_handler }}" method="post" class="form-horizontal">
{{ form.input('login', label="Username", id='field-login', value="", error="", classes=["control-full"]) }}
{{ form.input('password', label="Password", id='field-password', type="password", value="", error="", classes=["control-full"]) }}
{{ form.input('login', label="Username", id='field-login', value="", error="", classes=["control-medium"]) }}
{{ form.input('password', label="Password", id='field-password', type="password", value="", error="", classes=["control-medium"]) }}
{{ form.checkbox('remember', label="Remember me", id='field-remember', checked=true, value="63072000") }}
<div class="form-actions">
<button class="btn btn-primary" type="submit">{{ _('Log in') }}</button>
Expand Down
4 changes: 2 additions & 2 deletions ckan/templates/user/request_reset.html
Expand Up @@ -10,13 +10,13 @@

{% block primary_content %}
<article class="module">
<h1 class="heading">{{ _('Reset Your Password') }}</h1>
<div class="content">
<h1 class="page-heading">{{ _('Reset Your Password') }}</h1>
{% block form %}
<form action="" method="post" class="form-inline control-medium">
<label for="field-username">Username</label>
<input id="field-username" name="user" value="" />
<button type="submit" name="reset" class="btn btn-primary">{{ _("Request Reset") }}</button>
<button class="btn btn-large btn-primary" type="submit" name="reset">{{ _("Request Reset") }}</button>
</form>
{% endblock %}
</div>
Expand Down

0 comments on commit f56ce8a

Please sign in to comment.