Skip to content

Commit

Permalink
cleaned up js in local files. started on DialogTaglib
Browse files Browse the repository at this point in the history
  • Loading branch information
swestfall committed Jun 16, 2011
1 parent b70f411 commit daa5fbc
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 148 deletions.
@@ -0,0 +1,10 @@
package grails.yui.widget.testApp

class DialogController {

def index = { }

def toolTip = {}

def simpleDialog = {}
}
Expand Up @@ -11,12 +11,6 @@
<head>
<title>Example of YUI AutoComplete with Local Data</title>
<meta name="layout" content="main"/>
<script type="text/javascript">
grails = {};
grails.yui = {};
grails.yui.components = {};
grails.yui.formatters = {};
</script>
</head>
<body>

Expand Down
Expand Up @@ -11,12 +11,6 @@
<head>
<title>Example of YUI AutoComplete with Local Data</title>
<meta name="layout" content="main"/>
<script type="text/javascript">
grails = {};
grails.yui = {};
grails.yui.components = {};
grails.yui.formatters = {};
</script>
</head>
<body>

Expand Down
Expand Up @@ -11,12 +11,6 @@
<head>
<title>Example of YUI AutoComplete with Local Data</title>
<meta name="layout" content="main"/>
<script type="text/javascript">
grails = {};
grails.yui = {};
grails.yui.components = {};
grails.yui.formatters = {};
</script>
</head>
<body>

Expand Down
Expand Up @@ -11,24 +11,6 @@
<head>
<title>Example of YUI DataTable with Scrolling Enabled</title>
<meta name="layout" content="main"/>
<script type="text/javascript">
window.cellMousedownEvent_Handler = function() {
//alert('cellMousedownEvent_Handler fired');
}
window.cellMouseoutEvent_Handler = function() {
//alert('cellMouesoutEvent_Handler fired');
}
grails = {};
grails.yui = {};
grails.yui.components = {};
grails.yui.formatters = {};
grails.yui.formatters.formatDate = function() {
}
</script>
</head>
<body>

Expand All @@ -45,17 +27,13 @@
[key: "lastChange", sortable: true, resizeable: true, formatter: '@grails.yui.formatters.formatDate']
]
def events = [
[type: 'cellMousedownEvent', fn: 'window.cellMousedownEvent_Handler', obj: '{}', scope: 'this'],
[type: 'cellMouseoutEvent', fn: 'window.cellMouseoutEvent_Handler', obj: '{}', scope: 'this']
]
def events = []
%>

<div style="height: width: 'auto'; padding: 20px;">
<yuiWidget:yuiDataTable
id="testTable"
columns="${columns}"
events="${events}"
namespace="grails.yui.components"
liquidWidth="${true}"
editable="${true}"
Expand Down
30 changes: 2 additions & 28 deletions grails-yui-widget-testApp/grails-app/views/dataTable/localData.gsp
Expand Up @@ -10,29 +10,7 @@
<html>
<head>
<title>Example of YUI DataTable with Local Data</title>
<meta name="layout" content="main"/>
<script type="text/javascript">
window.cellMousedownEvent_Handler = function() {
//alert('cellMousedownEvent_Handler fired');
}
window.cellMouseoutEvent_Handler = function() {
//alert('cellMouesoutEvent_Handler fired');
}
window.postRenderEvent_Handler = function(oEvent, oDataTable, oScope) {
debugger;
oDataTable.getTableEl().style.width = "100%";
}
grails = {};
grails.yui = {};
grails.yui.components = {};
grails.yui.formatters = {};
grails.yui.formatters.formatDate = function() {
}
</script>
<meta name="layout" content="main"/>s
</head>
<body>

Expand All @@ -49,11 +27,7 @@
[key: "lastChange", sortable: true, resizeable: true, formatter: '@grails.yui.formatters.formatDate']
]
//grails.yui.components.grailsYuiDataTable_testTable
def events = [
[type: 'cellMousedownEvent', fn: 'window.cellMousedownEvent_Handler', obj: '{}', scope: 'this'],
[type: 'cellMouseoutEvent', fn: 'window.cellMouseoutEvent_Handler', obj: '{}', scope: 'this']
]
def events = []
%>

