Compare commits

..
Author SHA1 Message Date
Maygician
4fab170b9f longass recursion quit 2020-10-05 23:03:17 +07:00
Maygician
e420e51b7d error codes 2020-10-05 22:55:00 +07:00
Maygician
9a58a57120 excess link removed 2020-10-05 22:39:21 +07:00
Maygician
0312b9b9f6 todo added 2020-10-05 22:33:40 +07:00
Maygician
6a264009ee poison dep added. todo - fix it 2020-10-05 22:32:23 +07:00
Maygician
6cc08b1575 gh example hotfix2 2020-10-05 22:26:58 +07:00
Maygician
2a698bf26c gh example hotfix 2020-10-05 22:25:12 +07:00
Maygician
2d8a7c38e0 gh example implementation 0.0.1 2020-10-05 22:20:08 +07:00
Maygician
3465ba12fc daemon mode for server 2020-10-05 20:38:23 +07:00
Maygician
3a475208b2 router oauth2 2020-10-05 20:09:49 +07:00
Maygician
fe5e036c3e minor template changes 2020-10-05 20:05:30 +07:00
Maygician
b55e84acd1 attempt to discard http 2020-10-05 19:23:30 +07:00
Maygician
df1cb0c766 sh path fixed 2 2020-10-05 18:13:01 +07:00
Maygician
efada54b3e sh path fixed 2020-10-05 18:10:19 +07:00
Maygician
473f3bb68c typo fixed 2020-10-05 17:53:20 +07:00
Maygician
fdc7d9f1e1 self certs 2020-10-05 17:44:12 +07:00
Maygician
3e76b51dc7 .vscode 2020-10-05 17:24:53 +07:00
Maygician
d15372540c rel.sh port fixed 2020-10-05 17:02:26 +07:00
Maygician
daf319d786 github auth 2020-10-05 16:59:48 +07:00
Maygician
a0c024ae1f dev ssl 2020-10-04 16:13:56 +07:00
Maygician
5899204f38 config fixed, doing tables 2020-10-04 11:28:38 +07:00
Maygician
26b141290e - haml. not working anyways 2020-10-04 10:18:49 +07:00
Maygician
9baa501dab Js is back 2020-10-04 00:04:22 +07:00
Maygician
39b2bb6a0e uglified 2020-10-04 00:01:25 +07:00
Maygician
2fb13d873e haml and markdown template engines added 2020-10-03 23:01:02 +07:00
Maygician
f465b2270e minified, cleared 2020-10-03 21:02:51 +07:00
Maygician
310fa6828d server:true 2020-10-03 13:52:17 +07:00
Maygician
9101b7f6ae +statics 2020-10-03 13:32:06 +07:00
Maygician
b3242851a9 few shells 2020-10-03 13:23:48 +07:00
Maygician
93a2b5b53d getting cache_static_manifest back 2020-10-03 12:30:41 +07:00
Maygician
dd807c55dc prod secret. don't do that 2020-10-03 12:27:12 +07:00
Maygician
0969da9ef9 swap on ssd on GCP 2020-10-03 11:53:45 +07:00
Maygician
1e0dd39074 no docker. crude instruction for now 2020-10-03 10:26:27 +07:00
Maygician
52cf31fccd docker devenv WIP 2020-10-02 23:05:38 +07:00
Maygician
6202776133 +docs folder 2020-10-02 22:41:26 +07:00
Maygician
f627567374 phoenix live empty 2020-10-02 22:40:35 +07:00
87 changed files with 12121 additions and 6 deletions

7
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"elixirLS.projectDir": "lp",
"files.associations":
{
"*.lmay":"yaml"
},
}

View file

@ -1,7 +1,2 @@
# GCLP
GameCult Labor Platform. This repo holds only a `LICENSE` (MIT) and this file: it was created on 2 October 2020 and never received code. It is dormant.
The platform existed only as a design. The write-up is the `05.labor-platform` page of the archived `GameCult/gamecult-grav` repo (`pages/05.labor-platform/default.md`): a web app where members sign in with GitHub, browse and volunteer for outstanding issues across GameCult projects, and earn contribution points, backed by an application and database that talk to GitHub. That design is planned, not built here, and there is no successor implementation.
Nothing in this repo is runnable. For current GameCult work, start at `GameCult/gamecult-site` (the public site) or the org's repo list.
GameCult Labor Platform

30
deploy/GCP deploy Normal file
View file

@ -0,0 +1,30 @@
# commands from dev env should work.
# you'd need to add prod database to env, like this (don't use this exact one)
# export DATABASE_URL=ecto://postgres:postgres@localhost/lp_dev
# and gen a secret:
export SECRET_KEY_BASE=`mix phx.gen.secret`
# open ports you want to use for prod in firewall rules(instance settings)
# then add port you want to env:
# export PORT=80085 #this one won't work, obviously. put proper one here
# as I'm using micro instance with ssd, let's add swap :c
# use blkid to get uuid
# add the folloving line:
# UUID=XXXX-XXXX-XXXX-XXXX-XXXX /gssd ext4 errors=remount-ro 0 1
# to /etc/fstab
#sudo sed -e '2iUUID=XXXX-XXXX-XXXX-XXXX-XXXX \/gssd ext4 errors=remount-ro 0 1' -i /etc/fstab
#sudo sed -e '2iUUID=ba0f9619-0a64-4e35-9de0-0cd63af25c0c \/gssd ext4 errors=remount-ro 0 1' -i /etc/fstab
sudo mkfs.ext4 /dev/sdb
sudo mount -t ext4 /dev/sdb /gssd
sudo fallocate -l 4G /gssd/swapfile
sudo chmod 600 /gssd/swapfile
sudo mkswap /gssd/swapfile
sudo sed -e '2i\/gssd\/swapfile swap swap defaults 0 0' -i /etc/fstab
git clone https://github.com/GameCult/GCLP.git
cd GCLP
# git checkout pet # for now
cd lp
mix deps.get
mix deps.compile
mix ecto.create
# fetch prod.exs config file

20
deploy/rel.sh Normal file
View file

@ -0,0 +1,20 @@
#!/bin/bash
# don't forget to modify it, according to your db credentials
if [ -z "$DATABASE_URL"]; then
echo 'export DATABASE_URL=ecto://postgres:postgres@localhost/lp_dev' >> ~/.bashrc
fi
if [ -z "$SECRET_KEY_BASE"]; then
key=`mix phx.gen.secret`
echo 'export SECRET_KEY_BASE='$key >> ~/.bashrc
fi
if [ -z "$PORT"]; then
echo 'export PORT=80' >> ~/.bashrc
# echo 'export PORT=443' >> ~/.bashrc that was a mistake. it is http port in prod
fi
# and cert paths
if [ -z "$GCLP_SSL_KEY_PATH"]; then
echo 'export GCLP_SSL_KEY_PATH=~/GCLP/lp/priv/cert/selfsigned_key.pem' >> ~/.bashrc
fi
if [ -z "$GCLP_APP_SSL_CERT_PATH"]; then
echo 'export GCLP_APP_SSL_CERT_PATH=~/GCLP/lp/priv/cert/selfsigned.pem' >> ~/.bashrc
fi

26
deploy/release.sh Normal file
View file

@ -0,0 +1,26 @@
#!/bin/bash
cd ../lp
sudo _build/prod/rel/lp/bin/lp stop
# git pull origin pet
mix deps.get --only prod
MIX_ENV=prod mix compile
npm install --prefix ./assets
npm run deploy --prefix ./assets
mix phx.digest # once you have something js related
MIX_ENV=prod mix release
sudo _build/prod/rel/lp/bin/lp daemon
# note, that it is running in terminal
# start Starts the system
# start_iex Starts the system with IEx attached
# daemon Starts the system as a daemon
# daemon_iex Starts the system as a daemon with IEx attached
# eval "EXPR" Executes the given expression on a new, non-booted system
# rpc "EXPR" Executes the given expression remotely on the running system
# remote Connects to the running system via a remote shell
# restart Restarts the running system via a remote command
# stop Stops the running system via a remote command
# pid Prints the operating system PID of the running system via a remote command
# version Prints the release name and version to be booted

View file

@ -0,0 +1,10 @@
#todo
version: 3.8
services:
elixir_dev:
build:
context: ./elixir_dev
ports:
- 4000:4000
volumes:
- "./volumes/elixir:/elixir"

View file

@ -0,0 +1,54 @@
FROM ubuntu:18.04
# install ubuntu packages
RUN apt-get update -q \
&& apt-get install -y \
git \
curl \
locales \
build-essential \
autoconf \
libncurses5-dev \
libwxgtk3.0-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libpng-dev \
libssh-dev \
unixodbc-dev \
&& apt-get clean
# install asdf and its plugins
# ASDF will only correctly install plugins into the home directory as of 0.7.5
# so .... Just go with it.
ENV ASDF_ROOT /root/.asdf
ENV PATH "${ASDF_ROOT}/bin:${ASDF_ROOT}/shims:$PATH"
RUN git clone https://github.com/asdf-vm/asdf.git ${ASDF_ROOT} --branch v0.7.5 \
&& asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang \
&& asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir \
&& asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs \
&& ${ASDF_ROOT}/plugins/nodejs/bin/import-release-team-keyring
# set the locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# install erlang
ENV ERLANG_VERSION 22.0.7
RUN asdf install erlang ${ERLANG_VERSION} \
&& asdf global erlang ${ERLANG_VERSION}
# install elixir
ENV ELIXIR_VERSION 1.10.3-otp-21
RUN asdf install elixir ${ELIXIR_VERSION} \
&& asdf global elixir ${ELIXIR_VERSION}
# install local Elixir hex and rebar
RUN mix local.hex --force \
&& mix local.rebar --force
# install nodejs
ENV NODEJS_VERSION 12.8.4
RUN asdf install nodejs ${NODEJS_VERSION} \
&& asdf global nodejs ${NODEJS_VERSION}

11
docs/cli log Normal file
View file

@ -0,0 +1,11 @@
mix phx.new lp --live
cd lp
# on local machine, for dev
# needs postgres, default credentials are postgres/postgres
# see: lp/config/dev.exs
mix ecto create
mix deps get
mix deps compile
# self-signed ssl cert, localhost for dev
mix phx.gen.cert

30
docs/dev env Normal file
View file

@ -0,0 +1,30 @@
# todo: docker
# On windows - just install wsl2 (see https://docs.microsoft.com/en-us/windows/wsl/install-win10 )
# then ubuntu, preferably 18.04lts
# after that, just use ubuntu commands.
# might use this, for skipping prompts during installation
export DEBIAN_FRONTEND=noninteractive #not really helping
#
sudo apt-get install wget ca-certificates
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.deb
sudo apt-get update
sudo apt-get install esl-erlang elixir inotify-tools nodejs npm yarn python git
mix local.hex --force
mix local.rebar --force
mix archive.install hex phx_new 1.5.5
# postgres:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
# create default user postgre with password postgres in database postgres
# (that's what phoenix expects by default. see /config/dev.exs)
sudo -u postgres psql postgres
\password postgres
postgres
postgres
quit
# now you are good to go. feel free to add here if I missed something or contact me

3
docs/notes Normal file
View file

@ -0,0 +1,3 @@
in production, you would usually deal with static assets at application server layer, possibly not hitting Phoenix at all.
uses https only on port 443 in dev

View file

@ -0,0 +1,17 @@
# lmay = yaml.
# in vs code, Open Settings (JSON):
#
# "files.associations":
# {
# "*.lmay":"yaml"
# },
# or feel free to rename it ^_^
folders:
lib:
description: all sources
files:
lib/lp_web/:
router.ex:
notes:

2
docs/skills/elixir Normal file
View file

@ -0,0 +1,2 @@
mix.exs -> put deps here
func (a)+b -> func((a)+b) ;brackets are added implicitly

10
docs/skills/phoenix.lmay Normal file
View file

@ -0,0 +1,10 @@
version: 1.5.5
facts:
- you need controller, in order to serve route
- you also need view
- if you want html - must rename it to html.eex and add controller+view
- minimal /lib/templates/layout/root is "<%= @inner_content %>"
- you get one generated for you, when running "mix phx.gen.live "
- live uses websockets

2
docs/todo.md Normal file
View file

@ -0,0 +1,2 @@
create docker development environment
fix github requiring poison, instead of jason

5
lp/.formatter.exs Normal file
View file

@ -0,0 +1,5 @@
[
import_deps: [:ecto, :phoenix],
inputs: ["*.{ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{ex,exs}"],
subdirectories: ["priv/*/migrations"]
]

42
lp/.gitignore vendored Normal file
View file

