1
0
mirror of https://github.com/S2-/gitlit synced 2025-08-03 21:00:04 +02:00

9 Commits

Author SHA1 Message Date
s2
a04c84abb4 1.4.1 2019-06-21 14:15:57 +02:00
s2
31c19d5534 make jumbotron nicer 2019-06-21 09:31:36 +02:00
s2
171b79e355 1.4.0 2019-06-20 15:52:56 +02:00
s2
4178caa94a show splash screen on startup if passed path is not a git repo 2019-06-20 15:51:56 +02:00
s2
7cae3f33ec 1.3.1 2019-06-20 15:15:46 +02:00
s2
3952948a15 fix sortable 2019-06-20 15:14:33 +02:00
s2
011a78a75f style fixes 2019-06-20 15:14:33 +02:00
s2
e0ad69a5b1 remove old templates 2019-06-20 15:14:33 +02:00
s2
e994b98dcc show open an other folder button if there are no tracked files 2019-06-20 10:59:46 +02:00
12 changed files with 52 additions and 78 deletions

View File

@@ -1,3 +1,12 @@
html {
margin-bottom: 10px;
}
.jumbotron {
height: 640px;
margin-bottom: 0px;
}
.js-container { .js-container {
margin: 5px; margin: 5px;
} }

View File

@@ -15,7 +15,6 @@
<script type="text/javascript" src="../node_modules/ejs/ejs.js"></script> <script type="text/javascript" src="../node_modules/ejs/ejs.js"></script>
<script type="text/javascript" src="../node_modules/ejs-render-remote/ejs-render-remote.js"></script> <script type="text/javascript" src="../node_modules/ejs-render-remote/ejs-render-remote.js"></script>
<script type="text/javascript" src="js/templates.js"></script>
<script type="text/javascript" src="js/sorttable.js"></script> <script type="text/javascript" src="js/sorttable.js"></script>
<link href="../node_modules/bootstrap/dist/css/bootstrap.css" rel="stylesheet"> <link href="../node_modules/bootstrap/dist/css/bootstrap.css" rel="stylesheet">

View File

