From eb7f51f6f5e201e64cb0e22263f292ce738309b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C4=93teris=20Caune?= <cuu508@gmail.com>
Date: Thu, 5 Mar 2020 16:05:06 +0200
Subject: [PATCH] Focus the "name" input in the "Add Project" modal.

---
 static/js/add_project_modal.js            | 5 +++++
 templates/accounts/add_project_modal.html | 3 ++-
 templates/accounts/profile.html           | 1 +
 templates/front/projects.html             | 2 +-
 4 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100644 static/js/add_project_modal.js

diff --git a/static/js/add_project_modal.js b/static/js/add_project_modal.js
new file mode 100644
index 00000000..737c99d2
--- /dev/null
+++ b/static/js/add_project_modal.js
@@ -0,0 +1,5 @@
+$(function () {
+    $("#add-project-modal").on('shown.bs.modal', function () {
+        $("#add-project-name").focus();
+    })
+});
\ No newline at end of file
diff --git a/templates/accounts/add_project_modal.html b/templates/accounts/add_project_modal.html
index 44ebbe7d..d34c0e46 100644
--- a/templates/accounts/add_project_modal.html
+++ b/templates/accounts/add_project_modal.html
@@ -12,10 +12,11 @@
                 <p>Name your project</p>
 
                 <input
+                    id="add-project-name"
                     type="text"
                     name="name"
                     class="form-control input-lg"
-                    autocomplete="off">
+                    autocomplete="off" />
 
                 <p>&nbsp;</p>
 
diff --git a/templates/accounts/profile.html b/templates/accounts/profile.html
index 3b821ede..186828ed 100644
--- a/templates/accounts/profile.html
+++ b/templates/accounts/profile.html
@@ -205,6 +205,7 @@
 {% compress js %}
 <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
 <script src="{% static 'js/bootstrap.min.js' %}"></script>
+<script src="{% static 'js/add_project_modal.js' %}"></script>
 <script src="{% static 'js/profile.js' %}"></script>
 {% endcompress %}
 {% endblock %}
diff --git a/templates/front/projects.html b/templates/front/projects.html
index 42ffde80..a820968d 100644
--- a/templates/front/projects.html
+++ b/templates/front/projects.html
@@ -58,6 +58,6 @@
 {% compress js %}
 <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
 <script src="{% static 'js/bootstrap.min.js' %}"></script>
-<script src="{% static 'js/project.js' %}"></script>
+<script src="{% static 'js/add_project_modal.js' %}"></script>
 {% endcompress %}
 {% endblock %}