//-/////////////////////////////////////////////////////////////////////////////
//-                                                                           //
//-               This file is part of the Buildbotics firmware.              //
//-                                                                           //
//-      Copyright (c) 2015 - 2021, Buildbotics LLC, All rights reserved.     //
//-                                                                           //
//-       This Source describes Open Hardware and is licensed under the       //
//-                               CERN-OHL-S v2.                              //
//-                                                                           //
//-       You may redistribute and modify this Source and make products       //
//-  using it under the terms of the CERN-OHL-S v2 (https:/cern.ch/cern-ohl). //
//-         This Source is distributed WITHOUT ANY EXPRESS OR IMPLIED         //
//-  WARRANTY, INCLUDING OF MERCHANTABILITY, SATISFACTORY QUALITY AND FITNESS //
//-   FOR A PARTICULAR PURPOSE. Please see the CERN-OHL-S v2 for applicable   //
//-                                conditions.                                //
//-                                                                           //
//-              Source location: https://github.com/buildbotics              //
//-                                                                           //
//-    As per CERN-OHL-S v2 section 4, should You produce hardware based on   //
//-  these sources, You must maintain the Source Location clearly visible on  //
//-  the external case of the CNC Controller or other product you make using  //
//-                                this Source.                               //
//-                                                                           //
//-              For more information, email info@buildbotics.com             //
//-                                                                           //
//-/////////////////////////////////////////////////////////////////////////////

script#view-files-template(type="text/x-template")
  div
    nav.navbar
      nav-item
        | File
        .fa.fa-caret-down
        nav-menu
          nav-item(@click="upload")
            .fa.fa-upload
            span Upload File

          nav-item(@click="new_folder")
            .fa.fa-plus
            span New Folder

      nav-item
        | Selection
        .fa.fa-caret-down
        nav-menu
          nav-item(@click="edit", :disabled="!selected || is_dir")
            .fa.fa-pencil
            span Edit

          nav-item(@click="view", :disabled="!selected || is_dir",
            v-if="$root.webGLSupported")
            .fa.fa-eye
            span View

          nav-item(@click="download", :disabled="!selected || is_dir")
            .fa.fa-download
            span Download

          nav-item(@click="delete", :disabled="!selected")
            .fa.fa-trash
            span Delete

    a(v-el:download, :href="'/api/fs/' + selected", style="display:none",
      download, target="_blank")
    files(v-ref:files, @selected="set_selected", @activate="download",
      :locations="state.locations")
