Skip to content

Commit

Permalink
Merge pull request codice-archives#68 from pklinef/split-property-names
Browse files Browse the repository at this point in the history
DDF-1178 Split property names on camel case and all non-word characters
  • Loading branch information
Jason Smith committed Apr 30, 2015
2 parents f85bcf0 + 6d4bd52 commit 8488e10
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion search-ui/standard/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"jquery-cookie": "1.4.1",
"jquery-ui": "1.10.4",
"jqueryui-timepicker-addon": "v1.4.5",
"lodash": "2.4.1",
"lodash": "3.7.0",
"marionette": "2.4.1",
"moment": "2.5.1",
"multiselect": "ehynds/jquery-ui-multiselect-widget#2489720d3b06cf52025d5b7bbd3187ea15a8253f",
Expand Down
12 changes: 6 additions & 6 deletions search-ui/standard/src/main/webapp/js/HandlebarsHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,15 @@ define([
}
},
propertyTitle: function (str) {
if(str && typeof str === "string") {
return str.split("-").join(" ").replace(/\w\S*/g, function (word) {
return word.charAt(0).toUpperCase() + word.substr(1);
});
if (_.isString(str)) {
return _.chain(str).words().map(function(word) {
return _.capitalize(word);
}).join(' ');
}
return str;
},
safeString: function (str) {
if(str && typeof str === "string") {
if (_.isString(str)) {
return new Handlebars.SafeString(str);
}
return str;
Expand All @@ -311,7 +311,7 @@ define([
return str.split('-').join(' ');
},
encodeString: function (str) {
if(str && typeof str === "string") {
if (_.isString(str)) {
return encodeURIComponent(str);
}
return str;
Expand Down
16 changes: 12 additions & 4 deletions search-ui/standard/src/main/webapp/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ require.config({
backbonecometd: 'lib/backbone-cometd/backbone.cometd.extension',
backboneundo: 'lib/Backbone.Undo.js/Backbone.Undo',
poller: 'lib/backbone-poller/backbone.poller',
underscore: 'lib/lodash/dist/lodash.underscore.min',
lodash: 'lib/lodash/dist/lodash.min',
underscore: 'lib/lodash/lodash.min',
marionette: 'lib/marionette/lib/backbone.marionette.min',
// TODO test combining
modelbinder: 'lib/backbone.modelbinder/Backbone.ModelBinder.min',
Expand Down Expand Up @@ -165,17 +164,26 @@ require.onError = function (err) {
}
};

require(['jquery',
require(['underscore',
'jquery',
'backbone',
'marionette',
'application',
'icanhaz',
'properties',
'js/HandlebarsHelpers',
'js/ApplicationHelpers'],
function ($, Backbone, Marionette, app, ich, properties) {
function (_, $, Backbone, Marionette, app, ich, properties) {
'use strict';

// Make lodash compatible with Backbone
var lodash = _.noConflict();
_.mixin({
'debounce': _.debounce || lodash.debounce,
'defer': _.defer || lodash.defer,
'pluck': _.pluck || lodash.pluck
});

var document = window.document;

//in here we drop in any top level patches, etc.
Expand Down

0 comments on commit 8488e10

Please sign in to comment.