diff --git a/README b/README index 12846a17..f6a8a73b 100644 --- a/README +++ b/README @@ -5,20 +5,20 @@ TOC: A. How to get (and contribute) JMVC 1. Start a new project in git. - + 2. Fork .... - http://github.com/jupiterjs/steal and + http://github.com/jupiterjs/steal and http://github.com/jupiterjs/jquerymx - + 3. Add steal and javascriptmvc as submodules of your project... git submodule add git@github.com:_YOU_/steal.git steal git submodule add git@github.com:_YOU_/jquerymx.git jquery - + * Notice javascriptmvc is under the jquery folder - + 4. Learn a little more about submodules ... http://johnleach.co.uk/words/archives/2008/10/12/323/git-submodules-in-n-easy-steps - + 5. Make changes in steal or jmvc, and push them back to your fork. - + 6. Make a pull request to your fork. diff --git a/build.js b/build.js index 1d840746..fb38e236 100644 --- a/build.js +++ b/build.js @@ -2,12 +2,12 @@ load('steal/rhino/rhino.js') -var i, fileName, cmd, +var i, fileName, cmd, plugins = [ - "class" , + "class" , "controller", { - plugin: "controller/subscribe", + plugin: "controller/subscribe", exclude: ["jquery/controller/controller.js", "jquery/class/class.js", "jquery/lang/lang.js", @@ -19,16 +19,16 @@ var i, fileName, cmd, "event/pause", "event/resize", { - plugin: "event/drag/limit", + plugin: "event/drag/limit", exclude: ["jquery/lang/vector/vector.js", "jquery/event/livehack/livehack.js", "jquery/event/drag/drag.js"]}, { - plugin: "event/drag/scroll", + plugin: "event/drag/scroll", exclude: ["jquery/dom/within/within.js", "jquery/dom/compare/compare.js", "jquery/event/drop/drop.js","jquery/lang/vector/vector.js", "jquery/event/livehack/livehack.js", "jquery/event/drag/drag.js"]}, { plugin: "event/drop", exclude: ["jquery/lang/vector/vector.js", "jquery/event/livehack/livehack.js", "jquery/event/drag/drag.js"]}, "event/hover", - "view/ejs", + "view/ejs", "dom/closest", "dom/compare", { @@ -37,7 +37,7 @@ var i, fileName, cmd, }, "dom/fixture", "dom/form_params", - "dom/within", + "dom/within", "dom/cur_styles", "model", { @@ -109,14 +109,14 @@ var plugin, exclude, fileDest, fileName; out: fileDest, exclude: exclude.length? exclude: false }) - - + + var outBaos = new java.io.ByteArrayOutputStream(); var output = new java.io.PrintStream(outBaos); runCommand("java", "-jar", "steal/build/scripts/compiler.jar", "--compilation_level", "SIMPLE_OPTIMIZATIONS", "--warning_level", "QUIET", "--js", fileDest, { output: output }); - + var minFileDest = fileDest.replace(".js", ".min.js") new steal.File(minFileDest).save(outBaos.toString()); } @@ -133,13 +133,13 @@ for (i = 0; i < plugins.length; i++) { } fileName = fileName || "jquery." + plugin.replace(/\//g, ".").replace(/dom\./, "").replace(/\_/, "") + ".js"; fileDest = "jquery/dist/" + fileName - // compress + // compress var outBaos = new java.io.ByteArrayOutputStream(); var output = new java.io.PrintStream(outBaos); runCommand("java", "-jar", "steal/build/scripts/compiler.jar", "--compilation_level", "SIMPLE_OPTIMIZATIONS", "--warning_level", "QUIET", "--js", fileDest, { output: output }); - + var minFileDest = fileDest.replace(".js", ".min.js") new steal.File(minFileDest).save(outBaos.toString()); print("***" + fileName + " pluginified and compressed") diff --git a/buildAll.js b/buildAll.js index 95b0a721..87f6ca13 100644 --- a/buildAll.js +++ b/buildAll.js @@ -9,13 +9,13 @@ load('steal/rhino/rhino.js') steal('steal/build/pluginify','steal/build/apps','steal/build/scripts').then( function(s){ var ignore = /\.\w+|test|generate|dist|qunit|fixtures|pages/ - + var plugins = [], /** * {"path/to/file.js" : ["file2/thing.js", ...]} */ files = {}; - + s.File('jquery').contents(function( name, type, current ) { if (type !== 'file' && !ignore.test(name)) { var folder = current+"/"+name; @@ -24,20 +24,20 @@ steal('steal/build/pluginify','steal/build/apps','steal/build/scripts').then( fu plugins.push(folder); steal.File(folder).contents(arguments.callee, folder) } - + //steal.File(path + "/" + (current ? current + "/" : "") + name).contents(arguments.callee, (current ? current + "/" : "") + name); } },"jquery"); - + // tell it to load all plugins into this page - + //steal.win().build_in_progress = true; print(" LOADING APP ") steal.build.open('steal/rhino/blank.html', { startFiles: plugins }, function(opener){ - + opener.each('js', function(options, text, stl){ print(options.rootSrc) var dependencies = files[options.rootSrc] = []; @@ -50,7 +50,7 @@ steal('steal/build/pluginify','steal/build/apps','steal/build/scripts').then( fu } } }) - + s.File("jquery/dist/standalone").mkdirs(); s.File("jquery/dist/standalone/dependencies.json").save($.toJSON(files)); //get each file ... @@ -74,9 +74,9 @@ steal('steal/build/pluginify','steal/build/apps','steal/build/scripts').then( fu s.File("jquery/dist/standalone/"+out+".js").save(content); s.File("jquery/dist/standalone/"+out+".min.js").save(compressor(content)); } - + }) - + /* var pageSteal = steal.build.open("steal/rhino/empty.html").steal, steals = pageSteal.total, @@ -91,21 +91,21 @@ steal('steal/build/pluginify','steal/build/apps','steal/build/scripts').then( fu print("123 " + depend.path); //depends(depend, steals); } - - + + } } }, all = function(c){ for(var i =0; i < steals.length; i++){ var pSteal =steals[i]; - + if(!pSteal.func){ c(pSteal) } - + } - + }; print(" LOADED, GETTING DEPENDS"); all(function(stl){ @@ -123,8 +123,8 @@ steal('steal/build/pluginify','steal/build/apps','steal/build/scripts').then( fu } } })*/ - - - + + + }) \ No newline at end of file diff --git a/class/class.html b/class/class.html index ef16143d..4a29f26e 100644 --- a/class/class.html +++ b/class/class.html @@ -6,7 +6,7 @@
@@ -16,12 +16,12 @@ diff --git a/controller/subscribe/subscribe.js b/controller/subscribe/subscribe.js index 26280343..4af33b2c 100644 --- a/controller/subscribe/subscribe.js +++ b/controller/subscribe/subscribe.js @@ -6,23 +6,23 @@ steal('jquery/controller', 'jquery/lang/openajax').then(function() { * @parent jQuery.Controller.static.processors * @plugin jquery/controller/subscribe * Adds OpenAjax.Hub subscribing to controllers. - * + * * $.Controller("Subscriber",{ * "recipe.updated subscribe" : function(called, recipe){ - * + * * }, * "todo.* subscribe" : function(called, todo){ - * + * * } * }) - * + * * You should typically be listening to jQuery triggered events when communicating between * controllers. Subscribe should be used for listening to model changes. - * + * * ### API - * + * * This is the call signiture for the processor, not the controller subscription callbacks. - * + * * @param {HTMLElement} el the element being bound. This isn't used. * @param {String} event the event type (subscribe). * @param {String} selector the subscription name diff --git a/controller/view/test/qunit/controller_view_test.js b/controller/view/test/qunit/controller_view_test.js index 506da897..ff66cfa6 100644 --- a/controller/view/test/qunit/controller_view_test.js +++ b/controller/view/test/qunit/controller_view_test.js @@ -1,10 +1,10 @@ steal('jquery/controller/view','jquery/view/micro','funcunit/qunit') //load qunit .then(function(){ - + module("jquery/controller/view"); - + test("this.view", function(){ - + $.Controller.extend("jquery.Controller.View.Test.Qunit",{ init: function() { this.element.html(this.view()) @@ -12,36 +12,36 @@ steal('jquery/controller/view','jquery/view/micro','funcunit/qunit') //load qun }) jQuery.View.ext = ".micro"; $("#qunit-test-area").append(""); - + new jquery.Controller.View.Test.Qunit( $('#cont_view') ); - + ok(/Hello World/i.test($('#cont_view').text()),"view rendered") }); - + test("test.suffix.doubling", function(){ - + $.Controller.extend("jquery.Controller.View.Test.Qunit",{ init: function() { this.element.html(this.view('init.micro')) } }) - + jQuery.View.ext = ".ejs"; // Reset view extension to default - equal(".ejs", jQuery.View.ext); - + equal(".ejs", jQuery.View.ext); + $("#qunit-test-area").append(""); - + new jquery.Controller.View.Test.Qunit( $('#suffix_test_cont_view') ); - + ok(/Hello World/i.test($('#suffix_test_cont_view').text()),"view rendered") }); - + test("complex paths nested inside a controller directory", function(){ $.Controller.extend("Myproject.Controllers.Foo.Bar"); - + var path = jQuery.Controller._calculatePosition(Myproject.Controllers.Foo.Bar, "init.ejs", "init") equals(path, "//myproject/views/foo/bar/init.ejs", "view path is correct") - + $.Controller.extend("Myproject.Controllers.FooBar"); path = jQuery.Controller._calculatePosition(Myproject.Controllers.FooBar, "init.ejs", "init") equals(path, "//myproject/views/foo_bar/init.ejs", "view path is correct") diff --git a/controller/view/test/qunit/qunit.js b/controller/view/test/qunit/qunit.js index 7873c312..b02f4079 100644 --- a/controller/view/test/qunit/qunit.js +++ b/controller/view/test/qunit/qunit.js @@ -2,4 +2,4 @@ steal('jquery/controller/view','jquery/view/micro') //load your app .then('funcunit/qunit') //load qunit .then("./controller_view_test.js") - + diff --git a/controller/view/view.js b/controller/view/view.js index 5c05345f..6ca99002 100644 --- a/controller/view/view.js +++ b/controller/view/view.js @@ -4,7 +4,7 @@ steal('jquery/controller', 'jquery/view').then(function( $ ) { }; jQuery.Controller._calculatePosition = function( Class, view, action_name ) { - + var classParts = Class.fullName.split('.'), classPartsWithoutPrefix = classParts.slice(0); classPartsWithoutPrefix.splice(0, 2); // Remove prefix (usually 2 elements) @@ -14,7 +14,7 @@ steal('jquery/controller', 'jquery/view').then(function( $ ) { path = hasControllers? jQuery.String.underscore(classParts[0]): jQuery.String.underscore(classParts.join("/")), controller_name = jQuery.String.underscore(classPartsWithoutPrefix.join('/')).toLowerCase(), suffix = (typeof view == "string" && /\.[\w\d]+$/.test(view)) ? "" : jQuery.View.ext; - + //calculate view if ( typeof view == "string" ) { if ( view.substr(0, 2) == "//" ) { //leave where it is @@ -66,17 +66,17 @@ steal('jquery/controller', 'jquery/view').then(function( $ ) { /** * @tag view * Renders a View template with the controller instance. If the first argument - * is not supplied, + * is not supplied, * it looks for a view in /views/controller_name/action_name.ejs. * If data is not provided, it uses the controller instance as data. * @codestart * TasksController = $.Controller.extend('TasksController',{ * click: function( el ) { * // renders with views/tasks/click.ejs - * el.html( this.view() ) + * el.html( this.view() ) * // renders with views/tasks/under.ejs * el.after( this.view("under", [1,2]) ); - * // renders with views/tasks/under.micro + * // renders with views/tasks/under.micro * el.after( this.view("under.micro", [1,2]) ); * // renders with views/shared/top.ejs * el.before( this.view("shared/top", {phrase: "hi"}) ); @@ -87,7 +87,7 @@ steal('jquery/controller', 'jquery/view').then(function( $ ) { * @return {String} the rendered result of the view. * @param {String} [view] The view you are going to render. If a view isn't explicity given * this function will try to guess at the correct view as show in the example code above. - * @param {Object} [data] data to be provided to the view. If not present, the controller instance + * @param {Object} [data] data to be provided to the view. If not present, the controller instance * is used. * @param {Object} [myhelpers] an object of helpers that will be available in the view. If not present * this controller class's "Helpers" property will be used. diff --git a/dom/closest/closest.js b/dom/closest/closest.js index 14ac24da..903e776d 100644 --- a/dom/closest/closest.js +++ b/dom/closest/closest.js @@ -6,16 +6,16 @@ steal('jquery/dom').then(function(){ * @function closest * @parent dom * @plugin jquery/dom/closest - * Overwrites closest to allow open > selectors. This allows controller + * Overwrites closest to allow open > selectors. This allows controller * actions such as: - * + * * ">li click" : function( el, ev ) { ... } */ var oldClosest = jQuery.fn.closest; jQuery.fn.closest = function(selectors, context){ var rooted = {}, res, result, thing, i, j, selector, rootedIsEmpty = true, selector, selectorsArr = selectors; if(typeof selectors == "string") selectorsArr = [selectors]; - + $.each(selectorsArr, function(i, selector){ if(selector.indexOf(">") == 0 ){ if(selector.indexOf(" ") != -1){ @@ -26,9 +26,9 @@ steal('jquery/dom').then(function(){ rootedIsEmpty = false; } }) - + res = oldClosest.call(this, selectors, context); - + if(rootedIsEmpty) return res; i =0; while(i < res.length){ diff --git a/dom/compare/compare.html b/dom/compare/compare.html index 83c356a8..2bbddbee 100644 --- a/dom/compare/compare.html +++ b/dom/compare/compare.html @@ -56,11 +56,11 @@