What's the max number of folders nested in an ExtJS Application? - model-view-controller

Well, turns out I have an ExtJS application. My views folder structure (if not the best), is this:
CE\app\view\process\Pre
OK, inside this folder, I created some components in some other folders, such as:
CE\app\view\process\Pre\StudentData\Tabs\GeneralDataTab.js
CE\app\view\process\Pre\StudentData\Tabs\AddressDataTab.js
CE\app\view\process\Pre\StudentData\Tabs\SchoolDataTab.js
CE\app\view\process\Pre\ParentData\Common\DataPanel.js
I define all of these componentes like this:
Ext.define("CE.view.process.Pre.StudentData.Tabs.GeneralDataTab", {
//some code to define and create my class
});
According to my research, I must name my class with the original folder structure, separared by dots.
Everything was fine while I was developing, but once I executed SENCHA CMD BUILD to test the results, I got this error:
Couldn't find "Tabs" of undefined/Couldn't find "Common" of undefined
I checked many times the paths, the names and everything was OK.
So, I remove the last folders (Tabs/Common):
CE\app\view\process\Pre\StudentData\GeneralDataTab.js
CE\app\view\process\Pre\StudentData\AddressDataTab.js
CE\app\view\process\Pre\StudentData\SchoolDataTab.js
CE\app\view\process\Pre\ParentData\DataPanel.js
And voila! My application was working.
Everything happened after I ran SENCHA CMD BUILD, 'cause not even with SENCHA CMD BUILD TESTING I got this error.
Do you know if I mustn't nest that much folder structure in a Sencha ExtJS app?
I know I can define paths in the paths configuration of the application. I tried this, and renamed my classes, but It didn't work either.
Do you thing I did something wrong? Is it a bug of Sencha CMD? I'm using the version 4.0.1.45.
Thank you in advance.
EDIT:
I would like you to let you know that I resolved this problem, and I hope this could help you too.
In fact the problem wasn't the nested folders but the name of the classes.
In my Application.js file I added a new path, like this:
paths: {
//...
'ProcessViews' : '../CE/app/view/process',
},
And now my classes name look like this:
Ext.define("ProcessViews.Pre.StudentData.Tabs.GeneralDataTab", {
//some code to define and create my class
});
And now I don't get any error message and the application runs OK.
So, looks like a class name can't be that long. If you need it to, then you should use a path defined in the Application.js to make a shorter name. :)
Thank you.

Related

Nightwatch.js - Can I have multiple folders for Custom Commands?

I'm fairly new at automated testing and setting up Nightwatch but I can already tell my Custom Commands folder is going to get unwieldy sooner or later. I've seen some example nightwatch.json files that use an array for the Custom Commands Path but I can seem to figure it out. Is it possible? Are the examples I've seen out of date?
Here's what I'm attempting to define in nightwatch.json:
"custom_commands_path" : [
"./custom-commands/",
"./custom-commands/login-signup/"
],
If I place my "loginFromHomepage" custom command file in the /custom-commands folder it'll run just fine. If I move the file to /custom-commands/login-signup I get an error stating that the "loginFromHomepage" commands doesn't exist.
What am I missing or not understanding here?
Thanks!
I normally separate my pages by folders. Try something like this
"custom_commands_path": [
"./customCommands/folder1",
"./customCommands/folder2",
"./customCommands/folder"
],
I just realized this was a problem with our setup. For some reason our runner.js file was looking at nightwatch.json AND nightwatch-dev.json for the nightwatchConfig.
I'm not clear on why we're using both but it appears my issue was because I was only adding the additional folders for the custom commands to nightwatch.json and not nightwatch-dev.json.

Dojo File Caching in Worklight

