From fb4118f0d46342b28a2dfdb10f2917d36506ebe4 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 30 Jun 2016 21:28:44 +0100 Subject: [PATCH] =?UTF-8?q?close=20=C2=A36?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/public/css/styles.css | 22 ++++++++++++++++++---- assets/public/js/application.js | 9 +++++---- assets/templates/base.tmpl | 4 ++-- assets/templates/listing.tmpl | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/assets/public/css/styles.css b/assets/public/css/styles.css index aa5b8f3f..acf7a412 100644 --- a/assets/public/css/styles.css +++ b/assets/public/css/styles.css @@ -693,14 +693,28 @@ header div:nth-child(2) { position: relative; } +#listing .item:hover .checkbox { + opacity: 1; +} + #listing .item .checkbox { position: absolute; - top: 0; - right: 0; + top: -.9em; + right: -.9em; border-radius: 50%; - background: #000; + background: #fff; border: 0; -webkit-appearance: initial; + box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .12); + line-height: 0; + padding: .4em; + transition: .2s ease all; + opacity: 0; +} + +#listing .checkbox i { + font-size: 1em; + margin: 0; } .item:hover { @@ -915,4 +929,4 @@ i.spin { header p i:first-of-type { display: none; } -} \ No newline at end of file +} diff --git a/assets/public/js/application.js b/assets/public/js/application.js index a85e1f88..943db8e1 100644 --- a/assets/public/js/application.js +++ b/assets/public/js/application.js @@ -286,14 +286,15 @@ var backEvent = function(event) { // Handles the click event var itemClickEvent = function(event) { - var url = this.getElementsByTagName('a')[0].getAttribute('href'); + var url = this.dataset.href; + var el = document.getElementById(url); if (selectedItems.length != 0) event.preventDefault(); if (selectedItems.indexOf(url) == -1) { - this.classList.add('selected'); + el.classList.add('selected'); selectedItems.push(url); } else { - this.classList.remove('selected'); + el.classList.remove('selected'); selectedItems.removeElement(url); } @@ -412,7 +413,7 @@ document.addEventListener('listing', event => { document.getElementById("view").addEventListener("click", viewEvent); // Add event to items - let items = document.getElementsByClassName('item'); + let items = document.getElementsByClassName('checkbox'); Array.from(items).forEach(link => { link.addEventListener('click', itemClickEvent); }); diff --git a/assets/templates/base.tmpl b/assets/templates/base.tmpl index 37027828..c83350df 100644 --- a/assets/templates/base.tmpl +++ b/assets/templates/base.tmpl @@ -20,7 +20,7 @@ {{ if ne $lnk ""}} {{ end }} - - + check {{- end}}