Skip to content

Commit

Permalink
Merge pull request #2 from Weberistic/contentApps
Browse files Browse the repository at this point in the history
Content apps
  • Loading branch information
Lantzify authored Nov 26, 2022
2 parents 436b9e3 + a0d272c commit 9c02db4
Show file tree
Hide file tree
Showing 16 changed files with 472 additions and 368 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
angular.module("umbraco").controller("uSupport.ticketStatus.contentApp.controller", function ($scope) {

'use strict';

$scope.model.properties = [{
alias: "Color",
label: "Color",
view: "dropdownFlexible",
value: "primary",
config: {
items: [
"primary",
"secondary",
"success",
"warning",
"danger",
"gray"
],
},
validation: {
mandatory: true,
// pattern: ""
}
},
{
alias: "Active",
label: "Active",
description: "If tickets with this status should count as active",
view: "boolean",
},
{
alias: "Default",
label: "Default",
description: "If all new tickets should have this status as default status. (Only 1 can be default)",
view: "boolean",

}];

$scope.model.preview = {
property: $scope.model.properties[0],
page: $scope.model.page
};

if (!$scope.model.create) {
$scope.model.properties.forEach(function (property) {
property.value = $scope.model.ticketStatus[property.alias];
});
}

$scope.$watch("model.preview", function (newValue, oldValue) {
$scope.model.selectedColor = newValue.property.singleDropdownValue;
$scope.model.selectedName = newValue.page.title;
}, true);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<div ng-controller="uSupport.ticketStatus.contentApp.controller as vm" class="uSupport">
<div class="uSupport-row">
<div class="uSupport-col-12">
<umb-box>
<umb-box-header title="Settings"></umb-box-header>
<umb-box-content>

<umb-property property="property" ng-repeat="property in model.properties">
<umb-property-editor model="property"></umb-property-editor>
</umb-property>

<div class="umb-property uSupport-umb-property-last">
<div class="control-group umb-control-group">
<div class="control-header">
<div class="control-label">
Preview
</div>
</div>
<div class="controls">
<div class="db umb-property-editor">
<umb-badge size="s"
color="{{model.selectedColor}}">
{{model.selectedName || 'Status'}}
</umb-badge>
</div>
</div>
</div>
</div>

</umb-box-content>
</umb-box>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,12 @@
hide-icon="false"
show-back-button="true"
on-back="vm.close()"
navigation="vm.page.navigation"
menu="vm.page.menu">
</umb-editor-header>

<umb-editor-container class="form-horizontal">
<div class="uSupport-row">
<div class="uSupport-col-12">
<umb-box>
<umb-box-header title="Settings"></umb-box-header>
<umb-box-content>

<umb-property property="property" ng-repeat="property in vm.properties">
<umb-property-editor model="property"></umb-property-editor>
</umb-property>

<div class="umb-property uSupport-umb-property-last">
<div class="control-group umb-control-group">
<div class="control-header">
<div class="control-label">
Preview
</div>
</div>
<div class="controls">
<div class="db umb-property-editor">
<umb-badge size="s"
color="{{vm.selectedColor}}">
{{vm.selectedName || 'Status'}}
</umb-badge>
</div>
</div>
</div>
</div>

</umb-box-content>
</umb-box>
</div>
</div>
<umb-editor-sub-views sub-views="vm.page.navigation" model="vm"></umb-editor-sub-views>
</umb-editor-container>

<umb-editor-footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@
uSupportConfig,
notificationsService,
uSupportHelperServices,
uSupportHelperResources,
uSupportTicketStatusResources) {

'use strict';

var vm = this;

vm.page = {};
vm.loading = true;
vm.create = $routeParams.create;
vm.properties = uSupportConfig.ticketStatusProperties;

vm.preview = {
property: vm.properties[0],
page: vm.page
}
vm.page = {};

vm.navigation = [{
name: "Ticket status",
alias: "ticketStatus",
icon: "icon-file-cabinet",
view: uSupportConfig.basePathAppPlugins + "backoffice/ticketStatuses/apps/ticketStatus/ticketStatus.html",
active: true
}];

vm.page.navigation = vm.navigation;

if (!vm.create) {
uSupportTicketStatusResources.getTicketStatus($routeParams.id).then(function (ticketStatus) {
Expand All @@ -34,27 +39,23 @@
menu: {
currentNode: currentNode,
currentSection: appState.getSectionState("currentSection")
}
},
navigation: vm.navigation
};

vm.preview.page = vm.page;

vm.properties.forEach(function (property) {
property.value = vm.ticketStatus[property.alias];
});
uSupportHelperResources.getAddons(vm.ticketStatus).then(function (apps) {
if (apps.length > 0) {
vm.navigation = vm.navigation.concat(apps)
}

vm.loading = false;
vm.loading = false;
});
});
});
} else {
vm.loading = false;
}

