Adding a solution for single button inline forms

- used initially in the multitenancy tenant list. should be used anywhere we have/need destructive "links"

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-05-12 14:47:30 -07:00
parent 849336d058
commit 3339cc94a8
3 changed files with 42 additions and 5 deletions

View File

@@ -20,10 +20,10 @@
var t = tenant; %>
<%=Html.DisplayFor(m => t, string.Format("ActionsFor{0}", tenant.State.CurrentState), "") %><%=_Encoded(" | ")%><%
} %>
<%=Html.ActionLink(T("Edit").ToString(), "edit", new {tenantName = tenant.Name, area = "Orchard.MultiTenancy"}, new {@class = "button"}) %><%
<%=Html.ActionLink(T("Edit").ToString(), "edit", new {tenantName = tenant.Name, area = "Orchard.MultiTenancy"}) %><%
if (!string.Equals(tenant.Name, "default", StringComparison.OrdinalIgnoreCase)) { //todo: (heskew) base this off the view model so logic on what can be removed and have its state changed stays in the controller
%><%=_Encoded(" | ")%>
<%=Html.ActionLink(T("Remove").ToString(), "delete", new {tenantName = tenant.Name, area = "Orchard.MultiTenancy"}, new {@class = "button"}) %><%
<%=Html.ActionLink(T("Remove").ToString(), "delete", new {tenantName = tenant.Name, area = "Orchard.MultiTenancy"}) %><%
} %>
</div>
</div>

View File

@@ -1,4 +1,5 @@
jQuery.fn.extend({
//todo: (heskew) make use of the autofocus attribute instead
jQuery.fn.extend({
helpfullyFocus: function() {
var _this = $(this);
var firstError = _this.find(".input-validation-error").first();
@@ -19,6 +20,7 @@
}
}
});
// collapsable areas - anything with a data-controllerid attribute has its visibility controlled by the id-ed radio/checkbox
(function() {
$("[data-controllerid]").each(function() {
var controller = $("#" + $(this).attr("data-controllerid"));
@@ -35,4 +37,19 @@
$("[name=" + controller.attr("name") + "]").click(function() { $("[name=" + $(this).attr("name") + "]").each($(this).toggleWhatYouControl); });
}
});
})();
// inline form link buttons (form.inline.link button) swapped out for a link that submits said form
(function() {
$("form.inline.link").each(function() {
var _this = $(this);
var link = $("<a href='.'/>");
var button = _this.children("button").first();
link.text(button.text())
.css("cursor", "pointer")
.click(function() { _this.submit(); return false; })
.unload(function() { _this = 0; });
_this.replaceWith(link);
_this.css({ "position": "absolute", "left": "-9999em" });
$("body").append(_this);
});
})();

View File

@@ -56,6 +56,11 @@ body {
min-width:94.6em; /* 946px */
padding:0;
}
/*todo: (heskew) find out why I need this...*/
button {
font-family:Segoe UI,Trebuchet,Arial,Sans-Serif;
font-size:1.01em;
}
body#preview {
min-width:0;
}
@@ -158,14 +163,21 @@ p .button { font-size:inherit; }
/* Links
----------------------------------------------------------*/
a, a:link, a:visited {
a, a:link, a:visited,
form.link button {
color:#1e5d7d;
text-decoration:none;
}
form.link button {
height:1.3em;
}
a:hover, a:active, a:focus {
color:#1e5d7d;
text-decoration:underline;
}
form.link button:hover {
border-bottom:1px solid #1e5d7d;
}
/* Header - Branding and Login
----------------------------------------------------------*/
@@ -466,11 +478,19 @@ button, .button, .button:link, .button:visited {
color:#2d2f25;
cursor:pointer;
text-align:center;
padding:0 .8em .1em .8em;
padding:0 .8em .1em;
}
button {
padding-top:.08em;
}
form.link button {
background:inherit;
border:0;
padding:0;
width:auto;
margin:-2px -3px 0;
}
.primaryAction, .primaryAction:link, .primaryAction:visited {
background:#4687ad;
border:1px solid #8f8f8f;