Эх сурвалжийг харах

[doc2] Clean-up new home page template

Romain Rigaux 10 жил өмнө
parent
commit
b5f04fe1ad

+ 6 - 6
desktop/core/src/desktop/api2.py

@@ -96,18 +96,14 @@ def get_document(request):
   else:
   else:
     doc = Document2.objects.get(uuid=request.GET['uuid'])
     doc = Document2.objects.get(uuid=request.GET['uuid'])
 
 
-
-
   permissions = _massage_permissions(doc)
   permissions = _massage_permissions(doc)
 
 
-
   doc_info = doc.to_dict()
   doc_info = doc.to_dict()
   doc_info.update(permissions)
   doc_info.update(permissions)
 
 
-#   response = _massage_doc_for_json(doc, request.user, with_data=request.GET.get('with_data'))
-#   return JsonResponse(response)
   return JsonResponse(doc_info)
   return JsonResponse(doc_info)
 
 
+
 def _massage_permissions(document):
 def _massage_permissions(document):
   """
   """
   Returns the permissions for a given document as a dictionary
   Returns the permissions for a given document as a dictionary
@@ -189,7 +185,7 @@ def share_document(request):
 
 
   Example of input: {'read': {'user_ids': [1, 2, 3], 'group_ids': [1, 2, 3]}}
   Example of input: {'read': {'user_ids': [1, 2, 3], 'group_ids': [1, 2, 3]}}
   """
   """
-  perms_dict = json.loads(request.POST['perms_dict'])
+  perms_dict = json.loads(request.POST['data'])
   doc_id = json.loads(request.POST['doc_id'])
   doc_id = json.loads(request.POST['doc_id'])
 
 
   doc = Document2.objects.document(request.user, doc_id)
   doc = Document2.objects.document(request.user, doc_id)
@@ -208,6 +204,10 @@ def share_document(request):
 
 
     doc.share(request.user, name=name, users=users, groups=groups)
     doc.share(request.user, name=name, users=users, groups=groups)
 
 
+  return JsonResponse({
+      'status': 0,
+  })
+
 
 
 def _massage_doc_for_json(document, user, with_data=False):
 def _massage_doc_for_json(document, user, with_data=False):
 
 

+ 3 - 3
desktop/core/src/desktop/models.py

@@ -744,9 +744,9 @@ class Document2Manager(models.Manager):
   def documents(self, user):
   def documents(self, user):
     return Document2.objects.filter(
     return Document2.objects.filter(
         Q(owner=user) |
         Q(owner=user) |
-        Q(documentpermission2__users=user) |
-        Q(documentpermission2__groups__in=user.groups.all()) |
-        Q(documentpermission2__all=True)
+        Q(document2permission__users=user) |
+        Q(document2permission__groups__in=user.groups.all()) |
+        Q(document2permission__all=True)
     ).distinct().order_by('-last_modified')
     ).distinct().order_by('-last_modified')
 
 
   def directory(self, user, path):
   def directory(self, user, path):

+ 0 - 8
desktop/core/src/desktop/templates/home2.mako

@@ -161,9 +161,6 @@ ${ commonheader(_('Welcome Home'), "home", user) | n,unicode }
                 <th style="width: 26px">&nbsp;</th>
                 <th style="width: 26px">&nbsp;</th>
                 <th style="width: 200px">${_('Name')}</th>
                 <th style="width: 200px">${_('Name')}</th>
                 <th>${_('Description')}</th>
                 <th>${_('Description')}</th>
-                <th style="width: 150px">${_('Last Modified')}</th>
-                <th style="width: 80px; text-align: center">${_('Project')}</th>
-                <th style="width: 40px">${_('Sharing')}</th>
               </tr>
               </tr>
             </thead>
             </thead>
             <tbody data-bind="template: { name: 'document-template', foreach: renderableDocuments}">
             <tbody data-bind="template: { name: 'document-template', foreach: renderableDocuments}">
@@ -201,11 +198,6 @@ ${ commonheader(_('Welcome Home'), "home", user) | n,unicode }
     <td style="width: 26px"></td>
     <td style="width: 26px"></td>
     <td><a data-bind="attr: { href: absoluteUrl }, html: name"></a></td>
     <td><a data-bind="attr: { href: absoluteUrl }, html: name"></a></td>
     <td data-bind="text: ko.mapping.toJSON($data)"></td>
     <td data-bind="text: ko.mapping.toJSON($data)"></td>
-    <td></td>
-    <td style="text-align: center; white-space: nowrap">
-    </td>
-    <td style="width: 40px; text-align: center">    
-    </td>
   </tr>
   </tr>
 </script>
 </script>