Skip to content

Commit 0fab5bc

Browse files
committed
Added handlers for update notification buttons
Now the restart and change log buttons do something. I quickly styled the change log display to sort of suit the rest of the app. Will probably change later. For now it works
1 parent 752b744 commit 0fab5bc

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ <h1>Popcorn Time</h1>
2727

2828
<div id="notification"></div>
2929

30+
<div id="changelog-container"></div>
31+
32+
<script id="changelog-tpl" type="text/x-template">
33+
<a class="btn-close"><img src="/images/close.svg" width="50" /></a>
34+
<h1><%= title %></h1>
35+
<h3><%= description %></h3>
36+
<ul>
37+
<% for(var i = 0; i < changeLog.length; i++) { %>
38+
<li><%= changeLog[i] %></li>
39+
<% } %>
40+
</ul>
41+
</script>
42+
3043
<div id="catalog-select">
3144
<div class="search">
3245
<input type="text" placeholder="Search" data-translate="search" />

js/updater.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,25 @@
198198
'</span>'
199199
).addClass('blue');
200200

201+
var $restart = $('.btn.restart'),
202+
$chnglog = $('.btn.chnglog');
203+
204+
$restart.on('click', function() {
205+
var spawn = require('child_process').spawn,
206+
argv = gui.App.fullArgv;
207+
argv.push(process.cwd());
208+
spawn(process.execPath, argv, { cwd: process.cwd(), detached: true, stdio: [ 'ignore', 'ignore', 'ignore' ] }).unref();
209+
gui.App.quit();
210+
})
211+
212+
$chnglog.on('click', function() {
213+
var $changelog = $('#changelog-container').html(_.template($('#changelog-tpl').html())(updateData));
214+
$changelog.find('.btn-close').on('click', function() {
215+
$changelog.hide();
216+
});
217+
$changelog.show();
218+
})
219+
201220
$('body').addClass('has-notification')
202221
}
203222
}

sass/_layout.scss

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,51 @@ a { text-decoration: none; }
246246
background: #f15153;
247247
}
248248

249+
#changelog-container {
250+
position: absolute;
251+
left: 0; top: $header_height + $notification_height;
252+
height: 100%;
253+
width: calc(100% - 90px);
254+
padding: 30px;
255+
padding-left: 70px;
256+
z-index: 997;
257+
background: rgba(0, 0, 0, 0.93);
258+
display: none;
259+
260+
.btn-close {
261+
position: absolute;
262+
z-index: 9999;
263+
top: 19px;
264+
left: 15px;
265+
cursor: pointer;
266+
267+
&:hover {
268+
opacity: 0.8;
269+
}
270+
}
271+
272+
h1 {
273+
font-weight: bold;
274+
font-size: 30px;
275+
}
276+
277+
h3 {
278+
font-style: italic;
279+
font-size: 15px;
280+
}
281+
282+
ul {
283+
margin-top: 10px;
284+
padding-left: 20px;
285+
list-style-type: square;
286+
287+
li {
288+
margin: 10px 0;
289+
line-height: 20px;
290+
}
291+
}
292+
}
293+
249294
// Catalog select
250295
#catalog-select {
251296
@include box-sizing(border-box);

0 commit comments

Comments
 (0)