diff --git a/mod/data/preset/imagegallery/addtemplate.html b/mod/data/preset/imagegallery/addtemplate.html index 69ae28e8fde..0f760c5d9c3 100644 --- a/mod/data/preset/imagegallery/addtemplate.html +++ b/mod/data/preset/imagegallery/addtemplate.html @@ -1,7 +1,14 @@ -
- - - - -
[[title]]
[[caption]]
[[image]]
-
\ No newline at end of file +
+
+
+ [[title]] +
+
+
+ [[image]] +
+
+
+ [[description]] +
+
diff --git a/mod/data/preset/imagegallery/asearchtemplate.html b/mod/data/preset/imagegallery/asearchtemplate.html index 8e807baf3ea..abb4d612152 100644 --- a/mod/data/preset/imagegallery/asearchtemplate.html +++ b/mod/data/preset/imagegallery/asearchtemplate.html @@ -1,12 +1,12 @@ -
- - - - - - - - - -
Title: [[title]]
Caption: [[caption]]
+
+
+
+
+ [[title]] +
+
+
+ [[description]] +
+
diff --git a/mod/data/preset/imagegallery/csstemplate.css b/mod/data/preset/imagegallery/csstemplate.css index cb7ab6da677..bd1ad48bce6 100644 --- a/mod/data/preset/imagegallery/csstemplate.css +++ b/mod/data/preset/imagegallery/csstemplate.css @@ -1,40 +1,38 @@ /****** List View CSS ******/ -#pictures { - width: 750px; +#imagegallery-list img.list_picture { + width: 100%; + height: 15vw; + object-fit: cover; } -.picture { - padding: 5px; - border-style: solid; - border-width: thin; - border-color: #779; - background-color: white; - display: inline-block; +#imagegallery-list .card { + margin-top: 30px; + margin-bottom: 15px; } -.pictureframe { - padding: 5px; - display: inline-block; -} - -.picturediv { - display: inline-block; - max-width: 150px; - max-height: 200px; -} - -.inline { - display: inline; +.imagegallery-listentry .card-title { + font-size: larger; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } /***** Single View CSS *****/ -.caption { - font-style: italic; +.imagegallery-single-body .col { + padding: 10px 15px; } -#singleimage img { - width: 700px; +.imagegallery-single img.list_picture { + max-width: 100%; height: auto; } + +/***** Add entry CSS *****/ + +.imagegallery-addentry .form-group label, +.imagegallery-asearch .form-group label { + font-weight: bold; + padding-top: 20px; +} diff --git a/mod/data/preset/imagegallery/jstemplate.js b/mod/data/preset/imagegallery/jstemplate.js index 773dbaa3267..e69de29bb2d 100644 --- a/mod/data/preset/imagegallery/jstemplate.js +++ b/mod/data/preset/imagegallery/jstemplate.js @@ -1,41 +0,0 @@ -var maxHeight = 550; -var maxListHeight = 120; - -function init() { - if (document.getElementById("singleimage")) single(); - /*else if (document.getElementById("pictures")) list();*/ -} - -function list() { - imageDivs = document.getElementsByName("listimage"); - for (i=0; i < imageDivs.length; i++) { - currentHeight = imageDivs[i].offsetHeight; - currentWidth = imageDivs[i].offsetWidth; - - if (currentHeight > maxListHeight) { - ratio = maxListHeight / currentHeight; - imageDivs[i].style.width = (currentWidth*ratio) + 'px'; - imageDivs[i].style.height = (currentHeight*ratio) + 'px'; - imageDivs[i].firstChild.style.height = '100%'; - imageDivs[i].firstChild.style.width = '100%'; - } - } -} - -function single() { - var imageDiv = document.getElementById("singleimage"); - - if (imageDiv) { - currentHeight = imageDiv.offsetHeight; - currentWidth = imageDiv.offsetWidth; - - if (currentHeight > maxHeight) { - ratio = maxHeight / currentHeight; - imageDiv.style.width = (currentWidth*ratio) + 'px'; - imageDiv.style.height = (currentHeight*ratio) + 'px'; - - } - } -} - -window.onload = init; \ No newline at end of file diff --git a/mod/data/preset/imagegallery/listtemplate.html b/mod/data/preset/imagegallery/listtemplate.html index 2dafacc3a4f..add132c7187 100644 --- a/mod/data/preset/imagegallery/listtemplate.html +++ b/mod/data/preset/imagegallery/listtemplate.html @@ -1,8 +1,16 @@ -
-
- - - -
[[image]]
##more## ##edit## ##delete## ##approve## ##export##
-
+
+
+
+ [[image]] +
+
+
+ [[title]] + +
+
+ +
+
+
diff --git a/mod/data/preset/imagegallery/listtemplatefooter.html b/mod/data/preset/imagegallery/listtemplatefooter.html index 3945442acea..04f5b844997 100644 --- a/mod/data/preset/imagegallery/listtemplatefooter.html +++ b/mod/data/preset/imagegallery/listtemplatefooter.html @@ -1 +1 @@ -
\ No newline at end of file + diff --git a/mod/data/preset/imagegallery/listtemplateheader.html b/mod/data/preset/imagegallery/listtemplateheader.html index 4d9dbaee053..27de1da672c 100644 --- a/mod/data/preset/imagegallery/listtemplateheader.html +++ b/mod/data/preset/imagegallery/listtemplateheader.html @@ -1,2 +1 @@ -
-
\ No newline at end of file +
diff --git a/mod/data/preset/imagegallery/preset.xml b/mod/data/preset/imagegallery/preset.xml index 201650992b9..9c6da505bbc 100644 --- a/mod/data/preset/imagegallery/preset.xml +++ b/mod/data/preset/imagegallery/preset.xml @@ -21,10 +21,10 @@ picture image -100% -100% + + 2097152 -120 + @@ -33,8 +33,13 @@ -text -caption +textarea +description +0 +60 +10 +1 +0 - \ No newline at end of file + diff --git a/mod/data/preset/imagegallery/rsstemplate.html b/mod/data/preset/imagegallery/rsstemplate.html index 4ad64efd0e7..18e25db10ee 100644 --- a/mod/data/preset/imagegallery/rsstemplate.html +++ b/mod/data/preset/imagegallery/rsstemplate.html @@ -1,7 +1,13 @@ -
- - - - -

