This commit is contained in:
Marcin Kurczewski 2013-10-19 16:16:09 +02:00
parent ab26cb8ef2
commit 53f9076bff
3 changed files with 59 additions and 7 deletions

View file

@ -50,15 +50,48 @@
margin-bottom: 4em; margin-bottom: 4em;
} }
.post .remove-trigger { .post .ops {
cursor: pointer;
float: right; float: right;
color: rgba(128, 0, 0, 0.25); }
.post .ops a {
cursor: pointer;
margin-left: 0.5em;
vertical-align: middle; vertical-align: middle;
} }
.post .remove-trigger span { .post a span {
margin-left: 0.25em; margin-left: 0.25em;
vertical-align: middle; vertical-align: middle;
}
.post .move-up-trigger,
.post .move-down-trigger {
color: rgba(0, 64, 128, 0.5);
}
.post .move-up-trigger:hover,
.post .move-down-trigger:hover {
color: #00f;
}
.post .move-up-trigger span,
.post .move-down-trigger span {
color: rgba(0, 64, 128, 1);
}
.post:first-child .move-up-trigger {
display: none;
}
.post:last-child .move-down-trigger {
display: none;
}
.post .remove-trigger {
color: rgba(128, 0, 0, 0.5);
}
.post .remove-trigger:hover {
color: #f00;
}
.post .remove-trigger span {
color: rgba(128, 0, 0, 1); color: rgba(128, 0, 0, 1);
font-size: 130%; font-size: 130%;
} }

View file

@ -39,6 +39,15 @@ $(function()
handleFiles(this.files); handleFiles(this.files);
}); });
$('.post .move-down-trigger, .post .move-up-trigger').on('click', function()
{
var dir = $(this).hasClass('move-down-trigger') ? 'd' : 'u';
var post = $(this).parents('.post');
if (dir == 'u')
post.insertBefore(post.prev('.post'));
else
post.insertAfter(post.next('.post'));
});
$('.post .remove-trigger').on('click', function() $('.post .remove-trigger').on('click', function()
{ {
$(this).parents('.post').slideUp(function() $(this).parents('.post').slideUp(function()

View file

@ -38,9 +38,19 @@
<form action="<?php echo \Chibi\UrlHelper::route('post', 'upload') ?>" method="post"> <form action="<?php echo \Chibi\UrlHelper::route('post', 'upload') ?>" method="post">
<p class="alert alert-error">Some kind of error</p> <p class="alert alert-error">Some kind of error</p>
<a class="remove-trigger"> <div class="ops">
remove <span>&times;</span> <a class="move-up-trigger">
</a> move up <span>&uarr;</span>
</a>
<a class="move-down-trigger">
move down <span>&darr;</span>
</a>
<a class="remove-trigger">
remove <span>&times;</span>
</a>
</div>
<img class="thumbnail" src="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/img/pixel.gif') ?>" alt="Thumbnail"/> <img class="thumbnail" src="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/img/pixel.gif') ?>" alt="Thumbnail"/>
<div> <div>