Permalink
Browse files

Added ability to toggle a css class in the base control

  • Loading branch information...
1 parent d03d26f commit ac5032086d23a8aed46fe9e1c1838e7981452d48 @tablackmore committed Feb 28, 2011
Showing with 55 additions and 3 deletions.
  1. +6 −0 .project
  2. +7 −0 .pydevproject
  3. BIN build/yuicompressor-2.4.2.jar
  4. +18 −2 src/js/wui_controls_control.js
  5. +5 −0 test.py
  6. +1 −1 wui_mini_v0.1.js
  7. +18 −0 wui_v0.1.js
View
@@ -6,12 +6,18 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>org.python.pydev.PyDevBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>com.aptana.ide.core.unifiedBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.aptana.projects.webnature</nature>
+ <nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
View
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?eclipse-pydev version="1.0"?>
+
+<pydev_project>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
+</pydev_project>
View
0 build/yuicompressor-2.4.2.jar 100755 → 100644
No changes.
@@ -54,6 +54,23 @@ wui.controls.control = ( function() {
mainElement.className = result;
};
+ var toggleClass = function(className){
+ var i;
+ var exists = false;
+ for(i=0; i < classes.length; i++){
+ if(className === classes[i]){
+ exists = true;
+ break;
+ }
+ }
+ if(!exists){
+ addClass(className);
+ } else {
+ removeClass(className)
+ }
+ };
+
+
var addClass = function(className){
var i;
var exists = false;
@@ -90,6 +107,7 @@ wui.controls.control = ( function() {
return {
addClass: addClass,
removeClass: removeClass,
+ toggleClass: toggleClass,
clear: clear
}
}());
@@ -109,8 +127,6 @@ wui.controls.control = ( function() {
show: show,
hide: hide,
toggle: toggle,
- setWidth: setWidth,
- setHeight: setHeight,
setOnClick: setOnClick,
click: click,
css: css,
View
@@ -0,0 +1,5 @@
+def simple_app(environ, start_response):
+ status = '200 OK'
+ response_headers = [('Content-type','text/plain')]
+ start_response(status, response_headers)
+ return ['Hello world!\n']
View
Oops, something went wrong.
View
@@ -90,6 +90,23 @@ wui.controls.control = ( function() {
mainElement.className = result;
};
+ var toggleClass = function(className){
+ var i;
+ var exists = false;
+ for(i=0; i < classes.length; i++){
+ if(className === classes[i]){
+ exists = true;
+ break;
+ }
+ }
+ if(!exists){
+ addClass(className);
+ } else {
+ removeClass(className)
+ }
+ };
+
+
var addClass = function(className){
var i;
var exists = false;
@@ -126,6 +143,7 @@ wui.controls.control = ( function() {
return {
addClass: addClass,
removeClass: removeClass,
+ toggleClass: toggleClass,
clear: clear
}
}());

0 comments on commit ac50320

Please sign in to comment.