Browse Source

Forums and warnings admin moved to misago_forms.

Rafał Pitoń 11 years ago
parent
commit
3defc5b9f6

+ 9 - 7
misago/forums/forms.py

@@ -56,13 +56,15 @@ class ForumFormBase(forms.ModelForm):
         help_text=_("Optional CSS class used to customize this forum "
         help_text=_("Optional CSS class used to customize this forum "
                     "appearance from templates."))
                     "appearance from templates."))
     prune_started_after = forms.IntegerField(
     prune_started_after = forms.IntegerField(
-        label=_("Prune thread if number of days since its creation is "
-                "greater than"), min_value=0,
-        help_text=_("Enter 0 to disable this pruning criteria."))
+        label=_("Thread age"), min_value=0,
+        help_text=_("Prune thread if number of days since its creation is "
+                    "greater than specified. Enter 0 to disable this "
+                    "pruning criteria."))
     prune_replied_after = forms.IntegerField(
     prune_replied_after = forms.IntegerField(
-        label=_("Prune thread if number of days since last reply is greater "
-                "than"), min_value=0,
-        help_text=_("Enter 0 to disable this pruning criteria."))
+        label=_("Last reply"), min_value=0,
+        help_text=_("Prune thread if number of days since last reply is "
+                    "greater than specified. Enter 0 to disable this "
+                    "pruning criteria."))
 
 
     class Meta:
     class Meta:
         model = Forum
         model = Forum
