mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
updates
This commit is contained in:
parent
65041f9d70
commit
d061c26caf
@ -71,6 +71,7 @@ module.exports = function(grunt) {
|
||||
'node_modules/perfect-scrollbar/dist/js/perfect-scrollbar.jquery.js',
|
||||
'node_modules/showdown/dist/showdown.js',
|
||||
'node_modules/noty/js/noty/packaged/jquery.noty.packaged.js',
|
||||
'node_modules/jquery-pjax/jquery.pjax.js',
|
||||
'assets/js/src/**/*.js'
|
||||
]
|
||||
}
|
||||
|
8
assets/css/main.min.css
vendored
8
assets/css/main.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3
assets/js/app.min.js
vendored
3
assets/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,5 @@
|
||||
$(document).ready(function() {
|
||||
$(document).pjax('a', '#container');
|
||||
$('.scroll').perfectScrollbar();
|
||||
|
||||
$("#preview").click(function(e) {
|
||||
@ -7,10 +8,16 @@ $(document).ready(function() {
|
||||
var preview = $("#preview-area"),
|
||||
editor = $('.editor textarea');
|
||||
|
||||
if ($(this).attr("previewing") == "true") {
|
||||
if ($(this).data("previewing") == "true") {
|
||||
preview.hide();
|
||||
editor.fadeIn();
|
||||
$(this).attr("previewing", "false");
|
||||
$(this).data("previewing", "false");
|
||||
|
||||
notification({
|
||||
text: "You've gone into editing mode.",
|
||||
type: 'information',
|
||||
timeout: 2000
|
||||
});
|
||||
} else {
|
||||
var converter = new showdown.Converter(),
|
||||
text = editor.val(),
|
||||
@ -18,18 +25,23 @@ $(document).ready(function() {
|
||||
|
||||
editor.hide();
|
||||
preview.html(html).fadeIn();
|
||||
$(this).attr("previewing", "true");
|
||||
$(this).data("previewing", "true");
|
||||
|
||||
notification({
|
||||
text: "You've gone into preview mode.",
|
||||
type: 'information',
|
||||
timeout: 2000
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('form').submit(function(event) {
|
||||
var data = JSON.stringify($(this).serializeForm())
|
||||
var url = $(this).attr('action')
|
||||
var action = $(this).find("input[type=submit]:focus").val();
|
||||
|
||||
console.log(data);
|
||||
var data = JSON.stringify($(this).serializeForm()),
|
||||
url = $(this).attr('action'),
|
||||
button = $(this).find("input[type=submit]:focus"),
|
||||
action = button.val();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@ -41,21 +53,17 @@ $(document).ready(function() {
|
||||
dataType: 'json',
|
||||
encode: true,
|
||||
}).done(function(data) {
|
||||
if (action == "Save") {
|
||||
var word = "saved";
|
||||
} else {
|
||||
var word = "published";
|
||||
}
|
||||
|
||||
notification({
|
||||
text: 'The post was ' + word + '.',
|
||||
type: 'success'
|
||||
text: button.data("message"),
|
||||
type: 'success',
|
||||
timeout: 5000
|
||||
});
|
||||
}).fail(function(data) {
|
||||
notification({
|
||||
text: 'Something went wrong.',
|
||||
type: 'error'
|
||||
});
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
|
@ -63,7 +63,7 @@ notification = function(options) {
|
||||
}
|
||||
|
||||
var defaults = {
|
||||
template: '<div class="noty_message"><span class="noty_icon">' + icon + '</span><span class="noty_text"></span><div class="noty_close"></div></div>'
|
||||
template: '<div class="noty_message"><span class="noty_icon">' + icon + '</span><span class="noty_text"></span></div>'
|
||||
}
|
||||
|
||||
options = $.extend({}, defaults, options);
|
||||
|
@ -13,6 +13,9 @@
|
||||
"url": "https://github.com/hacdias/caddy-hugo/issues"
|
||||
},
|
||||
"homepage": "https://github.com/hacdias/caddy-hugo#readme",
|
||||
"scripts": {
|
||||
"install": "napa defunkt/jquery-pjax"
|
||||
},
|
||||
"dependencies": {
|
||||
"animate.css": "^3.4.0",
|
||||
"font-awesome": "^4.4.0",
|
||||
@ -29,6 +32,7 @@
|
||||
"grunt-contrib-cssmin": "^0.14.0",
|
||||
"grunt-contrib-sass": "^0.9.2",
|
||||
"grunt-contrib-uglify": "^0.9.2",
|
||||
"grunt-contrib-watch": "^0.6.1"
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"napa": "^1.2.0"
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ type Page struct {
|
||||
|
||||
// Render the page
|
||||
func (p *Page) Render(w http.ResponseWriter, r *http.Request, templates ...string) (int, error) {
|
||||
if r.URL.Query().Get("minimal") == "true" {
|
||||
if r.Header.Get("X-PJAX") == "true" {
|
||||
templates = append(templates, "base_minimal")
|
||||
} else {
|
||||
templates = append(templates, "base_full")
|
||||
|
@ -48,7 +48,7 @@ func Execute(w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
w.Write([]byte("{}"))
|
||||
|
||||
if r.Header.Get("X-Save-Mode") == "publish" {
|
||||
go commands.Execute()
|
||||
commands.Execute()
|
||||
}
|
||||
} else {
|
||||
content, err := ioutil.ReadFile("config." + language)
|
||||
|
@ -25,7 +25,9 @@
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="container">
|
||||
{{ template "content" . }}
|
||||
</div>
|
||||
<footer>
|
||||
</footer>
|
||||
</body>
|
||||
|
@ -1,3 +1,5 @@
|
||||
{{ define "content" }}
|
||||
|
||||
<main>
|
||||
<a href="/admin/settings">Settings</a>
|
||||
</main>
|
||||
{{ end }}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<main class="editor">
|
||||
<form method="POST" action="">
|
||||
<div class="sidebar data scroll">
|
||||
<div class="sidebar scroll data">
|
||||
<h2>Metadata</h2>
|
||||
{{ template "frontmatter" .FrontMatter }}
|
||||
</div>
|
||||
@ -14,8 +14,8 @@
|
||||
|
||||
<div class="action-bar">
|
||||
<button id="preview" class="left">Preview</button>
|
||||
<input type="submit" value="Save">
|
||||
<input type="submit" class="default" value="Publish">
|
||||
<input type="submit" data-message="Post saved." value="Save">
|
||||
<input type="submit" data-message="Post published successfully." class="default" value="Publish">
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{ define "frontmatter" }}
|
||||
{{ range $key, $value := . }}
|
||||
{{ range $key, $value := . }}
|
||||
{{ if or (eq $value.Type "object") (eq $value.Type "array") }}
|
||||
<fieldset name="{{ $value.Name }}" type="{{ $value.Type }}">
|
||||
<h3>{{ splitCapitalize $value.Name }} <button class="add"><i class="fa fa-plus"></i></button></h3>
|
||||
@ -11,5 +11,5 @@
|
||||
{{ end }}
|
||||
<input name="{{ $value.Name }}" id="{{ $value.Name }}" value="{{ $value.Content }}"></input><br>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -4,8 +4,10 @@
|
||||
<div class="content">
|
||||
<h1>Settings</h1>
|
||||
<form method="POST" action="/admin/settings">
|
||||
<div class="data">
|
||||
{{ template "frontmatter" . }}
|
||||
<input type="submit" value="Save">
|
||||
</div>
|
||||
<input type="submit" data-message="Settings updated." value="Save">
|
||||
</form>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user