diff --git a/pagure/templates/_projectstring.html b/pagure/templates/_projectstring.html index 3833604..85b0f60 100644 --- a/pagure/templates/_projectstring.html +++ b/pagure/templates/_projectstring.html @@ -4,18 +4,18 @@ {%- if theme.projectstring is defined -%} {{theme.projectstring(plural)}} {%- else -%} - {% if plural %} + {%- if plural -%} Projects - {% else %} + {%- else -%} Project - {% endif %} + {%- endif -%} {%- endif -%} {% endmacro %} {% macro projecticon() %} {%- if theme.projecticon is defined -%} - {{theme.projecticon}} + {{ theme.projecticon }} {%- else -%} fa-calendar-o fa-rotate-270 {%- endif -%} -{% endmacro %} \ No newline at end of file +{% endmacro %} diff --git a/pagure/templates/userprofile_starred.html b/pagure/templates/userprofile_starred.html index c0b0f15..9691ee8 100644 --- a/pagure/templates/userprofile_starred.html +++ b/pagure/templates/userprofile_starred.html @@ -9,14 +9,15 @@
-

Starred {{projectstring}}s

- {{ user.stars | length }} {{projectstring}}s +

Starred {{ projectstring(plural=True) }}

+ {{ + user.stars | length }} {{ projectstring(plural=(user.stars | length > 1)) }}s
{% if repos %} {{ render_repo_listing(repos)}} {% else %}
-

No starred {{projectstring}}s or forks

+

No starred {{ projectstring() }}s or forks

