]> git.plutz.net Git - shellwiki/commitdiff
simplified code for editor help tabs
authorPaul Hänsch <paul@plutz.net>
Sat, 12 Aug 2023 10:54:20 +0000 (12:54 +0200)
committerPaul Hänsch <paul@plutz.net>
Sat, 12 Aug 2023 10:54:20 +0000 (12:54 +0200)
themes/default.css
themes/default.sh

index c4ebf6e447d4b36d30290e383b942ed0eb201024..1823d7781758e6db6227afb7e606c284faccb5fc 100644 (file)
@@ -111,59 +111,37 @@ main pre {
 
 /* === Editor === */
 
-body[id$="/[edit]"] textarea,
-body[id$="/[newpage]"] textarea {
+[id$="/[edit]"] main .pagemenu {
+  margin-bottom: 1em;
+}
+
+.tab[name=edithelp] ~ .tab.editor textarea {
   width: 100%;
   min-height: 20em; min-height: 50vh;
   font-family: monospace;
   font-size: inherit;
 }
-
-[id$="/[edit]"] main {
-  padding-top: 2.5em;
-}
-[id$="/[edit]"] input[type=radio].tab ~ div.tab.syntax,
-[id$="/[edit]"] input[type=radio].tab ~ div.tab.help,
-[id$="/[newpage]"] input[type=radio].tab ~ div.tab.syntax,
-[id$="/[newpage]"] input[type=radio].tab ~ div.tab.help {
+.tab[name=edithelp] ~ .tab.syntax,
+.tab[name=edithelp] ~ .tab.attach {
   background-color: #FFF;
   min-height: 20em; min-height: 50vh;
 }
-[id$="/[edit]"] input[type=radio].tab#edtr:checked ~ form.tab.editor,
-[id$="/[newpage]"] input[type=radio].tab#edtr:checked ~ form.tab.editor {
-  display: block;
-}
-[id$="/[edit]"] input[type=radio].tab#help:checked ~ div.tab.syntax,
-[id$="/[newpage]"] input[type=radio].tab#help:checked ~ div.tab.syntax {
-  display: block;
-}
-[id$="/[edit]"] input[type=radio].tab#himg:checked ~ div.tab.help,
-[id$="/[edit]"] input[type=radio].tab#hdoc:checked ~ div.tab.help,
-[id$="/[newpage]"] input[type=radio].tab#himg:checked ~ div.tab.help,
-[id$="/[newpage]"] input[type=radio].tab#hdoc:checked ~ div.tab.help {
-  display: block;
-}
-[id$="/[edit]"] input[type=radio].tab ~ div.tab.help .himg,
-[id$="/[edit]"] input[type=radio].tab ~ div.tab.help .hdoc,
-[id$="/[newpage]"] input[type=radio].tab ~ div.tab.help .himg,
-[id$="/[newpage]"] input[type=radio].tab ~ div.tab.help .hdoc {
-  display: none;
-}
-[id$="/[edit]"] input[type=radio].tab ~ div.tab.help,
-[id$="/[newpage]"] input[type=radio].tab ~ div.tab.help {
+
+.tab[name=edithelp] ~ .tab.attach {
   padding-top: 1em;
   padding-left: 7em;
 }
-[id$="/[edit]"] input[type=radio].tab ~ div.tab.help .himg img,
-[id$="/[newpage]"] input[type=radio].tab ~ div.tab.help .himg img {
+.tab[name=edithelp] ~ .tab.attach .aimg img {
   float: left;
   max-height: 4em;
   margin-left: -6em;
 }
-[id$="/[edit]"] input[type=radio].tab#himg:checked ~ div.tab.help .himg,
-[id$="/[newpage]"] input[type=radio].tab#himg:checked ~ div.tab.help .himg { display: block; }
-[id$="/[edit]"] input[type=radio].tab#hdoc:checked ~ div.tab.help .hdoc,
-[id$="/[newpage]"] input[type=radio].tab#hdoc:checked ~ div.tab.help .hdoc { display: block; }
+
+.tab[name=edithelp]#editor:checked ~ .tab.editor,
+.tab[name=edithelp]#syntax:checked ~ .tab.syntax,
+.tab[name=edithelp]#attach:checked ~ .tab.attach {
+  display: block;
+}
 
 
 /* === Attachments === */
index 563ea3afdbd8676a428bbb3b3fec30a57bff680e..bb85450e05f4b3d2651932d4a705e8c230894f5a 100755 (executable)
@@ -74,10 +74,9 @@ theme_editor(){
   [ "$template" ] && acl_read "$template" || template="$page"
 
   theme_page - "Editor: $title" <<-EOF
-       <input checked type=radio class=tab name=edithelp value=edtr id=edtr><label for=edtr>Editor</label>
-       <input         type=radio class=tab name=edithelp value=help id=help><label for=help>Syntax</label>
-       <input         type=radio class=tab name=edithelp value=himg id=himg><label for=himg>Images</label>
-       <input         type=radio class=tab name=edithelp value=hdoc id=hdoc><label for=hdoc>Documents</label>
+       <input checked type=radio class=tab name=edithelp value=edtr id=editor><label for=editor>Editor</label>
+       <input         type=radio class=tab name=edithelp value=help id=syntax><label for=syntax>Syntax</label>
+       <input         type=radio class=tab name=edithelp value=att  id=attach><label for=attach>Attachments</label>
        <form class="tab editor" method=POST action="$(HTML "${_BASE}${page%/}/[edit]")">
          <input type=hidden name=session_key value="${SESSION_KEY}"/>
          <textarea name=pagetext>$({ wiki_text "$page" \
@@ -86,7 +85,7 @@ theme_editor(){
          <button type=submit name=action value=cancel>Cancel</button>
        </form>
         <div class="tab syntax">$(wiki "/[wiki]/editorhelp/")</div>
-       <div class="tab help">
+       <div class="tab attach">
        $(for file in "$_EXEC/pages/${page%/:$LANGUAGE/}/#attachments"/* "$_DATA/pages/${page%/:$LANGUAGE/}/#attachments"/*; do
          [ "$file" = "$_EXEC/pages/${page%/:$LANGUAGE/}/#attachments/${file##*/}" \
                -a -f "$_DATA/pages/${page%/:$LANGUAGE/}/#attachments/${file##*/}" ] && continue
@@ -95,12 +94,12 @@ theme_editor(){
            *.[pP][nN][gG]|*.[jJ][pP][gG]|*.[jJ][pP][eE][gG]|*.[gG][iI][fF])
              [ "$page" != "${page%/:$LANGUAGE/}" ] && p=../ || p=''
              att="$(HTML "${file##*/}")"
-             printf '<p class=himg><img src="%s%s">![](%s)</p><ul class=himg><li>[%s]([attachment]/%s)</li><li>[![%s](%s)]([attachment]/%s)</li></ul>' \
+             printf '<p class=aimg><img src="%s%s">![](%s)</p><ul class=aimg><li>[%s]([attachment]/%s)</li><li>[![%s](%s)]([attachment]/%s)</li></ul>' \
                     "$p" "$att" "$att" "$att" "$att" "$att" "$att" "$att"
              ;;
            *)
              att="$(HTML "${file##*/}")"
-             printf '<p class="hdoc">[%s](%s)</p>' "$att" "$att"
+             printf '<p class="adoc">[%s](%s)</p>' "$att" "$att"
              ;;
          esac
        done)