This repository has been archived by the owner on Apr 9, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
955 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,3 +100,5 @@ node_modules | |
!.elasticbeanstalk/*.cfg.yml | ||
!.elasticbeanstalk/*.global.yml | ||
.sass-cache | ||
|
||
local.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from django import forms | ||
|
||
LICENSE_CHOICES = ( | ||
('ALL-$', 'Use for commercial purposes'), | ||
('ALL-MOD', 'Modify, adapt, or build upon') | ||
) | ||
# Search within only these fields | ||
FIELD_CHOICES = ( | ||
('title', 'Title'), | ||
('creator', 'Creator'), | ||
('tags', 'Tags') | ||
) | ||
|
||
# Types of work | ||
WORK_TYPES = ( | ||
('photos', 'Photographs'), | ||
('cultural', 'Cultural works'), | ||
) | ||
WORK_TYPE_DEFAULT = [wt[0] for wt in WORK_TYPES] | ||
FIELD_DEFAULT = [field[0] for field in FIELD_CHOICES] | ||
|
||
|
||
class SearchForm(forms.Form): | ||
search = forms.CharField(label='Search', max_length=1000) | ||
licenses = forms.MultipleChoiceField(label='License', choices=LICENSE_CHOICES) | ||
search_fields = forms.MultipleChoiceField(label='Fields', choices=FIELD_CHOICES) | ||
work_types = forms.MultipleChoiceField(label='Work type', choices=WORK_TYPES) | ||
|
||
class ListForm(forms.Form): | ||
title = forms.CharField(label='Title') | ||
description = forms.CharField(label='Description', widget=forms.Textarea) | ||
is_public = forms.BooleanField(label='Is public?', required=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{% import "includes/license-logo.html" as license_logo %} | ||
{% import "includes/lists.html" as lists %} | ||
|
||
{% macro show(detail_url, image) -%} | ||
<div class="shrink columns t-image-result image-result"> | ||
<figure> | ||
<div class="figure-wrapper"> | ||
<a href="{{ detail_url }}" class="t-detail-link"> | ||
<img src="{{ image.thumbnail }}" class="thumbnail" width="200" /> | ||
</a> | ||
</div> | ||
<figcaption> | ||
{{ image.title|truncate(20) }} | ||
{% if image.creator %} by | ||
{% if image.creator_url %} | ||
<a href="{{ image.creator_url }}">{{ image.creator }}</a> | ||
{% else %} | ||
{{ image.creator }} | ||
{% endif %} | ||
{% endif %} | ||
</figcaption> | ||
</figure> | ||
<div class="figure-metadata"> | ||
{{ license_logo.license(image.license) }} | ||
{% if image.identifier %} | ||
{{ lists.add(image.identifier, size="small") }} | ||
{% endif %} | ||
|
||
{% if caller %} | ||
{{ caller() }} | ||
{% endif %} | ||
</div> | ||
|
||
</div> | ||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% macro license(l) -%} | ||
<img src="{{ url_for('static', filename='images/' + l.lower() + '.png')}}" alt="{{ l.upper() }}" title="{{ l }}" class="license-logo" /> | ||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% macro add(identifier, size) -%} | ||
<div class="add-to-list-container"> | ||
<button onClick="openledger.list.addToListForm(event)" title="Save to List" alt="Save to List" | ||
{% if size == "large" %} | ||
class="button success fi-list-bullet"> | ||
Save to List | ||
|
||
{% else %} | ||
class="button success tiny fi-list-bullet"> | ||
|
||
{% endif %} | ||
</button> | ||
|
||
<form class="add-to-list animated" action="#" method="GET"> | ||
<input type="text" name="title" value="" autocomplete="off" placeholder="Save to new or existing list" size="40"/> | ||
<div class="autocomplete"></div> | ||
<input type="hidden" name="identifier" value="{{ identifier }}" /> | ||
</form> | ||
<div class="add-to-list-response"></div> | ||
</div> | ||
{% endmacro -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
{% macro paginate_api(page, pages, search_data, provider) -%} | ||
<div class="row column text-center"> | ||
<ul class="pagination" role="navigation" aria-label="Pagination"> | ||
|
||
<li class="pagination-previous {{ "disabled" if page == 1 else ""}}"> | ||
{% if page > 1 %} | ||
<a aria-label="Previous page" href="{{ url_for('by_provider', provider=provider, page=search_data.page-1, per_page=search_data.per_page, licenses=search_data.licenses, search=search_data.search) }}">Previous</a> | ||
{% else %} | ||
Previous | ||
{% endif %} | ||
</li> | ||
|
||
<li class="pagination-next {{ "disabled" if page >= pages else ""}}"> | ||
{% if page < pages %} | ||
<a aria-label="Next page" href="{{ url_for('by_provider', provider=provider, page=search_data.page+1, per_page=search_data.per_page, licenses=search_data.licenses, search=search_data.search) }}">Next</a> | ||
{% else %} | ||
Next | ||
{% endif %} | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
{%- endmacro %} | ||
|
||
{% macro paginate_openledger(page, pages, search_data) -%} | ||
<div class="row column text-center"> | ||
<ul class="pagination" role="navigation" aria-label="Pagination"> | ||
|
||
<li class="pagination-previous {{ "disabled" if page == 1 }}"> | ||
{% if page > 1 %} | ||
<a aria-label="Previous page" href="{{ url_for('fulltext', page=page-1, **search_data) }}">Previous</a> | ||
{% else %} | ||
Previous | ||
{% endif %} | ||
</li> | ||
|
||
<li class="pagination-next {{ "disabled" if page >= pages }}"> | ||
{% if page < pages %} | ||
<a aria-label="Next page" href="{{ url_for('fulltext', page=page+1, **search_data) }}">Next</a> | ||
{% else %} | ||
Next | ||
{% endif %} | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<form method="GET" action="{{ endpoint }}" class="search-form"> | ||
<div class="row"> | ||
<div class="column medium-8"> | ||
|
||
{% if not endpoint.endswith('provider-apis') %} | ||
<p> | ||
Find images to use or remix from organizations and individuals | ||
supporting open content: | ||
</p> | ||
{% endif %} | ||
<div class="search-field-container"> | ||
<i class="fi-magnifying-glass"></i> | ||
{{ form.search(placeholder="Search...") }} | ||
<input type="submit" class="button" value="GO" /> | ||
</div> | ||
|
||
<small>Searches to try: <a href="{{ endpoint }}?search=paris&search_fields=title&search_fields=tags">paris</a> | <a href="{{ endpoint }}?search=sunset&search_fields=title&search_fields=tags">sunset</a> | <a href="{{ endpoint }}?search=open&search_fields=title&search_fields=tags">open</a> </small> | ||
</div> | ||
<div class="column search-filters"> | ||
|
||
<div class="row"> | ||
|
||
<div class="column shrink search-filters-license"> | ||
<fieldset> | ||
<legend> | ||
Find images I can... | ||
</legend> | ||
{{ form.licenses }} | ||
</fieldset> | ||
</div> | ||
<div class="column shrink"> | ||
{% if not endpoint.endswith('provider-apis') %} | ||
<fieldset> | ||
<legend style="margin-right: 1rem"> | ||
Search within: | ||
</legend> | ||
{{ form.search_fields }} | ||
</fieldset> | ||
</div> | ||
<div class="column shrink"> | ||
<fieldset> | ||
<legend style="margin-right: 1rem"> | ||
Find these types of works: | ||
</legend> | ||
{{ form.work_types }} | ||
</fieldset> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!doctype html> | ||
<title>Open Ledger prototype</title> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.2.3/foundation-flex.min.css"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css"> | ||
|
||
|
||
{% block head %}{% endblock head %} | ||
|
||
<body> | ||
<nav class="top-bar"> | ||
<div class="top-bar-title"> | ||
<a href="'fulltext'">Open Ledger Search Prototype</a> | ||
</div> | ||
<div class="top-bar-left"> | ||
<a href="#">Search via Provider APIs</a> | ||
</div> | ||
<div class="top-bar-right"> | ||
<div> | ||
<a href="#">Sign out</a> | ||
<a href="#">Sign in</a> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
|
||
{% block body %}{% endblock %} | ||
|
||
<footer class="callout secondary"> | ||
<p> | ||
This is a prototype of the <a href="https://creativecommons.org/2016/07/15/meeting-debrief-next-steps-challenge-attribution-view-source-3d-printing/">Open Ledger</a>, aggregating data from publicly available repositories of open content. | ||
</p> | ||
<p> | ||
<a href="https://github.com/creativecommons/open-ledger/">Github repository</a> | ||
</p> | ||
</footer> | ||
|
||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{% extends "base.html" %} | ||
{% import "includes/license-logo.html" as license_logo %} | ||
{% import "includes/lists.html" as lists %} | ||
|
||
{% block body %} | ||
|
||
<div class="callout hero"> | ||
<div class="column text-center"> | ||
|
||
|
||
<figure> | ||
<img src="{{ url }}" /> | ||
</figure> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="column metadata"> | ||
<h3>About this photo</h3> <ul> | ||
<li> | ||
<h4>Title</h4> | ||
<span>{{ title }}</span> | ||
</li> | ||
{% if creator %} | ||
<li> | ||
<h4>Creator</h4> | ||
<span> | ||
{% if creator_url %} | ||
<a href="{{ creator_url }}">{{ creator }}</a> | ||
{% else %} | ||
{{ creator }} | ||
{% endif %} | ||
</span> | ||
</li> | ||
{% endif %} | ||
<li> | ||
<h4>License</h4> | ||
<a href="{{ license_url }}">{{ license_logo.license(license) }}</a> | ||
</li> | ||
<li> | ||
<a href="{{ provider_url }}">Original source</a> | ||
</li> | ||
</ul> | ||
{% if image and image.tags %} | ||
{% for tag in image.tags %} | ||
<span class="secondary label">{{ tag.name }}</span> | ||
{% endfor %} | ||
{% endif %} | ||
</div> | ||
<div class="column"> | ||
<h3>How to use this work</h3> | ||
<blockquote class="attribution"> | ||
<a href="{{ provider_url }}">“{{ title }}”</a> | ||
{% if creator %} | ||
by | ||
<i> | ||
{% if creator_url %} | ||
<a href="{{ creator_url }}">{{ creator }}</a> | ||
{% else %} | ||
{{ creator }} | ||
{% endif %} | ||
</i> | ||
{% endif %} | ||
|
||
is licensed under | ||
<a href="{{ license_url }}">CC {{ license|upper }} {{ license_version }}</a> | ||
</blockquote> | ||
<button class="attribution-button button clipboard-sel-text primary" data-clipboard-target=".attribution"> | ||
<span class="fi-page-copy"></span> | ||
Copy credit as text | ||
</button> | ||
<button class="attribution-button button clipboard-sel-html secondary"> | ||
<span class="fi-page-copy"></span> | ||
Copy credit as HTML | ||
</button> | ||
|
||
{% if image %} {# Local objects only for now #} | ||
{{ lists.add(image.identifier, size="large") }} | ||
{% endif %} | ||
</div> | ||
|
||
|
||
|
||
</div> | ||
</div> | ||
|
||
{% endblock body %} | ||
|
||
{% block head %} | ||
{% set page_title = title + " via the Creative Commons Open Ledger" %} | ||
{% set description = "Openly licensed image '" + title + "'" %} | ||
{% set page_url = "https://openledger.creativecommons.org/" + request.path %} | ||
|
||
<!-— facebook open graph tags --> | ||
<meta property="og:type" content="website" /> | ||
<meta property="og:url" content="{{ page_url }}" /> | ||
<meta property="og:title" content="{{ page_title }}" /> | ||
<meta property="og:description" content="{{ description }}" /> | ||
<meta property="og:image" content="{{ url }}" /> | ||
|
||
<!-— twitter card tags additive with the og: tags --> | ||
<meta name="twitter:card" content="summary_large_image"> | ||
<meta name="twitter:domain" value="creativecommons.org" /> | ||
<meta name="twitter:title" value="{{ page_title }}" /> | ||
<meta name="twitter:description" value="{{ description }}" /> | ||
<meta name="twitter:image" content="{{ url }}" /> | ||
<meta name="twitter:url" value="{{ page_url }}" /> | ||
<meta name="twitter:label1" value="Open license" /> | ||
<meta name="twitter:data1" value="{{ license|upper }}" /> | ||
|
||
{% endblock head %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{% import "includes/license-logo.html" as license_logo %} | ||
{% import "includes/lists.html" as lists %} | ||
|
||
{% macro show(detail_url, image) -%} | ||
<div class="shrink columns t-image-result image-result"> | ||
<figure> | ||
<div class="figure-wrapper"> | ||
<a href="{{ detail_url }}" class="t-detail-link"> | ||
<img src="{{ image.thumbnail }}" class="thumbnail" width="200" /> | ||
</a> | ||
</div> | ||
<figcaption> | ||
{{ image.title|truncate(20) }} | ||
{% if image.creator %} by | ||
{% if image.creator_url %} | ||
<a href="{{ image.creator_url }}">{{ image.creator }}</a> | ||
{% else %} | ||
{{ image.creator }} | ||
{% endif %} | ||
{% endif %} | ||
</figcaption> | ||
</figure> | ||
<div class="figure-metadata"> | ||
{{ license_logo.license(image.license) }} | ||
{% if image.identifier %} | ||
{{ lists.add(image.identifier, size="small") }} | ||
{% endif %} | ||
|
||
{% if caller %} | ||
{{ caller() }} | ||
{% endif %} | ||
</div> | ||
|
||
</div> | ||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% macro license(l) -%} | ||
<img src="{{ url_for('static', filename='images/' + l.lower() + '.png')}}" alt="{{ l.upper() }}" title="{{ l }}" class="license-logo" /> | ||
{%- endmacro %} |
Oops, something went wrong.