Skip to content

Commit

Permalink
Merge pull request #117 from plank/116-add-folders-to-mm-search
Browse files Browse the repository at this point in the history
116 - add folder to MM search
  • Loading branch information
rileymcmaster authored May 27, 2024
2 parents 4ccd47c + 837ac20 commit 182fa56
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 22 deletions.
51 changes: 37 additions & 14 deletions public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2679,6 +2679,19 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
name: "mmfoldercard",
props: ["item"],
Expand Down Expand Up @@ -2818,9 +2831,7 @@ __webpack_require__.r(__webpack_exports__);

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var vue2_dropzone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue2-dropzone */ "./node_modules/vue2-dropzone/dist/vue2Dropzone.js");
/* harmony import */ var vue2_dropzone__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue2_dropzone__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _mm_card_folder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mm-card-folder */ "./resources/js/components/mm-card-folder.vue");
/* harmony import */ var _mm_card_folder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mm-card-folder */ "./resources/js/components/mm-card-folder.vue");
//
//
//
Expand Down Expand Up @@ -2848,11 +2859,10 @@ __webpack_require__.r(__webpack_exports__);
//
//


/* harmony default export */ __webpack_exports__["default"] = ({
name: "mmfolders",
components: {
mmfoldercard: _mm_card_folder__WEBPACK_IMPORTED_MODULE_1__["default"]
mmfoldercard: _mm_card_folder__WEBPACK_IMPORTED_MODULE_0__["default"]
},
props: {
resetPageNumber: {
Expand All @@ -2863,7 +2873,7 @@ __webpack_require__.r(__webpack_exports__);
return {
current: null,
cardItem: null,
optionsArray1: [{
optionsArray: [{
name: this.$i18n.t("actions.delete"),
slug: "delete",
"class": "delete-class"
Expand Down Expand Up @@ -14255,6 +14265,7 @@ var render = function() {
fill: "#AAA"
}
}),
_vm._v(" "),
_c("path", {
attrs: {
d:
Expand Down Expand Up @@ -14440,7 +14451,7 @@ var render = function() {
return _c(
"div",
{
key: index,
key: item.name,
staticClass: "mm__results-single",
class: [_vm.cardItem == index ? "active" : ""],
on: {
Expand All @@ -14465,10 +14476,7 @@ var render = function() {
this.$store.state.haveContextMenu
? _c("vue-simple-context-menu", {
ref: "vueSimpleContextMenu",
attrs: {
elementId: "myUniqueId",
options: _vm.optionsArray1
},
attrs: { elementId: "myUniqueId", options: _vm.optionsArray },
on: { "option-clicked": _vm.optionClicked }
})
: _vm._e()
Expand Down Expand Up @@ -39738,9 +39746,21 @@ var actions = {

var commit = _ref9.commit;
axios__WEBPACK_IMPORTED_MODULE_1___default.a.get(this.state.routeSearchMedia + "?q=" + value.searchterm, {}).then(function (response) {
_this9.state.mediaCollection = response.data;
_this9.state.hideDirectory = true;
_this9.state.isSearch = true;
if (response.data.media) {
commit("SET_SEARCH", true);
commit("SET_MEDIA", {
media: response.data.media,
currentPage: value && value.pageNumber && value.pageNumber,
pageCount: response.data.page_count,
directory: _this9.state.currentDirectory,
lazyLoad: value && value.lazyLoad && value.lazyLoad
});
commit("SET_PAGE_COUNT", response.data.page_count);
commit("SET_MEDIATYPES", response.data.media);
_this9.state.isLoading = false;
}

commit("SET_DIRECTORY", response.data.subdirectories);
})["catch"](function (error) {
_this9.state.isSearch = false;
value.vm.$toast.open({
Expand Down Expand Up @@ -40084,6 +40104,9 @@ var mutations = {
},
SET_PAGE_COUNT: function SET_PAGE_COUNT(state, value) {
state.pageCount = value;
},
SET_SEARCH: function SET_SEARCH(state, value) {
state.isSearch = value;
}
};

Expand Down
2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/app.js": "/app.js?id=a27714cbfa3670f07e05",
"/app.js": "/app.js?id=878131eec470783367b5",
"/app.css": "/app.css?id=9b4427fd4fd916cf9da4",
"/images/icon-add.svg": "/images/icon-add.svg?id=f35ff7376a119c2d780b",
"/images/icon-arrow-back.svg": "/images/icon-arrow-back.svg?id=963a92661eaa72c7bfd3",
Expand Down
7 changes: 3 additions & 4 deletions resources/js/components/mm-folders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div v-if="this.$store.state.hideDirectory == false" class="mm__results-grid">
<div
v-for="(item, index) in getDir"
:key="index"
:key="item.name"
class="mm__results-single"
v-bind:class="[cardItem == index ? 'active' : '']"
v-on:click="showOptions(index, item)"
Expand All @@ -16,7 +16,7 @@
<vue-simple-context-menu
v-if="this.$store.state.haveContextMenu"
:elementId="'myUniqueId'"
:options="optionsArray1"
:options="optionsArray"
:ref="'vueSimpleContextMenu'"
@option-clicked="optionClicked"
/>
Expand All @@ -25,7 +25,6 @@
</template>

<script>
import { props } from 'vue2-dropzone';
import mmfoldercard from "./mm-card-folder";
export default {
Expand All @@ -40,7 +39,7 @@ export default {
return {
current: null,
cardItem: null,
optionsArray1: [
optionsArray: [
{
name: this.$i18n.t("actions.delete"),
slug: "delete",
Expand Down
20 changes: 17 additions & 3 deletions resources/js/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ export const actions = {
});
},
getDirectory({ commit }, value) {

let route;
let paramsObj = { locale: this.state.lang }

this.state.isLoading = true;
if (value && value.directory) {
this.state.currentDirectory = value.directory;
Expand All @@ -112,6 +114,7 @@ export const actions = {
if (value && value.pageNumber) {
paramsObj = {...paramsObj, page: value.pageNumber}
}

return axios.get(route, {
params: paramsObj
}).then(response => {
Expand Down Expand Up @@ -311,9 +314,20 @@ export const actions = {
axios
.get(this.state.routeSearchMedia + "?q=" + value.searchterm, {})
.then(response => {
this.state.mediaCollection = response.data;
this.state.hideDirectory = true;
this.state.isSearch = true;
if (response.data.media) {
commit("SET_SEARCH", true);
commit("SET_MEDIA", {
media: response.data.media,
currentPage: value && value.pageNumber && value.pageNumber,
pageCount: response.data.page_count,
directory: this.state.currentDirectory,
lazyLoad: value && value.lazyLoad && value.lazyLoad
});
commit("SET_PAGE_COUNT", response.data.page_count);
commit("SET_MEDIATYPES", response.data.media);
this.state.isLoading = false;
}
commit("SET_DIRECTORY", response.data.subdirectories);
})
.catch(error => {
this.state.isSearch = false;
Expand Down
3 changes: 3 additions & 0 deletions resources/js/store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,7 @@ export const mutations = {
SET_PAGE_COUNT(state, value) {
state.pageCount = value;
},
SET_SEARCH(state, value) {
state.isSearch = value;
}
};

0 comments on commit 182fa56

Please sign in to comment.