From 59832b275df852bec1b02d75a41393517a8cbea0 Mon Sep 17 00:00:00 2001
From: Julen Landa Alustiza <jlanda@fedoraproject.org>
Date: Nov 15 2019 13:41:37 +0000
Subject: [PATCH 1/2] pagure/templates/repo_master.html: select full text on git|ssh url input boxes when they get focus


---

diff --git a/pagure/templates/repo_master.html b/pagure/templates/repo_master.html
index ab64a1b..e4471c5 100644
--- a/pagure/templates/repo_master.html
+++ b/pagure/templates/repo_master.html
@@ -13,7 +13,7 @@
     <div class="form-group">
       <div class="input-group input-group-sm">
         <div class="input-group-prepend"><span class="input-group-text">SSH</span></div>
-        <input class="form-control bg-white" type="text" value="{{
+        <input class="form-control bg-white select-on-focus" type="text" value="{{
           end_url_ssh | git_url_ssh }}{{ repo.fullname }}.git" readonly>
       </div>
     </div>
@@ -190,7 +190,7 @@
               <div class="form-group">
                 <div class="input-group input-group-sm">
                   <div class="input-group-prepend"><span class="input-group-text">GIT</span></div>
-                  <input class="form-control bg-white" type="text" value="{{
+                  <input class="form-control bg-white select-on-focus" type="text" value="{{
                     config.get('GIT_URL_GIT') }}{{ repo.path }}" readonly>
                 </div>
               </div>
@@ -212,7 +212,7 @@
                   <div class="form-group">
                     <div class="input-group input-group-sm">
                       <div class="input-group-prepend"><span class="input-group-text">GIT</span></div>
-                      <input class="form-control bg-white" type="text" value="{{
+                      <input class="form-control bg-white select-on-focus" type="text" value="{{
                         config.get('GIT_URL_GIT') }}docs/{{ repo.path }}" readonly>
                     </div>
                   </div>
@@ -308,6 +308,10 @@ $(".fork_project_btn").click(function() {
   $('#fork_project').submit();
 });
 
+$(".select-on-focus").on("focus", function() {
+  $(this).select();
+});
+
 {% if g.authenticated and not g.repo_obj.is_empty %}
 
 {% if g.repo_committer %}

From fd0057656b7923d348c979969dbf43a0812bd1b1 Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon <pingou@pingoured.fr>
Date: Nov 15 2019 14:46:49 +0000
Subject: [PATCH 2/2] Fix the unit-tests for the change in the UI


Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>

---

diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py
index 59b4ebe..0f977d8 100644
--- a/tests/test_pagure_flask_ui_repo.py
+++ b/tests/test_pagure_flask_ui_repo.py
@@ -1748,7 +1748,7 @@ class PagureFlaskRepotests(tests.Modeltests):
             self.assertEqual(output.status_code, 200)
             output_text = output.get_data(as_text=True)
             self.assertIn(
-                '<input class="form-control bg-white" type="text" '
+                '<input class="form-control bg-white select-on-focus" type="text" '
                 'value="ssh://git@localhost.localdomain/tickets/test.git" readonly>',
                 output_text,
             )
@@ -1775,7 +1775,7 @@ class PagureFlaskRepotests(tests.Modeltests):
             self.assertEqual(output.status_code, 200)
             output_text = output.get_data(as_text=True)
             self.assertNotIn(
-                '<input class="form-control bg-white" type="text" '
+                '<input class="form-control bg-white select-on-focus" type="text" '
                 'value="ssh://git@localhost.localdomain/tickets/test.git" readonly>',
                 output_text,
             )
diff --git a/tests/test_pagure_flask_ui_repo_slash_name.py b/tests/test_pagure_flask_ui_repo_slash_name.py
index e146795..028f542 100644
--- a/tests/test_pagure_flask_ui_repo_slash_name.py
+++ b/tests/test_pagure_flask_ui_repo_slash_name.py
@@ -93,7 +93,7 @@ class PagureFlaskSlashInNametests(tests.SimplePagureTest):
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            '<input class="form-control bg-white" type="text" '
+            '<input class="form-control bg-white select-on-focus" type="text" '
             'value="git://localhost.localdomain/test.git" readonly>',
             output_text,
         )
@@ -137,7 +137,7 @@ class PagureFlaskSlashInNametests(tests.SimplePagureTest):
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            '<input class="form-control bg-white" type="text" '
+            '<input class="form-control bg-white select-on-focus" type="text" '
             'value="git://localhost.localdomain/forks/test.git" readonly>',
             output_text,
         )
@@ -176,7 +176,7 @@ class PagureFlaskSlashInNametests(tests.SimplePagureTest):
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            '<input class="form-control bg-white" type="text" '
+            '<input class="form-control bg-white select-on-focus" type="text" '
             'value="git://localhost.localdomain/test.git" readonly>',
             output_text,
         )
@@ -215,7 +215,7 @@ class PagureFlaskSlashInNametests(tests.SimplePagureTest):
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            '<input class="form-control bg-white" type="text" '
+            '<input class="form-control bg-white select-on-focus" type="text" '
             'value="git://localhost.localdomain/forks/test.git" readonly>',
             output_text,
         )
diff --git a/tests/test_pagure_flask_ui_slash_branch_name.py b/tests/test_pagure_flask_ui_slash_branch_name.py
index c2d7d48..cbb2e11 100644
--- a/tests/test_pagure_flask_ui_slash_branch_name.py
+++ b/tests/test_pagure_flask_ui_slash_branch_name.py
@@ -116,7 +116,7 @@ class PagureFlaskSlashInBranchtests(tests.SimplePagureTest):
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            '<input class="form-control bg-white" type="text" '
+            '<input class="form-control bg-white select-on-focus" type="text" '
             'value="git://localhost.localdomain/test.git" readonly>',
             output_text,
         )
@@ -141,7 +141,7 @@ class PagureFlaskSlashInBranchtests(tests.SimplePagureTest):
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            '<input class="form-control bg-white" type="text" '
+            '<input class="form-control bg-white select-on-focus" type="text" '
             'value="git://localhost.localdomain/test.git" readonly>', output_text)
     '''
 

