Admin can list enterprise relationships

This commit is contained in:
Rohan Mitchell
2014-05-15 14:49:39 +10:00
parent 61af8204d9
commit 5f4e4ebeb0
5 changed files with 46 additions and 6 deletions

View File

@@ -1,2 +1,2 @@
Admin.controller "AdminEnterpriseRelationshipsCtrl", ($scope) ->
$scope.hello = "Hello, angular."
Admin.controller "AdminEnterpriseRelationshipsCtrl", ($scope, EnterpriseRelationships) ->
$scope.EnterpriseRelationships = EnterpriseRelationships

View File

@@ -0,0 +1,4 @@
Admin.factory 'EnterpriseRelationships', (enterprise_relationships) ->
new class EnterpriseRelationships
constructor: ->
@enterprise_relationships = enterprise_relationships

View File

@@ -1,7 +1,7 @@
module Admin
class EnterpriseRelationshipsController < ResourceController
def index
@enterprise_relationships = EnterpriseRelationship.by_name
end
end
end

View File

@@ -4,12 +4,16 @@
= render 'admin/shared/enterprises_sub_menu'
%div{"ng-app" => "ofn.admin", "ng-controller" => "AdminEnterpriseRelationshipsCtrl"}
:javascript
angular.module('ofn.admin').value('enterprise_relationships', #{render partial: "admin/json/enterprise_relationships", object: @enterprise_relationships})
-#%pre {{ EnterpriseRelationships.enterprise_relationships | json }}
%table#enterprise-relationships
%thead
%tr
%th Parent
%th Child
%tbody
%tr
%td {{ hello }}
%td {{ hello }}
%tr{"ng-repeat" => "enterprise_relationship in EnterpriseRelationships.enterprise_relationships"}
%td {{ enterprise_relationship.parent_name }}
%td {{ enterprise_relationship.child_name }}