- {% include 'Program/program_download_button.html.twig' %}
+ {% if logged_in %}
+ {% include 'Program/program_download_button.html.twig' %}
+ {% else %}
+ {% include 'Program/program_download_disabled_button.html.twig' %}
+ {% endif %}
{% if not isIOS() %}
{% include 'Program/program_apk_generation_buttons.html.twig' %}
@@ -110,7 +114,11 @@
- {% include 'Program/program_download_button.html.twig' with {'suffix': '-small'} %}
+ {% if logged_in %}
+ {% include 'Program/program_download_button.html.twig' with {'suffix': '-small'} %}
+ {% else %}
+ {% include 'Program/program_download_disabled_button.html.twig' with {'suffix': '-small'} %}
+ {% endif %}
diff --git a/templates/Program/program_download_disabled_button.html.twig b/templates/Program/program_download_disabled_button.html.twig
new file mode 100644
index 0000000000..5660a8a5de
--- /dev/null
+++ b/templates/Program/program_download_disabled_button.html.twig
@@ -0,0 +1,18 @@
+
diff --git a/tests/BehatFeatures/web/project-details/project_download.feature b/tests/BehatFeatures/web/project-details/project_download.feature
index 58c1d65fcc..36793655a4 100644
--- a/tests/BehatFeatures/web/project-details/project_download.feature
+++ b/tests/BehatFeatures/web/project-details/project_download.feature
@@ -5,13 +5,15 @@ Feature: As a visitor I want to be able to download projects
Given there are users:
| id | name |
| 1 | Catrobat |
+ | 2 | User |
And there are projects:
| id | name | downloads | owned by | apk_ready |
| 1 | project 1 | 5 | Catrobat | true |
| 2 | project 2 | 5 | Catrobat | true |
Scenario: I want to download a project via the button
- When I am on "/app/project/1"
+ Given I log in as "Catrobat"
+ And I am on "/app/project/1"
And I wait for the page to be loaded
Then the element "#projectDownloadButton-small" should be visible
And I click "#projectDownloadButton-small"
diff --git a/tests/BehatFeatures/web/project-details/project_download_disabled.feature b/tests/BehatFeatures/web/project-details/project_download_disabled.feature
new file mode 100644
index 0000000000..7cddad5a02
--- /dev/null
+++ b/tests/BehatFeatures/web/project-details/project_download_disabled.feature
@@ -0,0 +1,25 @@
+@web @project_page
+Feature: As a visitor I need to login to be able to download projects
+
+ Background:
+ Given there are users:
+ | id | name |
+ | 1 | Catrobat |
+ And there are projects:
+ | id | name | downloads | owned by | apk_ready |
+ | 1 | project 1 | 5 | Catrobat | true |
+ | 2 | project 2 | 5 | Catrobat | true |
+
+Scenario: I want to download a project via the button
+ When I am on "/app/project/1"
+ And I wait for the page to be loaded
+ Then the element "#projectDownloadDisabledButton-small" should be visible
+ And I click "#projectDownloadDisabledButton-small"
+ Then I am on "/app/login"
+ And I wait for the page to be loaded
+ And I fill in "_username" with "Catrobat"
+ And I fill in "_password" with "123456"
+ Then I press "Login"
+ And I wait for the page to be loaded
+ Then I should be logged in
+ And I am on "/app/project/1"
\ No newline at end of file
diff --git a/translations/catroweb.en.yaml b/translations/catroweb.en.yaml
index 79c53c27d3..bb8f3c39cd 100644
--- a/translations/catroweb.en.yaml
+++ b/translations/catroweb.en.yaml
@@ -27,6 +27,7 @@ reportIt: Yes, report it!
areYouSure: Are you sure?
noWayOfReturn: There is no way to restore your actions!
download: Download
+downloadDisabledAlert: You must be logged in to download this project
name: Name
description: Description
noDescription: No description available.