$scope.$watch("vm.preview", function (newValue, oldValue) {
vm.selectedColor = newValue.property.singleDropdownValue;
vm.selectedName = newValue.page.title;
}, true);

vm.save = function () {
vm.buttonState = "busy";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
angular.module("umbraco").controller("uSupport.ticketType.contentApp.controller", function (
$scope,
uSupportTicketTypeResources) {

'use strict';

$scope.loading = true;

uSupportTicketTypeResources.getAllDataTypes().then(function (dataTypes) {
$scope.model.dataTypes = dataTypes;
$scope.model.properties = [
{
alias: "propertyName",
label: "Property name",
view: "textbox"
},
{
alias: "propertyDescription",
label: "Property description",
view: "textbox"
},
{
alias: "property",
label: "Property",
view: "dropdownFlexible",
config: {
items: dataTypes
}
}
];

if ($scope.model.ticketType.PropertyId !== 0) {
uSupportTicketTypeResources.getDataTypeFromId($scope.model.ticketType.PropertyId).then(function (type) {
$scope.model.properties[0].value = $scope.model.ticketType.PropertyName;
$scope.model.properties[1].value = $scope.model.ticketType.PropertyDescription;
$scope.model.properties[2].value = type.Name;

$scope.loading = false;
});
} else {
$scope.loading = false;
}
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div ng-controller="uSupport.ticketType.contentApp.controller as vm" class="uSupport">

<umb-load-indicator ng-if="loading"></umb-load-indicator>

<div class="uSupport-row" ng-if="!loading">
<div class="uSupport-col-12">
<umb-box>
<umb-box-header title="Settings"></umb-box-header>
<umb-box-content>

<umb-property property="property" ng-repeat="property in model.properties">
<umb-property-editor model="property"></umb-property-editor>
</umb-property>

</umb-box-content>
</umb-box>
</div>
</div>
</div>
93 changes: 40 additions & 53 deletions src/uSupport/App_Plugins/uSupport/backoffice/ticketTypes/edit.html
Original file line number Diff line number Diff line change
@@ -1,56 +1,43 @@
<div ng-controller="uSupport.ticketType.edit.controller as vm" class="uSupport">

<umb-load-indicator ng-if="vm.loading"></umb-load-indicator>

<form novalidate val-form-manager name="formName" ng-submit="vm.save()">
<umb-editor-view ng-if="!vm.loading">
<umb-editor-header name="vm.page.title"
description="vm.page.description"
hideDescription="false"
name-locked="false"
hide-alias="false"
alias="vm.page.alias"
icon="vm.page.icon"
hideIcon="false"
show-back-button="true"
on-back="vm.close()"
menu="vm.page.menu">
</umb-editor-header>

<umb-editor-container class="form-horizontal">
<div class="uSupport-row">
<div class="uSupport-col-12">
<umb-box>
<umb-box-header title="Settings"></umb-box-header>
<umb-box-content>

<umb-property property="property" ng-repeat="property in vm.properties">
<umb-property-editor model="property"></umb-property-editor>
</umb-property>

</umb-box-content>
</umb-box>
</div>
</div>
</umb-editor-container>

<umb-editor-footer>
<umb-editor-footer-content-right>
<umb-button type="button"
button-style="link"
label-key="general_close"
action="vm.close()">
</umb-button>

<umb-button type="submit"
button-style="success"
state="vm.buttonState"
label-key="buttons_save"
action="vm.save()">
</umb-button>
</umb-editor-footer-content-right>
</umb-editor-footer>

</umb-editor-view>
</form>
<umb-load-indicator ng-if="vm.loading"></umb-load-indicator>

<form novalidate val-form-manager name="formName" ng-submit="vm.save()">
<umb-editor-view ng-if="!vm.loading">
<umb-editor-header name="vm.page.title"
description="vm.page.description"
hideDescription="false"
name-locked="false"
hide-alias="false"
alias="vm.page.alias"
icon="vm.page.icon"
hideIcon="false"
show-back-button="true"
on-back="vm.close()"
navigation="vm.page.navigation"
menu="vm.page.menu">
</umb-editor-header>

<umb-editor-container class="form-horizontal">
<umb-editor-sub-views sub-views="vm.page.navigation" model="vm"></umb-editor-sub-views>
</umb-editor-container>

<umb-editor-footer>
<umb-editor-footer-content-right>
<umb-button type="button"
button-style="link"
label-key="general_close"
action="vm.close()">
</umb-button>

<umb-button type="submit"
button-style="success"
state="vm.buttonState"
label-key="buttons_save"
action="vm.save()">
</umb-button>
</umb-editor-footer-content-right>
</umb-editor-footer>
</umb-editor-view>
</form>
</div>
Loading

0 comments on commit 9c02db4

Please sign in to comment.