aboutsummaryrefslogtreecommitdiffstats
path: root/webface
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-03-21 18:53:43 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-03-21 18:53:43 -0700
commit33492754881a27c88f6a1ed38e463bba15ecf837 (patch)
treee290f0719bc14c2d9590112652f8864ab9246229 /webface
parentd66fed95534d7a443e2cf84e9290d0c9bdf72311 (diff)
downloadfatcat-33492754881a27c88f6a1ed38e463bba15ecf837.tar.gz
fatcat-33492754881a27c88f6a1ed38e463bba15ecf837.zip
merge front and back
Diffstat (limited to 'webface')
-rw-r--r--webface/static/robots.txt1
-rw-r--r--webface/templates/base.html70
-rw-r--r--webface/templates/home.html32
-rw-r--r--webface/templates/work_add.html215
-rw-r--r--webface/templates/work_view.html37
-rwxr-xr-xwebface/webface.py87
6 files changed, 0 insertions, 442 deletions
diff --git a/webface/static/robots.txt b/webface/static/robots.txt
deleted file mode 100644
index a168f11b..00000000
--- a/webface/static/robots.txt
+++ /dev/null
@@ -1 +0,0 @@
-# Hello friends!
diff --git a/webface/templates/base.html b/webface/templates/base.html
deleted file mode 100644
index 4e9dcd4b..00000000
--- a/webface/templates/base.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<html lang="en" style="position: relative; min-height: 100%; height: auto;">
-<head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width">
-
- <title>{% block title %}fatcat!{% endblock %}</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.2.13/dist/semantic.min.css">
- <script
- src="https://code.jquery.com/jquery-3.1.1.min.js"
- integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
- crossorigin="anonymous"></script>
- <script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.2.13/dist/semantic.min.js"></script>
-
-</head>
-<body style="margin-bottom: 100px; height: auto;">
-
-<header class="ui fixed inverted menu">
- <div class="ui container">
- <a href="/" class="header item">
- <!-- <img class="logo" src="assets/images/logo.png"> -->
- fatcat!
- </a>
- <a href="/about" class="item">About</a>
- <a href="#" class="item">Guide</a>
- <div class="right menu">
- <div class="item">
- <div class="ui transparent inverted icon input">
- <i class="search icon"></i>
- <input type="text" placeholder="Search...">
- </div>
- </div>
- <div class="ui simple dropdown item">
- acidburn <i class="dropdown icon"></i>
- <div class="menu">
- <a class="item" href="#">Open Submissions</a>
- <a class="item" href="#">Edit History</a>
- <div class="divider"></div>
- <a class="item" href="/account">Account</a>
- <a class="item" href="/logout">Logout</a>
- </div>
- </div>
-
- </div>
- </div>
-</header>
-
-<main class="ui main text container" style="margin-top: 4em; margin-bottom: 2em;">
-{% block body %}Nothing to see here.{% endblock %}
-</main>
-
-
-<footer class="ui inverted vertical footer segment" style="margin-top: 2em; padding-top: 2em; padding-bottom:2em; position: absolute; bottom: 0px; width: 100%;">
- <div class="ui center aligned container">
- <div class="ui horizontal inverted small divided link list">
- <span class="item">fatcat!</span>
- <a class="item" href="/about">About</a>
- <a class="item" href="/sources">Sources</a>
- <a class="item" href="#">Status</a>
- <a class="item" href="#">Datasets</a>
- <a class="item" href="https://git.bnewbold.net/fatcat/">Source Code</a>
- </div>
- </div>
-</footer>
-
-{% block postscript %}{% endblock %}
-
-</body>
-</html>
diff --git a/webface/templates/home.html b/webface/templates/home.html
deleted file mode 100644
index d9cc34a2..00000000
--- a/webface/templates/home.html
+++ /dev/null
@@ -1,32 +0,0 @@
-{% extends "base.html" %}
-{% block body %}
-
-<h1>Salutations!</h1>
-
-Just mockups for now...
-
-<ul>
- <li><b>Work:</b>
- <a href="/work/create">Create</a>,
- <a href="/work/random">Random</a>
- <li><b><strike>Release:</strike></b>
- <a href="/release/create">Create</a>,
- <a href="/release/random">Random</a>
- <li><b><strike>File:</strike></b>
- <a href="/file/create">Create</a>,
- <a href="/file/random">Random</a>
- <li><b><strike>Contributor:</strike></b>
- <a href="/contrib/create">Create</a>,
- <a href="/contrib/random">Random</a>
- <li><b><strike>Container:</strike></b>
- <a href="/container/create">Create</a>,
- <a href="/container/random">Random</a>
- <li><b><strike>Publisher:</strike></b>
- <a href="/publisher/create">Create</a>,
- <a href="/publisher/random">Random</a>
- <li>Edit groups...
- <li>Changelog...
- <li>Login/Signup...
-</ul>
-
-{% endblock %}
diff --git a/webface/templates/work_add.html b/webface/templates/work_add.html
deleted file mode 100644
index ac8a8169..00000000
--- a/webface/templates/work_add.html
+++ /dev/null
@@ -1,215 +0,0 @@
-{% extends "base.html" %}
-{% block body %}
-<div class="ui segment">
-<h1 class="ui header">Adding a New Thing</h1>
-
-<form class="ui form" id="add_work_form">
-
- <h3 class="ui dividing header">The Basics</h3>
-
- <div class="ui huge field required">
- <label>Title</label>
- <input name="work_title" type="text" placeholder="Title of Work (in English)">
- </div>
-
- <div class="ui field required">
- <label>Type of Work</label>
- <select class="ui dropdown" id="work_type">
- <option value="">Primary Type</option>
- <option value="journal-article">Journal Article</option>
- <option value="book">Book</option>
- <option value="book-chapter">Book Chapter</option>
- <option value="dataset">Dataset</option>
- <option value="dissertation">Thesis or Dissertation</option>
- <option value="monograph">Monograph</option>
- <option value="proceedings-article">Conference Proceeding</option>
- <option value="report">Report</option>
- <option value="other">Other</option>
- </select>
- </div>
-
- <!-- Primary Creators/Authors -->
- <div class="ui field search" id="work_creators">
- <label>Primary Creator(s)</label>
- <div class="ui icon input">
- <input class="prompt" type="text" placeholder="Search...">
- <i class="search icon"></i>
- </div>
- <div class="results"></div>
- </div>
-
- <!-- Description (not an abstract) -->
- <div class="ui field">
- <label>Description</label>
- <div class="field">
- <label>Not an abstract...</label>
- <textarea rows="2"></textarea>
- </div>
- </div>
-
- <!-- Primary/Original Language -->
- <div class="field">
- <label>Primary Language</label>
- <select class="ui search select dropdown" id="language-select">
- <option value="">Select if Appropriate</option>
- <option value="en">English</option>
- <option value="es">Spanish</option>
- </select>
- </div>
-
- <!-- Subject / Categorization / Tags -->
- <div class="field">
- <label>Subject</label>
- <select multiple="" class="ui dropdown" id="subjects">
- <option value="">Select Subject/Tags</option>
- <option value="AF">Afghanistan</option>
- <option value="AX">Ă…land Islands</option>
- <option value="AL">Albania</option>
- <option value="DZ">Algeria</option>
- <option value="AS">American Samoa</option>
- <option value="AD">Andorra</option>
- <option value="AO">Angola</option>
- </select>
- </div>
-
-
- <h3 class="ui dividing header">Primary Release / Edition</h3>
-
- <!-- Contributors (and how) -->
- <div class="ui field search" id="release_creators">
- <label>Primary Creator(s)</label>
- <div class="ui icon input">
- <input class="prompt" type="text" placeholder="Search...">
- <i class="search icon"></i>
- </div>
- <div class="results"></div>
- </div>
-
- <!-- Date -->
- <!-- Container / Part-Of -->
- <!-- Publisher -->
- <!-- Identifier -->
- <!-- Language -->
- <!-- Type / Media -->
- <!-- Issue / Volume / Pages / Chapter -->
-
- <!-- Anything Else? -->
- <h3 class="ui dividing header">Anything Else?</h3>
-
- <!-- File / Copy / URL -->
- <!-- Citations -->
-
-<div class="ui submit button">Create Work</div>
-</form>
-
-</div>
-{% endblock %}
-
-{% block postscript %}
-<script>
-<!-- Form validation code -->
-$(document).ready(function() {
-
- $('#add_work_form')
- .form({
- fields: {
- name: {
- identifier: 'name',
- rules: [
- {
- type : 'empty',
- prompt : 'Please enter your name'
- }
- ]
- },
- skills: {
- identifier: 'skills',
- rules: [
- {
- type : 'minCount[2]',
- prompt : 'Please select at least two skills'
- }
- ]
- },
- gender: {
- identifier: 'gender',
- rules: [
- {
- type : 'empty',
- prompt : 'Please select a gender'
- }
- ]
- },
- username: {
- identifier: 'username',
- rules: [
- {
- type : 'empty',
- prompt : 'Please enter a username'
- }
- ]
- },
- password: {
- identifier: 'password',
- rules: [
- {
- type : 'empty',
- prompt : 'Please enter a password'
- },
- {
- type : 'minLength[6]',
- prompt : 'Your password must be at least {ruleValue} characters'
- }
- ]
- },
- terms: {
- identifier: 'terms',
- rules: [
- {
- type : 'checked',
- prompt : 'You must agree to the terms and conditions'
- }
- ]
- }
- }
- })
- ;
-
- var example_authors = [
- { title: 'Andorra' },
- { title: 'United Arab Emirates' },
- { title: 'Afghanistan' },
- { title: 'Antigua' },
- { title: 'Anguilla' },
- { title: 'Albania' },
- { title: 'Armenia' },
- { title: 'Netherlands Antilles' },
- { title: 'Angola' },
- { title: 'Argentina' },
- { title: 'American Samoa' },
- { title: 'Austria' },
- { title: 'Australia' },
- { title: 'Aruba' },
- ];
-
- $('#work_creators')
- .search({
- source: example_authors
- })
- ;
-
- $('#release_creators')
- .search({
- source: example_authors
- })
- ;
-
- $('#work_type').dropdown();
- $('#subjects').dropdown();
- $('#language-select').dropdown();
-
- console.log("Page loaded");
-
-});
-</script>
-{% endblock %}
diff --git a/webface/templates/work_view.html b/webface/templates/work_view.html
deleted file mode 100644
index 8c5e955d..00000000
--- a/webface/templates/work_view.html
+++ /dev/null
@@ -1,37 +0,0 @@
-{% extends "base.html" %}
-{% block body %}
-
-<h1>{{ work.title }}</h1>
-
-<p>Work type: {{ work.type }}
-<p><a href="/work/{{ work.id }}/history">History</a>
-<p>Contributors:
-{% for c in work.contributors %} {{ c.name }}; {% endfor %}
-
-{% if primary %}
-<h2>Primary Release/Edition</h2>
-<p>Title: {{ primary.title }}
-<p>Date: {{ primary.date }}
-
-{% if primary.container %}
-<p>Container: <a href="/container/{{ primary.container.id }}">{{ primary.container.title }}</a>
-{% endif %}
-
-{% if primary.doi %}
-<p>DOI: <a href="https://dx.doi.org/{{ primary.doi }}">{{ primary.doi }}</a>
-{% endif %}
-
-{% else %}
-<p>No primary release
-{% endif %}
-
-{% if releases %}
-<ul>
-{% for r in releases %}
- <ul><a href="/release/{{ r.id }}">{{ r.title }}</a> ({{ y.date }} - {{ y.release_type }})
-{% endfor %}
-</ul>
-{% else %}
-{% endif %}
-
-{% endblock %}
diff --git a/webface/webface.py b/webface/webface.py
deleted file mode 100755
index 33833e25..00000000
--- a/webface/webface.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python3
-
-import os
-import argparse
-import requests
-from flask import Flask, render_template, send_from_directory, request, \
- url_for, abort, g, redirect, jsonify
-
-app = Flask(__name__)
-app.config.from_object(__name__)
-
-
-### Views ###################################################################
-
-@app.route('/health', methods=['GET'])
-def health():
- return jsonify({'ok': True})
-
-@app.route('/work/create', methods=['GET'])
-def work_create():
- return render_template('work_add.html')
-
-@app.route('/work/random', methods=['GET'])
-def work_random():
- work = {
- "title": "Structure and Interpretation",
- "work_type": "book",
- "date": None,
- "contributors": [
- {"name": "Alyssa P. Hacker"},
- ],
- "primary": {
- "title": "Structure and Interpretation",
- "release_type": "online",
- "date": "2000-01-01",
- "doi": "10.491/599.sdo14",
- },
- "releases": [
- ]
- }
- return render_template('work_view.html', work=work, primary=work['primary'])
-
-@app.route('/work/<work_id>/random', methods=['GET'])
-def work_view(work_id):
- return render_template('work_view.html')
-
-
-### Static Routes ###########################################################
-
-@app.route('/', methods=['GET'])
-def homepage():
- return render_template('home.html')
-
-@app.route('/about', methods=['GET'])
-def aboutpage():
- return render_template('about.html')
-
-@app.route('/robots.txt', methods=['GET'])
-def robots():
- return send_from_directory(os.path.join(app.root_path, 'static'),
- 'robots.txt',
- mimetype='text/plain')
-
-
-### Entry Point #############################################################
-
-def main():
- parser = argparse.ArgumentParser()
- parser.add_argument('--debug',
- action='store_true',
- help="enable debugging interface")
- parser.add_argument('--host',
- default="127.0.0.1",
- help="listen on this host/IP")
- parser.add_argument('--port',
- type=int,
- default=5050,
- help="listen on this port")
- parser.add_argument('--backend-api',
- default="localhost:6060",
- help="backend API to connect to")
- args = parser.parse_args()
-
- app.run(debug=args.debug, host=args.host, port=args.port)
-
-if __name__ == '__main__':
- main()