[[title]]

[[image]]
[[caption]]
-
\ No newline at end of file +
+
+

[[title]]

+
+
+
+
[[image]]
+
+
+
[[description]]
+
+
+
diff --git a/mod/data/preset/imagegallery/rsstitletemplate.html b/mod/data/preset/imagegallery/rsstitletemplate.html index 50d369263ca..defb72d2491 100644 --- a/mod/data/preset/imagegallery/rsstitletemplate.html +++ b/mod/data/preset/imagegallery/rsstitletemplate.html @@ -1 +1 @@ -[[title]] \ No newline at end of file +[[title]] diff --git a/mod/data/preset/imagegallery/singletemplate.html b/mod/data/preset/imagegallery/singletemplate.html index 7acb2aac1f0..f63601e5825 100644 --- a/mod/data/preset/imagegallery/singletemplate.html +++ b/mod/data/preset/imagegallery/singletemplate.html @@ -1,8 +1,26 @@ -
- - - - - -

[[title]]

[[image]]
[[caption]]
##edit## ##delete## ##approve## ##export##
+
+
+

[[title]]

+
##actionsmenu##
+
+
+
+
Author
+
##userpicture## ##user##
+
+
+
Date added
+
##timeadded##
+
+
+
Date modified
+
##timemodified##
+
+
+
[[image]]
+
+
+
[[description]]
+
+
diff --git a/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature b/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature new file mode 100644 index 00000000000..a050dca2194 --- /dev/null +++ b/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature @@ -0,0 +1,92 @@ +@mod @mod_data @datapreset @data_preset_imagegallery +Feature: Users can use the Image gallery preset + In order to create an Image gallery database + As a user + I need to apply and use the Image gallery preset + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | student1 | Alice | Student | student1@example.com | + | teacher1 | Pau | Teacher | teacher1@example.com | + And the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + And the following "activities" exist: + | activity | name | intro | course | idnumber | + | data | Mountain landscapes | Database intro | C1 | data1 | + And I am on the "Mountain landscapes" "data activity" page logged in as teacher1 + And I follow "Presets" + And I click on "fullname" "radio" in the "Image gallery" "table_row" + And I click on "Use preset" "button" + And I click on "Continue" "button" + And I click on "Continue" "button" + And the following "mod_data > entries" exist: + | database | user | title | description | image | + | data1 | student1 | First image | This is the description text for image 1 | first.png | + | data1 | teacher1 | Second image | And this is the description text for image 2 | second.png | + + @javascript + Scenario: Users view entries + When I am on the "Mountain landscapes" "data activity" page logged in as student1 + Then I should see "First image" + And I should not see "This is the description text for image 1" + And I should not see "first.png" + And I should not see "Alice Student" in the "#imagegallery-list" "css_element" + And "//a/child::img[contains(@src, 'first.png')]" "xpath_element" should exist + And "Actions" "icon" should exist in the "#imagegallery-list" "css_element" + And I should see "Second image" + And I should not see "And this is the description text for image 2" + And I should not see "second.png" + And I should not see "Pau Teacher" + And "//a/child::img[contains(@src, 'second.png')]" "xpath_element" should exist + # Single view. + And I select "Single view" from the "jump" singleselect + And I should see "First image" + And I should see "Alice Student" in the ".imagegallery-single" "css_element" + And I should see "This is the description text for image 1" + And "//a/child::img[contains(@src, 'first.png')]" "xpath_element" should exist + And "Actions" "icon" should exist in the ".imagegallery-single" "css_element" + And I should not see "Second image" + And I should not see "And this is the description text for image 2" + And I should not see "Pau Teacher" + And "//a/child::img[contains(@src, 'second.png')]" "xpath_element" should not exist + And I follow "Next" + And I should see "Second image" + And I should see "Pau Teacher" + And I should see "And this is the description text for image 2" + And "//a/child::img[contains(@src, 'second.png')]" "xpath_element" should exist + # This student can't edit or delete this entry, so the Actions menu shouldn't be displayed. + And "Actions" "icon" should not exist in the ".imagegallery-single" "css_element" + And I should not see "First image" + And I should not see "Alice Student" in the ".imagegallery-single" "css_element" + And I should not see "This is the description text for image 1" + And "//a/child::img[contains(@src, 'first.png')]" "xpath_element" should not exist + + @javascript + Scenario: Users can search entries + Given I am on the "Mountain landscapes" "data activity" page logged in as student1 + And "First image" "text" should appear before "Second image" "text" + When I click on "Advanced search" "checkbox" + And I set the field "title" to "First image" + And I press "Save settings" + Then I should see "First image" + And I should not see "Second image" + But I set the field "title" to "image" + And I set the field "Order" to "Descending" + And I press "Save settings" + And "Second image" "text" should appear before "First image" "text" + + @javascript + Scenario: Users can add entries + Given I am on the "Mountain landscapes" "data activity" page logged in as student1 + When I press "Add entry" + And I set the field "title" to "New image" + And I set the field "description" to "This is the description for the new image." + And I press "Save" + Then I should see "New image" + And I should see "This is the description for the new image."