diff options
author | Wuzzy <almikes@aol.com> | 2016-08-31 21:45:44 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-08-31 21:56:43 +0200 |
commit | fa998da3c9dcfc9f3eba2ce4af96623a74503314 (patch) | |
tree | a82829e96ff0d1da61d9f529af5cdcbb1f7cc494 /init.lua | |
parent | 777a0527737c7cb52adf166160bea578eb71b9fc (diff) |
Allow entries to start as hidden by default
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -37,11 +37,13 @@ end function doc.new_entry(category_id, entry_id, def) local cat = doc.data.categories[category_id] if cat ~= nil then - cat.entries[entry_id] = def - cat.entry_count = doc.data.categories[category_id].entry_count + 1 - if def.hidden then + local hidden = def.hidden or (def.hidden == nil and cat.def.hide_entries_by_default) + if hidden then cat.hidden_count = cat.hidden_count + 1 + def.hidden = hidden end + cat.entry_count = doc.data.categories[category_id].entry_count + 1 + cat.entries[entry_id] = def return true else return false |