Skip to content

Commit

Permalink
fix JavaScript minify problem
Browse files Browse the repository at this point in the history
  • Loading branch information
RyujiAMANO committed Jan 28, 2016
1 parent 463bc6e commit 7de53e0
Showing 1 changed file with 70 additions and 71 deletions.
141 changes: 70 additions & 71 deletions webroot/js/tags.js
Expand Up @@ -2,89 +2,88 @@
* Created by ryuji on 15/04/30.
*/
NetCommonsApp.controller('Tags.TagEdit',
function($scope, $filter, $http, filterFilter) {
var where = $filter('filter');
['$scope', '$filter', '$http', 'filterFilter',
function($scope, $filter, $http, filterFilter) {
var where = $filter('filter');

$scope.frameId = 0;
$scope.modelName = '';
$scope.tags = [];
$scope.frameId = 0;
$scope.modelName = '';
$scope.tags = [];


$scope.init = function(frameId, modelName, tags) {
if (tags) {
$scope.tags = tags;
}
$scope.modelName = modelName;
$scope.frameId = frameId;
};
$scope.init = function(frameId, modelName, tags) {
if (tags) {
$scope.tags = tags;
}
$scope.modelName = modelName;
$scope.frameId = frameId;
};

$scope.newTag = '';
$scope.newTag = '';


$scope.tagExist = function(newTag) {
var result = filterFilter($scope.tags, newTag);
return (result.length > 0);
};
$scope.tagExist = function(newTag) {
var result = filterFilter($scope.tags, newTag);
return (result.length > 0);
};

$scope.addTag = function() {
if ($scope.newTag.length > 0) {
if ($scope.tagExist($scope.newTag) === false) {
$scope.tags.push({
name: $scope.newTag
});
$scope.newTag = '';
$scope.showResult = false;
$scope.addTag = function() {
if ($scope.newTag.length > 0) {
if ($scope.tagExist($scope.newTag) === false) {
$scope.tags.push({
name: $scope.newTag
});
$scope.newTag = '';
$scope.showResult = false;
}
}
}
};
};

$scope.showResult = false;
$scope.showResultStyle = {};
$scope.tagSearchResult = [];
$scope.searchUrl = '/tags/tags/search/';
// タグ補完
$scope.change = function() {
if ($scope.newTag.length > 2) {
// 3文字以上になったら検索してみる
// タグ候補を検索
var url = $scope.searchUrl + $scope.frameId +
'/keyword:' + $scope.newTag + '/target:' + $scope.modelName +
'/' + Math.random() + '.json';
console.log(url);
$http.get(url).
success(function(data, status, headers, config) {
$scope.tagSearchResult = data;
if ($scope.tagSearchResult.length > 0) {
$scope.showResult = true;
} else {
$scope.showResult = false;
}

}).
error(function(data, status, headers, config) {
console.log(data);
});
//$scope.tagSearchResult = ["結果1", "結果2", "結果3"];
//
//$scope.showResultStyle = {display:"block"}
$scope.showResult = false;
$scope.showResultStyle = {};
$scope.tagSearchResult = [];
$scope.searchUrl = '/tags/tags/search/';
// タグ補完
$scope.change = function() {
if ($scope.newTag.length > 2) {
// 3文字以上になったら検索してみる
// タグ候補を検索
var url = $scope.searchUrl + $scope.frameId +
'/keyword:' + $scope.newTag + '/target:' + $scope.modelName +
'/' + Math.random() + '.json';
console.log(url);
$http.get(url).success(function(data, status, headers, config) {
$scope.tagSearchResult = data;
if ($scope.tagSearchResult.length > 0) {
$scope.showResult = true;
} else {
$scope.showResult = false;
}

}
};
}).error(function(data, status, headers, config) {
console.log(data);
});
//$scope.tagSearchResult = ["結果1", "結果2", "結果3"];
//
//$scope.showResultStyle = {display:"block"}

}
};

$scope.selectTag = function(selectedTag) {
$scope.newTag = selectedTag;
//$scope.showResultStyle = {display:"none"}
//$scope.showResult = false;
$scope.showResult = false;
};

// 任意の tag を削除
$scope.removeTag = function(currentTag) {
$scope.tags = where($scope.tags, function(tag) {
return currentTag !== tag;
});
};
$scope.selectTag = function(selectedTag) {
$scope.newTag = selectedTag;
//$scope.showResultStyle = {display:"none"}
//$scope.showResult = false;
$scope.showResult = false;
};

}
// 任意の tag を削除
$scope.removeTag = function(currentTag) {
$scope.tags = where($scope.tags, function(tag) {
return currentTag !== tag;
});
};
}
]
);

0 comments on commit 7de53e0

Please sign in to comment.