Split relation type and associated relations into tabbed view
This commit is contained in:
@@ -19,7 +19,7 @@ function RelationTypeCreateController($scope, $location, relationTypeResource, n
|
||||
relationTypeResource.getRelationObjectTypes().then(function (data) {
|
||||
vm.objectTypes = data;
|
||||
}, function (err) {
|
||||
alert("oh no");
|
||||
notificationsService.error("Could not load form.")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* @description
|
||||
* The controller for editing relation types.
|
||||
*/
|
||||
function RelationTypeEditController($scope, $routeParams, relationTypeResource, editorState, navigationService, dateHelper, userService, entityResource, formHelper, contentEditingHelper) {
|
||||
function RelationTypeEditController($scope, $routeParams, relationTypeResource, editorState, navigationService, dateHelper, userService, entityResource, formHelper, contentEditingHelper, localizationService) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
@@ -17,11 +17,29 @@ function RelationTypeEditController($scope, $routeParams, relationTypeResource,
|
||||
|
||||
vm.save = saveRelationType;
|
||||
|
||||
if($routeParams.create) {
|
||||
alert("create");
|
||||
} else {
|
||||
init();
|
||||
|
||||
function init() {
|
||||
vm.page.loading = true;
|
||||
|
||||
localizationService.localizeMany(["relationType_tabRelationType", "relationType_tabRelations"]).then(function (data) {
|
||||
vm.page.navigation = [
|
||||
{
|
||||
"name": data[0],
|
||||
"alias": "relationType",
|
||||
"icon": "icon-info",
|
||||
"view": "views/relationTypes/views/relationType.html",
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"name": data[1],
|
||||
"alias": "relations",
|
||||
"icon": "icon-trafic",
|
||||
"view": "views/relationTypes/views/relations.html"
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
relationTypeResource.getById($routeParams.id)
|
||||
.then(function(data) {
|
||||
bindRelationType(data);
|
||||
|
||||
@@ -7,70 +7,13 @@
|
||||
name="vm.relationType.name"
|
||||
alias="vm.relationType.alias"
|
||||
hide-description="true"
|
||||
hide-icon="true">
|
||||
hide-icon="true"
|
||||
navigation="vm.page.navigation">
|
||||
</umb-editor-header>
|
||||
|
||||
<umb-editor-container class="form-horizontal">
|
||||
<umb-box>
|
||||
<umb-box-content>
|
||||
<!-- ID -->
|
||||
<umb-control-group label="Id">
|
||||
<div>{{vm.relationType.id}}</div>
|
||||
<small>{{vm.relationType.key}}</small>
|
||||
</umb-control-group>
|
||||
|
||||
<!-- Direction -->
|
||||
<umb-control-group label="@relationType_direction">
|
||||
<ul class="unstyled">
|
||||
<li>
|
||||
<label class="radio">
|
||||
<input type="radio" name="relationType-direction" ng-model="vm.relationType.isBidirectional" ng-value="false"> <localize key="relationType_parentToChild">Parent to child</localize>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label class="radio">
|
||||
<input type="radio" name="relationType-direction" ng-model="vm.relationType.isBidirectional" ng-value="true"> <localize key="relationType_bidirectional">Bidirectional</localize>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</umb-control-group>
|
||||
|
||||
<!-- Parent-->
|
||||
<umb-control-group label="@relationType_parent">
|
||||
<div>{{vm.relationType.parentObjectTypeName}}</div>
|
||||
</umb-control-group>
|
||||
|
||||
<!-- Child -->
|
||||
<umb-control-group label="@relationType_child">
|
||||
<div>{{vm.relationType.childObjectTypeName}}</div>
|
||||
</umb-control-group>
|
||||
|
||||
<!-- Relation count -->
|
||||
<umb-control-group label="@relationType_count" ng-if="vm.relationType.relations.length > 0">
|
||||
<div>{{vm.relationType.relations.length}}</div>
|
||||
</umb-control-group>
|
||||
|
||||
<!-- Relations -->
|
||||
<umb-control-group label="@relationType_relations" ng-if="vm.relationType.relations.length > 0">
|
||||
<div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th><localize key="relationType_parent">Parent</localize></th>
|
||||
<th><localize key="relationType_child">Child</localize></th>
|
||||
<th><localize key="relationType_created">Created</localize></th>
|
||||
<th><localize key="relationType_comment">Comment</localize></th>
|
||||
</thead>
|
||||
<tr ng-repeat="relation in vm.relationType.relations">
|
||||
<td>{{relation.parentName}}</td>
|
||||
<td>{{relation.childName}}</td>
|
||||
<td>{{relation.timestampFormatted}}</td>
|
||||
<td>{{relation.comment}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</umb-control-group>
|
||||
</umb-box-content>
|
||||
</umb-box>
|
||||
<umb-editor-sub-views sub-views="vm.page.navigation" model="vm">
|
||||
</umb-editor-sub-views>
|
||||
</umb-editor-container>
|
||||
|
||||
<umb-editor-footer>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<umb-box>
|
||||
<umb-box-content>
|
||||
<!-- ID -->
|
||||
<umb-control-group label="Id">
|
||||
<div>{{model.relationType.id}}</div>
|
||||
<small>{{model.relationType.key}}</small>
|
||||
</umb-control-group>
|
||||
|
||||
<!-- Direction -->
|
||||
<umb-control-group label="@relationType_direction">
|
||||
<ul class="unstyled">
|
||||
<li>
|
||||
<label class="radio">
|
||||
<input type="radio" name="relationType-direction" ng-model="model.relationType.isBidirectional" ng-value="false"> <localize key="relationType_parentToChild">Parent to child</localize>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label class="radio">
|
||||
<input type="radio" name="relationType-direction" ng-model="model.relationType.isBidirectional" ng-value="true"> <localize key="relationType_bidirectional">Bidirectional</localize>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</umb-control-group>
|
||||
|
||||
<!-- Parent-->
|
||||
<umb-control-group label="@relationType_parent">
|
||||
<div>{{model.relationType.parentObjectTypeName}}</div>
|
||||
</umb-control-group>
|
||||
|
||||
<!-- Child -->
|
||||
<umb-control-group label="@relationType_child">
|
||||
<div>{{model.relationType.childObjectTypeName}}</div>
|
||||
</umb-control-group>
|
||||
|
||||
<!-- Relation count -->
|
||||
<umb-control-group label="@relationType_count" ng-if="model.relationType.relations.length > 0">
|
||||
<div>{{model.relationType.relations.length}}</div>
|
||||
</umb-control-group>
|
||||
</umb-box-content>
|
||||
</umb-box>
|
||||
@@ -0,0 +1,23 @@
|
||||
<umb-box>
|
||||
<umb-box-content>
|
||||
<!-- Relations -->
|
||||
<umb-control-group label="@relationType_relations" ng-if="model.relationType.relations.length > 0">
|
||||
<div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th><localize key="relationType_parent">Parent</localize></th>
|
||||
<th><localize key="relationType_child">Child</localize></th>
|
||||
<th><localize key="relationType_created">Created</localize></th>
|
||||
<th><localize key="relationType_comment">Comment</localize></th>
|
||||
</thead>
|
||||
<tr ng-repeat="relation in model.relationType.relations">
|
||||
<td>{{relation.parentName}}</td>
|
||||
<td>{{relation.childName}}</td>
|
||||
<td>{{relation.timestampFormatted}}</td>
|
||||
<td>{{relation.comment}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</umb-control-group>
|
||||
</umb-box-content>
|
||||
</umb-box>
|
||||
@@ -1957,5 +1957,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="created">Created</key>
|
||||
<key alias="comment">Comment</key>
|
||||
<key alias="name">Name</key>
|
||||
<key alias="tabRelationType">Relation Type</key>
|
||||
<key alias="tabRelations">Relations</key>
|
||||
</area>
|
||||
</language>
|
||||
|
||||
@@ -1998,5 +1998,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="created">Created</key>
|
||||
<key alias="comment">Comment</key>
|
||||
<key alias="name">Name</key>
|
||||
<key alias="tabRelationType">Relation Type</key>
|
||||
<key alias="tabRelations">Relations</key>
|
||||
</area>
|
||||
</language>
|
||||
|
||||
Reference in New Issue
Block a user