editor type select input

ripple just pulsates now
This commit is contained in:
jean-emmanuel 2015-11-04 20:06:02 +01:00
parent b02adfc82d
commit 7e7302a529
3 changed files with 73 additions and 22 deletions

File diff suppressed because one or more lines are too long

View file

@ -64,13 +64,40 @@ enableEditor = function(){
for (i in data) {
if (i!='widgets' && i!='tabs') {
var type = typeof data[i]
var d = type == 'object'?JSON.stringify(data[i]):data[i]
var input = $(`
<label>${i}</label>
<input data-type="${type}" value='${d}' title="${i}"/>
`)
input.appendTo(form)
var type = typeof data[i],
d = type == 'object'?JSON.stringify(data[i]):data[i],
label = $(`<label>${i}</label>`).appendTo(form),
input
if (i=='type') {
input = $(`
<select class="input" data-type="${type}" title="${i}"/>
`)
for (t in widgetOptions) {
var selected = t==d?'selected=':''
input.append(`
<option ${selected} value="${t}">${t}</option>
`)
}
select = $('<div class="select-wrapper"></div>').append(input)
select.appendTo(form)
// } else if (typeof widgetOptions[data.type][i]=='boolean') {
// input = $(`
// <input class="checkbox" data-type="${type}" value='${d}' title="${i}"/>
// `)
// input.click(function(){
// $(this).val(!eval($(this).val())).trigger('change')
// })
// input.appendTo(form)
} else {
input = $(`
<input data-type="${type}" value='${d}' title="${i}"/>
`)
input.appendTo(form)
}
input.on('change',function(){
var v = $(this).val()!= '' && $(this).data('type') == 'object'?JSON.parse($(this).val()):$(this).val()
data[$(this).attr('title')]= v=='true'||v=='false'?eval(v):v

View file

@ -560,6 +560,28 @@ a {
box-shadow: 0 0 0 1rem $color-accent;
}
}
.checkbox {
background:$bg-3d;
cursor: pointer;
&:hover {
background:$bg-3d-hover;
}
}
.select-wrapper {
position: relative;
&:after{
content:"\f107";
font-family: FontAwesome;
position: absolute;
padding:10rem;
right:0;
top:0;
font-size: 20rem;
}
}
select {
-webkit-appearance:none;
}
.submit {
margin-top:30rem;
}
@ -811,9 +833,6 @@ a {
&.on .light {
background: $color-accent;
}
&.ripple .light {
animation: ripple .25s linear;
}
}
@ -824,9 +843,6 @@ a {
&:active .light {
background: $color-accent;
}
&.ripple .light {
animation:ripple 0.25s linear;
}
}
@ -885,7 +901,7 @@ a {
&:first-child {
border-top:0;
}
&:after {
&:before {
content:"";
position: absolute;
left:8rem;
@ -896,21 +912,29 @@ a {
background: $color-border;
border-radius: 8rem;
}
&.on:after {
&.on:before {
background: $color-accent;
}
&.ripple:after {
animation:ripple 0.25s linear;
}
}
}
}
.ripple:after {
content:"";
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
background:$color-accent;
animation:ripple 0.25s linear;
animation-fill-mode: forwards;
opacity:.4
}
@keyframes ripple {
/*scale the element to 250% to safely cover the entire link and fade it out*/
0% {box-shadow: 0 0 0 0 rgba($color-accent,.5)}
100% {box-shadow: 0 0 0 100rem transparent;}
100% {opacity:0}
}