Add option for selection backgrounds
This commit is contained in:
parent
d895a8434c
commit
0169d196b4
|
@ -701,6 +701,24 @@ def toggle_darkmode():
|
|||
else:
|
||||
enable_darkmode()
|
||||
|
||||
def set_background(background):
|
||||
ui_settings = read_ui_settings()
|
||||
ui_settings['background'] = background
|
||||
write_ui_settings(ui_settings)
|
||||
|
||||
def get_background():
|
||||
ui_settings = read_ui_settings()
|
||||
return ui_settings['background']
|
||||
|
||||
# def get_background_choices():
|
||||
# choices = []
|
||||
# choices.append("none")
|
||||
# for filename in os.listdir("/var/www/mynode/static/images/backgrounds/"):
|
||||
# if filename.endswith(".png") or filename.endswith(".jpg"):
|
||||
# name = filename.replace(".png","").replace(".jpg","")
|
||||
# choices.append(name)
|
||||
# return choices
|
||||
|
||||
def is_https_forced():
|
||||
return os.path.isfile('/home/bitcoin/.mynode/https_forced')
|
||||
|
||||
|
|
|
@ -903,6 +903,18 @@ def toggle_darkmode_page_home():
|
|||
toggle_darkmode()
|
||||
return redirect("/")
|
||||
|
||||
@mynode_settings.route("/settings/set-background", methods=['POST'])
|
||||
def set_background_page():
|
||||
check_logged_in()
|
||||
|
||||
if not request.form.get('background'):
|
||||
flash("No background specified", category="error")
|
||||
return redirect("/settings")
|
||||
|
||||
bg = request.form.get('background')
|
||||
set_background(bg)
|
||||
|
||||
return redirect("/settings")
|
||||
|
||||
@mynode_settings.route("/settings/toggle-netdata")
|
||||
def toggle_netdata_page():
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 311 KiB |
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
|
@ -10,3 +10,14 @@
|
|||
<script src="{{ url_for('static', filename='js/jquery-3.3.1.min.js')}}"></script>
|
||||
<script src="{{ url_for('static', filename='jquery_ui/jquery-ui.js')}}"></script>
|
||||
<script src="{{ url_for('static', filename='js/mynode.js')}}"></script>
|
||||
|
||||
{% if ui_settings['background'] and ui_settings['background'] != "none" %}
|
||||
<style>
|
||||
body {
|
||||
background-image: url("{{ url_for('static', filename='images/backgrounds/')}}{{ui_settings['background']}}.png");
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
background-position: center;
|
||||
}
|
||||
</style>
|
||||
{% endif %}
|
|
@ -364,6 +364,11 @@
|
|||
window.location.href='/settings/reinstall-app?app='+reinstall_app_choice
|
||||
});
|
||||
|
||||
$("#logout_days").selectmenu({width: 70});
|
||||
$("#logout_hours").selectmenu({width: 70});
|
||||
|
||||
$("#background").selectmenu();
|
||||
|
||||
var swap_choice="";
|
||||
$("#swap_size").selectmenu( {
|
||||
change: function( event, data ) {
|
||||
|
@ -535,6 +540,21 @@
|
|||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Background</div>
|
||||
For fun, you can set a background image.
|
||||
<br/><br/>
|
||||
|
||||
<form action="/settings/set-background" method="POST">
|
||||
<select name="background" id="background">
|
||||
<option value="none" {% if not ui_settings['background'] or ui_settings['background'] == "none" %}selected{% endif %}>None</option>
|
||||
<option value="laser_eyes" {% if ui_settings['background'] == "laser_eyes" %}selected{% endif %}>Laser Eyes</option>
|
||||
<option value="moon" {% if ui_settings['background'] == "moon" %}selected{% endif %}>Moon</option>
|
||||
</select>
|
||||
<input type="submit" id="background_save_button" value="Save" class="ui-button ui-widget ui-corner-all"/>
|
||||
</form>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Automatic Logout</div>
|
||||
Your myNode will logout automatically after a period of inactivity. It can be changed below.
|
||||
<br/><br/>
|
||||
|
@ -554,7 +574,7 @@
|
|||
<option value="{{h}}" {% if logout_time_hours == h %}selected{% endif %}>{{h}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="submit" id="logout_save_button" value="Save" class="ui-button ui-widget ui-corner-all settings_button_small"/>
|
||||
<input type="submit" id="logout_save_button" value="Save" class="ui-button ui-widget ui-corner-all"/>
|
||||
</form>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user