Browse Source

added info in admin

master
Enzo Angiulli 4 years ago
parent
commit
75f43390e5
  1. 1
      .gitignore
  2. 3
      ui/css/theme.css
  3. 41
      ui/home.htm

1
.gitignore

@ -2,5 +2,6 @@
/.idea/
/vendor/
data/*
cron.log
!data/.keep
.DS_Store

3
ui/css/theme.css

@ -39,7 +39,8 @@ textarea:focus {
}
.darker {
background-image: linear-gradient(#b1b1b1, #868686);
padding: 4px 7px;
width: 30px;
height: 30px;
}
input, textarea {
background-color: #979ea5;

41
ui/home.htm

@ -11,20 +11,16 @@
<a v-on:click="sendsignal(item, item.oncommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-play" aria-hidden="true"></i></a>
<a v-on:click="sendsignal(item, item.offcommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-stop" aria-hidden="true"></i></a>
</div>
<?php if ($admin): ?>
<div>
<div v-show="admin">
<a v-on:click="delitem(item)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-trash" aria-hidden="true"></i></a>
<a v-on:click="showinfo(item)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-info" aria-hidden="true"></i></a>
</div>
<?php endif ?>
</div>
</div>
<?php if ($admin): ?>
<div>
<div v-if="admin">
<a href="javascript:void(0)" class="addbtn" v-on:click="add">{{addtext}}</a>
<div class="add" v-show="adding">
<form>
@ -102,9 +98,6 @@
</form>
</div>
</div>
<?php endif ?>
</div>
@ -114,6 +107,7 @@ var app = new Vue({
el: '#app',
data: {
items: [],
admin: <?php echo ($admin) ? 'true' : 'false' ?>,
sending: false,
adding: false,
messages: [],
@ -173,6 +167,33 @@ var app = new Vue({
})
}
},
showinfo: function(item) {
alert(this.dump(item,2))
},
dump: function(arr,level) {
var dumped_text = "";
if(!level) level = 0;
//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j<level+1;j++) level_padding += " ";
if(typeof(arr) == 'object') { //Array/Hashes/Objects
for(var item in arr) {
var value = arr[item];
if(typeof(value) == 'object') { //If it is an array,
dumped_text += level_padding + "'" + item + "' ...\n";
dumped_text += this.dump(value,level+1);
} else {
dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
}
}
} else { //Stings/Chars/Numbers etc.
dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
return dumped_text;
},
getitems: function() {
axios
.get('api/items')

Loading…
Cancel
Save