@ -0,0 +1,42 @@
# The directory Mix will write compiled artifacts to.
/_build/
# If you run "mix test --cover", coverage assets end up here.
/cover/
# The directory Mix downloads your dependencies sources to.
/deps/
# Where 3rd-party dependencies like ExDoc output generated docs.
/doc/
# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch
# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump
# Also ignore archive artifacts (built via "mix archive.build").
*.ez
# Ignore package tarball (built via "mix hex.build").
lp-*.tar
# If NPM crashes, it generates a log, let's ignore it too.
npm-debug.log
# The directory NPM downloads your dependencies sources to.
/assets/node_modules/
# Since we are building assets from assets/,
# we ignore priv/static. You may want to comment
# this depending on your deployment strategy.
# /priv/static/
/priv/secret/*
/priv/cert/
# find the way to get your prod secret to prod server
# leaving you an example
/config/prod.exs
/config/prod.secret.exs
/config/github.exs

20
lp/README.md Normal file
View file

@ -0,0 +1,20 @@
# Lp
To start your Phoenix server:
* Install dependencies with `mix deps.get`
* Create and migrate your database with `mix ecto.setup`
* Install Node.js dependencies with `npm install` inside the `assets` directory
* Start Phoenix endpoint with `mix phx.server`
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
## Learn more
* Official website: https://www.phoenixframework.org/
* Guides: https://hexdocs.pm/phoenix/overview.html
* Docs: https://hexdocs.pm/phoenix
* Forum: https://elixirforum.com/c/phoenix-forum
* Source: https://github.com/phoenixframework/phoenix

5
lp/assets/.babelrc Normal file
View file

@ -0,0 +1,5 @@
{
"presets": [
"@babel/preset-env"
]
}

91
lp/assets/css/app.scss Normal file
View file

@ -0,0 +1,91 @@
/* This file is for your main application css. */
@import "./phoenix.css";
@import "../node_modules/nprogress/nprogress.css";
/* LiveView specific classes for your customizations */
.phx-no-feedback.invalid-feedback,
.phx-no-feedback .invalid-feedback {
display: none;
}
.phx-click-loading {
opacity: 0.5;
transition: opacity 1s ease-out;
}
.phx-disconnected{
cursor: wait;
}
.phx-disconnected *{
pointer-events: none;
}
.phx-modal {
opacity: 1!important;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.4);
}
.phx-modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
.phx-modal-close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.phx-modal-close:hover,
.phx-modal-close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
/* Alerts and form errors */
.alert {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
}
.alert-info {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.alert-warning {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.alert-danger {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.alert p {
margin-bottom: 0;
}
.alert:empty {
display: none;
}
.invalid-feedback {
color: #a94442;
display: block;
margin: -1rem 0 2rem;
}

101
lp/assets/css/phoenix.css Normal file

File diff suppressed because one or more lines are too long

35
lp/assets/js/app.js Normal file
View file

@ -0,0 +1,35 @@
// We need to import the CSS so that webpack will load it.
// The MiniCssExtractPlugin is used to separate it out into
// its own CSS file.
import "../css/app.scss"
// webpack automatically bundles all modules in your
// entry points. Those entry points can be configured
// in "webpack.config.js".
//
// Import deps with the dep name or local files with a relative path, for example:
//
// import {Socket} from "phoenix"
// import socket from "./socket"
//
import "phoenix_html"
import {Socket} from "phoenix"
import NProgress from "nprogress"
import {LiveSocket} from "phoenix_live_view"
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}})
// Show progress bar on live navigation and form submits
window.addEventListener("phx:page-loading-start", info => NProgress.start())
window.addEventListener("phx:page-loading-stop", info => NProgress.done())
// connect if there are any LiveViews on the page
liveSocket.connect()
// expose liveSocket on window for web console debug logs and latency simulation:
// >> liveSocket.enableDebug()
// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session
// >> liveSocket.disableLatencySim()
window.liveSocket = liveSocket

197
lp/assets/js/old.js Normal file
View file

@ -0,0 +1,197 @@
//__________________ https://gamecult.games/user/plugins/backtotop/assets/js/return-to-top.js
// ===== Scroll to Top ====
$(window).scroll(function () {
if ($(this).scrollTop() >= 50) { // If page is scrolled more than 50px
$('#return-to-top').fadeIn(200); // Fade in the arrow
} else {
$('#return-to-top').fadeOut(200); // Else fade out the arrow
}
});
$('#return-to-top').click(function () { // When arrow is clicked
$('body,html').animate({
scrollTop: 0 // Scroll to top of body
}, 500);
});
// __________________ https://gamecult.games/user/plugins/simplesearch/js/simplesearch.js
((function(){
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}
var findAncestor = function(el, selector) {
while ((el = el.parentElement) && !((el.matches || el.matchesSelector).call(el, selector))) {}
return el;
};
var fields = document.querySelectorAll('input[name="searchfield"][data-search-input]');
Array.prototype.forEach.call(fields, function(field) {
var form = findAncestor(field, 'form[data-simplesearch-form]'),
min = field.getAttribute('data-min') || false,
location = field.getAttribute('data-search-input'),
separator = field.getAttribute('data-search-separator');
if (min) {
var invalid = field.getAttribute('data-search-invalid');
field.addEventListener('keydown', function() {
field.setCustomValidity(field.value.length >= min ? '' : invalid);
});
}
form.addEventListener('submit', function(event) {
event.preventDefault();
if (field.checkValidity()) {
window.location.href = location + separator + field.value;
}
});
});
})());
//_______________ https://gamecult.games/user/themes/klb4/js/jquery.treemenu.js
/*
treeMenu - jQuery plugin
version: 0.6
Copyright 2014 Stepan Krapivin
*/
(function($){
$.fn.treemenu = function(options) {
options = options || {};
options.delay = options.delay || 0;
options.openActive = options.openActive || false;
options.closeOther = options.closeOther || false;
options.activeSelector = options.activeSelector || ".active";
this.addClass("treemenu");
if (!options.nonroot) {
this.addClass("treemenu-root");
}
options.nonroot = true;
this.find("> li").each(function() {
e = $(this);
var subtree = e.find('> ul');
var button = e.find('.toggler').eq(0);
if(button.length == 0) {
// create toggler
var button = $('<span>');
button.addClass('toggler');
e.prepend(button);
}
if(subtree.length > 0) {
subtree.hide();
e.addClass('tree-closed');
e.find(button).click(function() {
var li = $(this).parent('li');
if (options.closeOther && li.hasClass('tree-closed')) {
var siblings = li.parent('ul').find("li:not(.tree-empty)");
siblings.removeClass("tree-opened");
siblings.addClass("tree-closed");
siblings.removeClass(options.activeSelector);
siblings.find('> ul').slideUp(options.delay);
}
li.find('> ul').slideToggle(options.delay);
li.toggleClass('tree-opened');
li.toggleClass('tree-closed');
li.toggleClass(options.activeSelector);
});
$(this).find('> ul').treemenu(options);
} else {
$(this).addClass('tree-empty');
}
});
if (options.openActive) {
var cls = this.attr("class");
this.find(options.activeSelector).each(function(){
var el = $(this).parent();
while (el.attr("class") !== cls) {
el.find('> ul').show();
if(el.prop("tagName") === 'UL') {
el.show();
} else if (el.prop("tagName") === 'LI') {
el.removeClass('tree-closed');
el.addClass("tree-opened");
el.show();
}
el = el.parent();
}
});
}
return this;
}
})(jQuery);
//____________________________ https://gamecult.games/user/themes/klb4/js/site.js
var isTouch = window.DocumentTouch && document instanceof DocumentTouch;
function scrollHeader() {
// Has scrolled class on header
var zvalue = $(document).scrollTop();
if ( zvalue > 75 )
$("#header").addClass("scrolled");
else
$("#header").removeClass("scrolled");
}
function parallaxBackground() {
$('.parallax').css('background-positionY', ($(window).scrollTop() * 0.3) + 'px');
}
jQuery(document).ready(function($){
scrollHeader();
// Scroll Events
if (!isTouch){
$(document).scroll(function() {
scrollHeader();
parallaxBackground();
});
};
// Touch scroll
$(document).on({
'touchmove': function(e) {
scrollHeader(); // Replace this with your code.
}
});
//Smooth scroll to start
$('#to-start').click(function(){
var start_y = $('#start').position().top;
var header_offset = 45;
window.scroll({ top: start_y - header_offset, left: 0, behavior: 'smooth' });
return false;
});
//Smooth scroll to top
$('#to-top').click(function(){
window.scroll({ top: 0, left: 0, behavior: 'smooth' });
return false;
});
// Responsive Menu
$('#toggle').click(function () {
$(this).toggleClass('active');
$('#overlay').toggleClass('open');
$('body').toggleClass('mobile-nav-open');
});
// Tree Menu
$(".tree").treemenu({delay:300});
});

8160
lp/assets/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

30
lp/assets/package.json Normal file
View file

@ -0,0 +1,30 @@
{
"repository": {},
"description": " ",
"license": "MIT",
"scripts": {
"deploy": "webpack --mode production",
"watch": "webpack --mode development --watch"
},
"dependencies": {
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
"phoenix_live_view": "file:../deps/phoenix_live_view",
"nprogress": "^0.2.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-loader": "^8.0.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2",
"sass-loader": "^8.0.2",
"node-sass": "^4.13.1",
"hard-source-webpack-plugin": "^0.13.1",
"mini-css-extract-plugin": "^0.9.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"terser-webpack-plugin": "^2.3.2",
"webpack": "4.41.5",
"webpack-cli": "^3.3.2"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -0,0 +1,5 @@
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
# User-agent: *
# Disallow: /

View file

@ -0,0 +1,53 @@
const path = require('path');
const glob = require('glob');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = (env, options) => {
const devMode = options.mode !== 'production';
return {
optimization: {
minimizer: [
new TerserPlugin({ cache: true, parallel: true, sourceMap: devMode }),
new OptimizeCSSAssetsPlugin({})
]
},
entry: {
'app': glob.sync('./vendor/**/*.js').concat(['./js/app.js'])
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, '../priv/static/js'),
publicPath: '/js/'
},
devtool: devMode ? 'eval-cheap-module-source-map' : undefined,
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.[s]?css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
],
}
]
},
plugins: [
new MiniCssExtractPlugin({ filename: '../css/app.css' }),
new CopyWebpackPlugin([{ from: 'static/', to: '../' }])
]
.concat(devMode ? [new HardSourceWebpackPlugin()] : [])
}
};

49
lp/config/config.exs Normal file
View file

@ -0,0 +1,49 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
# General application configuration
use Mix.Config
config :lp,
ecto_repos: [Lp.Repo]
# Configures the endpoint
config :lp, LpWeb.Endpoint,
url: [host: "localhost"],
force_ssl: [hsts: true],
secret_key_base: "DgokGSB84E7YMG0wLwe/hR51+TpWnqbdQmZjvGh6SIEDExzvOQS1IYiJoxTcI/XN",
render_errors: [view: LpWeb.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Lp.PubSub,
live_view: [signing_salt: "CeYKUFh5"]
# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason
config :phoenix, :template_engines,
md: PhoenixMarkdown.Engine
# haml: PhoenixHaml.Engine
# https://emmet.io eex should be good enough
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs"
import_config "github.exs"
#_________________
#import Config
#config :lp,
# client_id: "your_fancy_github_id",
# client_secret: "that_is_a_secret"
#

77
lp/config/dev.exs Normal file
View file

@ -0,0 +1,77 @@
use Mix.Config
# Configure your database
config :lp, Lp.Repo,
username: "postgres",
password: "postgres",
database: "lp_dev",
hostname: "localhost",
show_sensitive_data_on_connection_error: true,
pool_size: 10
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with webpack to recompile .js and .css sources.
config :lp, LpWeb.Endpoint,
# http: [port: 80],
https: [
port: 443,
cipher_suite: :strong,
keyfile: "priv/cert/selfsigned_key.pem",
certfile: "priv/cert/selfsigned.pem"
],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [
node: [
"node_modules/webpack/bin/webpack.js",
"--mode",
"development",
"--watch-stdin",
cd: Path.expand("../assets", __DIR__)
]
]
# ## SSL Support
#
# In order to use HTTPS in development, a self-signed
# certificate can be generated by running the following
# Mix task:
#
# mix phx.gen.cert
#
# Note that this task requires Erlang/OTP 20 or later.
# Run `mix help phx.gen.cert` for more information.
#
# The `http:` config above can be replaced with:
#
#
# If desired, both `http:` and `https:` keys can be
# configured to run both http and https servers on
# different ports.
# Watch static and templates for browser reloading.
config :lp, LpWeb.Endpoint,
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/lp_web/(live|views)/.*(ex)$",
~r"lib/lp_web/templates/.*(eex|md)$"
]
]
# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"
# Set a higher stacktrace during development. Avoid configuring such
# in production as building large stacktraces may be expensive.
config :phoenix, :stacktrace_depth, 20
# Initialize plugs at runtime for faster development compilation
config :phoenix, :plug_init_mode, :runtime

65
lp/config/prod.exs Normal file
View file

@ -0,0 +1,65 @@
use Mix.Config
# For production, don't forget to configure the url host
# to something meaningful, Phoenix uses this information
# when generating URLs.
#
# Note we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the `mix phx.digest` task,
# which you should run after static files are built and
# before starting your production server.
config :lp, LpWeb.Endpoint,
# url: [host: "example.com", port: 80],
url: [host: "35.193.215.48"],
cache_static_manifest: "priv/static/cache_manifest.json",
https: [
port: 443,
cipher_suite: :strong,
keyfile: System.get_env("GCLP_SSL_KEY_PATH"),
certfile: System.get_env("GCLP_APP_SSL_CERT_PATH"),
transport_options: [socket_opts: [:inet6]]
]
#
#usually you would not want to do that, but i'm lazy. adjust to your machine
# Do not print debug messages in production
config :logger, level: :info
# ## SSL Support
#
# To get SSL working, you will need to add the `https` key
# to the previous section and set your `:url` port to 443:
#
# config :lp, LpWeb.Endpoint,
# ...
# url: [host: "example.com", port: 443],
# https: [
# port: 443,
# cipher_suite: :strong,
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH"),
# transport_options: [socket_opts: [:inet6]]
# ]
#
# The `cipher_suite` is set to `:strong` to support only the
# latest and more secure SSL ciphers. This means old browsers
# and clients may not be supported. You can set it to
# `:compatible` for wider support.
#
# `:keyfile` and `:certfile` expect an absolute path to the key
# and cert in disk or a relative path inside priv, for example
# "priv/ssl/server.key". For all supported SSL configuration
# options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1
#
# We also recommend setting `force_ssl` in your endpoint, ensuring
# no data is ever sent via http, always redirecting to https:
#
config :lp, LpWeb.Endpoint,
force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.
# Finally import the config/prod.secret.exs which loads secrets
# and configuration from environment variables.
import_config "prod.secret.exs"

41
lp/config/prod.secret.exs Normal file
View file

