mno-enterprise-frontend 2.0.9 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/mno_enterprise/angular/app.js.coffee.erb +0 -120
  3. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/maestrano-components.js.coffee +0 -11
  4. data/app/assets/javascripts/mno_enterprise/application.js +0 -2
  5. data/app/assets/javascripts/mno_enterprise/lib/xeditable.js +0 -0
  6. data/app/assets/stylesheets/mno_enterprise/main.less +0 -28
  7. data/app/views/layouts/mno_enterprise/_application_js.html.haml +0 -4
  8. data/app/views/layouts/mno_enterprise/_common_cdn_lib_js.html.haml +0 -5
  9. data/app/views/layouts/mno_enterprise/_header_files.html.haml +0 -3
  10. data/app/views/layouts/mno_enterprise/application.html.haml +1 -1
  11. data/app/views/mno_enterprise/provision/_provision_apps.html.haml +7 -8
  12. data/config/routes.rb +1 -10
  13. data/lib/mno_enterprise/frontend/engine.rb +12 -0
  14. data/lib/mno_enterprise/frontend/locales_generator.rb +57 -0
  15. data/lib/tasks/mnoe_admin_tasks.rake +67 -0
  16. data/lib/tasks/mnoe_frontend_tasks.rake +138 -0
  17. data/lib/tasks/mnoe_locales.rake +14 -0
  18. data/lib/tasks/templates/bower.json +10 -0
  19. data/spec/controllers/mno_enterprise/auth/confirmations_controller_spec.rb +2 -2
  20. data/spec/controllers/mno_enterprise/webhook/o_auth_controller_spec.rb +1 -1
  21. data/spec/lib/mno_enterprise/locales_generator_spec.rb +14 -0
  22. data/spec/lib/tasks/mnoe_locales_rake_spec.rb +25 -0
  23. metadata +35 -145
  24. data/app/assets/images/mno_enterprise/impac/close-widget-pink.png +0 -0
  25. data/app/assets/images/mno_enterprise/impac/close-widget.png +0 -0
  26. data/app/assets/javascripts/mno_enterprise/angular/controllers/maestrano-controllers.js.coffee +0 -4
  27. data/app/assets/javascripts/mno_enterprise/angular/controllers/modals/modals-ctrl.js.coffee +0 -62
  28. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-account.js.coffee +0 -157
  29. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee +0 -62
  30. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-apps-list.js.coffee +0 -127
  31. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-components.js.coffee +0 -25
  32. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-marketplace-app.js.coffee +0 -77
  33. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-marketplace.js.coffee +0 -51
  34. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-menu.js.coffee +0 -174
  35. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/arrears.js.coffee +0 -70
  36. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/billing.js.coffee +0 -48
  37. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/credit-card.js.coffee +0 -142
  38. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/index.js.coffee +0 -61
  39. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/invoices.js.coffee +0 -42
  40. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/members.js.coffee +0 -280
  41. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/settings.js.coffee +0 -91
  42. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/team-list.js.coffee +0 -179
  43. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/teams.js.coffee +0 -268
  44. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/file-model.js.coffee +0 -33
  45. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-autostop-app.js.coffee +0 -123
  46. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-currency-widget.js.coffee +0 -43
  47. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-current-currency.js.coffee +0 -22
  48. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-editable.js.coffee +0 -68
  49. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-helptext.js.coffee +0 -38
  50. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-match.js.coffee +0 -14
  51. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-message-modal.js.coffee +0 -56
  52. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-partner-code-popup.js.coffee +0 -74
  53. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-partner-contact.js.coffee +0 -59
  54. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-price-converter.js.coffee +0 -49
  55. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-scroll-to.js.coffee +0 -14
  56. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-typeahead.js.coffee +0 -89
  57. data/app/assets/javascripts/mno_enterprise/angular/directives/user-setup/components.js.coffee +0 -7
  58. data/app/assets/javascripts/mno_enterprise/angular/directives/user-setup/index.js.coffee +0 -256
  59. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-app-by-category.js.coffee +0 -5
  60. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-currency.js.coffee +0 -30
  61. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-filters.js.coffee +0 -7
  62. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-replace-underscore-with-space.js.coffee +0 -4
  63. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-titleize.js.coffee +0 -7
  64. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-truncate.js.coffee +0 -24
  65. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-app-instance.js.coffee +0 -15
  66. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-apps-document.js.coffee +0 -83
  67. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-user.js.coffee +0 -27
  68. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/organization-svc.js.coffee +0 -318
  69. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/team-svc.js.coffee +0 -180
  70. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/tickets-svc.js.coffee +0 -109
  71. data/app/assets/javascripts/mno_enterprise/angular/services/impac-config.svc.js.coffee +0 -35
  72. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-apps-list-helper.js.coffee +0 -337
  73. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-current-currency.js.coffee +0 -7
  74. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-current-user-svc.js.coffee +0 -99
  75. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-exchange-rates.js.coffee +0 -102
  76. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-miscellaneous.js.coffee.erb +0 -46
  77. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-modal.js.coffee +0 -67
  78. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-services.js.coffee +0 -21
  79. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-shopping-cart.js.coffee +0 -361
  80. data/app/assets/javascripts/mno_enterprise/angular/services/marketplace-svc.js.coffee +0 -59
  81. data/app/assets/javascripts/mno_enterprise/lib/angular-really-click.js +0 -17
  82. data/app/assets/javascripts/ng-performance/ngPerformance.html +0 -109
  83. data/app/assets/javascripts/ng-performance/ngPerformance.js +0 -211
  84. data/app/assets/stylesheets/mno_enterprise/custom/impac-variables-override.less +0 -65
  85. data/app/assets/stylesheets/mno_enterprise/custom/utility/app-presentation.less +0 -77
  86. data/app/assets/stylesheets/mno_enterprise/custom/utility/banners.less +0 -145
  87. data/app/assets/stylesheets/mno_enterprise/custom/utility/carousel.less +0 -68
  88. data/app/assets/stylesheets/mno_enterprise/custom/utility/helptext.less +0 -40
  89. data/app/assets/stylesheets/mno_enterprise/custom/utility/miscellaneous.less +0 -134
  90. data/app/assets/stylesheets/mno_enterprise/custom/utility/testimonial.less +0 -118
  91. data/app/assets/stylesheets/mno_enterprise/custom/views/apps.less +0 -243
  92. data/app/assets/stylesheets/mno_enterprise/custom/views/myspace.less +0 -477
  93. data/app/assets/stylesheets/mno_enterprise/custom/views/pages/home.less +0 -57
  94. data/app/assets/stylesheets/mno_enterprise/custom/views/star.less +0 -18
  95. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/bootstrap-wizard.less +0 -63
  96. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-marketplace.less +0 -187
  97. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-organization.less +0 -149
  98. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-teams.less +0 -119
  99. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/support.less +0 -42
  100. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/tickets.less +0 -80
  101. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/mno-editable.less +0 -60
  102. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/shopping-cart.less +0 -333
  103. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/star-wizard.less +0 -49
  104. data/app/assets/stylesheets/mno_enterprise/custom/views/user-setup.less +0 -10
  105. data/app/assets/templates/mno_enterprise/dashboard/account.html +0 -131
  106. data/app/assets/templates/mno_enterprise/dashboard/app_deletion.html +0 -36
  107. data/app/assets/templates/mno_enterprise/dashboard/apps_list.html +0 -103
  108. data/app/assets/templates/mno_enterprise/dashboard/horizontal_menu.html +0 -85
  109. data/app/assets/templates/mno_enterprise/dashboard/marketplace/index.html +0 -60
  110. data/app/assets/templates/mno_enterprise/dashboard/marketplace/show.html +0 -133
  111. data/app/assets/templates/mno_enterprise/dashboard/menu.html +0 -161
  112. data/app/assets/templates/mno_enterprise/dashboard/organization/arrears.html +0 -37
  113. data/app/assets/templates/mno_enterprise/dashboard/organization/billing.html +0 -37
  114. data/app/assets/templates/mno_enterprise/dashboard/organization/credit-card.html +0 -156
  115. data/app/assets/templates/mno_enterprise/dashboard/organization/index.full.html +0 -181
  116. data/app/assets/templates/mno_enterprise/dashboard/organization/index.html +0 -173
  117. data/app/assets/templates/mno_enterprise/dashboard/organization/invoices.html +0 -27
  118. data/app/assets/templates/mno_enterprise/dashboard/organization/members.html +0 -288
  119. data/app/assets/templates/mno_enterprise/dashboard/organization/settings.html +0 -55
  120. data/app/assets/templates/mno_enterprise/dashboard/teams/index.html +0 -175
  121. data/app/assets/templates/mno_enterprise/dashboard/teams/member-add-modal.html +0 -60
  122. data/app/assets/templates/mno_enterprise/dashboard/teams/member-removal-modal.html +0 -35
  123. data/app/assets/templates/mno_enterprise/dashboard/teams/team-add-modal.html +0 -35
  124. data/app/assets/templates/mno_enterprise/dashboard/teams/team-delete-modal.html +0 -35
  125. data/app/assets/templates/mno_enterprise/dashboard/teams/team-list.html +0 -107
  126. data/app/assets/templates/mno_enterprise/default_template.html +0 -20
  127. data/app/assets/templates/mno_enterprise/maestrano-components/autostop_app.html +0 -42
  128. data/app/assets/templates/mno_enterprise/maestrano-components/currency_widget.html +0 -1
  129. data/app/assets/templates/mno_enterprise/maestrano-components/editable.html +0 -28
  130. data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/congratulations.html +0 -8
  131. data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/default.html +0 -1
  132. data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/information.html +0 -8
  133. data/app/assets/templates/mno_enterprise/maestrano-components/star_wizard.html +0 -254
  134. data/app/assets/templates/mno_enterprise/maestrano-components/upload_spreadsheet.html +0 -191
  135. data/app/assets/templates/mno_enterprise/modals/new-organization-reseller-req.html +0 -35
  136. data/app/assets/templates/mno_enterprise/modals/new-organization.html +0 -35
  137. data/app/assets/templates/mno_enterprise/user-setup/index.html +0 -312
  138. data/app/controllers/mno_enterprise/pages_controller.rb +0 -9
  139. data/app/controllers/mno_enterprise/user_setup_controller.rb +0 -11
  140. data/app/views/layouts/mno_enterprise/_impersonate_header.html.haml +0 -7
  141. data/app/views/layouts/mno_enterprise/application_dashboard.html.haml +0 -22
  142. data/app/views/mno_enterprise/pages/myspace.html.haml +0 -6
  143. data/app/views/mno_enterprise/user_setup/index.html.haml +0 -2
  144. data/config/initializers/ng-performance.rb +0 -3
  145. data/lib/assets/javascripts/impac-angular.js +0 -8719
  146. data/lib/assets/stylesheets/impac-angular.less +0 -2352
  147. data/lib/mno_enterprise/frontend/concerns/README.md +0 -6
  148. data/lib/mno_enterprise/frontend/concerns/controllers/pages_controller.rb +0 -25
  149. data/spec/controllers/mno_enterprise/pages_controller_spec.rb +0 -42
  150. data/spec/controllers/mno_enterprise/user_setup_controller_spec.rb +0 -33
  151. data/spec/routing/mno_enterprise/pages_controller_routing_spec.rb +0 -18
  152. data/spec/routing/mno_enterprise/user_setup_controller_routing_spec.rb +0 -11
