Commit | Line | Data |
---|---|---|
929ca066 BA |
1 | {% extends "::base.html.twig" %} |
2 | ||
3 | {% block title %}{{ parent() }}upsert package{% endblock %} | |
4 | ||
5 | {% block header %} | |
6 | {{ parent() }} | |
7 | <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"> | |
8 | <link rel="stylesheet" href="{{ asset('mixstore/css/summernote.min.css') }}" /> | |
9 | ||
10 | <!-- include codemirror (codemirror.css, codemirror.js, xml.js, formatting.js) --> | |
11 | <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.min.css" /> | |
12 | <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/theme/monokai.min.css" /> | |
13 | <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.min.js"></script> | |
14 | <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/mode/xml/xml.min.js"></script> | |
15 | <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/2.36.0/formatting.min.js"></script> | |
16 | ||
17 | <link rel="stylesheet" href="{{ asset('mixstore/css/store/upsert.css') }}" /> | |
18 | <link rel="stylesheet" href="{{ asset('mixstore/css/form.css') }}" /> | |
19 | {% endblock %} | |
20 | ||
21 | {% block content %} | |
22 | ||
23 | {% form_theme form ':Form:fields.html.twig' %} | |
24 | ||
25 | <div class="row center-txt"> | |
26 | <h3>{{ title }}</h3> | |
27 | {% if 'ackage' in title %}<p class="red">Please don't forget to add a link to mixstore on your website. Thanks !</p>{% endif %} | |
28 | </div> | |
29 | ||
30 | <form name="upsert_form" method="post" {{ form_enctype(form) }} class="form-horizontal"> | |
31 | {{ form_widget(form) }} | |
32 | <div class="form-group"> | |
33 | <div class="col-sm-8 col-sm-offset-2"> | |
34 | <button type="submit" class="btn btn-primary" onclick="saveValidateSubmit()">Submit</button> | |
35 | </div> | |
36 | </div> | |
37 | </form> | |
38 | ||
39 | {% endblock content %} | |
40 | ||
41 | {%block javascripts %} | |
42 | {{ parent() }} | |
43 | <script src="{{ asset('mixstore/js/summernote.min.js') }}"></script> | |
44 | ||
45 | <script> | |
46 | ||
47 | $(document).ready(function() | |
48 | { | |
49 | //add label classes | |
50 | $('label').addClass('col-sm-2 control-label'); | |
51 | ||
52 | ||
53 | $('#form_description').summernote({ | |
54 | height: 150, | |
55 | codemirror: { // codemirror options | |
56 | theme: 'monokai', | |
57 | lineNumbers: false, | |
58 | viewportMargin: Infinity //does not work, see below | |
59 | } | |
60 | }); | |
61 | //HACK (summernote set inline height for codable element...) | |
62 | //$('note-codable').css('height', ''); | |
63 | //NOTE: there is also a bug after full screen : no autoresize... | |
64 | ||
65 | $('.note-editor').addClass('col-sm-8'); | |
66 | ||
67 | }); | |
68 | ||
69 | function saveValidateSubmit() | |
70 | { | |
71 | $('#form_description').html($('.note-editable').code()); | |
72 | //TODO: improve, should work also for code | |
73 | //http://hackerwins.github.io/summernote/features.html#api-summernote | |
74 | ||
75 | //document.forms['upsert_form'].validate(); | |
76 | document.forms['upsert_form'].submit(); | |
77 | } | |
78 | ||
79 | </script> | |
80 | ||
81 | {% endblock %} |