Renames canvas editor into grid again

This commit is contained in:
per ploug
2014-10-07 13:39:18 +02:00
parent bba4db46d2
commit b6fd0489e2
32 changed files with 78 additions and 220 deletions

View File

@@ -133,7 +133,7 @@ namespace Umbraco.Core
/// <summary>
/// Alias for the grid datatype.
/// </summary>
public const string CanvasAlias = "Umbraco.Canvas";
public const string GridAlias = "Umbraco.Grid";
/// <summary>

View File

@@ -1,5 +1,5 @@
angular.module("umbraco")
.directive('canvasRte', function (tinyMceService, stylesheetResource, angularHelper, assetsService, $q, $timeout) {
angular.module("umbraco.directives")
.directive('gridRte', function (tinyMceService, stylesheetResource, angularHelper, assetsService, $q, $timeout) {
return {
scope: {
uniqueId: '=',
@@ -75,7 +75,7 @@ angular.module("umbraco")
}));
});
}else{
stylesheets.push("views/propertyeditors/canvas/config/canvas.default.rtestyles.css");
stylesheets.push("views/propertyeditors/grid/config/grid.default.rtestyles.css");
styleFormats = fallbackStyles;
}

View File

@@ -1,7 +1,7 @@
angular.module('umbraco.services')
.factory('canvasService', function ($http, $q){
.factory('gridService', function ($http, $q){
var configPath = "../config/canvas.editors.config.js";
var configPath = "../config/grid.editors.config.js";
var service = {
getGridEditors: function () {
return $http.get(configPath);

View File

@@ -1,8 +0,0 @@
<div
unique-id="control.$uniqueId"
value="control.value"
canvas-rte configuration="model.config.rte">
hey
</div>

View File

@@ -1,5 +1,5 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.Canvas.EmbedController",
.controller("Umbraco.PropertyEditors.Grid.EmbedController",
function ($scope, $rootScope, $timeout, dialogService) {
$scope.setEmbed = function(){
@@ -16,3 +16,4 @@ angular.module("umbraco")
}
}, 200);
});

View File

@@ -1,4 +1,4 @@
<div ng-controller="Umbraco.PropertyEditors.Canvas.EmbedController">
<div ng-controller="Umbraco.PropertyEditors.Grid.EmbedController">
<div class="usky-editor-placeholder" ng-click="setEmbed()" ng-if="control.value === null">
<i class="icon icon-movie-alt"></i>
@@ -7,3 +7,4 @@
<div ng-if="control.value" ng-bind-html-unsafe="control.value"></div>
</div>

View File

@@ -1,5 +1,5 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.Canvas.MacroController",
.controller("Umbraco.PropertyEditors.Grid.MacroController",
function ($scope, $rootScope, $timeout, dialogService, macroResource, macroService, $routeParams) {
$scope.title = "Click to insert macro";
@@ -40,3 +40,4 @@ angular.module("umbraco")
}
}, 200);
});

View File

@@ -1,4 +1,4 @@
<div ng-controller="Umbraco.PropertyEditors.Canvas.MacroController">
<div ng-controller="Umbraco.PropertyEditors.Grid.MacroController">
<div class="usky-editor-placeholder" ng-click="setMacro()">
<div ng-if="!preview">
@@ -14,3 +14,4 @@
</div>
</div>

View File

@@ -1,5 +1,5 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.Canvas.MediaController",
.controller("Umbraco.PropertyEditors.Grid.MediaController",
function ($scope, $rootScope, $timeout, dialogService) {
$scope.setImage = function(){
@@ -21,3 +21,4 @@ angular.module("umbraco")
}
}, 200);
});

View File

@@ -1,4 +1,4 @@
<div ng-controller="Umbraco.PropertyEditors.Canvas.MediaController">
<div ng-controller="Umbraco.PropertyEditors.Grid.MediaController">
<div class="usky-editor-placeholder" ng-click="setImage()" ng-if="control.value === null">
<i class="icon icon-picture"></i>
@@ -7,10 +7,10 @@
<div ng-if="control.value">
<img
ng-if="control.value"
ng-if="control.value"
ng-click="setImage()"
ng-src="{{control.value.image}}"
ng-src="{{control.value.image}}"
class="fullSizeImage" />
<input type="text" class="caption" ng-model="control.value.caption" placeholder="Image caption..."/>
</div>
</div>
</div>