@ -0,0 +1,41 @@
# In this file, we load production configuration and secrets
# from environment variables. You can also hardcode secrets,
# although such is generally not recommended and you have to
# remember to add this file to your .gitignore.
use Mix.Config
database_url =
System.get_env("DATABASE_URL") ||
raise """
environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
"""
config :lp, Lp.Repo,
ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
secret_key_base =
System.get_env("SECRET_KEY_BASE") ||
raise """
environment variable SECRET_KEY_BASE is missing.
You can generate one by calling: mix phx.gen.secret
"""
# config :lp, LpWeb.Endpoint,
# http: [
# port: String.to_integer(System.get_env("PORT") || "4000"),
# transport_options: [socket_opts: [:inet6]]
# ],
# secret_key_base: secret_key_base
# ## Using releases (Elixir v1.9+)
#
# If you are doing OTP releases, you need to instruct Phoenix
# to start each relevant endpoint:
#
config :lp, LpWeb.Endpoint, server: true
#
# Then you can assemble a release by calling `mix release`.
# See `mix help release` for more information.

22
lp/config/test.exs Normal file
View file

@ -0,0 +1,22 @@
use Mix.Config
# Configure your database
#
# The MIX_TEST_PARTITION environment variable can be used
# to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information.
config :lp, Lp.Repo,
username: "postgres",
password: "postgres",
database: "lp_test#{System.get_env("MIX_TEST_PARTITION")}",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :lp, LpWeb.Endpoint,
http: [port: 4002],
server: false
# Print only warnings and errors during test
config :logger, level: :warn

9
lp/lib/lp.ex Normal file
View file

@ -0,0 +1,9 @@
defmodule Lp do
@moduledoc """
Lp keeps the contexts that define your domain
and business logic.
Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others.
"""
end

34
lp/lib/lp/application.ex Normal file
View file

@ -0,0 +1,34 @@
defmodule Lp.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
def start(_type, _args) do
children = [
# Start the Ecto repository
Lp.Repo,
# Start the Telemetry supervisor
LpWeb.Telemetry,
# Start the PubSub system
{Phoenix.PubSub, name: Lp.PubSub},
# Start the Endpoint (http/https)
LpWeb.Endpoint
# Start a worker by calling: Lp.Worker.start_link(arg)
# {Lp.Worker, arg}
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Lp.Supervisor]
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
LpWeb.Endpoint.config_change(changed, removed)
:ok
end
end

5
lp/lib/lp/repo.ex Normal file
View file

@ -0,0 +1,5 @@
defmodule Lp.Repo do
use Ecto.Repo,
otp_app: :lp,
adapter: Ecto.Adapters.Postgres
end

102
lp/lib/lp_web.ex Normal file
View file

@ -0,0 +1,102 @@
defmodule LpWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, views, channels and so on.
This can be used in your application as:
use LpWeb, :controller
use LpWeb, :view
The definitions below will be executed for every view,
controller, etc, so keep them short and clean, focused
on imports, uses and aliases.
Do NOT define functions inside the quoted expressions
below. Instead, define any helper function in modules
and import those modules here.
"""
def controller do
quote do
use Phoenix.Controller, namespace: LpWeb
import Plug.Conn
import LpWeb.Gettext
alias LpWeb.Router.Helpers, as: Routes
end
end
def view do
quote do
use Phoenix.View,
root: "lib/lp_web/templates",
namespace: LpWeb
# Import convenience functions from controllers
import Phoenix.Controller,
only: [get_flash: 1, get_flash: 2, view_module: 1, view_template: 1]
# Include shared imports and aliases for views
unquote(view_helpers())
end
end
def live_view do
quote do
use Phoenix.LiveView,
layout: {LpWeb.LayoutView, "live.html"}
unquote(view_helpers())
end
end
def live_component do
quote do
use Phoenix.LiveComponent
unquote(view_helpers())
end
end
def router do
quote do
use Phoenix.Router
import Plug.Conn
import Phoenix.Controller
import Phoenix.LiveView.Router
end
end
def channel do
quote do
use Phoenix.Channel
import LpWeb.Gettext
end
end
defp view_helpers do
quote do
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML
# Import LiveView helpers (live_render, live_component, live_patch, etc)
import Phoenix.LiveView.Helpers
# Import basic rendering functionality (render, render_layout, etc)
import Phoenix.View
import LpWeb.ErrorHelpers
import LpWeb.Gettext
alias LpWeb.Router.Helpers, as: Routes
end
end
@doc """
When used, dispatch to the appropriate controller/view/etc.
"""
defmacro __using__(which) when is_atom(which) do
apply(__MODULE__, which, [])
end
end

View file

@ -0,0 +1,35 @@
defmodule LpWeb.UserSocket do
use Phoenix.Socket
## Channels
# channel "room:*", LpWeb.RoomChannel
# Socket params are passed from the client and can
# be used to verify and authenticate a user. After
# verification, you can put default assigns into
# the socket that will be set for all channels, ie
#
# {:ok, assign(socket, :user_id, verified_user_id)}
#
# To deny connection, return `:error`.
#
# See `Phoenix.Token` documentation for examples in
# performing token verification on connect.
@impl true
def connect(_params, socket, _connect_info) do
{:ok, socket}
end
# Socket id's are topics that allow you to identify all sockets for a given user:
#
# def id(socket), do: "user_socket:#{socket.assigns.user_id}"
#
# Would allow you to broadcast a "disconnect" event and terminate
# all active sockets and channels for a given user:
#
# LpWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
#
# Returning `nil` makes this socket anonymous.
@impl true
def id(_socket), do: nil
end

View file

@ -0,0 +1,55 @@
defmodule LpWeb.GitController do
@client_id Application.fetch_env!(:lp, :client_id)
@client_secret Application.fetch_env!(:lp, :client_secret)
use LpWeb, :controller
# @data "/priv/secret/github_credentials" |> File.stream! |> Enum.to_list
def index(conn, _params) do
render(conn, "git.html")
end
def show(conn, _params) do
html(conn,"")
end
def oauth(conn, %{"code" => code}) do
#some persistance side effect
# persist(code)
access_token = Github.Oauth2.Client.access_token!(
config: [client_id: @client_id, client_secret: @client_secret],
params: [code: code]
)
github_client = %Github.Client{access_token: access_token}
%{"login" => login} = github_client |> Github.Users.find!() |> Map.fetch!(:body)
[%{"email" => email} | _] = github_client |> Github.Users.Emails.list!() |> Map.fetch!(:body)
render(conn, "oauth2.html", [login: login, email: email])
# redirect(conn, "git.html")
# html(conn,"")
end
# ___ example from github
# def github_callback(conn, %{"code" => code}) do
# access_token = Github.Oauth2.Client.access_token!(
# config: [client_id: @client_id, client_secret: @client_secret],
# params: [code: code]
# )
# github_client = %Github.Client{access_token: access_token}
# %{"login" => login} = github_client |> Github.Users.find!() |> Map.fetch!(:body)
# [%{"email" => email} | _] = github_client |> Github.Users.Emails.list!() |> Map.fetch!(:body)
# ...
# end
# ___
def github(conn, _params) do
authorize_url = Github.Oauth2.Client.authorize_url!(
# config: [client_id: Application.fetch_env!(:lp, :client_id), client_secret: Application.fetch_env!(:lp, :client_secret)],
config: [client_id: @client_id, client_secret: @client_secret],
scope: "user:email"
)
conn |> redirect(external: authorize_url)
end
end

View file

@ -0,0 +1,14 @@
defmodule LpWeb.OldController do
use LpWeb, :controller
def index(conn, _params) do
# conn
# |> render("old.html")
render(conn, "old.html")
# html(conn, """
# <h1>YetAnotherOldMockup</h1>
# """
# )
end
end

View file

@ -0,0 +1,11 @@
defmodule LpWeb.TableController do
use LpWeb, :controller
def index(conn, _params) do
render(conn, "table.html")
end
def sample(conn, _params) do
render(conn, "table_sample.html")
end
end

54
lp/lib/lp_web/endpoint.ex Normal file
View file

@ -0,0 +1,54 @@
defmodule LpWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :lp
# The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it.
@session_options [
store: :cookie,
key: "_lp_key",
signing_salt: "xPlX3lVr"
]
socket "/socket", LpWeb.UserSocket,
websocket: true,
longpoll: false
socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phx.digest
# when deploying your static files in production.
plug Plug.Static,
at: "/",
from: :lp,
gzip: false,
only: ~w(css fonts images js favicon.ico robots.txt)
# Code reloading can be explicitly enabled under the
# :code_reloader configuration of your endpoint.
if code_reloading? do
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
plug Phoenix.LiveReloader
plug Phoenix.CodeReloader
plug Phoenix.Ecto.CheckRepoStatus, otp_app: :lp
end
plug Phoenix.LiveDashboard.RequestLogger,
param_key: "request_logger",
cookie_key: "request_logger"
plug Plug.RequestId
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Phoenix.json_library()
plug Plug.MethodOverride
plug Plug.Head
plug Plug.Session, @session_options
plug LpWeb.Router
end

24
lp/lib/lp_web/gettext.ex Normal file
View file

@ -0,0 +1,24 @@
defmodule LpWeb.Gettext do
@moduledoc """
A module providing Internationalization with a gettext-based API.
By using [Gettext](https://hexdocs.pm/gettext),
your module gains a set of macros for translations, for example:
import LpWeb.Gettext
# Simple translation
gettext("Here is the string to translate")
# Plural translation
ngettext("Here is the string to translate",
"Here are the strings to translate",
3)
# Domain-based translation
dgettext("errors", "Here is the error message to translate")
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
"""
use Gettext, otp_app: :lp
end

View file

@ -0,0 +1,39 @@
defmodule LpWeb.PageLive do
use LpWeb, :live_view
@impl true
def mount(_params, _session, socket) do
{:ok, assign(socket, query: "", results: %{})}
end
@impl true
def handle_event("suggest", %{"q" => query}, socket) do
{:noreply, assign(socket, results: search(query), query: query)}
end
@impl true
def handle_event("search", %{"q" => query}, socket) do
case search(query) do
%{^query => vsn} ->
{:noreply, redirect(socket, external: "https://hexdocs.pm/#{query}/#{vsn}")}
_ ->
{:noreply,
socket
|> put_flash(:error, "No dependencies found matching \"#{query}\"")
|> assign(results: %{}, query: query)}
end
end
defp search(query) do
if not LpWeb.Endpoint.config(:code_reloader) do
raise "action disabled when not in development"
end
for {app, desc, vsn} <- Application.started_applications(),
app = to_string(app),
String.starts_with?(app, query) and not List.starts_with?(desc, ~c"ERTS"),
into: %{},
do: {app, vsn}
end
end

View file

@ -0,0 +1,48 @@
<section class="phx-hero">
<h1><%= gettext "Welcome to %{name}!", name: "Phoenix" %></h1>
<p>Peace of mind from prototype to production</p>
<form phx-change="suggest" phx-submit="search">
<input type="text" name="q" value="<%= @query %>" placeholder="Live dependency search" list="results" autocomplete="off"/>
<datalist id="results">
<%= for {app, _vsn} <- @results do %>
<option value="<%= app %>"><%= app %></option>
<% end %>
</datalist>
<button type="submit" phx-disable-with="Searching...">Go to Hexdocs</button>
</form>
</section>
<section class="row">
<article class="column">
<h2>Resources</h2>
<ul>
<li>
<a href="https://hexdocs.pm/phoenix/overview.html">Guides &amp; Docs</a>
</li>
<li>
<a href="https://github.com/phoenixframework/phoenix">Source</a>
</li>
<li>
<a href="https://github.com/phoenixframework/phoenix/blob/v1.5/CHANGELOG.md">v1.5 Changelog</a>
</li>
</ul>
</article>
<article class="column">
<h2>Help</h2>
<ul>
<li>
<a href="https://elixirforum.com/c/phoenix-forum">Forum</a>
</li>
<li>
<a href="https://webchat.freenode.net/?channels=elixir-lang">#elixir-lang on Freenode IRC</a>
</li>
<li>
<a href="https://twitter.com/elixirphoenix">Twitter @elixirphoenix</a>
</li>
<li>
<a href="https://elixir-slackin.herokuapp.com/">Elixir on Slack</a>
</li>
</ul>
</article>
</section>

50
lp/lib/lp_web/router.ex Normal file
View file

