Commit d5fce214619e03ae5d7c2ced7693143876022b56
1 parent
a9da4d68
Exists in
dev
Dashboard color change
Showing
2 changed files
with
46 additions
and
38 deletions
Show diff stats
src/dashboard/views.py
... | ... | @@ -20,13 +20,10 @@ from devices.TelescopeRemoteControl import TelescopeRemoteControl |
20 | 20 | |
21 | 21 | log = l.setupLogger("dashboard", "dashboard") |
22 | 22 | |
23 | - | |
24 | - | |
25 | -@login_required | |
26 | 23 | def index(request): |
27 | 24 | if request.user.is_authenticated: |
28 | - return render(request, 'dashboard/index.html', {'level': request.user.user_level.priority, 'base_template' : "base.html"}) # return the initial view (the dashboard's one) | |
29 | - return render(request, 'dashboard/index.html', {'level': request.user.user_level.priority, 'base_template' : "base_unlogged.html"}) # return the initial view (the dashboard's one) | |
25 | + return render(request, 'dashboard/index.html', {'level': request.user.user_level.priority, 'base_template' : "base.html", 'weather_img': "normal"}) # return the initial view (the dashboard's one) | |
26 | + return render(request, 'dashboard/index.html', {'level': 0, 'base_template' : "base_unlogged.html", 'weather_img': "red"}) # return the initial view (the dashboard's one) | |
30 | 27 | |
31 | 28 | #@login_required |
32 | 29 | #def observation_status(request): |
... | ... | @@ -39,7 +36,7 @@ def retrieve_env(request): |
39 | 36 | isDay = False |
40 | 37 | if t.hour > 5 and t.hour < 20: |
41 | 38 | isDay = True |
42 | - return render(request, 'dashboard/observation_status_env.html', ) | |
39 | + return render(request, 'dashboard/observation_status_env.html', locals()) | |
43 | 40 | except WeatherWatch.DoesNotExist: |
44 | 41 | raise Http404("No WeatherWatch matches the given query.") |
45 | 42 | ... | ... |
src/misc/templates/base.html
... | ... | @@ -44,6 +44,7 @@ |
44 | 44 | #page-wrapper { |
45 | 45 | padding: 15px 60px; |
46 | 46 | } |
47 | + | |
47 | 48 | #wrapper { |
48 | 49 | padding-left: 10%; |
49 | 50 | |
... | ... | @@ -61,19 +62,29 @@ a { |
61 | 62 | } |
62 | 63 | |
63 | 64 | #fas { |
64 | - size: 20px; | |
65 | + size: 18px; | |
65 | 66 | } |
67 | + | |
66 | 68 | #profile |
67 | 69 | { |
68 | - font-size: 20px; | |
70 | + font-size: 17px; | |
69 | 71 | } |
70 | 72 | |
71 | - | |
72 | 73 | #hour |
73 | 74 | { |
74 | - color: white; | |
75 | - font-size: 20px; | |
75 | + color: black; | |
76 | + font-size: 14px; | |
77 | +} | |
78 | + | |
79 | +#signout { | |
80 | + color: black; | |
76 | 81 | } |
82 | + | |
83 | +.nav>li>a:focus, .nav>li>a:hover { | |
84 | + text-decoration: none; | |
85 | + background-color: transparent !important; | |
86 | +} | |
87 | + | |
77 | 88 | </style> |
78 | 89 | |
79 | 90 | {% load tags %} |
... | ... | @@ -83,15 +94,16 @@ a { |
83 | 94 | <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> |
84 | 95 | <!-- Brand and toggle get grouped for better mobile display --> |
85 | 96 | <div class="navbar-header"> |
86 | - <a class="navbar-brand" href={% url "index" %}>Colibri Control Center</a> | |
97 | + <a class="navbar-brand" href={% url "index" %} style="color: black;">Colibri Control Center</a> | |
87 | 98 | </div> |
88 | 99 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> |
89 | 100 | |
90 | 101 | |
91 | 102 | |
92 | 103 | <!-- Collect the nav links, forms, and other content for toggling --> |
93 | - <div class="collapse navbar-collapse navbar-ex1-collapse"> | |
94 | - <ul class="nav navbar-nav side-nav" id="navbar_list"> | |
104 | + <!-- #f9ff93 #6b69f3--> | |
105 | + <div id="topbar" class="collapse navbar-collapse navbar-ex1-collapse navbar-dark bg-primary" style="background-color: #f9ff93;"> | |
106 | + <ul class="nav navbar-nav side-nav navbar-dark bg-primary" id="navbar_list"> | |
95 | 107 | <li><a href="{% url "weather" %}">Weather</a></li> |
96 | 108 | {% if request.user.user_level.priority >= 3 %} |
97 | 109 | <li><a href="{% url "site" %}">State</a></li> |
... | ... | @@ -112,18 +124,18 @@ a { |
112 | 124 | <li><a href="#">Images</a></li> |
113 | 125 | </ul> |
114 | 126 | <ul class="nav navbar-nav navbar-right navbar-user"> |
115 | - <li><a id="hour">lol</a></li> | |
116 | - <li><a id="day_night" href="{% url "weather" %}"><img id="day_night_img"></a></li> | |
117 | - <li><a id="wind" href="{% url "weather" %}"><img id="wind_img"></a></li> | |
118 | - <li><a id="weather" href="{% url "weather" %}"><img id="weather_img"></a></li> | |
127 | + <li><a class="nav-brand" id="hour"></a></li> | |
128 | + <li><a class="nav-brand" id="day_night" href="{% url "weather" %}"><img id="day_night_img"></a></li> | |
129 | + <li><a class="nav-brand" id="wind" href="{% url "weather" %}"><img id="wind_img"></a></li> | |
130 | + <li><a class="nav-brand" id="weather" href="{% url "weather" %}"><img id="weather_img"></a></li> | |
119 | 131 | <li> |
120 | - <a id="globalmode" href="{% url "change_globalMode" %}" onclick="return confirm('Are you sure you want to switch the controller mode ?')"> {% global_mode request %} </a> | |
132 | + <a class="nav-brand" id="globalmode" style="color: black;"> {% global_mode request %} </a> | |
121 | 133 | </li> |
122 | 134 | <li> |
123 | - <a href="{% url "profile" %}"><i id="profile" class="fas fa-cog "></i></a> | |
135 | + <a class="nav-brand" href="{% url "profile" %}" style="color: black;"><i id="profile" class="fas fa-cog "></i></a> | |
124 | 136 | </li> |
125 | 137 | <li> |
126 | - <a href="{% url "user_logout" %}" ><i class="fa fa-power-off"></i> Log Out</a> | |
138 | + <a id="signout" href="{% url "user_logout" %}" ><i class="fa fa-power-off"></i> Log Out</a> | |
127 | 139 | </li> |
128 | 140 | |
129 | 141 | </ul> |
... | ... | @@ -141,13 +153,12 @@ a { |
141 | 153 | { |
142 | 154 | $("#hour").text("Site time: " + moment().tz("America/Tijuana").format('LTS (Z UTC)')); |
143 | 155 | } |
144 | - | |
145 | 156 | ajax_request(); |
146 | 157 | interval = setInterval(function() {ajax_request();}, REFRESH_ICONS_FREQUENCE_MILLISECONDS); |
147 | 158 | |
148 | 159 | function ajax_request() { |
149 | 160 | $.get("{% url 'retrieve_env_navbar' %}", function (weather_status) { |
150 | - if (weather_status) | |
161 | + if (weather_status) | |
151 | 162 | { |
152 | 163 | /* |
153 | 164 | *** totally arbitrary method for day/night cycle, just for demonstration |
... | ... | @@ -156,38 +167,38 @@ a { |
156 | 167 | var site_time = new Date(hour - 9 * 3600 * 1000).getHours(); |
157 | 168 | var _img_day_night =document.createElement('img'); |
158 | 169 | if (site_time > 5 && site_time < 20) |
159 | - _img_day_night.src ="{% static 'media/white_rising_sun_new.png' %}"; | |
170 | + _img_day_night.src ="{% static 'media/rising_sun.png' %}"; | |
160 | 171 | else |
161 | - _img_day_night.src ="{% static 'media/white_moon_new.png' %}"; | |
162 | - _img_day_night.width = 30; | |
163 | - _img_day_night.height = 30; | |
172 | + _img_day_night.src ="{% static 'media/moon.png' %}"; | |
173 | + _img_day_night.width = 18; | |
174 | + _img_day_night.height = 18; | |
164 | 175 | _img_day_night.id ="day_night_img"; |
165 | 176 | _img_day_night.alt="html5"; |
166 | 177 | $("#day_night_img").replaceWith(_img_day_night); |
167 | 178 | |
168 | 179 | var _img = document.createElement('img'); |
169 | - _img.width = 30; | |
170 | - _img.height = 30; | |
180 | + _img.width = 18; | |
181 | + _img.height = 18; | |
171 | 182 | _img.id ="weather_img"; |
172 | 183 | if(parseInt(weather_status[0]['fields']['rain']) > MAX_RAIN_RATE) |
173 | - _img.src = "{% static 'media/rain_new.png' %}"; | |
184 | + _img.src = "{% static 'media/rain.png' %}"; | |
174 | 185 | else if (parseInt(weather_status[0]['fields']['cloud']) > MAX_CLOUD_VALUE) |
175 | - _img.src = "{% static 'media/white_cloud.png' %}"; | |
186 | + _img.src = "{% static 'media/cloud.png' %}"; | |
176 | 187 | else |
177 | - _img.src = "{% static 'media/white_sun.png' %}"; | |
178 | - _img.width = 25; | |
179 | - _img.height = 25; | |
188 | + _img.src = "{% static 'media/sun.png' %}"; | |
189 | + _img.width = 18; | |
190 | + _img.height = 18; | |
180 | 191 | _img.alt = "html5"; |
181 | 192 | $("#weather_img").replaceWith(_img); |
182 | 193 | |
183 | 194 | var _im = document.createElement('img'); |
184 | - _im.width = 25; | |
185 | - _im.height = 25; | |
195 | + _im.width = 18; | |
196 | + _im.height = 18; | |
186 | 197 | _im.id="wind_img"; |
187 | 198 | if (parseInt(weather_status[0]['fields']['wind']) >= TOO_STRONG_WIND) |
188 | - _im.src = "{% static 'media/white_wind.png' %}"; | |
199 | + _im.src = "{% static 'media/wind.png' %}"; | |
189 | 200 | else |
190 | - _im.src= "{% static 'media/white_windsock_nowind_new.png' %}"; | |
201 | + _im.src= "{% static 'media/windsock_nowind.png' %}"; | |
191 | 202 | $("#wind_img").replaceWith(_im); |
192 | 203 | } |
193 | 204 | }, 'json') | ... | ... |