@@ -4,25 +4,39 @@
const electronFind = require('electron-find'); const electronFind = require('electron-find');
let findInPage = new electronFind.FindInPage(remote.getCurrentWebContents()); let findInPage = new electronFind.FindInPage(remote.getCurrentWebContents());
let firstRun = true;
//events //events
ipcRenderer.on('fileList', (event, files) => { ipcRenderer.on('fileList', (event, files) => {
firstRun = false;
if (files && files.length > 0) { if (files && files.length > 0) {
$('.files-table-container').html(ejs.rr('templates/files.ejs', {files: files})); ejs.preloadTemplate('templates/files.ejs')
sorttable.makeSortable($('.js-filestable')[0]); .then(t => {
var myTH = document.getElementsByTagName('th')[0]; $('.files-table-container').html(ejs.rr(t, {files: files}));
sorttable.innerSortFunction.apply(myTH, []); sorttable.makeSortable($('.js-filestable')[0]);
var myTH = document.getElementsByTagName('th')[0];
sorttable.innerSortFunction.apply(myTH, []);
});
} else { } else {
$('.files-table-container').html(ejs.rr('templates/noGitLfsFiles.ejs')); $('.files-table-container').html(ejs.rr('templates/noGitLfsFiles.ejs'));
} }
}); });
ipcRenderer.on('repoDir', (event, repoDir) => { ipcRenderer.on('repoDir', (event, repoDir) => {
$('.js-container').html(ejs.rr('templates/main.ejs')); ejs.preloadTemplate('templates/main.ejs')
$('.js-repo-dir').text('current repo dir: ' + repoDir).show(); .then(t => {
$('.js-container').html(ejs.rr(t));
$('.js-repo-dir').text('current repo dir: ' + repoDir).show();
});
}); });
ipcRenderer.on('isNoGitLfsRepo', (event, repoDir) => { ipcRenderer.on('isNoGitLfsRepo', (event, repoDir) => {
$('.js-container').html(ejs.rr('templates/isNoGitLfsRepo.ejs', {repoDir: repoDir})); if (firstRun) {
firstRun = false;
$('.js-container').html(ejs.rr('templates/firstRun.ejs', {repoDir: repoDir}));
} else {
$('.js-container').html(ejs.rr('templates/isNoGitLfsRepo.ejs', {repoDir: repoDir}));
}
}); });
ipcRenderer.on('notification', (event, notification) => { ipcRenderer.on('notification', (event, notification) => {

View File

@@ -1,63 +0,0 @@
window.gitlit = window.gitlit || {};
gitlit.templates = {
main: ejs.compile(`
<div class="alert alert-success js-repo-dir" style="display:none;"></div>
<div class="files-table-container">
<div class="alert alert-primary" role="alert">
Getting file list...
</div>
</div>
`),
files: ejs.compile(`
<table class="table table-striped sortable js-filestable">
<thead class="thead-light">
<tr>
<th>file</th>
<th>status</th>
<th class="sorttable_nosort">action</th>
</tr>
<thead>
<tbody>
<% files.forEach((file) => { %>
<tr>
<td><%= file.file %></td>
<td><%= file.lockedBy ? file.lockedBy + ' (id: ' + file.id + ')' : 'not locked' %></td>
<td>
<a class="btn btn-primary btn-sm js-lock"
href="javascript:///"
data-file="<%= file.file %>"
style="<%= file.lockedBy ? 'display: none;' : '' %>"
>
Lock
</a>
<a class="btn btn-danger btn-sm js-unlock"
href="javascript:///"
data-file="<%= file.file %>"
style="<%= file.lockedBy ? '' : 'display: none;' %>"
>
Unlock
</a>
</td>
</tr>
<% }); %>
</tbody>
</table>
<div class="float-right">
<a class="btn btn-secondary btn-sm js-refresh" href="javascript:///">
Refresh
</a>
</div>
`),
isNoGitLfsRepo: ejs.compile(`
<div class="alert alert-danger">
<%= repoDir %> is not a git lfs repo.
</div>
`),
noGitLfsFiles: ejs.compile(`
<div class="alert alert-info">
no files tracked with lfs here.
</div>
`)
};

View File

@@ -126,7 +126,7 @@ function loadRepoPage() {
function createWindow() { function createWindow() {
// Create the browser window. // Create the browser window.
win = new BrowserWindow({width: 800, height: 600}); win = new BrowserWindow({width: 800, height: 700});
win.setMenu(null); win.setMenu(null);
// and load the index.html of the app. // and load the index.html of the app.

View File

@@ -34,6 +34,10 @@
</table> </table>
<div class="float-right"> <div class="float-right">
<div style="display: inline;">
<a class="btn btn-primary btn-sm js-open-folder" href="javascript:///">Open another folder</a>
<input type="file" style="display: none" class="js-open-folder-input" webkitdirectory />
</div>
<a class="btn btn-secondary btn-sm js-refresh" href="javascript:///"> <a class="btn btn-secondary btn-sm js-refresh" href="javascript:///">
Refresh Refresh
</a> </a>

View File

@@ -0,0 +1,9 @@
<div class="jumbotron text-center">
<img src="../logo/logo.png">
<h1>gitlit</h1>
<p class="lead">Handle git lfs locks with ease</p>
<div class="text-center">
<a class="btn btn-primary btn-lg js-open-folder" href="javascript:///">Open git repository folder</a>
<input type="file" style="display: none" class="js-open-folder-input" webkitdirectory />
</div>
</div>

View File

@@ -1,7 +1,4 @@
<div class="alert alert-danger"> <div class="alert alert-danger">
<%= repoDir %> is not a git lfs repo. <%= repoDir %> is not a git lfs repo.
</div> </div>
<div class="text-center"> <%- ejs.rr('templates/openFolder.ejs') %>
<a class="btn btn-primary js-open-folder" href="javascript:///">Open an other folder</a>
<input type="file" style="display: none" class="js-open-folder-input" webkitdirectory />
</div>

View File

@@ -1,3 +1,4 @@
<div class="alert alert-info"> <div class="alert alert-info">
no files tracked with lfs here. no files tracked with lfs here.
</div> </div>
<%- ejs.rr('templates/openFolder.ejs') %>

View File

@@ -0,0 +1,4 @@
<div class="text-center">
<a class="btn btn-primary js-open-folder" href="javascript:///">Open another folder</a>
<input type="file" style="display: none" class="js-open-folder-input" webkitdirectory />
</div>

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "gitlit", "name": "gitlit",
"version": "1.3.0", "version": "1.4.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "gitlit", "name": "gitlit",
"version": "1.3.0", "version": "1.4.1",
"description": "", "description": "",
"main": "app/main.js", "main": "app/main.js",
"build": { "build": {