git: 8624558756 - main - Activate the edit button for articles and books

From: Sergio Carlavilla Delgado <carlavilla_at_FreeBSD.org>
Date: Mon, 27 Dec 2021 21:16:02 UTC
The branch main has been updated by carlavilla:

URL: https://cgit.FreeBSD.org/doc/commit/?id=8624558756ae364a3d74877fcea2548ac455ed5a

commit 8624558756ae364a3d74877fcea2548ac455ed5a
Author:     Sergio Carlavilla Delgado <carlavilla@FreeBSD.org>
AuthorDate: 2021-12-27 21:15:30 +0000
Commit:     Sergio Carlavilla Delgado <carlavilla@FreeBSD.org>
CommitDate: 2021-12-27 21:15:50 +0000

    Activate the edit button for articles and books
---
 documentation/config/_default/config.toml          |   1 +
 .../beastie/assets/styles/documentation.scss       | 105 ++++++++-------------
 .../themes/beastie/layouts/articles/list.html      |   9 +-
 .../themes/beastie/layouts/articles/single.html    |   9 +-
 .../themes/beastie/layouts/books/list.html         |   9 +-
 .../themes/beastie/layouts/books/single.html       |   9 +-
 6 files changed, 61 insertions(+), 81 deletions(-)

diff --git a/documentation/config/_default/config.toml b/documentation/config/_default/config.toml
index 3ba167405b..17f8bb41dd 100644
--- a/documentation/config/_default/config.toml
+++ b/documentation/config/_default/config.toml
@@ -17,6 +17,7 @@ googleAnalytics = 'UA-22767463-1'
   websiteURL = "https://www.FreeBSD.org"
   description = "FreeBSD Documentation Portal"
   isOnline = true
+  editBaseUrl = "https://github.com/freebsd/freebsd-doc/edit/main/documentation/content/"
 
 [security]
   enableInlineShortcodes = false
diff --git a/documentation/themes/beastie/assets/styles/documentation.scss b/documentation/themes/beastie/assets/styles/documentation.scss
index a3860e7c8d..347fd470d6 100644
--- a/documentation/themes/beastie/assets/styles/documentation.scss
+++ b/documentation/themes/beastie/assets/styles/documentation.scss
@@ -29,7 +29,7 @@
 .articles-books-list {
   list-style: none;
   padding-left: 10px;
-  
+
   li {
 
     a {
@@ -37,7 +37,7 @@
       font-weight: bolder;
       color: var(--global-font);
     }
-    
+
     p {
       margin-top: 0px;
     }
@@ -48,7 +48,7 @@
 .main-wrapper-article {
   display: flex;
   margin-top: var(--header-height);
-  
+
   .article {
     flex-grow: 1;
     padding: var(--documentation-padding);
@@ -61,11 +61,11 @@
     padding-right: 1.5rem;
     transition: .2s ease-in-out;
   }
-  
+
   .article-toc {
     flex: 0 0 16rem;
     font-size: .75rem;
-    
+
     .article-toc-content {
       width: 16rem;
       position: sticky;
@@ -74,7 +74,7 @@
       overflow-x: hidden;
       overflow-y: auto;
       transition: .2s ease-in-out;
-      
+
       h3 {
         border-bottom: none;
       }
@@ -85,7 +85,7 @@
         overflow: auto;
         max-height: calc(90vh);
       }
-      
+
       #TableOfContents, .resources {
         ul {
           list-style: none;
@@ -106,13 +106,6 @@
                 font-weight: bolder;
               }
             }
-            
-            i {
-              &:hover {
-                font-weight: bolder;
-                font-weight: 900;
-              }
-            }
           }
         }
       }
@@ -126,12 +119,12 @@
       }
     }
   }
-  
+
   .toc-mobile {
     h3 {
       border-bottom: none;
     }
-    
+
     #TableOfContents, .resources {
       ul {
         list-style: none;
@@ -152,13 +145,7 @@
               font-weight: bolder;
             }
           }
-          
-          i {
-            &:hover {
-              font-weight: bolder;
-              font-weight: 900;
-            }
-          }
+
         }
       }
     }
