{"version":3,"sources":["webpack:///pages.explore.projects.b5b34e79079ca7967cb3.bundle.js","webpack:///./filterable_list.js","webpack:///./pages/explore/projects/index.js","webpack:///./projects_list.js"],"names":["webpackJsonp","./filterable_list.js","module","__webpack_exports__","__webpack_require__","$","_classCallCheck","instance","Constructor","TypeError","__WEBPACK_IMPORTED_MODULE_0_underscore__","__WEBPACK_IMPORTED_MODULE_0_underscore___default","n","__WEBPACK_IMPORTED_MODULE_1__lib_utils_axios_utils__","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","FilterableList","form","filter","holder","filterInputField","arguments","undefined","this","filterForm","listFilterElement","listHolderElement","isBusy","value","getAttribute","serialize","getFilterEndpoint","debounceFilter","a","debounce","onFilterInput","bind","unbindEvents","bindEvents","$form","queryData","filterGroupsParam","find","val","filterResults","setDefaultFilterOption","addEventListener","removeEventListener","params","_this","fadeTo","get","then","res","onFilterSuccess","onFilterComplete","catch","response","data","html","innerHTML","currentPath","getPagePath","window","history","replaceState","page","document","title","call","./pages/explore/projects/index.js","__WEBPACK_IMPORTED_MODULE_0__projects_list__","./projects_list.js","__WEBPACK_IMPORTED_MODULE_0__filterable_list__","ProjectsList","querySelector","initSearch"],"mappings":"AAAAA,cAAc,2BAERC,uBACA,SAAUC,EAAQC,EAAqBC,GAE7C,cAC4B,SAASC,GAKrC,QAASC,GAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB,KAAM,IAAIC,WAAU,qCALlD,GAAIC,GAA2CN,EAAoB,kDACxGO,EAAmDP,EAAoBQ,EAAEF,GACzEG,EAAuDT,EAAoB,8BAChGU,EAAe,WAAc,QAASC,GAAiBC,EAAQC,GAAS,IAAK,GAAIC,GAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,GAAIE,GAAaH,EAAMC,EAAIE,GAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,SAAWF,KAAYA,EAAWG,UAAW,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b3.bundle.js","sourcesContent":["webpackJsonp([\"pages.explore.projects\"],{\n\n/***/ \"./filterable_list.js\":\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_underscore__ = __webpack_require__(\"../../../node_modules/underscore/underscore.js\");\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_underscore___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_underscore__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__lib_utils_axios_utils__ = __webpack_require__(\"./lib/utils/axios_utils.js\");\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\n\n\n/**\n * Makes search request for content when user types a value in the search input.\n * Updates the html content of the page with the received one.\n */\n\nvar FilterableList = function () {\n function FilterableList(form, filter, holder) {\n var filterInputField = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'filter_groups';\n\n _classCallCheck(this, FilterableList);\n\n this.filterForm = form;\n this.listFilterElement = filter;\n this.listHolderElement = holder;\n this.filterInputField = filterInputField;\n this.isBusy = false;\n }\n\n _createClass(FilterableList, [{\n key: 'getFilterEndpoint',\n value: function getFilterEndpoint() {\n return this.filterForm.getAttribute('action') + '?' + $(this.filterForm).serialize();\n }\n }, {\n key: 'getPagePath',\n value: function getPagePath() {\n return this.getFilterEndpoint();\n }\n }, {\n key: 'initSearch',\n value: function initSearch() {\n // Wrap to prevent passing event arguments to .filterResults;\n this.debounceFilter = __WEBPACK_IMPORTED_MODULE_0_underscore___default.a.debounce(this.onFilterInput.bind(this), 500);\n\n this.unbindEvents();\n this.bindEvents();\n }\n }, {\n key: 'onFilterInput',\n value: function onFilterInput() {\n var $form = $(this.filterForm);\n var queryData = {};\n var filterGroupsParam = $form.find('[name=\"' + this.filterInputField + '\"]').val();\n\n if (filterGroupsParam) {\n queryData[this.filterInputField] = filterGroupsParam;\n }\n\n this.filterResults(queryData);\n\n if (this.setDefaultFilterOption) {\n this.setDefaultFilterOption();\n }\n }\n }, {\n key: 'bindEvents',\n value: function bindEvents() {\n this.listFilterElement.addEventListener('input', this.debounceFilter);\n }\n }, {\n key: 'unbindEvents',\n value: function unbindEvents() {\n this.listFilterElement.removeEventListener('input', this.debounceFilter);\n }\n }, {\n key: 'filterResults',\n value: function filterResults(params) {\n var _this = this;\n\n if (this.isBusy) {\n return false;\n }\n\n $(this.listHolderElement).fadeTo(250, 0.5);\n\n this.isBusy = true;\n\n return __WEBPACK_IMPORTED_MODULE_1__lib_utils_axios_utils__[\"a\" /* default */].get(this.getFilterEndpoint(), {\n params: params\n }).then(function (res) {\n _this.onFilterSuccess(res, params);\n _this.onFilterComplete();\n }).catch(function () {\n return _this.onFilterComplete();\n });\n }\n }, {\n key: 'onFilterSuccess',\n value: function onFilterSuccess(response, queryData) {\n if (response.data.html) {\n this.listHolderElement.innerHTML = response.data.html;\n }\n\n // Change url so if user reload a page - search results are saved\n var currentPath = this.getPagePath(queryData);\n\n return window.history.replaceState({\n page: currentPath\n }, document.title, currentPath);\n }\n }, {\n key: 'onFilterComplete',\n value: function onFilterComplete() {\n this.isBusy = false;\n $(this.listHolderElement).fadeTo(250, 1);\n }\n }]);\n\n return FilterableList;\n}();\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (FilterableList);\n/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(\"../../../node_modules/jquery/dist/jquery.js\")))\n\n/***/ }),\n\n/***/ \"./pages/explore/projects/index.js\":\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__projects_list__ = __webpack_require__(\"./projects_list.js\");\n\n\ndocument.addEventListener('DOMContentLoaded', function () {\n return new __WEBPACK_IMPORTED_MODULE_0__projects_list__[\"a\" /* default */]();\n});\n\n/***/ }),\n\n/***/ \"./projects_list.js\":\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filterable_list__ = __webpack_require__(\"./filterable_list.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\n\n/**\n * Makes search request for projects when user types a value in the search input.\n * Updates the html content of the page with the received one.\n */\n\nvar ProjectsList = function ProjectsList() {\n _classCallCheck(this, ProjectsList);\n\n var form = document.querySelector('form#project-filter-form');\n var filter = document.querySelector('.js-projects-list-filter');\n var holder = document.querySelector('.js-projects-list-holder');\n\n if (form && filter && holder) {\n var list = new __WEBPACK_IMPORTED_MODULE_0__filterable_list__[\"a\" /* default */](form, filter, holder);\n list.initSearch();\n }\n};\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (ProjectsList);\n\n/***/ })\n\n},[\"./pages/explore/projects/index.js\"]);\n\n\n// WEBPACK FOOTER //\n// pages.explore.projects.b5b34e79079ca7967cb3.bundle.js","import _ from 'underscore';\nimport axios from './lib/utils/axios_utils';\n\n/**\n * Makes search request for content when user types a value in the search input.\n * Updates the html content of the page with the received one.\n */\n\nexport default class FilterableList {\n constructor(form, filter, holder, filterInputField = 'filter_groups') {\n this.filterForm = form;\n this.listFilterElement = filter;\n this.listHolderElement = holder;\n this.filterInputField = filterInputField;\n this.isBusy = false;\n }\n\n getFilterEndpoint() {\n return `${this.filterForm.getAttribute('action')}?${$(this.filterForm).serialize()}`;\n }\n\n getPagePath() {\n return this.getFilterEndpoint();\n }\n\n initSearch() {\n // Wrap to prevent passing event arguments to .filterResults;\n this.debounceFilter = _.debounce(this.onFilterInput.bind(this), 500);\n\n this.unbindEvents();\n this.bindEvents();\n }\n\n onFilterInput() {\n const $form = $(this.filterForm);\n const queryData = {};\n const filterGroupsParam = $form.find(`[name=\"${this.filterInputField}\"]`).val();\n\n if (filterGroupsParam) {\n queryData[this.filterInputField] = filterGroupsParam;\n }\n\n this.filterResults(queryData);\n\n if (this.setDefaultFilterOption) {\n this.setDefaultFilterOption();\n }\n }\n\n bindEvents() {\n this.listFilterElement.addEventListener('input', this.debounceFilter);\n }\n\n unbindEvents() {\n this.listFilterElement.removeEventListener('input', this.debounceFilter);\n }\n\n filterResults(params) {\n if (this.isBusy) {\n return false;\n }\n\n $(this.listHolderElement).fadeTo(250, 0.5);\n\n this.isBusy = true;\n\n return axios.get(this.getFilterEndpoint(), {\n params,\n }).then((res) => {\n this.onFilterSuccess(res, params);\n this.onFilterComplete();\n }).catch(() => this.onFilterComplete());\n }\n\n onFilterSuccess(response, queryData) {\n if (response.data.html) {\n this.listHolderElement.innerHTML = response.data.html;\n }\n\n // Change url so if user reload a page - search results are saved\n const currentPath = this.getPagePath(queryData);\n\n return window.history.replaceState({\n page: currentPath,\n }, document.title, currentPath);\n }\n\n onFilterComplete() {\n this.isBusy = false;\n $(this.listHolderElement).fadeTo(250, 1);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./filterable_list.js","import ProjectsList from '~/projects_list';\n\ndocument.addEventListener('DOMContentLoaded', () => new ProjectsList());\n\n\n\n// WEBPACK FOOTER //\n// ./pages/explore/projects/index.js","import FilterableList from './filterable_list';\n\n/**\n * Makes search request for projects when user types a value in the search input.\n * Updates the html content of the page with the received one.\n */\nexport default class ProjectsList {\n constructor() {\n const form = document.querySelector('form#project-filter-form');\n const filter = document.querySelector('.js-projects-list-filter');\n const holder = document.querySelector('.js-projects-list-holder');\n\n if (form && filter && holder) {\n const list = new FilterableList(form, filter, holder);\n list.initSearch();\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./projects_list.js"],"sourceRoot":""}