forked from GithubBackups/healthchecks
Simpler navigation
This commit is contained in:
parent
3c57e4026a
commit
3eaff7d596
@ -79,6 +79,6 @@ def check_token(request, username, token):
|
||||
user.set_unusable_password()
|
||||
user.save()
|
||||
auth_login(request, user)
|
||||
return redirect("hc-checks")
|
||||
return redirect("hc-index")
|
||||
|
||||
return render(request, "bad_link.html")
|
||||
|
@ -4,7 +4,6 @@ from hc.front import views
|
||||
|
||||
urlpatterns = [
|
||||
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/([\w-]+)/name/$', views.update_name, name="hc-update-name"),
|
||||
url(r'^checks/([\w-]+)/timeout/$', views.update_timeout, name="hc-update-timeout"),
|
||||
|
@ -7,7 +7,7 @@ from hc.api.models import Check
|
||||
from hc.front.forms import TimeoutForm, TIMEOUT_CHOICES
|
||||
|
||||
|
||||
def index(request):
|
||||
def _welcome(request):
|
||||
if "welcome_code" not in request.session:
|
||||
check = Check()
|
||||
check.save()
|
||||
@ -26,40 +26,44 @@ def index(request):
|
||||
timer_formatted = "Never"
|
||||
|
||||
ctx = {
|
||||
"page": "welcome",
|
||||
"check": check,
|
||||
"timer": timer,
|
||||
"timer_formatted": timer_formatted,
|
||||
"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 docs(request):
|
||||
return render(request, "docs.html", {"page": "docs"})
|
||||
|
||||
|
||||
def about(request):
|
||||
return render(request, "about.html", {"page": "about"})
|
||||
|
||||
|
||||
@login_required
|
||||
def checks(request):
|
||||
def _my_checks(request):
|
||||
checks = Check.objects.filter(user=request.user).order_by("created")
|
||||
|
||||
ctx = {
|
||||
"checks": checks,
|
||||
"now": timezone.now,
|
||||
"timeout_choices": TIMEOUT_CHOICES,
|
||||
"page": "checks"
|
||||
"timeout_choices": TIMEOUT_CHOICES
|
||||
}
|
||||
|
||||
return render(request, "front/index.html", ctx)
|
||||
return render(request, "front/my_checks.html", ctx)
|
||||
|
||||
|
||||
def index(request):
|
||||
if request.user.is_authenticated():
|
||||
return _my_checks(request)
|
||||
else:
|
||||
return _welcome(request)
|
||||
|
||||
|
||||
def pricing(request):
|
||||
return render(request, "front/pricing.html", {"page": "pricing"})
|
||||
|
||||
|
||||
def docs(request):
|
||||
return render(request, "front/docs.html", {"page": "docs"})
|
||||
|
||||
|
||||
def about(request):
|
||||
return render(request, "front/about.html", {"page": "about"})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -19,12 +19,6 @@
|
||||
</div>
|
||||
|
||||
<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 %}>
|
||||
<a href="{% url 'hc-pricing' %}">Pricing</a>
|
||||
</li>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<div class="col-sm-12">
|
||||
<h3>Summary</h3>
|
||||
<p>
|
||||
Each check you create in <a href="{% url 'hc-checks' %}">My Checks</a>
|
||||
Each check you create in <a href="{% url 'hc-index' %}">My Checks</a>
|
||||
page has an unique "ping" URL. Whenever you access this URL,
|
||||
the "Last Ping" value of corresponding check is updated.
|
||||
</p>
|
Loading…
x
Reference in New Issue
Block a user