🎉 Initial formdata support and UI tweaks

This commit is contained in:
Liyas Thomas
2020-02-05 09:20:04 +05:30
parent 6a13b8c3c5
commit f24477e7b4
4 changed files with 63 additions and 32 deletions

View File

@@ -558,7 +558,6 @@ code {
transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out;
user-select: text; user-select: text;
width: calc(100% - 8px); width: calc(100% - 8px);
min-width: 128px;
resize: vertical; resize: vertical;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -570,6 +569,17 @@ code {
} }
} }
.method {
cursor: pointer;
&:hover,
&:active,
&:focus {
box-shadow: inset 0 0 0 2px var(--fg-light-color);
transition: all 0.2s ease-in-out;
}
}
pre { pre {
display: grid; display: grid;
} }
@@ -783,21 +793,12 @@ ol li {
} }
#send { #send {
// #hidden-message {
// display: none;
// }
&.show { &.show {
display: flex; display: flex;
position: fixed; position: fixed;
top: 12px; top: 12px;
right: 12px; right: 12px;
z-index: 2; z-index: 2;
// #hidden-message {
// display: block;
// margin-left: 4px;
// }
} }
} }

View File

@@ -4,7 +4,7 @@ TODO:
--> -->
<template> <template>
<div class="collections-wrapper"> <pw-section class="yellow" :label="$t('collections')" ref="collections">
<addCollection :show="showModalAdd" @hide-modal="displayModalAdd(false)" /> <addCollection :show="showModalAdd" @hide-modal="displayModalAdd(false)" />
<editCollection <editCollection
:show="showModalEdit" :show="showModalEdit"
@@ -92,7 +92,7 @@ TODO:
<span>{{ $t("generate_docs") }}</span> <span>{{ $t("generate_docs") }}</span>
</button> </button>
</nuxt-link> </nuxt-link>
</div> </pw-section>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -113,6 +113,7 @@ import { fb } from "../../functions/fb";
export default { export default {
components: { components: {
collection, collection,
"pw-section": () => import("../section"),
addCollection: () => import("./addCollection"), addCollection: () => import("./addCollection"),
addFolder: () => import("./addFolder"), addFolder: () => import("./addFolder"),
editCollection: () => import("./editCollection"), editCollection: () => import("./editCollection"),

View File

@@ -27,7 +27,6 @@ export default {
method: "Method", method: "Method",
path: "Path", path: "Path",
label: "Label", label: "Label",
again: "Again",
content_type: "Content Type", content_type: "Content Type",
raw_input: "Raw input", raw_input: "Raw input",
parameter_list: "Parameter List", parameter_list: "Parameter List",

View File

@@ -219,7 +219,6 @@
ref="sendButton" ref="sendButton"
> >
{{ $t("send") }} {{ $t("send") }}
<!-- <span id="hidden-message">{{ $t("again") }}</span> -->
<span> <span>
<i class="material-icons">send</i> <i class="material-icons">send</i>
</span> </span>
@@ -252,13 +251,29 @@
</pw-toggle> </pw-toggle>
</span> </span>
<div> <div>
<label for="attachment">
<button
class="icon"
@click="$refs.attachment.click()"
v-tooltip="$t('upload_file')"
>
<i class="material-icons">attach_file</i>
<span>{{ file_choosen || "No file choosen" }}</span>
</button>
</label>
<input
ref="attachment"
name="attachment"
type="file"
@change="uploadAttachment"
/>
<label for="payload"> <label for="payload">
<button <button
class="icon" class="icon"
@click="$refs.payload.click()" @click="$refs.payload.click()"
v-tooltip="$t('upload_file')" v-tooltip="$t('import_json')"
> >
<i class="material-icons">attach_file</i> <i class="material-icons">post_add</i>
</button> </button>
</label> </label>
<input <input
@@ -381,10 +396,10 @@
content: isHidden ? $t('show_code') : $t('hide_code') content: isHidden ? $t('show_code') : $t('hide_code')
}" }"
> >
<i class="material-icons">flash_on</i> <i class="material-icons">code</i>
</button> </button>
<button <button
:class="'icon' + (showPreRequestScript ? ' info-response' : '')" class="icon"
id="preRequestScriptButton" id="preRequestScriptButton"
v-tooltip.bottom="{ v-tooltip.bottom="{
content: !showPreRequestScript content: !showPreRequestScript
@@ -397,14 +412,15 @@
class="material-icons" class="material-icons"
:class="showPreRequestScript" :class="showPreRequestScript"
v-if="!showPreRequestScript" v-if="!showPreRequestScript"
>code</i
>
<i class="material-icons" :class="showPreRequestScript" v-else
>close</i
> >
playlist_add
</i>
<i class="material-icons" :class="showPreRequestScript" v-else>
close
</i>
</button> </button>
<button <button
:class="'icon' + (testsEnabled ? ' info-response' : '')" class="icon"
id="preRequestScriptButto" id="preRequestScriptButto"
v-tooltip.bottom="{ v-tooltip.bottom="{
content: !testsEnabled ? 'Enable Tests' : 'Disable Tests' content: !testsEnabled ? 'Enable Tests' : 'Disable Tests'
@@ -416,7 +432,7 @@
:class="testsEnabled" :class="testsEnabled"
v-if="!testsEnabled" v-if="!testsEnabled"
> >
assignment_turned_in playlist_add_check
</i> </i>
<i class="material-icons" :class="testsEnabled" v-else>close</i> <i class="material-icons" :class="testsEnabled" v-else>close</i>
</button> </button>
@@ -1044,13 +1060,7 @@
<input id="collection-tab" type="radio" name="side" /> <input id="collection-tab" type="radio" name="side" />
<label for="collection-tab">{{ $t("collections") }}</label> <label for="collection-tab">{{ $t("collections") }}</label>
<div class="tab"> <div class="tab">
<pw-section <collections />
class="yellow"
:label="$t('collections')"
ref="collections"
>
<collections />
</pw-section>
</div> </div>
<input id="sync-tab" type="radio" name="side" /> <input id="sync-tab" type="radio" name="side" />
<label for="sync-tab">{{ $t("notes") }}</label> <label for="sync-tab">{{ $t("notes") }}</label>
@@ -1606,7 +1616,8 @@ export default {
responseBodyMaxLines: 16, responseBodyMaxLines: 16,
activeSidebar: true, activeSidebar: true,
fb, fb,
customMethod: false customMethod: false,
file_choosen: null
}; };
}, },
watch: { watch: {
@@ -2797,6 +2808,25 @@ export default {
} }
this.setRouteQueryState(); this.setRouteQueryState();
}, },
uploadAttachment() {
const file = this.$refs.attachment.files[0];
if (file !== undefined && file !== null) {
const reader = new FileReader();
reader.onload = ({ target }) => {
console.log(target);
this.file_choosen = file.name;
console.log(target.result);
};
reader.readAsText(file);
this.$toast.info(this.$t("file_imported"), {
icon: "attach_file"
});
} else {
this.$toast.error(this.$t("choose_file"), {
icon: "attach_file"
});
}
},
uploadPayload() { uploadPayload() {
this.rawInput = true; this.rawInput = true;
const file = this.$refs.payload.files[0]; const file = this.$refs.payload.files[0];