Browse Source

Simpler navigation

pull/7/head
Pēteris Caune 9 years ago
parent
commit
3eaff7d596
9 changed files with 25 additions and 28 deletions
  1. +1
    -1
      hc/accounts/views.py
  2. +0
    -1
      hc/front/urls.py
  3. +23
    -19
      hc/front/views.py
  4. +0
    -6
      templates/base.html
  5. +0
    -0
      templates/front/about.html
  6. +1
    -1
      templates/front/docs.html
  7. +0
    -0
      templates/front/my_checks.html
  8. +0
    -0
      templates/front/pricing.html
  9. +0
    -0
      templates/front/welcome.html

+ 1
- 1
hc/accounts/views.py View File

@ -79,6 +79,6 @@ def check_token(request, username, token):
user.set_unusable_password() user.set_unusable_password()
user.save() user.save()
auth_login(request, user) auth_login(request, user)
return redirect("hc-checks")
return redirect("hc-index")
return render(request, "bad_link.html") return render(request, "bad_link.html")

+ 0
- 1
hc/front/urls.py View File

@ -4,7 +4,6 @@ from hc.front import views
urlpatterns = [ urlpatterns = [
url(r'^$', views.index, name="hc-index"), url(r'^$', views.index, name="hc-index"),
url(r'^checks/$', views.checks, name="hc-checks"),
url(r'^checks/add/$', views.add_check, name="hc-add-check"), url(r'^checks/add/$', views.add_check, name="hc-add-check"),
url(r'^checks/([\w-]+)/name/$', views.update_name, name="hc-update-name"), url(r'^checks/([\w-]+)/name/$', views.update_name, name="hc-update-name"),
url(r'^checks/([\w-]+)/timeout/$', views.update_timeout, name="hc-update-timeout"), url(r'^checks/([\w-]+)/timeout/$', views.update_timeout, name="hc-update-timeout"),


+ 23
- 19
hc/front/views.py View File

@ -7,7 +7,7 @@ from hc.api.models import Check
from hc.front.forms import TimeoutForm, TIMEOUT_CHOICES from hc.front.forms import TimeoutForm, TIMEOUT_CHOICES
def index(request):
def _welcome(request):
if "welcome_code" not in request.session: if "welcome_code" not in request.session:
check = Check() check = Check()
check.save() check.save()
@ -26,40 +26,44 @@ def index(request):
timer_formatted = "Never" timer_formatted = "Never"
ctx = { ctx = {
"page": "welcome",
"check": check, "check": check,
"timer": timer, "timer": timer,
"timer_formatted": timer_formatted, "timer_formatted": timer_formatted,
"ping_url": check.url() "ping_url": check.url()
} }
return render(request, "index.html", ctx)
return render(request, "front/welcome.html", ctx)
def pricing(request):
return render(request, "pricing.html", {"page": "pricing"})
def _my_checks(request):
checks = Check.objects.filter(user=request.user).order_by("created")
ctx = {
"checks": checks,
"now": timezone.now,
"timeout_choices": TIMEOUT_CHOICES
}
def docs(request):
return render(request, "docs.html", {"page": "docs"})
return render(request, "front/my_checks.html", ctx)
def about(request):
return render(request, "about.html", {"page": "about"})
def index(request):
if request.user.is_authenticated():
return _my_checks(request)
else:
return _welcome(request)
@login_required
def checks(request):
checks = Check.objects.filter(user=request.user).order_by("created")
def pricing(request):
return render(request, "front/pricing.html", {"page": "pricing"})
ctx = {
"checks": checks,
"now": timezone.now,
"timeout_choices": TIMEOUT_CHOICES,
"page": "checks"
}
return render(request, "front/index.html", ctx)
def docs(request):
return render(request, "front/docs.html", {"page": "docs"})
def about(request):
return render(request, "front/about.html", {"page": "about"})
@login_required @login_required


+ 0
- 6
templates/base.html View File

@ -19,12 +19,6 @@
</div> </div>
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
{% if request.user.is_authenticated %}
<li {% if page == 'checks' %} class="active" {% endif %}>
<a href="{% url 'hc-checks' %}">My Checks</a>
</li>
{% endif %}
<li {% if page == 'pricing' %} class="active" {% endif %}> <li {% if page == 'pricing' %} class="active" {% endif %}>
<a href="{% url 'hc-pricing' %}">Pricing</a> <a href="{% url 'hc-pricing' %}">Pricing</a>
</li> </li>


templates/about.html → templates/front/about.html View File


templates/docs.html → templates/front/docs.html View File


templates/front/index.html → templates/front/my_checks.html View File


templates/pricing.html → templates/front/pricing.html View File


templates/index.html → templates/front/welcome.html View File


Loading…
Cancel
Save