using icon as checkbox

This commit is contained in:
Alberto Miranda
2016-07-29 22:07:44 -03:00
parent 9f66418073
commit 91e61f6cd4
3 changed files with 36 additions and 31 deletions

View File

@@ -196,13 +196,8 @@ module.exports = class PlaybackController {
}
}
function getOpenInVlc () {
return this.state.saved.prefs.playInVlc
}
openPlayerFromActiveTorrent (torrentSummary, index, timeout, cb) {
var fileSummary = torrentSummary.files[index]
}
// update state
var state = this.state
@@ -246,6 +241,14 @@ function getOpenInVlc () {
return this.update()
}
// play in VLC if set as default player (Preferences / Playback / Play in VLC)
if (this.state.saved.prefs.playInVlc) {
dispatch('vlcPlay')
this.update()
cb()
return
}
// otherwise, play the video
dispatch('setTitle', torrentSummary.files[state.playing.fileIndex].name)
this.update()
@@ -255,14 +258,6 @@ function getOpenInVlc () {
})
}
// play in VLC if set as default player (Preferences / Playback / Play in VLC)
if (getOpenInVlc()) {
dispatch('vlcPlay')
this.update()
cb()
return
}
closePlayer () {
console.log('closePlayer')

View File

@@ -46,6 +46,7 @@ function renderPlayInVlcSelector (state) {
},
state.unsaved.prefs.playInVlc,
function (value) {
console.log('-- VALUE:', value)
setStateValue('playInVlc', value)
})
}
@@ -92,30 +93,31 @@ function renderSection (definition, controls) {
}
function renderCheckbox (definition, value, callback) {
var checked = ''
if (value) checked = 'checked'
var iconClass = 'icon clickable'
if (value) iconClass += ' enabled'
return hx`
<div class='control-group'>
<div class='controls'>
<label class='control-label'>
<div class='preference-title'>${definition.label}</div>
return (
<div className='control-group'>
<div className='controls'>
<label className='control-label'>
<div className='preference-title'>{definition.label}</div>
</label>
<div class='controls'>
<label>
<input type='checkbox' class='checkbox'
onclick=${handleClick}
id=${definition.property}
${checked} />
<span class="checkbox-label">${definition.description}</span>
<div className='controls'>
<label className='clickable' onClick={handleClick}>
<i
className={iconClass}
id='{definition.property}'
>
check_circle
</i>
<span className='checkbox-label'>{definition.description}</span>
</label>
</div>
</div>
</div>
`
)
function handleClick () {
callback(this.checked)
callback(!value)
}
}

View File

@@ -122,6 +122,10 @@ table {
* UTILITY CLASSES
*/
.clickable {
cursor: pointer;
}
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
@@ -919,6 +923,10 @@ video::-webkit-media-text-track-container {
margin-right: 0.2em;
}
.preferences .icon.enabled {
color: yellow;
}
.preferences .btn {
display: inline-block;
-webkit-appearance: button;
@@ -1071,7 +1079,7 @@ video::-webkit-media-text-track-container {
}
.checkbox-label {
vertical-align: middle;
vertical-align: top;
}