From cde3565a6743591b0de527dc4cf78125290a3f20 Mon Sep 17 00:00:00 2001 From: Ferran Recio Date: Mon, 12 Sep 2022 16:21:31 +0200 Subject: [PATCH] MDL-75498 mod_data: add new tags to presets --- mod/data/preset/imagegallery/addtemplate.html | 7 +++-- .../preset/imagegallery/asearchtemplate.html | 4 +-- .../preset/imagegallery/singletemplate.html | 1 + .../tests/behat/imagegallery_preset.feature | 26 +++++++++++++++++ mod/data/preset/journal/addtemplate.html | 5 ++-- mod/data/preset/journal/asearchtemplate.html | 8 +++--- mod/data/preset/journal/singletemplate.html | 1 + .../tests/behat/journal_preset.feature | 24 ++++++++++++++++ mod/data/preset/proposals/addtemplate.html | 9 +++--- .../preset/proposals/asearchtemplate.html | 8 +++--- mod/data/preset/proposals/rsstemplate.html | 6 ++-- mod/data/preset/proposals/singletemplate.html | 7 +++-- .../tests/behat/proposals_preset.feature | 28 +++++++++++++++++++ mod/data/preset/resources/addtemplate.html | 9 +++--- .../preset/resources/asearchtemplate.html | 6 ++-- mod/data/preset/resources/rsstemplate.html | 2 +- mod/data/preset/resources/singletemplate.html | 3 +- .../tests/behat/resources_preset.feature | 26 +++++++++++++++++ 18 files changed, 146 insertions(+), 34 deletions(-) diff --git a/mod/data/preset/imagegallery/addtemplate.html b/mod/data/preset/imagegallery/addtemplate.html index 9196b8b7606..b00753ac5e0 100644 --- a/mod/data/preset/imagegallery/addtemplate.html +++ b/mod/data/preset/imagegallery/addtemplate.html @@ -1,14 +1,15 @@
-
Title
+
[[title#name]]
[[title]]
-
Image
+
[[image#name]]
[[image]]
-
Description
+
[[description#name]]
[[description]]
+ ##otherfields##
diff --git a/mod/data/preset/imagegallery/asearchtemplate.html b/mod/data/preset/imagegallery/asearchtemplate.html index 24e5db57d43..4b5ec8a6c84 100644 --- a/mod/data/preset/imagegallery/asearchtemplate.html +++ b/mod/data/preset/imagegallery/asearchtemplate.html @@ -10,11 +10,11 @@
-
Title
+
[[title#name]]
[[title]]
-
Description
+
[[description#name]]
[[description]]
diff --git a/mod/data/preset/imagegallery/singletemplate.html b/mod/data/preset/imagegallery/singletemplate.html index ad0a62fc563..3ec798908a3 100644 --- a/mod/data/preset/imagegallery/singletemplate.html +++ b/mod/data/preset/imagegallery/singletemplate.html @@ -27,5 +27,6 @@
[[image]]
+ ##otherfields## diff --git a/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature b/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature index 1ecbc74e41b..c5d0816fad3 100644 --- a/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature +++ b/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature @@ -90,3 +90,29 @@ Feature: Users can use the Image gallery preset And I press "Save" Then I should see "New image" And I should see "This is the description for the new image." + + @javascript + Scenario: Image gallery. Renaming a field should affect the template + Given I am on the "Mountain landscapes" "data activity" page logged in as teacher1 + And I navigate to "Fields" in current page administration + And I open the action menu in "title" "table_row" + And I choose "Edit" in the open action menu + And I set the field "Field name" to "Edited field name" + And I press "Save" + And I should see "Field updated" + When I navigate to "Database" in current page administration + Then I click on "Advanced search" "checkbox" + And I should see "Edited field name" + And I click on "Add entry" "button" + And I should see "Edited field name" + + @javascript + Scenario: Image gallery. Has otherfields tag + Given the following "mod_data > fields" exist: + | database | type | name | description | + | data1 | text | Extra field | Test field description | + And I am on the "Mountain landscapes" "data activity" page logged in as teacher1 + When I select "Single view" from the "jump" singleselect + Then I should see "Extra field" + And I click on "Add entry" "button" + And I should see "Extra field" diff --git a/mod/data/preset/journal/addtemplate.html b/mod/data/preset/journal/addtemplate.html index ae583c14c66..6e4981f13c9 100644 --- a/mod/data/preset/journal/addtemplate.html +++ b/mod/data/preset/journal/addtemplate.html @@ -1,10 +1,11 @@
-
Title
+
[[Title#name]]
[[Title]]
-
Content
+
[[Content#name]]
[[Content]]
+ ##otherfields##
diff --git a/mod/data/preset/journal/asearchtemplate.html b/mod/data/preset/journal/asearchtemplate.html index 470f02544f9..5ac6b1edaed 100644 --- a/mod/data/preset/journal/asearchtemplate.html +++ b/mod/data/preset/journal/asearchtemplate.html @@ -10,12 +10,12 @@
-
Title
- [[title]] +
[[Title#name]]
+ [[Title]]
-
Content
- [[content]] +
[[Content#name]]
+ [[Content]]
diff --git a/mod/data/preset/journal/singletemplate.html b/mod/data/preset/journal/singletemplate.html index 411391a6e0e..8ead74d2cec 100644 --- a/mod/data/preset/journal/singletemplate.html +++ b/mod/data/preset/journal/singletemplate.html @@ -24,5 +24,6 @@
[[Content]]
+ ##otherfields## diff --git a/mod/data/preset/journal/tests/behat/journal_preset.feature b/mod/data/preset/journal/tests/behat/journal_preset.feature index 6fcc27aff9b..d8f03ca1ad1 100644 --- a/mod/data/preset/journal/tests/behat/journal_preset.feature +++ b/mod/data/preset/journal/tests/behat/journal_preset.feature @@ -76,3 +76,27 @@ Feature: Users can use the Journal preset And I press "Save" Then I should see "This is the title" And I should see "This is the content for the new entry." + + @javascript + Scenario: Journal. Renaming a field should affect the template + Given I am on the "Student reflections" "data activity" page logged in as teacher1 + And I navigate to "Fields" in current page administration + And I open the action menu in "Content" "table_row" + And I choose "Edit" in the open action menu + And I set the field "Field name" to "Edited field name" + And I press "Save" + And I should see "Field updated" + When I navigate to "Database" in current page administration + Then I click on "Advanced search" "checkbox" + And I should see "Edited field name" + And I click on "Add entry" "button" + And I should see "Edited field name" + + @javascript + Scenario: Journal. Has otherfields tag + Given the following "mod_data > fields" exist: + | database | type | name | description | + | data1 | text | Extra field | Test field description | + And I am on the "Student reflections" "data activity" page logged in as teacher1 + When I click on "Add entry" "button" + Then I should see "Extra field" diff --git a/mod/data/preset/proposals/addtemplate.html b/mod/data/preset/proposals/addtemplate.html index ad89ce3c15f..495b43e2f91 100644 --- a/mod/data/preset/proposals/addtemplate.html +++ b/mod/data/preset/proposals/addtemplate.html @@ -1,18 +1,19 @@
-
Title
+
[[Title#name]]
[[Title]]
-
Status
+
[[Status#name]]
[[Status]]
-
Summary
+
[[Summary#name]]
[[Summary]]
-
Content
+
[[Content#name]]
[[Content]]
+ ##otherfields##
diff --git a/mod/data/preset/proposals/asearchtemplate.html b/mod/data/preset/proposals/asearchtemplate.html index 40c6af1c131..5ac7b5b30ab 100644 --- a/mod/data/preset/proposals/asearchtemplate.html +++ b/mod/data/preset/proposals/asearchtemplate.html @@ -10,19 +10,19 @@
-
Title
+
[[Title#name]]
[[Title]]
-
Status
+
[[Status#name]]
[[Status]]
-
Summary
+
[[Summary#name]]
[[Summary]]
-
Content
+
[[Content#name]]
[[Content]]
diff --git a/mod/data/preset/proposals/rsstemplate.html b/mod/data/preset/proposals/rsstemplate.html index a86ba32d8f0..65fb5828795 100644 --- a/mod/data/preset/proposals/rsstemplate.html +++ b/mod/data/preset/proposals/rsstemplate.html @@ -21,18 +21,18 @@
-
Status
+
[[Status#name]]
[[Status]]
-

Summary

+

[[Summary#name]]

[[Summary]]
-

Content

+

[[Content#name]]

[[Content]]
diff --git a/mod/data/preset/proposals/singletemplate.html b/mod/data/preset/proposals/singletemplate.html index b3867a2e78d..d28d1919974 100644 --- a/mod/data/preset/proposals/singletemplate.html +++ b/mod/data/preset/proposals/singletemplate.html @@ -23,21 +23,22 @@
-

Status

+

[[Status#name]]

[[Status]]
-

Summary

+

[[Summary#name]]

[[Summary]]
-

Content

+

[[Content#name]]

[[Content]]
+ ##otherfields##
diff --git a/mod/data/preset/proposals/tests/behat/proposals_preset.feature b/mod/data/preset/proposals/tests/behat/proposals_preset.feature index c15ff161482..7deb633da53 100644 --- a/mod/data/preset/proposals/tests/behat/proposals_preset.feature +++ b/mod/data/preset/proposals/tests/behat/proposals_preset.feature @@ -94,3 +94,31 @@ Feature: Users can use the Proposals preset And I should see "Approved" And I should see "This is the summary for the new entry." And I should see "This is the content for the new entry." + + @javascript + Scenario: Proposals. Renaming a field should affect the template + Given I am on the "Student projects" "data activity" page logged in as teacher1 + And I navigate to "Fields" in current page administration + And I open the action menu in "Summary" "table_row" + And I choose "Edit" in the open action menu + And I set the field "Field name" to "Edited field name" + And I press "Save" + And I should see "Field updated" + When I navigate to "Database" in current page administration + Then I click on "Advanced search" "checkbox" + And I should see "Edited field name" + And I select "Single view" from the "jump" singleselect + And I should see "Edited field name" + And I click on "Add entry" "button" + And I should see "Edited field name" + + @javascript + Scenario: Proposals. Has otherfields tag + Given the following "mod_data > fields" exist: + | database | type | name | description | + | data1 | text | Extra field | Test field description | + And I am on the "Student projects" "data activity" page logged in as teacher1 + When I select "Single view" from the "jump" singleselect + Then I should see "Extra field" + And I click on "Add entry" "button" + And I should see "Extra field" diff --git a/mod/data/preset/resources/addtemplate.html b/mod/data/preset/resources/addtemplate.html index 59b4d0041a9..ed7b322175d 100644 --- a/mod/data/preset/resources/addtemplate.html +++ b/mod/data/preset/resources/addtemplate.html @@ -1,6 +1,6 @@
-
Title
+
[[Title#name]]
[[Title]]
@@ -8,7 +8,7 @@ [[Author]]
-
Cover
+
[[Cover#name]]
[[Cover]]
@@ -16,11 +16,12 @@ [[Description]]
-
Web link
+
[[Web link#name]]
[[Web link]]
-
Type
+
[[Type#name]]
[[Type]]
+ ##otherfields##
diff --git a/mod/data/preset/resources/asearchtemplate.html b/mod/data/preset/resources/asearchtemplate.html index cfd1be7fe2b..0c2c6457299 100644 --- a/mod/data/preset/resources/asearchtemplate.html +++ b/mod/data/preset/resources/asearchtemplate.html @@ -10,7 +10,7 @@
-
Title
+
[[Title#name]]
[[Title]]
@@ -22,11 +22,11 @@ [[Description]]
-
Link
+
[[Web link#name]]
[[Web link]]
-
Type
+
[[Type#name]]
[[Type]]
diff --git a/mod/data/preset/resources/rsstemplate.html b/mod/data/preset/resources/rsstemplate.html index f88539c7038..b2f63507e5a 100644 --- a/mod/data/preset/resources/rsstemplate.html +++ b/mod/data/preset/resources/rsstemplate.html @@ -27,7 +27,7 @@
[[Author]]
-
Type
+
[[Type#name]]
[[Type]]
diff --git a/mod/data/preset/resources/singletemplate.html b/mod/data/preset/resources/singletemplate.html index b55d8461ebd..7e03d3534aa 100644 --- a/mod/data/preset/resources/singletemplate.html +++ b/mod/data/preset/resources/singletemplate.html @@ -28,7 +28,7 @@
[[Author]]
-
Type
+
[[Type#name]]
[[Type]]
@@ -45,5 +45,6 @@ [[Description]]
+ ##otherfields## diff --git a/mod/data/preset/resources/tests/behat/resources_preset.feature b/mod/data/preset/resources/tests/behat/resources_preset.feature index 6d546829be3..6b53cbf6706 100644 --- a/mod/data/preset/resources/tests/behat/resources_preset.feature +++ b/mod/data/preset/resources/tests/behat/resources_preset.feature @@ -99,3 +99,29 @@ Feature: Users can use the Resources preset And I should see "This is the author" And I should see "https://thisisthelink.cat" And I should see "Type2" + + @javascript + Scenario: Resources. Renaming a field should affect the template + Given I am on the "Student resources" "data activity" page logged in as teacher1 + And I navigate to "Fields" in current page administration + And I open the action menu in "Type" "table_row" + And I choose "Edit" in the open action menu + And I set the field "Field name" to "Edited field name" + And I press "Save" + And I should see "Field updated" + When I navigate to "Database" in current page administration + Then I click on "Advanced search" "checkbox" + And I should see "Edited field name" + And I click on "Add entry" "button" + And I should see "Edited field name" + + @javascript + Scenario: Resources. Has otherfields tag + Given the following "mod_data > fields" exist: + | database | type | name | description | + | data1 | text | Extra field | Test field description | + And I am on the "Student resources" "data activity" page logged in as teacher1 + When I select "Single view" from the "jump" singleselect + Then I should see "Extra field" + And I click on "Add entry" "button" + And I should see "Extra field"