summaryrefslogtreecommitdiffstats
path: root/lib/new-story-dialog.inc.php
blob: c833933d84f2b30c65fe82216fab41585ede7b9f (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
<?php
?>
    <span id="add-new-story-btn" class="floating-action-btn" data-toggle="modal" data-target="#newStoryModal">
        +
    </span>
    <!-- Modal -->
    <div class="modal fade" id="newStoryModal" 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 id="modal-title" 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">
                            <label for="story-logo">Logo der Kindergeschichte:</label>
                            <input type="file" name="story-logo" id="story-logo">
                        </div>
                        <div class="form-group">
                            <label for="story-header">Header Bild der Kindergeschichte:</label>
                            <input type="file" name="story-header" id="story-header">
                        </div>
                        <input type="hidden" value="create" name="story-action" id="story-action">
                        <button type="submit" id="create-story-btn" class="btn btn-info btn-sm">Anlegen</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <script>
        $('#create-story-form').submit(function(event) {
            createNewStory();
            event.preventDefault();
        });
        $('#newCharacterModal').on('hide.bs.modal', function(evt) {
            formReset();
        });
        function formReset() {
            $('#create-story-form')[0].reset();
            $('#story-action').val('create');
            $('#modal-title').text('Neue Kindergeschichte anlegen');
            $('#create-story-btn').text('Anlegen');
        }
    </script>