footer with phorkie homepage link
[phorkie.git] / data / templates / edit-file.htm
index b0a4848..a1993c5 100644 (file)
@@ -1,31 +1,37 @@
  <div class="well filegroup" id="filegroup{{fileid}}">
   <div class="row-fluid">
    <div class="span6">
-    <label for="filename_1">Filename</label>
     <input type="hidden" name="files[{{fileid}}][original_name]" value="{{file.getFilename}}"/>
-    <input type="text" name="files[{{fileid}}][name]" id="filename_{{fileid}}" value="{{file.getFilename}}"/>
+    <input type="text" name="files[{{fileid}}][name]" id="filename_{{fileid}}" value="{{file.getFilename}}" placeholder="Filename (optional)" class="filename" onchange="filenameChange(this, {{fileid}})" onkeyup="filenameChange(this, {{fileid}})"/>
    </div>
-   <div class="span6" style="text-align: right">
-    <label for="type_{{fileid}}">Type</label>
-    <!-- fixme: preselect -->
+   <div class="span6 typeselect" style="text-align: right" id="typeselect_{{fileid}}">
+    <label for="type_{{fileid}}" class="inline">Type</label>
     <select name="files[{{fileid}}][type]" id="type_{{fileid}}">
      {{htmlhelper.getLanguageOptions(file)|raw}}
     </select>
    </div>
+   <div class="span6" style="display:none; text-align: right" id="typetext_{{fileid}}">
+    <p class="muted">Type determined from filename</p>
+   </div>
   </div>
+  {% if not file or file.isText %}
   <textarea name="files[{{fileid}}][content]" id="content_{{fileid}}" cols="80" rows="15" class="content">{{file.getContent}}</textarea>
+  {% else %}
+  <p style="text-align: center">
+   Binary files cannot be edited.
+  </p>
+  {% endif %}
   <div class="row-fluid">
    <div class="span9">
-    &nbsp;
-    <!--
-    <label for="upload_{{fileid}}" class="inline">Replace with file upload:</label>
+    <label for="upload_{{fileid}}" class="inline">Replace with upload:</label>
     <input type="file" name="files[{{fileid}}][upload]" id="upload_{{fileid}}" class="btn"/>
-    -->
    </div>
+   {% if not newfile %}
    <div class="span3" style="text-align: right">
     <input type="checkbox" name="files[{{fileid}}][delete]" value="1" id="delete_{{fileid}}"/>
     <label for="delete_{{fileid}}" class="inline">delete file</label>
    </div>
+   {% endif %}
   </div>
  </div>