Merged from 1.9.x.

This commit is contained in:
Daniel Stolt
2015-07-14 19:49:05 +01:00
12 changed files with 330 additions and 67 deletions

View File

@@ -88,6 +88,13 @@
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.Environment.Descriptor.ShellDescriptorCache">
<Properties>
<!-- Set Value="true" to disable shell descriptors cache (cache.dat). Recommended when using multiple instances. -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Services.ClientAddressAccessor"> <Component Type="Orchard.Services.ClientAddressAccessor">
<Properties> <Properties>
<!-- Set Value="true" to read the client host address from the specified HTTP header. --> <!-- Set Value="true" to read the client host address from the specified HTTP header. -->

View File

@@ -1,5 +1,4 @@
(function ($) { (function ($) {
var LayoutDesignerHost = function (element) { var LayoutDesignerHost = function (element) {
var self = this; var self = this;
this.element = element; this.element = element;
@@ -125,5 +124,16 @@
$(function () { $(function () {
var host = new LayoutDesignerHost($(".layout-designer")); var host = new LayoutDesignerHost($(".layout-designer"));
$(".layout-designer").each(function (e) {
var designer = $(this);
var dialog = designer.find(".layout-editor-help-dialog");
designer.find(".layout-editor-help-link").click(function (e) {
dialog.dialog({
modal: true,
width: 840
});
e.preventDefault();
});
});
}); });
})(jQuery); })(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,20 @@
@import "Variables.less"; @import "Variables.less";
.layout-editor-toolbar {
display: flex;
justify-content: space-between;
position: relative;
top: 10px;
.layout-editor-toolbar-group {
display: flex;
> li + li {
margin-left: 12px;
}
}
}
.layout-editor { .layout-editor {
display: flex; display: flex;
margin-top: 1em; margin-top: 1em;
@@ -32,3 +47,53 @@
background: #e8e8e8; background: #e8e8e8;
} }
} }
.layout-editor-help-dialog {
display: none;
.help-row {
&:before, &:after {
content: " "; // 1
display: table; // 2
}
&:after {
clear: both;
}
> .help-column-full, > .help-column-half {
margin: 0.5em 0;
}
> .help-column-half {
box-sizing: border-box;
float: left;
width: 50%;
&:nth-child(2n) {
padding-right: 10px;
clear: left;
}
}
+ .help-row {
margin-top: 1em;
}
}
code {
border-radius: 4px;
background-color: #f3f4f5;
padding: 2px 4px;
font-family: monospace;
}
p {
margin-bottom: 0.5em;
line-height: 1.6em;
}
table > tbody > tr > td:first-child {
padding-right: 10px;
}
}

View File

@@ -16,6 +16,7 @@
Script.Require("jQueryUI_Sortable"); Script.Require("jQueryUI_Sortable");
Script.Require("jQueryUI_Resizable"); Script.Require("jQueryUI_Resizable");
Script.Require("jQueryUI_Position"); Script.Require("jQueryUI_Position");
Script.Require("jQueryUI_Dialog");
Script.Require("TinyMce"); Script.Require("TinyMce");
Script.Require("Layouts.LayoutEditor"); Script.Require("Layouts.LayoutEditor");
Script.Include("jquery.deserialize.js"); Script.Include("jquery.deserialize.js");
@@ -35,11 +36,11 @@
angular angular
.module("LayoutEditor") .module("LayoutEditor")
.constant("environment", { .constant("environment", {
templateUrl: function(templateName) { templateUrl: function (templateName) {
return "@Url.Action("Get", "Template", new { area = "Orchard.Layouts" })" + "/" + templateName; return "@Url.Action("Get", "Template", new { area = "Orchard.Layouts" })" + "/" + templateName;
} }
}); });
(function() { (function () {
var editorConfig = JSON.parse(LayoutEditor.decode("@Html.Raw(Url.Encode(Model.ConfigurationData))")); var editorConfig = JSON.parse(LayoutEditor.decode("@Html.Raw(Url.Encode(Model.ConfigurationData))"));
var editorCanvasData = JSON.parse(LayoutEditor.decode("@Html.Raw(Url.Encode(Model.Data))")); var editorCanvasData = JSON.parse(LayoutEditor.decode("@Html.Raw(Url.Encode(Model.Data))"));
@@ -52,44 +53,170 @@
var contentType = Model.Content != null ? Model.Content.ContentItem.ContentType : default(string); var contentType = Model.Content != null ? Model.Content.ContentItem.ContentType : default(string);
} }
<div class="layout-designer" <fieldset>
data-modelstate-valid="@ViewData.ModelState.IsValid.ToString().ToLower()" <div class="layout-designer"
data-display-type="Design" data-modelstate-valid="@ViewData.ModelState.IsValid.ToString().ToLower()"
data-edit-url="@Url.Action("Edit", "Element", new { session = Model.SessionKey, contentId = contentId, contentType = contentType, area = "Orchard.Layouts" })" data-display-type="Design"
data-add-url="@Url.Action("Add", "Element", new {session = Model.SessionKey, contentId = contentId, contentType = contentType, area = "Orchard.Layouts"})" data-edit-url="@Url.Action("Edit", "Element", new { session = Model.SessionKey, contentId = contentId, contentType = contentType, area = "Orchard.Layouts" })"
data-add-direct-url="@Url.Action("CreateDirect", "Element", new { contentId = contentId, contentType = contentType, area = "Orchard.Layouts" })" data-add-url="@Url.Action("Add", "Element", new {session = Model.SessionKey, contentId = contentId, contentType = contentType, area = "Orchard.Layouts"})"
data-apply-template-url="@Url.Action("ApplyTemplate", "Layout", new { contentId = contentId, contentType = contentType, area = "Orchard.Layouts" })" data-add-direct-url="@Url.Action("CreateDirect", "Element", new { contentId = contentId, contentType = contentType, area = "Orchard.Layouts" })"
data-confirm-delete-prompt="@T("Are you sure you want to delete this element?")" data-apply-template-url="@Url.Action("ApplyTemplate", "Layout", new { contentId = contentId, contentType = contentType, area = "Orchard.Layouts" })"
data-editor-dialog-title-format="@T("$1 Properties")" data-confirm-delete-prompt="@T("Are you sure you want to delete this element?")"
data-editor-dialog-name="Layout" data-editor-dialog-title-format="@T("$1 Properties")"
data-anti-forgery-token="@Html.AntiForgeryTokenValueOrchard()" data-editor-dialog-name="Layout"
data-session-key="@Model.SessionKey"> data-anti-forgery-token="@Html.AntiForgeryTokenValueOrchard()"
data-session-key="@Model.SessionKey">
@Html.HiddenFor(m => m.SessionKey) @Html.HiddenFor(m => m.SessionKey)
@Html.HiddenFor(m => m.Data, new { @class = "layout-data-field" }) @Html.HiddenFor(m => m.Data, new { @class = "layout-data-field" })
<fieldset> <div class="layout-editor-toolbar">
<label>@T("Layout")</label> <ol class="layout-editor-toolbar-group">
<div class="group canvas-toolbar"> <li>
<div class="pull-right"> <label>@T("Layout")</label>
<ol class="group"> </li>
@if (Model.Templates.Any()) { </ol>
var options = Model.Templates.Select(x => new SelectListItem { Text = Html.ItemDisplayText(x).ToString(), Value = x.Id.ToString(CultureInfo.InvariantCulture), Selected = x.Id == Model.TemplateId }); <ol class="layout-editor-toolbar-group">
<li> <li>
<div class="template-picker"> <a class="layout-editor-help-link" href="#"><i class="fa fa-info-circle"></i> Clipboard, keyboard shortcuts, etc.</a>
<label> </li>
@T("Use existing layout:") @if (Model.Templates.Any()) {
@Html.DropDownListFor(x => x.TemplateId, options, T("(None)").Text) var options = Model.Templates.Select(x => new SelectListItem { Text = Html.ItemDisplayText(x).ToString(), Value = x.Id.ToString(CultureInfo.InvariantCulture), Selected = x.Id == Model.TemplateId });
</label> <li>
</div> <div class="template-picker">
</li> <label>
} @T("Use existing layout:")
</ol> @Html.DropDownListFor(x => x.TemplateId, options, T("(None)").Text)
</div> </label>
</div>
</li>
}
</ol>
</div> </div>
<div class="layout-editor-holder"> <div class="layout-editor-holder">
<orc-layout-editor model="window.layoutEditor" ng-app="LayoutEditor" /> <orc-layout-editor model="window.layoutEditor" ng-app="LayoutEditor" />
</div> </div>
</fieldset> @Display.DialogTemplate(Name: "Layout")
<div class="trash"></div> <div class="layout-editor-help-dialog" title="Layout editor help">
@Display.DialogTemplate(Name: "Layout") <div class="help-row">
</div> <h3>Clipboard</h3>
<div class="help-column-full">
<p>Elements (including containers) can be cut, copied and pasted using the standard clipboard shortcuts (<code>Ctrl+X</code> / <code>Ctrl+C</code> / <code>Ctrl-V</code> on Windows, <code>⌘+X</code> / <code>⌘+C</code> / <code>⌘+V</code> on Mac OS).</p>
<p>On browsers that support native clipboard events, clipboard operations can be performed across different layout editor instances, in different tabs or browser windows. Text content can also be pasted into other applications.</p>
<p>On other browsers, clipboard operations work only within the same layout editor instance.</p>
</div>
</div>
<div class="help-row">
<h3>Keyboard shortcuts</h3>
<div class="help-column-half">
<h4>Resizing columns</h4>
<table>
<tbody>
<tr>
<td><code>Alt+Left</code></td>
<td>Moves the left edge of the focused column left</td>
</tr>
<tr>
<td><code>Alt+Right</code></td>
<td>Moves the left edge of the focused column right</td>
</tr>
<tr>
<td><code>Shift+Left</code></td>
<td>Moves the right edge of the focused column left</td>
</tr>
<tr>
<td><code>Shift+Right</code></td>
<td>Moves the right edge of the focused column right</td>
</tr>
</tbody>
</table>
<p>The <code>Alt</code> and <code>Shift</code> keys can also be combined to move both edges simultaneously.</p>
</div>
<div class="help-column-half">
<h4>Focus</h4>
<table>
<tbody>
<tr>
<td><code>Up</code></td>
<td>Moves focus to the previous element (above)</td>
</tr>
<tr>
<td><code>Down</code></td>
<td>Moves focus to the next element (below)</td>
</tr>
<tr>
<td><code>Left</code></td>
<td>Moves focus to the previous column (to the left)</td>
</tr>
<tr>
<td><code>Right</code></td>
<td>Moves focus to the next column (to the right)</td>
</tr>
<tr>
<td><code>Alt+Up</code></td>
<td>Moves focus to the parent element</td>
</tr>
<tr>
<td><code>Alt+Down</code></td>
<td>Moves focus to the first child element</td>
</tr>
</tbody>
</table>
</div>
<div class="help-column-half">
<h4>Editing</h4>
<table>
<tbody>
<tr>
<td><code>Enter</code></td>
<td>Opens the content editor of the focused element</td>
</tr>
<tr>
<td><code>Space</code></td>
<td>Opens the properties popup of the focused element</td>
</tr>
<tr>
<td><code>Esc</code></td>
<td>Closes the properties popup of the focused element</td>
</tr>
<tr>
<td><code>Del</code></td>
<td>Deletes the focused element</td>
</tr>
</tbody>
</table>
</div>
<div class="help-column-half">
<h4>Moving</h4>
<table>
<tbody>
<tr>
<td><code>Ctrl+Up</code></td>
<td>Moves (reorders) the focused element up</td>
</tr>
<tr>
<td><code>Ctrl+Down</code></td>
<td>Moves (reorders) the focused element down</td>
</tr>
<tr>
<td><code>Ctrl+Left</code></td>
<td>Moves (reorders) the focused column left</td>
</tr>
<tr>
<td><code>Ctrl+Right</code></td>
<td>Moves (reorders) the focused column right</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="help-row">
<h3>Drag and drop</h3>
<section class="help-column-full">
<p>Drag any existing element to reorder within its parent.</p>
<p>Drag a new element from the toolbox and drop it within a compatible container.</p>
<p>Drag the left and right edges of a focused column to resize the column. By default any adjacent column will be attached and resized accordingly; holding down the <code>Alt</code> key while resizing unattaches from the adjacent column and instead modifies the offset between.</p>
</section>
</div>
</div>
</div>
</fieldset>

View File

@@ -58,7 +58,9 @@ namespace Orchard.Localization.Drivers {
protected override DriverResult Editor(LocalizationPart part, IUpdateModel updater, dynamic shapeHelper) { protected override DriverResult Editor(LocalizationPart part, IUpdateModel updater, dynamic shapeHelper) {
var model = new EditLocalizationViewModel(); var model = new EditLocalizationViewModel();
if (updater != null && updater.TryUpdateModel(model, TemplatePrefix, null, null)) {
// Content culture has to be set only if it's not set already.
if (updater != null && updater.TryUpdateModel(model, TemplatePrefix, null, null) && GetCulture(part) == null) {
_localizationService.SetContentCulture(part, model.SelectedCulture); _localizationService.SetContentCulture(part, model.SelectedCulture);
} }

View File

@@ -71,11 +71,12 @@ $(function () {
var listWidth = $('#media-library-main-list').width(); var listWidth = $('#media-library-main-list').width();
var listHeight = $('#media-library-main-list').height(); var listHeight = $('#media-library-main-list').height();
var itemSize = $('.thumbnail').first().width(); var itemWidth = $('.thumbnail').first().width();
var itemHeight = $('.thumbnail').first().height();
var draftText = $("#media-library").data("draft-text"); var draftText = $("#media-library").data("draft-text");
var itemsPerRow = Math.floor(listWidth / itemSize); var itemsPerRow = Math.floor(listWidth / itemWidth);
var itemsPerColumn = Math.ceil(listHeight / itemSize); var itemsPerColumn = Math.ceil(listHeight / itemHeight);
var pageCount = itemsPerRow * itemsPerColumn; var pageCount = itemsPerRow * itemsPerColumn;

View File

@@ -15,8 +15,8 @@
/* Component containers /* Component containers
----------------------------------*/ ----------------------------------*/
.ui-widget { .ui-widget {
font-family: Verdana,Arial,sans-serif; font-family: inherit;
font-size: 1.1em; font-size: inherit;
} }
.ui-widget .ui-widget { .ui-widget .ui-widget {
font-size: 1em; font-size: 1em;
@@ -25,7 +25,7 @@
.ui-widget select, .ui-widget select,
.ui-widget textarea, .ui-widget textarea,
.ui-widget button { .ui-widget button {
font-family: Verdana,Arial,sans-serif; font-family: inherit;
font-size: 1em; font-size: 1em;
} }
.ui-widget-content { .ui-widget-content {

File diff suppressed because one or more lines are too long

View File

@@ -153,7 +153,7 @@ namespace Orchard.ContentManagement {
/// <returns>The string representation of the value.</returns> /// <returns>The string representation of the value.</returns>
public static string ToString<T>(T value) { public static string ToString<T>(T value) {
var type = typeof(T); var type = typeof(T);
if (type == typeof(string)) { if (type == typeof(string) || type == typeof(char)) {
return Convert.ToString(value); return Convert.ToString(value);
} }
if ((!type.IsValueType || Nullable.GetUnderlyingType(type) != null) && if ((!type.IsValueType || Nullable.GetUnderlyingType(type) != null) &&
@@ -250,6 +250,9 @@ namespace Orchard.ContentManagement {
if (type == typeof(double)) return (T)(object)double.NegativeInfinity; if (type == typeof(double)) return (T)(object)double.NegativeInfinity;
throw new NotSupportedException(String.Format("Infinity not supported for type {0}", type.Name)); throw new NotSupportedException(String.Format("Infinity not supported for type {0}", type.Name));
} }
if (type == typeof(char) || type == typeof(char?)) {
return (T)(object)char.Parse(value);
}
if (type == typeof(int) || type == typeof(int?)) { if (type == typeof(int) || type == typeof(int?)) {
return (T)(object)int.Parse(value, CultureInfo.InvariantCulture); return (T)(object)int.Parse(value, CultureInfo.InvariantCulture);
} }

View File

@@ -20,7 +20,10 @@ namespace Orchard.Data.Migration.Schema {
dbType = DbType.Boolean; dbType = DbType.Boolean;
break; break;
default: default:
Enum.TryParse(Type.GetTypeCode(type).ToString(), true, out dbType); if(type == typeof(Guid))
dbType = DbType.Guid;
else
Enum.TryParse(Type.GetTypeCode(type).ToString(), true, out dbType);
break; break;
} }