Merge branch 'MDL-63253-master-adminsearchresults' of git://github.com/mudrd8mz/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 25 Sep 2018 20:56:11 +0000 (22:56 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 25 Sep 2018 20:56:11 +0000 (22:56 +0200)
admin/templates/settings_search_results.mustache
lib/adminlib.php
theme/boost/scss/moodle/admin.scss
theme/boost/style/moodle.css
theme/boost/templates/core_admin/settings_search_results.mustache
theme/bootstrapbase/less/moodle/admin.less
theme/bootstrapbase/style/moodle.css

index 78b6205..df82b0f 100644 (file)
@@ -22,7 +22,7 @@
     Context variables required for this template:
     * actionurl - Url to post to
     * hasresults - True if there are results
-    * results - List of results containing url, title, settings (array of raw html)
+    * results - List of results containing url, title, path (array of strings), settings (array of raw html)
     * showsave - Show save buttons
 
     Example context (json):
@@ -30,7 +30,7 @@
         "actionurl": "/",
         "hasresults": true,
         "results": [
-            { "url": "/", "title": "Match!", "settings": [ "blah blah blah" ] }
+            { "url": "/", "title": "Match!", "path": ["Administration", "Match!"], "settings": [ "blah blah blah" ] }
         ]
     }
 }}
     </div>
     <fieldset>
         <div class="clearer"></div>
