some ui updates
This commit is contained in:
parent
7ce34e0422
commit
b99d58a35b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -106,7 +106,7 @@ body > nav ul li a {
|
||||||
}
|
}
|
||||||
|
|
||||||
body > nav ul li a:hover {
|
body > nav ul li a:hover {
|
||||||
background-color: rgba(0,0,0,0.1);
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -329,8 +329,7 @@ fieldset h3 {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.block input,
|
input[type="text"] {
|
||||||
fieldset input {
|
|
||||||
border: 0;
|
border: 0;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
@ -463,23 +462,34 @@ fieldset input {
|
||||||
width: 182%;
|
width: 182%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input {
|
.foreground {
|
||||||
z-index: 99999;
|
z-index: 99999;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: rgba(0,0,0,0.1);
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.input div {
|
.input {
|
||||||
|
z-index: 999999;
|
||||||
|
position: fixed;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
max-width: 200px;
|
max-width: 25em;
|
||||||
width: 95%;
|
width: 95%;
|
||||||
position: relative;
|
top: 10%;
|
||||||
top: 50%;
|
left:50%;
|
||||||
transform: translateY(-50%);
|
transform: translateX(-50%);
|
||||||
|
background-color: #006064;
|
||||||
|
color: #fff;
|
||||||
|
padding: 1em 2em;
|
||||||
|
border-radius: .5em;
|
||||||
|
box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24);
|
||||||
|
}
|
||||||
|
|
||||||
|
.input input[type="text"] {
|
||||||
|
border-bottom: .15em solid white;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 600px) {
|
@media screen and (max-width: 600px) {
|
||||||
|
|
|
@ -71,76 +71,82 @@ $(document).on('page:browse', function() {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
if ($(this).data("opened")) {
|
if ($(this).data("opened")) {
|
||||||
$('#new-file').fadeOut(200);
|
$('.foreground').fadeOut(200);
|
||||||
|
$('#new-file-form').fadeOut(200);
|
||||||
$(this).data("opened", false);
|
$(this).data("opened", false);
|
||||||
} else {
|
} else {
|
||||||
$('#new-file').fadeIn(200);
|
$('.foreground').fadeIn(200);
|
||||||
|
$('#new-file-form').fadeIn(200);
|
||||||
$(this).data("opened", true);
|
$(this).data("opened", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#new-file').on('keypress', 'input', function(event) {
|
$('.foreground').off('click').click(function() {
|
||||||
if (event.keyCode == 13) {
|
$('.input').fadeOut(200);
|
||||||
event.preventDefault();
|
$('.foreground').fadeOut(200);
|
||||||
var value = $(this).val(),
|
$('.new').data("opened", false);
|
||||||
splited = value.split(":"),
|
});
|
||||||
filename = "",
|
|
||||||
archetype = "";
|
|
||||||
|
|
||||||
if (value == "") {
|
$('#new-file-form').submit(function(event) {
|
||||||
notification({
|
event.preventDefault();
|
||||||
text: "You have to write something. If you want to close the box, click the button again.",
|
var value = $('#new-file-name').val(),
|
||||||
type: 'warning',
|
splited = value.split(":"),
|
||||||
timeout: 5000
|
filename = "",
|
||||||
});
|
archetype = "";
|
||||||
|
|
||||||
return false;
|
if (value == "") {
|
||||||
} else if (splited.length == 1) {
|
notification({
|
||||||
filename = value;
|
text: "You have to write something. If you want to close the box, click the button again.",
|
||||||
} else if (splited.length == 2) {
|
type: 'warning',
|
||||||
filename = splited[0];
|
timeout: 5000
|
||||||
archetype = splited[1];
|
});
|
||||||
} else {
|
|
||||||
notification({
|
|
||||||
text: "Hmm... I don't understand you. Try writing something like 'name[:archetype]'.",
|
|
||||||
type: 'error'
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (splited.length == 1) {
|
||||||
|
filename = value;
|
||||||
var content = '{"filename": "' + filename + '", "archetype": "' + archetype + '"}';
|
} else if (splited.length == 2) {
|
||||||
|
filename = splited[0];
|
||||||
$.ajax({
|
archetype = splited[1];
|
||||||
type: 'POST',
|
} else {
|
||||||
url: window.location.pathname,
|
notification({
|
||||||
data: content,
|
text: "Hmm... I don't understand you. Try writing something like 'name[:archetype]'.",
|
||||||
dataType: 'json',
|
type: 'error'
|
||||||
encode: true,
|
|
||||||
}).done(function(data) {
|
|
||||||
notification({
|
|
||||||
text: "File created successfully.",
|
|
||||||
type: 'success',
|
|
||||||
timeout: 5000
|
|
||||||
});
|
|
||||||
|
|
||||||
$.pjax({
|
|
||||||
url: window.location.pathname.replace("browse", "edit") + filename,
|
|
||||||
container: '#content'
|
|
||||||
})
|
|
||||||
}).fail(function(data) {
|
|
||||||
// error types
|
|
||||||
notification({
|
|
||||||
text: 'Something went wrong.',
|
|
||||||
type: 'error'
|
|
||||||
});
|
|
||||||
console.log(data);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var content = '{"filename": "' + filename + '", "archetype": "' + archetype + '"}';
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: window.location.pathname,
|
||||||
|
data: content,
|
||||||
|
dataType: 'json',
|
||||||
|
encode: true,
|
||||||
|
}).done(function(data) {
|
||||||
|
notification({
|
||||||
|
text: "File created successfully.",
|
||||||
|
type: 'success',
|
||||||
|
timeout: 5000
|
||||||
|
});
|
||||||
|
|
||||||
|
$.pjax({
|
||||||
|
url: window.location.pathname.replace("browse", "edit") + filename,
|
||||||
|
container: '#content'
|
||||||
|
})
|
||||||
|
}).fail(function(data) {
|
||||||
|
// error types
|
||||||
|
notification({
|
||||||
|
text: 'Something went wrong.',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#upload").click(function(event) {
|
$("#upload").click(function(event) {
|
||||||
|
|
|
@ -9,10 +9,6 @@
|
||||||
<input type="file" value="Upload" multiple>
|
<input type="file" value="Upload" multiple>
|
||||||
<button id="upload">Upload <i class="fa fa-cloud-upload"></i></button>
|
<button id="upload">Upload <i class="fa fa-cloud-upload"></i></button>
|
||||||
<button class="default new">New <i class="fa fa-plus"></i></button>
|
<button class="default new">New <i class="fa fa-plus"></i></button>
|
||||||
<div id="new-file">
|
|
||||||
Write the name of the new file. If you want to use an archetype, add ':archetype' in the end, replacing 'archetype' by its name.
|
|
||||||
<input id="new-file-name" type="text">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,9 +53,19 @@
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<!-- <div class="input">
|
<div class="foreground hidden"></div>
|
||||||
<div>
|
|
||||||
<p>Write the name of the new file. If you want to use an archetype, add ':archetype' in the end, replacing 'archetype' by its name.</p>
|
<form id="new-file-form" class="input hidden">
|
||||||
</div>
|
<h3>New file</h3>
|
||||||
</div> -->
|
<p>Write the name of the new file. If you want to use an archetype, add <code>:archetype</code> in the end, replacing 'archetype' by its name.</p>
|
||||||
|
<input id="new-file-name" type="text" placeholder="Write here...">
|
||||||
|
<p class="right">
|
||||||
|
<input type="submit" value="Create">
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="input hidden" id="rename-form">
|
||||||
|
<h3>Rename file</h3>
|
||||||
|
<input id="new-file-name" type="text" placeholder="New name...">
|
||||||
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in New Issue