Skip to content
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

adding js to change view with header_lines doesnt work #94

Open
jaideepdas opened this issue May 9, 2014 · 0 comments
Open

adding js to change view with header_lines doesnt work #94

jaideepdas opened this issue May 9, 2014 · 0 comments

Comments

@jaideepdas
Copy link

I am trying to add custom js file to add some jquery functionality but its not working, I have tried:

model.header_lines = [
   '<script src="/js/songs.js"></script>',
   '<style href="/css/songs.css"></style>'
];

and

model.static = ['/js/songs.js']

but none of them works.

Following is my index.js file in models dir. I have copied it from the classic example.

var path = require('path'),
    fs = require('fs'),
    mongoose = require('mongoose'),
    files = fs.readdirSync(__dirname);

files.forEach(function(file) {
    var name = path.basename(file, '.js');
    if (name === 'index')
        return;

    var mod = require('./' + name);
    if (mod.model)
        module.exports[name] = mod;
    else
        module.exports[name] = mongoose.model(name, mod);
});

My app file formage bits:

var formage_options = {user: require('./models').user,
    customer: require('./models').customer,
    social_auth: require('./models').social_auth,
    site_category: require('./models').site_category,
    store_category: require('./models').store_category,
    brand: require('./models').brand,
    bank: require('./models').bank,
    card: require('./models').card,
    store: require('./models').store,
    affiliate: require('./models').affiliate,
    deal_offer: require('./models').deal_offer,
    coupon: require('./models').coupon,
    category_mapping: require('./models').category_mapping,
    cash_back: require('./models').cash_back,
    affiliate_store: require('./models').affiliate_store,
    bank_card: require('./models').bank_card};

formage_options.deal_offer.header_lines = ['<script src="/javascripts/admin/deal_offer.js"></script>'];

    require('formage').init(app, express, formage_options, {
        title: 'Admin',
        root: '/admin',
        default_section: 'main',
        username: 'admin',
        password: 'admin',
        admin_users_gui: true
    });

I want to put some custom js functions for the change form view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant