Skip to content

Commit

Permalink
Merge pull request #532 from Cadasta/bugfix/#520
Browse files Browse the repository at this point in the history
Fix #520: ellipsis menu visibility
  • Loading branch information
oliverroick authored Aug 8, 2016
2 parents 175bbb6 + 6faf8a8 commit 8578f3f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
16 changes: 5 additions & 11 deletions cadasta/organization/views/default.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import os
import json
from django.http import Http404, HttpResponse
from django.http import HttpResponse
from django.db import transaction
from django.shortcuts import redirect, get_object_or_404
import django.views.generic as base_generic
from django.core.urlresolvers import reverse
from django.utils.translation import gettext as _
from django.contrib import messages

import formtools.wizard.views as wizard
Expand Down Expand Up @@ -294,6 +293,7 @@ def get(self, request, *args, **kwargs):

class ProjectDashboard(PermissionRequiredMixin,
mixins.ProjectAdminCheckMixin,
mixins.ProjectMixin,
generic.DetailView):
def get_actions(view, request):
if view.get_object().public():
Expand Down Expand Up @@ -324,15 +324,7 @@ def get_context_data(self, **kwargs):
return context

def get_object(self, queryset=None):
queryset = Project.objects.filter(
organization__slug=self.kwargs.get('organization'),
slug=self.kwargs.get('project')
)
try:
obj = queryset.get()
except queryset.model.DoesNotExist:
raise Http404(_("No projects found matching the query"))
return obj
return self.get_project()


