- Dodanie możliwości ustalenia autora i wpisania opisu zmian przy zapisywaniu pliku.
class BookForm(forms.Form):
text = forms.CharField(widget=forms.Textarea)
class BookForm(forms.Form):
text = forms.CharField(widget=forms.Textarea)
+ commit_message = forms.CharField()
+ user = forms.CharField()
class ImageFoldersForm(forms.Form):
class ImageFoldersForm(forms.Form):
form = forms.BookForm(request.POST)
if form.is_valid():
repo.add_file(path, form.cleaned_data['text'])
form = forms.BookForm(request.POST)
if form.is_valid():
repo.add_file(path, form.cleaned_data['text'])
+ repo.commit(message=form.cleaned_data['commit_message'], user=form.cleaned_data['user'])
return HttpResponseRedirect(request.get_full_path())
else:
form = forms.BookForm()
return HttpResponseRedirect(request.get_full_path())
else:
form = forms.BookForm()
{% extends "base.html" %}
{% block extrahead %}
{% extends "base.html" %}
{% block extrahead %}
- <script src="/static/js/jquery.lazyload.js" type="text/javascript" charset="utf-8"></script>
+ <script src="/static/js/jquery.fieldselection.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
function aboveViewport(container, element, treshold) {
return $(container).offset().top >= $(element).offset().top + $(element).height() + treshold;
<script type="text/javascript" charset="utf-8">
function aboveViewport(container, element, treshold) {
return $(container).offset().top >= $(element).offset().top + $(element).height() + treshold;
});
setTimeout(checkScroll, 2000);
});
setTimeout(checkScroll, 2000);
+
+ $('#rozdzial-button').click(function(event) {
+ console.log($('#id_text').getSelection().text);
+ $('#id_text').replaceSelection('<rozdzial>' + $('#id_text').getSelection().text + '</rozdzial>', true);
+ event.preventDefault();
+ });
});
</script>
{% endblock extrahead %}
});
</script>
{% endblock extrahead %}
</div>
</div>
<form action="." method="post" accept-charset="utf-8">
</div>
</div>
<form action="." method="post" accept-charset="utf-8">
+ <a href="#" id="rozdzial-button">Rodział</a>
- <p><input type="submit" value="Zapisz"/></p>
+ <p>Użytkownik: {{ form.user }} Opis zmian: {{ form.commit_message }} <input type="submit" value="Zapisz"/></p>
</form>
{% endblock maincontent %}
</form>
{% endblock maincontent %}