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

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

<html>
<head>
7

Matija Obreza's avatar
Matija Obreza committed
8
<title><c:out value="${title}" /></title>
9 10
</head>
<body>
11 12 13 14
	<div class="main-col">
		<h1>
			<spring:message code="article.edit-article" />
		</h1>
15

16
		<%@ include file="transifex-responses.jspf" %>
17

18
		<c:set var="url" value="/content/save-article/${article.lang}"/>
19
		<c:set var="cancel" value="${article.id ne null ? (article.targetId ne null? '/content/'.concat(article.slug).concat('/').concat(article.classPk.shortName).concat('/').concat(article.targetId).concat('/').concat(article.lang) : '/content/'.concat(article.slug)) : '/content' }"/>
Alexander Basov's avatar
Alexander Basov committed
20

21 22 23
		<c:if test="${article.lang eq 'en'}">
			<div class="form-group">
				<form method="post" action="<c:url value="/content/transifex"/>">
24 25 26 27
					<input type="hidden" name="slug" value="${article.slug}" />
					<input type="hidden" name="targetId" value="${article.targetId}" />
					<input type="hidden" name="classPkShortName" value="${article.classPk.shortName}" />
					
28 29 30 31 32 33 34
					<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" />" />
					<input type="submit" name="fetch-all" class="btn btn-default" value="<spring:message code="article.fetch-from-transifex" />" />
					<!-- CSRF protection -->
					<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
				</form>
			</div>
Matija Obreza's avatar
Matija Obreza committed
35
			<div><c:out value="${resource}" /></div>
36
		</c:if>
37

Alexander Basov's avatar
Alexander Basov committed
38
		<form dir="${article.lang=='fa' || article.lang=='ar' ? 'rtl' : 'ltr'}" role="form" id="editForm" class="" action="<c:url value="${url}" />" method="post">
39 40 41 42 43 44 45 46 47 48
			<c:choose>
				<c:when test="${article.id ne null}">
					<input type="hidden" name="id" value="${article.id}" />
				</c:when>
				<c:when test="${article.targetId ne null}">
					<input type="hidden" name="targetId" value="${article.targetId}" />
					<input type="hidden" name="classPkShortName" value="${article.classPk.shortName}" />
				</c:when>
			</c:choose>			

49 50 51 52
			<div class="form-group">
				<label for="article-slug" class="control-label">
					<spring:message code="article.slug" />
				</label>
53

54 55 56 57
				<div class="controls">
					<input type="text" id="article-slug" name="slug" value="<c:out value="${article.slug}" />" class="span9 form-control required" />
				</div>
			</div>
58 59 60 61 62
			
			<div class="form-group">
				<label for="article-title" class="control-label">
					<spring:message code="article.title" />
				</label>
63

64 65
				<div class="controls">
					<input type="text" id="article-title" name="title" value="<c:out value="${article.title}" />" class="span9 form-control required" />
66
				</div>
67 68
			</div>

69 70 71 72
			<div dir="${article.lang=='fa' || article.lang=='ar' ? 'rtl' : 'ltr'}" class="form-group">
				<label for="article-body" class="control-label">
					<spring:message code="article.body" />
				</label>
73

74 75 76 77 78 79 80 81
				<div class="controls">
					<textarea id="article-body" name="body" class="span9 required form-control html-editor"><c:out value="${article.body}" escapeXml="false" /></textarea>
				</div>
			</div>
			<div class="form-group">
				<label for="article-summary" class="control-label">
					<spring:message code="article.summary" />
				</label>
82

83 84 85 86
				<div class="controls">
					<textarea id="article-summary" name="summary" class="span9 required form-control html-editor"><c:out value="${article.summary}" escapeXml="false" /></textarea>
				</div>
			</div>
87

88
			<input type="submit" value="<spring:message code="save"/>" class="btn btn-primary" />
Alexander Basov's avatar
Alexander Basov committed
89
			<a href="<c:url value="${cancel}" />" class="btn btn-default">Cancel</a>
90 91 92 93 94 95
			<!-- CSRF protection -->
			<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
		</form>
	</div>

	<content tag="javascript">
96 97
    <script type="text/javascript">
        jQuery(document).ready(function () {
98
          <local:tinyMCE selector=".html-editor" directionality="document.getElementById('editForm').dir" />
99 100
        });
    </script>
101
	</content>
102 103
</body>
</html>