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

WIP feat:add fields twitter and github #152

Open
wants to merge 3 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
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions ckanext/showcase/logic/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
4 changes: 4 additions & 0 deletions ckanext/showcase/templates/showcase/new_package_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -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=_('[email protected]'), 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 %}

Expand Down
13 changes: 13 additions & 0 deletions ckanext/showcase/templates/showcase/snippets/showcase_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ <h1 class="heading">{{ pkg.title or pkg.name }}</h1>
<span class="smallest">{{_('Submitted by')}}</span>
<p>{{ pkg.author }}</p>
{% endif %}

{% if pkg.twitter %}
<a href="{{ pkg.twitter }}" target="_blank">
<i class="fa fa-twitter"></i> {{ pkg.twitter }}
</a>
{% endif %}
<br>
{% if pkg.github %}
<a href="{{ pkg.github }}" target="_blank">
<i class="fa fa-github"></i> {{ pkg.github }}
</a>
{% endif %}

{% if pkg.url %}
<div class="info">
<a class="btn btn-primary" href="{{ pkg.url }}" target="_blank">
Expand Down