Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap 3 upgrade #89

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 0.2.4 (2021-02-17)


### Fixed

- Do not prefix absolute HTTP URLs of uploaded image
([#107](https://github.com/ckan/ckanext-pages/pull/107))


## 0.2.3 (2020-09-24)

Expand Down
2 changes: 1 addition & 1 deletion ckanext/pages/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# encoding: utf-8

__version__ = u'0.2.3'
__version__ = u'0.2.4'
4 changes: 2 additions & 2 deletions ckanext/pages/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ def pages_upload(context, data_dict):
'upload', 'clear_upload')
upload.upload(uploader.get_max_image_size())
image_url = data_dict.get('image_url')
if image_url:
if image_url and image_url[0:6] not in {'http:/', 'https:'}:
image_url = h.url_for_static(
'uploads/page_images/%s' % image_url,
qualified = True
qualified=True
)
return {'url': image_url}

Expand Down
2 changes: 1 addition & 1 deletion ckanext/pages/textbox/templates/textbox_form.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="control-group">
<div class="form-group">
<label for="field-content-ck" class="control-label">{{ _('Content') }}</label>
</div>
<textarea id="field-content-ck" name="content" placeholder="{{_('My content')}}" data-module="textbox" style="height:400px" data-module-site_url="{{ h.dump_json(h.url('/', locale='default', qualified=true)) }}"> {{ data.content }}</textarea>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,9 @@
border-top: 1px solid #ddd !important;
}*/
}
.input-append,
.input-prepend {
.input-group{
&.date {
.add-on i {
.input-group-addon i {
display: block;
cursor: pointer;
width: 16px;
Expand Down
9 changes: 9 additions & 0 deletions ckanext/pages/theme/resources/styles/pages.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@
.page-list-item h3 a {
display: block;
}
.form-control-panel {
margin-top: 20px;
border-top: 1px solid #e5e5e5;
padding: 19px 20px 20px 0;
}

.form-control-panel button {
float: right;
}
11 changes: 11 additions & 0 deletions ckanext/pages/theme/resources/styles/pages.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,14 @@
.page-list-item h3 a {
display:block;
}

.form-control-panel {
margin-top: 20px;
border-top: 1px solid #e5e5e5;
padding: 19px 20px 20px 0;

button {
float: right;
}
}

40 changes: 24 additions & 16 deletions ckanext/pages/theme/templates_main/ckanext_pages/base_form.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% import 'macros/form.html' as form %}
{% import 'macros/pages_form.html' as form %}
{% import 'macros/wysiwyg.html' as wysiwyg %}

{% set data = data or {} %}
Expand Down Expand Up @@ -60,10 +60,10 @@ <h1>{{ _('Edit page') }}</h1>

{#{{ form.input('name', id='field-name', label=_('Name'), placeholder=_('my-name'), value=data.name, error=errors.name, classes=['control-full']) }}#}

<div class="control-group">
<label for="field-private" class="control-label">{{ _('Visibility') }}</label>
<div class="controls">
<select id="field-private" class="form-control" name="private">
<div class="form-group">
<label for="field-private" class="control-label col-sm-3">{{ _('Visibility') }}</label>
<div class="col-sm-9">
<select id="field-private" class="form-control " name="private">
{% for option in [(true, _('Private')), (false, _('Public'))] %}
<option value="{{ option[0] }}" {% if option[0] == data.private %}selected="selected"{% endif %}>{{ option[1] }}</option>
{% endfor %}
Expand All @@ -72,9 +72,9 @@ <h1>{{ _('Edit page') }}</h1>
</div>

{% if not hide_field_order %}
<div class="control-group">
<label for="field-order" class="control-label">{{ _('Header Order') }}</label>
<div class="controls">
<div class="form-group">
<label for="field-order" class="control-label col-sm-3">{{ _('Menu Order') }}</label>
<div class="col-sm-9">
<select id="field-order" class="form-control" name="order">
{% for option in [('', _('Not in Menu')), ('1','1'), ('2', '2'), ('3', '3') , ('4', '4')] %}
<option value="{{ option[0] }}" {% if option[0] == data.order %}selected="selected"{% endif %}>{{ option[1] }}</option>
Expand All @@ -89,28 +89,36 @@ <h1>{{ _('Edit page') }}</h1>
{{ wysiwyg.editor('content', id='field-content', label=_('Content'), placeholder=_('Enter content here'), value=data.content|safe, error=errors.content) }}
{% elif editor == 'ckeditor' %}
{% resource 'ckanext-pages/main' %}
<div class="control-group">
<label for="field-content-ck" class="control-label">{{ _('Content') }}</label>
<div class="form-group">
<label for="field-content-ck" class="control-label col-sm-3">{{ _('Content') }}</label>
</div>
<textarea id="field-content-ck" name="content" placeholder="{{_('My content')}}" data-module="ckedit" style="height:400px" data-module-site_url="{{ h.dump_json(h.url('/', locale='default', qualified=true)) }}"> {{ data.content }}</textarea>
{% else %}
{{ form.markdown('content', id='field-content', label=_('Content'), placeholder=_('Enter content here'), value=data.content, error=errors.content) }}
{% endif %}

<div class="form-actions">
<div class="form-group form-control-panel">
{% if not page %}
<a class="btn pull-left" href="{{ cancel_url }}">{{ _('Cancel') }}</a>
<button class="btn btn-primary" name="save" value="save" type="submit">{{ _('Add') }}</button>
<div class="col-sm-2">
<a class="btn pull-left" href="{{ cancel_url }}">{{ _('Cancel') }}</a>
</div>

<div class="col-sm-2 col-sm-offset-8">
<button class="btn btn-primary" name="save" value="save" type="submit">{{ _('Add') }}</button>
</div>
{% else %}

{% block delete_button %}
{% if h.check_access('ckanext_%spages_delete'|format(type ~ '_' if type in ('group', 'org') else ''), {'id': data.id}) %}
{% set locale = h.dump_json({'content': _('Are you sure you want to delete this Page?')}) %}
<a class="btn btn-danger pull-left" href="{{ delete_url }}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
<div class="col-sm-2">
<a class="btn btn-danger pull-left" href="{{ delete_url }}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
</div>
{% endif %}
{% endblock %}

<button class="btn btn-primary" name="save" value="save" type="submit">{{ _('Save') }}</button>
<div class="col-sm-2 col-sm-offset-8">
<button class="btn btn-primary" name="save" value="save" type="submit">{{ _('Save') }}</button>
</div>
{% endif %}
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
{% block maintag %}<div class="row" role="main">{% endblock %}

{% block main_content %}
<section class="module span6 offset3">
<section class="module col-sm-6 col-sm-offset-3">
<div class="module-content">
{% block form %}
<p>{{ _('Are you sure you want to delete page - {name}?').format(name=c.page_dict.name) }}</p>
<p class="form-actions">
<p class="form-group">
{% set action = form_action or h.url_for('organization_pages_delete', id=c.group_dict.name, page='/' + page) %}
<form action="{{ action }}" method="post">
<button class="btn" type="submit" name="cancel" >{{ _('Cancel') }}</button>
<button class="btn btn-default" type="submit" name="cancel" >{{ _('Cancel') }}</button>
<button class="btn btn-primary" type="submit" name="delete" >{{ _('Confirm Delete') }}</button>
</form>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ <h2>Pages</h2>
{% endif %}
<div class="row page-list-item dataset-item">
{% if page.image %}
<div class="span3 image">
<div class="col-sm-3 image">
<a style="background-image:url({{ page.image }})" href="{{ url }}">
</a>
</div>
<div class="span8">
<div class="col-sm-8">
<h3 class="dataset-heading">
<a href="{{ url }}" >{{ page.title }}</a>
{% if page.publish_date %}
Expand All @@ -52,7 +52,7 @@ <h3 class="dataset-heading">
{% endif %}
</div>
{% else %}
<div class="span11">
<div class="col-sm-11">
<h3 class="dataset-heading">
<a href="{{ url }}" >{{ page.title }}</a>
{% if page.publish_date %}
Expand Down
Loading