+        <h2 class="main">{{#str}}searchresults, admin{{/str}}</h2>
         {{#hasresults}}
             {{#results}}
-                <h2 class="main">{{#str}}searchresults, admin{{/str}} - <a href="{{url}}">{{{title}}}</a></h2>
+                <h3 class="adminpagetitle"><a href="{{url}}">{{{title}}}</a></h3>
+                <ul class="adminpagepath" aria-label="{{#str}} pagepath, core {{/str}}">
+                    {{#path}}
+                    <li>{{.}}</li>
+                    {{/path}}
+                </ul>
                 <fieldset class="adminsettings">
                     {{#settings}}
                         <div class="clearer"></div>
index 4b909cf..d6cd9ac 100644 (file)
@@ -8179,6 +8179,15 @@ function admin_search_settings_html($query) {
             continue;
         }
 
+        // Locate the page in the admin root and populate its visiblepath attribute.
+        $path = array();
+        $located = $adminroot->locate($page->name, true);
+        if ($located) {
+            foreach ($located->visiblepath as $pathitem) {
+                array_unshift($path, (string) $pathitem);
+            }
+        }
+
         $sectionsettings = [];
         if (!empty($settings)) {
             foreach ($settings as $setting) {
@@ -8198,6 +8207,7 @@ function admin_search_settings_html($query) {
 
         $tpldata->results[] = (object) [
             'title' => $heading,
+            'path' => $path,
             'url' => $headingurl->out(false),
             'settings' => $sectionsettings
         ];
index cfc4a67..4faa33e 100644 (file)
 #overriderolestable .overriddenpermission {
     @extend .table-warning;
 }
+
+#page-admin-search {
+    .adminpagetitle {
+        margin-bottom: 0;
+        border-bottom: none;
+    }
+    .adminpagepath {
+        display: flex;
+        flex-wrap: wrap;
+        list-style: none;
+        padding: 0;
+        margin: 0 0 1.5rem 0;
+        li {
+            @extend .text-muted;
+            @extend .small;
+            + li:before {
+                padding-right: 0.5rem;
+                padding-left: 0.5rem;
+                content: "#{$breadcrumb-divider}";
+            }
+        }
+    }
+}
index 1b76193..9901ec1 100644 (file)
@@ -2691,7 +2691,8 @@ hr {
   border-top: 1px solid rgba(0, 0, 0, 0.1); }
 
 small,
-.small {
+.small,
+#page-admin-search .adminpagepath li {
   font-size: 80%;
   font-weight: 400; }
 
@@ -8448,7 +8449,7 @@ a.dimmed_text:visited,
 .usersuspended a:visited,
 .dimmed_category,
 .dimmed_category a, .tag_feed .media .muted a, #page-admin-qtypes .disabled,
-#page-admin-qbehaviours .disabled, #page-admin-plugins #plugins-control-panel .pluginname .componentname, #page-admin-plugins #plugins-control-panel .version .versionnumber, #page-admin-plugins #plugins-control-panel .notes .requiredby, #plugins-check-page .page-description, #plugins-check-page #plugins-check .requires-ok, #plugins-check-page #plugins-check .displayname .plugindir, #plugins-check-page #plugins-check-available-dependencies .displayname .component, .block .minicalendar td.weekend, .section .activity .stealth, .course-content .section-summary .section-summary-activities .activity-count, .course-content ul li.section.hidden .sectionname > span,
+#page-admin-qbehaviours .disabled, #page-admin-plugins #plugins-control-panel .pluginname .componentname, #page-admin-plugins #plugins-control-panel .version .versionnumber, #page-admin-plugins #plugins-control-panel .notes .requiredby, #plugins-check-page .page-description, #plugins-check-page #plugins-check .requires-ok, #plugins-check-page #plugins-check .displayname .plugindir, #plugins-check-page #plugins-check-available-dependencies .displayname .component, #page-admin-search .adminpagepath li, .block .minicalendar td.weekend, .section .activity .stealth, .course-content .section-summary .section-summary-activities .activity-count, .course-content ul li.section.hidden .sectionname > span,
 .course-content ul li.section.hidden .content > div.summary,
 .course-content ul li.section.hidden .activity .activityinstance, #course-category-listings .listitem[data-visible="0"], #course-category-listings .listitem[data-visible="0"] > div > a, #course-category-listings .listing-pagination-totals.dimmed, .fitem.disabled .fp-btn-choose, .form-defaultinfo,
 .form-label .form-shortname, .formsettingheading .form-horizontal, .no-felement.fstatic, .path-backup .backup_progress .backup_stage {
@@ -10974,6 +10975,21 @@ div.editor_atto_toolbar button .icon {
 .modal.modal-in-page {
   z-index: 0; }
 
+#page-admin-search .adminpagetitle {
+  margin-bottom: 0;
+  border-bottom: none; }
+
+#page-admin-search .adminpagepath {
+  display: flex;
+  flex-wrap: wrap;
+  list-style: none;
+  padding: 0;
+  margin: 0 0 1.5rem 0; }
+  #page-admin-search .adminpagepath li + li:before {
+    padding-right: 0.5rem;
+    padding-left: 0.5rem;
+    content: "/"; }
+
 .blockmovetarget .accesshide {
   position: relative;
   left: initial; }
index 4ecdcd6..6653154 100644 (file)
     along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 }}
 {{!
-    Settings.
+    @template core_admin/settings_search_results
+
+    Admin setting search results template.
+
+    Context variables required for this template:
+    * actionurl - Url to post to
+    * hasresults - True if there are results
+    * results - List of results containing url, title, path (array of strings), settings (array of raw html)
+    * showsave - Show save buttons
+
+    Example context (json):
+    {
+        "actionurl": "/",
+        "hasresults": true,
+        "results": [
+            { "url": "/", "title": "Match!", "path": ["Administration", "Match!"], "settings": [ "blah blah blah" ] }
+        ]
+    }
 }}
 <form action="{{actionurl}}" method="post" id="adminsettings">
     <div>
     </div>
     <fieldset>
         <div class="clearer"></div>
+        <h2 class="main">{{#str}}searchresults, admin{{/str}}</h2>
         {{#hasresults}}
             {{#results}}
-                <h2 class="main">{{#str}}searchresults, admin{{/str}} - <a href="{{url}}">{{{title}}}</a></h2>
+                <h3 class="adminpagetitle"><a href="{{url}}">{{{title}}}</a></h3>
+                <ul class="adminpagepath" aria-label="{{#str}} pagepath, core {{/str}}">
+                    {{#path}}
+                    <li>{{.}}</li>
+                    {{/path}}
+                </ul>
                 <fieldset class="adminsettings">
                     {{#settings}}
                         <div class="clearer"></div>
index ce5e5c3..26f41d8 100644 (file)
@@ -858,3 +858,26 @@ img.iconsmall {
 #page-admin-registration-index form .mark {
     background-color: @warningBackground;
 }
+
+#page-admin-search {
+    .adminpagetitle {
+        margin-bottom: 0;
+        border-bottom: none;
+    }
+    .adminpagepath {
+        list-style: none;
+        margin: 0 0 10px 0;
+        li {
+            .muted;
+            display: inline;
+            font-size: @fontSizeSmall;
+            + li:before {
+                content: "◀\00a0";
+                /*rtl:remove*/
+                content: "▶\00a0"; /* stylelint-disable-line declaration-block-no-duplicate-properties */
+                color: #ccc;
+                font-size: @fontSizeSmall;
+            }
+        }
+    }
+}
index 7edf35a..036a994 100644 (file)
@@ -5575,6 +5575,27 @@ img.iconsmall {
 #page-admin-registration-index form .mark {
   background-color: #fcf8e3;
 }
+#page-admin-search .adminpagetitle {
+  margin-bottom: 0;
+  border-bottom: none;
+}
+#page-admin-search .adminpagepath {
+  list-style: none;
+  margin: 0 0 10px 0;
+}
+#page-admin-search .adminpagepath li {
+  color: #999;
+  display: inline;
+  font-size: 11.9px;
+}
+#page-admin-search .adminpagepath li + li:before {
+  content: "◀\00a0";
+  /*rtl:remove*/
+  content: "▶\00a0";
+  /* stylelint-disable-line declaration-block-no-duplicate-properties */
+  color: #ccc;
+  font-size: 11.9px;
+}
 /* calendar.less */
 .calendar_event_category {
   background-color: #d8bfd8;