Skip to content

Commit

Permalink
Allow changing name button
Browse files Browse the repository at this point in the history
  • Loading branch information
pktiuk committed Apr 14, 2024
1 parent a6c940a commit 6c7f991
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@
</p>
</a>
<a>
<div class="haczyk_status">
<div class="haczyk_status" id="027">
<div class="haczyk_left">
<p class="haczyk_left_text">
Warsztat 027
</p>
</div>
<div class="haczyk_right haczyk_key_off" id="027">
<div class="haczyk_right haczyk_key_off">
</div>
</div>
</a>
Expand Down
12 changes: 9 additions & 3 deletions static/js/badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ function handleError(error){
}

function updateButtonState(button_element, hook_info){
button_element.className='haczyk_right';
const element_right = button_element.getElementsByClassName("haczyk_right")[0];
const button_text = button_element.getElementsByClassName("haczyk_left_text")[0];
element_right.className='haczyk_right';
const current_state = hook_info.state;
if (classMap.hasOwnProperty(current_state)) {
button_element.classList.add(classMap[current_state]);
element_right.classList.add(classMap[current_state]);
let name = hook_info.place;
//replace first letter with upper case
name = name.charAt(0).toUpperCase() + name.slice(1);
button_text.textContent= name;
} else {
button_element.classList.add("haczyk_key_error");
element_right.classList.add("haczyk_key_error");
}
}

Expand Down

0 comments on commit 6c7f991

Please sign in to comment.