@ -0,0 +1,50 @@
defmodule LpWeb.Router do
use LpWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {LpWeb.LayoutView, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", LpWeb do
pipe_through :browser
get "/", OldController, :index
# get "/table", TableController, :sample
get "/table", TableController, :index
get "/git", GitController, :index
get "/github", GitController, :github
get "/oauth2", GitController, :oauth
# get "old", OldController, :index
# live "/", PageLive, :index
end
# Other scopes may use custom stacks.
# scope "/api", LpWeb do
# pipe_through :api
# end
# Enables LiveDashboard only for development
#
# If you want to use the LiveDashboard in production, you should put
# it behind authentication and allow only admins to access it.
# If your application does not have an admins-only section yet,
# you can use Plug.BasicAuth to set up some basic authentication
# as long as you are also using SSL (which you should anyway).
if Mix.env() in [:dev, :test] do
import Phoenix.LiveDashboard.Router
scope "/" do
pipe_through :browser
live_dashboard "/dashboard", metrics: LpWeb.Telemetry
end
end
end

View file

@ -0,0 +1,55 @@
defmodule LpWeb.Telemetry do
use Supervisor
import Telemetry.Metrics
def start_link(arg) do
Supervisor.start_link(__MODULE__, arg, name: __MODULE__)
end
@impl true
def init(_arg) do
children = [
# Telemetry poller will execute the given period measurements
# every 10_000ms. Learn more here: https://hexdocs.pm/telemetry_metrics
{:telemetry_poller, measurements: periodic_measurements(), period: 10_000}
# Add reporters as children of your supervision tree.
# {Telemetry.Metrics.ConsoleReporter, metrics: metrics()}
]
Supervisor.init(children, strategy: :one_for_one)
end
def metrics do
[
# Phoenix Metrics
summary("phoenix.endpoint.stop.duration",
unit: {:native, :millisecond}
),
summary("phoenix.router_dispatch.stop.duration",
tags: [:route],
unit: {:native, :millisecond}
),
# Database Metrics
summary("lp.repo.query.total_time", unit: {:native, :millisecond}),
summary("lp.repo.query.decode_time", unit: {:native, :millisecond}),
summary("lp.repo.query.query_time", unit: {:native, :millisecond}),
summary("lp.repo.query.queue_time", unit: {:native, :millisecond}),
summary("lp.repo.query.idle_time", unit: {:native, :millisecond}),
# VM Metrics
summary("vm.memory.total", unit: {:byte, :kilobyte}),
summary("vm.total_run_queue_lengths.total"),
summary("vm.total_run_queue_lengths.cpu"),
summary("vm.total_run_queue_lengths.io")
]
end
defp periodic_measurements do
[
# A module, function and arguments to be invoked periodically.
# This function must call :telemetry.execute/3 and a metric must be added above.
# {LpWeb, :count_users, []}
]
end
end

View file

@ -0,0 +1 @@
<h1>404</h1>

View file

@ -0,0 +1,2 @@
<h1>500</h1>
<p>There was an error. Sadly.</p>

View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<h1>Github mock page</h1>
</head>
<body>
<div class="highlight highlight-source-elixir"><pre>iex<span class="pl-k">&gt;</span> jwt_token <span class="pl-k">=</span> <span class="pl-en">Github</span>.<span class="pl-en">Client</span>.<span class="pl-en">generate_jwt_token</span>(<span class="pl-c1">app_id:</span> <span class="pl-c1">12345</span>, <span class="pl-c1">private_key_filepath:</span> <span class="pl-s"><span class="pl-pds">"</span>app.pem<span class="pl-pds">"</span></span>)
iex<span class="pl-k">&gt;</span> github_client <span class="pl-k">=</span> %<span class="pl-en">Github</span>.<span class="pl-en">Client</span>{<span class="pl-c1">jwt_token:</span> <span class="pl-s"><span class="pl-pds">"</span>jwt_token<span class="pl-pds">"</span></span>}
iex<span class="pl-k">&gt;</span> github_client <span class="pl-k">|&gt;</span> <span class="pl-en">Github</span>.<span class="pl-en">Apps</span>.<span class="pl-en">Installations</span>.<span class="pl-en">find!</span>(<span class="pl-c1">67890</span>)
%<span class="pl-en">Github</span>.<span class="pl-en">Client</span>.<span class="pl-en">Response</span>{
<span class="pl-c1">status:</span> <span class="pl-c1">200</span>,
<span class="pl-c1">headers:</span> [<span class="pl-k">..</span>.],
<span class="pl-c1">body:</span> %{<span class="pl-s"><span class="pl-pds">"</span>id<span class="pl-pds">"</span></span> <span class="pl-k">=&gt;</span> <span class="pl-c1">12345</span>, <span class="pl-k">..</span>.},
<span class="pl-k">..</span>.
}</pre></div>
<div class="highlight highlight-source-elixir"><pre><span class="pl-k">def</span> <span class="pl-en">github</span>(conn, <span class="pl-c">_params</span>) <span class="pl-k">do</span>
authorize_url <span class="pl-k">=</span> <span class="pl-en">Github</span>.<span class="pl-en">Oauth2</span>.<span class="pl-en">Client</span>.<span class="pl-en">authorize_url!</span>(
<span class="pl-c1">config:</span> [<span class="pl-c1">client_id:</span> <span class="pl-s"><span class="pl-pds">"</span>client_id<span class="pl-pds">"</span></span>, <span class="pl-c1">client_secret:</span> <span class="pl-s"><span class="pl-pds">"</span>client_secret<span class="pl-pds">"</span></span>],
<span class="pl-c1">scope:</span> <span class="pl-s"><span class="pl-pds">"</span>user:email<span class="pl-pds">"</span></span>
)
conn <span class="pl-k">|&gt;</span> <span class="pl-en">redirect</span>(<span class="pl-c1">external:</span> authorize_url)
<span class="pl-k">end</span></pre></div>
<div class="highlight highlight-source-elixir"><pre><span class="pl-k">def</span> <span class="pl-en">github_callback</span>(conn, %{<span class="pl-s"><span class="pl-pds">"</span>code<span class="pl-pds">"</span></span> <span class="pl-k">=&gt;</span> code}) <span class="pl-k">do</span>
access_token <span class="pl-k">=</span> <span class="pl-en">Github</span>.<span class="pl-en">Oauth2</span>.<span class="pl-en">Client</span>.<span class="pl-en">access_token!</span>(
<span class="pl-c1">config:</span> [<span class="pl-c1">client_id:</span> <span class="pl-s"><span class="pl-pds">"</span>client_id<span class="pl-pds">"</span></span>, <span class="pl-c1">client_secret:</span> <span class="pl-s"><span class="pl-pds">"</span>client_secret<span class="pl-pds">"</span></span>],
<span class="pl-c1">params:</span> [<span class="pl-c1">code:</span> code]
)
github_client <span class="pl-k">=</span> %<span class="pl-en">Github</span>.<span class="pl-en">Client</span>{<span class="pl-c1">access_token:</span> access_token}
%{<span class="pl-s"><span class="pl-pds">"</span>login<span class="pl-pds">"</span></span> <span class="pl-k">=&gt;</span> login} <span class="pl-k">=</span> github_client <span class="pl-k">|&gt;</span> <span class="pl-en">Github</span>.<span class="pl-en">Users</span>.<span class="pl-en">find!</span>() <span class="pl-k">|&gt;</span> <span class="pl-en">Map</span>.<span class="pl-en">fetch!</span>(<span class="pl-c1">:body</span>)
[%{<span class="pl-s"><span class="pl-pds">"</span>email<span class="pl-pds">"</span></span> <span class="pl-k">=&gt;</span> email} <span class="pl-k">|</span> <span class="pl-c">_</span>] <span class="pl-k">=</span> github_client <span class="pl-k">|&gt;</span> <span class="pl-en">Github</span>.<span class="pl-en">Users</span>.<span class="pl-en">Emails</span>.<span class="pl-en">list!</span>() <span class="pl-k">|&gt;</span> <span class="pl-en">Map</span>.<span class="pl-en">fetch!</span>(<span class="pl-c1">:body</span>)
<span class="pl-k">..</span>.
<span class="pl-k">end</span></pre></div>
<p>https://github.com/WorkflowCI/github#with-app-jwt-token (c)</p>
<p><%= link "GH", to: "/github" %></p>
<%# <%= Github.(@url_get_param) %>
</body>
</html>

View file

@ -0,0 +1,4 @@
<H1> Autorisation succeded </H1>
<h2>Welcome, <%= @login %> ! </h2>
<h3>Is it your mail <%= @email %>? </h3>
<p>todo. keep context </p>

View file

@ -0,0 +1,5 @@
<main role="main" class="container">
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
<%= @inner_content %>
</main>

View file

@ -0,0 +1,11 @@
<main role="main" class="container">
<p class="alert alert-info" role="alert"
phx-click="lv:clear-flash"
phx-value-key="info"><%= live_flash(@flash, :info) %></p>
<p class="alert alert-danger" role="alert"
phx-click="lv:clear-flash"
phx-value-key="error"><%= live_flash(@flash, :error) %></p>
<%= @inner_content %>
</main>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<%= csrf_meta_tag() %>
<%= live_title_tag assigns[:page_title] || "Lp", suffix: " · Phoenix Framework" %>
<link phx-track-static rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
<script defer phx-track-static type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
</head>
<body>
<header>
<section class="container">
<nav role="navigation">
<ul>
<li><a href="https://hexdocs.pm/phoenix/overview.html">Get Started</a></li>
<%= if function_exported?(Routes, :live_dashboard_path, 2) do %>
<li><%= link "LiveDashboard", to: Routes.live_dashboard_path(@conn, :home) %></li>
<% end %>
</ul>
</nav>
<a href="https://phoenixframework.org/" class="phx-logo">
<img src="<%= Routes.static_path(@conn, "/images/phoenix.png") %>" alt="Phoenix Framework Logo"/>
</a>
</section>
</header>
<%= @inner_content %>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<%= csrf_meta_tag() %>
<%= live_title_tag assigns[:page_title] || "Lp", suffix: " · Phoenix Framework" %>
<link phx-track-static rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
<script defer phx-track-static type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
<script
src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.3.5/dist/alpine.min.js"
defer
></script>
</head>
<body>
<header>
<section class="container">
<nav role="navigation">
<ul>
<li><a href="https://gamecult.games/labor-platform">GameCult</a></li>
<li><a href="/table">Table</a></li>
<li><a href="/">Home</a></li>
<li><a href="/git">Git</a></li>
</ul>
</nav>
</section>
</header>
<%= @inner_content %>
</body>
</html>

View file

@ -0,0 +1,20 @@
!!!
%html{lang: "en"}
%head
%meta{content: "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%meta{charset: "utf-8"}/
%meta{content: "IE=edge", "http-equiv" => "X-UA-Compatible"}/
%meta{content: "width=device-width, initial-scale=1.0", name: "viewport"}/
= csrf_meta_tag()
= live_title_tag assigns[:page_title] || "Lp", suffix: " · Phoenix Framework"
%link{href: "#{Routes.static_path(@conn, "/css/app.css")}", "phx-track-static" => "", rel: "stylesheet"}/
%script{defer: "defer", "phx-track-static" => "", src: "#{Routes.static_path(@conn, "/js/app.js")}", type: "text/javascript"}
%script{defer: "defer", src: "https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.3.5/dist/alpine.min.js"}
%body
%header
%section.container
%nav{role: "navigation"}
%ul
%li
%a{href: "https://gamecult.games/labor-platform"} GameCult
= @inner_content

View file

@ -0,0 +1 @@
Eex has first priority

View file

@ -0,0 +1,185 @@
---
title: 'GameCult Labor Platform'
anchors:
active: false
tagtitle: h2
---
# Architecture
The Labor Platform is available on our website as a web app. Users can simply login using their Github account or create a GameCult account (same account used in our games). Pages and actions in this section all take place on our website, which communicates with an application and database running on our server containing code that interfaces with Github for things like the creation of issues, assignment of tasks, and retrieving patron donation history.
## Contribute
This section of the Platform is where members can view all of the currently outstanding issues for our projects, and sign up to volunteer themselves. Each entry is linked to Github, and displays its current status in the list entry, including some data which is not available on Github. Issues can be sorted and filtered based on any of the following:
### Data
* Project
* Name
* Category (Modeling/Music/AI/Refactoring/etc.)
* Status (available/assigned/pending review/complete)
* Currently assigned members/Current volunteers
* Man Hours
* Skill Level
* Contribution Points
## Vote
This section of the Platform allows members to participate in determining the future direction of GameCult. Any member can create a motion in this section or vote on existing motions.
## Profile
This section allows the user to access supplementary information and statistics connected to their account. Here the user can describe the skills they have to better match them with open issues.
* Nickname
* Member Tier
* Portfolio Link
* Skills
* List areas of expertise and the level for each skill.
* Availability
* Amount of time per day that the user is available for work
* Weekday selection
* Task History
* Completed Tasks
* Tasks in Progress
* Hours worked
* Total points earned/ total payout (per/year)
* Payout
* Revenue Share
* Monthly/Yearly Income
* Total
* Per Project
* Bounties
* Total
* This Month/Year
* Point Balance
### Management
This section is for creating motions which impact some aspect of the GameCult organization itself, such as tier thresholds or Role applications. Motions in this section are time-limited, and will pass or fail depending on the vote distribution at the end of the time limit. The majority needed to pass a motion depends on the type.
### Projects
This section is for motions which, when successful, result in the creation of a new issue with associated bounty. This is the place to report bugs in one of our projects, or suggest new features or content to be created. Motions in this section are not time-limited, and are passed when a certain proportion of the total voting body agrees on it. There are only positive votes in this section, abstaining from voting on a proposal here is the same as voting against. The proportion necessary to pass a proposal depends on its category:
* Bugs: 15%
* Cosmetics: 30%
* Balance Changes: 40%
* Features: 50%
* New Content: 50%
* Fundamental Design Changes: 66%
# Tiers
Members are given points according to two metrics: patrons and contributors, both of which contribute towards their ranking in a tier system. Tiers, in addition to providing certain benefits, directly determine how powerful the member’s vote is on the Platform. Each of the 5 tiers of each type provides a single vote added to the total number of votes a member can use.
### Decay
In order to avoid stratifying the organization over time due to a weight of historical contribution that is impossible for new members to overcome, historical point balances are subject to exponential decay, with 1% of their balance disappearing every week, rounded down. This does not apply to project specific contribution points.
### Patrons
Both a patron’s monthly contribution and their total historical donation counts towards their Patron Tier. After a month, a donation becomes historical, meaning its value is halved and subject to point decay. Every dollar of direct donation provides a single point. Player accounts also earn patron points for 20% of their CultCoin purchases.
**Tier I - Bronze (10 pts)**
**Tier II - Silver (100 pts)**
**Tier III - Gold (1k pts)**
**Tier IV - Platinum (10k pts)**
**Tier V - Unobtanium (100k pts)**
### Contributors
Contributors earn points from their contributions, with the amount being calculated using a formula that takes input from the task’s skill requirement and estimated man-hours. Contribution points are accounted for on both a general and per-project basis. Project contribution points do not decay. For simplicity and parity with patron points, each point granted represents a dollar of nominal labor value. Contributors are also eligible for bonuses if they turn in contributions early or if they. New contributors are automatically granted 20 contribution points for an automatic tier of Postulate.
**Tier I - Postulate (10 pts)**
**Tier II - Initiate (100 pts)**
Required to qualify for revenue sharing
**Tier III - Novice (1k pts)**
Allows the member to apply for a Maintainer Role for any project
**Tier IV - Adept (10k pts)**
Allows the member to apply for a Producer Role for any project
**Tier V - Master (100k pts)**
# Revenue Sharing
Revenue is divided in three equal portions: one portion is divided among all members according to total contribution points, one is divided according to contributions for the specific project which generated the revenue, and the last is stored in the budget for expenses and development of future projects.
# Roles
Not all contributions can be easily quantified by individual tasks. Some jobs are ongoing, and should be rewarded as such. We call those positions “Roles”. Roles provide an ongoing stream of both direct income (salary) and contribution points.
### Social Media
Describes those tasked with social media-related responsibilities. Someone in this role would be responsible for maintaining and keeping up-to-date with the various social media profiles maintained by GameCult.
### Community Manager
Community managers are responsible for maintaining contact with and order within our internal social environments, such as Discord or forums.
### Maintainer
Members of a project’s maintenance team are responsible for formalizing community proposals and reviewing pull requests to verify quality and coverage. This does not apply only to code. Projects need Maintainers to verify the quality of art as well, and there is a writing-related role (Editor) which is not project-specific.
### Producer
Producers are responsible for coordinating and caring for the members who are working on their project, as well as creating milestones and keeping their eyes on deadlines. It’s their job to choose which volunteers get assigned to issues. They can also unilaterally create new issues as long as they aren’t contradicted by previous community votes.
# Workflow
## Issue Creation
Sometimes the community has spoken, and decided that something needs to get done. When such a proposal passes, it is added to a queue for formalization. Other times it is a Producer for the project who decides, crafting a proposal and adding it to the queue directly.
From the queue, a maintainer will pick up the proposal and turn it into an Issue, describing it in detail as well as determining the skill level and man hours required to complete the task.
## Assignment
Once an issue has been created, it must be assigned to a member. Members must volunteer to work on an issue, at which point they can be chosen for the task by the project’s Producer.
The assigned member is by default assigned a nominal deadline depending on their stated availability and the amount of man-hours of the task: a person who has declared 1 hour per day of availability would receive 5 days to complete a 5 man-hour task. The default deadline can be adjusted by the Producer when the task is assigned.
## Submission
Regardless of the state of work when the deadline is reached, it must be submitted to the project repository as a pull request.
At this point one of the project’s Maintainers needs to come along and determine whether the submission solves the issue and meets the project’s standards for quality. If it does not, the Producer can choose whether to extend the deadline or reassign the task and choose what proportion of the bounty goes to the previous assignee.
On completion, the member(s) assigned to the task are awarded the contribution points and the cash bounty associated with the task. A successful task can be awarded a point bonus proportional to the nominal man-hours divided by the number taken. A highly successful task where the assignee went beyond the call of duty may also earn a bonus at the discretion of the Producer.

View file

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html>
<head>
<link href="https://cdn.datatables.net/responsive/2.1.0/css/responsive.dataTables.min.css" rel="stylesheet" media="screen">
<link href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css" rel="stylesheet" media="screen">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js
"></script>
<script src="https://cdn.datatables.net/responsive/2.1.0/js/dataTables.responsive.min.js"></script>
<script>
$(document).ready(function() {
$('#taskData').DataTable( {
responsive: {
details: {
type: 'column',
target: 'tr'
}
},
columnDefs: [ {
className: 'control',
orderable: false,
targets: 0
} ],
order: [ 1, 'asc' ]
} );
} );
</script>
</head>
<body>
<table id="taskData" class="display nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th></th>
<th>Project</th>
<th>Name</th>
<th>Category (Modeling/Music/AI/Refactoring/etc.)</th>
<th>Status (available/assigned/pending review/complete)</th>
<th>Currently assigned members/Current volunteers</th>
<th>Man Hours</th>
<th>Skill level</th>
<th>Contribution Points</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th>Project</th>
<th>Name</th>
<th>Category (Modeling/Music/AI/Refactoring/etc.)</th>
<th>Status (available/assigned/pending review/complete)</th>
<th>Currently assigned members/Current volunteers</th>
<th>Man Hours</th>
<th>Skill level</th>
<th>Contribution Points</th>
</tr>
</tfoot>
<tbody>
<tr>
<td></td>
<td>GCLP</td>
<td>Table data</td>
<td>web</td>
<td>assigned</td>
<td>1: Yang</td>
<td>est: 7, spnt: 2</td>
<td>medium</td>
<td>31</td>
</tr>
</tbody>
</table>
</body>
</html>

View file

@ -0,0 +1,690 @@
<!DOCTYPE html>
<html>
<head>
<link href="https://cdn.datatables.net/responsive/2.1.0/css/responsive.dataTables.min.css" rel="stylesheet" media="screen">
<link href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css" rel="stylesheet" media="screen">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js
"></script>
<script src="https://cdn.datatables.net/responsive/2.1.0/js/dataTables.responsive.min.js"></script>
<script>
$(document).ready(function() {
$('#example').DataTable( {
responsive: {
details: {
type: 'column',
target: 'tr'
}
},
columnDefs: [ {
className: 'control',
orderable: false,
targets: 0
} ],
order: [ 1, 'asc' ]
} );
} );
</script>
</head>
<body>
<table id="example" class="display nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th></th>
<th>First name</th>
<th>Last name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
<th>Extn.</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th>First name</th>
<th>Last name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
<th>Extn.</th>
</tr>
</tfoot>
<tbody>
<tr>
<td></td>
<td>Tiger</td>
<td>Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
<td>5421</td>
</tr>
<tr>
<td></td>
<td>Garrett</td>
<td>Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
<td>8422</td>
</tr>
<tr>
<td></td>
<td>Ashton</td>
<td>Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
<td>1562</td>
</tr>
<tr>
<td></td>
<td>Cedric</td>
<td>Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>2012/03/29</td>
<td>$433,060</td>
<td>6224</td>
</tr>
<tr>
<td></td>
<td>Airi</td>
<td>Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
<td>2008/11/28</td>
<td>$162,700</td>
<td>5407</td>
</tr>
<tr>
<td></td>
<td>Brielle</td>
<td>Williamson</td>
<td>Integration Specialist</td>
<td>New York</td>
<td>61</td>
<td>2012/12/02</td>
<td>$372,000</td>
<td>4804</td>
</tr>
<tr>
<td></td>
<td>Herrod</td>
<td>Chandler</td>
<td>Sales Assistant</td>
<td>San Francisco</td>
<td>59</td>
<td>2012/08/06</td>
<td>$137,500</td>
<td>9608</td>
</tr>
<tr>
<td></td>
<td>Rhona</td>
<td>Davidson</td>
<td>Integration Specialist</td>
<td>Tokyo</td>
<td>55</td>
<td>2010/10/14</td>
<td>$327,900</td>
<td>6200</td>
</tr>
<tr>
<td></td>
<td>Colleen</td>
<td>Hurst</td>
<td>Javascript Developer</td>
<td>San Francisco</td>
<td>39</td>
<td>2009/09/15</td>
<td>$205,500</td>
<td>2360</td>
</tr>
<tr>
<td></td>
<td>Sonya</td>
<td>Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>2008/12/13</td>
<td>$103,600</td>
<td>1667</td>
</tr>
<tr>
<td></td>
<td>Jena</td>
<td>Gaines</td>
<td>Office Manager</td>
<td>London</td>
<td>30</td>
<td>2008/12/19</td>
<td>$90,560</td>
<td>3814</td>
</tr>
<tr>
<td></td>
<td>Quinn</td>
<td>Flynn</td>
<td>Support Lead</td>
<td>Edinburgh</td>
<td>22</td>
<td>2013/03/03</td>
<td>$342,000</td>
<td>9497</td>
</tr>
<tr>
<td></td>
<td>Charde</td>
<td>Marshall</td>
<td>Regional Director</td>
<td>San Francisco</td>
<td>36</td>
<td>2008/10/16</td>
<td>$470,600</td>
<td>6741</td>
</tr>
<tr>
<td></td>
<td>Haley</td>
<td>Kennedy</td>
<td>Senior Marketing Designer</td>
<td>London</td>
<td>43</td>
<td>2012/12/18</td>
<td>$313,500</td>
<td>3597</td>
</tr>
<tr>
<td></td>
<td>Tatyana</td>
<td>Fitzpatrick</td>
<td>Regional Director</td>
<td>London</td>
<td>19</td>
<td>2010/03/17</td>
<td>$385,750</td>
<td>1965</td>
</tr>
<tr>
<td></td>
<td>Michael</td>
<td>Silva</td>
<td>Marketing Designer</td>
<td>London</td>
<td>66</td>
<td>2012/11/27</td>
<td>$198,500</td>
<td>1581</td>
</tr>
<tr>
<td></td>
<td>Paul</td>
<td>Byrd</td>
<td>Chief Financial Officer (CFO)</td>
<td>New York</td>
<td>64</td>
<td>2010/06/09</td>
<td>$725,000</td>
<td>3059</td>
</tr>
<tr>
<td></td>
<td>Gloria</td>
<td>Little</td>
<td>Systems Administrator</td>
<td>New York</td>
<td>59</td>
<td>2009/04/10</td>
<td>$237,500</td>
<td>1721</td>
</tr>
<tr>
<td></td>
<td>Bradley</td>
<td>Greer</td>
<td>Software Engineer</td>
<td>London</td>
<td>41</td>
<td>2012/10/13</td>
<td>$132,000</td>
<td>2558</td>
</tr>
<tr>
<td></td>
<td>Dai</td>
<td>Rios</td>
<td>Personnel Lead</td>
<td>Edinburgh</td>
<td>35</td>
<td>2012/09/26</td>
<td>$217,500</td>
<td>2290</td>
</tr>
<tr>
<td></td>
<td>Jenette</td>
<td>Caldwell</td>
<td>Development Lead</td>
<td>New York</td>
<td>30</td>
<td>2011/09/03</td>
<td>$345,000</td>
<td>1937</td>
</tr>
<tr>
<td></td>
<td>Yuri</td>
<td>Berry</td>
<td>Chief Marketing Officer (CMO)</td>
<td>New York</td>
<td>40</td>
<td>2009/06/25</td>
<td>$675,000</td>
<td>6154</td>
</tr>
<tr>
<td></td>
<td>Caesar</td>
<td>Vance</td>
<td>Pre-Sales Support</td>
<td>New York</td>
<td>21</td>
<td>2011/12/12</td>
<td>$106,450</td>
<td>8330</td>
</tr>
<tr>
<td></td>
<td>Doris</td>
<td>Wilder</td>
<td>Sales Assistant</td>
<td>Sidney</td>
<td>23</td>
<td>2010/09/20</td>
<td>$85,600</td>
<td>3023</td>
</tr>
<tr>
<td></td>
<td>Angelica</td>
<td>Ramos</td>
<td>Chief Executive Officer (CEO)</td>
<td>London</td>
<td>47</td>
<td>2009/10/09</td>
<td>$1,200,000</td>
<td>5797</td>
</tr>
<tr>
<td></td>
<td>Gavin</td>
<td>Joyce</td>
<td>Developer</td>
<td>Edinburgh</td>
<td>42</td>
<td>2010/12/22</td>
<td>$92,575</td>
<td>8822</td>
</tr>
<tr>
<td></td>
<td>Jennifer</td>
<td>Chang</td>
<td>Regional Director</td>
<td>Singapore</td>
<td>28</td>
<td>2010/11/14</td>
<td>$357,650</td>
<td>9239</td>
</tr>
<tr>
<td></td>
<td>Brenden</td>
<td>Wagner</td>
<td>Software Engineer</td>
<td>San Francisco</td>
<td>28</td>
<td>2011/06/07</td>
<td>$206,850</td>
<td>1314</td>
</tr>
<tr>
<td></td>
<td>Fiona</td>
<td>Green</td>
<td>Chief Operating Officer (COO)</td>
<td>San Francisco</td>
<td>48</td>
<td>2010/03/11</td>
<td>$850,000</td>
<td>2947</td>
</tr>
<tr>
<td></td>
<td>Shou</td>
<td>Itou</td>
<td>Regional Marketing</td>
<td>Tokyo</td>
<td>20</td>
<td>2011/08/14</td>
<td>$163,000</td>
<td>8899</td>
</tr>
<tr>
<td></td>
<td>Michelle</td>
<td>House</td>
<td>Integration Specialist</td>
<td>Sidney</td>
<td>37</td>
<td>2011/06/02</td>
<td>$95,400</td>
<td>2769</td>
</tr>
<tr>
<td></td>
<td>Suki</td>
<td>Burks</td>
<td>Developer</td>
<td>London</td>
<td>53</td>
<td>2009/10/22</td>
<td>$114,500</td>
<td>6832</td>
</tr>
<tr>
<td></td>
<td>Prescott</td>
<td>Bartlett</td>
<td>Technical Author</td>
<td>London</td>
<td>27</td>
<td>2011/05/07</td>
<td>$145,000</td>
<td>3606</td>
</tr>
<tr>
<td></td>
<td>Gavin</td>
<td>Cortez</td>
<td>Team Leader</td>
<td>San Francisco</td>
<td>22</td>
<td>2008/10/26</td>
<td>$235,500</td>
<td>2860</td>
</tr>
<tr>
<td></td>
<td>Martena</td>
<td>Mccray</td>
<td>Post-Sales support</td>
<td>Edinburgh</td>
<td>46</td>
<td>2011/03/09</td>
<td>$324,050</td>
<td>8240</td>
</tr>
<tr>
<td></td>
<td>Unity</td>
<td>Butler</td>
<td>Marketing Designer</td>
<td>San Francisco</td>
<td>47</td>
<td>2009/12/09</td>
<td>$85,675</td>
<td>5384</td>
</tr>
<tr>
<td></td>
<td>Howard</td>
<td>Hatfield</td>
<td>Office Manager</td>
<td>San Francisco</td>
<td>51</td>
<td>2008/12/16</td>
<td>$164,500</td>
<td>7031</td>
</tr>
<tr>
<td></td>
<td>Hope</td>
<td>Fuentes</td>
<td>Secretary</td>
<td>San Francisco</td>
<td>41</td>
<td>2010/02/12</td>
<td>$109,850</td>
<td>6318</td>
</tr>
<tr>
<td></td>
<td>Vivian</td>
<td>Harrell</td>
<td>Financial Controller</td>
<td>San Francisco</td>
<td>62</td>
<td>2009/02/14</td>
<td>$452,500</td>
<td>9422</td>
</tr>
<tr>
<td></td>
<td>Timothy</td>
<td>Mooney</td>
<td>Office Manager</td>
<td>London</td>
<td>37</td>
<td>2008/12/11</td>
<td>$136,200</td>
<td>7580</td>
</tr>
<tr>
<td></td>
<td>Jackson</td>
<td>Bradshaw</td>
<td>Director</td>
<td>New York</td>
<td>65</td>
<td>2008/09/26</td>
<td>$645,750</td>
<td>1042</td>
</tr>
<tr>
<td></td>
<td>Olivia</td>
<td>Liang</td>
<td>Support Engineer</td>
<td>Singapore</td>
<td>64</td>
<td>2011/02/03</td>
<td>$234,500</td>
<td>2120</td>
</tr>
<tr>
<td></td>
<td>Bruno</td>
<td>Nash</td>
<td>Software Engineer</td>
<td>London</td>
<td>38</td>
<td>2011/05/03</td>
<td>$163,500</td>
<td>6222</td>
</tr>
<tr>
<td></td>
<td>Sakura</td>
<td>Yamamoto</td>
<td>Support Engineer</td>
<td>Tokyo</td>
<td>37</td>
<td>2009/08/19</td>
<td>$139,575</td>
<td>9383</td>
</tr>
<tr>
<td></td>
<td>Thor</td>
<td>Walton</td>
<td>Developer</td>
<td>New York</td>
<td>61</td>
<td>2013/08/11</td>
<td>$98,540</td>
<td>8327</td>
</tr>
<tr>
<td></td>
<td>Finn</td>
<td>Camacho</td>
<td>Support Engineer</td>
<td>San Francisco</td>
<td>47</td>
<td>2009/07/07</td>
<td>$87,500</td>
<td>2927</td>
</tr>
<tr>
<td></td>
<td>Serge</td>
<td>Baldwin</td>
<td>Data Coordinator</td>
<td>Singapore</td>
<td>64</td>
<td>2012/04/09</td>
<td>$138,575</td>
<td>8352</td>
</tr>
<tr>
<td></td>
<td>Zenaida</td>
<td>Frank</td>
<td>Software Engineer</td>
<td>New York</td>
<td>63</td>
<td>2010/01/04</td>
<td>$125,250</td>
<td>7439</td>
</tr>
<tr>
<td></td>
<td>Zorita</td>
<td>Serrano</td>
<td>Software Engineer</td>
<td>San Francisco</td>
<td>56</td>
<td>2012/06/01</td>
<td>$115,000</td>
<td>4389</td>
</tr>
<tr>
<td></td>
<td>Jennifer</td>
<td>Acosta</td>
<td>Junior Javascript Developer</td>
<td>Edinburgh</td>
<td>43</td>
<td>2013/02/01</td>
<td>$75,650</td>
<td>3431</td>
</tr>
<tr>
<td></td>
<td>Cara</td>
<td>Stevens</td>
<td>Sales Assistant</td>
<td>New York</td>
<td>46</td>
<td>2011/12/06</td>
<td>$145,600</td>
<td>3990</td>
</tr>
<tr>
<td></td>
<td>Hermione</td>
<td>Butler</td>
<td>Regional Director</td>
<td>London</td>
<td>47</td>
<td>2011/03/21</td>
<td>$356,250</td>
<td>1016</td>
</tr>
<tr>
<td></td>
<td>Lael</td>
<td>Greer</td>
<td>Systems Administrator</td>
<td>London</td>
<td>21</td>
<td>2009/02/27</td>
<td>$103,500</td>
<td>6733</td>
</tr>
<tr>
<td></td>
<td>Jonas</td>
<td>Alexander</td>
<td>Developer</td>
<td>San Francisco</td>
<td>30</td>
<td>2010/07/14</td>
<td>$86,500</td>
<td>8196</td>
</tr>
<tr>
<td></td>
<td>Shad</td>
<td>Decker</td>
<td>Regional Director</td>
<td>Edinburgh</td>
<td>51</td>
<td>2008/11/13</td>
<td>$183,000</td>
<td>6373</td>
</tr>
<tr>
<td></td>
<td>Michael</td>
<td>Bruce</td>
<td>Javascript Developer</td>
<td>Singapore</td>
<td>29</td>
<td>2011/06/27</td>
<td>$183,000</td>
<td>5384</td>
</tr>
<tr>
<td></td>
<td>Donna</td>
<td>Snider</td>
<td>Customer Support</td>
<td>New York</td>
<td>27</td>
<td>2011/01/25</td>
<td>$112,000</td>
<td>4226</td>
</tr>
</tbody>
</table>
</body>
</html>

View file

@ -0,0 +1,47 @@
defmodule LpWeb.ErrorHelpers do
@moduledoc """
Conveniences for translating and building error messages.
"""
use Phoenix.HTML
@doc """
Generates tag for inlined form input errors.
"""
def error_tag(form, field) do
Enum.map(Keyword.get_values(form.errors, field), fn error ->
content_tag(:span, translate_error(error),
class: "invalid-feedback",
phx_feedback_for: input_id(form, field)
)
end)
end
@doc """
Translates an error message using gettext.
"""
def translate_error({msg, opts}) do
# When using gettext, we typically pass the strings we want
# to translate as a static argument:
#
# # Translate "is invalid" in the "errors" domain
# dgettext("errors", "is invalid")
#
# # Translate the number of files with plural rules
# dngettext("errors", "1 file", "%{count} files", count)
#
# Because the error messages we show in our forms and APIs
# are defined inside Ecto, we need to translate them dynamically.
# This requires us to call the Gettext module passing our gettext
# backend as first argument.
#
# Note we use the "errors" domain, which means translations
# should be written to the errors.po file. The :count option is
# set by Ecto and indicates we should also apply plural rules.
if count = opts[:count] do
Gettext.dngettext(LpWeb.Gettext, "errors", msg, msg, count, opts)
else
Gettext.dgettext(LpWeb.Gettext, "errors", msg, opts)
end
end
end

View file

@ -0,0 +1,20 @@
defmodule LpWeb.ErrorView do
use LpWeb, :view
# If you want to customize a particular status code
# for a certain format, you may uncomment below.
def render("404.html", _assigns) do
render("404_page.html", %{})
end
def render("500.html", _assigns) do
render("500_page.html", %{})
# "Internal Server Error"
end
# By default, Phoenix returns the status message from
# the template name. For example, "404.html" becomes
# "Not Found".
def template_not_found(template, _assigns) do
Phoenix.Controller.status_message_from_template(template)
end
end

View file

@ -0,0 +1,3 @@
defmodule LpWeb.GitView do
use LpWeb, :view
end

View file

@ -0,0 +1,3 @@
defmodule LpWeb.LayoutView do
use LpWeb, :view
end

View file

@ -0,0 +1,11 @@
defmodule LpWeb.OldView do
use LpWeb, :view
# def title() do
# "Awesome New Title!"
# end
# def render(conn, _params) do
# # render(conn, "index.html")
# end
end

View file

@ -0,0 +1,3 @@
defmodule LpWeb.TableView do
use LpWeb, :view
end

71
lp/mix.exs Normal file
View file

@ -0,0 +1,71 @@
defmodule Lp.MixProject do
use Mix.Project
def project do
[
app: :lp,
version: "0.1.0",
elixir: "~> 1.7",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {Lp.Application, []},
extra_applications: [:logger, :runtime_tools]
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.5.5"},
{:phoenix_ecto, "~> 4.1"},
{:ecto_sql, "~> 3.4"},
{:postgrex, ">= 0.0.0"},
{:phoenix_live_view, "~> 0.14.6"},
{:floki, ">= 0.27.0", only: :test},
{:phoenix_html, "~> 2.11"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_dashboard, "~> 0.2"},
{:telemetry_metrics, "~> 0.4"},
{:telemetry_poller, "~> 0.4"},
{:gettext, "~> 0.11"},
{:jason, "~> 1.0"},
{:plug_cowboy, "~> 2.0"},
{:phoenix_markdown, "~> 1.0"},
# {:ueberauth_github, "~> 0.7"},
{:github, "~> 0.12.0-rc1"},
{:poison, "~> 4.0.1"},
]
end
# Aliases are shortcuts or tasks specific to the current project.
# For example, to install project dependencies and perform other setup tasks, run:
#
# $ mix setup
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
[
setup: ["deps.get", "ecto.setup", "cmd npm install --prefix assets"],
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"]
]
end
end

49
lp/mix.lock Normal file
View file

@ -0,0 +1,49 @@
%{
"calliope": {:hex, :calliope, "0.4.2", "29d8585331f3c04f95d6e2f7c8367d660cfb6c2dc031bd3d22afb7e7201eb5c6", [:mix], [], "hexpm", "3e355b0057ce52e402172e3f37f739765450b9c7ec18bf84c56c12007363283c"},
"certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"},
"cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "4643e4fba74ac96d4d152c75803de6fad0b3fa5df354c71afdd6cbeeb15fac8a"},
"cowlib": {:hex, :cowlib, "2.9.1", "61a6c7c50cf07fdd24b2f45b89500bb93b6686579b069a89f88cb211e1125c78", [:rebar3], [], "hexpm", "e4175dc240a70d996156160891e1c62238ede1729e45740bdd38064dad476170"},
"db_connection": {:hex, :db_connection, "2.2.2", "3bbca41b199e1598245b716248964926303b5d4609ff065125ce98bcd368939e", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "642af240d8a8affb93b4ba5a6fcd2bbcbdc327e1a524b825d383711536f8070c"},
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
"earmark": {:hex, :earmark, "1.4.10", "bddce5e8ea37712a5bfb01541be8ba57d3b171d3fa4f80a0be9bcf1db417bcaf", [:mix], [{:earmark_parser, ">= 1.4.10", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "12dbfa80810478e521d3ffb941ad9fbfcbbd7debe94e1341b4c4a1b2411c1c27"},
"earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"},
"ecto": {:hex, :ecto, "3.4.6", "08f7afad3257d6eb8613309af31037e16c36808dfda5a3cd0cb4e9738db030e4", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "6f13a9e2a62e75c2dcfc7207bfc65645ab387af8360db4c89fee8b5a4bf3f70b"},
"ecto_sql": {:hex, :ecto_sql, "3.4.5", "30161f81b167d561a9a2df4329c10ae05ff36eca7ccc84628f2c8b9fa1e43323", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "31990c6a3579b36a3c0841d34a94c275e727de8b84f58509da5f1b2032c98ac2"},
"file_system": {:hex, :file_system, "0.2.9", "545b9c9d502e8bfa71a5315fac2a923bd060fd9acb797fe6595f54b0f975fd32", [:mix], [], "hexpm", "3cf87a377fe1d93043adeec4889feacf594957226b4f19d5897096d6f61345d8"},
"floki": {:hex, :floki, "0.28.0", "0d0795a17189510ee01323e6990f906309e9fc6e8570219135211f1264d78c7f", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "db1549560874ebba5a6367e46c3aec5fedd41f2757ad6efe567efb04b4d4ee55"},
"gettext": {:hex, :gettext, "0.18.2", "7df3ea191bb56c0309c00a783334b288d08a879f53a7014341284635850a6e55", [:mix], [], "hexpm", "f9f537b13d4fdd30f3039d33cb80144c3aa1f8d9698e47d7bcbcc8df93b1f5c5"},
"github": {:hex, :github, "0.12.0-rc1", "3b7c7efafb7ee2d6f584a129c2a42c38b1f00d12e289ba179f01865c6115e003", [:make, :mix], [{:httpoison, "~> 0.11", [hex: :httpoison, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:joken, "~> 2.0.0-rc3", [hex: :joken, repo: "hexpm", optional: false]}, {:oauth2, "~> 0.9", [hex: :oauth2, repo: "hexpm", optional: false]}], "hexpm", "f48f1f08bd9a80ad71891ea70c76e3a4c165095d48facaaaf3cde555865d0420"},
"hackney": {:hex, :hackney, "1.16.0", "5096ac8e823e3a441477b2d187e30dd3fff1a82991a806b2003845ce72ce2d84", [:rebar3], [{:certifi, "2.5.2", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.1", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.0", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "3bf0bebbd5d3092a3543b783bf065165fa5d3ad4b899b836810e513064134e18"},
"html_entities": {:hex, :html_entities, "0.5.1", "1c9715058b42c35a2ab65edc5b36d0ea66dd083767bef6e3edb57870ef556549", [:mix], [], "hexpm", "30efab070904eb897ff05cd52fa61c1025d7f8ef3a9ca250bc4e6513d16c32de"},
"httpoison": {:hex, :httpoison, "0.13.0", "bfaf44d9f133a6599886720f3937a7699466d23bb0cd7a88b6ba011f53c6f562", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "4846958172d6401c4f34ecc5c2c4607b5b0d90b8eec8f6df137ca4907942ed0f"},
"idna": {:hex, :idna, "6.0.1", "1d038fb2e7668ce41fbf681d2c45902e52b3cb9e9c77b55334353b222c2ee50c", [:rebar3], [{:unicode_util_compat, "0.5.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a02c8a1c4fd601215bb0b0324c8a6986749f807ce35f25449ec9e69758708122"},
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
"joken": {:hex, :joken, "2.0.1", "ec9ab31bf660f343380da033b3316855197c8d4c6ef597fa3fcb451b326beb14", [:mix], [{:jose, "~> 1.9", [hex: :jose, repo: "hexpm", optional: false]}], "hexpm", "059be59550f93486b1b1f6bb54b7fa573354ee8d6adbb7244cad74d62e3fdf6a"},
"jose": {:hex, :jose, "1.10.1", "16d8e460dae7203c6d1efa3f277e25b5af8b659febfc2f2eb4bacf87f128b80a", [:mix, :rebar3], [], "hexpm", "3c7ddc8a9394b92891db7c2771da94bf819834a1a4c92e30857b7d582e2f8257"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
"mime": {:hex, :mime, "1.4.0", "5066f14944b470286146047d2f73518cf5cca82f8e4815cf35d196b58cf07c47", [:mix], [], "hexpm", "75fa42c4228ea9a23f70f123c74ba7cece6a03b1fd474fe13f6a7a85c6ea4ff6"},
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
"oauth2": {:hex, :oauth2, "0.9.4", "632e8e8826a45e33ac2ea5ac66dcc019ba6bb5a0d2ba77e342d33e3b7b252c6e", [:mix], [{:hackney, "~> 1.7", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "407c6b9f60aa0d01b915e2347dc6be78adca706a37f0c530808942da3b62e7af"},
"parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"},
"phoenix": {:hex, :phoenix, "1.5.5", "9a5a197edc1828c5f138a8ef10524dfecc43e36ab435c14578b1e9b4bd98858c", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b10eaf86ad026eafad2ee3dd336f0fb1c95a3711789855d913244e270bde463b"},
"phoenix_ecto": {:hex, :phoenix_ecto, "4.2.1", "13f124cf0a3ce0f1948cf24654c7b9f2347169ff75c1123f44674afee6af3b03", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 2.15", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "478a1bae899cac0a6e02be1deec7e2944b7754c04e7d4107fc5a517f877743c0"},
"phoenix_haml": {:hex, :phoenix_haml, "0.2.3", "432b689ebb03dc821f00ae0ae5fb22e814aa8704e599763cbde538daf9f389f6", [:mix], [{:calliope, "~> 0.4.1", [hex: :calliope, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.1", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.3", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm", "bc52d3a5800034aad469c18af317cc983b362760348ce2f50c395efc733a00ec"},
"phoenix_html": {:hex, :phoenix_html, "2.14.2", "b8a3899a72050f3f48a36430da507dd99caf0ac2d06c77529b1646964f3d563e", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "58061c8dfd25da5df1ea0ca47c972f161beb6c875cd293917045b92ffe1bf617"},
"phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.2.9", "ac43a73561a4010fd2a52289a2f570829e2be5d5ea408a5af99dbed8793439e7", [:mix], [{:phoenix_html, "~> 2.14.1 or ~> 2.15", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.14.3", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.4.0 or ~> 0.5.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "f7cd3265a53d2bcd2e541a7d3c55f5a22e07bf6070b1d4adabd81791885190f7"},
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.2.4", "940c0344b1d66a2e46eef02af3a70e0c5bb45a4db0bf47917add271b76cd3914", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "38f9308357dea4cc77f247e216da99fcb0224e05ada1469167520bed4cb8cccd"},
"phoenix_live_view": {:hex, :phoenix_live_view, "0.14.7", "e05ca2e57974bb99eb54fed88b04754a622e54cf7e832db3c868bd06e0b99ff2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.5.3", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 0.5", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "899224a704221ab0019200da61019dea699763e12daa24d69edd79bc228fe5a5"},
"phoenix_markdown": {:hex, :phoenix_markdown, "1.0.3", "8095c40dd5037f4b56079ad66de3fe9136406c7c44e1222ce3c74d22e4c7870a", [:mix], [{:earmark, "~> 1.2", [hex: :earmark, repo: "hexpm", optional: false]}, {:html_entities, "~> 0.4", [hex: :html_entities, repo: "hexpm", optional: false]}, {:phoenix, ">= 1.1.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, ">= 2.3.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm", "d3591c4cb3357b068cc8284952dbacedb874b287add27787eea2d1d314b18c16"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.0.0", "a1ae76717bb168cdeb10ec9d92d1480fec99e3080f011402c0a2d68d47395ffb", [:mix], [], "hexpm", "c52d948c4f261577b9c6fa804be91884b381a7f8f18450c5045975435350f771"},
"plug": {:hex, :plug, "1.10.4", "41eba7d1a2d671faaf531fa867645bd5a3dce0957d8e2a3f398ccff7d2ef017f", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ad1e233fe73d2eec56616568d260777b67f53148a999dc2d048f4eb9778fe4a0"},
"plug_cowboy": {:hex, :plug_cowboy, "2.3.0", "149a50e05cb73c12aad6506a371cd75750c0b19a32f81866e1a323dda9e0e99d", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "bc595a1870cef13f9c1e03df56d96804db7f702175e4ccacdb8fc75c02a7b97e"},
"plug_crypto": {:hex, :plug_crypto, "1.1.2", "bdd187572cc26dbd95b87136290425f2b580a116d3fb1f564216918c9730d227", [:mix], [], "hexpm", "6b8b608f895b6ffcfad49c37c7883e8df98ae19c6a28113b02aa1e9c5b22d6b5"},
"poison": {:hex, :poison, "4.0.1", "bcb755a16fac91cad79bfe9fc3585bb07b9331e50cfe3420a24bcc2d735709ae", [:mix], [], "hexpm", "ba8836feea4b394bb718a161fc59a288fe0109b5006d6bdf97b6badfcf6f0f25"},
"postgrex": {:hex, :postgrex, "0.15.6", "a464c72010a56e3214fe2b99c1a76faab4c2bb0255cabdef30dea763a3569aa2", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "f99268325ac8f66ffd6c4964faab9e70fbf721234ab2ad238c00f9530b8cdd55"},
"ranch": {:hex, :ranch, "1.7.1", "6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881", [:rebar3], [], "hexpm", "451d8527787df716d99dc36162fca05934915db0b6141bbdac2ea8d3c7afc7d7"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
"telemetry": {:hex, :telemetry, "0.4.2", "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"},
"telemetry_metrics": {:hex, :telemetry_metrics, "0.5.0", "1b796e74add83abf844e808564275dfb342bcc930b04c7577ab780e262b0d998", [:mix], [{:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "31225e6ce7a37a421a0a96ec55244386aec1c190b22578bd245188a4a33298fd"},
"telemetry_poller": {:hex, :telemetry_poller, "0.5.1", "21071cc2e536810bac5628b935521ff3e28f0303e770951158c73eaaa01e962a", [:rebar3], [{:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "4cab72069210bc6e7a080cec9afffad1b33370149ed5d379b81c7c5f0c663fd4"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.5.0", "8516502659002cec19e244ebd90d312183064be95025a319a6c7e89f4bccd65b", [:rebar3], [], "hexpm", "d48d002e15f5cc105a696cf2f1bbb3fc72b4b770a184d8420c8db20da2674b38"},
}

View file

@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDfDCCAmSgAwIBAgIIcP+NbAJOWXAwDQYJKoZIhvcNAQELBQAwQzEaMBgGA1UE
CgwRUGhvZW5peCBGcmFtZXdvcmsxJTAjBgNVBAMMHFNlbGYtc2lnbmVkIHRlc3Qg
Y2VydGlmaWNhdGUwHhcNMjAxMDA0MDAwMDAwWhcNMjExMDA0MDAwMDAwWjBDMRow
GAYDVQQKDBFQaG9lbml4IEZyYW1ld29yazElMCMGA1UEAwwcU2VsZi1zaWduZWQg
dGVzdCBjZXJ0aWZpY2F0ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
ALIWgneD0c3VqtMDeT1t/TOEt6fHXnZ+L/j00V1bMXqmQOQlGZ8swCs3djUdfPLM
jnxfWQZ4Z6Ms3bml8KnwYsQyIG3+nW4VGB4wgow7wJX0qGC8WV/qsqci1v9YF9L0
0w+12Wpjffy2ksPrOGgjl07+BGw73I8s9xo3pBnloREgD4v7k6cuEeQ8aFr2hSkL
ttL68qIZfp6XWzqiDKHCNL4L94mBO5/K5V0scRNLt9wxUHdwjqIkgH1OAVsWmVQp
OKdxnngh5AxiNw2RK0vnTZmfoN/HoRXa5Do48qyRVo3WIsqOVIhkJZ/Fp8lSy/ui
LPlH+z2c2maBVtp4OnPcaR0CAwEAAaN0MHIwDAYDVR0TAQH/BAIwADAOBgNVHQ8B
Af8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQW
BBTQ5EXwkbu0mZ9bgrI6Q/jI2bjCzTAUBgNVHREEDTALgglsb2NhbGhvc3QwDQYJ
KoZIhvcNAQELBQADggEBADTmkM1bEBJLm87LhPZfhbmBokuw1JrAM7r8Wkun+1xu
FQyVTFWME2rZSj3VI7H059fcG+i6pgH0gVfsK8hnJ/PFQnT/HWf7IxYZRkLjmEQ1
Lf/LgCA/QfhIGxHeEJRN9bFIdmwjTF0Y3JitU440O4krYDvnoodqWSQbWMTSegN7
vHyR/sLEPHBBkkl3cAOUQbIT/zLpSYuKG3CGldyaKry2z+b+I9MUonn2dDjSZlb1
ISZJCFl+yjn1dKX9GTV1eFBn9n16B2EKIofEuM3RY72jRk1nH8DiUI2GygMZX51A
fc8Gd1iXcGSk3GllbogOCElelo2u3Sgy1c5oHMmN+oc=
-----END CERTIFICATE-----

View file

@ -0,0 +1,28 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAshaCd4PRzdWq0wN5PW39M4S3p8dedn4v+PTRXVsxeqZA5CUZ
nyzAKzd2NR188syOfF9ZBnhnoyzduaXwqfBixDIgbf6dbhUYHjCCjDvAlfSoYLxZ
X+qypyLW/1gX0vTTD7XZamN9/LaSw+s4aCOXTv4EbDvcjyz3GjekGeWhESAPi/uT
py4R5DxoWvaFKQu20vryohl+npdbOqIMocI0vgv3iYE7n8rlXSxxE0u33DFQd3CO
oiSAfU4BWxaZVCk4p3GeeCHkDGI3DZErS+dNmZ+g38ehFdrkOjjyrJFWjdYiyo5U
iGQln8WnyVLL+6Is+Uf7PZzaZoFW2ng6c9xpHQIDAQABAoIBAFSI1NNwkjW3uAfE
PVfIjwlWdWtB+vgaPCFb7Mn40Mrcgi8J4ViqgGnDQOxDnB0Qto4ZIIQuwVs2n+VQ
/KVeQzPIa5Zq50Xq43DpK/7vGiLUaNzKa05ZdQZbRl0c7uonZsytUI/svFAqRg6T
6Emeo2NOtsC9xZt9B6q9QLs+Qi+DEqRDMitBA/MIPnipoDbsmk0/HmARcTLtiqlJ
MYVWIs5kOxmXEK/TfPJRPf1dDUWJ+292t3dDcgx0QQ7vipbpYiIMXsMewqQYySuS
Dtzu20PUxAYz5lIRXPzbKhOU6/aDHUcEnwxWbq7R4aD82901jh77JvYKqxGguE2N
9uaByQECgYEA3anw9RiaQNsHVqhfha9EhpWbsPJtkCaEXVK6NKgWSyEjZy3MdAp5
0a8IjwXui5q9BSF4+dno766fXtXhZfD8M6iExioAy//iCEqnHh80ZScQ6k9xEKxk
oxqVUYsEZppYXifAZfU73r4MpOMpFlas8nCsesGUVlqrkWL/e92ZD10CgYEAzayR
5xfQJp5XnGJH7N13nn6u6NF8khgRKxfsfqTKd1Sl7bgcFfmQAcRbdcSxMf6oBdZO
r+W1zG+7YsJtd5po9csFGQX0m/aEZun+Ffi79Vp0P9vfuy3T+bnRo5f52GmJmnPM
61EB9CLAvBrd0l0MX91htY11FwyJSDvImKFd5MECgYAm6AAqFOJmRct4816oyUWe
1b2ZBkQizA/pjW6vdV1MXImpP4mmSHxvSGiZKfJfwI4yy1g/inbvMtg4PhQs32p0
6rw7R/4R0FztFaVVjSaWJpA6gC0ZPxj+49iXkm34UFj4VcPYYX3br8HqYxDAIgCD
ITG07itKKOn6P8UWCaQm5QKBgQCmr+eHfNsrkUS770MPiuW5RD6JXc4xsOOpIzh9
4xxb3fSkVoQcoye85uCg74oUVKjkIi2fjPHr/9nEToLdXf0WxzUYdKUsCXyA078j
G3VpgaeZYZ9PWfLj/18R0MeiRtZIoPVA+WQ18jx1tuhz5wlyYD8iHsT4qyZPrnQC
jzVDgQKBgDdhYgzZEHLaZsM+kVZasX39cL9pWKukukhYtsJ+O3DJaLfv3tS4+uDt
k6PbXh/HfIE8Np+urRGJ3DA3TxgDGxWe0rQVX10Om2n4eSgQH2o7TCP6BbzPXlby
EEanqVzcceGE+b2bViy63eWMQsm4bwiL7+zsSmPWrB72ZZ5vBZiq
-----END RSA PRIVATE KEY-----

View file

@ -0,0 +1,97 @@
## `msgid`s in this file come from POT (.pot) files.
##
## Do not add, change, or remove `msgid`s manually here as
## they're tied to the ones in the corresponding POT file
## (with the same domain).
##
## Use `mix gettext.extract --merge` or `mix gettext.merge`
## to merge POT files into PO files.
msgid ""
msgstr ""
"Language: en\n"
## From Ecto.Changeset.cast/4
msgid "can't be blank"
msgstr ""
## From Ecto.Changeset.unique_constraint/3
msgid "has already been taken"
msgstr ""
## From Ecto.Changeset.put_change/3
msgid "is invalid"
msgstr ""
## From Ecto.Changeset.validate_acceptance/3
msgid "must be accepted"
msgstr ""
## From Ecto.Changeset.validate_format/3
msgid "has invalid format"
msgstr ""
## From Ecto.Changeset.validate_subset/3
msgid "has an invalid entry"
msgstr ""
## From Ecto.Changeset.validate_exclusion/3
msgid "is reserved"
msgstr ""
## From Ecto.Changeset.validate_confirmation/3
msgid "does not match confirmation"
msgstr ""
## From Ecto.Changeset.no_assoc_constraint/3
msgid "is still associated with this entry"
msgstr ""
msgid "are still associated with this entry"
msgstr ""
## From Ecto.Changeset.validate_length/3
msgid "should be %{count} character(s)"
msgid_plural "should be %{count} character(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should have %{count} item(s)"
msgid_plural "should have %{count} item(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should be at least %{count} character(s)"
msgid_plural "should be at least %{count} character(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should have at least %{count} item(s)"
msgid_plural "should have at least %{count} item(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should be at most %{count} character(s)"
msgid_plural "should be at most %{count} character(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should have at most %{count} item(s)"
msgid_plural "should have at most %{count} item(s)"
msgstr[0] ""
msgstr[1] ""
## From Ecto.Changeset.validate_number/3
msgid "must be less than %{number}"
msgstr ""
msgid "must be greater than %{number}"
msgstr ""
msgid "must be less than or equal to %{number}"
msgstr ""
msgid "must be greater than or equal to %{number}"
msgstr ""
msgid "must be equal to %{number}"
msgstr ""

View file

@ -0,0 +1,95 @@
## This is a PO Template file.
##
## `msgid`s here are often extracted from source code.
## Add new translations manually only if they're dynamic
## translations that can't be statically extracted.
##
## Run `mix gettext.extract` to bring this file up to
## date. Leave `msgstr`s empty as changing them here has no
## effect: edit them in PO (`.po`) files instead.
## From Ecto.Changeset.cast/4
msgid "can't be blank"
msgstr ""
## From Ecto.Changeset.unique_constraint/3
msgid "has already been taken"
msgstr ""
## From Ecto.Changeset.put_change/3
msgid "is invalid"
msgstr ""
## From Ecto.Changeset.validate_acceptance/3
msgid "must be accepted"
msgstr ""
## From Ecto.Changeset.validate_format/3
msgid "has invalid format"
msgstr ""
## From Ecto.Changeset.validate_subset/3
msgid "has an invalid entry"
msgstr ""
## From Ecto.Changeset.validate_exclusion/3
msgid "is reserved"
msgstr ""
## From Ecto.Changeset.validate_confirmation/3
msgid "does not match confirmation"
msgstr ""
## From Ecto.Changeset.no_assoc_constraint/3
msgid "is still associated with this entry"
msgstr ""
msgid "are still associated with this entry"
msgstr ""
## From Ecto.Changeset.validate_length/3
msgid "should be %{count} character(s)"
msgid_plural "should be %{count} character(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should have %{count} item(s)"
msgid_plural "should have %{count} item(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should be at least %{count} character(s)"
msgid_plural "should be at least %{count} character(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should have at least %{count} item(s)"
msgid_plural "should have at least %{count} item(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should be at most %{count} character(s)"
msgid_plural "should be at most %{count} character(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should have at most %{count} item(s)"
msgid_plural "should have at most %{count} item(s)"
msgstr[0] ""
msgstr[1] ""
## From Ecto.Changeset.validate_number/3
msgid "must be less than %{number}"
msgstr ""
msgid "must be greater than %{number}"
msgstr ""
msgid "must be less than or equal to %{number}"
msgstr ""
msgid "must be greater than or equal to %{number}"
msgstr ""
msgid "must be equal to %{number}"
msgstr ""

View file

@ -0,0 +1,4 @@
[
import_deps: [:ecto_sql],
inputs: ["*.exs"]
]

11
lp/priv/repo/seeds.exs Normal file
View file

@ -0,0 +1,11 @@
# Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# Lp.Repo.insert!(%Lp.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong.

257
lp/priv/static/css/app.css Normal file

File diff suppressed because one or more lines are too long

BIN
lp/priv/static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

169
lp/priv/static/js/app.js Normal file

File diff suppressed because one or more lines are too long

197
lp/priv/static/js/old.js Normal file
View file

@ -0,0 +1,197 @@
//__________________ https://gamecult.games/user/plugins/backtotop/assets/js/return-to-top.js
// ===== Scroll to Top ====
$(window).scroll(function () {
if ($(this).scrollTop() >= 50) { // If page is scrolled more than 50px
$('#return-to-top').fadeIn(200); // Fade in the arrow
} else {
$('#return-to-top').fadeOut(200); // Else fade out the arrow
}
});
$('#return-to-top').click(function () { // When arrow is clicked
$('body,html').animate({
scrollTop: 0 // Scroll to top of body
}, 500);
});
// __________________ https://gamecult.games/user/plugins/simplesearch/js/simplesearch.js
((function(){
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}
var findAncestor = function(el, selector) {
while ((el = el.parentElement) && !((el.matches || el.matchesSelector).call(el, selector))) {}
return el;
};
var fields = document.querySelectorAll('input[name="searchfield"][data-search-input]');
Array.prototype.forEach.call(fields, function(field) {
var form = findAncestor(field, 'form[data-simplesearch-form]'),
min = field.getAttribute('data-min') || false,
location = field.getAttribute('data-search-input'),
separator = field.getAttribute('data-search-separator');
if (min) {
var invalid = field.getAttribute('data-search-invalid');
field.addEventListener('keydown', function() {
field.setCustomValidity(field.value.length >= min ? '' : invalid);
});
}
form.addEventListener('submit', function(event) {
event.preventDefault();
if (field.checkValidity()) {
window.location.href = location + separator + field.value;
}
});
});
})());
//_______________ https://gamecult.games/user/themes/klb4/js/jquery.treemenu.js
/*
treeMenu - jQuery plugin
version: 0.6
Copyright 2014 Stepan Krapivin
*/
(function($){
$.fn.treemenu = function(options) {
options = options || {};
options.delay = options.delay || 0;
options.openActive = options.openActive || false;
options.closeOther = options.closeOther || false;
options.activeSelector = options.activeSelector || ".active";
this.addClass("treemenu");
if (!options.nonroot) {
this.addClass("treemenu-root");
}
options.nonroot = true;
this.find("> li").each(function() {
e = $(this);
var subtree = e.find('> ul');
var button = e.find('.toggler').eq(0);
if(button.length == 0) {
// create toggler
var button = $('<span>');
button.addClass('toggler');
e.prepend(button);
}
if(subtree.length > 0) {
subtree.hide();
e.addClass('tree-closed');
e.find(button).click(function() {
var li = $(this).parent('li');
if (options.closeOther && li.hasClass('tree-closed')) {
var siblings = li.parent('ul').find("li:not(.tree-empty)");
siblings.removeClass("tree-opened");
siblings.addClass("tree-closed");
siblings.removeClass(options.activeSelector);
siblings.find('> ul').slideUp(options.delay);
}
li.find('> ul').slideToggle(options.delay);
li.toggleClass('tree-opened');
li.toggleClass('tree-closed');
li.toggleClass(options.activeSelector);
});
$(this).find('> ul').treemenu(options);
} else {
$(this).addClass('tree-empty');
}
});
if (options.openActive) {
var cls = this.attr("class");
this.find(options.activeSelector).each(function(){
var el = $(this).parent();
while (el.attr("class") !== cls) {
el.find('> ul').show();
if(el.prop("tagName") === 'UL') {
el.show();
} else if (el.prop("tagName") === 'LI') {
el.removeClass('tree-closed');
el.addClass("tree-opened");
el.show();
}
el = el.parent();
}
});
}
return this;
}
})(jQuery);
//____________________________ https://gamecult.games/user/themes/klb4/js/site.js
var isTouch = window.DocumentTouch && document instanceof DocumentTouch;
function scrollHeader() {
// Has scrolled class on header
var zvalue = $(document).scrollTop();
if ( zvalue > 75 )
$("#header").addClass("scrolled");
else
$("#header").removeClass("scrolled");
}
function parallaxBackground() {
$('.parallax').css('background-positionY', ($(window).scrollTop() * 0.3) + 'px');
}
jQuery(document).ready(function($){
scrollHeader();
// Scroll Events
if (!isTouch){
$(document).scroll(function() {
scrollHeader();
parallaxBackground();
});
};
// Touch scroll
$(document).on({
'touchmove': function(e) {
scrollHeader(); // Replace this with your code.
}
});
//Smooth scroll to start
$('#to-start').click(function(){
var start_y = $('#start').position().top;
var header_offset = 45;
window.scroll({ top: start_y - header_offset, left: 0, behavior: 'smooth' });
return false;
});
//Smooth scroll to top
$('#to-top').click(function(){
window.scroll({ top: 0, left: 0, behavior: 'smooth' });
return false;
});
// Responsive Menu
$('#toggle').click(function () {
$(this).toggleClass('active');
$('#overlay').toggleClass('open');
$('body').toggleClass('mobile-nav-open');
});
// Tree Menu
$(".tree").treemenu({delay:300});
});

View file

@ -0,0 +1,5 @@
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
# User-agent: *
# Disallow: /

View file

@ -0,0 +1,11 @@
defmodule LpWeb.PageLiveTest do
use LpWeb.ConnCase
import Phoenix.LiveViewTest
test "disconnected and connected render", %{conn: conn} do
{:ok, page_live, disconnected_html} = live(conn, "/")
assert disconnected_html =~ "Welcome to Phoenix!"
assert render(page_live) =~ "Welcome to Phoenix!"
end
end

View file

@ -0,0 +1,14 @@
defmodule LpWeb.ErrorViewTest do
use LpWeb.ConnCase, async: true
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
test "renders 404.html" do
assert render_to_string(LpWeb.ErrorView, "404.html", []) == "Not Found"
end
test "renders 500.html" do
assert render_to_string(LpWeb.ErrorView, "500.html", []) == "Internal Server Error"
end
end

View file

@ -0,0 +1,8 @@
defmodule LpWeb.LayoutViewTest do
use LpWeb.ConnCase, async: true
# When testing helpers, you may want to import Phoenix.HTML and
# use functions such as safe_to_string() to convert the helper
# result into an HTML string.
# import Phoenix.HTML
end

View file

@ -0,0 +1,40 @@
defmodule LpWeb.ChannelCase do
@moduledoc """
This module defines the test case to be used by
channel tests.
Such tests rely on `Phoenix.ChannelTest` and also
import other functionality to make it easier
to build common data structures and query the data layer.
Finally, if the test case interacts with the database,
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use LpWeb.ChannelCase, async: true`, although
this option is not recommended for other databases.
"""
use ExUnit.CaseTemplate
using do
quote do
# Import conveniences for testing with channels
import Phoenix.ChannelTest
import LpWeb.ChannelCase
# The default endpoint for testing
@endpoint LpWeb.Endpoint
end
end
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Lp.Repo)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Lp.Repo, {:shared, self()})
end
:ok
end
end

View file

@ -0,0 +1,43 @@
defmodule LpWeb.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
import other functionality to make it easier
to build common data structures and query the data layer.
Finally, if the test case interacts with the database,
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use LpWeb.ConnCase, async: true`, although
this option is not recommended for other databases.
"""
use ExUnit.CaseTemplate
using do
quote do
# Import conveniences for testing with connections
import Plug.Conn
import Phoenix.ConnTest
import LpWeb.ConnCase
alias LpWeb.Router.Helpers, as: Routes
# The default endpoint for testing
@endpoint LpWeb.Endpoint
end
end
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Lp.Repo)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Lp.Repo, {:shared, self()})
end
{:ok, conn: Phoenix.ConnTest.build_conn()}
end
end

View file

@ -0,0 +1,55 @@
defmodule Lp.DataCase do
@moduledoc """
This module defines the setup for tests requiring
access to the application's data layer.
You may define functions here to be used as helpers in
your tests.
Finally, if the test case interacts with the database,
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use Lp.DataCase, async: true`, although
this option is not recommended for other databases.
"""
use ExUnit.CaseTemplate
using do
quote do
alias Lp.Repo
import Ecto
import Ecto.Changeset
import Ecto.Query
import Lp.DataCase
end
end
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Lp.Repo)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Lp.Repo, {:shared, self()})
end
:ok
end
@doc """
A helper that transforms changeset errors into a map of messages.
assert {:error, changeset} = Accounts.create_user(%{password: "short"})
assert "password is too short" in errors_on(changeset).password
assert %{password: ["password is too short"]} = errors_on(changeset)
"""
def errors_on(changeset) do
Ecto.Changeset.traverse_errors(changeset, fn {message, opts} ->
Regex.replace(~r"%{(\w+)}", message, fn _, key ->
opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string()
end)
end)
end
end

2
lp/test/test_helper.exs Normal file
View file

@ -0,0 +1,2 @@
ExUnit.start()
Ecto.Adapters.SQL.Sandbox.mode(Lp.Repo, :manual)