@@ -1,61 +0,0 @@
1
- module = angular.module('maestrano.dashboard.dashboard-organization-index',['maestrano.assets'])
2
-
3
- #============================================
4
- #
5
- #============================================
6
- module.controller('DashboardOrganizationIndexCtrl',[
7
- '$scope', 'DhbOrganizationSvc', 'AssetPath'
8
- ($scope, DhbOrganizationSvc, AssetPath) ->
9
-
10
- #====================================
11
- # Pre-Initialization
12
- #====================================
13
- $scope.assetPath = AssetPath
14
- $scope.isLoading = true
15
- $scope.tabs = {
16
- billing: false,
17
- members: false,
18
- teams: false,
19
- settings: false
20
- }
21
-
22
- #====================================
23
- # Scope Management
24
- #====================================
25
- $scope.initialize = ->
26
- $scope.isLoading = false
27
- if $scope.isBillingShown()
28
- $scope.tabs.billing = true
29
- else
30
- $scope.tabs.members = true
31
-
32
- $scope.isTabSetShown = ->
33
- !$scope.isLoading && (
34
- DhbOrganizationSvc.user.isSuperAdmin() || DhbOrganizationSvc.user.isAdmin())
35
-
36
- $scope.isBillingShown = ->
37
- DhbOrganizationSvc.user.isSuperAdmin()
38
-
39
- $scope.isSettingsShown = ->
40
- DhbOrganizationSvc.user.isSuperAdmin()
41
-
42
- #====================================
43
- # Post-Initialization
44
- #====================================
45
- $scope.$watch DhbOrganizationSvc.getId, (val) ->
46
- $scope.isLoading = true
47
- if val?
48
- DhbOrganizationSvc.load().then (organization)->
49
- $scope.initialize()
50
-
51
- ])
52
-
53
- module.directive('dashboardOrganizationIndex', ['TemplatePath', (TemplatePath) ->
54
- return {
55
- restrict: 'A',
56
- scope: {
57
- },
58
- templateUrl: TemplatePath['mno_enterprise/dashboard/organization/index.html'],
59
- controller: 'DashboardOrganizationIndexCtrl'
60
- }
61
- ])
@@ -1,42 +0,0 @@
1
- module = angular.module('maestrano.dashboard.dashboard-organization-invoices',['maestrano.assets'])
2
-
3
- #============================================
4
- #
5
- #============================================
6
- module.controller('DashboardOrganizationInvoicesCtrl',[
7
- '$scope','$window','DhbOrganizationSvc', 'Utilities','AssetPath', 'Miscellaneous',
8
- ($scope, $window, DhbOrganizationSvc, Utilities, AssetPath, Miscellaneous) ->
9
- #====================================
10
- # Pre-Initialization
11
- #====================================
12
- $scope.assetPath = AssetPath
13
- $scope.isLoading = true
14
- $scope.invoices = []
15
-
16
- #====================================
17
- # Scope Management
18
- #====================================
19
- # Initialize the data used by the directive
20
- $scope.initialize = (invoices) ->
21
- angular.copy(invoices,$scope.invoices)
22
- $scope.isLoading = false
23
-
24
- #====================================
25
- # Post-Initialization
26
- #====================================
27
- $scope.$watch DhbOrganizationSvc.getId, (val) ->
28
- $scope.isLoading = true
29
- if val?
30
- DhbOrganizationSvc.load().then (organization)->
31
- $scope.initialize(organization.invoices)
32
- ])
33
-
34
- module.directive('dashboardOrganizationInvoices', ['TemplatePath', (TemplatePath) ->
35
- return {
36
- restrict: 'A',
37
- scope: {
38
- },
39
- templateUrl: TemplatePath['mno_enterprise/dashboard/organization/invoices.html'],
40
- controller: 'DashboardOrganizationInvoicesCtrl'
41
- }
42
- ])
@@ -1,280 +0,0 @@
1
- module = angular.module('maestrano.dashboard.dashboard-organization-members',['maestrano.assets'])
2
-
3
- #============================================
4
- #
5
- #============================================
6
- module.controller('DashboardOrganizationMembersCtrl',[
7
- '$scope','$window','DhbOrganizationSvc','DhbTeamSvc', 'Utilities','AssetPath','$modal', '$q',
8
- ($scope, $window, DhbOrganizationSvc, DhbTeamSvc, Utilities, AssetPath,$modal, $q) ->
9
- #====================================
10
- # Pre-Initialization
11
- #====================================
12
- $scope.assetPath = AssetPath
13
- $scope.isLoading = true
14
- $scope.members = []
15
- $scope.teams = []
16
-
17
- #====================================
18
- # Scope Management
19
- #====================================
20
- # Initialize the data used by the directive
21
- $scope.initialize = (members, teams = nil) ->
22
- angular.copy(members,$scope.members)
23
- angular.copy(teams,$scope.teams) if teams
24
- $scope.isLoading = false
25
-
26
- $scope.editMember = (member) ->
27
- $scope.editionModal.open(member)
28
-
29
- $scope.removeMember = (member) ->
30
- $scope.deletionModal.open(member)
31
-
32
- $scope.inviteMembers = ->
33
- $scope.inviteModal.open()
34
-
35
- $scope.isInviteShown = ->
36
- DhbOrganizationSvc.can.create.member()
37
-
38
- $scope.isEditShown = (member) ->
39
- DhbOrganizationSvc.can.update.member(member)
40
-
41
- $scope.isRemoveShown = (member) ->
42
- DhbOrganizationSvc.can.destroy.member(member)
43
-
44
- $scope.memberRoleLabel = (member) ->
45
- if member.entity == 'User'
46
- return member.role
47
- else
48
- return "Invited (#{member.role})"
49
-
50
- #====================================
51
- # User Edition Modal
52
- #====================================
53
- $scope.editionModal = editionModal = {}
54
- editionModal.config = {
55
- instance: {
56
- backdrop: 'static'
57
- templateUrl: 'dashboard/organization/members/edition-modal.html'
58
- size: 'lg'
59
- windowClass: 'inverse member-edit'
60
- scope: $scope
61
- }
62
- roles: ['Member','Power User','Admin','Super Admin']
63
- }
64
-
65
- editionModal.open = (member) ->
66
- self = editionModal
67
- self.member = member
68
- self.selectedRole = member.role
69
- self.$instance = $modal.open(self.config.instance)
70
- self.isLoading = false
71
- editionModal.member = member
72
-
73
- editionModal.title = ->
74
- m = editionModal.member
75
- if m.entity == 'User'
76
- return "Edit Member: #{m.name} #{m.surname}"
77
- else
78
- return "Edit Member: #{m.email}"
79
-
80
- editionModal.close = ->
81
- self = editionModal
82
- self.$instance.close()
83
-
84
- editionModal.select = (role) ->
85
- editionModal.selectedRole = role
86
-
87
- editionModal.classForRole = (role) ->
88
- self = editionModal
89
- if role == self.member.role
90
- return 'btn-info'
91
- else if role == self.selectedRole
92
- return 'btn-warning'
93
- else
94
- return ''
95
-
96
- editionModal.isChangeDisabled = ->
97
- editionModal.member.role == editionModal.selectedRole
98
-
99
- editionModal.change = ->
100
- self = editionModal
101
- self.isLoading = true
102
- obj = { email: self.member.email, role: self.selectedRole }
103
- DhbOrganizationSvc.members.update(obj).then(
104
- (members) ->
105
- self.errors = ''
106
- angular.copy(members,$scope.members)
107
- self.close()
108
- , (errors) ->
109
- self.errors = Utilities.processRailsError(errors)
110
- ).finally(-> self.isLoading = false)
111
-
112
- #====================================
113
- # User Deletion Modal
114
- #====================================
115
- $scope.deletionModal = deletionModal = {}
116
- deletionModal.config = {
117
- instance: {
118
- backdrop: 'static'
119
- templateUrl: 'dashboard/organization/members/removal-modal.html'
120
- size: 'lg'
121
- windowClass: 'inverse member-edit'
122
- scope: $scope
123
- }
124
- }
125
-
126
- deletionModal.open = (member) ->
127
- self = deletionModal
128
- self.member = member
129
- self.$instance = $modal.open(self.config.instance)
130
- self.isLoading = false
131
- self.member = member
132
-
133
- deletionModal.close = ->
134
- self = deletionModal
135
- self.$instance.close()
136
-
137
- deletionModal.confirmationText = ->
138
- m = deletionModal.member
139
- if m.entity == 'User' && m.name?
140
- return "Do you really want to remove <strong>#{m.name} #{m.surname}</strong> from your company?"
141
- else
142
- return "Do you really want to remove <strong>#{m.email}</strong> from your company?"
143
-
144
- deletionModal.remove = ->
145
- self = deletionModal
146
- self.isLoading = true
147
- obj = { email: self.member.email }
148
- DhbOrganizationSvc.members.remove(obj).then(
149
- (members) ->
150
- self.errors = ''
151
- angular.copy(members,$scope.members)
152
- self.close()
153
- , (errors) ->
154
- self.errors = Utilities.processRailsError(errors)
155
- ).finally(-> self.isLoading = false)
156
-
157
- #====================================
158
- # Invite Modal
159
- #====================================
160
- $scope.inviteModal = inviteModal = {}
161
- inviteModal.config = {
162
- instance: {
163
- backdrop: 'static'
164
- templateUrl: 'dashboard/organization/members/invite-modal.html'
165
- size: 'lg'
166
- windowClass: 'inverse member-edit'
167
- scope: $scope
168
- }
169
- defaultRole: 'Member'
170
- roles: ->
171
- list = ['Member','Power User','Admin']
172
- list.push('Super Admin') if DhbOrganizationSvc.user.isSuperAdmin()
173
- return list
174
- teams: ->
175
- $scope.teams
176
- }
177
-
178
- inviteModal.open = () ->
179
- self = inviteModal
180
- self.$instance = $modal.open(self.config.instance)
181
- self.isLoading = false
182
- self.members = []
183
- self.userEmails = ''
184
- self.step = 'enterEmails'
185
- self.roleList = self.config.roles()
186
- self.teamList = self.config.teams()
187
- self.invalidEmails = []
188
-
189
- inviteModal.close = ->
190
- self = inviteModal
191
- self.$instance.close()
192
-
193
- inviteModal.isTeamListShown = ->
194
- inviteModal.teamList.length > 0
195
-
196
- inviteModal.title = ->
197
- self = inviteModal
198
- if self.step == 'enterEmails'
199
- "Enter email addresses"
200
- else
201
- "Select role for each new member"
202
-
203
- inviteModal.labelForAction = ->
204
- if inviteModal.step == 'enterEmails'
205
- return "Next"
206
- else
207
- return "Invite"
208
-
209
- inviteModal.next = ->
210
- self = inviteModal
211
- if self.step == 'enterEmails'
212
- inviteModal.processEmails()
213
-
214
- else
215
- inviteModal.inviteMembers()
216
-
217
- inviteModal.isNextEnabled = ->
218
- self = inviteModal
219
- self.step == 'defineRoles' || (self.step == 'enterEmails' && self.userEmails.length > 0)
220
-
221
- inviteModal.oneValidEmail = ->
222
- self = inviteModal
223
- res = false
224
- _.each self.userEmails.split("\n"), (email) ->
225
-
226
- res = true if email.match(email_regexp)
227
- return res
228
-
229
- inviteModal.processEmails = ->
230
- self = inviteModal
231
- self.isLoading = true
232
- self.members = []
233
- self.invalidEmails = []
234
-
235
- _.each self.userEmails.split("\n"), (email) ->
236
- email_regexp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
237
- if email.match(email_regexp)
238
- self.members.push({email: email, role: self.config.defaultRole })
239
- else
240
- self.invalidEmails.push(email)
241
-
242
- self.isLoading = false
243
- if self.invalidEmails.length == 0
244
- self.step = 'defineRoles'
245
-
246
- inviteModal.inviteMembers = ->
247
- self = inviteModal
248
- self.isLoading = true
249
- DhbOrganizationSvc.members.invite(self.members).then(
250
- (members) ->
251
- self.errors = ''
252
- angular.copy(members,$scope.members)
253
- self.close()
254
- , (errors) ->
255
- self.errors = Utilities.processRailsError(errors)
256
- ).finally(-> self.isLoading = false)
257
-
258
-
259
- #====================================
260
- # Post-Initialization
261
- #====================================
262
- refresh = ->
263
- $q.all([DhbOrganizationSvc.load(),DhbTeamSvc.load()]).then (values)->
264
- $scope.initialize(values[0].organization.members,values[1])
265
-
266
- contextObj = ->
267
- { orgId: DhbOrganizationSvc.getId(), teams: DhbTeamSvc.data }
268
-
269
- $scope.$watch contextObj, refresh, true
270
- ])
271
-
272
- module.directive('dashboardOrganizationMembers', ['TemplatePath', (TemplatePath) ->
273
- return {
274
- restrict: 'A',
275
- scope: {
276
- },
277
- templateUrl: TemplatePath['mno_enterprise/dashboard/organization/members.html'],
278
- controller: 'DashboardOrganizationMembersCtrl'
279
- }
280
- ])
@@ -1,91 +0,0 @@
1
- module = angular.module('maestrano.dashboard.dashboard-organization-settings',['maestrano.assets'])
2
-
3
- #============================================
4
- #
5
- #============================================
6
- module.controller('DashboardOrganizationSettingsCtrl',[
7
- '$scope','$window','DhbOrganizationSvc', 'Utilities','AssetPath'
8
- ($scope, $window, DhbOrganizationSvc, Utilities, AssetPath) ->
9
- #====================================
10
- # Pre-Initialization
11
- #====================================
12
- $scope.assetPath = AssetPath
13
- $scope.isLoading = true
14
- $scope.model = {}
15
- $scope.origModel = {}
16
- $scope.forms = {}
17
-
18
- #====================================
19
- # Scope Management
20
- #====================================
21
- # Initialize the data used by the directive
22
- $scope.initialize = (organization) ->
23
- angular.copy(organization,$scope.model)
24
- angular.copy(organization,$scope.origModel)
25
- $scope.isLoading = false
26
-
27
- # Save the current state of the credit card
28
- $scope.save = ->
29
- $scope.isLoading = true
30
- DhbOrganizationSvc.organization.update($scope.model).then(
31
- (organization) ->
32
- $scope.errors = ''
33
- angular.copy(organization,$scope.model)
34
- angular.copy(organization,$scope.origModel)
35
- , (errors) ->
36
- $scope.errors = Utilities.processRailsError(errors)
37
- ).finally(-> $scope.isLoading = false)
38
-
39
- # Cancel the temporary changes made by the
40
- # user
41
- $scope.cancel = ->
42
- angular.copy($scope.origModel,$scope.model)
43
- $scope.errors = ''
44
-
45
- # Check if the user has started editing the
46
- # form
47
- $scope.isChanged = ->
48
- !angular.equals($scope.model,$scope.origModel)
49
-
50
- # Check whether we should display the cancel
51
- # button or not
52
- $scope.isCancelShown = ->
53
- $scope.isChanged()
54
-
55
- # Should we enable the save button
56
- $scope.isSaveEnabled = ->
57
- f = $scope.forms
58
- $scope.isChanged() && f.settings.$valid
59
-
60
- # Return the class to add to the btn
61
- # based on soa_enabled
62
- $scope.connecBtnClassFor = (action) ->
63
- if action == 'enable'
64
- return ( $scope.model.soa_enabled && 'btn-info')
65
- else
66
- return ( !$scope.model.soa_enabled && 'btn-info')
67
-
68
- # Action to be perform when user clicks on 'enable'
69
- # or 'disable'
70
- $scope.connecBtnClickOn = (action) ->
71
- $scope.model.soa_enabled = (action == 'enable')
72
-
73
- #====================================
74
- # Post-Initialization
75
- #====================================
76
- $scope.$watch DhbOrganizationSvc.getId, (val) ->
77
- $scope.isLoading = true
78
- if val?
79
- DhbOrganizationSvc.load().then (organization)->
80
- $scope.initialize(organization.organization)
81
- ])
82
-
83
- module.directive('dashboardOrganizationSettings', ['TemplatePath', (TemplatePath) ->
84
- return {
85
- restrict: 'A',
86
- scope: {
87
- },
88
- templateUrl: TemplatePath['mno_enterprise/dashboard/organization/settings.html'],
89
- controller: 'DashboardOrganizationSettingsCtrl'
90
- }
91
- ])