@@ -168,7 +155,7 @@
 .main-wrapper-book {
   display: flex;
   margin-top: var(--header-height);
-  
+
   .book {
     flex-grow: 1;
     padding: var(--documentation-padding);
@@ -192,28 +179,28 @@
         border: 1px solid var(--lines-color);
       }
     }
-    
+
     .buttons {
       display: flex;
-      
+
       .prev, .next {
         display: flex;
         flex-direction: row;
         align-items: center;
-        
+
         i {
           padding: 1rem;
         }
       }
-      
+
       .next {
         margin-left: auto;
       }
-      
+
       .container {
         display: flex;
         flex-direction: column;
-        
+
         .direction {
           font-weight: bolder;
         }
@@ -221,12 +208,12 @@
     }
 
   }
-  
+
   .book-toc {
     flex: 0 0 16rem;
     font-size: .75rem;
     background-color: var(--global-background-color);
-    
+
     .book-toc-content {
       width: 16rem;
       position: sticky;
@@ -235,7 +222,7 @@
       overflow-x: hidden;
       overflow-y: auto;
       transition: .2s ease-in-out;
-      
+
       h3 {
         border-bottom: none;
       }
@@ -245,7 +232,7 @@
         overflow: auto;
         max-height: calc(90vh);
       }
-      
+
       #TableOfContents, .resources {
         ul {
           list-style: none;
@@ -266,13 +253,7 @@
                 font-weight: bolder;
               }
             }
-            
-            i {
-              &:hover {
-                font-weight: bolder;
-                font-weight: 900;
-              }
-            }
+
           }
         }
       }
@@ -286,19 +267,19 @@
       }
     }
   }
-  
+
   .book-menu input.toggle+label+ul {
     display:none
   }
   .book-menu input.toggle:checked+label+ul {
     display:block
   }
-  
+
   .book-menu {
     flex: 0 0 16rem;
     font-size: .75rem;
     background-color: var(--global-background-color);
-    
+
     .book-menu-content {
       width: 16rem;
       position: sticky;
@@ -313,7 +294,7 @@
         border-bottom: none;
         padding-left: .5rem;
       }
-      
+
       input.toggle + .icon::after {
         display: flex;
         align-items: center;
@@ -321,7 +302,7 @@
         text-rendering: auto;
         content: "\f105";
       }
-      
+
       input.toggle:checked + .icon::after {
         display: flex;
         align-items: center;
@@ -329,12 +310,12 @@
         text-rendering: auto;
         content: "\f107";
       }
-      
+
       #MenuContents {
         position: sticky;
         overflow: auto;
         max-height: calc(90vh);
-        
+
         ul {
           list-style: none;
           margin: 0;
@@ -343,7 +324,7 @@
 
           li {
             margin: 0;
-            
+
             label {
               display: flex;
               justify-content: space-between;
@@ -359,30 +340,30 @@
               border-left: 1px solid var(--lines-color);
               font-weight: bolder;
             }
-            
+
             ul {
               li {
                 padding-left: 10px;
-                
+
                 a {
                   font-weight: normal;
                   border-left: 3px solid var(--lines-color);
                 }
               }
-              
+
             }
-            
+
           }
         }
       }
     }
   }
-    
+
   .toc-mobile {
     h3 {
       border-bottom: none;
     }
-    
+
     #TableOfContents, .resources {
       ul {
         list-style: none;
@@ -403,13 +384,7 @@
               font-weight: bolder;
             }
           }
-          
-          i {
-            &:hover {
-              font-weight: bolder;
-              font-weight: 900;
-            }
-          }
+
         }
       }
     }
@@ -433,7 +408,7 @@ input.toggle {
   .article-toc {
     display: none;
   }
-  
+
   .book-toc {
     display: none;
   }
@@ -476,7 +451,7 @@ input.toggle {
       right: 0;
     }
   }
-  
+
 }
 
 @media (min-width: 55em) {
@@ -486,5 +461,5 @@ input.toggle {
   .book-menu-mobile {
     display: none;
   }
-  
+
 }
diff --git a/documentation/themes/beastie/layouts/articles/list.html b/documentation/themes/beastie/layouts/articles/list.html
index 94a7c88787..2954accc8b 100644
--- a/documentation/themes/beastie/layouts/articles/list.html
+++ b/documentation/themes/beastie/layouts/articles/list.html
@@ -40,13 +40,14 @@
       <h3>{{ i18n "toc" }}</h3>
       {{ .TableOfContents }}
       <hr />
-      <!--<div class="resources">
+      <div class="resources">
         <h3>{{ i18n "resources" }}</h3>
         <ul class="contents">
-          <li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>Download PDF</a></li>
-          <li><a href="#"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>Edit this page</a></li>
+          <!--<li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>{{ i18n "download-pdf" }}</a></li>-->
+          {{ $editUrl := printf "%s%s/%s" $.Site.Params.editBaseUrl $.Site.Home.Language .Page.File }}
+          <li><a href="{{ $editUrl }}" target="_blank"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>{{ i18n "edit-page" }}</a></li>
         </ul>
-      </div>-->
+      </div>
     </div>
   </aside>
 </main>
diff --git a/documentation/themes/beastie/layouts/articles/single.html b/documentation/themes/beastie/layouts/articles/single.html
index 94a7c88787..2954accc8b 100644
--- a/documentation/themes/beastie/layouts/articles/single.html
+++ b/documentation/themes/beastie/layouts/articles/single.html
@@ -40,13 +40,14 @@
       <h3>{{ i18n "toc" }}</h3>
       {{ .TableOfContents }}
       <hr />
-      <!--<div class="resources">
+      <div class="resources">
         <h3>{{ i18n "resources" }}</h3>
         <ul class="contents">
-          <li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>Download PDF</a></li>
-          <li><a href="#"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>Edit this page</a></li>
+          <!--<li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>{{ i18n "download-pdf" }}</a></li>-->
+          {{ $editUrl := printf "%s%s/%s" $.Site.Params.editBaseUrl $.Site.Home.Language .Page.File }}
+          <li><a href="{{ $editUrl }}" target="_blank"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>{{ i18n "edit-page" }}</a></li>
         </ul>
-      </div>-->
+      </div>
     </div>
   </aside>
 </main>
diff --git a/documentation/themes/beastie/layouts/books/list.html b/documentation/themes/beastie/layouts/books/list.html
index fad22d20e8..251a7a625e 100644
--- a/documentation/themes/beastie/layouts/books/list.html
+++ b/documentation/themes/beastie/layouts/books/list.html
@@ -80,13 +80,14 @@
       <h3>{{ i18n "toc" }}</h3>
       {{ .TableOfContents }}
       <hr />
-      <!--<div class="resources">
+      <div class="resources">
         <h3>{{ i18n "resources" }}</h3>
         <ul class="contents">
-          <li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>{{ i18n "download-pdf" }}</a></li>
-          <li><a href="#"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>{{ i18n "edit-page" }}</a></li>
+          <!--<li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>{{ i18n "download-pdf" }}</a></li>-->
+          {{ $editUrl := printf "%s%s/%s" $.Site.Params.editBaseUrl $.Site.Home.Language .Page.File }}
+          <li><a href="{{ $editUrl }}" target="_blank"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>{{ i18n "edit-page" }}</a></li>
         </ul>
-      </div>-->
+      </div>
     </div>
   </aside>
   <a class="to-top" href="#top">
diff --git a/documentation/themes/beastie/layouts/books/single.html b/documentation/themes/beastie/layouts/books/single.html
index fad22d20e8..251a7a625e 100644
--- a/documentation/themes/beastie/layouts/books/single.html
+++ b/documentation/themes/beastie/layouts/books/single.html
@@ -80,13 +80,14 @@
       <h3>{{ i18n "toc" }}</h3>
       {{ .TableOfContents }}
       <hr />
-      <!--<div class="resources">
+      <div class="resources">
         <h3>{{ i18n "resources" }}</h3>
         <ul class="contents">
-          <li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>{{ i18n "download-pdf" }}</a></li>
-          <li><a href="#"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>{{ i18n "edit-page" }}</a></li>
+          <!--<li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>{{ i18n "download-pdf" }}</a></li>-->
+          {{ $editUrl := printf "%s%s/%s" $.Site.Params.editBaseUrl $.Site.Home.Language .Page.File }}
+          <li><a href="{{ $editUrl }}" target="_blank"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>{{ i18n "edit-page" }}</a></li>
         </ul>
-      </div>-->
+      </div>
     </div>
   </aside>
   <a class="to-top" href="#top">