New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create a plugin for admin? #459
Comments
Take a look at the sample plugin, it provides an example for this: https://github.com/pencilblue/pencilblue/blob/master/plugins/sample/sample.js#L45 |
My guess is that there's an error in your code to add the navigation item. Can you share your main plugin file (products.js)? |
When that happens there is usually an angular error associated. Do you see
|
Import.js /**
* CatalogImport
*
* @author Brian Hyder <brian@pencilblue.org>
* @copyright 2014 PencilBlue, LLC
*/
function CatalogImport(){}
/**
* Called when the application is being installed for the first time.
*
* @param cb A callback that must be called upon completion. cb(Error, Boolean).
* The result should be TRUE on success and FALSE on failure
*/
CatalogImport.onInstall = function(cb) {
cb(null, true);
};
/**
* Called when the application is uninstalling this plugin. The plugin should
* make every effort to clean up any plugin-specific DB items or any in function
* overrides it makes.
*
* @param cb A callback that must be called upon completion. cb(Error, Boolean).
* The result should be TRUE on success and FALSE on failure
*/
CatalogImport.onUninstall = function(cb) {
// Remove "sample" nav during uninstall
pb.AdminNavigation.remove("products");
cb(null, true);
};
/**
* Called when the application is starting up. The function is also called at
* the end of a successful install. It is guaranteed that all core PB services
* will be available including access to the core DB.
*
* @param cb A callback that must be called upon completion. cb(Error, Boolean).
* The result should be TRUE on success and FALSE on failure
*/
CatalogImport.onStartup = function(cb) {
/**
* Administration Navigation sample
*/
// Add a new top level node
pb.AdminNavigation.add({
id: "products",
title: "Products",
icon: "cogs",
href: "/admin/products",
access: ACCESS_USER,
children: [
{
id: "product_import",
title: "Import Products",
icon: "cog",
href: "/admin/products/import",
access: ACCESS_USER
}
]
});
// Add a child to the top level node "sample"
pb.AdminNavigation.addChild("products", {
id: "products_modify",
title: "Modify Products",
icon: "cog",
href: "/admin/products/modify",
access: ACCESS_USER
});
// Add a child to the top level node "sample"
pb.AdminNavigation.addChild("products", {
id: "products_create_catalog",
title: "Create Catalog",
icon: "cog",
href: "/admin/products/createcatalog",
access: ACCESS_USER
});
// Remove "sample_2"
//pb.AdminNavigation.remove("sample_2");
cb(null, true);
};
/**
* Called when the application is gracefully shutting down. No guarantees are
* provided for how much time will be provided the plugin to shut down.
*
* @param cb A callback that must be called upon completion. cb(Error, Boolean).
* The result should be TRUE on success and FALSE on failure
*/
CatalogImport.onShutdown = function(cb) {
cb(null, true);
};
//exports
module.exports = CatalogImport; |
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.15/$injector/modulerr?p0=pencilblueApp&p1=E…gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.15%2Fangular.min.js%3A17%3A431) Yes, there is a error in console, see the screenshot |
Yeah, looks like @brianhyder was right. Have you created an Angular controller for the page? |
No, Please can you help, I'm much interested in Pencilblue and wants to complete my work on it. |
Take a look at the Portfolio plugin's home page settings screen. That will give you an idea of how to create a custom admin screen for your plugin. |
Closed the issue, because we found what the problem was. You can still comment in this thread and we'll respond. |
Any way to debug and log the variables to console. |
One more question, How to create angularJS templates and is there any tutorials for it? |
|
How I can create a template to upload files in Admin Panel? |
This is a much larger question than templates.
|
Okay, Right now I am developing it on my local ubuntu machine and I want to import a csv file into the mongodb database and files needs to be saved into any folder under pencilblue. |
I also want to know How to save some values in a array to the database? |
Take a look at the DAO's save function |
I am working on an admin plugin where I am confused these part:
There is not much documents available for it, please help.
Thanks
Gaurav T
The text was updated successfully, but these errors were encountered: