Example #1
0
    this.collection.each(function (criterion) {
      id = criterion.id;
      FilterView = FilterManager[id];

      if (!_.isUndefined(FilterView)) {
        filter = this.createSubView(FilterView, {
          model: criterion,
          el: this.$('.' + _.str.dasherize(id)),
          user: this.user
        });
        filter.render();
      }
    }, this);
 fileNgModuleName: function (module) {
     return _.str.dasherize(_.str.underscored(module)) + '.module.js';
 }
 fileNgControllerName: function (module) {
     return _.str.dasherize(_.str.underscored(module)) + '.controller.js';
 },
 trainItemName: function (item) {
     return _.str.dasherize(_.str.underscored(item));
 },
Example #5
0
 className: function () {
   return _.str.dasherize(this.model.id) + (this.model.isSortable() ? ' sortable' : '');
 },
Example #6
0
  grunt.registerTask('d', function (dname, dtype) {
//        delete option
    var rm = grunt.option('rm');

    rm = (rm === undefined) ? false : rm;


    var d = 'app/scripts/directives/';
    var directive = grunt.file.read('templates/dir.tpl');
    dname = 'sv-' + _.str.dasherize(dname);
    var dnames = dname.toLowerCase().split('-');

    var uname = '', lname = '', jname = '';
    var counter = 1;
    dnames.forEach(function (part) {
      var Upart = part.charAt(0).toUpperCase() + part.substring(1).toLowerCase();
      uname += Upart;
      lname += part.toLowerCase();
      if (counter++ == 1) {
        jname += part.toLowerCase();
      }
      else {
        jname += Upart;
      }

    });

      jnameDashed = _.str.dasherize(jname);


    var oname = dname;
    var directivef = directive.replace(/#uname#/g, uname).replace(/#lname#/g, lname)
      .replace(/#jname#/g, jname).replace(/#dname#/g, dname);

      var dirFileName = d + jnameDashed + '.js', directivef;
    if (!rm)
      grunt.file.write(dirFileName, directivef);
    else {
      delFileDep(dirFileName);
    }


    var reg = 'profile.directive("' + jname + '", ' + jname + ');\r\n';
////////////////


    // register
    var ref = '/// <reference path="directives/' + jname + '.js" />\r\n';
//        grunt.log.ok(ref);
//        grunt.log.ok(reg);
//        grunt.fail.fatal();


    var apath = 'app/scripts/app.js';
    var tpath = 'app/views/directives/' + oname + '.jade';
    var app = grunt.file.read(apath);
    //if (rm) {
    //  app = removeFromInside(app, ref);
    //  app = removeFromInside(app, reg);
    //}
    //else {
    //
    //  app = enterInside(app, '//#dir', reg);
    //  app = enterInside(app, '//#ref', ref);
    //}


    /////////////////// index/
    var ipath = 'app/index.html';
      var src = '<script src="scripts/directives/' + jnameDashed + '.js"></script>\r\n';
    var indf = grunt.file.read(ipath);
    //////////////////
    var directiveTemplate = 'div ' + oname + ' Template';
    /////////////////
    if (dtype && dtype == 'info') {
      var directiveTemplate = grunt.file.read('templates/dir-info.tpl');
    }

    if (dtype && dtype == 'edit') {
      var directiveTemplate = grunt.file.read('templates/dir-edit.tpl');
    }


/////
    if (rm) {
      indf = removeFromInside(indf, src);

    } else {

      indf = enterInside(indf, '<!-- links -->', src);
    }

    if (rm) {
      delFileDep(tpath);
    } else {
      grunt.file.write(tpath, directiveTemplate);
    }
    grunt.file.write(apath, app);
    grunt.file.write(ipath, indf);

  })
Example #7
0
  grunt.registerTask('c', function (cname) {
//        delete option
    var rm = grunt.option('rm');

    rm = (rm === undefined) ? false : rm;


//     C        //
    var d = 'app/scripts/controllers/';
    var t = '.js';
    var ctrl = grunt.file.read('templates/ctrl.tpl');

    var lname = cname;
    var name = lname.charAt(0).toUpperCase() + lname.substring(1);


    var ctrlr = ctrl.replace(/#name#/g, name).replace(/#lname#/g, lname);

////////////////


////////////////

    // register
    var ref = '/// <reference path="controllers/' + name + '.js" />\r\n';
    var reg = 'profile.controller("' + name + 'Ctrl", ' + name + 'Ctrl);\r\n';
    var state = '\t\t\t.state("' + _.str.dasherize(lname) + '", {\r\n' +
      '\t\t\t\turl: "/' + _.str.dasherize(lname) + '", \r\n' +
      '\t\t\t\tcontroller:"' + name + 'Ctrl",\r\n' +
      '\t\t\t\ttemplateUrl: "../views/' + _.str.dasherize(lname) + '.html"\r\n' +
      '\t\t\t})\r\n';

    var apath = 'app/scripts/app.js';
    var tpath = 'app/views/' + lname + '.jade';
    var app = grunt.file.read(apath);
    if (rm) {
      //app = removeFromInside(app, ref);
      //app = removeFromInside(app, reg);
      app = removeFromInside(app, state);
    }
    else {

      //app = enterInside(app, '//#ctrl', reg);
      //app = enterInside(app, '//#ref', ref);
      app = enterInside(app, '//#state', state);
    }


    /////////////////// index
    var ipath = 'app/index.html';
    var src = '<script src="scripts/controllers/' + name + '.js"></script>\r\n';
    var indf = grunt.file.read(ipath);
    //////////////////
    if (rm) {
      indf = removeFromInside(indf, src);

    } else {

      indf = enterInside(indf, '<!-- links -->', src);
    }

    if (rm) {
      var file = d + name + t;
      console.log(file);
      console.log(tpath);
      delFileDep(file);
      delFileDep(tpath);
      //grunt.file.delete(tpath);
    } else {
      grunt.file.write(d + name + t, ctrlr);
      grunt.file.write(tpath, grunt.file.read("templates/ctrl-template.tpl"));
    }
    grunt.file.write(apath, app);
    grunt.file.write(ipath, indf);

  })