mirror of
https://github.com/S2-/gitlit
synced 2025-08-02 12:20:05 +02:00
ejs.rr & open folder button
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
<script type="text/javascript" src="../node_modules/pnotify/dist/iife/PNotifyButtons.js"></script>
|
<script type="text/javascript" src="../node_modules/pnotify/dist/iife/PNotifyButtons.js"></script>
|
||||||
|
|
||||||
<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="js/templates.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>
|
||||||
|
|
||||||
|
@@ -7,22 +7,22 @@
|
|||||||
//events
|
//events
|
||||||
ipcRenderer.on('fileList', (event, files) => {
|
ipcRenderer.on('fileList', (event, files) => {
|
||||||
if (files && files.length > 0) {
|
if (files && files.length > 0) {
|
||||||
$('.files-table-container').html(gitlit.templates.files({files: files}));
|
$('.files-table-container').html(ejs.rr('templates/files.ejs', {files: files}));
|
||||||
sorttable.makeSortable($('.js-filestable')[0]);
|
sorttable.makeSortable($('.js-filestable')[0]);
|
||||||
var myTH = document.getElementsByTagName('th')[0];
|
var myTH = document.getElementsByTagName('th')[0];
|
||||||
sorttable.innerSortFunction.apply(myTH, []);
|
sorttable.innerSortFunction.apply(myTH, []);
|
||||||
} else {
|
} else {
|
||||||
$('.files-table-container').html(gitlit.templates.noGitLfsFiles());
|
$('.files-table-container').html(ejs.rr('templates/noGitLfsFiles.ejs'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on('repoDir', (event, repoDir) => {
|
ipcRenderer.on('repoDir', (event, repoDir) => {
|
||||||
$('.js-container').html(gitlit.templates.main());
|
$('.js-container').html(ejs.rr('templates/main.ejs'));
|
||||||
$('.js-repo-dir').text('current repo dir: ' + repoDir).show();
|
$('.js-repo-dir').text('current repo dir: ' + repoDir).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on('isNoGitLfsRepo', (event, repoDir) => {
|
ipcRenderer.on('isNoGitLfsRepo', (event, repoDir) => {
|
||||||
$('.js-container').html(gitlit.templates.isNoGitLfsRepo({repoDir: repoDir}));
|
$('.js-container').html(ejs.rr('templates/isNoGitLfsRepo.ejs', {repoDir: repoDir}));
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on('notification', (event, notification) => {
|
ipcRenderer.on('notification', (event, notification) => {
|
||||||
@@ -76,6 +76,16 @@
|
|||||||
window.location.reload(false);
|
window.location.reload(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.js-open-folder', (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
$('.js-open-folder-input').trigger('click');
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('change', '.js-open-folder-input', (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
ipcRenderer.send('restart', $('.js-open-folder-input')[0].files[0].path);
|
||||||
|
});
|
||||||
|
|
||||||
$(document).on('keypress', (ev) => {
|
$(document).on('keypress', (ev) => {
|
||||||
//ctrl + f
|
//ctrl + f
|
||||||
if (ev.ctrlKey && ev.charCode == 6) {
|
if (ev.ctrlKey && ev.charCode == 6) {
|
||||||
|
40
app/templates/files.ejs
Normal file
40
app/templates/files.ejs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<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>
|
7
app/templates/isNoGitLfsRepo.ejs
Normal file
7
app/templates/isNoGitLfsRepo.ejs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<div class="alert alert-danger">
|
||||||
|
<%= repoDir %> is not a git lfs repo.
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<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>
|
6
app/templates/main.ejs
Normal file
6
app/templates/main.ejs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<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>
|
3
app/templates/noGitLfsFiles.ejs
Normal file
3
app/templates/noGitLfsFiles.ejs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="alert alert-info">
|
||||||
|
no files tracked with lfs here.
|
||||||
|
</div>
|
5
package-lock.json
generated
5
package-lock.json
generated
@@ -812,6 +812,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/ejs/-/ejs-2.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/ejs/-/ejs-2.6.2.tgz",
|
||||||
"integrity": "sha512-PcW2a0tyTuPHz3tWyYqtK6r1fZ3gp+3Sop8Ph+ZYN81Ob5rwmbHEzaqs10N3BEsaGTkh/ooniXK+WwszGlc2+Q=="
|
"integrity": "sha512-PcW2a0tyTuPHz3tWyYqtK6r1fZ3gp+3Sop8Ph+ZYN81Ob5rwmbHEzaqs10N3BEsaGTkh/ooniXK+WwszGlc2+Q=="
|
||||||
},
|
},
|
||||||
|
"ejs-render-remote": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/ejs-render-remote/-/ejs-render-remote-1.0.7.tgz",
|
||||||
|
"integrity": "sha512-Yr3dk+Z1tn386sntXBZv53Ql0s+vg7clKFP6URGsZvKkPr5nyc9oJ/tAZBcodHh3y9js1u+Z4DvW7wm622HjTA=="
|
||||||
|
},
|
||||||
"electron": {
|
"electron": {
|
||||||
"version": "3.1.11",
|
"version": "3.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-3.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-3.1.11.tgz",
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
"animate.css": "^3.5.2",
|
"animate.css": "^3.5.2",
|
||||||
"bootstrap": "^4.1.3",
|
"bootstrap": "^4.1.3",
|
||||||
"ejs": "^2.6.1",
|
"ejs": "^2.6.1",
|
||||||
|
"ejs-render-remote": "^1.0.7",
|
||||||
"electron-find": "^1.0.6",
|
"electron-find": "^1.0.6",
|
||||||
"electron-localshortcut": "^3.1.0",
|
"electron-localshortcut": "^3.1.0",
|
||||||
"jquery": "^3.3.1",
|
"jquery": "^3.3.1",
|
||||||
|
Reference in New Issue
Block a user