From 6ba8cab6f4cbbc38a846c43e534c5a2bba637369 Mon Sep 17 00:00:00 2001 From: shubham76 Date: Sat, 24 Feb 2018 10:44:42 +0530 Subject: [PATCH 1/8] Better version listing for project dashboard - Issue: #3554 --- readthedocs/projects/views/public.py | 4 +- .../templates/core/project_detail_right.html | 17 ++--- .../templates/core/project_details.html | 62 ++++++++++--------- 3 files changed, 43 insertions(+), 40 deletions(-) diff --git a/readthedocs/projects/views/public.py b/readthedocs/projects/views/public.py index 61f6cfeca64..a2ee42a5e30 100644 --- a/readthedocs/projects/views/public.py +++ b/readthedocs/projects/views/public.py @@ -43,10 +43,10 @@ class ProjectIndex(ListView): """List view of public :py:class:`Project` instances.""" model = Project - + def get_queryset(self): queryset = Project.objects.public(self.request.user) - + if self.kwargs.get('tag'): self.tag = get_object_or_404(Tag, slug=self.kwargs.get('tag')) queryset = queryset.filter(tags__name__in=[self.tag.slug]) diff --git a/readthedocs/templates/core/project_detail_right.html b/readthedocs/templates/core/project_detail_right.html index b3e3e9dca00..c06d5b5854e 100644 --- a/readthedocs/templates/core/project_detail_right.html +++ b/readthedocs/templates/core/project_detail_right.html @@ -91,6 +91,15 @@

{% trans "Project Privacy Level" %}

{% endblock %} +{% block project-default-branch %} +

