Skip to content
This repository was archived by the owner on Oct 6, 2022. It is now read-only.

Commit

Permalink
Separate landing page from download component
Browse files Browse the repository at this point in the history
  • Loading branch information
mdcfe committed Mar 25, 2018
1 parent 0818400 commit 59af7ae
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 68 deletions.
33 changes: 33 additions & 0 deletions docute-landing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const landing = {
html: `
<div id="landing" class="main content markdown-body">
<p><img src="https://camo.githubusercontent.com/9ad178e5cf76a372d6aaee8bbdf13485fbc1d51b/68747470733a2f2f692e696d6775722e636f6d2f435034535a70422e706e67"></img></p>
<p><i>This is not an official EssentialsX site.</i></p>
<section>
<a class="big wiki" href="#/_Sidebar">Visit wiki</a>
<a class="big download" href="#" @click="toggleDownloads">
<span v-if="showDownloads">Hide downloads</span>
<span v-else>Show downloads</span>
</a>
</section>
<DownloadPage v-if="showDownloads"></DownloadPage>
</div>
`,
component: {
components: {
DownloadPage,
},
data() {
return {
showDownloads: false,
};
},
methods: {
toggleDownloads() {
this.showDownloads = !this.showDownloads;
}
}
},
};

window.landing = landing;
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
<div id="app"></div>
<script src="https://unpkg.com/docute@3/dist/docute.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>

<script src="https://unpkg.com/[email protected]/components/prism-groovy.js"></script>
<script src="https://unpkg.com/[email protected]/components/prism-java.js"></script>
<script src="docute-wikilink.js"></script>

<script src="vue-dlpage.js"></script>
<script src="docute-landing.js"></script>
<script src="docute-wikilink.js"></script>

<script src="main.js"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions main.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,29 @@ button:active {
.link:hover {
color: var(--main);
}

a.big::before {
content: "➔";
background: var(--main-dark);
border-radius: 4px 0 0 4px;
display: inline-block;
padding: 0.3em 0.5em;
margin: 0 0.5em 0 0;
color: white;
font-size: 16pt;
text-align: center;
}

a.big.download {
content:
}

a.big {
background: var(--main);
border-radius: 4px;
display: inline-block;
padding: 0 0.5em 0 0;
color: white;
font-size: 16pt;
text-align: center;
}
3 changes: 2 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const mirrorCI = "https://ci.akpmakes.tech/job/EssentialsX/";

axios.defaults.baseURL = mirrorCI; // ender.zone doesn't allow CORS

const landing = window.dlPage;
//const landing = window.landing;
//const dlPage = window.dlPage;

docute.init({
url: "https://raw.githubusercontent.com/wiki/EssentialsX/Essentials/",
Expand Down
123 changes: 57 additions & 66 deletions vue-dlpage.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,65 @@
const component = {
html: `
<transition name="fadein">
<div id="landing" class="main content markdown-body">
<p><img src="https://camo.githubusercontent.com/9ad178e5cf76a372d6aaee8bbdf13485fbc1d51b/68747470733a2f2f692e696d6775722e636f6d2f435034535a70422e706e67"></img></p>
<p><i>This is not an official EssentialsX site.</i></p>
const DownloadPage = {
template: `
<section>
<h2>Download EssentialsX</h2>
<section>
<p v-if="buildNo">The latest version of EssentialsX is <b>{{build}}</b>.</p>
<p v-if="failed" class="warning">Could not retrieve information about the latest version.</p>
<table v-if="buildNo">
<tr>
<th>Plugin</th>
<th>Main</th>
<th>Mirror</th>
</tr>
<tr v-for="plugin in plugins" :key="plugin.name">
<td>{{ plugin.name }}</td>
<td><a :href="plugin.main">Download</a></td>
<td><a :href="plugin.mirror">Download</a></td>
</tr>
</table>
<button @click="updateInfo">Update</button>
</section>
<h2>Help for EssentialsX</h2>
<section>
<router-link to="/Home">Go to EssentialsX Wiki</router-link>
</section>
</div>
</transition>
<p v-if="buildNo">The latest version of EssentialsX is <b>{{build}}</b>.</p>
<p v-if="failed" class="warning">
Could not retrieve information about the latest version.
Click <a href="https://ci.ender.zone/job/EssentialsX">here</a> to visit the build server.
</p>
<table v-if="buildNo">
<tr>
<th>Plugin</th>
<th>Main</th>
<th>Mirror</th>
</tr>
<tr v-for="plugin in plugins" :key="plugin.name">
<td>{{ plugin.name }}</td>
<td><a :href="plugin.main">Download</a></td>
<td><a :href="plugin.mirror">Download</a></td>
</tr>
</table>
<button @click="updateInfo">Update</button>
</section>
`,
component: {
data() {
return {
buildNo: null,
failed: null,
plugins: [],
};
},
computed: {
build() {
return this.buildNo ? `b${this.buildNo}` : "unknown";
},
data() {
return {
buildNo: null,
failed: null,
plugins: [],
};
},
computed: {
build() {
return this.buildNo ? `b${this.buildNo}` : "unknown";
},
methods: {
updateInfo() {
axios.get("lastSuccessfulBuild/api/json")
.then(response => {
this.buildNo = response.data.id;
this.plugins = response.data.artifacts.map(artifact => {
return {
name: `EssentialsX ${artifact.displayPath.match(/EssentialsX([A-Za-z]*)/)[1]}`,
main: `${mainCI}lastSuccessfulBuild/artifact/${artifact.relativePath}`,
mirror: `${mirrorCI}lastSuccessfulBuild/artifact/${artifact.relativePath}`,
};
});
this.failed = null;
}, error => {
if (error.response) {
this.failed = error.response.data;
} else {
this.failed = error.message;
}
},
methods: {
updateInfo() {
axios.get("lastSuccessfulBuild/api/json")
.then(response => {
this.buildNo = response.data.id;
this.plugins = response.data.artifacts.map(artifact => {
return {
name: `EssentialsX ${artifact.displayPath.match(/EssentialsX([A-Za-z]*)/)[1]}`,
main: `${mainCI}lastSuccessfulBuild/artifact/${artifact.relativePath}`,
mirror: `${mirrorCI}lastSuccessfulBuild/artifact/${artifact.relativePath}`,
};
});
this.failed = null;
}, error => {
if (error.response) {
this.failed = error.response.data;
} else {
this.failed = error.message;
}
);
}
},
mounted: function () {
this.updateInfo();
}
);
}
},
mounted: function () {
this.updateInfo();
}
};

window.dlPage = component;
window.DownloadPage = DownloadPage;

0 comments on commit 59af7ae

Please sign in to comment.