<div class=" enablevue">
    <div class="row">
        <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2">
            <filelistcomponent fetch-files-url="http://localhost:2000/production/kitmodules/filesystem/handlers/GetDirectoryEntries.ashx?ver&#x3D;1" json='{"Settings":{"IncludeFolders":false,"LanguageId":"sv","MediaFolderReferenceId":134296,"CurrentMediaFolderReferenceId":134296,"ListHeading":"Handläggningsordning och lathund","RootVirtualPath":"/","CurrentVirtualPath":"/","Columns":["Name"],"DisplayHeadings":false,"DisplayDirectories":true,"BlockView":"List"}}'
                doc-reader-text="Öppna detta dokument med readspeaker docreader" pdf-icon="/images/icon-file-pdf-black.svg" doc-icon="/images/icon-file-doc-black.svg" ppt-icon="/images/icon-file-ppt-black.svg" xls-icon="/images/icon-file-xls-black.svg" file-icon="/images/icon-file.svg"></filelistcomponent>
            <br>
        </div>
    </div>
</div>
<div class=" enablevue">
    <div class="row">
        <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2">
            <filelistcomponent fetch-files-url="{{urlToService}}" json='{{{Settings}}}'
                doc-reader-text="{{componentTexts.docReaderText.value}}" pdf-icon="{{iconPaths.pdf}}"
                doc-icon="{{iconPaths.doc}}" ppt-icon="{{iconPaths.ppt}}" xls-icon="{{iconPaths.xls}}"
                file-icon="{{iconPaths.file}}"></filelistcomponent>
            <br>
        </div>
    </div>
