25 lines
1.6 KiB
Python
25 lines
1.6 KiB
Python
import sys
|
|
|
|
file_path = 'core/templates/core/yard_sign_voters.html'
|
|
with open(file_path, 'r') as f:
|
|
content = f.read()
|
|
|
|
header_old = '<th class="py-3 text-uppercase small ls-1">Voters Wanting Sign</th>'
|
|
header_new = header_old + '\n <th class="py-3 text-uppercase small ls-1">Sign Type</th>'
|
|
content = content.replace(header_old, header_new)
|
|
|
|
cell_old = '</a>\n {% endfor %}\n </div>\n </td>'
|
|
cell_new = cell_old + '\n <td>\n <span class="badge {% if \"Large Sign\" in household.sign_types_display %}bg-warning text-dark{% else %}bg-danger{% endif %} rounded-pill px-3">\n {{ household.sign_types_display }}\n </span>\n </td>'
|
|
content = content.replace(cell_old, cell_new)
|
|
|
|
icon_old = "icon: 'http://maps.google.com/mapfiles/ms/icons/red-dot.png'"
|
|
icon_new = "icon: item.is_large ? 'http://maps.google.com/mapfiles/ms/icons/orange-dot.png' : 'http://maps.google.com/mapfiles/ms/icons/red-dot.png'"
|
|
content = content.replace(icon_old, icon_new)
|
|
|
|
info_old = "votersCount.textContent = 'Voters: ' + item.voters;"
|
|
info_new = info_old + "\n \n var typeDiv = document.createElement('div');\n typeDiv.className = 'mb-2 small fw-bold';\n typeDiv.textContent = 'Type: ' + (item.is_large ? 'Large Sign' : 'Yard Sign');\n container.appendChild(typeDiv);"
|
|
content = content.replace(info_old, info_new)
|
|
|
|
with open(file_path, 'w') as f:
|
|
f.write(content)
|