Skip to content

Commit

Permalink
Merge pull request #393 from EverythingMe/feature/post_to_create_a_query
Browse files Browse the repository at this point in the history
Fix: allow Unicode and other special chars in column names
  • Loading branch information
arikfr committed Mar 19, 2015
2 parents b8aefd2 + 407c5a8 commit 4b7561e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
16 changes: 6 additions & 10 deletions rd_ui/app/scripts/ng_smart_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,10 @@
column = scope.column,
row = scope.dataRow,
format = filter('format'),
getter = parse(column.map),
childScope;

//can be useful for child directives
scope.formatedValue = format(getter(row), column.formatFunction, column.formatParameter);
scope.formatedValue = format(row[column.map], column.formatFunction, column.formatParameter);

function defaultContent() {
//clear content
Expand Down Expand Up @@ -267,12 +266,11 @@
replace: true,
link: function (scope, element, attrs, ctrl) {
var form = angular.element(element.children()[1]),
input = angular.element(form.children()[0]),
getter = parse(scope.column.map);
input = angular.element(form.children()[0]);

//init values
scope.isEditMode = false;
scope.value = getter(scope.row);
scope.value = scope.row[scope.column.map];


scope.submit = function () {
Expand All @@ -285,7 +283,7 @@
};

scope.toggleEditMode = function () {
scope.value = getter(scope.row);
scope.value = scope.row[scope.column.map];
scope.isEditMode = scope.isEditMode !== true;
};

Expand Down Expand Up @@ -595,13 +593,11 @@
*/
this.updateDataRow = function (dataRow, propertyName, newValue) {
var index = scope.displayedCollection.indexOf(dataRow),
getter = parse(propertyName),
setter = getter.assign,
oldValue;
if (index !== -1) {
oldValue = getter(scope.displayedCollection[index]);
oldValue = scope.displayedCollection[index][propertyName];
if (oldValue !== newValue) {
setter(scope.displayedCollection[index], newValue);
scope.displayedCollection[index][propertyName] = newValue;
scope.$emit('updateDataRow', {item: scope.displayedCollection[index]});
}
}
Expand Down
18 changes: 0 additions & 18 deletions rd_ui/app/scripts/services/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,27 +243,9 @@
return parts[0];
};

var charConversionMap = {
'__pct': /%/g,
'_': / /g,
'__qm': /\?/g,
'__brkt': /[\(\)\[\]]/g,
'__dash': /-/g,
'__amp': /&/g,
'__dot': /\./g,
'__sl': /\//g,
'__fsl': /\\/g,
};

QueryResult.prototype.getColumnCleanName = function (column) {
var name = this.getColumnNameWithoutType(column);

if (name != '') {
_.each(charConversionMap, function(regex, replacement) {
name = name.replace(regex, replacement);
});
}

return name;
}

Expand Down

0 comments on commit 4b7561e

Please sign in to comment.