mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-10 06:04:18 +00:00
new ui code in angular
This commit is contained in:
parent
2c33493741
commit
0fda377b8c
42 changed files with 3248 additions and 303 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@
|
|||
*.DS_STORE
|
||||
db.*
|
||||
venv*
|
||||
node_modules
|
|
@ -1 +1,2 @@
|
|||
Paul Hallett paulandrewhallett@gmail.com
|
||||
Zane Adickes zaneadix@gmail.com
|
12
assets/css/bootstrap.min.css
vendored
Executable file → Normal file
12
assets/css/bootstrap.min.css
vendored
Executable file → Normal file
File diff suppressed because one or more lines are too long
BIN
assets/fonts/lato-regular/lato-regular.eot
Executable file
BIN
assets/fonts/lato-regular/lato-regular.eot
Executable file
Binary file not shown.
2836
assets/fonts/lato-regular/lato-regular.svg
Executable file
2836
assets/fonts/lato-regular/lato-regular.svg
Executable file
File diff suppressed because it is too large
Load diff
After Width: | Height: | Size: 201 KiB |
BIN
assets/fonts/lato-regular/lato-regular.ttf
Executable file
BIN
assets/fonts/lato-regular/lato-regular.ttf
Executable file
Binary file not shown.
BIN
assets/fonts/lato-regular/lato-regular.woff
Executable file
BIN
assets/fonts/lato-regular/lato-regular.woff
Executable file
Binary file not shown.
BIN
assets/fonts/lato-regular/lato-regular.woff2
Executable file
BIN
assets/fonts/lato-regular/lato-regular.woff2
Executable file
Binary file not shown.
3
assets/js/app.min.js
vendored
Normal file
3
assets/js/app.min.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
!function(){"use strict";angular.module("pokeapi_v2",["pokeapi-header"]).config(["$locationProvider","$httpProvider",function(e,o){e.html5Mode(!0),o.defaults.xsrfCookieName="csrftoken",o.defaults.xsrfHeaderName="X-CSRFToken"}])}();
|
||||
!function(){"use strict";angular.module("pokeapi-header",[])}();
|
||||
"use strict";angular.module("pokeapi-header").directive("pokeapiHeader",function(){return{restrict:"A",templateUrl:"static/views/header.html",replace:!0}});
|
9
assets/v1/css/bootstrap.min.css
vendored
Executable file
9
assets/v1/css/bootstrap.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
0
assets/js/jquery.js → assets/v1/js/jquery.js
vendored
0
assets/js/jquery.js → assets/v1/js/jquery.js
vendored
|
@ -4,7 +4,7 @@ import os
|
|||
|
||||
PROJECT_ROOT = Path(__file__).ancestor(2)
|
||||
|
||||
DEBUG = False
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
|
@ -50,7 +50,10 @@ STATIC_ROOT = PROJECT_ROOT.child('assets')
|
|||
STATIC_URL = '/assets/'
|
||||
|
||||
STATICFILES_DIRS = (
|
||||
|
||||
PROJECT_ROOT.child('assets'),
|
||||
# '/pokemon/assets/',
|
||||
# '/pokemon_v2/assets/'
|
||||
)
|
||||
|
||||
STATICFILES_FINDERS = (
|
||||
|
@ -83,7 +86,7 @@ WSGI_APPLICATION = 'config.wsgi.application'
|
|||
|
||||
TEMPLATE_DIRS = (
|
||||
PROJECT_ROOT.child('templates'),
|
||||
|
||||
PROJECT_ROOT + 'pokemon/templates'
|
||||
)
|
||||
|
||||
DATABASES = {
|
||||
|
|
120
config/urls.py
120
config/urls.py
|
@ -2,124 +2,20 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import patterns, include, url
|
||||
from django.conf.urls import url, include
|
||||
from django.conf.urls.static import static
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from django.contrib import admin
|
||||
admin.autodiscover()
|
||||
from pokemon import urls as pokemon_urls
|
||||
from pokemon_v2 import urls as pokemon_v2_urls
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
url(r'^', include(pokemon_urls)),
|
||||
|
||||
##################################
|
||||
#
|
||||
# V1 API setup using Tastypie
|
||||
#
|
||||
##################################
|
||||
|
||||
from tastypie.api import Api
|
||||
|
||||
from pokemon.api import (
|
||||
PokemonResource, TypeResource, AbilityResource, GameResource,
|
||||
SpriteResource, DescriptionResource, EggResource, MoveResource,
|
||||
PokedexResource
|
||||
)
|
||||
|
||||
api_resources = Api()
|
||||
api_resources.register(PokemonResource())
|
||||
api_resources.register(AbilityResource())
|
||||
api_resources.register(TypeResource())
|
||||
api_resources.register(GameResource())
|
||||
api_resources.register(SpriteResource())
|
||||
api_resources.register(DescriptionResource())
|
||||
api_resources.register(EggResource())
|
||||
api_resources.register(MoveResource())
|
||||
api_resources.register(PokedexResource())
|
||||
|
||||
|
||||
#####################################
|
||||
#
|
||||
# V2 API setup using Django Rest
|
||||
#
|
||||
#####################################
|
||||
|
||||
from rest_framework import routers
|
||||
from pokemon_v2.views import *
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
|
||||
router.register(r"ability", AbilityResource)
|
||||
router.register(r"berry", BerryResource)
|
||||
router.register(r"berry-firmness", BerryFirmnessResource)
|
||||
router.register(r"berry-flavor", BerryFlavorResource)
|
||||
router.register(r"characteristic", CharacteristicResource)
|
||||
router.register(r"contest-type", ContestTypeResource)
|
||||
router.register(r"contest-effect", ContestEffectResource)
|
||||
router.register(r"egg-group", EggGroupResource)
|
||||
router.register(r"encounter-method", EncounterMethodResource) # ?
|
||||
router.register(r"encounter-condition", EncounterConditionResource) # ?
|
||||
router.register(r"encounter-condition-value", EncounterConditionValueResource) # ?
|
||||
router.register(r"evolution-chain", EvolutionChainResource)
|
||||
router.register(r"evolution-trigger", EvolutionTriggerResource)
|
||||
router.register(r"generation", GenerationResource)
|
||||
router.register(r"gender", GenderResource)
|
||||
router.register(r"growth-rate", GrowthRateResource)
|
||||
router.register(r"item", ItemResource)
|
||||
router.register(r"item-category", ItemCategoryResource)
|
||||
router.register(r"item-attribute", ItemAttributeResource)
|
||||
router.register(r"item-fling-effect", ItemFlingEffectResource)
|
||||
router.register(r"item-pocket", ItemPocketResource)
|
||||
router.register(r"language", LanguageResource)
|
||||
router.register(r"location", LocationResource)
|
||||
router.register(r"location-area", LocationAreaResource)
|
||||
router.register(r"move", MoveResource)
|
||||
router.register(r"move-ailment", MoveMetaAilmentResource)
|
||||
router.register(r"move-battle-style", MoveBattleStyleResource)
|
||||
router.register(r"move-category", MoveMetaCategoryResource)
|
||||
router.register(r"move-damage-class", MoveDamageClassResource)
|
||||
router.register(r"move-learn-method", MoveLearnMethodResource)
|
||||
router.register(r"move-target", MoveTargetResource)
|
||||
router.register(r"nature", NatureResource)
|
||||
router.register(r"pal-park-area", PalParkAreaResource)
|
||||
router.register(r"pokedex", PokedexResource)
|
||||
router.register(r"pokemon", PokemonResource)
|
||||
router.register(r"pokemon-color", PokemonColorResource)
|
||||
router.register(r"pokemon-form", PokemonFormResource)
|
||||
router.register(r"pokemon-habitat", PokemonHabitatResource)
|
||||
router.register(r"pokemon-shape", PokemonShapeResource)
|
||||
router.register(r"pokemon-species", PokemonSpeciesResource)
|
||||
router.register(r"pokeathlon-stat", PokeathlonStatResource)
|
||||
router.register(r"region", RegionResource)
|
||||
router.register(r"stat", StatResource)
|
||||
router.register(r"super-contest-effect", SuperContestEffectResource)
|
||||
router.register(r"type", TypeResource)
|
||||
router.register(r"version", VersionResource)
|
||||
router.register(r"version-group", VersionGroupResource)
|
||||
|
||||
|
||||
###########################
|
||||
#
|
||||
# Gotta Get Em' All
|
||||
#
|
||||
###########################
|
||||
|
||||
urlpatterns = patterns(
|
||||
|
||||
'',
|
||||
|
||||
url(r'^$', 'config.views.home'),
|
||||
|
||||
url(r'^docs/$',
|
||||
TemplateView.as_view(template_name='pages/docs.html'),
|
||||
name="documentation"),
|
||||
|
||||
url(r'^about/$', 'config.views.about'),
|
||||
url(r'^', include(pokemon_v2_urls)),
|
||||
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
|
||||
url(r'^api/', include(api_resources.urls)),
|
||||
|
||||
url(r'^api/v2/', include(router.urls)),
|
||||
|
||||
url(r'^media/(?P<path>.*)',
|
||||
'django.views.static.serve',
|
||||
{'document_root': settings.MEDIA_ROOT}),
|
||||
|
@ -128,4 +24,4 @@ urlpatterns = patterns(
|
|||
'django.views.static.serve',
|
||||
{'document_root': settings.STATIC_ROOT}),
|
||||
|
||||
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
79
gulpfile.js
Normal file
79
gulpfile.js
Normal file
|
@ -0,0 +1,79 @@
|
|||
|
||||
var gulp = require('gulp'),
|
||||
plumber = require('gulp-plumber'),
|
||||
jshint = require('gulp-jshint'),
|
||||
stylish = require('jshint-stylish'),
|
||||
concat = require('gulp-concat'),
|
||||
flatten = require('gulp-flatten'),
|
||||
browserSync = require('browser-sync').create(),
|
||||
uglify = require('gulp-uglify');
|
||||
|
||||
var client = {
|
||||
|
||||
html: {
|
||||
|
||||
'partials': 'pokemon_v2/client/components/**/views/*.html'
|
||||
},
|
||||
|
||||
scripts: [
|
||||
'pokemon_v2/client/app.js',
|
||||
'pokemon_v2/client/components/**/scripts/*-module.js',
|
||||
'pokemon_v2/client/components/**/scripts/*-routes.js',
|
||||
'pokemon_v2/client/components/**/scripts/*-filters.js',
|
||||
'pokemon_v2/client/components/**/scripts/*-service.js',
|
||||
'pokemon_v2/client/components/**/scripts/*-directive.js',
|
||||
'pokemon_v2/client/components/**/scripts/*-controller.js'
|
||||
],
|
||||
}
|
||||
|
||||
var out = {
|
||||
|
||||
scripts: 'assets/js',
|
||||
|
||||
partials: 'pokemon_v2/templates/partials'
|
||||
}
|
||||
|
||||
|
||||
gulp.task('html', function () {
|
||||
|
||||
return gulp.src(client.html.partials)
|
||||
.pipe(flatten())
|
||||
.pipe(gulp.dest(out.partials));
|
||||
});
|
||||
|
||||
|
||||
gulp.task('scripts', function () {
|
||||
|
||||
return gulp.src(client.scripts)
|
||||
.pipe(plumber())
|
||||
.pipe(jshint())
|
||||
.pipe(jshint.reporter(stylish))
|
||||
.pipe(uglify())
|
||||
.pipe(concat('app.min.js'))
|
||||
.pipe(gulp.dest(out.scripts));
|
||||
});
|
||||
|
||||
|
||||
gulp.task('watch', function () {
|
||||
|
||||
// gulp.watch(client.styles.src, ['styles']);
|
||||
gulp.watch(client.html.partials, ['html']);
|
||||
gulp.watch(client.scripts, ['scripts']);
|
||||
});
|
||||
|
||||
|
||||
gulp.task('sync', function () {
|
||||
|
||||
browserSync.init({
|
||||
|
||||
port : 3000,
|
||||
// files : server.all,
|
||||
logLevel : 'info', // info, debug, warn ,silent
|
||||
// middleware : [fallback],
|
||||
proxy : 'localhost:8000'
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
gulp.task('default', ['html', 'scripts']);
|
||||
gulp.task('start', ['default', 'watch', 'sync']);
|
16
package.json
Normal file
16
package.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "pokeapi",
|
||||
"version": "2.0.0",
|
||||
"description": "A RESTful api for pokemon data",
|
||||
"dependencies": {
|
||||
"browser-sync": "^2.10.1",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-flatten": "^0.2.0",
|
||||
"gulp-jshint": "^2.0.0",
|
||||
"gulp-plumber": "^1.0.1",
|
||||
"gulp-uglify": "^1.5.1",
|
||||
"jshint": "^2.8.0",
|
||||
"jshint-stylish": "^2.1.0"
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "base-v1.html" %}
|
||||
|
||||
{% block mainbody %}
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "base-v1.html" %}
|
||||
|
||||
{% block title %}Page Not found{% endblock %}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "base-v1.html" %}
|
||||
{% load humanize %}
|
||||
{% block mainbody %}
|
||||
|
||||
|
@ -17,9 +17,9 @@
|
|||
</div>
|
||||
<div class="collapse navbar-collapse navbar-right">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/v1/">Home</a></li>
|
||||
<li class="active"><a href="#">About</a></li>
|
||||
<li><a href="/docs/">Documentation</a></li>
|
||||
<li><a href="/v1/docs/">Documentation</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
|
@ -10,16 +10,16 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="Pokeapi The Pokemon RESTful API">
|
||||
<meta name="author" content="Paul Hallett">
|
||||
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/static/css/custom.css" rel="stylesheet">
|
||||
<link href="/static/v1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/static/v1/css/custom.css" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js">
|
||||
</script>
|
||||
<![endif]-->
|
||||
<link rel="shortcut icon" href="/static/favicon.ico">
|
||||
<script src="/static/js/jquery.js">
|
||||
<script src="/static/v1/js/jquery.js">
|
||||
</script>
|
||||
<script src="/static/js/bootstrap.min.js">
|
||||
<script src="/static/v1/js/bootstrap.min.js">
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "base-v1.html" %}
|
||||
|
||||
{% block mainbody %}
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
|||
</div>
|
||||
<div class="collapse navbar-collapse navbar-right">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/about/">About</a></li>
|
||||
<li><a href="/v1/">Home</a></li>
|
||||
<li><a href="/v1/about/">About</a></li>
|
||||
<li class="active"><a href="#">Documentation</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "base-v1.html" %}
|
||||
{% load humanize %}
|
||||
{% block mainbody %}
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
|||
<div class="collapse navbar-collapse navbar-right">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="active"><a href="#">Home</a></li>
|
||||
<li><a href="/about/">About</a></li>
|
||||
<li><a href="/docs/">Documentation</a></li>
|
||||
<li><a href="/v1/about/">About</a></li>
|
||||
<li><a href="/v1/docs/">Documentation</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
48
pokemon/urls.py
Normal file
48
pokemon/urls.py
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf.urls import patterns, include, url
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from django.contrib import admin
|
||||
admin.autodiscover()
|
||||
|
||||
##################################
|
||||
#
|
||||
# V1 API setup using Tastypie
|
||||
#
|
||||
##################################
|
||||
|
||||
from tastypie.api import Api
|
||||
|
||||
from pokemon.api import (
|
||||
PokemonResource, TypeResource, AbilityResource, GameResource,
|
||||
SpriteResource, DescriptionResource, EggResource, MoveResource,
|
||||
PokedexResource
|
||||
)
|
||||
|
||||
api_resources = Api()
|
||||
api_resources.register(PokemonResource())
|
||||
api_resources.register(AbilityResource())
|
||||
api_resources.register(TypeResource())
|
||||
api_resources.register(GameResource())
|
||||
api_resources.register(SpriteResource())
|
||||
api_resources.register(DescriptionResource())
|
||||
api_resources.register(EggResource())
|
||||
api_resources.register(MoveResource())
|
||||
api_resources.register(PokedexResource())
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
url(r'^v1/$', 'pokemon.views.home'),
|
||||
|
||||
url(r'^v1/docs/$',
|
||||
TemplateView.as_view(template_name='docs-v1.html'),
|
||||
name="documentation"
|
||||
),
|
||||
|
||||
url(r'^v1/about/$', 'pokemon.views.about'),
|
||||
|
||||
url(r'^api/', include(api_resources.urls)),
|
||||
]
|
|
@ -58,7 +58,7 @@ def about(request):
|
|||
average_day = int(round(total_views / ResourceView.objects.count()))
|
||||
|
||||
return render_to_response(
|
||||
'pages/about.html',
|
||||
'about-v1.html',
|
||||
{
|
||||
'total': total_views,
|
||||
'average_day': average_day,
|
||||
|
@ -76,7 +76,7 @@ def home(request):
|
|||
total_views = int(round(total_views, -2))
|
||||
|
||||
return render_to_response(
|
||||
'pages/home.html',
|
||||
'home-v1.html',
|
||||
{
|
||||
'total_views': total_views,
|
||||
},
|
21
pokemon_v2/client/app.js
Normal file
21
pokemon_v2/client/app.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular.module('pokeapi_v2', [
|
||||
'pokeapi-header'
|
||||
])
|
||||
|
||||
.config(['$locationProvider', '$httpProvider',
|
||||
|
||||
function ($locationProvider, $httpProvider) {
|
||||
|
||||
$locationProvider.html5Mode(true);
|
||||
|
||||
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
|
||||
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
|
||||
}
|
||||
]);
|
||||
|
||||
})();
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
angular.module('pokeapi-header')
|
||||
|
||||
.directive('pokeapiHeader', function () {
|
||||
|
||||
return {
|
||||
|
||||
restrict: 'A',
|
||||
|
||||
templateUrl: 'static/views/header.html',
|
||||
|
||||
replace: true
|
||||
};
|
||||
|
||||
});
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular.module('pokeapi-header', []);
|
||||
|
||||
})();
|
12
pokemon_v2/client/components/header/views/header.html
Normal file
12
pokemon_v2/client/components/header/views/header.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
<header>
|
||||
|
||||
<span>Pokeapi</span>
|
||||
|
||||
<ul>
|
||||
<li><a ui-sref="home">Home</a></li>
|
||||
<li><a ui-sref="about">About</a></li>
|
||||
<li><a ui-sref="docs">Documentation</a></li>
|
||||
</ul>
|
||||
|
||||
</header>
|
60
pokemon_v2/templates/base.html
Normal file
60
pokemon_v2/templates/base.html
Normal file
|
@ -0,0 +1,60 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<!-- A project by Paul Hallett - http://phalt.co - https://github.com/phalt/pokeapi -->
|
||||
<!-- Collaborators: -->
|
||||
<!-- Zane Adickes - https://github.com/zaneadix/ -->
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title> Pokéapi - The Pokemon RESTful API </title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="Pokeapi The Pokemon RESTful API">
|
||||
<meta name="author" content="Paul Hallett">
|
||||
<meta name="author" content="Zane Adickes">
|
||||
|
||||
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="/static/favicon.ico">
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body ng-app="pokeapi_v2">
|
||||
|
||||
{% block mainbody %}
|
||||
|
||||
{% endblock mainbody %}
|
||||
|
||||
<!--
|
||||
<hr class="">
|
||||
|
||||
<div class="footer">
|
||||
<p>
|
||||
<a href="http://phalt.co?ref=pokeapi" target="_blank">© Paul Hallett
|
||||
<script type="text/javascript">
|
||||
document.write(new Date().getFullYear());
|
||||
</script>
|
||||
</a>
|
||||
|
||||
<span class="pull-right">
|
||||
<a href="https://twitter.com/phalt_" class="twitter-follow-button" data-show-count="false" data-show-screen-name="false" data-dnt="true">Follow me on twitter</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
||||
<iframe src="http://ghbtns.com/github-btn.html?user=phalt&type=follow" allowtransparency="false" frameborder="0" scrolling="0" width="132" height="20"></iframe>
|
||||
</span>
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
-->
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
10
pokemon_v2/templates/home.html
Normal file
10
pokemon_v2/templates/home.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block mainbody %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
12
pokemon_v2/templates/partials/header.html
Normal file
12
pokemon_v2/templates/partials/header.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
<header>
|
||||
|
||||
<span>Pokeapi</span>
|
||||
|
||||
<ul>
|
||||
<li><a ui-sref="home">Home</a></li>
|
||||
<li><a ui-sref="about">About</a></li>
|
||||
<li><a ui-sref="docs">Documentation</a></li>
|
||||
</ul>
|
||||
|
||||
</header>
|
81
pokemon_v2/urls.py
Normal file
81
pokemon_v2/urls.py
Normal file
|
@ -0,0 +1,81 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf.urls import patterns, include, url
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
#####################################
|
||||
#
|
||||
# V2 API setup using Django Rest
|
||||
#
|
||||
#####################################
|
||||
|
||||
from rest_framework import routers
|
||||
from pokemon_v2.api import *
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
|
||||
router.register(r"ability", AbilityResource)
|
||||
router.register(r"berry", BerryResource)
|
||||
router.register(r"berry-firmness", BerryFirmnessResource)
|
||||
router.register(r"berry-flavor", BerryFlavorResource)
|
||||
router.register(r"characteristic", CharacteristicResource)
|
||||
router.register(r"contest-type", ContestTypeResource)
|
||||
router.register(r"contest-effect", ContestEffectResource)
|
||||
router.register(r"egg-group", EggGroupResource)
|
||||
router.register(r"encounter-method", EncounterMethodResource)
|
||||
router.register(r"encounter-condition", EncounterConditionResource)
|
||||
router.register(r"encounter-condition-value", EncounterConditionValueResource)
|
||||
router.register(r"evolution-chain", EvolutionChainResource)
|
||||
router.register(r"evolution-trigger", EvolutionTriggerResource)
|
||||
router.register(r"generation", GenerationResource)
|
||||
router.register(r"gender", GenderResource)
|
||||
router.register(r"growth-rate", GrowthRateResource)
|
||||
router.register(r"item", ItemResource)
|
||||
router.register(r"item-category", ItemCategoryResource)
|
||||
router.register(r"item-attribute", ItemAttributeResource)
|
||||
router.register(r"item-fling-effect", ItemFlingEffectResource)
|
||||
router.register(r"item-pocket", ItemPocketResource)
|
||||
router.register(r"language", LanguageResource)
|
||||
router.register(r"location", LocationResource)
|
||||
router.register(r"location-area", LocationAreaResource)
|
||||
router.register(r"move", MoveResource)
|
||||
router.register(r"move-ailment", MoveMetaAilmentResource)
|
||||
router.register(r"move-battle-style", MoveBattleStyleResource)
|
||||
router.register(r"move-category", MoveMetaCategoryResource)
|
||||
router.register(r"move-damage-class", MoveDamageClassResource)
|
||||
router.register(r"move-learn-method", MoveLearnMethodResource)
|
||||
router.register(r"move-target", MoveTargetResource)
|
||||
router.register(r"nature", NatureResource)
|
||||
router.register(r"pal-park-area", PalParkAreaResource)
|
||||
router.register(r"pokedex", PokedexResource)
|
||||
router.register(r"pokemon", PokemonResource)
|
||||
router.register(r"pokemon-color", PokemonColorResource)
|
||||
router.register(r"pokemon-form", PokemonFormResource)
|
||||
router.register(r"pokemon-habitat", PokemonHabitatResource)
|
||||
router.register(r"pokemon-shape", PokemonShapeResource)
|
||||
router.register(r"pokemon-species", PokemonSpeciesResource)
|
||||
router.register(r"pokeathlon-stat", PokeathlonStatResource)
|
||||
router.register(r"region", RegionResource)
|
||||
router.register(r"stat", StatResource)
|
||||
router.register(r"super-contest-effect", SuperContestEffectResource)
|
||||
router.register(r"type", TypeResource)
|
||||
router.register(r"version", VersionResource)
|
||||
router.register(r"version-group", VersionGroupResource)
|
||||
|
||||
|
||||
###########################
|
||||
#
|
||||
# Gotta Get Em' All
|
||||
#
|
||||
###########################
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
url(r'^$',
|
||||
TemplateView.as_view(template_name='home.html'),
|
||||
name="home"
|
||||
),
|
||||
|
||||
url(r'^api/v2/', include(router.urls)),
|
||||
]
|
|
@ -1,58 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
{% load humanize %}
|
||||
{% block mainbody %}
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="navbar-brand">
|
||||
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://pokeapi.co" data-text="Pokéapi - the Pokémon RESTful API " data-via="phalt_" data-related="phalt_">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navbar-right">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/about/">About</a></li>
|
||||
<li><a href="/docs/">Documentation</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="header col-md-8">
|
||||
<h1>PokeAPI moderation</h1>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
</div><!-- /.header row -->
|
||||
<div class="row pad_top">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<ul>
|
||||
<li><a href="/moderate/pokemon/">Pokemon</a></li>
|
||||
<li>Moves</li>
|
||||
<li>Descriptions</li>
|
||||
<li>Games</li>
|
||||
<li>Items</li>
|
||||
<li>Berries</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
</div><!--row-->
|
||||
|
||||
</div><!-- /.container -->
|
||||
|
||||
{% endblock %}
|
|
@ -1,55 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
{% load humanize %}
|
||||
{% block mainbody %}
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="navbar-brand">
|
||||
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://pokeapi.co" data-text="Pokéapi - the Pokémon RESTful API " data-via="phalt_" data-related="phalt_">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navbar-right">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/about/">About</a></li>
|
||||
<li><a href="/docs/">Documentation</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="header col-md-8">
|
||||
<h1>PokeAPI moderation - Pokemon</h1>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
</div><!-- /.header row -->
|
||||
<div class="row pad_top">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<ul>
|
||||
{% for p in pokemon %}
|
||||
<li><a href="/moderate/pokemon/{{ p.pkdx_id }}/">{{ p.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
</div><!--row-->
|
||||
|
||||
</div><!-- /.container -->
|
||||
|
||||
{% endblock %}
|
|
@ -1,51 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
{% load humanize %}
|
||||
{% block mainbody %}
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="navbar-brand">
|
||||
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://pokeapi.co" data-text="Pokéapi - the Pokémon RESTful API " data-via="phalt_" data-related="phalt_">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navbar-right">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/about/">About</a></li>
|
||||
<li><a href="/docs/">Documentation</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="header col-md-8">
|
||||
<h1>PokeAPI moderation - {{pokemon.name}}</h1>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
</div><!-- /.header row -->
|
||||
<div class="row pad_top">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
{{form.as_p}}
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
</div><!--row-->
|
||||
|
||||
</div><!-- /.container -->
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in a new issue