Skip to content

Commit

Permalink
Added a default CSS style for MTAjaxModalContainer. And I updated the…
Browse files Browse the repository at this point in the history
… bindings in the example application to reflect that.
  • Loading branch information
johnnykahalawai authored and Pascal Robert committed Mar 16, 2012
1 parent 50c2ebc commit 4376a3b
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ContentBox : MTAjaxModalContainer {
label = "Click me to Show";
title = "Some Title";
useDefaultCSS = false;
}

InteralHrefBox : MTAjaxModalContainer {
Expand All @@ -9,6 +10,7 @@ InteralHrefBox : MTAjaxModalContainer {
label = "Click me to show";
showTitle = true;
title = "Loading from an Internal Href";
useDefaultCSS = false;
}

RepetitionBox: MTAjaxModalContainer {
Expand All @@ -18,6 +20,7 @@ RepetitionBox: MTAjaxModalContainer {
label = "edit";
showFooter = false;
showTitle = false;
useDefaultCSS = false;
varName = wordID;
}

Expand Down
3 changes: 2 additions & 1 deletion Frameworks/Ajax/MooTools/Components/MTAjaxModalContainer.api
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wodefinitions>
<wo class="MTAjaxModalContainer" wocomponentcontent="true"> </wo>
<wo class="MTAjaxModalContainer" wocomponentcontent="true"> <binding name="useDefaultCSS"/>
</wo>
</wodefinitions>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
import er.extensions.appserver.ERXWOContext;
import er.extensions.foundation.ERXMutableURL;

/*
* * @binding useDefaultCSS (boolean) defaults to true. Will load a default CSS file for the modal container.
*/

public class MTAjaxModalContainer extends AjaxDynamicElement {

private String _updateContainerID = null;
Expand Down Expand Up @@ -259,6 +263,7 @@ public NSDictionary createAjaxOptions(WOComponent component) {

@Override
protected void addRequiredWebResources(WOResponse response, WOContext context) {

MTAjaxUtils.addScriptResourceInHead(context, context.response(), "MooTools", MTAjaxUtils.MOOTOOLS_CORE_JS);
MTAjaxUtils.addScriptResourceInHead(context, context.response(), "MooTools", MTAjaxUtils.MOOTOOLS_MORE_JS);
MTAjaxUtils.addScriptResourceInHead(context, context.response(), "MooTools", "scripts/plugins/bootstrap/ui/Bootstrap.js");
Expand All @@ -267,11 +272,17 @@ protected void addRequiredWebResources(WOResponse response, WOContext context) {
MTAjaxUtils.addScriptResourceInHead(context, context.response(), "MooTools", "scripts/plugins/bootstrap/ui/Bootstrap.Popup.js");
MTAjaxUtils.addScriptResourceInHead(context, context.response(), "MooTools", "scripts/plugins/bootstrap/ui/CSSEvents.js");
MTAjaxUtils.addScriptResourceInHead(context, context.response(), "MooTools", MTAjaxUtils.MOOTOOLS_WONDER_JS);

Boolean useDefaultCSS = (Boolean)valueForBinding("useDefaultCSS", Boolean.TRUE, context.component());
if(useDefaultCSS) {
MTAjaxUtils.addStylesheetResourceInHead(context, context.response(), "MooTools", "scripts/plugins/bootstrap/modal/modal.css");
}

}

@Override
public WOActionResults handleRequest(WORequest request, WOContext context) {
System.out.println("Hello?");

WOComponent component = context.component();

WOResponse response = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
.modal-open .dropdown-menu {
z-index: 2050;
}
.modal-open .dropdown.open {
*z-index: 2050;
}
.modal-open .popover {
z-index: 2060;
}
.modal-open .tooltip {
z-index: 2070;
}
.modal-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1040;
background-color: #000000;
}
.modal-backdrop.fade {
opacity: 0;
}
.modal-backdrop, .modal-backdrop.fade.in {
opacity: 0.8;
filter: alpha(opacity=80);
}
.modal {
position: fixed;
top: 50%;
left: 50%;
z-index: 1050;
max-height: 500px;
overflow: auto;
width: 560px;
margin: -250px 0 0 -280px;
background-color: #ffffff;
border: 1px solid #999;
border: 1px solid rgba(0, 0, 0, 0.3);
*border: 1px solid #999;
/* IE6-7 */

-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
-webkit-background-clip: padding-box;
-moz-background-clip: padding-box;
background-clip: padding-box;
}
.modal.fade {
-webkit-transition: opacity .3s linear, top .3s ease-out;
-moz-transition: opacity .3s linear, top .3s ease-out;
-ms-transition: opacity .3s linear, top .3s ease-out;
-o-transition: opacity .3s linear, top .3s ease-out;
transition: opacity .3s linear, top .3s ease-out;
top: -25%;
}
.modal.fade.in {
top: 50%;
}
.modal-header {
padding: 9px 15px;
border-bottom: 1px solid #eee;
}
.modal-header .close {
margin-top: 2px;
}
.modal-body {
padding: 15px;
}
.modal-footer {
padding: 14px 15px 15px;
margin-bottom: 0;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
-webkit-border-radius: 0 0 6px 6px;
-moz-border-radius: 0 0 6px 6px;
border-radius: 0 0 6px 6px;
-webkit-box-shadow: inset 0 1px 0 #ffffff;
-moz-box-shadow: inset 0 1px 0 #ffffff;
box-shadow: inset 0 1px 0 #ffffff;
*zoom: 1;
}
.modal-footer:before, .modal-footer:after {
display: table;
content: "";
}
.modal-footer:after {
clear: both;
}
.modal-footer .btn {
float: right;
margin-left: 5px;
margin-bottom: 0;
}
.modal .close {
float: right;
font-size: 20px;
font-weight: bold;
line-height: 18px;
color: #000000;
text-shadow: 0 1px 0 #ffffff;
opacity: 0.2;
filter: alpha(opacity=20);
}

.modal .close:hover {
color: #000000;
text-decoration: none;
opacity: 0.4;
filter: alpha(opacity=40);
cursor: pointer;
}

.modal h3 {
color: #333333;
font-size: 18px;
font-weight: bold;
line-height: 27px;
margin: 0;
text-rendering: optimizelegibility;
}

0 comments on commit 4376a3b

Please sign in to comment.