--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2011-03-09 17:02:09 -08:00
11 changed files with 132 additions and 55 deletions

View File

@@ -51,6 +51,12 @@ Website: http://clay.codeplex.com/
Copyright: Copyright (c) 2010 Louis Dejardin
License: MS-PL
CodeMirror
----------
Website: http://codemirror.net/2/
Copyright: Copyright (C) 2011 by Marijn Haverbeke
License: MIT
DLR
---
Website: http://dlr.codeplex.com

View File

@@ -5,12 +5,12 @@
}
<fieldset>
@Html.EditorFor(m => m.OnAdminMenu)
<label for="OnAdminMenu" class="forcheckbox">@T("Create an admin menu item to manage this {0}", Model.ContentItem.ContentType)</label>
<label for="OnAdminMenu" class="forcheckbox">@T("Show on admin menu")</label>
<div data-controllerid="OnAdminMenu" class="">
<label for="AdminMenuText">@T("Admin menu text")</label>
<label for="AdminMenuText">@T("Menu text")</label>
@Html.TextBoxFor(m => m.AdminMenuText, new { @class = "large text" })
<label for="AdminMenuPosition">@T("Admin menu position")</label>
<label for="AdminMenuPosition">@T("Position")</label>
@Html.TextBoxFor(m => m.AdminMenuPosition)
</div>
</fieldset>

View File