<div style="height: width: 100%; padding: 20px;">
Expand Down
Expand Up @@ -11,28 +11,6 @@
<head>
<title>Example of YUI DataTable with Local Data</title>
<meta name="layout" content="main"/>
<script type="text/javascript">
window.cellMousedownEvent_Handler = function() {
//alert('cellMousedownEvent_Handler fired');
}
window.cellMouseoutEvent_Handler = function() {
//alert('cellMouesoutEvent_Handler fired');
}
window.postRenderEvent_Handler = function(oEvent, oDataTable, oScope) {
debugger;
oDataTable.getTableEl().style.width = "100%";
}
grails = {};
grails.yui = {};
grails.yui.components = {};
grails.yui.formatters = {};
grails.yui.formatters.formatDate = function() {
}
</script>
</head>
<body>

Expand All @@ -49,11 +27,7 @@
[key: "lastChange", sortable: true, resizeable: true, formatter: '@grails.yui.formatters.formatDate']
]
//grails.yui.components.grailsYuiDataTable_testTable
def events = [
[type: 'cellMousedownEvent', fn: 'window.cellMousedownEvent_Handler', obj: '{}', scope: 'this'],
[type: 'cellMouseoutEvent', fn: 'window.cellMouseoutEvent_Handler', obj: '{}', scope: 'this']
]
def events = []
%>

<div style="height: width: 100%; padding: 20px;">
Expand Down
Expand Up @@ -11,28 +11,6 @@
<head>
<title>Example of YUI DataTable with Local Data</title>
<meta name="layout" content="main"/>
<script type="text/javascript">
window.cellMousedownEvent_Handler = function() {
//alert('cellMousedownEvent_Handler fired');
}
window.cellMouseoutEvent_Handler = function() {
//alert('cellMouesoutEvent_Handler fired');
}
window.postRenderEvent_Handler = function(oEvent, oDataTable, oScope) {
debugger;
oDataTable.getTableEl().style.width = "100%";
}
grails = {};
grails.yui = {};
grails.yui.components = {};
grails.yui.formatters = {};
grails.yui.formatters.formatDate = function() {
}
</script>
</head>
<body>

Expand All @@ -49,11 +27,7 @@
[key: "lastChange", sortable: true, resizeable: true, formatter: '@grails.yui.formatters.formatDate']
]
//grails.yui.components.grailsYuiDataTable_testTable
def events = [
[type: 'cellMousedownEvent', fn: 'window.cellMousedownEvent_Handler', obj: '{}', scope: 'this'],
[type: 'cellMouseoutEvent', fn: 'window.cellMouseoutEvent_Handler', obj: '{}', scope: 'this']
]
def events = []
%>

<div style="height: width: 100%; padding: 20px;">
Expand Down
Expand Up @@ -11,24 +11,6 @@
<head>
<title>Example of YUI DataTable with Scrolling Enabled</title>
<meta name="layout" content="main"/>
<script type="text/javascript">
window.cellMousedownEvent_Handler = function() {
//alert('cellMousedownEvent_Handler fired');
}
window.cellMouseoutEvent_Handler = function() {
//alert('cellMouesoutEvent_Handler fired');
}
grails = {};
grails.yui = {};
grails.yui.components = {};
grails.yui.formatters = {};
grails.yui.formatters.formatDate = function() {
}
</script>
</head>
<body>

Expand All @@ -45,10 +27,7 @@
[key: "lastChange", sortable: true, resizeable: true, formatter: '@grails.yui.formatters.formatDate']
]
def events = [
[type: 'cellMousedownEvent', fn: 'window.cellMousedownEvent_Handler', obj: '{}', scope: 'this'],
[type: 'cellMouseoutEvent', fn: 'window.cellMouseoutEvent_Handler', obj: '{}', scope: 'this']
]
def events = []
%>

<div style="height: width: 'auto'; padding: 20px;">
Expand Down
18 changes: 18 additions & 0 deletions grails-yui-widget-testApp/grails-app/views/dialog/index.gsp
@@ -0,0 +1,18 @@
<%--
Created by IntelliJ IDEA.
User: swestfall
Date: 6/9/11
Time: 5:38 PM
To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<title>Collection of Dialog Example Pages</title>
<meta name="layout" content="main"/>
</head>
<body>
<a href="${createLink(controller: 'dialog', action: 'toolTip')}">Example of YUI ToolTip</a>
</body>
</html>
31 changes: 31 additions & 0 deletions grails-yui-widget-testApp/grails-app/views/dialog/simpleDialog.gsp
@@ -0,0 +1,31 @@
<%--
Created by IntelliJ IDEA.
User: swestfall
Date: 6/9/11
Time: 5:38 PM
To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<title>Example of YUI Simple Dialog</title>
<meta name="layout" content="main"/>