@@ -135,7 +137,7 @@ def ForumFormFactory(instance):
             base_level=1,
             base_level=1,
             required=False),
             required=False),
         'archive_pruned_in': ForumChoiceField(
         'archive_pruned_in': ForumChoiceField(
-            label=_("Pruned threads archive"),
+            label=_("Archive"),
             help_text=_("Instead of being deleted, pruned threads can be "
             help_text=_("Instead of being deleted, pruned threads can be "
                         "moved to designated forum."),
                         "moved to designated forum."),
             queryset=Forum.objects.all_forums(),
             queryset=Forum.objects.all_forums(),

+ 20 - 13
misago/templates/misago/admin/forums/form.html

@@ -1,5 +1,5 @@
 {% extends "misago/admin/generic/form.html" %}
 {% extends "misago/admin/generic/form.html" %}
-{% load crispy_forms_filters i18n %}
+{% load i18n misago_forms %}
 
 
 
 
 {% block title %}
 {% block title %}
@@ -31,38 +31,45 @@
 {% endblock %}
 {% endblock %}
 
 
 
 
+{% block form-extra %}
+class="form-horizontal"
+{% endblock form-extra%}
+
+
 {% block form-body %}
 {% block form-body %}
 <div class="form-body">
 <div class="form-body">
+  {% with label_class="col-md-3" field_class="col-md-9" %}
   <fieldset>
   <fieldset>
     <legend>{% trans "Role and position" %}</legend>
     <legend>{% trans "Role and position" %}</legend>
 
 
-    {{ form.new_parent|as_crispy_field }}
-    {{ form.role|as_crispy_field }}
+    {% form_row form.new_parent label_class field_class %}
+    {% form_row form.role label_class field_class %}
 
 
   </fieldset>
   </fieldset>
   <fieldset>
   <fieldset>
     <legend>{% trans "Display" %}</legend>
     <legend>{% trans "Display" %}</legend>
 
 
-    {{ form.name|as_crispy_field }}
-    {{ form.description|as_crispy_field }}
-    {{ form.css_class|as_crispy_field }}
+    {% form_row form.name label_class field_class %}
+    {% form_row form.description label_class field_class %}
+    {% form_row form.css_class label_class field_class %}
 
 
   </fieldset>
   </fieldset>
   <fieldset>
   <fieldset>
     <legend>{% trans "Behaviour" %}</legend>
     <legend>{% trans "Behaviour" %}</legend>
 
 
-    {{ form.copy_permissions|as_crispy_field }}
-    {{ form.redirect_url|as_crispy_field }}
-    {{ form.is_closed|as_crispy_field }}
+    {% form_row form.copy_permissions label_class field_class %}
+    {% form_row form.redirect_url label_class field_class %}
+    {% form_row form.is_closed label_class field_class %}
 
 
   </fieldset>
   </fieldset>
   <fieldset>
   <fieldset>
-    <legend>{% trans "Pruning" %}</legend>
+    <legend>{% trans "Prune threads" %}</legend>
 
 
-    {{ form.prune_started_after|as_crispy_field }}
-    {{ form.prune_replied_after|as_crispy_field }}
-    {{ form.archive_pruned_in|as_crispy_field }}
+    {% form_row form.prune_started_after label_class field_class %}
+    {% form_row form.prune_replied_after label_class field_class %}
+    {% form_row form.archive_pruned_in label_class field_class %}
 
 
   </fieldset>
   </fieldset>
+  {% endwith %}
 </div>
 </div>
 {% endblock form-body %}
 {% endblock form-body %}

+ 16 - 10
misago/templates/misago/admin/generic/form.html

@@ -39,16 +39,22 @@
         {% block form-body %}{% endblock %}
         {% block form-body %}{% endblock %}
 
 
         <div class="form-footer">
         <div class="form-footer">
-          {% block form-footer %}
-          {% if target and target.pk %}
-          <button class="btn btn-primary">{% trans "Save changes" %}</button>
-          <button class="btn btn-success" name="stay" value="1">{% trans "Save and keep editing" %}</button>
-          {% else %}
-          <button class="btn btn-primary">{% trans "Save" %}</button>
-          <button class="btn btn-success" name="stay" value="1">{% trans "Save and add another" %}</button>
-          {% endif %}
-          {% endblock %}
-          <a href="{% url root_link %}" class="btn btn-default">{% trans "Cancel" %}</a>
+          <div class="row">
+            <div class="{% block form-footer-class %}col-xs-12{% endblock form-footer-class %}">
+
+              {% block form-footer %}
+              {% if target and target.pk %}
+              <button class="btn btn-primary">{% trans "Save changes" %}</button>
+              <button class="btn btn-success" name="stay" value="1">{% trans "Save and keep editing" %}</button>
+              {% else %}
+              <button class="btn btn-primary">{% trans "Save" %}</button>
+              <button class="btn btn-success" name="stay" value="1">{% trans "Save and add another" %}</button>
+              {% endif %}
+              {% endblock %}
+              <a href="{% url root_link %}" class="btn btn-default">{% trans "Cancel" %}</a>
+
+            </div>
+          </div>
         </div>
         </div>
 
 
       </form>
       </form>

+ 21 - 28
misago/templates/misago/admin/warnings/form.html

@@ -37,40 +37,33 @@ class="form-horizontal"
 
 
 
 
 {% block form-body %}
 {% block form-body %}
-{% with label_class="col-md-3" field_class="col-md-9" %}
-  <div class="form-body">
-    <fieldset>
-      <legend>{% trans "Name and description" %}</legend>
+<div class="form-body">
+  {% with label_class="col-md-3" field_class="col-md-9" %}
+  <fieldset>
+    <legend>{% trans "Name and description" %}</legend>
 
 
-        {% form_row form.name label_class field_class %}
-        {% form_row form.description label_class field_class %}
+      {% form_row form.name label_class field_class %}
+      {% form_row form.description label_class field_class %}
 
 
-    </fieldset>
-    <fieldset>
-      <legend>{% trans "Expiration time" %}</legend>
+  </fieldset>
+  <fieldset>
+    <legend>{% trans "Expiration time" %}</legend>
 
 
-        {% form_row form.expires_after_minutes label_class field_class %}
+      {% form_row form.expires_after_minutes label_class field_class %}
 
 
-    </fieldset>
-    <fieldset>
-      <legend>{% trans "Restrictions" %}</legend>
+  </fieldset>
+  <fieldset>
+    <legend>{% trans "Restrictions" %}</legend>
 
 
-        {% form_row form.restricts_posting_replies label_class field_class %}
-        {% form_row form.restricts_posting_threads label_class field_class %}
+      {% form_row form.restricts_posting_replies label_class field_class %}
+      {% form_row form.restricts_posting_threads label_class field_class %}
 
 
-    </fieldset>
-  </div>
-{% endwith %}
+  </fieldset>
+  {% endwith %}
+</div>
 {% endblock form-body %}
 {% endblock form-body %}
 
 
 
 
-{% block javascripts %}
-<script type="text/javascript">
-  $(function() {
-    $('#id_valid_until').datetimepicker({
-      language: $('html').attr('lang'),
-      pickTime: false
-    });
-  });
-</script>
-{% endblock %}
+{% block form-footer-class %}
+col-md-offset-3
+{% endblock form-footer-class %}