Commit a2ecabed authored by svilayphiou's avatar svilayphiou
Browse files

put back static folder with pad.js

parent ea5320d6
......@@ -11,4 +11,3 @@ xhttp.onreadystatechange = function() {
};
xhttp.open("GET", "https://semestriel.framapad.org/p/9f7m-osp-website-css/export/txt", true);
xhttp.send();
......@@ -4,6 +4,8 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Projects</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
......@@ -33,5 +35,8 @@
</main>
<script src="http://localhost:8000/static/js/pad.js" type="text/javascript" charset="utf-8"></script>
{% block script %}
{% endblock %}
</body>
</html>
......@@ -29,7 +29,16 @@
{% endfor %}
</ul>
</section>
<section id="commits" class="repo-views">
<div class='iceberg'>
<h3>Iceberg</h3>
<div v-for="image in repo.iceberg">
<img v-bind:src="image.src">
</div>
</div>
<section id="commits">
<h3>Commits</h3>
<ul class="commit-list">
......@@ -54,4 +63,56 @@
{% endblock content %}
{% block script %}
<script type="text/javascript" charset="utf-8">
var gitlab_url = "http://gitlab.constantvzw.org";
var user_name = "osp";
var repoID = {{ project.id }}
var repo = {}
getMetadata(repoID);
getIceberg(repoID);
var reposApp = new Vue({
el: '#repo',
data: {
repo
}
})
// METADATA ///////////////////////////////
function getMetadata(repoID) {
let repo_url = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID;
fetch(repo_url).then(function(resp){ return resp.json(); })
.then(function(data){
name = data.name.split(".").slice(1);
repo.id = repoID;
repo.repo = data.name;
repo.name = name.replace(",", " ");
repo.iceberg = [];
if (data.default_branch == "archive"){
repo.archived = "archived";
}
})
}
function getIceberg(repoID){
let icebergURL = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID + "/repository/tree?path=iceberg";
fetch(icebergURL).then(function(resp){ return resp.json(); })
.then(function(data){
return data.map(function(image) {
item = {};
item.name = image.name;
project_path = [gitlab_url, user_name, repo.repo].join('/');
if(repo.archived){ branch = "archive";} else { branch = "master" }
item.src = project_path + "/raw/" + branch + "/" + image.path;
repo.iceberg.push(item);
})
});
}
</script>
{% endblock script %}
......@@ -5,8 +5,6 @@
<title>OSP works</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<style>
img {
max-width: 200px;
......@@ -39,19 +37,22 @@
</div>
<script type="text/javascript" charset="utf-8">
let body = document.querySelector('body');
var gitlab_url = "http://gitlab.constantvzw.org";
var user_name = "osp";
var repos = [448, 456, 508]
var appRepo = new Vue({
el: '.repo',
data: {
repoTitle: 'Hello Vue!'
}
})
for (i=0; i < repos.length; i++) {
let repo = document.createElement('div'),
title = document.createElement('h2'),
......@@ -135,6 +136,7 @@
</script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script type="text/javascript" charset="utf-8" src="pad.js"> </script>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment