update: convert to pug

This commit is contained in:
Clément 2018-09-06 11:25:52 +02:00
parent a7d8a91457
commit facbd376bc
55 changed files with 410 additions and 478 deletions

2
.gitignore vendored
View File

@ -10,6 +10,6 @@ dist/html/*
# Files # Files
index.html index.html
config.php config.pug
issues.md issues.md
oidc-client-preprod-config.json oidc-client-preprod-config.json

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
default: install
config.pug:
cp config-sample.pug config.pug
dist/css/hd-app.css: src/scss/main.scss
npx grunt sass
install:
git submodule update --init --recursive
npm install
build: config.pug
npx grunt sass
npx pug --pretty -p index.pug < index.pug > index.html
serve: dist/css/hd-app.css
php -S 127.0.0.1:8080 router.php
.PHONY: default install build serve

View File

@ -1,12 +1,19 @@
# HD app
HD app is the magic tool that allows the Happy Dev network to thrive in a decentralized way. HD app is the magic tool that allows the Happy Dev network to thrive in a decentralized way.
## Install ## Install
* `git clone --recurse-submodules https://git.happy-dev.fr/happy-dev/hd-app.git`
* `cd hd-app`
* `cp config-sample.php config.php`
* Edit `config.php` to suit your own setup
* `npm install -g grunt-cli`
* `npm install`
## Compile SASS clone then:
* `grunt watch`
* `make install`
## Build
Compile sass & pug
* `make build`
## Run server
require PHP
* `make serve`

View File

@ -1,8 +0,0 @@
<?php
$dn = getenv("DN");// Domain Name of the app
$sdn = getenv("SDN");// Server Domain Name
if ($dn === NULL) {
$dn = 'http://hd-app.local';
$sdn = 'http://localhost:8000';
}

3
config-sample.pug Normal file
View File

@ -0,0 +1,3 @@
- var dn = 'http://127.0.0.1:8080'
- var sdn = 'http://127.0.0.1:8000'
- v = Math.random()

View File

@ -1,74 +0,0 @@
<?php
// Some useful variables
$v = rand();// Used to avoid abusive caching by the browser
require_once("config.php");// Use "config-sample.php" to create your own
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Happy Dev App</title>
<?php
// Prod/Dev setup
if (in_array($dn, array('https://app.happy-dev.fr', 'https://staging-app.happy-dev.fr'))) {
require_once("src/html/dependencies-prod.php");
} else {
require_once("src/html/dependencies-dev.php");
}
?>
</head>
<body>
<?php require_once('src/html/menu.html'); ?>
<main id="mainContainer" class="container-fluid">
<?php require_once('src/html/dashboard.html'); ?>
<?php require_once('src/html/members.html'); ?>
<?php require_once('src/html/member.php'); ?>
<?php require_once('src/html/projects.html'); ?>
<?php require_once('src/html/project.php'); ?>
<?php require_once('src/html/client-creation.html'); ?>
<?php require_once('src/html/channels.html'); ?>
<?php require_once('src/html/channel.php'); ?>
<?php require_once('src/html/search.html'); ?>
</main>
<sib-chat
id="chat-singleton"
data-authentication="login"
data-auto-login="true"
data-bosh-service-url="https://jabber.happy-dev.fr/http-bind/"
data-debug="false"
data-locales-url="en"
bind-resources
></sib-chat>
<script>
// Move the chat singleton to the right view on "page load"
window.onload = function() {
if (window.location.pathname.indexOf("-chat") !== -1) {
var chatSingleton = document.querySelector("#chat-singleton");
var pathnameParts = window.location.pathname.split("/");
var viewName = pathnameParts[pathnameParts.length - 1];
var view = document.getElementById(viewName);
view.appendChild(chatSingleton);
chatSingleton.dataset.src = view.dataset.src;
}
}
// Move the chat singleton to the right view on "navigate"
window.addEventListener('navigate', event => {
var chatSingleton = document.querySelector("#chat-singleton");
var view = document.getElementById(event.detail.route);
view.querySelector(".chat-view").appendChild(chatSingleton);
chatSingleton.dataset.src = view.dataset.src;
});
</script>
</body>
</html>

48
index.pug Normal file
View File

@ -0,0 +1,48 @@
<!DOCTYPE html>
include config.pug
html(lang='fr')
head
meta(charset='UTF-8')
meta(name='viewport', content='width=device-width, initial-scale=1.0')
meta(http-equiv='X-UA-Compatible', content='ie=edge')
title Happy Dev App
//- Prod/Dev setup
if (['https://app.happy-dev.fr', 'https://staging-app.happy-dev.fr'].includes(dn))
include src/html/dependencies-prod.pug
else
include src/html/dependencies-dev.pug
body
include src/html/menu.pug
main#mainContainer.container-fluid
include src/html/dashboard.pug
include src/html/members.pug
include src/html/member.pug
include src/html/projects.pug
include src/html/project.pug
include src/html/client-creation.pug
include src/html/channels.pug
include src/html/channel.pug
include src/html/search.pug
sib-chat#chat-singleton(data-authentication='login', data-auto-login='true', data-bosh-service-url='https://jabber.happy-dev.fr/http-bind/', data-debug='false', data-locales-url='en', bind-resources='')
script.
// Move the chat singleton to the right view on "page load"
window.onload = function() {
if (window.location.pathname.indexOf("-chat") !== -1) {
var chatSingleton = document.querySelector("#chat-singleton");
var pathnameParts = window.location.pathname.split("/");
var viewName = pathnameParts[pathnameParts.length - 1];
var view = document.getElementById(viewName);
view.appendChild(chatSingleton);
chatSingleton.dataset.src = view.dataset.src;
}
}
// Move the chat singleton to the right view on "navigate"
window.addEventListener('navigate', event => {
var chatSingleton = document.querySelector("#chat-singleton");
var view = document.getElementById(event.detail.route);
view.querySelector(".chat-view").appendChild(chatSingleton);
chatSingleton.dataset.src = view.dataset.src;
});

View File

@ -1,10 +1,10 @@
{ {
"authority": "https://test-paris.happy-dev.fr/openid/", "authority": "https://test-paris.happy-dev.fr/openid/",
"client_id": "125356", "client_id": "125356",
"redirect_uri": "http://hd-app.local", "redirect_uri": "http://127.0.0.1:8080",
"response_type": "id_token token", "response_type": "id_token token",
"scope": "openid profile email", "scope": "openid profile email",
"automaticSilentRenew": true, "automaticSilentRenew": true,
"silent_redirect_uri": "http://hd-app.local", "silent_redirect_uri": "http://127.0.0.1:8080",
"loadUserInfo": true "loadUserInfo": true
} }

8
router.php Normal file
View File

@ -0,0 +1,8 @@
<?php
if (PHP_SAPI == 'cli-server') {
$url = parse_url($_SERVER['REQUEST_URI']);
$file = __DIR__ . $url['path'];
if (is_file($file)) return false;
}
include "index.html";

View File

@ -1,4 +0,0 @@
<div id="calendar" style="display: none">
<h1 class="page-title">Agenda</h1>
<ldp-calendar data-src="http://lucky.alwaysdata.net/api/events/" style="display: block; height: 300px; width: 500px;"></ldp-calendar>
</div>

6
src/html/calendar.pug Normal file
View File

@ -0,0 +1,6 @@
#calendar(style='display: none')
h1.page-title Agenda
ldp-calendar(
data-src='http://lucky.alwaysdata.net/api/events/',
style='display: block; height: 300px; width: 500px;'
)

View File

@ -1,2 +0,0 @@
<div id="channel-chat" class="chat-view" style="display: none" bind-resources></div>

View File

@ -0,0 +1 @@
#channel-chat.chat-view(style='display: none', bind-resources='')

View File

@ -1,9 +0,0 @@
<div id="channel-create" style="display: none">
<sib-form
data-src="<?php echo $sdn; ?>/channels/"
range-owner="<?php echo $sdn; ?>/members/"
widget-members="sib-form-multiple-dropdown"
range-members="<?php echo $sdn; ?>/members/"
></sib-form>
</div>

View File

@ -0,0 +1,7 @@
#channel-create(style='display: none')
sib-form(
data-src=`${sdn}/channels/`,
range-owner=`${sdn}/members/`,
widget-members='sib-form-multiple-dropdown',
range-members=`${sdn}/members/`
)

View File

@ -1,8 +0,0 @@
<div id="channel-edit" style="display: none">
<sib-form
range-owner="<?php echo $sdn; ?>/members/"
widget-members="sib-form-multiple-dropdown"
range-members="<?php echo $sdn; ?>/members/"
bind-resources
></sib-form>
</div>

View File

@ -0,0 +1,7 @@
#channel-edit(style='display: none')
sib-form(
range-owner=`${sdn}/members/`,
widget-members='sib-form-multiple-dropdown',
range-members=`${sdn}/members/`,
bind-resources=''
)

View File

@ -1,4 +1,4 @@
<script> script.
document.addEventListener("WebComponentsReady", function(event) { document.addEventListener("WebComponentsReady", function(event) {
class HDAppMember extends SIBWidget { class HDAppMember extends SIBWidget {
get template() { get template() {
@ -18,21 +18,19 @@
} }
customElements.define("hdapp-member", HDAppMember); customElements.define("hdapp-member", HDAppMember);
}); });
</script>
<div id="channel-profile" style="display: none"> #channel-profile(style='display: none')
<sib-display sib-display(
data-fields="name, description, owner" data-fields='name, description, owner',
widget-owner="hdapp-member" widget-owner='hdapp-member',
bind-resources bind-resources=''
></sib-display> )
h2.section.skills Participants
sib-display(
id-suffix='members',
data-fields='avatar, user',
widget-avatar='sib-display-img',
widget-user='hdapp-userinfo',
bind-resources=''
)
<h2 class="section skills">Participants</h2>
<sib-display
id-suffix="members"
data-fields="avatar, user"
widget-avatar="sib-display-img"
widget-user="hdapp-userinfo"
bind-resources
></sib-display>
</div>

View File

@ -1,23 +0,0 @@
<div id="channel" style="display: none">
<sib-router id="channel-router" default-route="channel-profile">
<sib-route name="channel-chat">
<button>Chat</button>
</sib-route>
<sib-route name="channel-profile">
<button>Info</button>
</sib-route>
<sib-route name="channel-edit">
<button>Éditer</button>
</sib-route>
<sib-route name="channel-create">
<button>Nouveau</button>
</sib-route>
</sib-router>
<div id="network-views-container">
<?php require_once('channel-chat.html'); ?>
<?php require_once('channel-profile.html'); ?>
<?php require_once('channel-edit.html'); ?>
<?php require_once('channel-create.html'); ?>
</div>
</div>

15
src/html/channel.pug Normal file
View File

@ -0,0 +1,15 @@
#channel(style='display: none')
sib-router#channel-router(default-route='channel-profile')
sib-route(name='channel-chat')
button Chat
sib-route(name='channel-profile')
button Info
sib-route(name='channel-edit')
button Éditer
sib-route(name='channel-create')
button Nouveau
#network-views-container
include channel-chat.pug
include channel-profile.pug
include channel-edit.pug
include channel-create.pug

View File

@ -1,9 +0,0 @@
<div id="channels" style="display: none">
<sib-display
id="channels-list"
data-src="<?php echo $sdn; ?>/channels/"
data-fields="name, description"
search-fields="name, description"
next="channel"
></sib-display>
</div>

7
src/html/channels.pug Normal file
View File

@ -0,0 +1,7 @@
#channels(style='display: none')
sib-display#channels-list(
data-src=`${sdn}/channels/`,
data-fields='name, description',
search-fields='name, description',
next='channel'
)

View File

@ -1,7 +0,0 @@
<div id="client-create" style="display: none">
<sib-form
data-src="<?php echo $sdn; ?>/clients/"
data-fields="name, address, logo"
></sib-form>
</div>

View File

@ -0,0 +1,5 @@
#client-create(style='display: none')
sib-form(
data-src=`${sdn}/clients/`,
data-fields='name, address, logo'
)

View File

@ -1,26 +0,0 @@
<div id="dashboard" style="display: none">
<!--<form>-->
<!--<div class="form-group">-->
<!--<input type="text" class="form-control form-control-sm" id="search-input" placeholder="Recherche" aria-describedby="search-help" autofocus />-->
<!--<small id="search-help" class="form-text text-muted">* parmi les membres, les projets et les groupes de discussion</small>-->
<!--</div>-->
<!--</form>-->
<div class="list-condensed">
<ldp-display
id="to-user-profile"
data-src="<?php echo $sdn; ?>/members/1/"
set-name="firstname, name-separator, lastname"
value-name-separator="&nbsp;"
data-fields="avatar, name"
widget-avatar="ldp-display-img"
></ldp-display>
</div>
<script>
document.querySelector("#to-user-profile").addEventListener("click", () => {
document.getElementById("navbar-router").navigate("member");
document.getElementById("member-page-router").navigate("member-detail");
});
</script>
</div>

21
src/html/dashboard.pug Normal file
View File

@ -0,0 +1,21 @@
#dashboard(style='display: none')
//-
<form>
<div class="form-group">
<input type="text" class="form-control form-control-sm" id="search-input" placeholder="Recherche" aria-describedby="search-help" autofocus />
<small id="search-help" class="form-text text-muted">* parmi les membres, les projets et les groupes de discussion</small>
</div>
</form>
.list-condensed
ldp-display#to-user-profile(
data-src=`${sdn}/members/1/`,
set-name='firstname, name-separator, lastname',
value-name-separator=' ',
data-fields='avatar, name',
widget-avatar='ldp-display-img'
)
script.
document.querySelector("#to-user-profile").addEventListener("click", () => {
document.getElementById("navbar-router").navigate("member");
document.getElementById("member-page-router").navigate("member-detail");
});

View File

@ -1,19 +0,0 @@
<!-- Stylesheets -->
<link rel="stylesheet" href="<?php echo $dn; ?>/node_modules/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="<?php echo $dn; ?>/node_modules/cropper/dist/cropper.min.css" />
<link rel="stylesheet" href="<?php echo $dn; ?>/node_modules/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" href="<?php echo $dn; ?>/dist/css/hd-app.css?v=<?php echo $v ?>" />
<!-- Javascript -->
<script type="text/javascript" src="<?php echo $dn; ?>/node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $dn; ?>/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo $dn; ?>/node_modules/cropper/dist/cropper.min.js"></script>
<script type="text/javascript" src="<?php echo $dn; ?>/dist/lib/webcomponentsjs/webcomponents-loader.js"></script>
<script type="text/javascript" src="<?php echo $dn; ?>/src/js/hd-app.js?v=<?php echo $v ?>"></script>
<script src="<?php echo $dn; ?>/dist/lib/sib-chat/3rdparty/sib-oidc-client.js?v=<?php echo $v ?>"></script>
<!-- Web components -->
<link rel="import" href="<?php echo $dn; ?>/dist/lib/sib-core/sib-display.html?v=<?php echo $v ?>" />
<link rel="import" href="<?php echo $dn; ?>/dist/lib/sib-router/sib-router.html?v=<?php echo $v ?>" />
<link rel="import" href="<?php echo $dn; ?>/dist/lib/sib-chat/sib-chat.html">

View File

@ -0,0 +1,16 @@
// Stylesheets
link(rel='stylesheet', href=`${dn}/node_modules/bootstrap/dist/css/bootstrap.min.css`)
link(rel='stylesheet', href=`${dn}/node_modules/cropper/dist/cropper.min.css`)
link(rel='stylesheet', href=`${dn}/node_modules/font-awesome/css/font-awesome.min.css`)
link(rel='stylesheet', href=`${dn}/dist/css/hd-app.css?v=${v}`)
// Javascript
script(src=`${dn}/node_modules/jquery/dist/jquery.min.js`)
script(src=`${dn}/node_modules/bootstrap/dist/js/bootstrap.min.js`)
script(src=`${dn}/node_modules/cropper/dist/cropper.min.js`)
script(src=`${dn}/dist/lib/webcomponentsjs/webcomponents-loader.js`)
script(src=`${dn}/src/js/hd-app.js?v=${v}`)
script(src=`${dn}/dist/lib/sib-chat/3rdparty/sib-oidc-client.js?v=${v}`)
// Web components
link(rel='import', href=`${dn}/dist/lib/sib-core/sib-display.html?v=${v}`)
link(rel='import', href=`${dn}/dist/lib/sib-router/sib-router.html?v=${v}`)
link(rel='import', href=`${dn}/dist/lib/sib-chat/sib-chat.html`)

View File

@ -1,19 +0,0 @@
<!-- Stylesheets -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link href="https://cdn.bootcss.com/cropper/4.0.0/cropper.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="<?php echo $dn; ?>/dist/css/hd-app.css?v=<?php echo $v ?>" />
<!-- Javascript -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/cropper/4.0.0/cropper.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.2.0/webcomponents-loader.js" integrity="sha256-fUVqCtpScUF69qkFkeuHmcShr2N2UleRQJhRG4etHds=" crossorigin="anonymous"></script>
<script src="<?php echo $dn; ?>/src/js/hd-app.js?v=<?php echo $v ?>"></script>
<script src="<?php echo $cdn; ?>/sib-chat/3rdparty/sib-oidc-client.js?v=<?php echo $v ?>"></script>
<!-- Web components -->
<link rel="import" href="<?php echo $cdn; ?>/sib-core/sib-display.html?v=<?php echo $v ?>" />
<link rel="import" href="<?php echo $cdn; ?>/sib-router/sib-router.html?v=<?php echo $v ?>" />
<link rel="import" href="<?php echo $cdn; ?>/sib-chat/sib-chat.html">

View File

@ -0,0 +1,34 @@
// Stylesheets
link(rel='stylesheet', href='https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css', integrity='sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4', crossorigin='anonymous')
link(href='https://cdn.bootcss.com/cropper/4.0.0/cropper.min.css', rel='stylesheet')
link(rel='stylesheet', href='https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css')
link(rel='stylesheet', href=`${dn}/dist/css/hd-app.css?v=${v}`)
// Javascript
script(
src='https://code.jquery.com/jquery-3.3.1.slim.min.js',
integrity='sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo',
crossorigin='anonymous')
script(
src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js',
integrity='sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ',
crossorigin='anonymous')
script(
src='https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js',
integrity='sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm',
crossorigin='anonymous')
script(
src='https://cdn.bootcss.com/cropper/4.0.0/cropper.min.js')
script(
src='https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.2.0/webcomponents-loader.js',
integrity='sha256-fUVqCtpScUF69qkFkeuHmcShr2N2UleRQJhRG4etHds=',
crossorigin='anonymous')
script(
src=`${dn} ?>/src/js/hd-app.js?v=${v}`)
script(
src=`${cdn} ?>/sib-chat/3rdparty/sib-oidc-client.js?v=${v}`)
// Web components
link(rel='import', href=`${cdn} ?>/sib-core/sib-display.html?v=${v}`)
link(rel='import', href=`${cdn} ?>/sib-router/sib-router.html?v=${v}`)
link(rel='import', href=`${cdn} ?>/sib-chat/sib-chat.html`)

View File

@ -1,3 +0,0 @@
<div id="drive" style="display: none">
<h1 class="page-title">Drive</h1>
</div>

2
src/html/drive.pug Normal file
View File

@ -0,0 +1,2 @@
#drive(style='display: none')
h1.page-title Drive

View File

@ -1 +0,0 @@
<div id="member-chat" class="chat-view" style="display: none" bind-resources></div>

1
src/html/member-chat.pug Normal file
View File

@ -0,0 +1 @@
#member-chat.chat-view(style='display: none', bind-resources='')

View File

@ -1,51 +1,41 @@
<script> // script.
//class LDPFormImgUpload extends SIBWidget { class LDPFormImgUpload extends SIBWidget {
// get template() { get template() {
// return `<label for="${this.name}"><img id="${this.name}-preview" src="${this.value}"/></label> return `<label for="${this.name}"><img id="${this.name}-preview" src="${this.value}"/></label>
// <input id="${this.name}" type="file" name="${this.name}" value="${this.value}" />`; <input id="${this.name}" type="file" name="${this.name}" value="${this.value}" />`;
// } }
// render() { render() {
// store.get(this.value).then( (value) => { store.get(this.value).then( (value) => {
// this._value = value; this._value = value;
// this.innerHTML = this.template; this.innerHTML = this.template;
// }); });
// } }
//} }
//customElements.define("ldp-form-img-upload", LDPFormImgUpload); customElements.define("ldp-form-img-upload", LDPFormImgUpload);
//widget-avatar="ldp-form-img-upload" widget-avatar="ldp-form-img-upload"
</script>
<div id="member-edit" style="display: none"> #member-edit(style='display: none')
<label for="avatar-input" class="d-none"> label.d-none(for='avatar-input')
<img id="avatar-preview" src="" style="width: 100%;"/> img#avatar-preview(src='', style='width: 100%;')
</label> input#avatar-input.d-none(accept='image/*', name='avatar', value='', type='file')
<input class="d-none" type="file" accept="image/*" id="avatar-input" name="avatar" value="" /> sib-form.edit-form(
data-fields='user, avatar, bio, cell, jabberID, number, pseudo, skills, website',
widget-user='hdapp-usereditinfo',
range-cell=`${sdn}/cells/`, widget-skills='sib-form-multiple-dropdown',
range-skills=`${sdn}/skills/`,
bind-resources=''
)
#crop-modal
.crop-wrapper
img#crop-preview(src='')
.control-bar
button#cancel-img-cropping.btn.btn-link Annuler
i#rotate-img.fa.fa-undo(aria-hidden='true')
button#crop-img.btn.btn-link Valider
<sib-form
class="edit-form"
data-fields="user, avatar, bio, cell, jabberID, number, pseudo, skills, website"
widget-user="hdapp-usereditinfo"
range-cell="<?php echo $sdn; ?>/cells/"
widget-skills="sib-form-multiple-dropdown"
range-skills="<?php echo $sdn; ?>/skills/"
bind-resources
></sib-form>
</div>
<div id="crop-modal"> script.
<div class="crop-wrapper">
<img id="crop-preview" src="" />
</div>
<div class="control-bar">
<button id="cancel-img-cropping" class="btn btn-link">Annuler</button>
<i id="rotate-img" class="fa fa-undo" aria-hidden="true"></i>
<button id="crop-img" class="btn btn-link">Valider</button>
</div>
</div>
<script>
// Constant declaration // Constant declaration
const avatarPreview = document.querySelector("#avatar-preview"); const avatarPreview = document.querySelector("#avatar-preview");
const avatarInput = document.querySelector("#avatar-input"); const avatarInput = document.querySelector("#avatar-input");
@ -105,4 +95,3 @@
avatarPreview.src = $cropPreview.cropper("getCroppedCanvas").toDataURL() avatarPreview.src = $cropPreview.cropper("getCroppedCanvas").toDataURL()
closeCropping(); closeCropping();
}); });
</script>

View File

@ -1,13 +0,0 @@
<div id="member-profile" style="display: none">
<sib-display
id="member-info"
data-fields="avatar, user, before-pseudo, pseudo, bio, cell, number, roles, website, skills"
widget-avatar="sib-display-img"
widget-user="hdapp-userinfo"
widget-cell="hdapp-usercell"
widget-number="sib-display-tel"
widget-roles="sib-display-lookuplist"
widget-skills="sib-display-lookuplist"
bind-resources
></sib-display>
</div>

View File

@ -0,0 +1,11 @@
#member-profile(style='display: none')
sib-display#member-info(
data-fields='avatar, user, before-pseudo, pseudo, bio, cell, number, roles, website, skills',
widget-avatar='sib-display-img',
widget-user='hdapp-userinfo',
widget-cell='hdapp-usercell',
widget-number='sib-display-tel',
widget-roles='sib-display-lookuplist',
widget-skills='sib-display-lookuplist',
bind-resources=''
)

View File

@ -1,19 +0,0 @@
<div id="member" style="display: none">
<sib-router id="member-router" default-route="member-profile">
<sib-route name="member-chat">
<button>Chat</button>
</sib-route>
<sib-route name="member-profile">
<button>Voir</button>
</sib-route>
<sib-route name="member-edit">
<button>Éditer</button>
</sib-route>
</sib-router>
<div id="member-views-container">
<?php require_once('member-chat.html'); ?>
<?php require_once('member-profile.html'); ?>
<?php require_once('member-edit.html'); ?>
</div>
</div>

12
src/html/member.pug Normal file
View File

@ -0,0 +1,12 @@
#member(style='display: none')
sib-router#member-router(default-route='member-profile')
sib-route(name='member-chat')
button Chat
sib-route(name='member-profile')
button Voir
sib-route(name='member-edit')
button Éditer
#member-views-container
include member-chat.pug
include member-profile.pug
include member-edit.pug

View File

@ -1,4 +1,4 @@
<script> script.
document.addEventListener("WebComponentsReady", function(event) { document.addEventListener("WebComponentsReady", function(event) {
class HDAppUserInfo extends SIBDisplayLookupList { class HDAppUserInfo extends SIBDisplayLookupList {
get parentElement() {return "div"} get parentElement() {return "div"}
@ -50,22 +50,20 @@
} }
customElements.define("hdapp-usercell", HDAppCell); customElements.define("hdapp-usercell", HDAppCell);
}); });
</script>
<div id="members" class="view" style="display: none"> #members.view(style='display: none')
<sib-display sib-display#profiles-list(
id="profiles-list" data-src=`${sdn}/members/`,
data-src="<?php echo $sdn; ?>/members/" data-fields='avatar, user, before-pseudo, pseudo, bio, cell, skills',
data-fields="avatar, user, before-pseudo, pseudo, bio, cell, skills" value-before-pseudo='@',
value-before-pseudo="@" widget-avatar='sib-display-img',
widget-avatar="sib-display-img" widget-user='hdapp-userinfo',
widget-user="hdapp-userinfo" widget-cell='hdapp-usercell',
widget-cell="hdapp-usercell" widget-skills='sib-display-lookuplist',
widget-skills="sib-display-lookuplist" set-searchset='user.first_name, user.last_name',
set-searchset="user.first_name, user.last_name" search-fields='searchset',
search-fields="searchset" next='member'
next="member" )
></sib-display>
</div>

View File

@ -1,37 +0,0 @@
<nav class="navbar bg-white fixed-top border-bottom pb-0 d-md-flex" id="navbar">
<sib-router id="navbar-router" class="navbar-nav" default-route="members">
<sib-route id="menu-title" class="nav-item" name="dashboard">
HAPPY DEV
</sib-route>
<div id="menu-items" class="col-7 col-md-7">
<sib-route class="nav-item pb-2 active align-self-stretch text-center text-md-left" name="members">
<i class="fa fa-users" aria-hidden="true"></i>
<span class="d-none d-md-inline">Membres</span>
</sib-route>
<sib-route class="d-none" name="member" id-prefix="<?php echo $sdn; ?>/members/"></sib-route>
<sib-route class="nav-item pb-2 align-self-stretch text-center text-md-left" name="projects">
<i class="fa fa-tasks" aria-hidden="true"></i>
<span class="d-none d-md-inline"> Projets</span>
</sib-route>
<sib-route class="d-none" name="project" id-prefix="<?php echo $sdn; ?>/projects/"></sib-route>
<sib-route name="client-create">New client</sib-route>
<sib-route class="nav-item pb-2 align-self-stretch text-center text-md-left" name="channels">
<i class="fa fa-comments" aria-hidden="true"></i>
<span class="d-none d-md-inline"> Network</span>
</sib-route>
<sib-route class="d-none" name="channel" id-prefix="<?php echo $sdn; ?>/channels/"></sib-route>
</div>
<div class="col-2 col-md-1"></div>
</sib-router>
<div id="search-bar">
<input id="search-input" class="form-control" type="search" placeholder="ctrl + k"/>
<i id="search-icon" class="fa fa-search" aria-hidden="true"></i>
<i id="close-search-icon" class="fa fa-times" aria-hidden="true"></i>
</div>
</nav>

23
src/html/menu.pug Normal file
View File

@ -0,0 +1,23 @@
nav#navbar.navbar.bg-white.fixed-top.border-bottom.pb-0.d-md-flex
sib-router#navbar-router.navbar-nav(default-route='members')
sib-route#menu-title.nav-item(name='dashboard')
| HAPPY DEV
#menu-items.col-7.col-md-7
sib-route.nav-item.pb-2.active.align-self-stretch.text-center.text-md-left(name='members')
i.fa.fa-users(aria-hidden='true')
span.d-none.d-md-inline Membres
sib-route.d-none(name='member', id-prefix=`${sdn}/members/`)
sib-route.nav-item.pb-2.align-self-stretch.text-center.text-md-left(name='projects')
i.fa.fa-tasks(aria-hidden='true')
span.d-none.d-md-inline Projets
sib-route.d-none(name='project', id-prefix=`${sdn}/projects/`)
sib-route(name='client-create') New client
sib-route.nav-item.pb-2.align-self-stretch.text-center.text-md-left(name='channels')
i.fa.fa-comments(aria-hidden='true')
span.d-none.d-md-inline Network
sib-route.d-none(name='channel', id-prefix=`${sdn}/channels/`)
.col-2.col-md-1
#search-bar
input#search-input.form-control(placeholder='ctrl + k', type='search')
i#search-icon.fa.fa-search(aria-hidden='true')
i#close-search-icon.fa.fa-times(aria-hidden='true')

View File

@ -1 +0,0 @@
<div id="project-chat" class="chat-view" style="display: none" bind-resources></div>

View File

@ -0,0 +1 @@
#project-chat.chat-view(style='display: none', bind-resources='')

View File

@ -1,8 +0,0 @@
<div id="project-create" style="display: none">
<sib-form
data-src="<?php echo $sdn; ?>/projects/"
range-client="<?php echo $sdn; ?>/clients/"
widget-team="sib-form-multiple-dropdown"
range-team="<?php echo $sdn; ?>/members/"
></sib-form>
</div>

View File

@ -0,0 +1,7 @@
#project-create(style='display: none')
sib-form(
data-src=`${sdn}/projects/`,
range-client=`${sdn}/clients/`,
widget-team='sib-form-multiple-dropdown',
range-team=`${sdn}/members/`
)

View File

@ -1,9 +0,0 @@
<div id="project-edit" style="display: none">
<sib-form
range-client="<?php echo $sdn; ?>/clients/"
widget-team="sib-form-multiple-dropdown"
range-team="<?php echo $sdn; ?>/members/"
bind-resources
></sib-form>
</div>

View File

@ -0,0 +1,7 @@
#project-edit(style='display: none')
sib-form(
range-client=`${sdn}/clients/`,
widget-team='sib-form-multiple-dropdown',
range-team=`${sdn}/members/`,
bind-resources=''
)

View File

@ -1,19 +0,0 @@
<div id="project-profile" style="display: none">
<sib-display
data-fields="name, number, client"
widget-client="hdapp-client"
bind-resources
></sib-display>
<h2>Team</h2>
<sib-display
class="members-list-condensed"
id-suffix="team"
data-fields="avatar, user"
widget-avatar="sib-display-img"
widget-user="hdapp-userinfo"
next="member"
bind-resources
></sib-display>
</div>

View File

@ -0,0 +1,15 @@
#project-profile(style='display: none')
sib-display(
data-fields='name, number, client',
widget-client='hdapp-client',
bind-resources=''
)
h2 Team
sib-display.members-list-condensed(
id-suffix='team',
data-fields='avatar, user',
widget-avatar='sib-display-img',
widget-user='hdapp-userinfo',
next='member',
bind-resources=''
)

View File

@ -1,23 +0,0 @@
<div id="project" style="display: none">
<sib-router id="project-router" default-route="project-profile">
<sib-route name="project-chat">
<button>Chat</button>
</sib-route>
<sib-route name="project-profile">
<button>Voir</button>
</sib-route>
<sib-route name="project-edit">
<button>Éditer</button>
</sib-route>
<sib-route name="project-create">
<button>Nouveau</button>
</sib-route>
</sib-router>
<div id="project-views-container">
<?php require_once('project-chat.html'); ?>
<?php require_once('project-profile.html'); ?>
<?php require_once('project-edit.html'); ?>
<?php require_once('project-create.html'); ?>
</div>
</div>

15
src/html/project.pug Normal file
View File

@ -0,0 +1,15 @@
#project(style='display: none')
sib-router#project-router(default-route='project-profile')
sib-route(name='project-chat')
button Chat
sib-route(name='project-profile')
button Voir
sib-route(name='project-edit')
button Éditer
sib-route(name='project-create')
button Nouveau
#project-views-container
include project-chat.pug
include project-profile.pug
include project-edit.pug
include project-create.pug

View File

@ -1,4 +1,4 @@
<script> script.
document.addEventListener("WebComponentsReady", function(event) { document.addEventListener("WebComponentsReady", function(event) {
class HDAppClient extends SIBWidget { class HDAppClient extends SIBWidget {
get template() { get template() {
@ -14,15 +14,12 @@
} }
customElements.define("hdapp-client", HDAppClient); customElements.define("hdapp-client", HDAppClient);
}); });
</script>
<div id="projects" style="display: none">
<sib-display
data-src="<?php echo $sdn; ?>/projects/"
data-fields="number, client, name"
widget-client="hdapp-client"
search-fields="number, name"
next="project"
></sib-display>
</div>
#projects(style='display: none')
sib-display(
data-src=`${sdn}/projects/`,
data-fields='number, client, name',
widget-client='hdapp-client',
search-fields='number, name',
next='project'
)

View File

@ -1,35 +0,0 @@
<div id="search-view">
<div class="content container-fluid">
<ldp-display
id="search-results-members"
class="list-condensed"
data-src="<?php echo $sdn; ?>/members/"
set-name="firstname, name-separator, lastname"
value-name-separator="&nbsp;"
data-fields="avatar, name"
widget-avatar="ldp-display-img"
search-fields="firstname, lastname"
next="member"
></ldp-display>
<ldp-display
id="search-results-projects"
class="list-condensed"
data-src="<?php echo $sdn; ?>/projects/"
set-title="number, after-num-separator, name"
value-after-num-separator="&nbsp;-&nbsp;"
data-fields="client, title"
widget-client="ldp-display-client"
search-fields="number, name"
next="project"
></ldp-display>
<ldp-display
id="search-results-channels"
data-src="<?php echo $sdn; ?>/channels/"
data-fields="name"
search-fields="name"
next="channel"
></ldp-display>
</div>
</div>

26
src/html/search.pug Normal file
View File

@ -0,0 +1,26 @@
#search-view
.content.container-fluid
ldp-display#search-results-members.list-condensed(
data-src=`${sdn}/members/`,
set-name='firstname, name-separator, lastname',
value-name-separator=' ',
data-fields='avatar, name',
widget-avatar='ldp-display-img',
search-fields='firstname, lastname',
next='member'
)
ldp-display#search-results-projects.list-condensed(
data-src=`${sdn}/projects/`,
set-title='number, after-num-separator, name',
value-after-num-separator=' - ',
data-fields='client, title',
widget-client='ldp-display-client',
search-fields='number, name',
next='project'
)
ldp-display#search-results-channels(
data-src=`${sdn}/channels/`,
data-fields='name',
search-fields='name',
next='channel'
)