Skip to content

Commit

Permalink
MDL-75684 mod_data: Add author name/lastname to adv search
Browse files Browse the repository at this point in the history
Add the "First name" and "Last name" fields at the beginning of the
advanced search template for all the presets.
  • Loading branch information
sarjona committed Oct 24, 2022
1 parent a8452c9 commit 09a2c6a
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 22 deletions.
4 changes: 2 additions & 2 deletions mod/data/lang/en/data.php
Expand Up @@ -40,8 +40,8 @@
$string['ascending'] = 'Ascending';
$string['asearchtemplate'] = 'Advanced search template';
$string['atmaxentry'] = 'You have entered the maximum number of entries allowed!';
$string['authorfirstname'] = 'Author first name';
$string['authorlastname'] = 'Author surname';
$string['authorfirstname'] = 'First name';
$string['authorlastname'] = 'Last name';
$string['autogenallforms'] = 'Generate all default templates';
$string['autolinkurl'] = 'Autolink the URL';
$string['availablefromdate'] = 'Available from';
Expand Down
13 changes: 11 additions & 2 deletions mod/data/preset/imagegallery/asearchtemplate.html
@@ -1,11 +1,20 @@
<div class="imagegallery-asearch container">
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3">
<div class="form-group col">
<label for="[[title#id]]">Title</label><br/>
<div class="font-weight-bold mb-2">First name</div>
##firstname##
</div>
<div class="form-group col">
<div class="font-weight-bold mb-2">Last name</div>
##lastname##
</div>

<div class="form-group col">
<div class="font-weight-bold mb-2">Title</div>
[[title]]
</div>
<div class="form-group col">
<label for="[[description#id]]">Description</label><br/>
<div class="font-weight-bold mb-2">Description</div>
[[description]]
</div>
</div>
Expand Down
Expand Up @@ -70,6 +70,8 @@ Feature: Users can use the Image gallery preset
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 should see "First name"
And I should see "Last name"
And I set the field "title" to "First image"
And I press "Save settings"
Then I should see "First image"
Expand Down
13 changes: 11 additions & 2 deletions mod/data/preset/journal/asearchtemplate.html
@@ -1,11 +1,20 @@
<div class="journal-asearch container">
<div class="row row-cols-3">
<div class="form-group col">
<label for="[[title#id]]">Title</label><br/>
<div class="font-weight-bold mb-2">First name</div>
##firstname##
</div>
<div class="form-group col">
<div class="font-weight-bold mb-2">Last name</div>
##lastname##
</div>

<div class="form-group col">
<div class="font-weight-bold mb-2">Title</div>
[[title]]
</div>
<div class="form-group col">
<label for="[[content#id]]">Content</label><br/>
<div class="font-weight-bold mb-2">Content</div>
[[content]]
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions mod/data/preset/journal/tests/behat/journal_preset.feature
Expand Up @@ -56,6 +56,8 @@ Feature: Users can use the Journal preset
Given I am on the "Student reflections" "data activity" page logged in as student1
And "Reflection created by student" "text" should appear before "Reflection created by teacher" "text"
When I click on "Advanced search" "checkbox"
And I should see "First name"
And I should see "Last name"
And I set the field "Title" to "student"
And I press "Save settings"
Then I should see "Reflection created by student"
Expand Down
17 changes: 13 additions & 4 deletions mod/data/preset/proposals/asearchtemplate.html
@@ -1,19 +1,28 @@
<div class="proposals-asearch container">
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3">
<div class="form-group col">
<label for="[[Title#id]]">Title</label><br/>
<div class="font-weight-bold mb-2">First name</div>
##firstname##
</div>
<div class="form-group col">
<div class="font-weight-bold mb-2">Last name</div>
##lastname##
</div>

