aboutsummaryrefslogtreecommitdiff
path: root/src/scripts/starterWindow.js
blob: e8153819abb818c08d3a8c153ca55694dec576c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$(document).ready(function(){
    $('.nav-group').on('click', 'span', function() {
        $('.nav-group span.active').removeClass('active');
        $(this).addClass('active');
    });
    $('.templateIcon').click(function(e){
        $('.template .templateIcon').removeClass('clicked');
        $('.template .templateName span').removeClass('clickedText');
        $(this).addClass('clicked');
        var parentId = ($(this).parent().attr('id'));
        $('#'+parentId + ' .templateName span').addClass('clickedText')
        e.stopPropagation()
    })
    $(document).on("click", function(e) {
        if ($(e.target).is(".templateIcon, .templateName span") === false) {
            $('.template .templateIcon').removeClass('clicked');
            $('.template .templateName span').removeClass('clickedText');
        }
    });
    $('#startSelected').click(function(){
        if ($('.template .templateIcon').hasClass('clicked')){
            var parentId = ($('.clicked').parent().attr('id'));
            start(parentId);
        }
        else {
            showError('No Template Selected!', 'No template was selected. Please Select a template to get started!')
        }
    })
    function showError(heading, message) {
        const { remote } = window.require('electron')
        const dialog = remote.dialog
        dialog.showErrorBox(heading, message);
    }
    function start(id) {
        alert('This would start the ' + id + ' template');
    }
})