article-edit.jsp 3.74 KB
Newer Older
1
2
<!DOCTYPE html>

3
<%@include file="/WEB-INF/jsp/init.jsp" %>
4
5
6

<html>
<head>
7
8

    <title>${title}</title>
9
10
</head>
<body>
11
12
13
14
<h1>
    <spring:message code="article.edit-article"/>
</h1>

15
16
<c:if test="${article.lang eq 'en'}">
    <div class="form-group">
Matija Obreza's avatar
Matija Obreza committed
17
18
19
20
21
22
23
24
25
26
27
    	<c:if test="${responseFromTransifex ne null}">
        <div class="alert alert-warning"><spring:message code="${responseFromTransifex}" /></div>
        </c:if>
        
        <form method="post" action="<c:url value="/content/transifex"/>">
            <input id="articleSlug" type="hidden" name="slug" value="${article.slug}"/>
	        <input type="submit" name="post" class="btn btn-default" value="<spring:message code="article.post-to-transifex" />" />
            <input type="submit" name="remove" class="btn btn-default" value="<spring:message code="article.remove-from-transifex" />" />
            <!-- CSRF protection -->
            <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
        </form>
28
29
30
    </div>
    <div>${resource}</div>
</c:if>
31

32
33
34
35
36
37
38
39
40
<c:if test="${article.lang ne 'en'}">
    <div class="form-group">
        <div> ${responseFromTransifex}</div>
        <a href="<c:url value="/content/translate/${article.slug}/${article.lang}"/>" class="btn btn-default">Fetch from
            Transifex</a>
    </div>
</c:if>

<form dir="${article.lang=='fa' || article.lang=='ar' ? 'rtl' : 'ltr'}" role="form" id="editForm" class=""
Matija Obreza's avatar
Matija Obreza committed
41
      action="<c:url value="/content/save-article/${article.lang}" />" method="post">
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    <c:if test="${article.id ne null}">
        <input type="hidden" name="id" value="${article.id}"/>
    </c:if>
    <div class="form-group">
        <label for="article-slug" class="control-label"><spring:message code="article.slug"/></label>

        <div class="controls">
            <input type="text" id="article-slug" name="slug" value="<c:out value="${article.slug}" />"
                   class="span9 form-control required"/>
        </div>
    </div>
    <div class="form-group">
        <label for="article-title" class="control-label"><spring:message code="article.title"/></label>

        <div class="controls">
            <input type="text" id="article-title" name="title" value="<c:out value="${article.title}" />"
                   class="span9 form-control required"/>
        </div>
    </div>
61
    <div dir="${article.lang=='fa' || article.lang=='ar' ? 'rtl' : 'ltr'}" class="form-group">
62
63
64
        <label for="article-body" class="control-label"><spring:message code="article.body"/></label>

        <div class="controls">
65
            <textarea  id="article-body" name="body" class="span9 required form-control html-editor"><c:out
66
67
                    value="${article.body}" escapeXml="false"/></textarea>
        </div>
68

69
70
71
72
73
74
75
76
77
    </div>

    <input type="submit" value="<spring:message code="save"/>" class="btn btn-primary"/>
    <a href="<c:url value="${article.id ne null ? '/content/'.concat(article.slug) : '/' }" />" class="btn btn-default">Cancel</a>
    <!-- CSRF protection -->
    <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
</form>

<content tag="javascript">
78
    <script type="text/javascript" src="<c:url value="/html/js/tinymce/tinymce.min.js"/>"></script>
79
80
81
82
83
84
85
86
87
88
    <script type="text/javascript">
        jQuery(document).ready(function () {
            if (window.location.hash == '#raw') {
            } else {
                tinyMCE.init({
                    selector: ".html-editor",
                    menubar: false,
                    statusbar: false,
                    height: 200,
                    plugins: "link autolink code",
89
90
                    directionality: document.getElementById('editForm').dir,
                    convert_urls: false
91
92
93
94
                });
            }
        });
    </script>
95
</content>
96
97
</body>
</html>