mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-17 00:21:40 +00:00
added checkbox handler + state...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
6a16b1b023
commit
66f83629e3
2
bootstrap.js
vendored
2
bootstrap.js
vendored
File diff suppressed because one or more lines are too long
@ -3,8 +3,7 @@
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="checkbox"][checked]~*,
|
.item.checked .item-content * {
|
||||||
.checked {
|
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +33,7 @@ input[type="checkbox"][checked]~*,
|
|||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
.item:hover .sort-handle {
|
.item:hover .sort-handle {
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
@ -41,3 +41,5 @@ input[type="checkbox"][checked]~*,
|
|||||||
.sort-placeholder {
|
.sort-placeholder {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 ft=css : */
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<macro name="item-pre-controls"/>
|
<macro name="item-pre-controls"/>
|
||||||
|
|
||||||
<macro name="item-content">
|
<macro name="item-content" class="item-content">
|
||||||
<include
|
<include
|
||||||
class="raw"
|
class="raw"
|
||||||
contenteditable
|
contenteditable
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<macro name="item-pre-controls">
|
<macro name="item-pre-controls">
|
||||||
<input type="checkbox"/>
|
<input type="checkbox" class="state" saveto="@source(./path)"/>
|
||||||
</macro>
|
</macro>
|
||||||
|
|
||||||
<include src="../outline">
|
<include src="../outline">
|
||||||
|
|||||||
36
index.html
36
index.html
@ -27,16 +27,46 @@ var clear = () => {
|
|||||||
delete localStorage['wiki-location']
|
delete localStorage['wiki-location']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var save = () => {
|
||||||
|
// XXX save...
|
||||||
|
localStorage['wiki-data'] = JSON.stringify(Wiki.__wiki_data)
|
||||||
|
localStorage['wiki-location'] = Wiki.location
|
||||||
|
}
|
||||||
|
|
||||||
var reload = () => {
|
var reload = () => {
|
||||||
$('.wiki')
|
$('.wiki')
|
||||||
.html(Wiki.title[0] == '_' ? Wiki.text : Wiki.get('./_view').text)
|
.html(Wiki.title[0] == '_' ? Wiki.text : Wiki.get('./_view').text)
|
||||||
.ready(update_editor)
|
.ready(update_editor)
|
||||||
|
|
||||||
// XXX save...
|
save()
|
||||||
localStorage['wiki-data'] = JSON.stringify(Wiki.__wiki_data)
|
|
||||||
localStorage['wiki-location'] = Wiki.location
|
|
||||||
|
|
||||||
$('title').text(Wiki.location)
|
$('title').text(Wiki.location)
|
||||||
|
|
||||||
|
$('input[type="checkbox"].state')
|
||||||
|
// initial state...
|
||||||
|
.each(function(){
|
||||||
|
var path = $(this).attr('saveto')
|
||||||
|
var value = !!Wiki.get(path).data.checked
|
||||||
|
|
||||||
|
$(this)
|
||||||
|
.prop('checked', value)
|
||||||
|
.parents('.item').first()
|
||||||
|
[value ? 'addClass' : 'removeClass']('checked')
|
||||||
|
})
|
||||||
|
// handle clicks...
|
||||||
|
.click(function(){
|
||||||
|
var path = $(this).attr('saveto')
|
||||||
|
var value = $(this).prop('checked')
|
||||||
|
|
||||||
|
Wiki.get(path).data.checked = value
|
||||||
|
|
||||||
|
$(this)
|
||||||
|
.parents('.item').first()
|
||||||
|
[value ? 'addClass' : 'removeClass']('checked')
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
save()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var update_editor = function(){
|
var update_editor = function(){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user