Merge branch 'temp-template-editor' into dev-v7.6

This commit is contained in:
Sebastiaan Janssen
2017-01-26 18:27:10 +01:00
13 changed files with 384 additions and 103 deletions

View File

@@ -1,16 +1,16 @@
(function () {
"use strict";
function InsertOverlayController($scope) {
function InsertOverlayController($scope, localizationService) {
var vm = this;
if(!$scope.model.title) {
$scope.model.title = "Insert";
$scope.model.title = localizationService.localize("template_insert");
}
if(!$scope.model.subtitle) {
$scope.model.subtitle = "Choose what to insert into your template";
$scope.model.subtitle = localizationService.localize("template_insertDesc");
}
vm.openMacroPicker = openMacroPicker;
@@ -22,7 +22,7 @@
vm.macroPickerOverlay = {
view: "macropicker",
title: "Insert macro",
title: localizationService.localize("template_insertMacro"),
dialogData: {},
show: true,
submit: function(model) {
@@ -45,8 +45,8 @@
function openPageFieldOverlay() {
vm.pageFieldOverlay = {
title: "Insert value",
description: "Select a value from the currentpage",
title: localizationService.localize("template_insertPageField"),
description: localizationService.localize("template_insertPageFieldDesc"),
submitButtonLabel: "Insert",
closeButtonlabel: "Cancel",
view: "insertfield",
@@ -78,7 +78,8 @@
treeAlias: "dictionary",
entityType: "dictionary",
multiPicker: false,
title: "Insert dictionary item",
title: localizationService.localize("template_insertDictionaryItem"),
description: localizationService.localize("template_insertDictionaryItemDesc"),
show: true,
select: function(node){
@@ -108,7 +109,7 @@
entityType: "partialView",
multiPicker: false,
show: true,
title: "Insert partial view",
title: localizationService.localize("template_insertPartialView"),
select: function(node){

View File

@@ -24,7 +24,7 @@
<div class="umb-insert-code-box" ng-click="vm.openDictionaryItemOverlay()">
<div class="umb-insert-code-box__title"><localize key="template_insertDictionaryItem" /></div>
<div class="umb-insert-code-box__description"><localize key="template_insertDictionaryItem" /></div>
<div class="umb-insert-code-box__description"><localize key="template_insertDictionaryItemDesc" /></div>
</div>
</div>

View File

@@ -27,12 +27,12 @@
</li>
</ul>
<umb-empty-state ng-if="nomacros"
position="center">
<localize key="defaultdialogs_nomacros">
<umb-empty-state
ng-if="nomacros"
position="center">
<localize key="defaultdialogs_noMacros">
There are no macros available to insert
</localize>
</umb-empty-state>
</div>

View File

@@ -1,8 +1,14 @@
(function () {
"use strict";
function QueryBuilderOverlayController($scope, templateQueryResource) {
function QueryBuilderOverlayController($scope, templateQueryResource, localizationService) {
var everything = localizationService.localize("template_allContent");
var myWebsite = localizationService.localize("template_websiteRoot");
var ascendingTranslation = localizationService.localize("template_ascending");
var descendingTranslation = localizationService.localize("template_descending");
var vm = this;
vm.properties = [];
@@ -17,10 +23,10 @@
vm.query = {
contentType: {
name: "Everything"
name: everything
},
source: {
name: "My website"
name: myWebsite
},
filters: [
{
@@ -33,7 +39,13 @@
alias: "",
name: "",
},
direction: "ascending"
direction: "ascending", //This is the value for sorting sent to server
translation: {
currentLabel: ascendingTranslation, //This is the localized UI value in the the dialog
ascending: ascendingTranslation,
descending: descendingTranslation
}
}
};
@@ -74,7 +86,6 @@
vm.contentPickerOverlay = {
view: "contentpicker",
show: true,
submitButtonLabel: "Insert",
submit: function(model) {
var selectedNodeId = model.selection[0].id;
@@ -83,7 +94,7 @@
if (selectedNodeId > 0) {
query.source = { id: selectedNodeId, name: selectedNodeName };
} else {
query.source.name = "My website";
query.source.name = myWebsite;
delete query.source.id;
}
@@ -113,13 +124,21 @@
function trashFilter(query) {
query.filters.splice(query, 1);
//if we remove the last one, add a new one to generate ui for it.
if (query.filters.length == 0) {
query.filters.push({});
}
}
function changeSortOrder(query) {
if (query.sort.direction === "ascending") {
query.sort.direction = "descending";
query.sort.translation.currentLabel = query.sort.translation.descending;
} else {
query.sort.direction = "ascending";
query.sort.translation.currentLabel = query.sort.translation.ascending;
}
throttledFunc();
}
@@ -128,8 +147,10 @@
query.sort.property = property;
if (property.type === "datetime") {
query.sort.direction = "descending";
query.sort.translation.currentLabel = query.sort.translation.descending;
} else {
query.sort.direction = "ascending";
query.sort.translation.currentLabel = query.sort.translation.ascending;
}
throttledFunc();
}

View File

@@ -5,7 +5,7 @@
<div class="row">
<div class="query-items">
<span><localize key="template_iWant">I Want</localize></span>
<span><localize key="template_iWant">I want</localize></span>
<div class="btn-group">
@@ -22,7 +22,7 @@
</div>
<span><localize key="template_fromt">from</localize></span>
<span><localize key="template_from">from</localize></span>
<a href class="btn btn-link" ng-click="vm.chooseSource(vm.query)">
{{vm.query.source.name}}
@@ -91,7 +91,7 @@
<i class="icon-add"></i>
</a>
<a href ng-if="vm.query.filters.length > 1" ng-click="vm.trashFilter(vm.query)">
<a href ng-click="vm.trashFilter(vm.query)">
<i class="icon-trash"></i>
</a>
@@ -100,7 +100,7 @@
<div class="query-items">
<span<localize key="template_orderBy">order by</localize></span>
<span><localize key="template_orderBy">order by</localize></span>
<div class="btn-group">
<a class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="#">
@@ -119,7 +119,7 @@
</div>
<a href class="btn" ng-click="vm.changeSortOrder(vm.query)">
{{vm.query.sort.direction}}
{{vm.query.sort.translation.currentLabel}}
</a>
</div>

View File

@@ -1,71 +1,59 @@
<div ng-controller="Umbraco.Overlays.TemplateSectionsOverlay as vm">
<div ng-if="!model.hasMaster" class="umb-insert-code-box" ng-click="vm.select('renderBody')">
<div class="umb-insert-code-box" ng-click="vm.select('renderBody')">
<div class="umb-insert-code-box__check" ng-class="{'umb-insert-code-box__check--checked': model.insertType === 'renderBody' }"><i class="icon icon-check"></i></div>
<div class="umb-insert-code-box__title">Render child template</div>
<div class="umb-insert-code-box__title"><localize key="template_renderBody" /></div>
<div class="umb-insert-code-box__description">
Renders the contents of a child template, by inserting a
<code>@RenderBody()</code> placeholder.
<localize key="template_renderBodyDesc" />
</div>
</div>
<div ng-if="!model.hasMaster" class="umb-insert-code-box" ng-click="vm.select('renderSection')">
<div class="umb-insert-code-box" ng-click="vm.select('renderSection')">
<div class="umb-insert-code-box__check" ng-class="{'umb-insert-code-box__check--checked': model.insertType === 'renderSection' }"><i class="icon icon-check"></i></div>
<div class="umb-insert-code-box__title">Render a named section</div>
<div class="umb-insert-code-box__title"><localize key="template_renderSection" /></div>
<div class="umb-insert-code-box__description">
Renders a named area of a child template, by insert a <code>@RenderSection(name)</code> placeholder.
This renders an area of a child template which is wrapped in a corresponding <code>@section [name]{ ... }</code> definition.
<localize key="template_renderSectionDesc" />
</div>
<div ng-if="model.insertType === 'renderSection'" style="margin-top: 20px;">
<div style="margin-bottom: 20px;">
<label class="bold">Section name <span class="red">*</span></label>
<label class="bold"><localize key="template_sectionName" /> <span class="red">*</span></label>
<input type="text" name="renderSectionName" class="-full-width-input" ng-model="model.renderSectionName" required umb-auto-focus />
<small class="red" val-msg-for="renderSectionName" val-toggle-msg="required"><localize key="required" /></small>
<div class="umb-insert-code-box__description">
Set the name of the section to render in this area of the template
</div>
</div>
<div>
<label>
<input type="checkbox" ng-model="model.mandatoryRenderSection" />
Make section mandatory
<input type="checkbox" ng-model="model.mandatoryRenderSection" /> <localize key="template_sectionMandatory" />
</label>
<div class="umb-insert-code-box__description">
If mandatory, the child template must contain a <code>@section</code> definition, otherwise an error is shown.
<localize key="template_sectionMandatoryDesc" />
</div>
</div>
</div>
</div>
<div ng-if="model.hasMaster" class="umb-insert-code-box" ng-click="vm.select('addSection')">
<div class="umb-insert-code-box" ng-click="vm.select('addSection')">
<div class="umb-insert-code-box__check" ng-class="{'umb-insert-code-box__check--checked': model.insertType === 'addSection' }"><i class="icon icon-check"></i></div>
<div class="umb-insert-code-box__title">Define a named section</div>
<div class="umb-insert-code-box__title"><localize key="template_defineSection" /></div>
<div class="umb-insert-code-box__description">
Defines a part of your template as a named section by wrapping it in
a <code>@section { ... }</code>. This can be rendered in a
specific area of the master of this template, by using <code>@RenderSection</code>.
<localize key="template_defineSectionDesc" />
</div>
<div ng-if="model.insertType === 'addSection'" style="margin-top: 20px;">
<div>
<label class="bold">Section name <span class="red">*</span></label>
<label class="bold"><localize key="template_sectionName" /> <span class="red">*</span></label>
<input type="text" name="sectionName" class="-full-width-input" ng-model="model.sectionName" required umb-auto-focus />
<small class="red" val-msg-for="sectionName" val-toggle-msg="required"><localize key="required" /></small>
<div class="umb-insert-code-box__description">
Give the section a name
</div>
</div>
</div>
</div>
</div>

View File

@@ -220,7 +220,7 @@
view: "macropicker",
dialogData: {},
show: true,
title: "Insert macro",
title: localizationService.localize("template_insertMacro"),
submit: function (model) {
var macroObject = macroService.collectValueData(model.selectedMacro, model.macroParams, "Mvc");
@@ -247,6 +247,7 @@
closeButtonlabel: "Cancel",
view: "insertfield",
show: true,
title: localizationService.localize("template_insertPageField"),
submit: function (model) {
insert(model.umbracoField);
vm.pageFieldOverlay.show = false;
@@ -271,7 +272,7 @@
entityType: "dictionary",
multiPicker: false,
show: true,
title: "Insert dictionary item",
title: localizationService.localize("template_insertDictionaryItem"),
select: function(node){
//crappy hack due to dictionary items not in umbracoNode table
var code = "@Umbraco.GetDictionaryValue(\"" + node.name + "\")";
@@ -298,7 +299,7 @@
entityType: "partialView",
multiPicker: false,
show: true,
title: "Insert Partial view",
title: localizationService.localize("template_insertPartialView"),
select: function(node){
//crappy hack due to dictionary items not in umbracoNode table
var nodeNameWithPath = node.id.replace(".cshtml", "");
@@ -322,7 +323,7 @@
vm.queryBuilderOverlay = {
view: "querybuilder",
show: true,
title: "Query for content",
title: localizationService.localize("template_queryBuilder"),
submit: function (model) {
@@ -356,7 +357,7 @@
vm.sectionsOverlay = {
view: "templatesections",
hasMaster: vm.template.masterTemplateAlias,
isMaster: vm.template.isMasterTemplate,
submitButtonLabel: "Insert",
show: true,
submit: function(model) {
@@ -401,7 +402,7 @@
vm.masterTemplateOverlay = {
view: "itempicker",
title: "Choose master template",
title: localizationService.localize("template_mastertemplate"),
availableItems: availableMasterTemplates,
show: true,
submit: function(model) {
@@ -443,23 +444,15 @@
}
function getMasterTemplateName(masterTemplateAlias, templates) {
if(masterTemplateAlias) {
var templateName = "";
angular.forEach(templates, function(template){
if(template.alias === masterTemplateAlias) {
templateName = template.name;
}
});
return templateName;
} else {
return "No master";
}
}
function removeMasterTemplate() {

View File

@@ -33,7 +33,11 @@
class="umb-era-button umb-button--s"
ng-click="vm.openMasterTemplateOverlay()">
<i class="icon icon-layout"></i>
<span class="bold">Master template:</span> <span style="margin-left: 5px;">{{ vm.getMasterTemplateName(vm.template.masterTemplateAlias, vm.templates) }}</span>
<span class="bold"><localize key="template_mastertemplate">Master template</localize>:</span>
<span style="margin-left: 5px;">
<span ng-if="vm.template.masterTemplateAlias">{{ vm.getMasterTemplateName(vm.template.masterTemplateAlias, vm.templates) }}</span>
<span ng-if="!vm.template.masterTemplateAlias"><localize key="template_noMaster">No master</localize></span>
</span>
</button>
<a ng-if="vm.template.masterTemplateAlias" ng-click="vm.removeMasterTemplate()" class="umb-era-button umb-button--s dropdown-toggle umb-button-group__toggle">
@@ -62,7 +66,7 @@
<li><a href="" ng-click="vm.openPageFieldOverlay()"><localize key="template_insertPageField">Value</localize></a></li>
<li><a href="" ng-click="vm.openPartialOverlay()"><localize key="template_insertPartialView">Partial view</localize></a></li>
<li><a href="" ng-click="vm.openDictionaryItemOverlay()"><localize key="template_insertDictionaryItem">Dictionary</localize></a></li>
<li><a href="" ng-click="vm.openMacroOverlay()"><localize key="general_insertMacro">Macro</localize></a></li>
<li><a href="" ng-click="vm.openMacroOverlay()"><localize key="template_insertMacro">Macro</localize></a></li>
</ul>
</div>