diff --git a/dpaste/forms.py b/dpaste/forms.py index 426a13b..04f9704 100644 --- a/dpaste/forms.py +++ b/dpaste/forms.py @@ -19,6 +19,11 @@ EXPIRE_DEFAULT = 3600 * 24 * 30 class SnippetForm(forms.ModelForm): + content = forms.CharField( + label=_('Content'), + widget=forms.Textarea(attrs={'placeholder': _('Awesome code goes here...')}), + ) + lexer = forms.ChoiceField( label=_(u'Lexer'), initial=LEXER_DEFAULT, diff --git a/dpaste/templates/dpaste/base.html b/dpaste/templates/dpaste/base.html index 0d8037a..c85fd74 100644 --- a/dpaste/templates/dpaste/base.html +++ b/dpaste/templates/dpaste/base.html @@ -44,6 +44,8 @@ $(document).ready(function(){ } }); }); + + $('.autofocus input:text, .autofocus textarea').first().focus(); }); {% endblock %} diff --git a/dpaste/templates/dpaste/snippet_form.html b/dpaste/templates/dpaste/snippet_form.html index 4702367..0670f26 100644 --- a/dpaste/templates/dpaste/snippet_form.html +++ b/dpaste/templates/dpaste/snippet_form.html @@ -5,7 +5,7 @@ {{ snippet_form.non_field_errors }}
{{ snippet_form.title }}
-
+
{{ snippet_form.content }}
@@ -26,7 +26,7 @@
- {% if follow_button %} + {% if is_new %}
diff --git a/dpaste/templates/dpaste/snippet_new.html b/dpaste/templates/dpaste/snippet_new.html index 497f6a8..18f4b85 100644 --- a/dpaste/templates/dpaste/snippet_new.html +++ b/dpaste/templates/dpaste/snippet_new.html @@ -6,7 +6,5 @@ {% block dpaste_nav_new %}active{% endblock %} {% block page %} - {% with 1 as follow_button %} - {% include "dpaste/snippet_form.html" %} - {% endwith %} + {% include "dpaste/snippet_form.html" %} {% endblock %} \ No newline at end of file diff --git a/dpaste/views.py b/dpaste/views.py index 2611355..ef15c72 100644 --- a/dpaste/views.py +++ b/dpaste/views.py @@ -44,6 +44,7 @@ def snippet_new(request, template_name='dpaste/snippet_new.html'): template_context = { 'snippet_form': snippet_form, + 'is_new': True, } return render_to_response(