PROJECT_ADD_FORMS = [('extents', forms.ProjectAddExtents),
Expand Down Expand Up @@ -475,6 +467,7 @@ def done(self, form_list, form_dict, **kwargs):


class ProjectEdit(mixins.ProjectMixin,
mixins.ProjectAdminCheckMixin,
LoginPermissionRequiredMixin):
model = Project
permission_required = 'project.update'
Expand Down Expand Up @@ -545,6 +538,7 @@ class ProjectUnarchive(ProjectEdit, ArchiveMixin, generic.DetailView):

class ProjectDataDownload(mixins.ProjectMixin,
LoginPermissionRequiredMixin,
mixins.ProjectAdminCheckMixin,
base_generic.edit.FormMixin,
generic.DetailView):
template_name = 'organization/project_download.html'
Expand Down
4 changes: 2 additions & 2 deletions cadasta/organization/views/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ def is_administrator(self):
su_role = Role.objects.filter(name='superuser')
org_admins = [
role.user for role in OrganizationRole.objects.filter(
organization=self.get_object().organization,
organization=self.get_project().organization,
admin=True
)
]
proj_managers = [
role.user for role in ProjectRole.objects.filter(
project=self.get_object(),
project=self.get_project(),
role='PM'
)

Expand Down
11 changes: 11 additions & 0 deletions cadasta/party/views/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from jsonattrs.mixins import JsonAttrsMixin
from core.mixins import LoginPermissionRequiredMixin

from organization.views import mixins as organization_mixins
from resources.forms import AddResourceFromLibraryForm
from resources.views.mixins import ProjectHasResourcesMixin
from . import mixins
Expand Down Expand Up @@ -40,6 +41,7 @@ def get_form_kwargs(self, *args, **kwargs):
class PartiesDetail(LoginPermissionRequiredMixin,
JsonAttrsMixin,
mixins.PartyObjectMixin,
organization_mixins.ProjectAdminCheckMixin,
ProjectHasResourcesMixin,
generic.DetailView):
template_name = 'party/party_detail.html'
Expand All @@ -50,6 +52,7 @@ class PartiesDetail(LoginPermissionRequiredMixin,

class PartiesEdit(LoginPermissionRequiredMixin,
mixins.PartyObjectMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.UpdateView):
template_name = 'party/party_edit.html'
form_class = forms.PartyForm
Expand All @@ -59,6 +62,7 @@ class PartiesEdit(LoginPermissionRequiredMixin,

class PartiesDelete(LoginPermissionRequiredMixin,
mixins.PartyObjectMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.DeleteView):
template_name = 'party/party_delete.html'
permission_required = 'party.delete'
Expand All @@ -72,6 +76,7 @@ def get_success_url(self):

class PartyResourcesAdd(LoginPermissionRequiredMixin,
mixins.PartyResourceMixin,
organization_mixins.ProjectAdminCheckMixin,
base_generic.edit.FormMixin,
generic.DetailView):
template_name = 'party/resources_add.html'
Expand All @@ -89,6 +94,7 @@ def post(self, request, *args, **kwargs):

class PartyResourcesNew(LoginPermissionRequiredMixin,
mixins.PartyResourceMixin,
organization_mixins.ProjectAdminCheckMixin,
ProjectHasResourcesMixin,
generic.CreateView):
template_name = 'party/resources_new.html'
Expand All @@ -99,6 +105,7 @@ class PartyResourcesNew(LoginPermissionRequiredMixin,
class PartyRelationshipDetail(LoginPermissionRequiredMixin,
JsonAttrsMixin,
mixins.PartyRelationshipObjectMixin,
organization_mixins.ProjectAdminCheckMixin,
ProjectHasResourcesMixin,
generic.DetailView):
template_name = 'party/relationship_detail.html'
Expand All @@ -109,6 +116,7 @@ class PartyRelationshipDetail(LoginPermissionRequiredMixin,

class PartyRelationshipEdit(LoginPermissionRequiredMixin,
mixins.PartyRelationshipObjectMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.UpdateView):
template_name = 'party/relationship_edit.html'
form_class = forms.TenureRelationshipEditForm
Expand All @@ -121,6 +129,7 @@ def get_success_url(self):

class PartyRelationshipDelete(LoginPermissionRequiredMixin,
mixins.PartyRelationshipObjectMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.DeleteView):
template_name = 'party/relationship_delete.html'
permission_required = 'tenure_rel.delete'
Expand All @@ -134,6 +143,7 @@ def get_success_url(self):

class PartyRelationshipResourceNew(LoginPermissionRequiredMixin,
mixins.PartyRelationshipResourceMixin,
organization_mixins.ProjectAdminCheckMixin,
ProjectHasResourcesMixin,
generic.CreateView):
template_name = 'party/relationship_resources_new.html'
Expand All @@ -143,6 +153,7 @@ class PartyRelationshipResourceNew(LoginPermissionRequiredMixin,

class PartyRelationshipResourceAdd(LoginPermissionRequiredMixin,
mixins.PartyRelationshipResourceMixin,
organization_mixins.ProjectAdminCheckMixin,
base_generic.edit.FormMixin,
generic.DetailView):
template_name = 'party/relationship_resources_add.html'
Expand Down
6 changes: 6 additions & 0 deletions cadasta/resources/views/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
from core.mixins import LoginPermissionRequiredMixin

from . import mixins
from organization.views import mixins as organization_mixins
from ..forms import AddResourceFromLibraryForm
from .. import messages as error_messages


class ProjectResources(LoginPermissionRequiredMixin,
mixins.ProjectResourceMixin,
mixins.ProjectHasResourcesMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.ListView):
template_name = 'resources/project_list.html'
permission_required = 'resource.list'
Expand All @@ -22,6 +24,7 @@ class ProjectResources(LoginPermissionRequiredMixin,
class ProjectResourcesAdd(LoginPermissionRequiredMixin,
mixins.ProjectResourceMixin,
base_generic.edit.FormMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.DetailView):
template_name = 'resources/project_add_existing.html'
form_class = AddResourceFromLibraryForm
Expand All @@ -42,6 +45,7 @@ def post(self, request, *args, **kwargs):
class ProjectResourcesNew(LoginPermissionRequiredMixin,
mixins.ProjectResourceMixin,
mixins.ProjectHasResourcesMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.CreateView):
template_name = 'resources/project_add_new.html'
permission_required = 'resource.add'
Expand All @@ -53,6 +57,7 @@ def get_perms_objects(self):

class ProjectResourcesDetail(LoginPermissionRequiredMixin,
mixins.ResourceObjectMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.DetailView):
template_name = 'resources/project_detail.html'
permission_required = 'resource.view'
Expand All @@ -66,6 +71,7 @@ def get_context_data(self, *args, **kwargs):

class ProjectResourcesEdit(LoginPermissionRequiredMixin,
mixins.ResourceObjectMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.UpdateView):
template_name = 'resources/edit.html'
permission_required = 'resource.edit'
Expand Down
9 changes: 9 additions & 0 deletions cadasta/spatial/views/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
from resources.views.mixins import ProjectHasResourcesMixin
from party.messages import TENURE_REL_CREATE
from . import mixins
from organization.views import mixins as organization_mixins
from .. import forms
from ..serializers import SpatialUnitGeoJsonSerializer
from .. import messages as error_messages


class LocationsList(LoginPermissionRequiredMixin,
mixins.SpatialQuerySetMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.ListView):
template_name = 'spatial/location_map.html'
permission_required = 'spatial.list'
Expand All @@ -26,6 +28,7 @@ class LocationsList(LoginPermissionRequiredMixin,

class LocationsAdd(LoginPermissionRequiredMixin,
mixins.SpatialQuerySetMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.CreateView):
form_class = forms.LocationForm
template_name = 'spatial/location_add.html'
Expand Down Expand Up @@ -59,6 +62,7 @@ def get_form_kwargs(self):
class LocationDetail(LoginPermissionRequiredMixin,
JsonAttrsMixin,
mixins.SpatialUnitObjectMixin,
organization_mixins.ProjectAdminCheckMixin,
ProjectHasResourcesMixin,
generic.DetailView):
template_name = 'spatial/location_detail.html'
Expand All @@ -74,6 +78,7 @@ def get_context_data(self, *args, **kwargs):

class LocationEdit(LoginPermissionRequiredMixin,
mixins.SpatialUnitObjectMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.UpdateView):
template_name = 'spatial/location_edit.html'
form_class = forms.LocationForm
Expand All @@ -83,6 +88,7 @@ class LocationEdit(LoginPermissionRequiredMixin,

class LocationDelete(LoginPermissionRequiredMixin,
mixins.SpatialUnitObjectMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.DeleteView):
template_name = 'spatial/location_delete.html'
permission_required = 'spatial.delete'
Expand All @@ -97,6 +103,7 @@ def get_success_url(self):
class LocationResourceAdd(LoginPermissionRequiredMixin,
mixins.SpatialUnitResourceMixin,
base_generic.edit.FormMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.DetailView):
template_name = 'spatial/resources_add.html'
form_class = AddResourceFromLibraryForm
Expand All @@ -113,6 +120,7 @@ def post(self, request, *args, **kwargs):

class LocationResourceNew(LoginPermissionRequiredMixin,
mixins.SpatialUnitResourceMixin,
organization_mixins.ProjectAdminCheckMixin,
ProjectHasResourcesMixin,
generic.CreateView):
template_name = 'spatial/resources_new.html'
Expand All @@ -132,6 +140,7 @@ def get_context_data(self, *args, **kwargs):

class TenureRelationshipAdd(LoginPermissionRequiredMixin,
mixins.SpatialUnitRelationshipMixin,
organization_mixins.ProjectAdminCheckMixin,
generic.CreateView):
template_name = 'spatial/relationship_add.html'
form_class = forms.TenureRelationshipForm
Expand Down

0 comments on commit 8578f3f

Please sign in to comment.