Kouhei Sutou
null+****@clear*****
Wed Dec 31 11:13:57 JST 2014
Kouhei Sutou 2014-12-31 11:13:57 +0900 (Wed, 31 Dec 2014) New Revision: f51138955683006520352138be253628bd1c58cb https://github.com/groonga/groonga-admin/commit/f51138955683006520352138be253628bd1c58cb Message: Add column page view Added files: app/scripts/controllers/column-show-controller.js app/views/columns/show.html Modified files: app/index.html app/scripts/app.js app/styles/main.scss Modified: app/index.html (+1 -0) =================================================================== --- app/index.html 2014-12-30 20:24:21 +0900 (2e69e83) +++ app/index.html 2014-12-31 11:13:57 +0900 (6b3aba5) @@ -85,6 +85,7 @@ <script src="scripts/controllers/top-controller.js"></script> <script src="scripts/controllers/table-show-controller.js"></script> <script src="scripts/controllers/table-search-controller.js"></script> + <script src="scripts/controllers/column-show-controller.js"></script> <!-- endbuild --> </body> </html> Modified: app/scripts/app.js (+4 -0) =================================================================== --- app/scripts/app.js 2014-12-30 20:24:21 +0900 (144b187) +++ app/scripts/app.js 2014-12-31 11:13:57 +0900 (fada4d7) @@ -33,6 +33,10 @@ angular templateUrl: 'views/tables/search.html', controller: 'TableSearchController' }) + .when('/tables/:table/columns/:column', { + templateUrl: 'views/columns/show.html', + controller: 'ColumnShowController' + }) .otherwise({ redirectTo: '/' }); Added: app/scripts/controllers/column-show-controller.js (+42 -0) 100644 =================================================================== --- /dev/null +++ app/scripts/controllers/column-show-controller.js 2014-12-31 11:13:57 +0900 (0a9b4f8) @@ -0,0 +1,42 @@ +'use strict'; + +/** + * @ngdoc function + * @name groongaAdminApp.controller:ColumnShowController + * @description + * # ColumnShowController + * Controller of the groongaAdminApp + */ +angular.module('groongaAdminApp') + .controller('ColumnShowController', [ + '$scope', '$routeParams', '$filter', 'schemaLoader', + function ($scope, $routeParams, $filter, schemaLoader) { + var schema; + + function initialize() { + $scope.column = { + name: $routeParams.column, + properties: [], + table: { + name: $routeParams.table, + columns: [] + } + }; + } + + initialize(); + schemaLoader() + .then(function(_schema) { + schema = _schema; + + var table = schema.tables[$scope.column.table.name]; + var column = table.columns[$scope.column.name]; + angular.forEach(column.properties, function(value, key) { + $scope.column.properties.push({name: key, value: value}); + }); + + angular.forEach(table.columns, function(value) { + $scope.column.table.columns.push(value); + }); + }); + }]); Modified: app/styles/main.scss (+2 -1) =================================================================== --- app/styles/main.scss 2014-12-30 20:24:21 +0900 (f6b757c) +++ app/styles/main.scss 2014-12-31 11:13:57 +0900 (662a45a) @@ -40,7 +40,8 @@ $icon-font-path: "../bower_components/bootstrap-sass-official/assets/fonts/boots .table-search-result, .table-properties, -.table-columns { +.table-columns, +.column-properties { @extend .table-responsive; table { Added: app/views/columns/show.html (+46 -0) 100644 =================================================================== --- /dev/null +++ app/views/columns/show.html 2014-12-31 11:13:57 +0900 (e3d9cd3) @@ -0,0 +1,46 @@ +<div class="container-fluid" ng-controller="ColumnShowController"> + <ol class="breadcrumb"> + <li><a href="#/">Top</a></li> + <li><a href="#/tables/">Tables</a></li> + <li><a href="#/tables/{{column.table.name}}">{{column.table.name}}</a></li> + <li><a href="#/tables/{{column.table.name}}/columns/">Columns</a></li> + <li class="active"> + <a href="#/tables/{{column.table.name}}/columns/{{column.name}}"> + {{column.name}} + </a> + </li> + </ol> + + <div class="sidebar"> + <div class="panel panel-default"> + <div class="panel-heading"> + <h2 class="panel-title">Columns</h2> + </div> + <div class="panel-body"> + <ul> + <li ng-repeat="c in column.table.columns track by $index"> + <a href="#/tables/{{column.table.name}}/columns/{{c.name}}"> + {{c.name}} + </a> + </li> + </ul> + </div> + </div> + </div> + + <div class="main-content"> + <div class="alert alert-warning" ng-show="message.length > 0"> + <p>{{message}}</p> + </div> + + <h2>{{column.name}}</h2> + <div class="column-properties"> + <table> + <tr ng-repeat="property in column.properties track by $index"> + <th>{{property.name}}</th> + <td>{{property.value}}</td> + </tr> + </table> + </div> + </div> +</div> -------------- next part -------------- HTML����������������������������... 下載