@@ -57,11 +57,15 @@ CodeMirror.defineMode("razor", function (config, parserConfig) {
}
// text mode
else if (ch == "@") {
state.tokenize = inRazor(inText);
return "razor-tag";
if (stream.peek() != "@") { // handle @@ escaping
state.tokenize = inRazor(inText);
return "razor-tag";
}
stream.next()
}
else {
stream.eatWhile(/[^&<]/);
stream.eatWhile(/[^&<@]/);
return null;
}
}
@@ -91,12 +95,12 @@ CodeMirror.defineMode("razor", function (config, parserConfig) {
return function (stream, state) {
var razor = false;
while (!stream.eol()) {
if (stream.next() == quote) {
state.tokenize = inTag;
if (stream.peek() == "@") {
state.tokenize = inRazorAttribute(quote);
break;
}
else if (stream.peek() == "@") {
state.tokenize = inRazor(inAttribute(quote), "xml-attribute");
else if (stream.next() == quote) {
state.tokenize = inTag;
break;
}
}
@@ -104,6 +108,14 @@ CodeMirror.defineMode("razor", function (config, parserConfig) {
};
}
function inRazorAttribute(quote) {
return function (stream, state) {
stream.eat("@");
state.tokenize = inRazor(inAttribute(quote), "xml-attribute");
return "razor-tag";
}
}
function inBlock(style, terminator) {
return function (stream, state) {
while (!stream.eol()) {
@@ -128,10 +140,10 @@ CodeMirror.defineMode("razor", function (config, parserConfig) {
return "razor-keyword";
}
else if (stream.match("{")) {
state.tokenize = inRazorBlock();
state.tokenize = inRazorBlock(1, nextState);
}
else {
stream.eatWhile(/[^\s\'\"\<]/);
stream.eatWhile(/[^\s\'\"<@]/);
state.tokenize = nextState;
}
@@ -156,33 +168,42 @@ CodeMirror.defineMode("razor", function (config, parserConfig) {
}
}
function inRazorBlock(nestedLevel) {
function inRazorBlock(nestedLevel, nextState) {
var nested = nestedLevel || 1;
return function (stream, state) {
while (!stream.eol()) {
// identify keywords
if (stream.eatWhile(/[a-zA-Z]/)) {
if (stream.eatWhile(/\w/)) {
state.tokenize = inRazorBlock(nested, nextState);
if (keywords[stream.current()]) {
state.tokenize = inRazorBlock(nested);
stream.eatSpace();
return "razor-keyword";
}
stream.next();
break;
}
if (stream.peek() == '"') {
state.tokenize = inRazorString(inRazorBlock(nested, nextState));
break;
}
if (stream.peek() == '{') nested++;
if (stream.peek() == '}') nested--;
if (nested == 0) {
state.tokenize = inRazorBlockEnd;
state.tokenize = inRazorBlockEnd(nextState);
break;
}
// eat keywords separators
if (stream.eatWhile(/^[a-zA-Z]/)) {
state.tokenize = inRazorBlock(nested);
stream.next();
return "razor";
if (stream.eatWhile(/[^\w{}\"]/)) {
stream.eatSpace();
state.tokenize = inRazorBlock(nested, nextState);
break;
}
stream.next();
@@ -192,10 +213,23 @@ CodeMirror.defineMode("razor", function (config, parserConfig) {
};
}
function inRazorBlockEnd(stream, state) {
stream.eat("}");
state.tokenize = inText;
return "razor-tag";
function inRazorBlockEnd(nextState) {
return function (stream, state) {
stream.eat("}");
state.tokenize = nextState;
return "razor-tag";
}
}
function inRazorString(nextState) {
return function (stream, state) {
// when in this state, the " is not read yet
stream.eat('"');
stream.eatWhile(/[^"]/);
stream.eat('"');
state.tokenize = nextState;
return "razor-string";
}
}
var curState, setStyle;

View File

@@ -71,7 +71,9 @@
if (wrapper.children('.content').children('div' + selector).children('.CodeMirror').length == 0) {
var textArea = wrapper.children('.content').children('div' + selector).children('textarea').get(0);
CodeMirror.fromTextArea(textArea, { mode: "razor", tabMode: "indent", height: "100%" });
if (textArea) {
CodeMirror.fromTextArea(textArea, { mode: "razor", tabMode: "indent", height: "100%", readOnly : true });
}
}
});

View File

@@ -9,3 +9,11 @@ span.xml-entity {color: #a22;}
span.razor {background-color: rgb(236, 242, 245)}
span.razor-tag {background-color: yellow;}
span.razor-keyword {color: blue; background-color: rgb(236, 242, 245)}
span.razor-string {color: rgb(163,21,21); background-color: rgb(236, 242, 245)}
.CodeMirror
{
font-family:Consolas, Monospace;
font-size:10pt;
line-height:12pt;
}

View File

@@ -36,8 +36,8 @@
.debug-shapes .shape-tracing .wrapper {
background:#FFF;
border:1px dotted #CA7230;
margin:5px;
/*border:1px dotted #CA7230;
margin:5px;*/
padding:0px;
display:inline-block;
@@ -139,14 +139,14 @@ ul.debuggerMenu { margin:8px 0 -8px 0; }
-moz-border-radius: 3px;
}
.meta .model div.name
.meta .model div.name, .meta ul.properties div.name
{
display:block;
float:left;
width:30%;
}
.meta .model ul
.meta .model ul, .meta ul.properties
{
padding:0;
margin-left:-15px;
@@ -154,12 +154,12 @@ ul.debuggerMenu { margin:8px 0 -8px 0; }
list-style-type:none;
}
.meta .model ul li
.meta .model ul li, .meta ul.properties li
{
padding-left:15px;
}
.meta .model h3
.meta .model h3, .meta ul.properties h3
{
margin:0;
padding:0;
@@ -183,14 +183,18 @@ h3:hover
background-image:url(images/menu-glyph.png);
}
.expando-glyph-container.closed .expando-glyph {
.expando-glyph-container.closed .expando-glyph
{
background-repeat:none;
background-image:url(images/menu-glyph.png);
background-position:0 3px;
}
.expando-glyph-container.closed .expando-glyph:hover {
background-image:url(images/menu-glyph.png);
}
.expando-glyph-container.closing .expando-glyph {
.expando-glyph-container.closing .expando-glyph
{
background-repeat:none;
-webkit-transition:all .2s ease-in-out;
-moz-transition:all .2s ease-in-out;
transition:all .2s ease-in-out;
@@ -198,7 +202,9 @@ h3:hover
-moz-transform:rotate(-90deg) translate(3px, -3px);
transform:rotate(-90deg) translate(3px, -3px);
}
.expando-glyph-container.opening .expando-glyph {
.expando-glyph-container.opening .expando-glyph
{
background-repeat:none;
-webkit-transition:all .2s ease-in-out;
-moz-transition:all .2s ease-in-out;
transition:all .2s ease-in-out;

View File

@@ -16,11 +16,38 @@
<div class="content">
<div class="shape">
Shape: @Model.ShapeType <br />
Definition: @Model.Definition <br />
Display Type: @(Model.DisplayType ?? "n/a")<br />
Position: @(Model.Position ?? "n/a") <br />
Placement Source: @(Model.PlacementSource ?? "n/a") <br />
<ul class="properties">
<li>
<h3>
<div class="name">Shape</div>
<div class="value">@Model.ShapeType</div>
</h3>
</li>
<li>
<h3>
<div class="name">Definition</div>
<div class="value">@Model.Definition</div>
</h3>
</li>
<li>
<h3>
<div class="name">Display Type</div>
<div class="value">@(String.IsNullOrEmpty((string)Model.DisplayType) ? T("n/a").Text : Model.DisplayType.ToString())</div>
</h3>
</li>
<li>
<h3>
<div class="name">Position</div>
<div class="value">@(String.IsNullOrEmpty((string)Model.Position) ? T("n/a").Text : Model.Position.ToString())</div>
</h3>
</li>
<li>
<h3>
<div class="name">Placement Source</div>
<div class="value">@(String.IsNullOrEmpty((string)Model.PlacementSource) ? T("n/a").Text : Model.PlacementSource.ToString())</div>
</h3>
</li>
</ul>
</div>
<div class="model" style="display:none">

View File

@@ -9,7 +9,7 @@
}
@using (Html.BeginFormAntiForgeryPost(Url.Action("Modules", "Gallery"))) {
<fieldset class="bulk-actions">
<fieldset class="bulk-actions bulk-actions-auto">
<label for="sourceId">@T("Feed:")</label>
<select id="sourceId" name="@Html.NameOf(m => m.Options.SourceId)">
@Html.SelectOption(Model.Options.SourceId, null, T("All feeds").ToString())
@@ -27,7 +27,7 @@
@Html.SelectOption(Model.Options.Order, PackagingExtensionsOrder.Alphanumeric, T("Alphanumeric").ToString())
</select>
<button id="apply-bulk-actions" type="submit">@T("Apply")</button>
<button id="apply-bulk-actions" class="apply-bulk-actions-auto" type="submit">@T("Apply")</button>
</fieldset>
<fieldset class="search-actions">

View File

@@ -9,7 +9,7 @@
}
@using (Html.BeginFormAntiForgeryPost(Url.Action("Themes", "Gallery"))) {
<fieldset class="bulk-actions">
<fieldset class="bulk-actions bulk-actions-auto">
<label for="sourceId">@T("Show")</label>
<select id="sourceId" name="@Html.NameOf(m => m.Options.SourceId)">
@Html.SelectOption(Model.Options.SourceId, null, T("All feeds").ToString())
@@ -27,7 +27,7 @@
@Html.SelectOption(Model.Options.Order, PackagingExtensionsOrder.Alphanumeric, T("Alphanumeric").ToString())
</select>
<button id="apply-bulk-actions" type="submit">@T("Apply")</button>
<button id="apply-bulk-actions" class="apply-bulk-actions-auto" type="submit">@T("Apply")</button>
</fieldset>
<fieldset class="search-actions">

View File

@@ -57,15 +57,9 @@
}
});
$(".bulk-actions").each(function () {
$("select").each(function () {
$(this).change(function () {
var self = $(this);
var form = self.closest("form");
// Submit form
form.submit();
});
});
$(".bulk-actions-auto select").change(function () {
// form.submit() would be better as it wouldn't rely on an id,
// but the form might rely on knowing which button was clicked.
$("#apply-bulk-actions").click();
});
})(jQuery);

View File

@@ -962,7 +962,7 @@ table.items th, table.items td {
.page-size-options select {
margin-top: 10px;
}
html.dyn #submit-pager, html.dyn #apply-bulk-actions { display:none; }
html.dyn #submit-pager, html.dyn .apply-bulk-actions-auto { display:none; }
.pager { list-style: none; padding: 0; margin: 12px 0 0 0;}
.pager li {
float: left;