diff --git a/README.rst b/README.rst index 9ee3d8be..3160dbba 100644 --- a/README.rst +++ b/README.rst @@ -149,6 +149,14 @@ The Showcase extension adds the following pages to the user interface: * To add a Showcase Admin : ``http://127.0.0.1:5000/ckan-admin/showcase_admins`` +--- +Fields +--- + +* Twitter + +* Github + --------------------- Configuration diff --git a/ckanext/showcase/logic/schema.py b/ckanext/showcase/logic/schema.py index 7d8f752d..799823cc 100644 --- a/ckanext/showcase/logic/schema.py +++ b/ckanext/showcase/logic/schema.py @@ -35,12 +35,14 @@ def showcase_base_schema(): schema = { 'id': [empty], 'revision_id': [ignore], - 'name': [not_empty, name_validator, package_name_validator], - 'title': [if_empty_same_as("name"), unicode_safe], - 'author': [ignore_missing, unicode_safe], - 'author_email': [ignore_missing, unicode_safe], - 'notes': [ignore_missing, unicode_safe], - 'url': [ignore_missing, url_validator], + 'name': [not_empty, six.text_type, name_validator, package_name_validator], + 'title': [if_empty_same_as("name"), six.text_type], + 'author': [ignore_missing, six.text_type], + 'author_email': [ignore_missing, six.text_type], + 'twitter': [ignore_missing, six.text_type], + 'github': [ignore_missing, six.text_type], + 'notes': [ignore_missing, six.text_type], + 'url': [ignore_missing, six.text_type], 'state': [ignore_not_package_admin, ignore_missing], 'type': [ignore_missing, unicode_safe], '__extras': [ignore], diff --git a/ckanext/showcase/templates/showcase/new_package_form.html b/ckanext/showcase/templates/showcase/new_package_form.html index 626adafc..6bb99d5d 100644 --- a/ckanext/showcase/templates/showcase/new_package_form.html +++ b/ckanext/showcase/templates/showcase/new_package_form.html @@ -64,6 +64,10 @@ {{ form.input('author', label=_('Submitted By'), id='field-author', placeholder=_('Joe Bloggs'), value=data.author, error=errors.author, classes=['control-medium']) }} {{ form.input('author_email', label=_('Submitter Email'), id='field-author-email', placeholder=_('joe@example.com'), value=data.author_email, error=errors.author_email, classes=['control-medium']) }} + + {{ form.input('twitter', label=_('Submitter Twitter'), id='field-twitter', placeholder=_('https://www.twitter.com/jtweets'), type="url", value=data.twitter, error=errors.twitter, classes=['control-medium']) }} + + {{ form.input('github', label=_('Submitter GitHub'), id='field-github', placeholder=_('https://github.com/jcodes'), type="url", value=data.github, error=errors.github, classes=['control-medium']) }} {% endblock %} {% endblock %} diff --git a/ckanext/showcase/templates/showcase/snippets/showcase_info.html b/ckanext/showcase/templates/showcase/snippets/showcase_info.html index fb1e3a0f..d2bd705a 100644 --- a/ckanext/showcase/templates/showcase/snippets/showcase_info.html +++ b/ckanext/showcase/templates/showcase/snippets/showcase_info.html @@ -21,6 +21,19 @@

{{ pkg.title or pkg.name }}

{{_('Submitted by')}}

{{ pkg.author }}

{% endif %} + + {% if pkg.twitter %} + + {{ pkg.twitter }} + + {% endif %} +
+ {% if pkg.github %} + + {{ pkg.github }} + + {% endif %} + {% if pkg.url %}