Skip to content

Commit

Permalink
fix #68
Browse files Browse the repository at this point in the history
  • Loading branch information
brunosardinepi committed Jan 7, 2017
1 parent 02e8591 commit 977bf68
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 deletions.
82 changes: 40 additions & 42 deletions locations/templates/locations/location_detail.html
Expand Up @@ -72,48 +72,46 @@ <h3 class="panel-title panel-title-cog">Locations</h3>
<div class="col-md-8">
<div class="panel panel-default">
{% if this_world %}
{% if not this_location %}
<div class="panel-heading panel-heading-cog clearfix">
<span class="pull-left">
<h3 class="panel-title panel-title-cog">{{ this_world.name }}</h3>
</span>
<span class="pull-right">
<ul class="nav navbar-nav navbar-right navbar-cog">
<li class="dropdown">
<a href="#" class="dropdown-cog dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-lg fa-cog" aria-hidden="true"></i> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{% url 'locations:location_create' world_pk=this_world.pk %}"><span class="text-success"><i class="fa fa-fw fa-plus" aria-hidden="true"></i> Create location</span></a></li>
<li><a href="{% url 'locations:world_update' world_pk=this_world.pk %}"><span class="text-warning"><i class="fa fa-fw fa-pencil-square-o" aria-hidden="true"></i> Edit world</span></a></li>
<li><a href="{% url 'locations:world_delete' world_pk=this_world.pk %}"><span class="text-danger"><i class="fa fa-fw fa-trash" aria-hidden="true"></i> Delete world</span></a></li>
</ul>
</li>
</ul>
</span>
</div>
<div class="panel-body">
<p>{{ this_world.content|safe }}</p>
</div>
{% elif this_location %}
<div class="panel-heading panel-heading-cog clearfix">
<span class="pull-left">
<h3 class="panel-title panel-title-cog">{{ this_location.name }}</h3>
</span>
<span class="pull-right">
<ul class="nav navbar-nav navbar-right navbar-cog">
<li class="dropdown">
<a href="#" class="dropdown-cog dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-lg fa-cog" aria-hidden="true"></i> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{% url 'locations:location_update' location_pk=this_location.pk %}"><span class="text-warning"><i class="fa fa-fw fa-pencil-square-o" aria-hidden="true"></i> Edit location</span></a></li>
<li><a href="{% url 'locations:location_delete' location_pk=this_location.pk %}"><span class="text-danger"><i class="fa fa-fw fa-trash" aria-hidden="true"></i> Delete location</span></a></li>
</ul>
</li>
</ul>
</span>
</div>
<div class="panel-body">
<p>{{ this_location.content|safe }}</p>
</div>
{% endif %}
<div class="panel-heading panel-heading-cog clearfix">
<span class="pull-left">
<h3 class="panel-title panel-title-cog">{{ this_world.name }}</h3>
</span>
<span class="pull-right">
<ul class="nav navbar-nav navbar-right navbar-cog">
<li class="dropdown">
<a href="#" class="dropdown-cog dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-lg fa-cog" aria-hidden="true"></i> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{% url 'locations:location_create' world_pk=this_world.pk %}"><span class="text-success"><i class="fa fa-fw fa-plus" aria-hidden="true"></i> Create location</span></a></li>
<li><a href="{% url 'locations:world_update' world_pk=this_world.pk %}"><span class="text-warning"><i class="fa fa-fw fa-pencil-square-o" aria-hidden="true"></i> Edit world</span></a></li>
<li><a href="{% url 'locations:world_delete' world_pk=this_world.pk %}"><span class="text-danger"><i class="fa fa-fw fa-trash" aria-hidden="true"></i> Delete world</span></a></li>
</ul>
</li>
</ul>
</span>
</div>
<div class="panel-body">
<p>{{ this_world.content|safe }}</p>
</div>
{% elif this_location %}
<div class="panel-heading panel-heading-cog clearfix">
<span class="pull-left">
<h3 class="panel-title panel-title-cog">{{ this_location.name }}</h3>
</span>
<span class="pull-right">
<ul class="nav navbar-nav navbar-right navbar-cog">
<li class="dropdown">
<a href="#" class="dropdown-cog dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-lg fa-cog" aria-hidden="true"></i> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{% url 'locations:location_update' location_pk=this_location.pk %}"><span class="text-warning"><i class="fa fa-fw fa-pencil-square-o" aria-hidden="true"></i> Edit location</span></a></li>
<li><a href="{% url 'locations:location_delete' location_pk=this_location.pk %}"><span class="text-danger"><i class="fa fa-fw fa-trash" aria-hidden="true"></i> Delete location</span></a></li>
</ul>
</li>
</ul>
</span>
</div>
<div class="panel-body">
<p>{{ this_location.content|safe }}</p>
</div>
{% else %}
<div class="panel-heading panel-heading-cog clearfix">
<span class="pull-right">
Expand Down
12 changes: 7 additions & 5 deletions locations/views.py
Expand Up @@ -27,11 +27,13 @@ def location_detail(request, world_pk=None, location_pk=None):
if world_pk:
this_world = get_object_or_404(models.World, pk=world_pk)
if this_world.user == request.user:
if location_pk:
this_location = get_object_or_404(models.Location, pk=location_pk)
return render(request, 'locations/location_detail.html', {'this_world': this_world, 'this_location': this_location, 'worlds': worlds, 'locations': locations})
else:
return render(request, 'locations/location_detail.html', {'this_world': this_world, 'worlds': worlds, 'locations': locations})
return render(request, 'locations/location_detail.html', {'this_world': this_world, 'worlds': worlds, 'locations': locations})
else:
raise Http404
elif location_pk:
this_location = get_object_or_404(models.Location, pk=location_pk)
if this_location.user == request.user:
return render(request, 'locations/location_detail.html', {'this_world': this_world, 'this_location': this_location, 'worlds': worlds, 'locations': locations})
else:
raise Http404
else:
Expand Down

0 comments on commit 977bf68

Please sign in to comment.