summaryrefslogtreecommitdiffstats
path: root/admin.html
blob: 000d7ea1c15b0da9450b3d290f68fe376515bfa8 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html lang="de">
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="https://www.sl-its.de/css/bootstrap.spacelab.min.css">
        <script src="https://www.sl-its.de/js/jquery-1.11.2.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script>
            function createNewStory() {
                var form = $('#create-story-form')[0];
                var data = new FormData(form);
                //var file = $('#story-logo').prop('files')[0];
                //data.append('file', file);
                jQuery.ajax({
                    url: 'createStory.php',
                    data: data,
                    cache: false,
                    contentType: false,
                    processData: false,
                    method: 'POST'
                }).done(function(data, textStatus){
                     console.log("Success: Files sent!");
                     console.log(data);
                     console.log(textStatus);
                     $('#newSeriesModal').modal('hide');
                     forform   }).fail(function(jqXHR, textStatus){
                     console.log("An error occurred, the files couldn't be sent!");
                     console.log(jqXHR);
                     console.log(textStatus);
                });
            }
        </script>
        <style type="text/css">
            .figure-desc {
                text-align: justify;
            }
            .figure-pic {
                height: 300px;
                width: 300px;
            }
            .spacer {
                height: 55px;
            }
        </style>
        <title>Kindergeschichten - Admin</title>
    </head>
    <body>
        <nav class="navbar navbar-default navbar-fixed-top navbar-right">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">Kindergeschichten - Admin</a>
                <button type="button" class="navbar-toggle navbar-toggle-si" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div>
            <div class="container-fluid">
                <div class="collapse navbar-collapse" id="myNavbar">
                    <ul class="nav navbar-nav">
                    </ul>
                </div>
            </div>
        </nav>
        <div class="spacer"></div>
        
        <div class="container">
            <!-- Trigger the modal with a button -->
            <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#newSeriesModal">Neue Kindergeschichte</button>

            <!-- Modal -->
            <div class="modal fade" id="newSeriesModal" role="dialog">
                <div class="modal-dialog">
            
                    <!-- Modal content-->
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal">&times;</button>
                            <h4 class="modal-title">Neue Kindergeschichte anlegen</h4>
                        </div>
                        <div class="modal-body">
                            <form action="" method="post" enctype="multipart/form-data" id="create-story-form">
                                <div class="form-group">
                                    <label for="name">Name der Kindergeschichte:</label>
                                    <input type="text" class="form-control" id="story-name" name="story-name">
                                </div>
                                <div class="form-group">
                                    <label for="story-description">Beschreibung der Kindergeschichte:</label>
                                    <textarea class="form-control" rows="5" id="story-description" name="story-description"></textarea>
                                </div>
                                <div class="form-group">
                                    <input type="file" name="story-logo" id="story-logo">
                                </div>
                                <button type="submit" class="btn btn-info btn-sm">Anlegen</button>
                            </form>
                        </div>
                    </div>
                
                </div>
            </div>
            
        </div>
        <script>
            $('#create-story-form').submit(function(event) {
                createNewStory();
                event.preventDefault();
            });
        </script>
    </body>
</html>