{% trans "Project Default Branch" %}{# trans does not work here. #}

+
+

+ {{ project.get_default_branch }} +

+
+{% endblock %} + {% block short-urls %}

{% trans "Short URLs" %}

@@ -122,11 +131,3 @@

{% trans "Sub Projects" %}

{% endif %} {% endblock %} - -{% block defaults %} -

{% trans "Default Version" %}

-

{{ project.get_default_version }}

- -

{% trans "'latest' Version" %}

-

{{ project.get_default_branch }}

-{% endblock %} diff --git a/readthedocs/templates/core/project_details.html b/readthedocs/templates/core/project_details.html index a8f9f52a3c9..4fb78aca66c 100644 --- a/readthedocs/templates/core/project_details.html +++ b/readthedocs/templates/core/project_details.html @@ -19,40 +19,42 @@

{% trans "Versions" %}

-
+
+
+ {% block build_versions %} {% if versions and request.user|is_admin:project %} From 3d2747ce85c2fe9cc9788dc344b9145cb03c5835 Mon Sep 17 00:00:00 2001 From: Shubham R Patil Date: Sat, 24 Feb 2018 18:48:51 +0530 Subject: [PATCH 2/8] restored projects/views/public.py The file was changed by mistake. Restored it. --- readthedocs/projects/views/public.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readthedocs/projects/views/public.py b/readthedocs/projects/views/public.py index a2ee42a5e30..61f6cfeca64 100644 --- a/readthedocs/projects/views/public.py +++ b/readthedocs/projects/views/public.py @@ -43,10 +43,10 @@ class ProjectIndex(ListView): """List view of public :py:class:`Project` instances.""" model = Project - + def get_queryset(self): queryset = Project.objects.public(self.request.user) - + if self.kwargs.get('tag'): self.tag = get_object_or_404(Tag, slug=self.kwargs.get('tag')) queryset = queryset.filter(tags__name__in=[self.tag.slug]) From 15f3eddacaa387c9983754b7f5634a541c8e631d Mon Sep 17 00:00:00 2001 From: Shubham R Patil Date: Sun, 25 Feb 2018 00:49:40 +0530 Subject: [PATCH 3/8] Removed the extra comment --- readthedocs/templates/core/project_detail_right.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/templates/core/project_detail_right.html b/readthedocs/templates/core/project_detail_right.html index c06d5b5854e..df756eb9ca2 100644 --- a/readthedocs/templates/core/project_detail_right.html +++ b/readthedocs/templates/core/project_detail_right.html @@ -92,7 +92,7 @@

{% trans "Project Privacy Level" %}

{% endblock %} {% block project-default-branch %} -

{% trans "Project Default Branch" %}{# trans does not work here. #}

+

{% trans "Project Default Branch" %}

{{ project.get_default_branch }} From 7d0e4313200400b5885139fa6a978545e13c8a54 Mon Sep 17 00:00:00 2001 From: Shubham R Patil Date: Sun, 25 Feb 2018 12:22:33 +0530 Subject: [PATCH 4/8] made changes to check the right user --- readthedocs/templates/core/project_details.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/templates/core/project_details.html b/readthedocs/templates/core/project_details.html index 4fb78aca66c..88cb935e63f 100644 --- a/readthedocs/templates/core/project_details.html +++ b/readthedocs/templates/core/project_details.html @@ -27,7 +27,7 @@

{% trans "Versions" %}

{# Link to the docs #} {{ version.slug }} - {% if request.user in project.users.all %} + {% if request.user|is_admin:project %} {{ version.get_privacy_level_display }} {% endif %} From 4877aa3a119c4ce0625f21479373edc183878ddb Mon Sep 17 00:00:00 2001 From: shubham76 Date: Tue, 27 Feb 2018 22:12:44 +0530 Subject: [PATCH 5/8] Removed default branch name from the right side-bar --- readthedocs/templates/core/project_detail_right.html | 9 --------- 1 file changed, 9 deletions(-) diff --git a/readthedocs/templates/core/project_detail_right.html b/readthedocs/templates/core/project_detail_right.html index df756eb9ca2..1f889be1b24 100644 --- a/readthedocs/templates/core/project_detail_right.html +++ b/readthedocs/templates/core/project_detail_right.html @@ -91,15 +91,6 @@

{% trans "Project Privacy Level" %}

{% endblock %} -{% block project-default-branch %} -

{% trans "Project Default Branch" %}

-
-

- {{ project.get_default_branch }} -

-
-{% endblock %} - {% block short-urls %}

{% trans "Short URLs" %}

From bd67955a7d9ad6b3ef51d1e4d303da63dbac4389 Mon Sep 17 00:00:00 2001 From: Shubham R Patil Date: Wed, 28 Feb 2018 22:48:43 +0530 Subject: [PATCH 6/8] Reverted the project detail table styling --- .../templates/core/project_details.html | 65 ++++++++++--------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/readthedocs/templates/core/project_details.html b/readthedocs/templates/core/project_details.html index 88cb935e63f..c115cfb18e9 100644 --- a/readthedocs/templates/core/project_details.html +++ b/readthedocs/templates/core/project_details.html @@ -18,41 +18,42 @@

{% trans "Versions" %}

+
From d3d00d0a40ef006cb0af6d7517706fbd232d77a6 Mon Sep 17 00:00:00 2001 From: Shubham R Patil Date: Wed, 28 Feb 2018 23:01:04 +0530 Subject: [PATCH 7/8] Update project_details.html --- readthedocs/templates/core/project_details.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readthedocs/templates/core/project_details.html b/readthedocs/templates/core/project_details.html index c115cfb18e9..af39e378215 100644 --- a/readthedocs/templates/core/project_details.html +++ b/readthedocs/templates/core/project_details.html @@ -18,7 +18,9 @@

{% trans "Versions" %}

+
+
    {% for version in versions|sort_version_aware %} From 28b9af2cc6768a84e7b02a10905fbe649c3ba97c Mon Sep 17 00:00:00 2001 From: Shubham R Patil Date: Sun, 4 Mar 2018 19:51:13 +0530 Subject: [PATCH 8/8] removed extra spaces --- readthedocs/templates/core/project_details.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readthedocs/templates/core/project_details.html b/readthedocs/templates/core/project_details.html index af39e378215..dc01b6335ca 100644 --- a/readthedocs/templates/core/project_details.html +++ b/readthedocs/templates/core/project_details.html @@ -18,9 +18,9 @@

    {% trans "Versions" %}

    - +
    - +
      {% for version in versions|sort_version_aware %}