<style>
#ctx {
background: orange;
width: 200px;
height: 200px;
}
</style>

</head>
<body>

<div>Example of a YUI Simple Dialog</div>
<a href="http://developer.yahoo.com/yui/examples/container/simpledialog-quickstart.html">YUI Simple Dialog Sample Page</a>


</body>
</html>
9 changes: 8 additions & 1 deletion grails-yui-widget-testApp/grails-app/views/layouts/main.gsp
Expand Up @@ -31,11 +31,18 @@
<link type="text/css" rel="stylesheet" href="${resource(dir: 'js/yui-2.9.0/paginator/assets/skins/sam', file: 'paginator.css')}"/>
<script type="text/javascript" src="${resource(dir: 'js/yui-2.9.0/paginator', file: 'paginator-min.js')}"></script>

<!-- yui2 container resources -->
<link type="text/css" rel="stylesheet" href="${resource(dir: 'js/yui-2.9.0/container/assets/skins/sam', file: 'container.css')}"/>
<script type="text/javascript" src="${resource(dir: 'js/yui-2.9.0/container', file: 'container-min.js')}"></script>

<!-- yui2 button resources -->
<link type="text/css" rel="stylesheet" href="${resource(dir: 'js/yui-2.9.0/button/assets/skins/sam', file: 'button.css')}"/>
<script type="text/javascript" src="${resource(dir: 'js/yui-2.9.0/button', file: 'button-min.js')}"></script>

<link rel="stylesheet" href="${resource(dir: 'css', file: 'main.css')}"/>
<link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}" type="image/x-icon"/>

<yuiWidget:javascript />
<yuiWidget:javascript/>

</head>
<body class="yui-skin-sam">
Expand Down
Expand Up @@ -33,7 +33,7 @@
<local:liquidYuiDataTable
id="testTable"
columns="${columns}"
events="${events}"
events="${[]}"
namespace="grails.yui.components"
config="${[caption: 'DataTable Caption']}">
<yuiWidget:yuiLocalDataSource
Expand Down
4 changes: 4 additions & 0 deletions grails-yui-widget/grails-app/conf/ReadMe.txt
Expand Up @@ -30,3 +30,7 @@ AutoComplete


Dialog
1. Dialog
2. SimpleDialog
3. ToolTip

Expand Up @@ -100,7 +100,7 @@ class DataTableTagLib {
YAHOO.util.Event.onDOMReady(function(){
${internalTags}
${dataTableID} = new YAHOO.widget.ScrollingDataTable("${elementID}",
${util.toJSON(columns)}, ${dataSourceID}, ${util.toJSON(columns)});
${util.toJSON(columns)}, ${dataSourceID}, ${util.toJSON(config)});
grails.yui.util.applyConfig(${dataTableID}, ${util.toJSON(props)});
${util.buildEventStrings(dataTableID, events).join()}
});
Expand Down
@@ -0,0 +1,36 @@
package grails.yui.widget

class DialogTagLib {

static namespace = "yuiWidget";

def util = GrailsYuiWidgetUtil.getInstance();

def yuiToolTip = { attrs, body ->

//pull the config properties and set defaults
def id = attrs.remove('id')
def events = attrs.remove('events') ?: []
def config = attrs.remove('config') ?: [:]
def namespace = attrs.remove('namespace') ?: 'grails.yui.components'
def props = attrs.remove('props') ?: []

//set ids
def elementID = "grailsYuiToolTipEl_${id}"
def toolTipID = "${namespace}.grailsYuiToolTip_${id}"

out << """
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function(){
${toolTipID} = new YAHOO.widget.Tooltip("${elementID}", ${util.toJSON(config)});
grails.yui.util.applyConfig(${toolTipID}, ${util.toJSON(props)});
${util.buildEventStrings(toolTipID, events).join()}
});
</script>
"""
}

def yuiSimpleDialog = { attrs, body ->

}
}

0 comments on commit daa5fbc

Please sign in to comment.