{% endif %}
diff --git a/pagure/ui/app.py b/pagure/ui/app.py index a9755ad..b49c908 100644 --- a/pagure/ui/app.py +++ b/pagure/ui/app.py @@ -99,6 +99,7 @@ def index(): return flask.render_template( "index.html", select="projects", + namespace=None, repos=repos, repos_length=num_repos, total_page=total_page, diff --git a/tests/test_pagure_flask_api_ui_private_repo.py b/tests/test_pagure_flask_api_ui_private_repo.py index 4cc1b9d..d61c8f6 100644 --- a/tests/test_pagure_flask_api_ui_private_repo.py +++ b/tests/test_pagure_flask_api_ui_private_repo.py @@ -420,12 +420,9 @@ class PagurePrivateRepotest(tests.Modeltests): self.assertIn( '

My Projects

', output_text) - self.assertIn( - '2 projects', - output_text) + self.assertIn('2 Projects', output_text) self.assertNotIn( - 'Forks', - output_text) + 'Forks', output_text) self.assertEqual( output_text.count('Groups'), 0) @@ -605,7 +602,7 @@ class PagurePrivateRepotest(tests.Modeltests): '

My Projects

', output_text) self.assertIn( - '0 projects
', + '0 Projects
', output_text) self.assertNotIn( 'Forks', @@ -633,7 +630,7 @@ class PagurePrivateRepotest(tests.Modeltests): '

My Projects

', output_text) self.assertIn( - '1 projects
', + '1 Projects
', output_text) self.assertNotIn( 'Forks', diff --git a/tests/test_pagure_flask_ui_app.py b/tests/test_pagure_flask_ui_app.py index 32beae9..7ec343e 100644 --- a/tests/test_pagure_flask_ui_app.py +++ b/tests/test_pagure_flask_ui_app.py @@ -43,7 +43,7 @@ class PagureFlaskApptests(tests.Modeltests): output = self.app.get('/', follow_redirects=True) output_text = output.get_data(as_text=True) self.assertIn( - '
You have no projects
', + '
You have no Projects
', output_text) tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_ui_app_browse.py b/tests/test_pagure_flask_ui_app_browse.py index 10072bd..115f533 100644 --- a/tests/test_pagure_flask_ui_app_browse.py +++ b/tests/test_pagure_flask_ui_app_browse.py @@ -64,10 +64,10 @@ class PagureFlaskAppBrowsetests(tests.Modeltests): '4', output_text) self.assertIn( - '', output_text) - self.assertEqual(output_text.count('title="Private project"'), 1) + self.assertEqual(output_text.count('title="Private Project"'), 1) @patch.dict('pagure.config.config', {'PRIVATE_PROJECTS': True}) def test_browse_project_unauth_private_project(self): @@ -85,10 +85,10 @@ class PagureFlaskAppBrowsetests(tests.Modeltests): '3', output_text) self.assertNotIn( - '', output_text) - self.assertEqual(output_text.count('title="Private project"'), 0) + self.assertEqual(output_text.count('title="Private Project"'), 0) @patch.dict('pagure.config.config', {'PRIVATE_PROJECTS': True}) def test_browse_project_logged_in_no_access_private_project(self): @@ -108,10 +108,10 @@ class PagureFlaskAppBrowsetests(tests.Modeltests): '3', output_text) self.assertNotIn( - '', output_text) - self.assertEqual(output_text.count('title="Private project"'), 0) + self.assertEqual(output_text.count('title="Private Project"'), 0) @patch.dict('pagure.config.config', {'PRIVATE_PROJECTS': True}) def test_browse_project_logged_in_ticket_private_project(self): @@ -144,10 +144,10 @@ class PagureFlaskAppBrowsetests(tests.Modeltests): '3', output_text) self.assertNotIn( - '', output_text) - self.assertEqual(output_text.count('title="Private project"'), 0) + self.assertEqual(output_text.count('title="Private Project"'), 0) @patch.dict('pagure.config.config', {'PRIVATE_PROJECTS': True}) def test_browse_project_logged_in_commit_private_project(self): @@ -179,10 +179,10 @@ class PagureFlaskAppBrowsetests(tests.Modeltests): '4', output_text) self.assertIn( - '', output_text) - self.assertEqual(output_text.count('title="Private project"'), 1) + self.assertEqual(output_text.count('title="Private Project"'), 1) @patch.dict('pagure.config.config', {'PRIVATE_PROJECTS': True}) def test_browse_project_logged_in_admin_private_project(self): @@ -214,10 +214,10 @@ class PagureFlaskAppBrowsetests(tests.Modeltests): '4', output_text) self.assertIn( - '', output_text) - self.assertEqual(output_text.count('title="Private project"'), 1) + self.assertEqual(output_text.count('title="Private Project"'), 1) class PagureFlaskAppBrowseGroupAdmintests(tests.Modeltests): """ Tests for the browse pages of flask app controller of pagure """ @@ -318,10 +318,10 @@ class PagureFlaskAppBrowseGroupAdmintests(tests.Modeltests): '4', output_text) self.assertIn( - '', output_text) - self.assertEqual(output_text.count('title="Private project"'), 1) + self.assertEqual(output_text.count('title="Private Project"'), 1) class PagureFlaskAppBrowseGroupCommittests(tests.Modeltests): @@ -423,10 +423,10 @@ class PagureFlaskAppBrowseGroupCommittests(tests.Modeltests): '4', output_text) self.assertIn( - '', output_text) - self.assertEqual(output_text.count('title="Private project"'), 1) + self.assertEqual(output_text.count('title="Private Project"'), 1) class PagureFlaskAppBrowseGroupTickettests(tests.Modeltests): @@ -494,10 +494,10 @@ class PagureFlaskAppBrowseGroupTickettests(tests.Modeltests): '3', output_text) self.assertNotIn( - '', output_text) - self.assertEqual(output_text.count('title="Private project"'), 0) + self.assertEqual(output_text.count('title="Private Project"'), 0) @patch.dict('pagure.config.config', {'PRIVATE_PROJECTS': True}) def test_browse_project_user_in_group(self): @@ -529,10 +529,10 @@ class PagureFlaskAppBrowseGroupTickettests(tests.Modeltests): '3', output_text) self.assertNotIn( - '', output_text) - self.assertEqual(output_text.count('title="Private project"'), 0) + self.assertEqual(output_text.count('title="Private Project"'), 0) if __name__ == '__main__': diff --git a/tests/test_pagure_flask_ui_app_index.py b/tests/test_pagure_flask_ui_app_index.py index 0646436..be7383b 100644 --- a/tests/test_pagure_flask_ui_app_index.py +++ b/tests/test_pagure_flask_ui_app_index.py @@ -80,7 +80,7 @@ class PagureFlaskAppIndextests(tests.Modeltests): self.assertIn( '' - '1 projects\n', + '1 Projects
\n', output_text) self.assertNotIn( '

All Projects ' diff --git a/tests/test_pagure_flask_ui_app_userdash.py b/tests/test_pagure_flask_ui_app_userdash.py index 4765f6b..676e2c5 100644 --- a/tests/test_pagure_flask_ui_app_userdash.py +++ b/tests/test_pagure_flask_ui_app_userdash.py @@ -57,7 +57,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): output_text = output.get_data(as_text=True) self.assertIn( '1 projects', + ' border-0 ml-auto font-weight-bold">1 Projects', output_text) self.assertIn( '
No Projects match this filter
', @@ -79,7 +79,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): # After self.assertIn( '1 projects', + ' border-0 ml-auto font-weight-bold">1 Projects', output_text) self.assertIn( '
No Projects match this filter
', @@ -109,7 +109,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): self.assertIn( '

My Projects

\n' ' 1 projects\n', + ' opacity-100 border-0 ml-auto font-weight-bold">1 Projects\n', output_text) # Add foo to test with commit level @@ -130,7 +130,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): self.assertIn( '

My Projects

\n' ' 2 projects\n', + ' opacity-100 border-0 ml-auto font-weight-bold">2 Projects\n', output_text) def test_index_commit_access_while_ticket(self): @@ -157,7 +157,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): self.assertIn( '

My Projects

\n' ' 1 projects\n', + ' opacity-100 border-0 ml-auto font-weight-bold">1 Projects\n', output_text) # Add foo to test with ticket level @@ -178,7 +178,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): self.assertIn( '

My Projects

\n' ' 2 projects\n', + ' opacity-100 border-0 ml-auto font-weight-bold">2 Projects\n', output_text) def test_index_admin_access_while_admin(self): @@ -205,7 +205,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): self.assertIn( '

My Projects

\n' ' 1 projects\n', + ' opacity-100 border-0 ml-auto font-weight-bold">1 Projects\n', output_text) # Add foo to test with admin level @@ -226,7 +226,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): self.assertIn( '

My Projects

\n' ' 2 projects\n', + ' opacity-100 border-0 ml-auto font-weight-bold">2 Projects\n', output_text) def test_index_admin_access_while_commit(self): @@ -253,7 +253,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): self.assertIn( '

My Projects

\n' ' 1 projects\n', + ' opacity-100 border-0 ml-auto font-weight-bold">1 Projects\n', output_text) # Add foo to test with commit level @@ -275,7 +275,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): self.assertIn( '

My Projects

\n' ' 2 projects\n', + ' opacity-100 border-0 ml-auto font-weight-bold">2 Projects\n', output_text) def test_index_main_admin_access_while_commit(self): @@ -302,7 +302,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): self.assertIn( '

My Projects

\n' ' 1 projects\n', + ' opacity-100 border-0 ml-auto font-weight-bold">1 Projects\n', output_text) # Add foo to test with commit level @@ -323,7 +323,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): self.assertIn( '

My Projects

\n' ' 2 projects\n', + ' opacity-100 border-0 ml-auto font-weight-bold">2 Projects\n', output_text) @@ -351,7 +351,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): self.assertIn( '

My Projects

\n' ' 1 projects\n', + ' opacity-100 border-0 ml-auto font-weight-bold">1 Projects\n', output_text) self.assertIn( '3 projects', output_text) + 'border-0 ml-auto font-weight-bold">3 Projects', output_text) self.assertNotIn( 'Forks ', output_text) @@ -3283,7 +3283,7 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( '3 projects', output_text) + 'border-0 ml-auto font-weight-bold">3 Projects', output_text) self.assertNotIn( 'Forks ', output_text) @@ -3321,7 +3321,7 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( '3 projects', output_text) + 'border-0 ml-auto font-weight-bold">3 Projects', output_text) self.assertIn( """ @@ -3845,7 +3845,7 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( '1 projects', output_text) + 'border-0 ml-auto font-weight-bold">1 Projects', output_text) self.assertNotIn( 'Forks ', output_text) @@ -3874,7 +3874,7 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( '1 projects', output_text) + 'border-0 ml-auto font-weight-bold">1 Projects', output_text) self.assertNotIn( 'Forks ', output_text) @@ -3950,7 +3950,7 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( '1 projects', output_text) + 'border-0 ml-auto font-weight-bold">1 Projects', output_text) self.assertNotIn( 'Forks ', output_text) @@ -3997,7 +3997,7 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( '1 projects', output_text) + 'border-0 ml-auto font-weight-bold">1 Projects', output_text) self.assertNotIn( 'Forks ', output_text) @@ -4069,7 +4069,7 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( '1 projects', output_text) + 'border-0 ml-auto font-weight-bold">1 Projects', output_text) self.assertNotIn( 'Forks ', output_text) @@ -4104,7 +4104,7 @@ index 0000000..fb7093d output_text = output.get_data(as_text=True) self.assertIn( '1 projects', output_text) + 'border-0 ml-auto font-weight-bold">1 Projects', output_text) self.assertNotIn( 'Forks ', output_text) @@ -4330,7 +4330,7 @@ index 0000000..fb7093d self.assertIn('
', output_text) print(output_text) self.assertEqual( - output_text.count(''), + output_text.count(''), 1) def test_edit_file_no_signed_off(self): diff --git a/tests/test_pagure_flask_ui_star_project.py b/tests/test_pagure_flask_ui_star_project.py index 87b4e24..7f9ca4d 100644 --- a/tests/test_pagure_flask_ui_star_project.py +++ b/tests/test_pagure_flask_ui_star_project.py @@ -102,8 +102,7 @@ class TestStarProjectUI(tests.SimplePagureTest): '/test/star/1', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'You starred ' - 'this project', + 'You starred this project', output.get_data(as_text=True) ) @@ -115,8 +114,7 @@ class TestStarProjectUI(tests.SimplePagureTest): '/test/star/0', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'You unstarred ' - 'this project', + 'You unstarred this project', output.get_data(as_text=True) ) self._check_star_count(data=data, stars=0) @@ -138,8 +136,7 @@ class TestStarProjectUI(tests.SimplePagureTest): '/test/star/1', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'You starred ' - 'this project', + 'You starred this project', output.get_data(as_text=True) ) self._check_star_count(data=data, stars=1) @@ -170,8 +167,7 @@ class TestStarProjectUI(tests.SimplePagureTest): '/test/star/0', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'You unstarred ' - 'this project', + 'You unstarred this project', output.get_data(as_text=True) ) self._check_star_count(data=data, stars=0) @@ -201,7 +197,7 @@ class TestStarProjectUI(tests.SimplePagureTest): ) self.assertIn( '0 projects', + 'border-0 ml-auto font-weight-bold">0 Projects', output_text) # make pingou star the project @@ -218,8 +214,7 @@ class TestStarProjectUI(tests.SimplePagureTest): '/test/star/1', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'You starred ' - 'this project', + 'You starred this project', output.get_data(as_text=True) ) self._check_star_count(data=data, stars=1) @@ -232,7 +227,7 @@ class TestStarProjectUI(tests.SimplePagureTest): ) self.assertIn( '1 projects', + 'border-0 ml-auto font-weight-bold">1 Projects', output_text) self.assertEqual( output_text.count('class="list-group-item"'), 1) @@ -272,7 +267,7 @@ class TestStarProjectUI(tests.SimplePagureTest): ) self.assertIn( '0 projects', + 'border-0 ml-auto font-weight-bold">0 Projects', output_text) self.assertEqual( output_text.count('class="list-group-item"'), 0)