<div class="form-group col">
<div class="font-weight-bold mb-2">Title</div>
[[Title]]
</div>
<div class="form-group col">
<label for="[[Status#id]]">Status</label><br/>
<div class="font-weight-bold mb-2">Status</div>
[[Status]]
</div>
<div class="form-group col">
<label for="[[Summary#id]]">Summary</label><br/>
<div class="font-weight-bold mb-2">Summary</div>
[[Summary]]
</div>
<div class="form-group col">
<label for="[[Content#id]]">Content</label><br/>
<div class="font-weight-bold mb-2">Content</div>
[[Content]]
</div>
</div>
Expand Down
Expand Up @@ -72,6 +72,8 @@ Feature: Users can use the Proposals preset
Given I am on the "Student projects" "data activity" page logged in as student1
And "Project created by student" "text" should appear before "Project created by teacher" "text"
When I click on "Advanced search" "checkbox"
And I should see "First name"
And I should see "Last name"
And I set the field "Title" to "student"
And I press "Save settings"
Then I should see "Project created by student"
Expand Down
19 changes: 14 additions & 5 deletions mod/data/preset/resources/asearchtemplate.html
@@ -1,23 +1,32 @@
<div class="resources-asearch container">
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3">
<div class="form-group col">
<label for="[[Title#id]]">Title</label><br/>
<div class="font-weight-bold mb-2">First name</div>
##firstname##
</div>
<div class="form-group col">
<div class="font-weight-bold mb-2">Last name</div>
##lastname##
</div>

<div class="form-group col">
<div class="font-weight-bold mb-2">Title</div>
[[Title]]
</div>
<div class="form-group col">
<label for="[[Author#id]]">Author</label><br/>
<div class="font-weight-bold mb-2">Author</div>
[[Author]]
</div>
<div class="form-group col">
<label for="[[Description#id]]">Description</label><br/>
<div class="font-weight-bold mb-2">Description</div>
[[Description]]
</div>
<div class="form-group col">
<label for="[[Web link#id]]">Link</label><br/>
<div class="font-weight-bold mb-2">Link</div>
[[Web link]]
</div>
<div class="form-group col">
<label for="[[Type#id]]">Type</label><br/>
<div class="font-weight-bold mb-2">Type</div>
[[Type]]
</div>
</div>
Expand Down
Expand Up @@ -74,6 +74,8 @@ Feature: Users can use the Resources preset
Given I am on the "Student resources" "data activity" page logged in as student1
And "My favourite book" "text" should appear before "My favourite podcast" "text"
When I click on "Advanced search" "checkbox"
And I should see "First name"
And I should see "Last name"
And I set the field "Title" to "book"
And I press "Save settings"
Then I should see "My favourite book"
Expand Down
8 changes: 4 additions & 4 deletions mod/data/templates/defaulttemplate_asearchtemplate.mustache
Expand Up @@ -36,24 +36,24 @@
<div class="defaulttemplate-asearch container">
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3">
<div class="form-group col">
<span class="font-weight-bold">{{#str}}authorfirstname, mod_data{{/str}}<br/></span>
<div class="font-weight-bold mb-2">{{#str}}authorfirstname, mod_data{{/str}}</div>
##firstname##
</div>
<div class="form-group col">
<span class="font-weight-bold">{{#str}}authorlastname, mod_data{{/str}}<br/></span>
<div class="font-weight-bold mb-2">{{#str}}authorlastname, mod_data{{/str}}</div>
##lastname##
</div>

{{#fields}}
<div class="form-group col">
<span class="font-weight-bold"><label for="[[{{fieldname}}#id]]">{{fieldname}}</label><br/></span>
<div class="font-weight-bold mb-2">{{fieldname}}</div>
{{fieldcontent}}
</div>
{{/fields}}

{{#tags}}
<div class="form-group col">
<span class="font-weight-bold">{{#str}}tags{{/str}}<br/></span>
<div class="font-weight-bold mb-2">{{#str}}tags{{/str}}</div>
{{.}}
</div>
{{/tags}}
Expand Down
6 changes: 3 additions & 3 deletions mod/data/tests/behat/view_entries.feature
Expand Up @@ -121,12 +121,12 @@ Feature: Users can view and search database entries
And I log out
When I am on the "Test database name" "data activity" page logged in as teacher1
And I click on "Advanced search" "checkbox"
And I set the field "Author first name" to "Bob"
And I set the field "First name" to "Bob"
And I press "Save settings"
Then I should see "Student entry 1"
And I should not see "Student entry 2"
And I set the field "Author first name" to ""
And I set the field "Author surname" to "2"
And I set the field "First name" to ""
And I set the field "Last name" to "2"
And I press "Save settings"
And I should not see "Student entry 1"
And I should see "Student entry 2"
Expand Down

0 comments on commit 09a2c6a

Please sign in to comment.