Display bindings, history and variables in multiple lines on click

This commit is contained in:
Siteshwar Vashisht 2013-10-21 23:42:16 +05:30
parent 7709af7a62
commit 8279a0d477
4 changed files with 16 additions and 5 deletions

View file

@ -173,6 +173,7 @@ controllers.controller("historyController", function($scope, $http, $timeout) {
$scope.historySize = 0;
// Stores items which are yet to be added in history items
$scope.remainingItems = [];
$scope.selectedItems = [];
// Populate history items in parts
$scope.loadHistory = function() {
@ -190,6 +191,15 @@ controllers.controller("historyController", function($scope, $http, $timeout) {
$timeout($scope.loadHistory, 100);
}
$scope.selectItem = function(item) {
var index = $scope.selectedItems.indexOf(item);
if ( index >= 0) {
$scope.selectedItems.splice(index,1);
}
else {
$scope.selectedItems.push(item);
}
}
// Get history from server
$scope.fetchHistory = function() {
$http.get("/history/").success(function(data, status, headers, config) {

View file

@ -5,7 +5,7 @@
<table class="data_table">
<tbody>
<tr class="data_table_row" ng-repeat="binding in bindings | filterBinding:query">
<td class="data_table_cell no_overflow" style="text-align: right; padding-right: 30px;">{{ binding.command }}</td>
<td ng-class="{ data_table_cell: true, no_overflow: !binding._is_selected }" style="text-align: right; padding-right: 30px;" ng-click="binding._is_selected = !binding._is_selected">{{ binding.command }}</td>
<td class="data_table_cell no_overflow" style="text-align: left; padding-right: 30px;">{{ binding.binding }}</td>
</tr>
</tbody>

View file

@ -1,11 +1,11 @@
<div id="table_filter_container" style="display: block;">
<div id="table_filter_container">
<span ng-show="loadingText.length > 0"> {{ loadingText }} </span>
<input id="table_filter_text_box" class="filter_text_box text_box_transient" placeholder="Filter" ng-model="query">
</div>
<table class="data_table">
<tbody>
<tr ng-repeat="item in historyItems | filter:query">
<td class="history_text no_overflow">{{ item }}</td>
<td ng-class="{'history_text': true, 'no_overflow': selectedItems.indexOf(item) < 0}" ng-click="selectItem(item)">{{ item }}</td>
<td class="history_delete">
<a ng-click="deleteHistoryItem(item)">
<img class="delete_icon" src="delete.png">

View file

@ -1,4 +1,4 @@
<div id="table_filter_container" style="display: block;">
<div id="table_filter_container">
<input id="table_filter_text_box" class="filter_text_box text_box_transient" placeholder="Filter" ng-model="query">
</div>
@ -6,7 +6,8 @@
<tbody>
<tr class="data_table_row" ng-repeat="variable in variables | filterVariable:query">
<td class="data_table_cell no_overflow" style="text-align: right; padding-right: 30px;">{{ variable.name }}</td>
<td class="data_table_cell no_overflow" style="text-align: left; padding-right: 30px;">{{ variable.value }}</td>
<!-- Small hack to select/unselect variables -->
<td ng-class="{'data_table_cell': true, 'no_overflow': !variable._is_selected}" style="text-align: left; padding-right: 30px;" ng-click="variable._is_selected=!variable._is_selected">{{ variable.value }}</td>
</tr>
</tbody>
</table>