You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2022/05/17 16:52:56 UTC

[solr] branch branch_9_0 updated: Ref guide overall versioning improvement (#859)

This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch branch_9_0
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9_0 by this push:
     new e4225d27fb8 Ref guide overall versioning improvement (#859)
e4225d27fb8 is described below

commit e4225d27fb8611fc7fb013bbc007032ad6fe45ae
Author: Houston Putman <ho...@apache.org>
AuthorDate: Tue May 17 12:44:46 2022 -0400

    Ref guide overall versioning improvement (#859)
    
    - Moved the version selector up to the title.
    - Added a perma-link button to get the permanent link for a page.
    - Made the page-version selector orange, to make it more visible.
    - Changed location of default ui-bundle to use new jenkins managed file
    
    (cherry picked from commit 33339a29485c6f65647853efa5c71e62a2f876f1)
---
 NOTICE.txt                                         |  4 ++
 solr/solr-ref-guide/playbook.template.yml          |  2 +-
 solr/solr-ref-guide/ui-src/css/nav.css             | 30 +++++++--
 solr/solr-ref-guide/ui-src/css/page-versions.css   | 59 ++++++++++++++++++
 solr/solr-ref-guide/ui-src/css/perma-link.css      | 71 ++++++++++++++++++++++
 solr/solr-ref-guide/ui-src/css/site.css            |  1 +
 solr/solr-ref-guide/ui-src/img/link-24.svg         |  4 ++
 .../solr-ref-guide/ui-src/js/07-copy-perma-link.js | 51 ++++++++++++++++
 solr/solr-ref-guide/ui-src/partials/nav-menu.hbs   | 13 ++++
 solr/solr-ref-guide/ui-src/partials/nav.hbs        | 10 +--
 solr/solr-ref-guide/ui-src/partials/perma-link.hbs |  3 +
 solr/solr-ref-guide/ui-src/partials/toolbar.hbs    | 16 +++++
 12 files changed, 252 insertions(+), 12 deletions(-)

diff --git a/NOTICE.txt b/NOTICE.txt
index 03d1566881d..a366d0aaf36 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -55,6 +55,10 @@ Copyright (c) 2013 Randy McLaughlin, MIT-license, https://github.com/randymized/
 This product includes fugue icons created by Yusuke Kamiyamane
 Copyright (C) 2013-2014 Yusuke Kamiyamane, https://github.com/yusukekamiyamane/fugue-icons
 
+This product includes octicons: https://github.com/primer/octicons
+License: MIT
+Copyright (c) 2022 GitHub Inc.
+
 Jackcess: http://jackcess.sourceforge.net/
 Copyright (C) 2011-2014 James Ahlborn
 
diff --git a/solr/solr-ref-guide/playbook.template.yml b/solr/solr-ref-guide/playbook.template.yml
index 589bc219f70..bf750a24c3f 100644
--- a/solr/solr-ref-guide/playbook.template.yml
+++ b/solr/solr-ref-guide/playbook.template.yml
@@ -36,7 +36,7 @@ content:
 
 ui:
   bundle:
-    url: 'https://nightlies.apache.org/solr/draft-guides/ui-bundle.zip'
+    url: 'https://nightlies.apache.org/solr/solr-reference-guide-ui-bundle/ui-bundle.zip'
     snapshot: true
   supplemental_files: '${supplemental_files}'
 output:
diff --git a/solr/solr-ref-guide/ui-src/css/nav.css b/solr/solr-ref-guide/ui-src/css/nav.css
index a3b6c3d33f0..02f674ddd07 100644
--- a/solr/solr-ref-guide/ui-src/css/nav.css
+++ b/solr/solr-ref-guide/ui-src/css/nav.css
@@ -70,7 +70,9 @@ html.is-clipped--nav {
   opacity: 0.75;
 }
 
-.nav-panel-menu:not(.is-active)::after {
+/* Solr Changes - Start */
+.nav-panel-menu:not(.is-active) .nav-menu::after {
+  /* Solr Changes - End */
   content: "";
   background: rgba(0, 0, 0, 0.5);
   display: block;
@@ -83,7 +85,9 @@ html.is-clipped--nav {
 
 .nav-menu {
   min-height: 100%;
-  padding: 0.5rem 0.75rem;
+  /* Solr Changes - Start */
+  padding: 0.01rem 0.75rem;
+  /* Solr Changes - End */
   line-height: var(--nav-line-height);
   position: relative;
 }
@@ -106,7 +110,7 @@ html.is-clipped--nav {
 }
 
 .nav-menu > ul.nav-list {
-  padding-top: 20px;
+  padding-top: 0;
 }
 /* Solr Changes - End */
 
@@ -164,22 +168,36 @@ html.is-clipped--nav {
   background: var(--nav-background);
   display: flex;
   flex-direction: column;
-  position: absolute;
-  top: 0;
+  /* Solr Changes - Start */
+  position: sticky;
+  top: var(--navbar-height);
+  /* Solr Changes - End */
   right: 0;
+  /* Solr Removals - Start
   bottom: 0;
+  Solr Removals - End */
+  /* Solr Additions - Start */
+  z-index: 2;
+  /* Solr Additions - End */
   left: 0;
 }
 
 .nav-panel-explore:not(:first-child) {
   top: auto;
-  max-height: var(--nav-panel-explore-height);
+  /* Solr Changes - Start */
+  max-height: 100%;
+  /* Solr Changes - End */
 }
 
 .nav-panel-explore .context {
   font-size: calc(15 / var(--rem-base) * 1rem);
   flex-shrink: 0;
+  /* Solr Removals - Start
   color: var(--nav-muted-color);
+   Solr Removals - End */
+  /* Solr Additions - Start */
+  font-weight: var(--body-font-weight-bold);
+  /* Solr Additions - End */
   box-shadow: 0 -1px 0 var(--nav-panel-divider-color);
   padding: 0 0.5rem;
   display: flex;
diff --git a/solr/solr-ref-guide/ui-src/css/page-versions.css b/solr/solr-ref-guide/ui-src/css/page-versions.css
new file mode 100644
index 00000000000..b5a458f022d
--- /dev/null
+++ b/solr/solr-ref-guide/ui-src/css/page-versions.css
@@ -0,0 +1,59 @@
+.page-versions {
+  margin: 0 0.2rem 0 auto;
+  position: relative;
+  line-height: 1;
+}
+
+@media screen and (min-width: 1024px) {
+  .page-versions {
+    margin-right: 0.7rem;
+  }
+}
+
+.page-versions .version-menu-toggle {
+  /* Solr Changes - Start */
+  font-weight: var(--body-font-weight-bold);
+  color: var(--color-solr-primary-orange);
+  /* Solr Changes - End */
+  background: url(../img/chevron.svg) no-repeat;
+  background-position: right 0.5rem top 50%;
+  background-size: auto 0.75em;
+  border: none;
+  outline: none;
+  line-height: inherit;
+  padding: 0.5rem 1.5rem 0.5rem 0.5rem;
+  position: relative;
+  z-index: var(--z-index-page-version-menu);
+}
+
+.page-versions .version-menu {
+  display: flex;
+  min-width: 100%;
+  flex-direction: column;
+  align-items: flex-end;
+  background: linear-gradient(to bottom, var(--page-version-menu-background) 0%, var(--page-version-menu-background) 100%) no-repeat;
+  padding: 1.375rem 1.5rem 0.5rem 0.5rem;
+  position: absolute;
+  top: 0;
+  right: 0;
+  white-space: nowrap;
+}
+
+.page-versions:not(.is-active) .version-menu {
+  display: none;
+}
+
+.page-versions .version {
+  display: block;
+  padding-top: 0.5rem;
+}
+
+.page-versions .version.is-current {
+  display: none;
+}
+
+.page-versions .version.is-missing {
+  color: var(--page-version-missing-font-color);
+  font-style: italic;
+  text-decoration: none;
+}
diff --git a/solr/solr-ref-guide/ui-src/css/perma-link.css b/solr/solr-ref-guide/ui-src/css/perma-link.css
new file mode 100644
index 00000000000..a6c7d84478e
--- /dev/null
+++ b/solr/solr-ref-guide/ui-src/css/perma-link.css
@@ -0,0 +1,71 @@
+/* Solr New File */
+
+.perma-link-copy {
+  height: 75%;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  margin-right: 0.7rem;
+}
+
+.perma-link-copy .copy-button {
+  height: 100%;
+  display: flex;
+  background-color: inherit;
+  align-items: center;
+  justify-content: center;
+  border: 1px solid rgba(0, 0, 0, 0);
+}
+
+.perma-link-copy .copy-button:hover {
+  border-color: rgba(0, 0, 0, 0.3);
+}
+
+.perma-link-copy .perma-link {
+  height: 100%;
+}
+
+.perma-link-copy .copy-button .copy-toast {
+  flex: none;
+  position: absolute;
+  top: 75%;
+  display: inline-flex;
+  justify-content: center;
+  margin-top: 1em;
+  background-color: var(--doc-font-color);
+  border-radius: 0.25em;
+  padding: 0.5em;
+  color: var(--color-white);
+  cursor: auto;
+  opacity: 0;
+  transition: opacity 1s ease 0.75s;
+  pointer-events: none;
+}
+
+.perma-link-copy .copy-button .copy-toast::after {
+  content: "";
+  position: absolute;
+  top: 0;
+  width: 1em;
+  height: 1em;
+  border: 0.55em solid transparent;
+  border-left-color: var(--doc-font-color);
+  transform: rotate(-90deg) translateX(50%) translateY(50%);
+  transform-origin: left;
+}
+
+.perma-link-copy .copy-button.clicked .copy-toast {
+  opacity: 1;
+  transition: none;
+}
+
+.perma-link-copy .copy-button .button-label {
+  margin: 0 0.3rem;
+  opacity: 0.6;
+}
+
+.perma-link-copy .copy-button .copy-icon {
+  height: 60%;
+  margin: 0 0.2rem 0 0;
+  opacity: 0.6;
+}
diff --git a/solr/solr-ref-guide/ui-src/css/site.css b/solr/solr-ref-guide/ui-src/css/site.css
index f8468bb2511..e345927857d 100644
--- a/solr/solr-ref-guide/ui-src/css/site.css
+++ b/solr/solr-ref-guide/ui-src/css/site.css
@@ -1,6 +1,7 @@
 /* Solr Changes - Start */
 @import "typeface-noto-sans.css";
 @import "typeface-inconsolata.css";
+@import "perma-link.css";
 /* Solr Changes - End */
 @import "vars.css";
 @import "base.css";
diff --git a/solr/solr-ref-guide/ui-src/img/link-24.svg b/solr/solr-ref-guide/ui-src/img/link-24.svg
new file mode 100644
index 00000000000..fa9e7605217
--- /dev/null
+++ b/solr/solr-ref-guide/ui-src/img/link-24.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <path d="M14.78 3.653a3.936 3.936 0 115.567 5.567l-3.627 3.627a3.936 3.936 0 01-5.88-.353.75.75 0 00-1.18.928 5.436 5.436 0 008.12.486l3.628-3.628a5.436 5.436 0 10-7.688-7.688l-3 3a.75.75 0 001.06 1.061l3-3z"/>
+    <path d="M7.28 11.153a3.936 3.936 0 015.88.353.75.75 0 001.18-.928 5.436 5.436 0 00-8.12-.486L2.592 13.72a5.436 5.436 0 107.688 7.688l3-3a.75.75 0 10-1.06-1.06l-3 3a3.936 3.936 0 01-5.567-5.568l3.627-3.627z"/>
+</svg>
\ No newline at end of file
diff --git a/solr/solr-ref-guide/ui-src/js/07-copy-perma-link.js b/solr/solr-ref-guide/ui-src/js/07-copy-perma-link.js
new file mode 100644
index 00000000000..9c36d72788f
--- /dev/null
+++ b/solr/solr-ref-guide/ui-src/js/07-copy-perma-link.js
@@ -0,0 +1,51 @@
+;(function () {
+  'use strict'
+
+  var TRAILING_SPACE_RX = / +$/gm
+  var config = (document.getElementById('site-script') || { dataset: {} }).dataset
+
+  ;[].slice.call(document.querySelectorAll('span.perma-link-copy')).forEach(function (span) {
+    var link, copy, toast, permaLinkText, toolbox
+    link = window.location.href.replace('/latest/', '/' + span.getAttribute('version') + '/')
+    ;(toolbox = document.createElement('div')).className = 'perma-link'
+    if (window.navigator.clipboard) {
+      ;(copy = document.createElement('button')).className = 'copy-button'
+      copy.setAttribute('title', 'Copy Link for Version')
+      ;(permaLinkText = document.createElement('span')).className = 'button-label'
+      permaLinkText.appendChild(document.createTextNode('Permalink'))
+      copy.appendChild(permaLinkText)
+      if (config.svgAs === 'svg') {
+        var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
+        svg.setAttribute('class', 'copy-icon')
+        var use = document.createElementNS('http://www.w3.org/2000/svg', 'use')
+        use.setAttribute('href', window.uiRootPath + '/img/link-24.svg#icon-clippy')
+        svg.appendChild(use)
+        copy.appendChild(svg)
+      } else {
+        var img = document.createElement('img')
+        img.src = window.uiRootPath + '/img/link-24.svg#view-clippy'
+        img.alt = 'copy icon'
+        img.className = 'copy-icon'
+        copy.appendChild(img)
+      }
+      ;(toast = document.createElement('span')).className = 'copy-toast'
+      toast.appendChild(document.createTextNode('Copied!'))
+      copy.appendChild(toast)
+      toolbox.appendChild(copy)
+    }
+    span.appendChild(toolbox)
+    if (copy) copy.addEventListener('click', writeToClipboard.bind(copy, link))
+  })
+
+  function writeToClipboard (link) {
+    var text = link.replace(TRAILING_SPACE_RX, '')
+    window.navigator.clipboard.writeText(text).then(
+      function () {
+        this.classList.add('clicked')
+        this.offsetHeight // eslint-disable-line no-unused-expressions
+        this.classList.remove('clicked')
+      }.bind(this),
+      function () {}
+    )
+  }
+})()
diff --git a/solr/solr-ref-guide/ui-src/partials/nav-menu.hbs b/solr/solr-ref-guide/ui-src/partials/nav-menu.hbs
new file mode 100644
index 00000000000..ad7953ffb0c
--- /dev/null
+++ b/solr/solr-ref-guide/ui-src/partials/nav-menu.hbs
@@ -0,0 +1,13 @@
+
+{{#with page.navigation}}
+<div class="nav-panel-menu is-active" data-panel="menu">
+  <nav class="nav-menu">
+    {{#with @root.page.componentVersion}}
+    <!-- Solr Removals - Start
+    <h3 class="title"><a href="{{{relativize ./url}}}">{{./title}}</a></h3>
+         Solr Removals - End -->
+    {{/with}}
+{{> nav-tree navigation=this}}
+  </nav>
+</div>
+{{/with}}
diff --git a/solr/solr-ref-guide/ui-src/partials/nav.hbs b/solr/solr-ref-guide/ui-src/partials/nav.hbs
index 8d323442fa7..6bd1c1b7062 100644
--- a/solr/solr-ref-guide/ui-src/partials/nav.hbs
+++ b/solr/solr-ref-guide/ui-src/partials/nav.hbs
@@ -1,10 +1,10 @@
 <div class="nav-container"{{#if page.component}} data-component="{{page.component.name}}" data-version="{{page.version}}"{{/if}}>
-  <!-- Solr Changes - Start (change 'aside' -> 'nav') -->
-  <nav class="nav">
+  <aside class="nav">
     <div class="panels">
-{{> nav-menu}}
+<!-- Solr Changes - Start -->
 {{> nav-explore}}
+{{> nav-menu}}
+<!-- Solr Changes - End -->
     </div>
-  </nav>
-  <!-- Solr Changes - End -->
+  </aside>
 </div>
diff --git a/solr/solr-ref-guide/ui-src/partials/perma-link.hbs b/solr/solr-ref-guide/ui-src/partials/perma-link.hbs
new file mode 100644
index 00000000000..563667ecec6
--- /dev/null
+++ b/solr/solr-ref-guide/ui-src/partials/perma-link.hbs
@@ -0,0 +1,3 @@
+<!-- Solr New File -->
+<span class="perma-link-copy" version="{{page.version}}">
+</span>
\ No newline at end of file
diff --git a/solr/solr-ref-guide/ui-src/partials/toolbar.hbs b/solr/solr-ref-guide/ui-src/partials/toolbar.hbs
new file mode 100644
index 00000000000..97308180e32
--- /dev/null
+++ b/solr/solr-ref-guide/ui-src/partials/toolbar.hbs
@@ -0,0 +1,16 @@
+<div class="toolbar" role="navigation">
+{{> nav-toggle}}
+  {{#with site.homeUrl}}
+  <a href="{{{relativize this}}}" class="home-link{{#if @root.page.home}} is-current{{/if}}"></a>
+  {{/with}}
+{{> breadcrumbs}}
+{{> page-versions}}
+<!-- Solr Additions - Start -->
+{{> perma-link}}
+<!-- Solr Additions - End -->
+  {{#if (and page.fileUri (not env.CI))}}
+  <div class="edit-this-page"><a href="{{page.fileUri}}">Edit this Page</a></div>
+  {{else if (and page.editUrl (or env.FORCE_SHOW_EDIT_PAGE_LINK (not page.origin.private)))}}
+  <div class="edit-this-page"><a href="{{page.editUrl}}">Edit this Page</a></div>
+  {{/if}}
+</div>