taggart

Simple golang tagging filesystem webapp
Log | Files | Refs

bulk-tag.html (5289B)


      1 {{template "_header" .}}
      2         <h1>{{.Title}}</h1>
      3         {{if .Data.Error}}
      4         <div class="alert alert-danger">
      5             <strong>Error:</strong> {{.Data.Error}}
      6         </div>
      7         {{end}}
      8         {{if .Data.Success}}
      9         <div class="alert alert-success">
     10             <strong>Success:</strong> {{.Data.Success}}
     11         </div>
     12         {{end}}
     13         <form method="POST">
     14             <div class="form-section">
     15                 <h3>Select Files</h3>
     16                 <div class="form-group">
     17                     <label>Selection Method:</label>
     18                     <div class="radio-group">
     19                         <label>
     20                             <input type="radio" name="selection_mode" value="range"
     21                                    {{if or (eq .Data.FormData.SelectionMode "range") (eq .Data.FormData.SelectionMode "")}}checked{{end}}
     22                                    onchange="toggleSelectionMode()">
     23                             By File ID Range
     24                         </label><br>
     25                         <label>
     26                             <input type="radio" name="selection_mode" value="tags"
     27                                    {{if eq .Data.FormData.SelectionMode "tags"}}checked{{end}}
     28                                    onchange="toggleSelectionMode()">
     29                             By Tag Query
     30                         </label>
     31                     </div>
     32                 </div>
     33 
     34                 <div id="range-selection" class="form-group">
     35                     <label for="file_range">File ID Range:</label>
     36                     <input type="text" id="file_range" name="file_range"
     37                            placeholder="e.g., 1-5,8,10-12" value="{{.Data.FormData.FileRange}}">
     38                     <div class="help-text">
     39                         Specify file IDs to tag. Use ranges (1-5) and individual IDs (8) separated by commas.
     40                     </div>
     41                 </div>
     42 
     43                 <div id="tag-selection" class="form-group" style="display: none;">
     44                     <label for="tag_query">Tag Query:</label>
     45                     <input type="text" id="tag_query" name="tag_query"
     46                            placeholder="e.g., colour:blue or colour:blue,size:large" value="{{.Data.FormData.TagQuery}}">
     47                     <div class="help-text">
     48                         <strong>Examples:</strong><br>
     49                         • <code>colour:blue</code> - Files with this exact tag<br>
     50                         • <code>colour:blue,size:large</code> - Files with BOTH tags (AND)<br>
     51                         • <code>colour:blue OR colour:red</code> - Files with EITHER tag (OR)
     52                     </div>
     53                 </div>
     54             </div>
     55 
     56             <div class="form-section">
     57                 <h3>Tag Operation</h3>
     58                 <div class="form-group">
     59                     <label for="category">Category:</label>
     60                     <input type="text" id="category" name="category" list="categories" value="{{.Data.FormData.Category}}" required>
     61                     <datalist id="categories">
     62                         {{range .Data.Categories}}
     63                         <option value="{{.}}">
     64                         {{end}}
     65                     </datalist>
     66                     <div class="help-text">Choose an existing category or create a new one.</div>
     67                 </div>
     68                 <div class="form-group">
     69                     <label for="value">Value:</label>
     70                     <input type="text" id="value" name="value" value="{{.Data.FormData.Value}}">
     71                     <div class="help-text">
     72                         The tag value to add or remove. <strong>Leave empty when removing to delete all values in the category.</strong>
     73                     </div>
     74                 </div>
     75                 <div class="form-group">
     76                     <label>Operation:</label>
     77                     <div class="radio-group">
     78                         <label>
     79                             <input type="radio" name="operation" value="add" {{if eq .Data.FormData.Operation "add"}}checked{{end}}>
     80                             Add tag to selected files
     81                         </label><br>
     82                         <label>
     83                             <input type="radio" name="operation" value="remove" {{if eq .Data.FormData.Operation "remove"}}checked{{end}}>
     84                             Remove tag(s) from selected files
     85                         </label>
     86                     </div>
     87                     <div class="help-text">
     88                         When removing: specify a value to remove just that tag, or leave value empty to remove all tags in the category.
     89                     </div>
     90                 </div>
     91             </div>
     92             <button type="submit" class="text-button">Apply Tags</button>
     93         </form>
     94 		<br>
     95 		<details><summary>Recent Files (for reference)</summary>
     96                 {{range .Data.RecentFiles}}
     97                 <div class="file-item">
     98                     <span class="file-id">ID {{.ID}}:</span> <a href="/file/{{.ID}}" title="{{.Filename}}">{{.Filename}}</a>
     99                 </div>
    100                 {{else}}
    101                 <div class="file-item">No files found</div>
    102                 {{end}}
    103 		</details>
    104     <script src="/static/bulk-tag.js" defer></script>
    105 {{template "_footer"}}