Compare commits

..

No commits in common. "aaa12dc84e3677609c3ae32834584e2279c07ab0" and "e71ec7786db7e44fff9d9249decb3d9dae26baa4" have entirely different histories.

11 changed files with 508 additions and 861 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
if (typeof(registerServiceWorker) === undefined) {
if (typeof(registerServiceWorker) == undefined) {
const registerServiceWorker = async () => {
if ("serviceWorker" in navigator) {
try {
@ -31,7 +31,7 @@ if (typeof(_bm_yDown) == undefined) {
function bm_toggle_dropdown(list_id) {
var list = document.getElementById(list_id);
if (list.className.indexOf("w3-show") === -1) {
if (list.className.indexOf("w3-show") == -1) {
list.className += " w3-show";
} else {
list.className = list.className.replace(" w3-show", "");
@ -143,9 +143,12 @@ function bm_toggle_quickbox() {
function bm_show_confirm(sender, title, message) {
document.querySelector("#modal-confirm-dialog h5").innerHTML = title;
document.querySelector("#modal-confirm-dialog p").innerHTML = message;
let btn_ok = document.getElementById("modal-confirm-ok");
btn_ok = document.getElementById("modal-confirm-ok");
btn_ok.outerHTML = btn_ok.outerHTML;
document.getElementById("modal-confirm-ok").addEventListener('click', (event) => {
htmx.trigger(sender, 'confirmed', null);
htmx.trigger(sender, 'confirmed');
document.getElementById("modal-confirm-dialog").style.display = "none";
});
@ -153,11 +156,11 @@ function bm_show_confirm(sender, title, message) {
}
function bm_item_field_add(type_field_id, widget) {
let template = Handlebars.templates['items/field-' + widget]
let fields_list = document.getElementById('fields-' + type_field_id);
let counter = parseInt(document.getElementById('fields-' + type_field_id + '-counter').innerHTML);
template = Handlebars.templates['items/field-' + widget]
fields_list = document.getElementById('fields-' + type_field_id);
counter = parseInt(document.getElementById('fields-' + type_field_id + '-counter').innerHTML);
fields_list.insertAdjacentHTML('beforeend', template({type_field_id:type_field_id,counter:counter, value:""}));
document.getElementById('fields-' + type_field_id + '-counter').innerHTML = (counter + 1).toString();
document.getElementById('fields-' + type_field_id + '-counter').innerHTML = counter + 1;
}
document.addEventListener("DOMContentLoaded", function(event){

View File

@ -1,4 +1,4 @@
const cacheVersion = "0.281"
const cacheVersion = "0.271"
const cacheName = "speedtech-brainminder"
const cacheFiles = [
'/static/bootstrap-icons/font/bootstrap-icons.min.css',

View File

@ -72,7 +72,7 @@
<div id="modal-confirm-dialog" class="w3-modal" style="display: none;">
<div id="modal-confirm-dialog-content" class="w3-modal-content w3-round-large w3-padding w3-animate-top">
<header class="w3-container">
<header class="w3-container" style="margin-bottom: 20px;">
<span _="on click hide #modal-confirm-dialog"
class="w3-button w3-small w3-round-large w3-display-topright" style="margin-top: 2px; margin-right: 8px; padding: 8px;"><i class='bi bi-x-circle-fill'></i></span>
<h5></h5>

View File

@ -39,15 +39,21 @@
<div class="w3-half">
<p>
<label for="item-title">Title</label>
<input name="Title" id="item-title" type="text" value="{{.item.Title}}" style="width: 100%"/>
<input
name="Title"
class="w3-input w3-border"
id="item-title"
type="text"
value="{{.item.Title}}"
/>
</p>
<p>
{{ widget_select "Type_id" "Type" .item.Type_id .types `style="width: 100%"` }}
{{ widget_select "Type_id" "Type" .item.Type_id .types `class="w3-input w3-border"` }}
</p>
</div>
<div class="w3-half">
<p>
{{ widget_checkboxes "Notebooks" "Notebooks" .item.Notebooks .notebooks `` }}
{{ widget_checkboxes "Notebooks" "Notebooks" .item.Notebooks .notebooks `class="w3-check"` }}
</p>
</div>
</div>
@ -59,7 +65,14 @@
{{ if eq .item.Type_show_summary 1}}
<p>
<label for="item-summary">Summary</label>
<textarea name="Summary" id="item-summary" type="text" rows="5">{{.item.Summary}}</textarea>
<textarea
name="Summary"
class="w3-input w3-border"
id="item-summary"
type="text"
rows="5"
>{{.item.Summary}}</textarea
>
</p>
{{ end }}
@ -80,21 +93,40 @@
<div class="w3-half">
<p>
<label for="item-tags">Tags</label>
<input name="Tags" id="item-tags" type="text" value="{{.item.Tags}}" style="width: 100%" />
<input
name="Tags"
class="w3-input w3-border"
id="item-tags"
type="text"
value="{{.item.Tags}}"
/>
</p>
</div>
<div class="w3-half">
<p>
{{ widget_slim_select "Categories" "Categories" .item.Categories .categories `multiple="true"` }}
{{ widget_slim_select "Categories" "Categories" .item.Categories .categories `multiple="true" class="w3-input w3-border"` }}
</p>
</div>
</div>
<p>
<label>
<input id="on_dashboard" name="On_dashboard" type="checkbox" value="1" {{if eq .item.On_dashboard 1}} checked="checked" {{end}} />
On dashboard
</label>
<label class="switch">
<input
id="on_dashboard"
class="w3-check"
name="On_dashboard"
type="checkbox"
value="1"
{{if
eq
.item.On_dashboard
1
}}
checked="checked"
{{end}}
/>
<span class="slider round"></span>
</label><label for="on_dashboard" class="label-checkbox">On dashboard</label>
</p>
</div>
@ -118,6 +150,7 @@
<div class="w3-row">
<div class="w3-col l6 m9 s10">
<input
class="w3-input w3-border"
id="search-item-relation"
name="SearchText"
type="text"

View File

@ -20,7 +20,7 @@
{{ template "item:relations_view" .}}
<div class="w3-row">
<div class="w3-row" style="margin-bottom: 20px">
<div class="w3-half">
{{if gt (len .item.Categories) 0 }}
<i class="w3-hide-medium w3-hide-large bi bi-tags-fill"></i>

View File

@ -1,7 +1,7 @@
{{define "page:content"}}
<div id="modal" class="w3-modal">
<div class="w3-modal-content w3-round-large">
<header class="w3-container" style="margin-bottom: 20px; font-weight: bold;">
<header class="w3-container w3-padding" style="margin-bottom: 20px; font-weight: bold;">
<span _="on click remove #modal"
class="w3-button w3-round-large w3-display-topright" style="margin-top: 2px; margin-right: 2px;"><i class='bi bi-x-circle-fill'></i></span>
<h5><i class="{{.item.Type_icon}}" title="{{.item.Type_title}}"></i> {{.item.Type_title}} : {{.item.Title}}</h5>

View File

@ -1,4 +1,4 @@
{{define "partial:notebooks-list"}}
{{ widget_select "current_notebook_id" "" .current_notebook_id .notebooksList `hx-on:change="bm_sidebar_click('main-sidebar')" hx-post="/" hx-push-url="true" hx-target="#page-content" hx-trigger="change" id="current_notebook_id" style="width: 100%"` }}
{{ widget_select "current_notebook_id" "" .current_notebook_id .notebooksList `hx-on:change="bm_sidebar_click('main-sidebar')" hx-post="/" hx-push-url="true" hx-target="#page-content" hx-trigger="change" id="current_notebook_id" class="w3-input w3-border"` }}
{{ end }}

View File

@ -17,11 +17,23 @@
<div id="main-sidebar-content">
<div class="w3-bar-block w3-container" id="searchSidebar">
<form method="POST" hx-post="/items/search" hx-target="#page-content" hx-push-url="true" hx-on:submit="bm_sidebar_click('main-sidebar')">
<form
method="POST"
hx-post="/items/search"
hx-target="#page-content"
hx-push-url="true"
hx-on:submit="bm_sidebar_click('main-sidebar')"
>
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}" />
<div class="w3-row">
<div class="threequarter">
<input type="text" id="searchText" name="SearchText" placeholder="Search.." />
<input
type="text"
id="searchText"
name="SearchText"
class="w3-input"
placeholder="Search.."
/>
</div>
<div class="quarter">
<button type="submit" class="w3-right w3-button w3-round-large w3-metro-dark-blue" style="padding: 4px 8px; margin-top: 5px; margin-right: 8px;"><i class='bi bi-search'></i></button>
@ -31,7 +43,7 @@
</div>
<div class="w3-container">
<h5 class="w3-text-metro-dark-blue">
<h6 class="w3-text-metro-dark-blue">
<a
hx-get="/"
hx-target="#page-content"
@ -41,11 +53,11 @@
>
<i class="bi bi-speedometer"></i> Dashboard
</a>
</h5>
</h6>
<h5 class="w3-text-metro-dark-blue">
<h6 class="w3-text-metro-dark-blue">
<i class="bi bi-journals"></i> Notebook
</h5>
</h6>
<form method="POST" action="/" hx-post="/" hx-push-url="true" hx-target="#page-content">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}" />
{{template "partial:notebooks-list" . }}
@ -53,9 +65,9 @@
</div>
<div class="w3-container">
<h5 class="w3-text-metro-dark-blue accordion" onclick="bm_toggle_visibility('types_menu')">
<i class="bi bi-list-task"></i> Items <i class='w3-right bi bi-caret-down types_menu'></i><i class='w3-right bi bi-caret-up hidden types_menu'></i>
</h5>
<h6 class="w3-text-metro-dark-blue accordion" onclick="bm_toggle_visibility('types_menu')">
<i class="bi bi-list-task"></i> Items <i class='w3-right bi bi-caret-down-fill types_menu'></i><i class='w3-right bi bi-caret-up-fill hidden types_menu'></i>
</h6>
</div>
<div id="types_menu" class="w3-bar-block w3-margin-left w3-margin-right hidden">
{{template "partial:types-list" . }}
@ -72,9 +84,9 @@
</div>
<div class="w3-container">
<h5 class="w3-text-metro-dark-blue accordion" onclick="bm_toggle_visibility('settings_menu')">
<i class="bi bi-gear-fill"></i> Settings <i class='w3-right bi bi-caret-down settings_menu'></i><i class='w3-right bi bi-caret-up hidden settings_menu'></i>
</h5>
<h6 class="w3-text-metro-dark-blue accordion" onclick="bm_toggle_visibility('settings_menu')">
<i class="bi bi-gear-fill"></i> Settings <i class='w3-right bi bi-caret-down-fill settings_menu'></i><i class='w3-right bi bi-caret-up-fill hidden settings_menu'></i>
</h6>
</div>
<div id="settings_menu" class="w3-bar-block w3-margin-left w3-margin-right hidden">
<a
@ -106,9 +118,9 @@
</a>
</div>
<div class="w3-container">
<h5 class="w3-text-metro-dark-blue">
<h6 class="w3-text-metro-dark-blue">
<a href="/logout"><i class="bi bi-box-arrow-left"></i></i> Logout</a>
</h5>
</h6>
</div>
</div>
</nav>

View File

@ -41,11 +41,13 @@
hx-get="/type/create"
hx-push-url="true"
hx-target="#page-content"
><i class="bi bi-plus-circle"></i></a>
><i class="bi bi-plus-circle"></i
></a>
<a
class="w3-button w3-small w3-border w3-round-large w3-metro-blue"
href="#"
_="on click toggle the *display of #all_types_search"><i class="bi bi-search"></i></a>
_="on click toggle the *display of #all_types_search"><i class="bi bi-search"></i
></a>
</th>
</tr>
</thead>
@ -54,7 +56,15 @@
range .types
}}
<tr>
<td class="title" data-label="Title">{{.Title}}</td>
<td class="title" data-label="Title">
<a
href="/type/read/{{.Id}}"
hx-get="/type/read/{{.Id}}"
hx-push-url="true"
hx-target="#page-content"
><i class="{{.Icon}}"></i> {{.Title}}</a
>
</td>
<td class="w3-right-align">
<button
class="w3-button w3-edit w3-small w3-border w3-round-large"

View File

@ -351,7 +351,7 @@ func widget_relation_type(name string, value string, attributes string) template
}
func widget_select(name string, label string, value any, options []WidgetOption, attributes string) template.HTML {
return render_select(name, label, value, options, attributes, "")
return render_select(name, label, value, options, attributes, "w3-input w3-border")
}
func widget_slim_select(name string, label string, value any, options []WidgetOption, attributes string) template.HTML {
@ -428,9 +428,8 @@ func widget_checkboxes(name string, label string, value any, options []WidgetOpt
}
id_str := strings.ReplaceAll(name+"-"+option.Key, " ", "-")
o = o + "<p>"
//o = o + fmt.Sprintf(`<label class="switch"><input id="%v" type="checkbox" name="%v" %v value="%v" %v /><span class="slider round"></span></label>`, id_str, name, checked, option.Key, attributes)
o = o + fmt.Sprintf(`<label><input id="%v" type="checkbox" name="%v" %v value="%v" %v />%v</label>`, id_str, name, checked, option.Key, attributes, option.Value)
//o = o + fmt.Sprintf(`<label class="label-checkbox" for="%v">%v</label>`, id_str, option.Value)
o = o + fmt.Sprintf(`<label class="switch"><input id="%v" type="checkbox" name="%v" %v value="%v" %v /><span class="slider round"></span></label>`, id_str, name, checked, option.Key, attributes)
o = o + fmt.Sprintf(`<label class="label-checkbox" for="%v">%v</label>`, id_str, option.Value)
o = o + "</p>"
}
o = o + "</fiedlset>"
@ -442,7 +441,7 @@ func widget_text(name string, label string, value string, attributes string) tem
if len(label) > 0 {
o = o + fmt.Sprintf(`<label for="%v">%v</label>`, name, label)
}
o = o + fmt.Sprintf(`<input id="%v" type="text" name="%v" value="%v" %v />`, name, name, value, attributes)
o = o + fmt.Sprintf(`<input id="%v" type="text" name="%v" value="%v" class="w3-input w3-border" %v />`, name, name, value, attributes)
return template.HTML(o)
}
@ -451,7 +450,7 @@ func widget_url(name string, label string, value string, attributes string) temp
if len(label) > 0 {
o = o + fmt.Sprintf(`<label for="%v">%v</label>`, name, label)
}
o = o + fmt.Sprintf(`<input id="%v" type="url" name="%v" value="%v" %v />`, name, name, value, attributes)
o = o + fmt.Sprintf(`<input id="%v" type="url" name="%v" value="%v" class="w3-input w3-border" %v />`, name, name, value, attributes)
return template.HTML(o)
}