When using Dojo file caching with Worklight receiving a 404 Error when running in Simulator. It appears the file being loaded is not being copied from the common area to the device. Is there something else I need to define in my project to make that happen? There must be a convention and I wanted to follow it going forward as I expect to have more template files in the project.
My define statement in a .js file:
define(["dojo/_base/lang", "dijit/layout/ContentPane", "dojo/dom", "dojo/text!./templates/Order.html"], function(lang, ContentPane, dom, template){
...
var cp1 = new ContentPane({
title:"Order",
content: lang.replace(template, someJson)
}).placeAt("temp");
My folder structure:
In the common/js directory I have the above code in a .js file and I have a templates folder to keep the Order.html and I would expect to have other template files stored there in the future.
Error on the console:
GET http://localhost:10080/DojoProject/apps/services/preview/DojoApp/windowsphone8/1.0/default/layers/templates/Order.html 404 (Not Found)
It seems that the way you are specifying the path, browser tries to find the file in the "layers" folder which is sibling to "templates".
Have you tried to modify the "dojo/text!./templates/Order.html" to something like: "dojo/text!./../templates/Order.html" to navigate one level up, then go into the templates folder?
I'm not sure this will work, but I think it worths a try.

PHPUnit + CodeIgniter multiple objects with same name

I currently test my CodeIgniter app with phpunit by using CIUnit (https://bitbucket.org/kenjis/my-ciunit). The problem is that I have multiple controllers with the same name. I have a controller in the root controller directory named "Blog" and I have a controller called "Blog" in the controller/ajax/ directory.
The reason is to seperate all ajax requests from the main controller.
When I am running tests on both files, I get the following error:
PHP Fatal error: Cannot redeclare class Blog in ...
Well, I am not suprised I am getting this error.
What are my options to resolve this?
Prefix controllers in ajax directory with "ajax" (looks only a bit stupid url/ajax/ajax_blog)
Use namespaces (I guess I need to namespace codeigniter too then)
Create 3 seperate phpunit.xml files
This aren't really solutions I am looking for. Do I have any other options? Is it somehow possible to run each testsuite seperatly, but still in one command? Can I "clean" objects between testsuites? Anything else?
There are no other options except those you mentioned, as it is impossible to "unload" class definitions in PHP.
Naming two controllers the same is not a problem when you run CI normally, since only one controller is instantiated per request, but something that should be avoided.
If it is just the ajax-url you don't like, maybe override it in a route (in config/routes.php):
$routes['ajax/blog'] = 'ajax/ajax_blog';

file/page not found when uploaded online

I am working on a new module of existing live project. It is a website developed in PHP Zend Framework. New module is on admin side. It runs properly on my localhost/virtualhost.
When I uploaded it online with correct directory path it is found that one file is not found.
It is called like
www.example.com/admin/controllerName/actionName
All the actions works except one action that doesn't display anything and returns exception error mentioning that page or file not found.
What could be the issue? I have checked folders. If one action for the same controller works than why doesn't other. Both have their .phtml files in View section.
Help would be appreciated.
Would I be right if I guessed your local development environment was Windows?
It's probably a filename case sensitivity issue.
Assuming your request looks like
www.example.com/admin/fusionmaps/newpage
I'm not sure how you've setup your modules but if it's reasonably standard, you should have something like this (note the upper and lowercase characters)
application/modules/admin/controllers/FusionmapsController.php
The controller classname should be Admin_FusionmapsController with action public function newpageAction()
The view script should be at
application/modules/admin/views/scripts/fusionmaps/newpage.phtml

Referencing script files from MVC

I am having problems referencing scripts that should be included in my view, when I access the page using a different route my scripts fail.
The idea is that two routes actually point to the same action:
http://localhost/PaydayWebsite/registration
http://localhost/PaydayWebsite/organizations/p001/departments/vest/employees/chn/registration
where the second just include more params for my action. I have tried using
ResolveUrl, Url.Content and mvccontribs Html.ScriptInclude but neither seem to work. Any ideas?
You should be able to use Url.Content, but you'll need to make your path relative to the root of the application rather than the current path.
Use
Url.Content( "~/Content/Scripts/jquery-1.3.2.min.js" )
rather than
Url.Content( "../../Content/Scripts/jquery-1.3.2.min.js" )

Resources