View File

@@ -0,0 +1,5 @@
<div
unique-id="control.$uniqueId"
value="control.value"
grid-rte configuration="model.config.rte">
</div>

View File

@@ -1,5 +1,5 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.Canvas.TextStringController",
.controller("Umbraco.PropertyEditors.Grid.TextStringController",
function ($scope, $rootScope, $timeout, dialogService) {
$scope.adjustSize = function(ev){
@@ -15,3 +15,4 @@ angular.module("umbraco")
}
});

View File

@@ -1,4 +1,4 @@
<div ng-controller="Umbraco.PropertyEditors.Canvas.TextStringController">
<div ng-controller="Umbraco.PropertyEditors.Grid.TextStringController">
<textarea
class="textstring input-block-level" id="{{control.uniqueId}}_text"
ng-keyup="adjustSize($event)" ng-model="control.value"

View File

@@ -1,8 +1,8 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.CanvasController",
function ($scope, $http, assetsService, $rootScope, dialogService, canvasService, mediaResource, imageHelper, $timeout) {
.controller("Umbraco.PropertyEditors.GridController",
function ($scope, $http, assetsService, $rootScope, dialogService, gridService, mediaResource, imageHelper, $timeout) {
// Canvas status variables
// Grid status variables
$scope.currentRow = null;
$scope.currentCell = null;
$scope.currentToolsControl = null;
@@ -214,7 +214,7 @@ angular.module("umbraco")
// Init row value
row = $scope.initRow(row);
// Push the new row
// Push the new row
if(row){
section.rows.push(row);
}
@@ -490,13 +490,13 @@ angular.module("umbraco")
control.$editorPath = control.editor.view;
}else{
//use convention
control.$editorPath = "views/propertyeditors/canvas/editors/" + control.editor.view + ".html";
control.$editorPath = "views/propertyeditors/grid/editors/" + control.editor.view + ".html";
}
}
};
canvasService.getGridEditors().then(function(response){
gridService.getGridEditors().then(function(response){
$scope.availableEditors = response.data;
$scope.contentReady = true;

View File

@@ -1,4 +1,4 @@
<div ng-controller="Umbraco.PropertyEditors.CanvasController" class="usky-grid">
<div ng-controller="Umbraco.PropertyEditors.GridController" class="usky-grid">
<div ng-if="contentReady">
<!-- Template picker -->
@@ -125,7 +125,7 @@
</a>
</div>
<div ng-if="overlayMenu.show && overlayMenu.key == area.$uniqueId" ng-include="'views/propertyeditors/canvas/dialogs/additem.html'"></div>
<div ng-if="overlayMenu.show && overlayMenu.key == area.$uniqueId" ng-include="'views/propertyeditors/grid/dialogs/additem.html'"></div>
</div>
</div>
@@ -193,7 +193,7 @@
</a>
</div>
<div ng-show="overlayMenu.show && overlayMenu.key == control.$uniqueId" ng-include="'views/propertyeditors/canvas/dialogs/additem.html'"></div>
<div ng-show="overlayMenu.show && overlayMenu.key == control.$uniqueId" ng-include="'views/propertyeditors/grid/dialogs/additem.html'"></div>
</div>
</div>
@@ -250,3 +250,6 @@
</div>
</div>

View File

@@ -1,6 +1,6 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.CanvasPrevalueEditorController",
function ($scope, $http, assetsService, $rootScope, dialogService, mediaResource, canvasService, imageHelper, $timeout) {
.controller("Umbraco.PropertyEditors.GridPrevalueEditorController",
function ($scope, $http, assetsService, $rootScope, dialogService, mediaResource, gridService, imageHelper, $timeout) {
var emptyModel = {
columns: 12,
@@ -76,7 +76,7 @@ angular.module("umbraco")
$scope.model.value.templates.splice(index, 1);
};
$scope.closeTemplate = function(){
//clean-up
_.forEach($scope.currentTemplate.sections, function(section, index){
if(section.grid <= 0){
@@ -140,7 +140,7 @@ angular.module("umbraco")
$scope.model.value.layouts.splice(index, 1);
};
$scope.closeLayout = function(){
//clean-up
_.forEach($scope.currentLayout.areas, function(area, index){
if(area.grid <= 0){
@@ -150,7 +150,7 @@ angular.module("umbraco")
$scope.currentLayout = undefined;
};
/****************
area
@@ -187,14 +187,15 @@ angular.module("umbraco")
$scope.scaleDown = function(section){
var remove = (section.grid > 1) ? 1 : section.grid;
section.grid = section.grid-remove;
};
};
$scope.toggleCollection = function(collection, toggle){
if(toggle){
collection = [];
}else{
delete collection;
}
}
};
$scope.percentage = function(spans){
return ((spans / $scope.model.value.columns) * 100).toFixed(1);
};
@@ -226,12 +227,12 @@ angular.module("umbraco")
/****************
editors
*****************/
canvasService.getGridEditors().then(function(response){
gridService.getGridEditors().then(function(response){
$scope.editors = response.data;
});
/* init grid data */
/* init grid data */
if (!$scope.model.value || $scope.model.value === "" || !$scope.model.value.templates) {
$scope.model.value = emptyModel;
} else {
@@ -240,4 +241,4 @@ angular.module("umbraco")
}
}
})
});

View File

@@ -1,10 +1,10 @@
<div ng-controller="Umbraco.PropertyEditors.CanvasPrevalueEditorController" class="usky-grid usky-grid-configuration">
<div ng-controller="Umbraco.PropertyEditors.GridPrevalueEditorController" class="usky-grid usky-grid-configuration">
<div style="width: 600px">
<div class="control-group uSky-templates" ng-if="!currentTemplate">
<umb-control-group label="Canvas layouts" description="Layouts are the overall work area for the canvas editor, usually you only need one or two differnt layouts" hide-label="false">
<umb-control-group label="Grid layouts" description="Layouts are the overall work area for the grid editor, usually you only need one or two differnt layouts" hide-label="false">
<ul class="unstyled"
ui-sortable
@@ -297,7 +297,7 @@
</div>
<div style="max-width: 600px">
<umb-control-group label="Columns" hide-label="false">
<umb-control-group label="Columns" hide-label="false" description="Total combined number of columns in the grid layout">
<input type="text" class="" ng-model="model.value.columns" />
</umb-control-group>
</div>

View File

@@ -537,7 +537,7 @@
<Compile Include="Umbraco\TreeInit.aspx.designer.cs">
<DependentUpon>treeInit.aspx</DependentUpon>
</Compile>
<Content Include="Config\canvas.editors.config.js" />
<Content Include="Config\grid.editors.config.js" />
<Content Include="Umbraco\Config\Lang\cs.xml" />
<Content Include="Umbraco\Install\Legacy\loadStarterKits.ascx" />
<Content Include="Umbraco\ClientRedirect.aspx" />
@@ -2075,13 +2075,13 @@
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Views\Partials\Canvas\bootstrap3.cshtml" />
<Content Include="Views\Partials\Canvas\Editors\embed.cshtml" />
<Content Include="Views\Partials\Canvas\Editors\macro.cshtml" />
<Content Include="Views\Partials\Canvas\Editors\media.cshtml" />
<Content Include="Views\Partials\Canvas\Editors\rte.cshtml" />
<Content Include="Views\Partials\Canvas\Editors\textstring.cshtml" />
<Content Include="Views\Partials\Canvas\bootstrap2.cshtml" />
<Content Include="Views\Partials\Grid\bootstrap3.cshtml" />
<Content Include="Views\Partials\Grid\Editors\embed.cshtml" />
<Content Include="Views\Partials\Grid\Editors\macro.cshtml" />
<Content Include="Views\Partials\Grid\Editors\media.cshtml" />
<Content Include="Views\Partials\Grid\Editors\rte.cshtml" />
<Content Include="Views\Partials\Grid\Editors\textstring.cshtml" />
<Content Include="Views\Partials\Grid\bootstrap2.cshtml" />
<None Include="Web.Debug.config.transformed" />
<None Include="web.Template.Debug.config">
<DependentUpon>Web.Template.config</DependentUpon>

View File

@@ -1,3 +0,0 @@
@model dynamic
@using Umbraco.Web.Templates
@Html.Raw(Model.value)

View File

@@ -1,17 +0,0 @@
@inherits UmbracoViewPage<dynamic>
@using Umbraco.Web.Templates
@if (Model.value != null)
{
string macroAlias = Model.value.macroAlias.ToString();
ViewDataDictionary parameters = new ViewDataDictionary();
foreach (dynamic mpd in Model.value.macroParamsDictionary)
{
parameters.Add(mpd.Name, mpd.Value);
}
<text>
@Umbraco.RenderMacro(macroAlias, parameters)
</text>
}

View File

@@ -1,13 +0,0 @@
@model dynamic
@using Umbraco.Web.Templates
@if (Model.value != null)
{
<div class="thumbnail">
<img src="@Model.value.image" alt="@Model.value.caption">
</div>
if (Model.value.caption != null)
{
<p class="caption">@Model.value.caption</p>
}
}

View File

@@ -1,4 +0,0 @@
@model dynamic
@using Umbraco.Web.Templates
@Html.Raw(TemplateUtilities.ParseInternalLinks(Model.value.ToString()))

View File

@@ -1,20 +0,0 @@
@model dynamic
@using Umbraco.Web.Templates
@if (Model.editor.config.markup != null)
{
string markup = Model.editor.config.markup.ToString();
markup = markup.Replace("#value#", Model.value.ToString());
markup = markup.Replace("#style#", Model.editor.config.style.ToString());
<text>
@Html.Raw(markup)
</text>
}
else
{
<text>
<div style="@Model.editor.config.style">@Model.value</div>
</text>
}

View File

@@ -1,47 +0,0 @@
@inherits UmbracoViewPage<dynamic>
@using Umbraco.Web.Templates
@using Newtonsoft.Json.Linq;
@if (Model != null && !string.IsNullOrEmpty(Model.ToString()))
{
var onlyOneColumn = Model.sections != null ? ((System.Collections.ICollection)Model.sections).Count : 0;
<div class="uSky-grid @(onlyOneColumn > 1 ? "container-fluid" : "")">
<div class="row-fluid clearfix">
@foreach (var s in Model.sections)
{
<div class="@("span" + s.grid)">
@foreach (var row in s.rows)
{
<div class="gridrow_@row.uniqueId" >
<div>
<div class="row-fluid clearfix">
@foreach (var area in row.areas)
{
<div class="@("span" + area.grid)">
@foreach (var control in area.controls)
{
if (control != null && control.editor != null && control.editor.view != null)
{
string editor = "canvas/editors/" + control.editor.view.ToString();
<text>
@Html.Partial(editor, (object)control)
</text>
}
}
</div>
}
</div>
</div>
</div>
}
</div>
}
</div>
</div>
}

View File

@@ -1,45 +0,0 @@
@inherits UmbracoViewPage<dynamic>
@using Umbraco.Web.Templates
@if (Model != null && !string.IsNullOrEmpty(Model.ToString()))
{
var onlyOneColumn = Model.sections != null ? ((System.Collections.ICollection)Model.sections).Count : 0;
<div class="uSky-grid @(onlyOneColumn > 1 ? "container" : "")">
<div class="row clearfix">
@foreach (var s in Model.sections)
{
<div class="col-md-@s.grid column">
@foreach (var row in s.rows)
{
<div class="gridrow_@row.uniqueId" >
<div class="container">
<div class="row clearfix">
@foreach (var area in row.areas)
{
<div class="col-md-@area.grid column">
@foreach (var control in area.controls)
{
if (control != null && control.editor != null && control.editor.view != null)
{
string editor = "canvas/editors/" + control.editor.view.ToString();
<text>
@Html.Partial(editor, (object)control)
</text>
}
}
</div>
}
</div>
</div>
</div>
}
</div>
}
</div>
</div>
}

View File

@@ -12,27 +12,27 @@ using Umbraco.Web.Mvc;
namespace Umbraco.Web
{
public static class CanvasTemplateExtensions
public static class GridTemplateExtensions
{
public static MvcHtmlString RenderCanvas(this IPublishedProperty property, string framework = "bootstrap3")
public static MvcHtmlString GetGridHtml(this IPublishedProperty property, string framework = "bootstrap3")
{
var view = "Canvas/" + framework;
var view = "Grid/" + framework;
return new MvcHtmlString(renderPartialViewToString(view, property.Value));
}
public static MvcHtmlString RenderCanvas(this IPublishedContent contentItem)
public static MvcHtmlString GetGridHtml(this IPublishedContent contentItem)
{
return RenderCanvas(contentItem, "bodyText", "bootstrap3");
return GetGridHtml(contentItem, "bodyText", "bootstrap3");
}
public static MvcHtmlString RenderCanvas(this IPublishedContent contentItem, string propertyAlias)
public static MvcHtmlString GetGridHtml(this IPublishedContent contentItem, string propertyAlias)
{
return RenderCanvas(contentItem, propertyAlias, "bootstrap3");
return GetGridHtml(contentItem, propertyAlias, "bootstrap3");
}
public static MvcHtmlString RenderCanvas(this IPublishedContent contentItem, string propertyAlias, string framework)
public static MvcHtmlString GetGridHtml(this IPublishedContent contentItem, string propertyAlias, string framework)
{
var view = "Canvas/" + framework;
var view = "Grid/" + framework;
var model = contentItem.GetProperty(propertyAlias).Value;
return new MvcHtmlString(renderPartialViewToString(view, model));

View File

@@ -7,8 +7,8 @@ using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PropertyEditors
{
[PropertyEditor(Core.Constants.PropertyEditors.CanvasAlias, "Canvas", "canvas", HideLabel=true, IsParameterEditor = false, ValueType="JSON")]
public class CanvasPropertyEditor : PropertyEditor
[PropertyEditor(Core.Constants.PropertyEditors.GridAlias, "Grid layout", "grid", HideLabel=true, IsParameterEditor = false, ValueType="JSON")]
public class GridPropertyEditor : PropertyEditor
{
/// <summary>
/// Overridden to ensure that the value is validated
@@ -23,14 +23,14 @@ namespace Umbraco.Web.PropertyEditors
protected override PreValueEditor CreatePreValueEditor()
{
return new canvasPreValueEditor();
return new gridPreValueEditor();
}
}
internal class canvasPreValueEditor : PreValueEditor
internal class gridPreValueEditor : PreValueEditor
{
[PreValueField("items", "Canvas", "views/propertyeditors/canvas/canvas.prevalues.html", Description = "Canvas configuration")]
[PreValueField("items", "Grid", "views/propertyeditors/grid/grid.prevalues.html", Description = "Grid configuration")]
public string Items { get; set; }
[PreValueField("rte", "Rich text editor", "views/propertyeditors/rte/rte.prevalues.html", Description = "Rich text editor configuration")]

View File

@@ -307,7 +307,7 @@
<Compile Include="Editors\PackageInstallController.cs" />
<Compile Include="Editors\TemplateController.cs" />
<Compile Include="Editors\CanvasDesignerController.cs" />
<Compile Include="CanvasTemplateExtensions.cs" />
<Compile Include="GridTemplateExtensions.cs" />
<Compile Include="Models\PackageInstallModel.cs" />
<Compile Include="Models\ContentEditing\DataTypeBasic.cs" />
<Compile Include="Models\ContentEditing\MemberBasic.cs" />
@@ -379,7 +379,7 @@
<Compile Include="Mvc\NotFoundHandler.cs" />
<Compile Include="Mvc\PreRenderViewActionFilterAttribute.cs" />
<Compile Include="Mvc\RedirectToUmbracoUrlResult.cs" />
<Compile Include="PropertyEditors\CanvasPropertyEditor.cs" />
<Compile Include="PropertyEditors\GridPropertyEditor.cs" />
<Compile Include="Mvc\UmbracoVirtualNodeByIdRouteHandler.cs" />
<Compile Include="PropertyEditors\ValueConverters\MacroContainerValueConverter.cs" />
<Compile Include="PropertyEditors\TagsDataController.cs" />