|
1 | 1 | extends ../layout/admin |
2 | 2 |
|
3 | 3 | block head |
4 | | - script(src="/bower_components/ace-builds/src-min/ace.js") |
5 | | - script(src="/bower_components/ace-builds/src-min/theme-github.js") |
6 | | - script(src="/bower_components/ace-builds/src-min/mode-markdown.js") |
| 4 | + script(src="/bower_components/ace-builds/src-min/ace.js") |
| 5 | + script(src="/bower_components/ace-builds/src-min/theme-github.js") |
| 6 | + script(src="/bower_components/ace-builds/src-min/mode-markdown.js") |
7 | 7 |
|
8 | 8 | block content |
9 | | - h1 Edit Post |
10 | | - hr |
| 9 | + h1 Edit Post |
| 10 | + hr |
11 | 11 |
|
12 | | - form.post-form(method="post",action="/admin/posts/#{post.getId()}") |
13 | | - .item-row |
14 | | - input(type="hidden", name='_csrf', value='#{_csrf.token}') |
15 | | - .form-group |
16 | | - label 标题 |
17 | | - input.form-control(type="text", name="title", value='#{postForm.getTitle()}') |
| 12 | + form.post-form(method="post",action="/admin/posts/#{post.getId()}") |
| 13 | + .item-row |
| 14 | + input(type="hidden", name='_csrf', value='#{_csrf.token}') |
| 15 | + .form-group |
| 16 | + label 标题 |
| 17 | + input.form-control(type="text", name="title", value='#{postForm.getTitle()}') |
18 | 18 |
|
19 | | - .form-group |
20 | | - label 正文 |
21 | | - textarea.form-control#content(name="content", style="display:none;") |
22 | | - = postForm.getContent() |
23 | | - div#content-editor |
24 | | - #{postForm.getContent()} |
| 19 | + .form-group |
| 20 | + label 正文 |
| 21 | + textarea.form-control#content(name="content", style="display:none;") |
| 22 | + = postForm.getContent() |
| 23 | + div#content-editor |
| 24 | + #{postForm.getContent()} |
25 | 25 |
|
26 | | - .form-group |
27 | | - label 摘要 |
28 | | - textarea.form-control#summary(name="summary", style="display:none;") |
29 | | - = postForm.getSummary() |
30 | | - div#summary-editor |
31 | | - #{postForm.getSummary()} |
| 26 | + .form-group |
| 27 | + label 摘要 |
| 28 | + textarea.form-control#summary(name="summary", style="display:none;") |
| 29 | + = postForm.getSummary() |
| 30 | + div#summary-editor |
| 31 | + #{postForm.getSummary()} |
32 | 32 |
|
33 | | - .item-row |
34 | | - hr |
35 | | - .row |
36 | | - .col-sm-3 |
37 | | - span Format |
38 | | - select.form-control(name="postFormat") |
39 | | - for format in postFormats |
40 | | - if format != postForm.getPostFormat() |
41 | | - option(value="#{format.getId()}") #{format.getDisplayName()} |
42 | | - else |
43 | | - option(value="#{format.getId()}", selected="selected") #{format.getDisplayName()} |
44 | | - .col-sm-3 |
45 | | - span Status |
46 | | - select.form-control(name="postStatus") |
47 | | - for status in postStatus |
48 | | - if status != postForm.getPostStatus() |
49 | | - option(value="#{status.getId()}") #{status.getName()} |
50 | | - else |
51 | | - option(value="#{status.getId()}", selected="selected") #{status.getName()} |
52 | | - .col-sm-3 |
53 | | - span Permalink |
54 | | - input.form-control(name="permalink", value="#{postForm.getPermalink()}") |
| 33 | + .item-row |
| 34 | + hr |
| 35 | + .row |
| 36 | + .col-sm-2 |
| 37 | + .form-group |
| 38 | + label Type |
| 39 | + select.form-control(name="postType") |
| 40 | + for item in postTypes |
| 41 | + if item != postForm.getPostType() |
| 42 | + option(value="#{item.getId()}") #{item.getName()} |
| 43 | + else |
| 44 | + option(value="#{item.getId()}", selected="selected") #{item.getName()} |
| 45 | + .col-sm-2 |
| 46 | + .form-group |
| 47 | + label Format |
| 48 | + select.form-control(name="postFormat") |
| 49 | + for format in postFormats |
| 50 | + if format != postForm.getPostFormat() |
| 51 | + option(value="#{format.getId()}") #{format.getDisplayName()} |
| 52 | + else |
| 53 | + option(value="#{format.getId()}", selected="selected") #{format.getDisplayName()} |
| 54 | + .col-sm-2 |
| 55 | + .form-group |
| 56 | + label Status |
| 57 | + select.form-control(name="postStatus") |
| 58 | + for status in postStatus |
| 59 | + if status != postForm.getPostStatus() |
| 60 | + option(value="#{status.getId()}") #{status.getName()} |
| 61 | + else |
| 62 | + option(value="#{status.getId()}", selected="selected") #{status.getName()} |
55 | 63 |
|
56 | | - .col-sm-3 |
57 | | - span Tags |
58 | | - input.form-control(name="postTags", value="#{postForm.getPostTags()}") |
59 | | - .item-row |
60 | | - hr |
61 | | - button.btn.btn-primary.btn-lg(type="submit") Save |
62 | | - hr |
| 64 | + .col-sm-2 |
| 65 | + .form-group |
| 66 | + label Permalink |
| 67 | + input.form-control(name="permalink", value="#{postForm.getPermalink()}") |
| 68 | + |
| 69 | + .col-sm-3 |
| 70 | + .form-group |
| 71 | + label Tags |
| 72 | + input.form-control(name="postTags", value="#{postForm.getPostTags()}") |
| 73 | + .item-row |
| 74 | + hr |
| 75 | + button.btn.btn-primary.btn-lg(type="submit") Save |
| 76 | + hr |
63 | 77 |
|
64 | 78 | script |
65 | | - var editor = ace.edit("content-editor"); |
66 | | - var summaryEditor = ace.edit("summary-editor"); |
| 79 | + var editor = ace.edit("content-editor"); |
| 80 | + var summaryEditor = ace.edit("summary-editor"); |
67 | 81 |
|
68 | | - editor.setTheme("ace/theme/github"); |
69 | | - summaryEditor.setTheme("ace/theme/github"); |
| 82 | + editor.setTheme("ace/theme/github"); |
| 83 | + summaryEditor.setTheme("ace/theme/github"); |
70 | 84 |
|
71 | | - var MarkdownMode = ace.require("ace/mode/markdown").Mode; |
72 | | - editor.getSession().setMode(new MarkdownMode()); |
73 | | - editor.getSession().setUseWrapMode(true); |
| 85 | + var MarkdownMode = ace.require("ace/mode/markdown").Mode; |
| 86 | + editor.getSession().setMode(new MarkdownMode()); |
| 87 | + editor.getSession().setUseWrapMode(true); |
74 | 88 |
|
75 | | - summaryEditor.getSession().setMode(new MarkdownMode()); |
76 | | - summaryEditor.getSession().setUseWrapMode(true); |
| 89 | + summaryEditor.getSession().setMode(new MarkdownMode()); |
| 90 | + summaryEditor.getSession().setUseWrapMode(true); |
77 | 91 |
|
78 | | - $("form").submit(function(){ |
79 | | - $("#content").val(editor.getValue()); |
80 | | - $("#summary").val(summaryEditor.getValue()); |
81 | | - return true; |
82 | | - }); |
| 92 | + $("form").submit(function(){ |
| 93 | + $("#content").val(editor.getValue()); |
| 94 | + $("#summary").val(summaryEditor.getValue()); |
| 95 | + return true; |
| 96 | + }); |
0 commit comments