Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Mbb640 committed Jul 5, 2021
1 parent 27fb0bd commit 67f8bc1
Show file tree
Hide file tree
Showing 17 changed files with 105 additions and 712 deletions.
335 changes: 80 additions & 255 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
<ProjectReference Include="..\StatCan.OrchardCore.Security\StatCan.OrchardCore.Security.csproj" PrivateAssets="none" />

<!-- Modules -->
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.Assessment\StatCan.OrchardCore.Assessment.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.DisplayHelpers\StatCan.OrchardCore.DisplayHelpers.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.CommonTypes\StatCan.OrchardCore.CommonTypes.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.Configuration\StatCan.OrchardCore.Configuration.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.ContentFields\StatCan.OrchardCore.ContentFields.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.DisplayHelpers\StatCan.OrchardCore.DisplayHelpers.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.EmailTemplates\StatCan.OrchardCore.EmailTemplates.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.FIP\StatCan.OrchardCore.FIP.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.Ethos\StatCan.OrchardCore.Ethos.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.GCCollab\StatCan.OrchardCore.GCCollab.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.GitHub\StatCan.OrchardCore.GitHub.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\Modules\StatCan.OrchardCore.Hackathon\StatCan.OrchardCore.Hackathon.csproj" PrivateAssets="none" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,97 +0,0 @@
/*
** NOTE: This file is generated by Gulp and should not be edited directly!
** Any changes made directly to this file will be overwritten next time its asset group is processed by Gulp.
*/

function debounce(func, wait, immediate) {
var timeout;
return function () {
var context = this,
args = arguments;

var later = function later() {
timeout = null;
if (!immediate) func.apply(context, args);
};

var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
}

;

function initVueMultiselect(element) {
// only run script if element exists
if (element) {
var elementId = element.id;
var selectedItems = JSON.parse(element.dataset.selectedItems || "[]");

if (selectedItems == null) {
selectedItems = [];
}

var multiple = JSON.parse(element.dataset.multiple);
var allItems = JSON.parse(element.dataset.allItems || "[]");
var debouncedSearch = debounce(function (vm, query) {
vm.isLoading = true;
}, 250);
var vueMultiselect = Vue.component('vue-multiselect', window.VueMultiselect.default);
var vm = new Vue({
el: '#' + elementId,
components: {
'vue-multiselect': vueMultiselect
},
data: {
value: null,
arrayOfItems: selectedItems,
options: allItems
},
computed: {
selectedIds: function selectedIds() {
return this.arrayOfItems.map(function (x) {
return x.Value;
}).join(',');
},
isDisabled: function isDisabled() {
return this.arrayOfItems.length > 0 && !multiple;
}
},
watch: {
selectedIds: function selectedIds() {
// We add a delay to allow for the <input> to get the actual value
// before the form is submitted
setTimeout(function () {
$(document).trigger('contentpreview:render');
}, 100);
}
},
methods: {
onSelect: function onSelect(selectedOption) {
var self = this;

for (i = 0; i < self.arrayOfItems.length; i++) {
if (self.arrayOfItems[i].Value === selectedOption.Value) {
return;
}
}

self.arrayOfItems.push(selectedOption);
},
remove: function remove(item) {
this.arrayOfItems.splice(this.arrayOfItems.indexOf(item), 1);
}
}
});
/*Hook for other scripts that might want to have access to the view model*/

var event = new CustomEvent("vue-multiselect-created", {
detail: {
vm: vm
}
});
document.querySelector("body").dispatchEvent(event);
}
}
69 changes: 0 additions & 69 deletions src/Modules/StatCan.OrchardCore.GitHub/wwwroot/tokensEditor.js
Original file line number Diff line number Diff line change
@@ -1,69 +0,0 @@
/*
** NOTE: This file is generated by Gulp and should not be edited directly!
** Any changes made directly to this file will be overwritten next time its asset group is processed by Gulp.
*/

function initializeTokensEditor(elem, data) {
console.log(data);
var store = {
debug: false,
state: {
tokens: data
},
addToken: function addToken() {
if (this.debug) {
console.log('add token triggered');
}

;
this.state.tokens.push({
name: '',
value: ''
});
},
removeToken: function removeToken(index) {
if (this.debug) {
console.log('remove token triggered with', index);
}

;
this.state.tokens.splice(index, 1);
}
};
var tokensTable = {
template: '#tokens-table',
props: ['data'],
name: 'tokens-table',
methods: {
add: function add() {
store.addToken();
},
remove: function remove(index) {
store.removeToken(index);
},
getTokensFormattedList: function getTokensFormattedList() {
if (this.debug) {
console.log('getTokensFormattedList triggered');
}

;
return JSON.stringify(store.state.tokens.filter(function (x) {
return !IsNullOrWhiteSpace(x.name);
}));
}
}
};
new Vue({
components: {
tokensTable: tokensTable
},
data: {
sharedState: store.state
},
el: elem
});
}

function IsNullOrWhiteSpace(str) {
return str === null || str.match(/^ *$/) !== null;
}
Original file line number Diff line number Diff line change
@@ -1,115 +0,0 @@
/*
** NOTE: This file is generated by Gulp and should not be edited directly!
** Any changes made directly to this file will be overwritten next time its asset group is processed by Gulp.
*/

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function initializeLocalizedTextEditor(element, confirmModalOptions) {
var $el = $(element);
var initialData = $el.data('init');
var cultures = $el.data('cultures');

function autoExpand() {
// textareas autoexpand when text changes
this.style.height = 'auto';
this.style.minHeight = "38px";
this.style.height = this.scrollHeight + 'px';
}

$('.autoexpand-listener').on('input', 'textarea', autoExpand);
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$('.autoexpand-listener').find("textarea").each(autoExpand);
});
var parsedData = initialData ? initialData.map(function (i) {
return {
name: i.Name,
localizedItems: i.LocalizedItems.map(function (j) {
return {
culture: j.Culture,
value: j.Value,
isCurrent: cultures.find(function (c) {
return c == j.Culture;
})
};
})
};
}) : []; // add missing cultures

parsedData.forEach(function (item) {
cultures.forEach(function (c) {
if (!item.localizedItems.find(function (i) {
return i.culture == c;
})) {
item.localizedItems.push({
culture: c,
isCurrent: true,
value: ''
});
}
});
});
return new Vue({
el: element,
data: {
entries: []
},
computed: {
value: function value() {
this.entries;
return JSON.stringify(this.entries);
},
hasEntries: function hasEntries() {
return this.entries.length > 0;
}
},
created: function created() {
this.entries = parsedData;
},
mounted: function mounted() {
// expand the textareas on mount
$('.autoexpand-listener').find("textarea").each(autoExpand);
},
methods: {
add: function add() {
this.entries.push({
name: '',
localizedItems: cultures === null || cultures === void 0 ? void 0 : cultures.map(function (c) {
return {
culture: c,
isCurrent: true,
value: ''
};
})
});
},
remove: function remove(index) {
// use the admin confirm dialog before deleting
var that = this;
confirmDialog(_objectSpread(_objectSpread({}, confirmModalOptions), {}, {
callback: function callback(resp) {
if (resp) {
that.entries.splice(index, 1);
}
}
}));
},
updatePreview: function updatePreview() {
this.$nextTick(function () {
$(document).trigger('contentpreview:render');
});
}
},
watch: {
entries: function entries() {
this.updatePreview();
}
}
});
}

;
Loading

0 comments on commit 67f8bc1

Please sign in to comment.