Working credential list, dropdowns

This commit is contained in:
brantje 2016-09-11 22:14:11 +02:00
parent 6467752906
commit ba62b5b85a
11 changed files with 157 additions and 10 deletions

View file

@ -14,6 +14,23 @@
background: #d83a02;
color: #fff; }
.popovermenu {
margin-top: 7px;
height: 100px;
right: -2px !important; }
.popovermenu ul {
display: block;
width: 100px;
height: 75px; }
.popovermenu ul li {
padding: 0px; }
.popovermenu ul .menuitem {
font-size: 12px;
display: inline; }
.popovermenu .action {
padding: 10px;
margin: -10px; }
.vault_wrapper {
margin: 0 auto;
margin-top: 20px;
@ -59,5 +76,31 @@
@media screen and (max-width: 768px) {
.vault_wrapper {
width: 90%; } }
.credential-table {
width: 100%;
margin-top: 44px; }
.credential-table tr:hover {
background-color: whitesmoke; }
.credential-table tr td {
cursor: pointer;
padding: 5px;
border-bottom: 1px solid #eeeeee; }
.credential-table tr td .tags {
float: right; }
.credential-table tr td .tags .tag {
background-color: rgba(240, 240, 240, 0.9);
padding: 4px;
font-size: 11px; }
.credential-table tr td .icon-more {
display: inline-block;
float: right;
margin-left: 5px;
margin-top: 1px;
opacity: 0.4;
height: 20px;
width: 32px;
cursor: pointer; }
.credential-table tr td .icon-more:hover {
opacity: 1; }
/*# sourceMappingURL=app.css.map */

View file

@ -1,7 +1,7 @@
{
"version": 3,
"mappings": "AAAA,YAAY;EACV,UAAU,EAAE,OAAO;EACnB,KAAK,EAAE,IAAI;;AAEb,kBAAkB;EAChB,UAAU,EAAE,OAAoB;EAChC,KAAK,EAAE,IAAI;;AAGb,WAAW;EACT,UAAU,EAAE,OAAO;EACnB,KAAK,EAAE,IAAI;;AAEb,iBAAiB;EACf,UAAU,EAAE,OAAoB;EAChC,KAAK,EAAE,IAAI;;ACdb,cAAc;EACZ,MAAM,EAAE,MAAM;EACd,UAAU,EAAE,IAAI;EAChB,KAAK,EAAE,IAAI;EACX,SAAS,EAAE,KAAK;ECMhB,qBAAqB,EDLE,GAAG;ECM1B,aAAa,EDNU,GAAG;ECO1B,eAAe,EA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AE,iBAAiB;IAChC,6BAAK;MACH,KAAK,EAAE,KAAK;MACZ,kCAAI;QACF,gBAAgB,EAAE,wBAAoB;QACtC,OAAO,EAAE,GAAG;QACZ,SAAS,EAAE,IAAI;IAGnB,kCAAU;MACR,OAAO,EAAE,YAAY;MACrB,KAAK,EAAE,KAAK;MACZ,WAAW,EAAE,GAAG;MAChB,UAAU,EAAE,GAAG;MACf,OAAO,EAAE,GAAG;MACZ,MAAM,EAAE,IAAI;MACZ,KAAK,EAAE,IAAI;MACX,MAAM,EAAE,OAAO;IAEjB,wCAAgB;MACd,OAAO,EAAE,CAAC",
"sources": ["../sass/partials/button.scss","../sass/partials/popovermenu.scss","../sass/vaults.scss","../sass/mixins.scss","../sass/credentials.scss"],
"names": [],
"file": "app.css"
}

View file

@ -17,7 +17,8 @@ angular
'ngSanitize',
'ngTouch',
'templates-main',
'LocalStorageModule'
'LocalStorageModule',
'offClick'
])
.config(function ($routeProvider) {
$routeProvider

View file

@ -3,7 +3,7 @@ angular.module('templates-main', ['views/show_vault.html', 'views/vaults.html'])
angular.module('views/show_vault.html', []).run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('views/show_vault.html',
'Welcome to the vault! {{active_vault}} Credentials: {{credentials}}');
'<div id="controls"><div class="breadcrumb"></div><div class="actions creatable"><span href="#" class="button new"><span class="icon icon-add"></span> <span>New</span></span></div></div><table class="credential-table" ng-init="menuOpen = false"><tr ng-repeat="credential in credentials"><td><span class="label">{{credential.label}}</span> <span class="icon icon-more" ng-click="menuOpen = !menuOpen" off-click="menuOpen = false;"></span> <span class="tags"><span class="tag">Tag 1</span> <span class="tag">Tag 2</span> <span class="tag">Tag 4</span> <span class="tag">Tag 4</span> <span class="tag">Long tag xD</span></span><div class="actionList popovermenu bubble menu" ng-show="menuOpen"><ul><li><span class="menuitem action"><span class="icon icon-rename"></span><span>Edit</span></span></li><li><span href="#" class="menuitem action"><span class="icon icon-share"></span><span>Share</span></span></li><li><span class="menuitem action" data-action="Delete"><span class="icon icon-delete"></span><span>Delete</span></span></li></ul></div></td></tr></table>');
}]);
angular.module('views/vaults.html', []).run(['$templateCache', function($templateCache) {

View file

@ -0,0 +1 @@
"use strict";angular.module("offClick",[]),angular.module("offClick").directive("offClick",["$rootScope","$parse","OffClickFilterCache",function(n,e,t){var c=0,o={},i=!1,r=function(n,e){if(!n||!e)return!1;for(var t=e.length,c=0;c<t;++c){var o=e[c],i=!1;try{i=o.contains(n)}catch(r){"undefined"!=typeof o.compareDocumentPosition&&(i=o===n||Boolean(16&o.compareDocumentPosition(n)))}if(i)return!0}return!1},f=function(e){if("touchmove"===e.type)return i=!0,!1;if(i)return i=!1,!1;var c=e.target||e.srcElement;angular.forEach(o,function(o,i){var f=t["*"]||[];o.elm.id&&""!==o.elm.id&&t["#"+o.elm.id]&&(f=f.concat(t["#"+o.elm.id])),angular.forEach(o.elm.classList,function(n){t["."+n]&&(f=f.concat(t["."+n]))}),o.elm.contains(c)||r(c,f)||n.$evalAsync(function(){o.cb(o.scope,{$event:e})})})};return document.addEventListener("touchmove",f,!0),document.addEventListener("touchend",f,!0),document.addEventListener("click",f,!0),{restrict:"A",compile:function(t,i){var r=e(i.offClick);return function(t,f){var u=c++,l=void 0,a=function(){o[u]={elm:f[0],cb:r,scope:t}},d=function(){o[u]=null,delete o[u]};i.offClickIf?l=n.$watch(function(){return e(i.offClickIf)(t)},function(n){n&&a()||!n&&d()}):a(),t.$on("$destroy",function(){d(),l&&l(),f=null})}}}}]),angular.module("offClick").directive("offClickFilter",["OffClickFilterCache","$parse",function(n,e){var t=void 0;return{restrict:"A",compile:function(c,o){return function(c,i){t=e(o.offClickFilter)(c).split(",").map(function(n){return n.trim()}),t.forEach(function(e){n[e]?n[e].push(i[0]):n[e]=[i[0]]}),c.$on("$destroy",function(){t.forEach(function(e){n[e].length>1?n[e].splice(n[e].indexOf(i[0]),1):(n[e]=null,delete n[e])}),i=null})}}}}]),angular.module("offClick").factory("OffClickFilterCache",function(){var n={};return n});

View file

@ -28,7 +28,7 @@ class CredentialMapper extends Mapper {
*/
public function getCredentialsByVaultId($vault_id, $user_id) {
$sql = 'SELECT * FROM `*PREFIX*passman_credentials` ' .
'WHERE `user_id` = ? and vault_id = ? LIMIT 1';
'WHERE `user_id` = ? and vault_id = ?';
return $this->findEntities($sql, [$user_id, $vault_id]);
}

View file

@ -3,5 +3,7 @@
@import 'variables';
@import 'mixins';
@import 'partials/button';
@import 'partials/popovermenu';
@import 'vaults';
@import 'credentials';
@import 'menu';

35
sass/credentials.scss Normal file
View file

@ -0,0 +1,35 @@
.credential-table{
width: 100%;
margin-top: 44px;
tr:hover{
background-color: darken(#fff, 4%);
}
tr{
td{
cursor: pointer;
padding: 5px;
border-bottom: 1px solid #eeeeee;
.tags{
float: right;
.tag{
background-color: rgba(240,240,240,.9);
padding: 4px;
font-size: 11px;
}
}
.icon-more{
display: inline-block;
float: right;
margin-left: 5px;
margin-top: 1px;
opacity: 0.4;
height: 20px;
width: 32px;
cursor: pointer;
}
.icon-more:hover{
opacity: 1;
}
}
}
}

View file

@ -0,0 +1,21 @@
.popovermenu {
margin-top: 7px;
height: 100px;
right: -2px !important;
ul {
display: block;
width: 100px;
height: 75px;
li{
padding: 0px;
}
.menuitem{
font-size: 12px;
display: inline;
}
}
.action {
padding: 10px;
margin: -10px;
}
}

View file

@ -10,6 +10,7 @@ script('passman', 'vendor/angular-route/angular-route.min');
script('passman', 'vendor/angular-sanitize/angular-sanitize.min');
script('passman', 'vendor/angular-touch/angular-touch.min');
script('passman', 'vendor/angular-local-storage/angular-local-storage.min');
script('passman', 'vendor/angular-off-click/angular-off-click.min');
script('passman', 'vendor/sjcl/sjcl');

View file

@ -1,5 +1,48 @@
Welcome to the vault!
{{active_vault}}
Credentials:
{{credentials}}
<div id="controls">
<div class="breadcrumb">
<!--<div class="crumb svg last" data-dir="/"><a-->
<!--href="/ncdev/index.php/apps/files?dir=/"><img class="svg"-->
<!--src="/ncdev/core/img/places/home.svg"-->
<!--alt="Home"></a>-->
<!--</div>-->
</div>
<div class="actions creatable">
<span href="#" class="button new">
<span class="icon icon-add"></span>
<span>New</span></span>
</div>
</div>
<table class="credential-table" ng-init="menuOpen = false">
<tr ng-repeat="credential in credentials">
<td>
<span class="label">{{credential.label}}</span>
<span class="icon icon-more" ng-click="menuOpen = !menuOpen" off-click="menuOpen = false;"></span>
<span class="tags">
<span class="tag">Tag 1</span>
<span class="tag">Tag 2</span>
<span class="tag">Tag 4</span>
<span class="tag">Tag 4</span>
<span class="tag">Long tag xD</span>
</span>
<div class="actionList popovermenu bubble menu" ng-show="menuOpen">
<ul>
<li><span
class="menuitem action"
><span
class="icon icon-rename"></span><span>Edit</span></span>
</li>
<li><span href="#"
class="menuitem action"
><span
class="icon icon-share"></span><span>Share</span></span>
</li>
<li><span
class="menuitem action"
data-action="Delete"><span
class="icon icon-delete"></span><span>Delete</span></span>
</li>
</ul>
</div>
</td>
</tr>
</table>