]> git.plutz.net Git - serve0/blobdiff - templates/tagger.html.sh
styling for pagination links
[serve0] / templates / tagger.html.sh
index 10e657c020d57ccd543bb0b1c4b3315bc6a6fc0e..4b1d0fe698f83e47b74366d6f328ebca38f94095 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright 2014, 2015 Paul Hänsch
+# Copyright 2014, 2015, 2016 Paul Hänsch
 #
 # This file is part of Serve0
 # 
 # You should have received a copy of the GNU Affero General Public License
 # along with Serve0  If not, see <http://www.gnu.org/licenses/>. 
 
+category_options(){
+  cat="${1}:"
+  [ "$cat" = "none:" ] && cat=''
+
+  printf %s "$taglist_set" \
+  | sed -rn 's;^('"$cat"')([^:]+)$;<option value="\1\2">\2</option>;p'
+}
+
+category_box(){
+  for cat in "$@"; do
+  cat <<EOF
+  <fieldset class="newtag">
+    <label class="category">${cat}:</label>
+    <input type="hidden" name="category" value="$cat">
+    <select name="ctag" size="12" multiple>
+      $(category_options "$cat")
+    </select>
+  </fieldset>
+EOF
+  done
+}
+
 cat <<EOF
-  <div class="panel footer" id="tagger">
-    <a class="panel tagger hide" href="#foot">Hide</a>
-    <hr>
+  <div class="panel switchable bottom" id="tagger">
     <p class="help">Add selectetd tags to selected videos.</p>
-    <p class="newtag">
-      <label class="category">None:</label>
-      <select name="ctag" size="12" multiple id="${n}_none">
-       $(echo "$taglist" |sed -rn 's;^([^:]+)$;<option value="\1">\1</option>;p')
-      </select>
-    </p>
-    $(echo "$taglist" |sed -rn 's;^([^:]+):.*$;\1;p' |sort -u |while read cat; do echo "
-    <p class=\"newtag\">
-      <label class=\"category\">${cat}:</label>
-      <input type=\"hidden\" name=\"category\" value=\"$cat\">
-      <select name=\"ctag\" size=\"12\" multiple id=\"${n}_$cat\">
-       $(echo "$taglist" |sed -rn "s;^${cat}:(.*)$;<option value=\"${cat}:\\1\">\\1</option>;p")
-      </select>
-    </p>"
-    done)
-    <p class="newtag additional">
+    $(category_box $(list_categories))
+    <fieldset class="newtag additional">
       <label class="additional">Additional Tags (one per line):</label>
       <textarea name="tags" rows="2"></textarea>
-    </p>
+    </fieldset>
     <input type="submit" value="Add Tags!">
+
+    <a class="panel toggle" href="#foot">Hide</a>
   </div>
 EOF