</div>
{
  "iconPaths": {
    "pdf": "/images/icon-file-pdf-black.svg",
    "doc": "/images/icon-file-doc-black.svg",
    "ppt": "/images/icon-file-ppt-black.svg",
    "xls": "/images/icon-file-xls-black.svg",
    "file": "/images/icon-file.svg"
  },
  "componentTexts": {
    "sortNameText": {
      "value": "Namn"
    },
    "sortDateText": {
      "value": "Ändringsdatum"
    },
    "docReaderText": {
      "value": "Öppna detta dokument med readspeaker docreader"
    }
  },
  "epiDivClass": "col-md-12",
  "urlToService": "http://localhost:2000/production/kitmodules/filesystem/handlers/GetDirectoryEntries.ashx?ver=1",
  "Settings": "{\"Settings\":{\"IncludeFolders\":false,\"LanguageId\":\"sv\",\"MediaFolderReferenceId\":134296,\"CurrentMediaFolderReferenceId\":134296,\"ListHeading\":\"Handläggningsordning och lathund\",\"RootVirtualPath\":\"/\",\"CurrentVirtualPath\":\"/\",\"Columns\":[\"Name\"],\"DisplayHeadings\":false,\"DisplayDirectories\":true,\"BlockView\":\"List\"}}"
}
  • Content:
    Vue.component("filelistcomponent", {
      props: [
        "fetchFilesUrl",
        "json",
        "docReaderText",
        "pdfIcon",
        "docIcon",
        "pptIcon",
        "xlsIcon",
        "fileIcon"
      ],
      data() {
        return {
          loading: false,
          settings: {},
          files: [],
          pdf: this.pdfIcon,
          doc: this.docIcon,
          ppt: this.pptIcon,
          xls: this.xlsIcon,
          file: this.fileIcon,
          docRead: this.docReaderText
        };
      },
      async created() {
        await this.init(this.fetchFilesUrl, JSON.parse(this.json));
      },
      methods: {
        async init(url, settings) {
          // try {
          //   this.loading = true;
          //   const response = await axios.post(url, settings);
          //   const {Settings, Files} = response.data;
          //   if(Settings) {
          //     this.settings = Settings;
          //   }
          //   if(Files) {
          //     this.files = Files;
          //   }
          //   this.loading = false;
          //   console.log({response: response.data});
          // } catch (error) {
          //   this.loading = false;
          //   console.log(error)
          // }
          try {
            this.loading = true;
            await fetch(url, {
              method: "POST",
              headers: {
                Accept: "application/json",
                "Content-Type": "application/x-www-form-urlencoded"
              },
              body: "RequestPackageType=" + encodeURIComponent(JSON.stringify(settings))
            })
              .then(res => res.json())
              .then(response => {
                console.log("Success:", response);
                const { Settings, Files } = response;
                
                if (Settings) {
                  this.settings = Settings;
                }
                if (Files) {
                  this.files = Files;
                }
                this.loading = false;
              })
              .catch(error => {
                console.log(error);
                this.loading = false;
              });
          } catch (error) {
            console.log(error);
            this.loading = false;
          }
        }
      },
      template: `
      <div class="filebrowserblock vld-parent">
      <vloading :height="32" :width="32" :color="'#404040'" :is-full-page="false" :active.sync="loading"></vloading>
      <div class="filebrowserblock--container" v-if="files.length > 0">
          <h2 v-if="settings && settings.ListHeading" class="heading-level-2" v-html="settings.ListHeading"></h2>
          <ul class="files">
              <li v-for="(item, index) in files" :key="index">
                  <div class="d-flex flex-row">
                      <div class="files--icon">
                          <img v-if="item.Extension == 'pdf'" :src="pdf"></img>
                          <img v-else-if="item.Extension == 'doc'" :src="doc"></img>
                          <img v-else-if="item.Extension == 'ppt'" :src="ppt"></img>
                          <img v-else-if="item.Extension == 'xls'" :src="xls"></img>
                          <img v-else :src="file"></img>
                      </div>
                      <a :href="item.NavigateUrl" target="_blank" download class="files--info">
                          <p class="files--title">
                              {{item.Name}} {{item.Created}}
                          </p>
                          <p class="files--extension">
                              {{item.Extension}}
                          </p>
                      </a>
                      <a :href="'http://docreader.readspeaker.com/docreader/?cid=bqepo&lang=sv_se&url=' + item.FullUrl"
                          v-if="item.FullUrl" class="files--speaker d-flex align-items-start" :title="docRead">
                          <span class="material-icons ml-2">volume_up</span>
                      </a>
                  </div>
              </li>
          </ul>
      </div>
    </div>
      `
    });
    
  • URL: /components/raw/filebrowserblock/FileBrowserBlock.js
  • Filesystem Path: src\components\02-block_components\FileBrowserBlock\FileBrowserBlock.js
  • Size: 3.8 KB
  • Content:
    .filebrowserblock {
      width: 100%;
      margin-bottom: $md-space;
      .files--info{
        font-size: 18px;
        line-height: 132%;
        font-family: "Lato Bold";
        @include media-breakpoint-down(md) {
          font-size: 16px;
          line-height: 24px;
        }
      }
      .files--icon{
        min-width: 28px;
      }
      .files--text{
        font-size: 18px;
        line-height: 132%;
        font-family: "Lato Bold";
        @include media-breakpoint-down(md) {
          font-size: 16px;
          line-height: 24px;
        }
      }
      a{
        &.files--speaker{
          &:hover{
            opacity: 0.6;
            text-decoration: none!important;
            span{
              text-decoration: none!important;
            }
          }
        }
      }
      .filebrowserblock--container {
        width: 100%;
        .library--list {
          width: 100%;
          margin-top: 0px;
          margin: 0;
          padding-left: 0;
          margin-top: $xs-space;
          list-style: none;
          li {
            box-shadow: 0 1px 0 #e5e5e5;
            padding: $xs-space;
            padding-left: 0;
            .files--info {
              cursor: pointer;
              color: $dark-grey;
              &:hover {
                text-decoration: underline;
              }
            }
            img {
              width: 28px;
              height: 36px;
            }
          }
        }
        .folder--open {
          cursor: pointer;
        }
        .sort--bar {
          padding: $md-space 0 8px 0;
          border-bottom: 1px solid #e5e5e5;
    
          .sort--button {
            cursor: pointer;
          }
        }
        .files {
          width: 100%;
          padding-left: 0;
          margin-top: $xs-space;
          list-style: none;
          .files--speaker {
            margin-top: 2px;
            cursor: pointer;
          }
          .files--info {
            margin-left: $xs-space;
            .files--title {
              font-weight: inherit;
              font-family: "Lato Bold";
              margin-bottom: 0;
            }
            .files--extension {
              margin-bottom: 0;
            }
          }
          li {
            box-shadow: 0 1px 0 #e5e5e5;
            padding: $xs-space;
            padding-left: 0;
            .files--extension {
              text-transform: uppercase;
            }
            img {
              width: 28px;
              height: 36px;
            }
          }
        }
      }
    }
    
  • URL: /components/raw/filebrowserblock/FileBrowserBlock.scss
  • Filesystem Path: src\components\02-block_components\FileBrowserBlock\FileBrowserBlock.scss
  • Size: 2.2 KB

There are no notes for this item.