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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mno_enterprise/angular/app.js.coffee.erb +0 -120
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/maestrano-components.js.coffee +0 -11
- data/app/assets/javascripts/mno_enterprise/application.js +0 -2
- data/app/assets/javascripts/mno_enterprise/lib/xeditable.js +0 -0
- data/app/assets/stylesheets/mno_enterprise/main.less +0 -28
- data/app/views/layouts/mno_enterprise/_application_js.html.haml +0 -4
- data/app/views/layouts/mno_enterprise/_common_cdn_lib_js.html.haml +0 -5
- data/app/views/layouts/mno_enterprise/_header_files.html.haml +0 -3
- data/app/views/layouts/mno_enterprise/application.html.haml +1 -1
- data/app/views/mno_enterprise/provision/_provision_apps.html.haml +7 -8
- data/config/routes.rb +1 -10
- data/lib/mno_enterprise/frontend/engine.rb +12 -0
- data/lib/mno_enterprise/frontend/locales_generator.rb +57 -0
- data/lib/tasks/mnoe_admin_tasks.rake +67 -0
- data/lib/tasks/mnoe_frontend_tasks.rake +138 -0
- data/lib/tasks/mnoe_locales.rake +14 -0
- data/lib/tasks/templates/bower.json +10 -0
- data/spec/controllers/mno_enterprise/auth/confirmations_controller_spec.rb +2 -2
- data/spec/controllers/mno_enterprise/webhook/o_auth_controller_spec.rb +1 -1
- data/spec/lib/mno_enterprise/locales_generator_spec.rb +14 -0
- data/spec/lib/tasks/mnoe_locales_rake_spec.rb +25 -0
- metadata +35 -145
- data/app/assets/images/mno_enterprise/impac/close-widget-pink.png +0 -0
- data/app/assets/images/mno_enterprise/impac/close-widget.png +0 -0
- data/app/assets/javascripts/mno_enterprise/angular/controllers/maestrano-controllers.js.coffee +0 -4
- data/app/assets/javascripts/mno_enterprise/angular/controllers/modals/modals-ctrl.js.coffee +0 -62
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-account.js.coffee +0 -157
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee +0 -62
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-apps-list.js.coffee +0 -127
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-components.js.coffee +0 -25
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-marketplace-app.js.coffee +0 -77
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-marketplace.js.coffee +0 -51
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-menu.js.coffee +0 -174
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/arrears.js.coffee +0 -70
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/billing.js.coffee +0 -48
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/credit-card.js.coffee +0 -142
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/index.js.coffee +0 -61
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/invoices.js.coffee +0 -42
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/members.js.coffee +0 -280
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/settings.js.coffee +0 -91
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/team-list.js.coffee +0 -179
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/teams.js.coffee +0 -268
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/file-model.js.coffee +0 -33
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-autostop-app.js.coffee +0 -123
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-currency-widget.js.coffee +0 -43
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-current-currency.js.coffee +0 -22
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-editable.js.coffee +0 -68
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-helptext.js.coffee +0 -38
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-match.js.coffee +0 -14
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-message-modal.js.coffee +0 -56
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-partner-code-popup.js.coffee +0 -74
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-partner-contact.js.coffee +0 -59
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-price-converter.js.coffee +0 -49
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-scroll-to.js.coffee +0 -14
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-typeahead.js.coffee +0 -89
- data/app/assets/javascripts/mno_enterprise/angular/directives/user-setup/components.js.coffee +0 -7
- data/app/assets/javascripts/mno_enterprise/angular/directives/user-setup/index.js.coffee +0 -256
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-app-by-category.js.coffee +0 -5
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-currency.js.coffee +0 -30
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-filters.js.coffee +0 -7
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-replace-underscore-with-space.js.coffee +0 -4
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-titleize.js.coffee +0 -7
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-truncate.js.coffee +0 -24
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-app-instance.js.coffee +0 -15
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-apps-document.js.coffee +0 -83
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-user.js.coffee +0 -27
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/organization-svc.js.coffee +0 -318
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/team-svc.js.coffee +0 -180
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/tickets-svc.js.coffee +0 -109
- data/app/assets/javascripts/mno_enterprise/angular/services/impac-config.svc.js.coffee +0 -35
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-apps-list-helper.js.coffee +0 -337
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-current-currency.js.coffee +0 -7
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-current-user-svc.js.coffee +0 -99
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-exchange-rates.js.coffee +0 -102
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-miscellaneous.js.coffee.erb +0 -46
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-modal.js.coffee +0 -67
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-services.js.coffee +0 -21
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-shopping-cart.js.coffee +0 -361
- data/app/assets/javascripts/mno_enterprise/angular/services/marketplace-svc.js.coffee +0 -59
- data/app/assets/javascripts/mno_enterprise/lib/angular-really-click.js +0 -17
- data/app/assets/javascripts/ng-performance/ngPerformance.html +0 -109
- data/app/assets/javascripts/ng-performance/ngPerformance.js +0 -211
- data/app/assets/stylesheets/mno_enterprise/custom/impac-variables-override.less +0 -65
- data/app/assets/stylesheets/mno_enterprise/custom/utility/app-presentation.less +0 -77
- data/app/assets/stylesheets/mno_enterprise/custom/utility/banners.less +0 -145
- data/app/assets/stylesheets/mno_enterprise/custom/utility/carousel.less +0 -68
- data/app/assets/stylesheets/mno_enterprise/custom/utility/helptext.less +0 -40
- data/app/assets/stylesheets/mno_enterprise/custom/utility/miscellaneous.less +0 -134
- data/app/assets/stylesheets/mno_enterprise/custom/utility/testimonial.less +0 -118
- data/app/assets/stylesheets/mno_enterprise/custom/views/apps.less +0 -243
- data/app/assets/stylesheets/mno_enterprise/custom/views/myspace.less +0 -477
- data/app/assets/stylesheets/mno_enterprise/custom/views/pages/home.less +0 -57
- data/app/assets/stylesheets/mno_enterprise/custom/views/star.less +0 -18
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/bootstrap-wizard.less +0 -63
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-marketplace.less +0 -187
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-organization.less +0 -149
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-teams.less +0 -119
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/support.less +0 -42
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/tickets.less +0 -80
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/mno-editable.less +0 -60
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/shopping-cart.less +0 -333
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/star-wizard.less +0 -49
- data/app/assets/stylesheets/mno_enterprise/custom/views/user-setup.less +0 -10
- data/app/assets/templates/mno_enterprise/dashboard/account.html +0 -131
- data/app/assets/templates/mno_enterprise/dashboard/app_deletion.html +0 -36
- data/app/assets/templates/mno_enterprise/dashboard/apps_list.html +0 -103
- data/app/assets/templates/mno_enterprise/dashboard/horizontal_menu.html +0 -85
- data/app/assets/templates/mno_enterprise/dashboard/marketplace/index.html +0 -60
- data/app/assets/templates/mno_enterprise/dashboard/marketplace/show.html +0 -133
- data/app/assets/templates/mno_enterprise/dashboard/menu.html +0 -161
- data/app/assets/templates/mno_enterprise/dashboard/organization/arrears.html +0 -37
- data/app/assets/templates/mno_enterprise/dashboard/organization/billing.html +0 -37
- data/app/assets/templates/mno_enterprise/dashboard/organization/credit-card.html +0 -156
- data/app/assets/templates/mno_enterprise/dashboard/organization/index.full.html +0 -181
- data/app/assets/templates/mno_enterprise/dashboard/organization/index.html +0 -173
- data/app/assets/templates/mno_enterprise/dashboard/organization/invoices.html +0 -27
- data/app/assets/templates/mno_enterprise/dashboard/organization/members.html +0 -288
- data/app/assets/templates/mno_enterprise/dashboard/organization/settings.html +0 -55
- data/app/assets/templates/mno_enterprise/dashboard/teams/index.html +0 -175
- data/app/assets/templates/mno_enterprise/dashboard/teams/member-add-modal.html +0 -60
- data/app/assets/templates/mno_enterprise/dashboard/teams/member-removal-modal.html +0 -35
- data/app/assets/templates/mno_enterprise/dashboard/teams/team-add-modal.html +0 -35
- data/app/assets/templates/mno_enterprise/dashboard/teams/team-delete-modal.html +0 -35
- data/app/assets/templates/mno_enterprise/dashboard/teams/team-list.html +0 -107
- data/app/assets/templates/mno_enterprise/default_template.html +0 -20
- data/app/assets/templates/mno_enterprise/maestrano-components/autostop_app.html +0 -42
- data/app/assets/templates/mno_enterprise/maestrano-components/currency_widget.html +0 -1
- data/app/assets/templates/mno_enterprise/maestrano-components/editable.html +0 -28
- data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/congratulations.html +0 -8
- data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/default.html +0 -1
- data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/information.html +0 -8
- data/app/assets/templates/mno_enterprise/maestrano-components/star_wizard.html +0 -254
- data/app/assets/templates/mno_enterprise/maestrano-components/upload_spreadsheet.html +0 -191
- data/app/assets/templates/mno_enterprise/modals/new-organization-reseller-req.html +0 -35
- data/app/assets/templates/mno_enterprise/modals/new-organization.html +0 -35
- data/app/assets/templates/mno_enterprise/user-setup/index.html +0 -312
- data/app/controllers/mno_enterprise/pages_controller.rb +0 -9
- data/app/controllers/mno_enterprise/user_setup_controller.rb +0 -11
- data/app/views/layouts/mno_enterprise/_impersonate_header.html.haml +0 -7
- data/app/views/layouts/mno_enterprise/application_dashboard.html.haml +0 -22
- data/app/views/mno_enterprise/pages/myspace.html.haml +0 -6
- data/app/views/mno_enterprise/user_setup/index.html.haml +0 -2
- data/config/initializers/ng-performance.rb +0 -3
- data/lib/assets/javascripts/impac-angular.js +0 -8719
- data/lib/assets/stylesheets/impac-angular.less +0 -2352
- data/lib/mno_enterprise/frontend/concerns/README.md +0 -6
- data/lib/mno_enterprise/frontend/concerns/controllers/pages_controller.rb +0 -25
- data/spec/controllers/mno_enterprise/pages_controller_spec.rb +0 -42
- data/spec/controllers/mno_enterprise/user_setup_controller_spec.rb +0 -33
- data/spec/routing/mno_enterprise/pages_controller_routing_spec.rb +0 -18
- data/spec/routing/mno_enterprise/user_setup_controller_routing_spec.rb +0 -11
@@ -1,77 +0,0 @@
|
|
1
|
-
module = angular.module('maestrano.dashboard.dashboard-marketplace-app',['maestrano.assets'])
|
2
|
-
|
3
|
-
#============================================
|
4
|
-
#
|
5
|
-
#============================================
|
6
|
-
module.controller('DashboardMarketplaceAppCtrl',[
|
7
|
-
'$scope', 'MarketplaceSvc', 'DhbOrganizationSvc','AssetPath','$routeParams',
|
8
|
-
($scope, MarketplaceSvc, DhbOrganizationSvc, AssetPath, $routeParams) ->
|
9
|
-
|
10
|
-
#====================================
|
11
|
-
# Pre-Initialization
|
12
|
-
#====================================
|
13
|
-
$scope.assetPath = AssetPath
|
14
|
-
$scope.isLoading = true
|
15
|
-
$scope.app = {}
|
16
|
-
|
17
|
-
#====================================
|
18
|
-
# Scope Management
|
19
|
-
#====================================
|
20
|
-
$scope.initialize = (app) ->
|
21
|
-
angular.copy(app,$scope.app)
|
22
|
-
$scope.isLoading = false
|
23
|
-
$scope.helper = {}
|
24
|
-
can = DhbOrganizationSvc.can
|
25
|
-
|
26
|
-
# ----------------------------------------------------------
|
27
|
-
# Permissions helper
|
28
|
-
# ----------------------------------------------------------
|
29
|
-
$scope.helper.canCreateApp = ->
|
30
|
-
can.create.appInstance()
|
31
|
-
|
32
|
-
$scope.backLink = ->
|
33
|
-
"#/marketplace"
|
34
|
-
|
35
|
-
# Check that the testimonial is not empty
|
36
|
-
$scope.isTestimonialShown = (testimonial) ->
|
37
|
-
testimonial.text? && testimonial.text.length > 0
|
38
|
-
|
39
|
-
$scope.provisionLink = () ->
|
40
|
-
"/mnoe/provision/new?apps[]=#{$scope.app.nid}&organization_id=#{DhbOrganizationSvc.getId()}"
|
41
|
-
|
42
|
-
#====================================
|
43
|
-
# Cart Management
|
44
|
-
#====================================
|
45
|
-
$scope.cart = cart = {
|
46
|
-
isOpen: false
|
47
|
-
bundle: {}
|
48
|
-
config: {}
|
49
|
-
}
|
50
|
-
|
51
|
-
# Open the ShoppingCart
|
52
|
-
cart.open = ->
|
53
|
-
if (d = DhbOrganizationSvc.data) && (o = d.organization) && o.id
|
54
|
-
cart.config.organizationId = o.id
|
55
|
-
|
56
|
-
cart.bundle = { app_instances: [{app: { id: $scope.app.id }}] }
|
57
|
-
cart.isOpen = true
|
58
|
-
|
59
|
-
|
60
|
-
#====================================
|
61
|
-
# Post-Initialization
|
62
|
-
#====================================
|
63
|
-
MarketplaceSvc.load().then (marketplace)->
|
64
|
-
listApp = _.findWhere(marketplace.apps,{slug: $routeParams.appId })
|
65
|
-
listApp ||= _.findWhere(marketplace.apps,{id: parseInt($routeParams.appId) })
|
66
|
-
$scope.initialize(listApp)
|
67
|
-
|
68
|
-
])
|
69
|
-
|
70
|
-
module.directive('dashboardMarketplaceApp', ['TemplatePath', (TemplatePath) ->
|
71
|
-
return {
|
72
|
-
restrict: 'A',
|
73
|
-
scope: {},
|
74
|
-
templateUrl: TemplatePath['mno_enterprise/dashboard/marketplace/show.html'],
|
75
|
-
controller: 'DashboardMarketplaceAppCtrl'
|
76
|
-
}
|
77
|
-
])
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module = angular.module('maestrano.dashboard.dashboard-marketplace',['maestrano.assets'])
|
2
|
-
|
3
|
-
#============================================
|
4
|
-
#
|
5
|
-
#============================================
|
6
|
-
module.controller('DashboardMarketplaceCtrl',[
|
7
|
-
'$scope', 'MarketplaceSvc', 'AssetPath'
|
8
|
-
($scope, MarketplaceSvc, AssetPath) ->
|
9
|
-
|
10
|
-
#====================================
|
11
|
-
# Pre-Initialization
|
12
|
-
#====================================
|
13
|
-
$scope.assetPath = AssetPath
|
14
|
-
$scope.isLoading = true
|
15
|
-
$scope.selectedCategory = ''
|
16
|
-
$scope.searchTerm = ''
|
17
|
-
$scope.appFilter = ''
|
18
|
-
|
19
|
-
#====================================
|
20
|
-
# Scope Management
|
21
|
-
#====================================
|
22
|
-
$scope.initialize = (marketplace)->
|
23
|
-
$scope.categories = marketplace.categories
|
24
|
-
$scope.apps = marketplace.apps
|
25
|
-
$scope.isLoading = false
|
26
|
-
|
27
|
-
$scope.linkFor = (app) ->
|
28
|
-
"#/marketplace/#{app.id}"
|
29
|
-
|
30
|
-
$scope.appsFilter = (app) ->
|
31
|
-
if ($scope.searchTerm? && $scope.searchTerm.length > 0) || !$scope.selectedCategory
|
32
|
-
return true
|
33
|
-
else
|
34
|
-
return _.contains(app.categories,$scope.selectedCategory)
|
35
|
-
|
36
|
-
#====================================
|
37
|
-
# Post-Initialization
|
38
|
-
#====================================
|
39
|
-
MarketplaceSvc.load().then (marketplace)->
|
40
|
-
$scope.initialize(marketplace)
|
41
|
-
|
42
|
-
])
|
43
|
-
|
44
|
-
module.directive('dashboardMarketplace', ['TemplatePath', (TemplatePath) ->
|
45
|
-
return {
|
46
|
-
restrict: 'A',
|
47
|
-
scope: {},
|
48
|
-
templateUrl: TemplatePath['mno_enterprise/dashboard/marketplace/index.html'],
|
49
|
-
controller: 'DashboardMarketplaceCtrl'
|
50
|
-
}
|
51
|
-
])
|
data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-menu.js.coffee
DELETED
@@ -1,174 +0,0 @@
|
|
1
|
-
module = angular.module('maestrano.dashboard.dashboard-menu',['maestrano.assets'])
|
2
|
-
|
3
|
-
#============================================
|
4
|
-
#
|
5
|
-
#============================================
|
6
|
-
module.controller('DashboardMenuCtrl',[
|
7
|
-
'$scope','$q','AssetPath','$location','$sce','CurrentUserSvc','DashboardAppsDocument','DhbOrganizationSvc','MarketplaceSvc','DhbTeamSvc', '$modal', '$http','$routeParams','$window','MessageSvc','MsgBus','TemplatePath','ModalSvc',
|
8
|
-
($scope,$q,AssetPath,$location,$sce,CurrentUserSvc,DashboardAppsDocument,DhbOrganizationSvc, MarketplaceSvc, DhbTeamSvc, $modal, $http, $routeParams, $window, MessageSvc, MsgBus, TemplatePath, ModalSvc) ->
|
9
|
-
$scope.assetPath = AssetPath
|
10
|
-
|
11
|
-
# Open the maestrano star menu
|
12
|
-
$scope.openMnoStarMenu = ->
|
13
|
-
$window.mnoLoader.toggleMenu()
|
14
|
-
|
15
|
-
#====================================
|
16
|
-
# Pre-Initialization
|
17
|
-
# Here we initialize all the services that do not depend on
|
18
|
-
# the current organization
|
19
|
-
#====================================
|
20
|
-
MarketplaceSvc.setup()
|
21
|
-
|
22
|
-
#====================================
|
23
|
-
# Scope Management
|
24
|
-
#====================================
|
25
|
-
# Check path or root path
|
26
|
-
$scope.isButtonActive = (entity) ->
|
27
|
-
$location.url() == entity ||
|
28
|
-
$location.url().split("/")[1] == entity.split("/")[1]
|
29
|
-
|
30
|
-
# Note: Unused at the moment
|
31
|
-
$scope.reloadServices = (orgId) ->
|
32
|
-
DashboardAppsDocument.setup(id:orgId)
|
33
|
-
DhbOrganizationSvc.setup(id: orgId)
|
34
|
-
DhbTeamSvc.setup(id: orgId)
|
35
|
-
|
36
|
-
#====================================
|
37
|
-
# Select Box
|
38
|
-
#====================================
|
39
|
-
$scope.selectBox = selectBox = {}
|
40
|
-
selectBox.form = {}
|
41
|
-
selectBox.isClosed = true
|
42
|
-
selectBox.isShown = false
|
43
|
-
selectBox.user = undefined
|
44
|
-
selectBox.organizations = []
|
45
|
-
selectBox.userLabel = ''
|
46
|
-
|
47
|
-
selectBox.initialize = (currentUser) ->
|
48
|
-
self = selectBox
|
49
|
-
self.user = currentUser
|
50
|
-
self.userLabel = "#{self.user.name} #{self.user.surname}"
|
51
|
-
self.organizations = self.user.organizations
|
52
|
-
|
53
|
-
# Capture parameters internally
|
54
|
-
if $routeParams.new_app
|
55
|
-
MsgBus.publish('params', {new_app: $routeParams.new_app})
|
56
|
-
$location.search('new_app', null )
|
57
|
-
|
58
|
-
# Attempt to load organization from param
|
59
|
-
if (val = $routeParams.dhbRefId)
|
60
|
-
val = parseInt(val)
|
61
|
-
$location.search('dhbRefId', null )
|
62
|
-
self.organization = _.findWhere(self.organizations,{id: val})
|
63
|
-
|
64
|
-
# Attempt to load last organization from cookie
|
65
|
-
if !self.organization? && (val = $.cookie('dhb_ref_id'))
|
66
|
-
self.organization = _.findWhere(self.organizations,{id: val})
|
67
|
-
|
68
|
-
# Default to first one otherwise
|
69
|
-
unless self.organization?
|
70
|
-
self.organization = self.organizations[0]
|
71
|
-
|
72
|
-
# return false if the user is member or reseller of at least one organization
|
73
|
-
$scope.selectBoxisEmpty = ->
|
74
|
-
!(self.organization && self.organization.id)
|
75
|
-
|
76
|
-
# if the selectBox is empty, then by default we show the account tab
|
77
|
-
# note: That condition will be true when a reseller has just signed up after
|
78
|
-
# accepting an invitation to join a reseller organization. At that stage
|
79
|
-
# he may not have any customers and he won't have any personal organization.
|
80
|
-
if $scope.selectBoxisEmpty()
|
81
|
-
$location.path('/account')
|
82
|
-
# otherwise we change the selectbox to the organization loaded
|
83
|
-
else
|
84
|
-
# Switch dashboard to organization
|
85
|
-
selectBox.changeTo(self.organization)
|
86
|
-
|
87
|
-
selectBox.toggle = ->
|
88
|
-
selectBox.isClosed = !selectBox.isClosed
|
89
|
-
|
90
|
-
selectBox.close = ->
|
91
|
-
selectBox.isClosed = true
|
92
|
-
|
93
|
-
selectBox.organizationList = ->
|
94
|
-
self = selectBox
|
95
|
-
return _.sortBy(self.organizations, (o) -> o.name)
|
96
|
-
|
97
|
-
# Format the html of the label used by the provided
|
98
|
-
# organization, based on whether it is selected, is a customer, reseller
|
99
|
-
# or regular company
|
100
|
-
selectBox.organizationLabel = (organization) ->
|
101
|
-
icon = {}
|
102
|
-
icon.type = if (organization.id == DhbOrganizationSvc.getId()) then "fa-dot-circle-o" else "fa-circle-o"
|
103
|
-
|
104
|
-
html = "<i class=\"fa #{icon.type}\"></i>#{organization.name}"
|
105
|
-
return html
|
106
|
-
|
107
|
-
# TODO: This function should go in a service
|
108
|
-
selectBox.changeTo = (organization) ->
|
109
|
-
DashboardAppsDocument.setup(id: organization.id)
|
110
|
-
DhbOrganizationSvc.setup(id: organization.id)
|
111
|
-
DhbTeamSvc.setup(id: organization.id)
|
112
|
-
$.cookie('dhb_ref_id',organization.id)
|
113
|
-
selectBox.organization = organization
|
114
|
-
selectBox.close()
|
115
|
-
|
116
|
-
selectBox.createNewOrga = ->
|
117
|
-
newOrgModal.open()
|
118
|
-
selectBox.close()
|
119
|
-
|
120
|
-
# Analytics tab is only enabled for certain users
|
121
|
-
# To enable access, do:
|
122
|
-
# user.put_metadata('has_analytics_beta_access',true)
|
123
|
-
$scope.isAnalyticsTabShown = ->
|
124
|
-
return CurrentUserSvc.document &&
|
125
|
-
CurrentUserSvc.document.current_user &&
|
126
|
-
CurrentUserSvc.document.current_user.hasAnalyticsBetaAccess
|
127
|
-
|
128
|
-
#====================================
|
129
|
-
# New Orga Modal
|
130
|
-
#====================================
|
131
|
-
newOrgModal = ModalSvc.newOrgModal({
|
132
|
-
callback: (data) ->
|
133
|
-
selectBox.changeTo(data)
|
134
|
-
})
|
135
|
-
|
136
|
-
CurrentUserSvc.loadDocument().then (data) ->
|
137
|
-
selectBox.initialize(CurrentUserSvc.document.current_user)
|
138
|
-
|
139
|
-
])
|
140
|
-
|
141
|
-
module.directive('dashboardMenu', ['TemplatePath', 'Miscellaneous', (TemplatePath,Miscellaneous) ->
|
142
|
-
return {
|
143
|
-
restrict: 'A'
|
144
|
-
scope: {
|
145
|
-
backgroundColor:'='
|
146
|
-
}
|
147
|
-
controller: 'DashboardMenuCtrl'
|
148
|
-
|
149
|
-
templateUrl: (elem,attrs) ->
|
150
|
-
if Miscellaneous.style.layout.dashboard_menu_orientation == 'horizontal'
|
151
|
-
TemplatePath['mno_enterprise/dashboard/horizontal_menu.html']
|
152
|
-
else
|
153
|
-
TemplatePath['mno_enterprise/dashboard/menu.html']
|
154
|
-
|
155
|
-
# We need to manually close the collapse menu as we actually stay on the same page
|
156
|
-
link: (scope,element,attrs) ->
|
157
|
-
unless Miscellaneous.style.layout.dashboard_menu_orientation == 'horizontal'
|
158
|
-
element.find(".menu").on("mouseenter", ->
|
159
|
-
angular.element(this).stop()
|
160
|
-
angular.element(this).find(".brand-logo").addClass('expanded')
|
161
|
-
angular.element(this).find(".dashboard-button").find(".content").css("display", "block")
|
162
|
-
angular.element(this).animate({width:275},150)
|
163
|
-
)
|
164
|
-
element.find(".menu").on("mouseleave", ->
|
165
|
-
angular.element(this).stop()
|
166
|
-
angular.element(this).find(".brand-logo").removeClass('expanded')
|
167
|
-
angular.element(this).find(".dashboard-button").find(".content").css("display", "none")
|
168
|
-
angular.element(this).animate({width:80},150)
|
169
|
-
)
|
170
|
-
element.find(".nav a").on("click", ->
|
171
|
-
element.find(".navbar-toggle").click()
|
172
|
-
)
|
173
|
-
}
|
174
|
-
])
|
@@ -1,70 +0,0 @@
|
|
1
|
-
module = angular.module('maestrano.dashboard.dashboard-organization-arrears',['maestrano.assets'])
|
2
|
-
|
3
|
-
#============================================
|
4
|
-
# Arrears Directive
|
5
|
-
#============================================
|
6
|
-
module.controller('DashboardOrganizationArrearsCtrl',[
|
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.paymentFailedBox = paymentFailedBox = {}
|
15
|
-
$scope.situations = {}
|
16
|
-
|
17
|
-
DhbOrganizationSvc.load().then (organization)->
|
18
|
-
$scope.situations = organization.arrears_situations
|
19
|
-
$scope.isLoading = false
|
20
|
-
|
21
|
-
#==============================
|
22
|
-
# Payment failed/retry section
|
23
|
-
#==============================
|
24
|
-
paymentFailedBox.errors = []
|
25
|
-
paymentFailedBox.inProgress = false
|
26
|
-
|
27
|
-
paymentFailedBox.getSituation = () ->
|
28
|
-
_.find($scope.situations,
|
29
|
-
(situation) -> situation.category == 'payment_failed'
|
30
|
-
)
|
31
|
-
|
32
|
-
paymentFailedBox.show = ->
|
33
|
-
this.getSituation()?
|
34
|
-
|
35
|
-
paymentFailedBox.retryPayment = () ->
|
36
|
-
self = this
|
37
|
-
self.inProgress = true
|
38
|
-
DhbOrganizationSvc.charge().then (response) ->
|
39
|
-
success = response.status == 'success'
|
40
|
-
payment = response.data
|
41
|
-
if (payment)
|
42
|
-
if (success)
|
43
|
-
self.resolve()
|
44
|
-
else if (payment.full_return_message)
|
45
|
-
self.errors = Utilities.processRailsError(payment.full_return_message)
|
46
|
-
else
|
47
|
-
self.errors = Utilities.processRailsError("bug")
|
48
|
-
else
|
49
|
-
self.errors = Utilities.processRailsError("bug")
|
50
|
-
self.inProgress = false
|
51
|
-
|
52
|
-
paymentFailedBox.resolve = () ->
|
53
|
-
self = this
|
54
|
-
# Remove ArrearsSituation
|
55
|
-
index = $scope.situations.indexOf(self.getSituation())
|
56
|
-
$scope.situations.splice(index,1)
|
57
|
-
# Return success
|
58
|
-
self.success = "Thank you! The payment has been performed successfully!"
|
59
|
-
|
60
|
-
])
|
61
|
-
|
62
|
-
module.directive('dashboardOrganizationArrears', ['TemplatePath', (TemplatePath) ->
|
63
|
-
return {
|
64
|
-
restrict: 'A',
|
65
|
-
scope: {
|
66
|
-
},
|
67
|
-
templateUrl: TemplatePath['mno_enterprise/dashboard/organization/arrears.html'],
|
68
|
-
controller: 'DashboardOrganizationArrearsCtrl'
|
69
|
-
}
|
70
|
-
])
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module = angular.module('maestrano.dashboard.dashboard-organization-billing',['maestrano.assets'])
|
2
|
-
|
3
|
-
#============================================
|
4
|
-
# Current Billing Directive
|
5
|
-
#============================================
|
6
|
-
module.controller('DashboardOrganizationBillingCtrl',[
|
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.billing = {}
|
15
|
-
|
16
|
-
#====================================
|
17
|
-
# Scope Management
|
18
|
-
#====================================
|
19
|
-
# Initialize the data used by the directive
|
20
|
-
$scope.initialize = (billing) ->
|
21
|
-
angular.copy(billing,$scope.billing)
|
22
|
-
$scope.isLoading = false
|
23
|
-
|
24
|
-
$scope.isCreditShown = () ->
|
25
|
-
b = $scope.billing
|
26
|
-
b &&
|
27
|
-
b.credit &&
|
28
|
-
b.credit.value > 0
|
29
|
-
|
30
|
-
#====================================
|
31
|
-
# Post-Initialization
|
32
|
-
#====================================
|
33
|
-
$scope.$watch DhbOrganizationSvc.getId, (val) ->
|
34
|
-
$scope.isLoading = true
|
35
|
-
if val?
|
36
|
-
DhbOrganizationSvc.load().then (organization)->
|
37
|
-
$scope.initialize(organization.billing)
|
38
|
-
])
|
39
|
-
|
40
|
-
module.directive('dashboardOrganizationBilling', ['TemplatePath', (TemplatePath) ->
|
41
|
-
return {
|
42
|
-
restrict: 'A',
|
43
|
-
scope: {
|
44
|
-
},
|
45
|
-
templateUrl: TemplatePath['mno_enterprise/dashboard/organization/billing.html'],
|
46
|
-
controller: 'DashboardOrganizationBillingCtrl'
|
47
|
-
}
|
48
|
-
])
|
@@ -1,142 +0,0 @@
|
|
1
|
-
module = angular.module('maestrano.dashboard.dashboard-organization-credit-card',['maestrano.assets'])
|
2
|
-
|
3
|
-
#============================================
|
4
|
-
#
|
5
|
-
#============================================
|
6
|
-
module.controller('DashboardOrganizationCreditCardCtrl',[
|
7
|
-
'$scope','$window','DhbOrganizationSvc', 'Miscellaneous', 'Utilities','AssetPath'
|
8
|
-
($scope, $window, DhbOrganizationSvc, Miscellaneous, Utilities,AssetPath) ->
|
9
|
-
|
10
|
-
#====================================
|
11
|
-
# Pre-Initialization
|
12
|
-
#====================================
|
13
|
-
$scope.assetPath = AssetPath
|
14
|
-
$scope.isLoading = true
|
15
|
-
$scope.forms = {}
|
16
|
-
$scope.model = {}
|
17
|
-
$scope.origModel = {}
|
18
|
-
$scope.config = {
|
19
|
-
validTitles: ['Mr.', 'Ms.', 'Mrs.', 'Miss', 'Dr.', 'Sir.', 'Prof.']
|
20
|
-
validMonths: [1..12]
|
21
|
-
validYears: [d = (new Date).getFullYear()..d+20]
|
22
|
-
validCountries: Miscellaneous.countries
|
23
|
-
}
|
24
|
-
|
25
|
-
#====================================
|
26
|
-
# Scope Management
|
27
|
-
#====================================
|
28
|
-
# Initialize the data used by the directive
|
29
|
-
$scope.initialize = (creditCard) ->
|
30
|
-
angular.copy(creditCard,$scope.model)
|
31
|
-
angular.copy(creditCard,$scope.origModel)
|
32
|
-
$scope.isLoading = false
|
33
|
-
|
34
|
-
# Save the current state of the credit card
|
35
|
-
$scope.save = ->
|
36
|
-
$scope.isLoading = true
|
37
|
-
DhbOrganizationSvc.billing.update($scope.model).then(
|
38
|
-
(creditCard) ->
|
39
|
-
$scope.errors = ''
|
40
|
-
angular.copy(creditCard,$scope.model)
|
41
|
-
angular.copy(creditCard,$scope.origModel)
|
42
|
-
if $scope.callback
|
43
|
-
$scope.callback()
|
44
|
-
, (errors) ->
|
45
|
-
$scope.errors = Utilities.processRailsError(errors)
|
46
|
-
).finally(-> $scope.isLoading = false)
|
47
|
-
|
48
|
-
# Cancel the temporary changes made by the
|
49
|
-
# user
|
50
|
-
$scope.cancel = ->
|
51
|
-
angular.copy($scope.origModel,$scope.model)
|
52
|
-
$scope.errors = ''
|
53
|
-
|
54
|
-
# Check if the user has started editing the
|
55
|
-
# CreditCard
|
56
|
-
$scope.isChanged = ->
|
57
|
-
!angular.equals($scope.model,$scope.origModel)
|
58
|
-
|
59
|
-
# Check whether we should display the cancel
|
60
|
-
# button or not
|
61
|
-
$scope.isCancelShown = ->
|
62
|
-
$scope.isChanged()
|
63
|
-
|
64
|
-
# Should we enable the save button
|
65
|
-
$scope.isSaveEnabled = ->
|
66
|
-
f = $scope.forms
|
67
|
-
$scope.isChanged() && f.billingAddress.$valid && f.creditCard.$valid
|
68
|
-
|
69
|
-
# Enable/Disable the credit card icons
|
70
|
-
$scope.classForIconType = (ccType) ->
|
71
|
-
self = $scope
|
72
|
-
cType = self.getType()
|
73
|
-
if ccType == self.getType() || cType == ""
|
74
|
-
return "enabled"
|
75
|
-
else
|
76
|
-
return "disabled"
|
77
|
-
|
78
|
-
# Return the credit card type (visa/mastercard/amex/jcb)
|
79
|
-
$scope.getType = () ->
|
80
|
-
self = $scope
|
81
|
-
number = self.model.number
|
82
|
-
if number != null && number != undefined
|
83
|
-
re = new RegExp("^X");
|
84
|
-
if (number.match(re) != null) then return ""
|
85
|
-
|
86
|
-
re = new RegExp("^4");
|
87
|
-
if (number.match(re) != null) then return "visa"
|
88
|
-
|
89
|
-
re = new RegExp("^(34|37)");
|
90
|
-
if (number.match(re) != null) then return "amex"
|
91
|
-
|
92
|
-
re = new RegExp("^5[1-5]");
|
93
|
-
if (number.match(re) != null) then return "mastercard"
|
94
|
-
|
95
|
-
re = new RegExp("^6(?:011|5[0-9]{2})");
|
96
|
-
if (number.match(re) != null) then return "discover"
|
97
|
-
|
98
|
-
re = new RegExp("(?:2131|1800|35[0-9]{3})")
|
99
|
-
if (number.match(re) != null) then return "jcb"
|
100
|
-
|
101
|
-
re = new RegExp("^3(?:0[0-5]|[68][0-9])")
|
102
|
-
if (number.match(re) != null) then return "dinersclub"
|
103
|
-
|
104
|
-
# Last resort we assume that it is a Mastercard if
|
105
|
-
# the number is long enough
|
106
|
-
# See:
|
107
|
-
#http://stackoverflow.com/questions/72768/how-do-you-detect-credit-card-type-based-on-number
|
108
|
-
if number.length > 4
|
109
|
-
return "mastercard"
|
110
|
-
else
|
111
|
-
return ""
|
112
|
-
|
113
|
-
return ""
|
114
|
-
|
115
|
-
# Open the godaddy site seal in a popup
|
116
|
-
$scope.openGodaddySslSeal = () ->
|
117
|
-
bgHeight = "779"
|
118
|
-
bgWidth = "593"
|
119
|
-
url = "https://seal.godaddy.com/verifySeal?sealID=RsNWG4eDd3ctNJWJfbeSBjJ6OWCtE3j0OwSXRDYF1WlMAGMqqmX5Kp"
|
120
|
-
options = "menubar=no,toolbar=no,personalbar=no,location=yes,status=no,resizable=yes,fullscreen=no,scrollbars=no,width=#{bgWidth},height=#{bgHeight}"
|
121
|
-
$window.open(url,'SealVerfication',options)
|
122
|
-
|
123
|
-
#====================================
|
124
|
-
# Post-Initialization
|
125
|
-
#====================================
|
126
|
-
$scope.$watch DhbOrganizationSvc.getId, (val) ->
|
127
|
-
$scope.isLoading = true
|
128
|
-
if val?
|
129
|
-
DhbOrganizationSvc.load().then (organization)->
|
130
|
-
$scope.initialize(organization.credit_card)
|
131
|
-
])
|
132
|
-
|
133
|
-
module.directive('dashboardOrganizationCreditCard', ['TemplatePath', (TemplatePath) ->
|
134
|
-
return {
|
135
|
-
restrict: 'A',
|
136
|
-
scope: {
|
137
|
-
callback:'&'
|
138
|
-
},
|
139
|
-
templateUrl: TemplatePath['mno_enterprise/dashboard/organization/credit-card.html'],
|
140
|
-
controller: 'DashboardOrganizationCreditCardCtrl'
|
141
|
-
}
|
142
|
-
])
|