-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathedit.html.twig
More file actions
210 lines (188 loc) · 8.79 KB
/
edit.html.twig
File metadata and controls
210 lines (188 loc) · 8.79 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
{% extends "ServerGroveKbBundle:Admin:layout.html.twig" %}
{% block postheader %}
{{ parent() }}
{{ sgkb_breadcrumb.displayBreadcrumb(document, document.getDefaultCategory(), true) }}
{% endblock postheader %}
{% block content %}
<script>
$(document).ready(function () {
$('#tsettings').click(function () {
console.log("ff");
$('.settings').toggle();
});
});
</script>
{% spaceless %}
<form id="article-form" class="exit-control" action="{{ path('sgkb_admin_articles_update', { 'slug': document.slug }) }}" method="post" {{ form_enctype(edit_form) }}>
<a href="#cheatsheet" role="button" class="btn" data-toggle="modal" style="float: right;">Markdown Cheatsheet</a>
<h1>
{% trans %}Article edit{% endtrans %}
</h1>
<div class="well">
<a href="#" id="tsettings" class="btn">{% trans %}Settings{% endtrans %}</a>
</div>
<div class="row-fluid settings">
{{ form_errors(edit_form) }}
<div class="span6">
<div>
{{ form_label(edit_form.categories) }}
{{ form_widget(edit_form.categories, { 'attr': { 'class': 'input-xxlarge', 'size': 11 } }) }}
</div>
</div>
<div class="span6">
{% if edit_form.urls is defined %}
<div>
{{ form_label(edit_form.urls) }}
{{ form_widget(edit_form.urls, { 'attr': { 'class': 'input-xxlarge' } }) }}
</div>
{% endif %}
<div class="keywordMgr" ng-controller="ArticleKeywordsCtrl"
ng-init="url='{{ path('sgkb_admin_articles_keywords_sync', { 'slug': document.slug, '_format': 'json' }) }}'">
<label for="article_keywords" class="control-label">{% trans %}Keywords{% endtrans %}</label>
<div class="input-append">
<input id="article_keywords" ng-enter-press="addKeywords()" ng-model="newKeywords" ng-list
autocomplete="off" type="text" class="span4"
placeholder="{% trans %}A comma separated list of keywords{% endtrans %}"/>
<button class="btn" type="button" ng-click="addKeywords()"
ng-disabled="newKeywords.length == 0">{% trans %}Add{% endtrans %}</button>
</div>
{% for keyword in document.keywords %}
<init ng-init="keywords.push('{{ keyword }}')"></init>
{% endfor %}
<ul class="well well-small">
<li class="label label-info" ng-repeat="keyword in keywords">
{% raw %}{{ keyword }}{% endraw %}
<a href="javascript:void(0)" ng-click="removeKeyword(keyword)">×</a>
</li>
</ul>
</div>
</div>
</div>
{% for locale,translation_form in translation_forms %}
{% form_theme translation_form _self %}
<translation ng-controller="{{ locale }}TranslationCtrl">
<div class="well">
<button class="btn" type="button" data-toggle="collapse"
data-target="#article_edit_{{ locale }}">{% trans with { '%locale%': locale } %}Edit "%locale%" Version{% endtrans %}
{% if translation_form.isActive.getVars().checked|default(false) %}
<span class="label label-success">{% trans %}Active{% endtrans %}</span>
{% else %}
<span class="label label-important">{% trans %}Disabled{% endtrans %}</span>
{% endif %}
</button>
<a href="{{ path('sgkb_articles_view', {
'slug': document.slug,
'path': document.getDefaultCategory().getPath(),
'_locale': locale,
'_format': 'html'
}) }}" target="_blank" class="btn bump-left">{% trans with { '%locale%': locale } %}View this
article{% endtrans %}</a>
</div>
<div class="collapse" id="article_edit_{{ locale }}">
<h2>{% trans with { '%locale%': locale } %}Article translation for locale "%locale%"{% endtrans %}</h2>
{{ form_errors(translation_form) }}
{{ form_row(translation_form.title)}}
{{ form_row(translation_form.isActive) }}
{{ form_row(translation_form.contentType) }}
{{ form_row(translation_form.content) }}
{{ form_rest(translation_form) }}
</div>
</translation>
<script type="text/javascript">
/* <![CDATA[ */
var {{ locale }}TranslationCtrl = getTranslationController('{{ translation_form.content.getVars().value|escape('js') }}', '{{ translation_form.getVars().contentType|escape('js') }}', '{{ locale }}');
/* ]]> */
</script>
{% endfor %}
<div class="form-actions">
<label class="checkbox">
<input type="checkbox" name="back_to_list" value="1" checked="checked"/> {% trans %}Return to the list after save{% endtrans %}
</label>
<br>
<button class="btn btn-primary" type="submit">{% trans %}Save{% endtrans %}</button>
<a class="btn" href="{{ path('sgkb_admin_articles_index') }}">{% trans %}Cancel{% endtrans %}</a>
{{ form_rest(edit_form) }}
</div>
</form>
{% if is_granted("ROLE_ADMIN") %}
<div class="pull-right" style="margin-top: -64px; margin-right: 20px;"><delete-form action="{{ path('sgkb_admin_articles_delete', {'slug': document.slug}) }}" method="post" button="{% trans %}Delete{% endtrans %}" confirmation="{% trans %}Are you sure you want to delete this article?{% endtrans %}">
{{ form_widget(delete_form) }}
</delete-form></div>
{% endif %}
{% render "ServerGroveKbBundle:Admin/Urls:modalForm" %}
{% include "ServerGroveKbBundle:Admin/Articles:image-gallery.html.twig" %}
{% include "ServerGroveKbBundle:Admin/Articles:markdown-cheatsheet.html.twig" %}
{% endspaceless %}
{% endblock %}
{% block text_widget %}
{% if link is defined %}
<div class="input-append">
{{ form_widget(form) }}
<a href="{{ link }}" target="_blank" class="btn btn-info">{% trans %}Public view{% endtrans %}</a>
</div>
{% else %}
{{ form_widget(form) }}
{% endif %}
{% endblock text_widget %}
{% block sg_editor_widget %}
{% spaceless %}
<div class="row-fluid">
<ul class="nav nav-tabs" id="editTabs">
<li class="active"><a href="#edit_{{ id }}" data-toggle="tab">edit</a></li>
<li><a href="#preview_{{ id }}" data-toggle="tab">preview</a></li>
</ul>
<div class="tab-content" id="tabContent">
<div id="edit_{{ id }}" class=" tab-pane active">
<div class="span12" style="border: solid 1px #999;">
{{ form_widget(form, { 'attr': { 'rows': 40 } }) }}
<div class="gallery-opener-container">
<button class="btn" type="button" ng-click="openGallery();">{% trans %}Image gallery{% endtrans %}</button>
</div>
</div>
</div>
<div class=" tab-pane" id="preview_{{ id }}">
<div class="span12 content-preview " ng-bind-html-unsafe="getPreviewContent()"></div>
</div>
</div>
</div>
{% endspaceless %}
{% endblock sg_editor_widget %}
{% block form_checkbox %}
{% spaceless %}
{% if not label %}
<script type="text/javascript">
/* <![CDATA[ */
var {{ id }}ActiveCtrl = getActiveWidgetController({{ checked ? 'true' : 'false' }});
/* ]]> */
</script>
<div class="btn-group" data-toggle="buttons-radio" ng-controller="{{ id }}ActiveCtrl">
<button type="button" class="ng-class: getClassIfActive('btn-success'); btn{{ checked ? ' active' : '' }}" ng-click="setActive(true)">Active</button>
<button type="button" class="ng-class: getClassIfDisabled('btn-danger'); btn{{ checked ? '' : ' active' }}" ng-click="setActive(false)">Disabled</button>
{{ form_widget(form, { 'attr': { 'class': 'hide', 'ng-checked': 'active' } }) }}
</div>
{% else %}
{{ parent() }}
{% endif %}
{% endspaceless %}
{% endblock form_checkbox %}
{% block choice_widget_expanded %}
{% spaceless %}
<script type="text/javascript">
/* <![CDATA[ */
var {{ id }}ContentTypeCtrl = getContentTypeWidgetController('{{ data }}');
/* ]]> */
</script>
<div class="btn-group" data-toggle="buttons-radio" ng-controller="{{ id }}ContentTypeCtrl">
{% for child in form %}
{% if not child.has('label') or child.get('label') is empty %}
{% set label = child.get('name')|humanize %}
{% else %}
{% set label = child.get('label')|humanize %}
{% endif %}
<button type="button" class="btn{{ data == child.get('value') ? ' active' : '' }}" ng-click="setContentType('{{ child.get('value') }}')">{{ label }}</button>
{{ form_widget(child, { 'attr': { 'class': 'hide', 'ng-model': 'contentType' } }) }}
{% endfor %}
</div>
{% endspaceless %}
{% endblock choice_widget_expanded %}