Ver Fonte

HUE-2033 [core] Reviews findings

Enrico Berti há 11 anos atrás
pai
commit
56e21e24ec

+ 2 - 2
desktop/core/src/desktop/api.py

@@ -78,7 +78,7 @@ def massaged_tags_for_json(docs, user):
 
   ts['trash'] = massaged_tags(trash_tag, tag_doc_mapping)
   ts['history'] = massaged_tags(history_tag, tag_doc_mapping)
-  tags = list(set(tag_doc_mapping.keys() + [tag for tag in DocumentTag.objects.get_tags(user=user)])) # List of all personal and share tags
+  tags = list(set(tag_doc_mapping.keys() + [tag for tag in DocumentTag.objects.get_tags(user=user)])) # List of all personal and shared tags
 
   for tag in tags:
     massaged_tag = massaged_tags(tag, tag_doc_mapping)
@@ -195,7 +195,7 @@ def massage_doc_for_json(doc, user):
         }
       },
       'owner': doc.owner.username,
-      'isMine': doc.owner.username == user.username and True or False,
+      'isMine': doc.owner.username == user.username,
       'lastModified': doc.last_modified.strftime("%x %X"),
       'lastModifiedInMillis': time.mktime(doc.last_modified.timetuple())
     }

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

@@ -202,7 +202,7 @@ class DocumentManager(models.Manager):
 
   def history_docs(self, model_class, user):
     include = [DocumentTag.objects.get_history_tag(user=user)]
-    exclude = [DocumentTag.objects.get_trash_tag(user=user)]    
+    exclude = [DocumentTag.objects.get_trash_tag(user=user)]
 
     return Document.objects.get_docs(user, model_class).filter(tags__in=include).exclude(tags__in=exclude).order_by('-last_modified')
 

+ 2 - 2
desktop/core/src/desktop/templates/home.mako

@@ -148,7 +148,7 @@ ${ commonheader(_('Welcome Home'), "home", user) | n,unicode }
                        title="${ _('Remove selected project') }" rel="tooltip" data-placement="right"></i>
              </div>
            </li>
-           <!-- ko template: { name: 'tag-template', foreach: nyTags } -->
+           <!-- ko template: { name: 'tag-template', foreach: myTags } -->
            <!-- /ko -->
            <li data-bind="visible: myTags().length == 0">
              <a href="javascript:void(0)" class="edit-tags" style="line-height:24px">
@@ -463,7 +463,7 @@ ${ commonheader(_('Welcome Home'), "home", user) | n,unicode }
     });
 
     $("#tagsNewBtn").on("click", function () {
-      var tag_name = $("#tagsNew").val(); // use ko var + bind enable/disable button accordingly (blank, duplicate, reserved...)?
+      var tag_name = $("#tagsNew").val();
       $.post("/desktop/api/tag/add_tag", {
         name: tag_name
       },function (data) {