Kouhei Sutou
null+****@clear*****
Thu Oct 23 13:08:34 JST 2014
Kouhei Sutou 2014-10-23 13:08:34 +0900 (Thu, 23 Oct 2014) New Revision: f5962ba2397d461c2ad4e9dc711d140a294e43fd https://github.com/groonga/groonga-admin/commit/f5962ba2397d461c2ad4e9dc711d140a294e43fd Message: Add list show mode Modified files: app/scripts/controllers/table-search-controller.js app/styles/main.scss app/views/tables/search.html Modified: app/scripts/controllers/table-search-controller.js (+9 -1) =================================================================== --- app/scripts/controllers/table-search-controller.js 2014-10-23 11:57:08 +0900 (9b51a96) +++ app/scripts/controllers/table-search-controller.js 2014-10-23 13:08:34 +0900 (82790f7) @@ -29,6 +29,7 @@ angular.module('groongaAdminApp') } $scope.table = $routeParams.table; + $scope.recordsShowType = 'table'; $scope.columns = []; $scope.records = []; $scope.commandLine = ''; @@ -69,6 +70,13 @@ angular.module('groongaAdminApp') } $scope.nTotalRecords = response.nTotalRecords(); $scope.columns = response.columns(); - $scope.records = response.records(); + $scope.records = response.records().map(function(record) { + return record.map(function(value, index) { + return { + value: value, + column: $scope.columns[index] + }; + }); + }); }); }); Modified: app/styles/main.scss (+22 -6) =================================================================== --- app/styles/main.scss 2014-10-23 11:57:08 +0900 (31f8372) +++ app/styles/main.scss 2014-10-23 13:08:34 +0900 (7563311) @@ -68,12 +68,28 @@ body { } } -table.search-result { - @extend .table; - @extend .table-striped; - @extend .table-bordered; - @extend .table-hover; - @extend .table-condensed; +.table-search-result { + @extend .table-responsive; + + table { + @extend .table; + @extend .table-striped; + @extend .table-bordered; + @extend .table-hover; + @extend .table-condensed; + } +} + +.list-search-result { + @extend .container-fluid; + + table { + @extend .table; + @extend .table-striped; + @extend .table-bordered; + @extend .table-hover; + @extend .table-condensed; + } } /* Responsive: Portrait tablets and up */ Modified: app/views/tables/search.html (+22 -4) =================================================================== --- app/views/tables/search.html 2014-10-23 11:57:08 +0900 (59ea566) +++ app/views/tables/search.html 2014-10-23 13:08:34 +0900 (db706ae) @@ -24,8 +24,9 @@ <span id="n-total-records">{{nTotalRecords}} records</span> <span id="elapsed-time">({{elapsedTimeInMilliseconds | number : 3}}ms)</span> </p> - <div class="table-responsive"> - <table class="search-result"> + + <div class="table-search-result" ng-show="recordsShowType == 'table'"> + <table> <thead> <tr> <th ng-repeat="column in columns track by $index"> @@ -35,11 +36,28 @@ </thead> <tbody> <tr ng-repeat="record in records track by $index"> - <td ng-repeat="row in record track by $index"> - {{row}} + <td ng-repeat="element in record track by $index"> + {{element.value}} </td> </tr> </tbody> </table> </div> + + <div class="list-search-result" ng-show="recordsShowType == 'list'"> + <div class="row" ng-repeat="record in records track by $index"> + <div class="col-md12"> + <div class="table-responsive"> + <table> + <tbody> + <tr ng-repeat="item in record track by $index"> + <th>{{item.column.name}}</th> + <td>{{item.value}}</td> + </tr> + </tbody> + </table> + </div> + </div> + </div> + </div> </div> -------------- next part -------------- HTML����������������������������... ダウンロード