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

Partially addresses #45 #56

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Demo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssdd
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
recursive-include ckanext/pages/textbox *
recursive-include ckanext/pages/theme *
recursive-include ckanext/pages/fanstatic *
graft ckanext
include *.py
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Branches:

- master: What's getting installed on our systems.
- master_clean_29: current( as of ckan 2.9) upstream tag 0.2.3 with our rebased master changes on it.
- upstream: Upstream master, with tags.
- a bunch of other ones that may not be necessary








[![Build Status](https://travis-ci.org/ckan/ckanext-pages.svg?branch=master)](https://travis-ci.org/ckan/ckanext-pages)
[![Coverage Status](https://coveralls.io/repos/ckan/ckanext-pages/badge.svg?branch=master&service=github)](https://coveralls.io/github/ckan/ckanext-pages?branch=master)
ckanext-pages
Expand Down
7 changes: 6 additions & 1 deletion ckanext/pages/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,17 @@ def pages_show(self, page=None, page_type='page'):
p.toolkit.c.page = _page
self._inject_views_into_page(_page)

return p.toolkit.render('ckanext_pages/%s.html' % page_type)
return p.toolkit.render('ckanext_pages/%s.html' % page_type, extra_vars={"pages_name": config.get('ckanext.pages.alternative_name', 'pages').title()})

def pages_index(self):
return self._pages_list_pages('page')

def _pages_list_pages(self, page_type):
#Don't allow normal users to see this, we provide our own custom view
try:
p.toolkit.check_access('ckanext_pages_update', {'user': p.toolkit.c.user})
except p.toolkit.NotAuthorized:
p.toolkit.abort(401, _('Unauthorized to manage pages'))
data_dict={'org_id': None, 'page_type': page_type}
if page_type == 'blog':
data_dict['order_publish_date'] = True
Expand Down
7 changes: 4 additions & 3 deletions ckanext/pages/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def build_pages_nav_main(*args):

page_name = ''

if (toolkit.c.action in ('pages_show', 'blog_show')
if (getattr(toolkit.c, 'action', None) in ('pages_show', 'blog_show')
and toolkit.c.controller == 'ckanext.pages.controller:PagesController'):
page_name = toolkit.c.environ['routes.url'].current().split('/')[-1]

Expand Down Expand Up @@ -136,6 +136,7 @@ def get_helpers(self):
}

def after_map(self, map):
pages_name = config.get('ckanext.pages.alternative_name', 'pages')
controller = 'ckanext.pages.controller:PagesController'

if self.organization_pages:
Expand Down Expand Up @@ -163,9 +164,9 @@ def after_map(self, map):
action='pages_delete', ckan_icon='delete', controller=controller)
map.connect('pages_edit', '/pages_edit{page:/.*|}',
action='pages_edit', ckan_icon='edit', controller=controller)
map.connect('pages_index', '/pages',
map.connect('pages_index', '/%s' % pages_name,
action='pages_index', ckan_icon='file', controller=controller, highlight_actions='pages_edit pages_index pages_show')
map.connect('pages_show', '/pages{page:/.*|}',
map.connect('pages_show', '/%s{page:/.*|}' % pages_name,
action='pages_show', ckan_icon='file', controller=controller, highlight_actions='pages_edit pages_index pages_show')
map.connect('pages_upload', '/pages_upload',
action='pages_upload', controller=controller)
Expand Down
4 changes: 3 additions & 1 deletion ckanext/pages/theme/resources/styles/pages.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
.page-list-item .image {
width: 168px;
/* hack for default theme */

}
.page-list-item .image a {
display: block;
Expand All @@ -15,3 +14,6 @@
.page-list-item h3 a {
display: block;
}
.page-simple-form-height {
height: 400px !important;
}
3 changes: 3 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,6 @@
.page-list-item h3 a {
display:block;
}
.page-simple-form-height {
height: 400px !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ <h1>{{ _('Edit page') }}</h1>
</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) }}
{{ form.markdown('content', id='field-content', attrs={'class': 'form-control page-simple-form-height'}, label=_('Content'), placeholder=_('Enter content here'), value=data.content, error=errors.content) }}
{% endif %}

<div class="form-actions">
Expand Down
11 changes: 11 additions & 0 deletions ckanext/pages/theme/templates_main/ckanext_pages/page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
{#
pages_name - what we call pages
#}

{% extends 'page.html' %}

{% block breadcrumb_content %}
<li><a href="/home">Home</a></li>
{% if c.page.name != "home" %}
<li class="active">{% link_for c.page.title|truncate(35), controller='ckanext.pages.controller:PagesController', action='pages_show', page='/' + c.page.name %}</li>
{% endif %}
{% endblock %}

{% block subtitle %}{{ c.page.title }}{% endblock %}

{% block primary %}
Expand Down
26 changes: 10 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
# encoding: utf-8

import io
import os.path
import re

from setuptools import setup, find_packages
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path

here = path.abspath(path.dirname(__file__))

# Get the long description from the relevant file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

# Extract version
HERE = os.path.abspath(os.path.dirname(__file__))
INIT_PY = os.path.join(HERE, 'ckanext', 'pages', '__init__.py')
version = None
with io.open(INIT_PY) as f:
for line in f:
m = re.match(r'__version__\s*=\s*u?[\'"](.*)[\'"]', line)
if m:
version = m.groups()[0]
break
if version is None:
raise RuntimeError('Could not extract version from "{}".'.format(INIT_PY))


setup(
name='ckanext-pages',
version=version,
version='',
description='Basic CMS extension for ckan',
long_description='',
long_description=long_description,
classifiers=[
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 5 - Production/Stable',
Expand Down