mirror of
https://github.com/pinry/pinry.git
synced 2025-11-14 09:05:41 +01:00
Improve error message system and add errors to basic functions
This commit is contained in:
@@ -1,19 +1,19 @@
|
|||||||
.messages {
|
#messages {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
top: 50px;
|
top: 60px;
|
||||||
z-index: 200;
|
z-index: 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
.messages li {
|
#messages li {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
font-size: 16px
|
font-size: 16px
|
||||||
margin: 10px 0;
|
margin: 5px 0;
|
||||||
padding: 18px 28px;
|
padding: 18px 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.messages li:hover {
|
#messages li:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
-webkit-transform: scale(1.1);
|
-webkit-transform: scale(1.1);
|
||||||
-moz-transform: scale(1.1);
|
-moz-transform: scale(1.1);
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ $(window).load(function() {
|
|||||||
promise.success(function(pin) {
|
promise.success(function(pin) {
|
||||||
createBox(pin);
|
createBox(pin);
|
||||||
});
|
});
|
||||||
|
promise.error(function() {
|
||||||
|
message('Problem problem fetching pin data.', 'alert alert-error');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var delayTime = 3000,
|
window.message = function(text, classes) {
|
||||||
alerts = $('.alert');
|
classes = typeof classes !== 'undefined' ? classes : 'alert';
|
||||||
|
messageHtml = renderTemplate('#messages-template', {
|
||||||
delayTime = delayTime + (alerts.length * 250);
|
text: text,
|
||||||
|
classes: classes
|
||||||
alerts.each(function() {
|
});
|
||||||
$(this).delay(delayTime).fadeOut('slow');
|
$('#messages').append(messageHtml);
|
||||||
delayTime -= 250;
|
$('#messages li').each(function() {
|
||||||
console.log(delayTime);
|
$(this).delay(3000).fadeOut(300);
|
||||||
});
|
var messageDelayed = $(this);
|
||||||
|
setTimeout(function() {
|
||||||
|
messageDelayed.remove();
|
||||||
|
}, 3300);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ $(window).load(function() {
|
|||||||
$('#pin-form-image-url').val(image.thumbnail.image);
|
$('#pin-form-image-url').val(image.thumbnail.image);
|
||||||
createPinPreviewFromForm();
|
createPinPreviewFromForm();
|
||||||
});
|
});
|
||||||
|
promise.error(function() {
|
||||||
|
message('Problem uploading image.', 'alert alert-error');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
// If bookmarklet submit
|
// If bookmarklet submit
|
||||||
if (pinFromUrl) {
|
if (pinFromUrl) {
|
||||||
@@ -118,6 +121,9 @@ $(window).load(function() {
|
|||||||
dismissModal(modal);
|
dismissModal(modal);
|
||||||
uploadedImage = false;
|
uploadedImage = false;
|
||||||
});
|
});
|
||||||
|
promise.error(function() {
|
||||||
|
message('Problem saving image.', 'alert alert-error');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
$('#pin-form-close').click(function() {
|
$('#pin-form-close').click(function() {
|
||||||
if (pinFromUrl) return window.close();
|
if (pinFromUrl) return window.close();
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ $(window).load(function() {
|
|||||||
thisPin.closest('.pin').remove();
|
thisPin.closest('.pin').remove();
|
||||||
tileLayout();
|
tileLayout();
|
||||||
});
|
});
|
||||||
|
promise.error(function() {
|
||||||
|
message('Problem deleting image.', 'alert alert-error');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,9 @@
|
|||||||
<link rel="stylesheet" href="{% static "css/lightbox.css" %}"/>
|
<link rel="stylesheet" href="{% static "css/lightbox.css" %}"/>
|
||||||
<link rel="stylesheet" href="{% static "css/pinry.css" %}"/>
|
<link rel="stylesheet" href="{% static "css/pinry.css" %}"/>
|
||||||
{% endcompress %}
|
{% endcompress %}
|
||||||
|
{% compress css inline %}
|
||||||
{% block extra_css %}{% endblock %}
|
{% block extra_css %}{% endblock %}
|
||||||
|
{% endcompress %}
|
||||||
<!-- End CSS -->
|
<!-- End CSS -->
|
||||||
|
|
||||||
<!-- Start JavaScript Variables -->
|
<!-- Start JavaScript Variables -->
|
||||||
@@ -64,15 +66,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- End Navigation -->
|
<!-- End Navigation -->
|
||||||
|
|
||||||
|
<!-- Messages -->
|
||||||
|
<ul id="messages"></ul>
|
||||||
|
<!-- End Messages -->
|
||||||
|
|
||||||
<!-- Content -->
|
<!-- Content -->
|
||||||
{% block yield %}{% endblock %}
|
{% block yield %}{% endblock %}
|
||||||
<!-- End Content -->
|
<!-- End Content -->
|
||||||
|
|
||||||
<!-- Messages -->
|
|
||||||
{% include "includes/messages.html" %}
|
|
||||||
<!-- End Messages -->
|
|
||||||
|
|
||||||
<!-- Templates -->
|
<!-- Templates -->
|
||||||
|
{% include "includes/messages.html" %}
|
||||||
{% include "includes/lightbox.html" %}
|
{% include "includes/lightbox.html" %}
|
||||||
{% include "includes/pins.html" %}
|
{% include "includes/pins.html" %}
|
||||||
{% include "includes/pin_form.html" %}
|
{% include "includes/pin_form.html" %}
|
||||||
@@ -91,7 +94,9 @@
|
|||||||
<script src="{% static "js/pinry.js" %}"></script>
|
<script src="{% static "js/pinry.js" %}"></script>
|
||||||
<script src="{% static "js/pin-form.js" %}"></script>
|
<script src="{% static "js/pin-form.js" %}"></script>
|
||||||
{% endcompress %}
|
{% endcompress %}
|
||||||
|
{% compress js inline %}
|
||||||
{% block extra_js %}{% endblock %}
|
{% block extra_js %}{% endblock %}
|
||||||
|
{% endcompress %}
|
||||||
<!-- End JavaScript -->
|
<!-- End JavaScript -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
{% if messages %}
|
{% verbatim %}
|
||||||
<ul class="messages">
|
<script id="messages-template" type="text/x-handlebars-template">
|
||||||
{% for message in messages %}
|
<li class="{{ classes }}">{{ text }}</li>
|
||||||
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
|
</script>
|
||||||
{% endfor %}
|
{% endverbatim %}
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user