Merge branch 'Jeavon-U4-4641' into temp-U4-4641

This commit is contained in:
Claus
2015-11-17 12:47:18 +01:00
5 changed files with 106 additions and 21 deletions

View File

@@ -0,0 +1,7 @@
angular.module("umbraco").controller('Umbraco.Dialogs.Template.SnippetController',
function($scope, $http, dialogService) {
$scope.type = $scope.dialogOptions.type;
$scope.section = {};
$scope.section.name = "";
$scope.section.required = false;
});

View File

@@ -0,0 +1,39 @@
<form novalidate name="contentForm"
ng-controller="Umbraco.Dialogs.Template.SnippetController"
ng-submit="close()"
val-form-manager>
<style>
</style>
<div class="umb-panel">
<div class="umb-panel-header">
<h1 class="headline" style="margin: 10px 0 0 0">Configure the section</h1>
</div>
<div class="umb-panel-body with-footer umb-querybuilder">
<label>
Section name:
<input type="text" ng-model="section.name" />
</label>
<label ng-show="type === 'rendersection'">
Required?
<input type="checkbox" ng-checked="section.required" ng-model="section.required" />
</label>
</div>
<div class="umb-panel-footer" >
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_close">Close</localize>
</a>
<a href ng-click="submit(section)" class="btn btn-primary">Insert</a>
</div>
</div>
</div>
</div>
</form>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -251,24 +251,28 @@ namespace Umbraco.Web.UI.Umbraco.Settings.Views
//TODO: implement content placeholders, etc... just like we had in v5
//Panel1.Menu.InsertSplitter();
editorSource.Menu.InsertSplitter();
//MenuIconI umbContainer = Panel1.Menu.NewIcon();
//umbContainer.ImageURL = UmbracoPath + "/images/editor/masterpagePlaceHolder.gif";
MenuIconI umbRenderBody = editorSource.Menu.NewIcon();
umbRenderBody.ImageURL = UmbracoPath + "/images/editor/renderbody.gif";
//umbContainer.AltText = ui.Text("template", "insertContentAreaPlaceHolder");
//umbContainer.OnClickCommand =
// ClientTools.Scripts.OpenModalWindow(
// IOHelper.ResolveUrl(SystemDirectories.Umbraco) +
// "/dialogs/insertMasterpagePlaceholder.aspx?&id=" + _template.Id,
// ui.Text("template", "insertContentAreaPlaceHolder"), 470, 320);
umbRenderBody.AltText = "Insert @RenderBody()";
//MenuIconI umbContent = Panel1.Menu.NewIcon();
//umbContent.ImageURL = UmbracoPath + "/images/editor/masterpageContent.gif";
//umbContent.AltText = ui.Text("template", "insertContentArea");
//umbContent.OnClickCommand =
// ClientTools.Scripts.OpenModalWindow(
// IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/insertMasterpageContent.aspx?id=" +
// _template.Id, ui.Text("template", "insertContentArea"), 470, 300);
umbRenderBody.OnClickCommand = "editViewEditor.insertRenderBody()";
MenuIconI umbSection = editorSource.Menu.NewIcon();
umbSection.ImageURL = UmbracoPath + "/images/editor/masterpagePlaceHolder.gif";
//umbContainer.AltText = ui.Text("template", "insertContentAreaPlaceHolder");
umbSection.AltText = "Insert Section";
umbSection.OnClickCommand = "editViewEditor.openSnippetModal('section')";
MenuIconI umbRenderSection = editorSource.Menu.NewIcon();
umbRenderSection.ImageURL = UmbracoPath + "/images/editor/masterpageContent.gif";
//umbContainer.AltText = ui.Text("template", "insertContentAreaPlaceHolder");
umbRenderSection.AltText = "Insert @RenderSection";
umbRenderSection.OnClickCommand = "editViewEditor.openSnippetModal('rendersection')";
}

View File

@@ -37,6 +37,10 @@
UmbEditor.Insert("@Umbraco.RenderMacro(\"" + alias + "\")", "", this._opts.codeEditorElementId);
},
insertRenderBody: function() {
UmbEditor.Insert("@RenderBody()", "", this._opts.codeEditorElementId);
},
openMacroModal: function (alias) {
/// <summary>callback used to display the modal dialog to insert a macro with parameters</summary>
@@ -54,6 +58,37 @@
});
},
openSnippetModal: function (type) {
/// <summary>callback used to display the modal dialog to insert a macro with parameters</summary>
var self = this;
UmbClientMgr.openAngularModalWindow({
template: "views/common/dialogs/template/snippet.html",
callback: function (data) {
var code = "";
if (type === 'section') {
code = "\n@section " + data.name + "{\n";
code += "<!-- Content here -->\n" +
"}\n";
}
if (type === 'rendersection') {
if (data.required) {
code = "\n@RenderSection(\"" + data.name + "\", true);\n";
} else {
code = "\n@RenderSection(\"" + data.name + "\" false);\n";
}
}
UmbEditor.Insert(code, '', self._opts.codeEditorElementId);
},
type: type
});
},
openQueryModal: function () {
/// <summary>callback used to display the modal dialog to insert a macro with parameters</summary>