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
data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-current-user-svc.js.coffee
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
angular.module('maestrano.services.current-user-svc', []).factory('CurrentUserSvc', ['$http', '$q', ($http, $q) ->
|
2
|
-
service = {}
|
3
|
-
|
4
|
-
# Configuration
|
5
|
-
service.config = {
|
6
|
-
signInPath: '/mnoe/auth/users/sign_in'
|
7
|
-
signUpPath: '/mnoe/auth/users'
|
8
|
-
updatePath: '/mnoe/jpi/v1/current_user',
|
9
|
-
updatePasswordPath: '/mnoe/jpi/v1/current_user/update_password',
|
10
|
-
}
|
11
|
-
|
12
|
-
# Load User
|
13
|
-
service.then = (fn = nil) ->
|
14
|
-
service.loadDocument().then(fn)
|
15
|
-
|
16
|
-
service.loadDocument = (force = false)->
|
17
|
-
self = service
|
18
|
-
if self.document == undefined || force
|
19
|
-
self.query = $http.get("/mnoe/jpi/v1/current_user")
|
20
|
-
self.query.success (data) ->
|
21
|
-
self.document = data
|
22
|
-
return self.query
|
23
|
-
|
24
|
-
|
25
|
-
# Sign user in
|
26
|
-
# Return a promise
|
27
|
-
service.signIn = (email,password) ->
|
28
|
-
self = service
|
29
|
-
creds = {email: email, password: password}
|
30
|
-
$http.post(self.config.signInPath,{user: creds})
|
31
|
-
.then(-> self.loadDocument(true))
|
32
|
-
|
33
|
-
service.addOrg = (org) ->
|
34
|
-
self = service
|
35
|
-
if self.document && self.document.current_user && self.document.current_user.organizations
|
36
|
-
self.document.current_user.organizations.push(org)
|
37
|
-
|
38
|
-
service.update = (data) ->
|
39
|
-
self = service
|
40
|
-
return $http.put(self.config.updatePath,{user:data}).then (resp) ->
|
41
|
-
userResp = resp.data.current_user
|
42
|
-
angular.copy(userResp, self.document.current_user)
|
43
|
-
return userResp
|
44
|
-
|
45
|
-
service.updatePassword = (newPassword,confirmPassword,currentPassword) ->
|
46
|
-
self = service
|
47
|
-
return $http.put(self.config.updatePasswordPath,{ user: {
|
48
|
-
password: newPassword,
|
49
|
-
password_confirmation: confirmPassword,
|
50
|
-
current_password: currentPassword
|
51
|
-
} })
|
52
|
-
|
53
|
-
# Sign user up
|
54
|
-
# expect the following hash:
|
55
|
-
# {
|
56
|
-
# name: 'John',
|
57
|
-
# surname: 'Doe',
|
58
|
-
# email: 'john.doe@doecorp.com',
|
59
|
-
# password: 'jdoedoe',
|
60
|
-
# password_confirmation: 'jdoejdoe'
|
61
|
-
# }
|
62
|
-
# Return a promise
|
63
|
-
service.signUp = (hash) ->
|
64
|
-
self = service
|
65
|
-
$http.post(self.config.signUpPath,{user: hash})
|
66
|
-
.then(-> self.loadDocument(true))
|
67
|
-
|
68
|
-
service.getSsoSessionId = ->
|
69
|
-
self = service
|
70
|
-
if self.document?
|
71
|
-
return self.document.current_user.sso_session
|
72
|
-
else
|
73
|
-
return null
|
74
|
-
|
75
|
-
service.getUserData = ->
|
76
|
-
self = service
|
77
|
-
deferred = $q.defer()
|
78
|
-
self.loadDocument().then(
|
79
|
-
(success) ->
|
80
|
-
deferred.resolve(success.data.current_user)
|
81
|
-
->
|
82
|
-
deferred.reject()
|
83
|
-
)
|
84
|
-
return deferred.promise
|
85
|
-
|
86
|
-
service.getOrganizations = ->
|
87
|
-
self = service
|
88
|
-
deferred = $q.defer()
|
89
|
-
|
90
|
-
self.loadDocument().then (success) ->
|
91
|
-
deferred.resolve(success.data.current_user.organizations)
|
92
|
-
,(error) ->
|
93
|
-
deferred.reject("Error while trying to retrieve current user organizations")
|
94
|
-
|
95
|
-
return deferred.promise
|
96
|
-
|
97
|
-
return service
|
98
|
-
|
99
|
-
])
|
data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-exchange-rates.js.coffee
DELETED
@@ -1,102 +0,0 @@
|
|
1
|
-
# This service provides exchange rates from AUD to another currency
|
2
|
-
# as well as currency information (symbol, subunit symbol etc.)
|
3
|
-
# ---
|
4
|
-
# Note that rates are received from Maestrano in percent
|
5
|
-
# E.g: 100 AUD = 92.31 USD
|
6
|
-
angular.module('maestrano.exchange-rates', []).factory('ExchangeRates', ['$http', ($http) ->
|
7
|
-
service = {}
|
8
|
-
service.ratesUrl = '/api/v1/exchange_rates'
|
9
|
-
service.rates = {}
|
10
|
-
service.defCurrency = if window.currentVisitorCountryCode is "AU" then "AUD" else "USD"
|
11
|
-
service.then = () ->
|
12
|
-
|
13
|
-
#==================================
|
14
|
-
# Money Object
|
15
|
-
#==================================
|
16
|
-
# Exchange object
|
17
|
-
moneyObject = {}
|
18
|
-
|
19
|
-
# Return a new money object in the
|
20
|
-
# requested currency
|
21
|
-
moneyObject.to = (currency) ->
|
22
|
-
self = this
|
23
|
-
if self.currency
|
24
|
-
if self.currency == currency
|
25
|
-
return self
|
26
|
-
else
|
27
|
-
money = angular.copy(moneyObject)
|
28
|
-
money.currency = currency
|
29
|
-
money.amount = (self.amount * service.rates[currency].value) / service.rates[self.currency].value
|
30
|
-
# Round the number if no subunit
|
31
|
-
if !service.rates[currency].options.subunit_to_unit || service.rates[currency].options.subunit_to_unit == 1
|
32
|
-
money.amount = Math.round(money.amount)
|
33
|
-
return money
|
34
|
-
|
35
|
-
# Return the money object in the service
|
36
|
-
# default currency
|
37
|
-
moneyObject.toDefault = () ->
|
38
|
-
self = this
|
39
|
-
self.to(service.defaultCurrency())
|
40
|
-
|
41
|
-
# Format a money object for display
|
42
|
-
moneyObject.format = () ->
|
43
|
-
self = this
|
44
|
-
accounting.formatMoney(self.amount, service.rates[self.currency].options)
|
45
|
-
|
46
|
-
# Format a money object in fractional only (like 99ct)
|
47
|
-
# if the amount is below the subunit_to_unit threshold
|
48
|
-
moneyObject.formatFractional = () ->
|
49
|
-
self = this
|
50
|
-
currency = service.rates[self.currency]
|
51
|
-
if !currency.options.subunit_to_unit || currency.options.subunit_to_unit == 1
|
52
|
-
return self.format()
|
53
|
-
else
|
54
|
-
subunit_amount = Math.round(self.amount*currency.options.subunit_to_unit)
|
55
|
-
if subunit_amount >= currency.options.subunit_to_unit
|
56
|
-
return self.format()
|
57
|
-
else
|
58
|
-
return accounting.formatMoney(subunit_amount, { symbol: currency.options.subunit_symbol, format: currency.options.subunit_format, precision: 0 })
|
59
|
-
|
60
|
-
moneyObject.amount = ->
|
61
|
-
self = this
|
62
|
-
return self.amount
|
63
|
-
|
64
|
-
|
65
|
-
#==================================
|
66
|
-
# Service
|
67
|
-
#==================================
|
68
|
-
# Load the rates from Maestrano
|
69
|
-
# and populate the then function
|
70
|
-
service.loadRates = () ->
|
71
|
-
self = service
|
72
|
-
query = $http.get(self.ratesUrl)
|
73
|
-
self.then = query.then
|
74
|
-
query.success((data) ->
|
75
|
-
self.rates = data
|
76
|
-
)
|
77
|
-
|
78
|
-
service.newMoneyObject = (amount,currency) ->
|
79
|
-
money = angular.copy(moneyObject)
|
80
|
-
money.amount = amount
|
81
|
-
money.currency = currency
|
82
|
-
return money
|
83
|
-
|
84
|
-
# Take a float amount in whole unit (eg: dollar,Yen)
|
85
|
-
# Take a currency in iso-3 standard (eg: AUD)
|
86
|
-
# ---
|
87
|
-
# This method returns an moneyObject
|
88
|
-
# You can convert rates like that:
|
89
|
-
# ExchangeRates.exchange(100,'AUD').to('USD')
|
90
|
-
service.exchange = (amount,currency) ->
|
91
|
-
return service.newMoneyObject(amount,currency)
|
92
|
-
|
93
|
-
# Getter/Setter for defaultCurrency
|
94
|
-
service.defaultCurrency = (currency = null) ->
|
95
|
-
if angular.isString(currency)
|
96
|
-
service.defCurrency = currency
|
97
|
-
return service.defCurrency
|
98
|
-
|
99
|
-
service.loadRates()
|
100
|
-
|
101
|
-
return service
|
102
|
-
])
|
data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-miscellaneous.js.coffee.erb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
angular.module('maestrano.services.miscellaneous', []).factory('Miscellaneous', ['$http','$q', ($http, $q) ->
|
2
|
-
service = {}
|
3
|
-
|
4
|
-
# Currencies
|
5
|
-
<% currencies = Country.all.map { |country| Country[country[1]].data['currency'] }.select { |e| e != nil }.sort %>
|
6
|
-
<% currencies = (["USD","AUD","EUR"] + currencies).uniq %>
|
7
|
-
service.currencies = <%= currencies %>
|
8
|
-
|
9
|
-
# Default currency
|
10
|
-
service.defaultCurrency = "<%= MnoEnterprise.app_currency %>"
|
11
|
-
|
12
|
-
# Countries
|
13
|
-
service.countries = [
|
14
|
-
<% Country.all.sort.each do |country,code| %>
|
15
|
-
{ label:"<%= country %>", val: "<%= code %>", ext: "<%= Country.new(code).country_code %>" }
|
16
|
-
<% end %>
|
17
|
-
]
|
18
|
-
|
19
|
-
# Default country
|
20
|
-
service.defaultCountry = "<%= MnoEnterprise.app_country %>"
|
21
|
-
|
22
|
-
# Phone country code
|
23
|
-
service.countryCodes = <%= Country.all.map { |c| [c[1],"(#{c[1]}) +#{Country[c[1]].country_code}"] } %>
|
24
|
-
|
25
|
-
# Impac! API URL
|
26
|
-
service.impacUrls = <%= {
|
27
|
-
get_widget: "#{MnoEnterprise.router.impac_root_url}/get_widget"
|
28
|
-
}.to_json %>
|
29
|
-
|
30
|
-
# Impac! Colors configuration
|
31
|
-
service.impacTenantColors = <%= {
|
32
|
-
positive: MnoEnterprise.style.palette.impac.positive,
|
33
|
-
negative: MnoEnterprise.style.palette.impac.negative,
|
34
|
-
array: MnoEnterprise.style.palette.impac.pool
|
35
|
-
}.to_json %>
|
36
|
-
|
37
|
-
# Maestrano Style Configuration
|
38
|
-
service.style = <%= MnoEnterprise.style.to_json %>
|
39
|
-
|
40
|
-
return service
|
41
|
-
|
42
|
-
])
|
43
|
-
|
44
|
-
# Increment version below to force
|
45
|
-
# asset reload
|
46
|
-
# 74
|
@@ -1,67 +0,0 @@
|
|
1
|
-
angular.module('maestrano.services.modal-svc', []).factory( 'ModalSvc', [
|
2
|
-
'$modal','$rootScope','Utilities','DhbOrganizationSvc','TemplatePath',
|
3
|
-
($modal, $rootScope, Utilities, DhbOrganizationSvc, TemplatePath) ->
|
4
|
-
|
5
|
-
# --------------------------------------------------------------------
|
6
|
-
# The goal of this service is to create a generic modal creator
|
7
|
-
# This is a wip
|
8
|
-
# --------------------------------------------------------------------
|
9
|
-
|
10
|
-
service = {}
|
11
|
-
|
12
|
-
# --------------------------------------------------------------------
|
13
|
-
# Generic Modal class
|
14
|
-
# --------------------------------------------------------------------
|
15
|
-
class Modal
|
16
|
-
# Mandatory options:
|
17
|
-
# ------------------
|
18
|
-
# templateUrl: url of the template
|
19
|
-
#
|
20
|
-
# Optional options:
|
21
|
-
# -----------------
|
22
|
-
# backdrop
|
23
|
-
# modalSize
|
24
|
-
# modalClass (e.g. inverse)
|
25
|
-
# callback: function called after proceed() if successful
|
26
|
-
constructor: (@opts) ->
|
27
|
-
# TODO: exceptions if opts is not complete
|
28
|
-
|
29
|
-
config: () ->
|
30
|
-
self = this
|
31
|
-
{
|
32
|
-
instance: {
|
33
|
-
templateUrl: self.opts.templateUrl
|
34
|
-
controller: self.opts.controller
|
35
|
-
backdrop: self.opts.backdrop || 'static'
|
36
|
-
size: self.opts.modalSize || 'lg'
|
37
|
-
windowClass: self.opts.modalClass || 'inverse'
|
38
|
-
resolve: {
|
39
|
-
$modalInstanceCB: (-> return self.opts.callback)
|
40
|
-
}
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
# Open the modal
|
45
|
-
open: () ->
|
46
|
-
self = this
|
47
|
-
$modal.open(self.config().instance)
|
48
|
-
|
49
|
-
# --------------------------------------------------------------------
|
50
|
-
# Service instanciations
|
51
|
-
# --------------------------------------------------------------------
|
52
|
-
service.new = (opts = {}) ->
|
53
|
-
return new Modal(opts)
|
54
|
-
|
55
|
-
service.newOrgModal = (opts = {}) ->
|
56
|
-
opts.templateUrl = TemplatePath['mno_enterprise/modals/new-organization.html']
|
57
|
-
opts.controller = 'NewOrgModalCtrl'
|
58
|
-
return new Modal(opts)
|
59
|
-
|
60
|
-
service.newOrgResellerReqModal = (opts = {}) ->
|
61
|
-
opts.templateUrl = TemplatePath['mno_enterprise/modals/new-organization-reseller-req.html']
|
62
|
-
opts.controller = 'NewOrgResellerReqModalCtrl'
|
63
|
-
return new Modal(opts)
|
64
|
-
|
65
|
-
return service
|
66
|
-
|
67
|
-
])
|
@@ -1,21 +0,0 @@
|
|
1
|
-
maestranoServices = angular.module('maestrano.services',[
|
2
|
-
'maestrano.services.apps-list-helper',
|
3
|
-
'maestrano.services.current-user-svc',
|
4
|
-
'maestrano.services.shopping-cart'
|
5
|
-
'maestrano.services.current-currency',
|
6
|
-
'maestrano.services.miscellaneous',
|
7
|
-
'maestrano.services.marketplace-svc',
|
8
|
-
'maestrano.services.message-svc',
|
9
|
-
'maestrano.services.modal-svc',
|
10
|
-
|
11
|
-
# Dashboard
|
12
|
-
'maestrano.services.dashboard.apps-document',
|
13
|
-
'maestrano.services.dashboard.organization-svc',
|
14
|
-
'maestrano.services.dashboard.team-svc'
|
15
|
-
'maestrano.services.dashboard.user',
|
16
|
-
'maestrano.services.dashboard.app-instance',
|
17
|
-
|
18
|
-
# Impac configuration
|
19
|
-
'maestrano.services.impac-config-svc'
|
20
|
-
|
21
|
-
])
|
data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-shopping-cart.js.coffee
DELETED
@@ -1,361 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Main Shopping cart steps
|
3
|
-
# 0) start
|
4
|
-
# 1) identifyUser
|
5
|
-
# 2) selectOrga (optional)
|
6
|
-
# 3) chooseApps
|
7
|
-
# 4) chooseDeal (optional)
|
8
|
-
# 5) chooseSupport
|
9
|
-
# 6) chooseExtras
|
10
|
-
# 7) orderSummary
|
11
|
-
# 8) paymentScreen (optional)
|
12
|
-
# 9) checkout
|
13
|
-
# 10) confirmScreen (optional)
|
14
|
-
#
|
15
|
-
angular.module('maestrano.services.shopping-cart', [])
|
16
|
-
.factory('ShoppingCart', ['$http','$q','CurrentUserSvc', ($http,$q,$CurrentUserSvc) ->
|
17
|
-
service = {}
|
18
|
-
service.config = {
|
19
|
-
allAppsPath: '/mnoe/jpi/v1/shopping_cart/apps',
|
20
|
-
allOrgsPath: '/mnoe/jpi/v1/shopping_cart/organizations'
|
21
|
-
cartRootPath: '/mnoe/jpi/v1/shopping_cart'
|
22
|
-
|
23
|
-
deals: [{ entity: 'deal', product: 'new_6_month_prepay'},
|
24
|
-
{ entity: 'deal', product: 'new_12_month_prepay'},
|
25
|
-
{ entity: 'deal', product: 'starter_pack_deal'}]
|
26
|
-
|
27
|
-
firstStep: 'identifyUser'
|
28
|
-
steps: {
|
29
|
-
identifyUser: {
|
30
|
-
number: 0
|
31
|
-
skipCondition: ( (svc)-> svc.data.user? && svc.data.user.email? && svc.data.user.email != '')
|
32
|
-
next: 'selectOrga'
|
33
|
-
showOrder: false
|
34
|
-
showFunnel: false
|
35
|
-
},
|
36
|
-
selectOrga: {
|
37
|
-
number: 0
|
38
|
-
skipCondition: ( (svc)-> svc.data.organization? )
|
39
|
-
next: 'chooseApps'
|
40
|
-
showOrder: false
|
41
|
-
showFunnel: false
|
42
|
-
},
|
43
|
-
chooseApps: {
|
44
|
-
number: 1
|
45
|
-
skipCondition: ( (svc)-> svc.data.fasttrack )
|
46
|
-
next: 'chooseDeal'
|
47
|
-
showOrder: true
|
48
|
-
showFunnel: true
|
49
|
-
orderMode: 'list'
|
50
|
-
},
|
51
|
-
chooseDeal: {
|
52
|
-
number: 2
|
53
|
-
skipCondition: ( (svc)-> svc.data.fasttrack || !svc.isDealProposed() )
|
54
|
-
next: 'chooseSupport'
|
55
|
-
showOrder: true
|
56
|
-
showFunnel: true
|
57
|
-
orderMode: 'list'
|
58
|
-
},
|
59
|
-
chooseSupport: {
|
60
|
-
number: 2
|
61
|
-
skipCondition: ( (svc)-> svc.data.fasttrack )
|
62
|
-
next: 'chooseExtras'
|
63
|
-
showOrder: true
|
64
|
-
showFunnel: true
|
65
|
-
orderMode: 'list'
|
66
|
-
},
|
67
|
-
chooseExtras: {
|
68
|
-
number: 3
|
69
|
-
skipCondition: ( (svc)-> svc.data.fasttrack )
|
70
|
-
next: 'orderSummary'
|
71
|
-
showOrder: true
|
72
|
-
showFunnel: true
|
73
|
-
orderMode: 'list'
|
74
|
-
},
|
75
|
-
orderSummary: {
|
76
|
-
number: 4
|
77
|
-
next: 'ccDetails'
|
78
|
-
showOrder: true
|
79
|
-
showFunnel: true
|
80
|
-
orderMode: 'summary'
|
81
|
-
},
|
82
|
-
ccDetails: {
|
83
|
-
number: 4
|
84
|
-
next: 'confirmScreen'
|
85
|
-
showOrder: true
|
86
|
-
showFunnel: true
|
87
|
-
orderMode: 'summary'
|
88
|
-
},
|
89
|
-
confirmScreen: {
|
90
|
-
number: 4
|
91
|
-
showOrder: false
|
92
|
-
showFunnel: false
|
93
|
-
},
|
94
|
-
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
|
99
|
-
#==========================================
|
100
|
-
# Workflow functions
|
101
|
-
#==========================================
|
102
|
-
service.setLoading = (val)->
|
103
|
-
service.state.loading = val
|
104
|
-
|
105
|
-
# Switch the cart to a new step
|
106
|
-
service.switchStepTo = (stepName) ->
|
107
|
-
self = service
|
108
|
-
self.state.stepHist.push(self.state.step)
|
109
|
-
self.state.subStep = null
|
110
|
-
self.state.step = stepName
|
111
|
-
|
112
|
-
service.switchSubStepTo = (subStepName) ->
|
113
|
-
self = service
|
114
|
-
self.state.subStep = subStepName
|
115
|
-
|
116
|
-
# Move the cart workflow to the next
|
117
|
-
# step
|
118
|
-
# Passing is a step in argument is optional
|
119
|
-
# and only used by the next method itself
|
120
|
-
# when it need to skip steps (recursive call)
|
121
|
-
service.next = (currStep = null)->
|
122
|
-
self = service
|
123
|
-
|
124
|
-
# We get the next step to target
|
125
|
-
currentStep = (currStep || self.state.step)
|
126
|
-
if currentStep
|
127
|
-
nextStep = self.config.steps[currentStep]['next']
|
128
|
-
else
|
129
|
-
nextStep = self.config.firstStep
|
130
|
-
|
131
|
-
# Exit if no next step
|
132
|
-
unless nextStep?
|
133
|
-
return null
|
134
|
-
|
135
|
-
# Check if we can skip it
|
136
|
-
if angular.isFunction(self.config.steps[nextStep]['skipCondition'])
|
137
|
-
if self.config.steps[nextStep]['skipCondition'](self)
|
138
|
-
return self.next(nextStep)
|
139
|
-
|
140
|
-
# Switch to the nextStep
|
141
|
-
self.switchStepTo(nextStep)
|
142
|
-
|
143
|
-
# Go back one step
|
144
|
-
service.back = ()->
|
145
|
-
self = service
|
146
|
-
self.state.step = self.state.stepHist.pop()
|
147
|
-
return self.state.step
|
148
|
-
|
149
|
-
#==========================================
|
150
|
-
# HTTP functions
|
151
|
-
#==========================================
|
152
|
-
service.addBundle = (bundle = null)->
|
153
|
-
self = service
|
154
|
-
return false unless angular.isObject(bundle)
|
155
|
-
|
156
|
-
# Register bundle
|
157
|
-
self.$bundle = bundle
|
158
|
-
|
159
|
-
# Check if we should fasttrack
|
160
|
-
self.data.fasttrack = self.$bundle.fasttrack || false
|
161
|
-
|
162
|
-
# Retrieve the list of available applications to purchase
|
163
|
-
# Also add any app from the provided bundle that is not
|
164
|
-
# in the list of available apps (useful to display sandbox apps or non-active
|
165
|
-
# apps properly when they are specifically chosen)
|
166
|
-
service.getApps = ()->
|
167
|
-
self = service
|
168
|
-
return self.$q['apps'] if self.$q['apps']
|
169
|
-
|
170
|
-
# If a bundle is present, pass the apps as parameter to ensure
|
171
|
-
# they are in the returned list
|
172
|
-
# Need to pass app_instances as JSON as $http.get 'params' doe not handle
|
173
|
-
# automated conversion of JS objects
|
174
|
-
config = {}
|
175
|
-
config['params'] = { ensure_apps: angular.toJson(self.$bundle.app_instances) } if self.$bundle
|
176
|
-
|
177
|
-
# Fetch the apps
|
178
|
-
path = self.config.allAppsPath
|
179
|
-
self.$q['apps'] = $http.get(path,config).then((result)-> self.data.apps = result['data'])
|
180
|
-
|
181
|
-
# Return the promise
|
182
|
-
self.$q['apps']
|
183
|
-
|
184
|
-
service.getOrganizations = () ->
|
185
|
-
self = service
|
186
|
-
unless self.$q['organizations']
|
187
|
-
path = self.config.allOrgsPath
|
188
|
-
self.$q['organizations'] = $http.get(path).then((result)-> self.data.organizations = result['data'])
|
189
|
-
self.$q['organizations']
|
190
|
-
|
191
|
-
# Load details about the current user
|
192
|
-
service.getUser = () ->
|
193
|
-
self = service
|
194
|
-
$CurrentUserSvc.loadDocument().then(
|
195
|
-
(result) ->
|
196
|
-
self.data.user = result['data']['user']
|
197
|
-
)
|
198
|
-
|
199
|
-
# Call user service and log the current
|
200
|
-
# user in
|
201
|
-
service.userSignIn = (email,password) ->
|
202
|
-
self = service
|
203
|
-
$CurrentUserSvc.signIn(email,password)
|
204
|
-
.then((user) -> self.data.user = user)
|
205
|
-
|
206
|
-
# Call user service and sign the current
|
207
|
-
# user up
|
208
|
-
service.userSignUp = (hash) ->
|
209
|
-
self = service
|
210
|
-
$CurrentUserSvc.signUp(hash)
|
211
|
-
.then((user) -> self.data.user = user)
|
212
|
-
|
213
|
-
# Remotely push an item to the cart, update
|
214
|
-
# the item locally with the response as well
|
215
|
-
# as the financials
|
216
|
-
# TODO: id should actually be generated
|
217
|
-
# on the backend side
|
218
|
-
service.upsertItem = (hash) ->
|
219
|
-
self = service
|
220
|
-
path = "#{self.config.cartRootPath}/#{self.cart.id}/upsert_item"
|
221
|
-
$http.put(path,{ item: hash }).then(
|
222
|
-
(result) ->
|
223
|
-
angular.extend(hash,result.data.item)
|
224
|
-
angular.extend(self.cart, result.data.cart)
|
225
|
-
)
|
226
|
-
|
227
|
-
# Remotely remove an item from the cart and
|
228
|
-
# update the totals
|
229
|
-
service.removeItem = (hash) ->
|
230
|
-
self = service
|
231
|
-
path = "#{self.config.cartRootPath}/#{self.cart.id}/remove_item"
|
232
|
-
$http.put(path,{ item: hash }).then(
|
233
|
-
(result) ->
|
234
|
-
angular.extend(self.cart, result.data.cart)
|
235
|
-
)
|
236
|
-
|
237
|
-
# Generate an item id for a new item
|
238
|
-
# Used for item edition
|
239
|
-
# TODO: refactor - remove harcoded offset
|
240
|
-
service.generateItemId = ->
|
241
|
-
self = service
|
242
|
-
self.state.itemIdCounter += 1
|
243
|
-
id = self.state.itemIdCounter
|
244
|
-
id += 1000
|
245
|
-
if self.cart? && angular.isNumber(self.cart.lastItemId)
|
246
|
-
id += self.cart.lastItemId
|
247
|
-
id.toString()
|
248
|
-
|
249
|
-
# Create a new cart using the current
|
250
|
-
# cart user and provided organization
|
251
|
-
service.createCart = (orga)->
|
252
|
-
self = service
|
253
|
-
path = self.config.cartRootPath
|
254
|
-
data = { shopping_cart: { organization_id: orga.id, bundle: self.$bundle } }
|
255
|
-
$http.post(path,data).then (result) ->
|
256
|
-
self.data.organization = orga
|
257
|
-
self.cart = result['data']
|
258
|
-
|
259
|
-
service.checkout = (creditCard = {})->
|
260
|
-
self = service
|
261
|
-
path = "#{self.config.cartRootPath}/#{self.cart.id}/checkout"
|
262
|
-
$http.put(path,{ credit_card: creditCard}).then(
|
263
|
-
(result) ->
|
264
|
-
angular.extend(self.cart, result.data)
|
265
|
-
)
|
266
|
-
|
267
|
-
|
268
|
-
#==========================================
|
269
|
-
# Step specific methods
|
270
|
-
#==========================================
|
271
|
-
# Check whether we should display the deal page
|
272
|
-
# or not
|
273
|
-
service.isDealProposed = ()->
|
274
|
-
hasHostedApp = _.findWhere(service.cart.content.appInstances, { product: 'cube'})?
|
275
|
-
createdAt = moment(service.data.user.createdAt)
|
276
|
-
hasHostedApp && createdAt > moment().subtract({days:1})
|
277
|
-
|
278
|
-
# Should we show the order summary at the current
|
279
|
-
# step
|
280
|
-
service.isOrderShown = ->
|
281
|
-
self = service
|
282
|
-
self.config.steps[self.state.step]? && self.config.steps[self.state.step].showOrder
|
283
|
-
|
284
|
-
# Should we show the funnel for the current
|
285
|
-
# step
|
286
|
-
service.isFunnelShown = ->
|
287
|
-
self = service
|
288
|
-
self.config.steps[self.state.step]? && self.config.steps[self.state.step].showFunnel
|
289
|
-
|
290
|
-
service.stepNumber = ->
|
291
|
-
self = service
|
292
|
-
self.config.steps[self.state.step]? && self.config.steps[self.state.step].number
|
293
|
-
|
294
|
-
# Should the side area be a list or summary?
|
295
|
-
service.sideAreaMode = ->
|
296
|
-
self = service
|
297
|
-
self.config.steps[self.state.step]? && self.config.steps[self.state.step].orderMode
|
298
|
-
|
299
|
-
service.isPartnerFieldShown = ->
|
300
|
-
service.isDealProposed()
|
301
|
-
|
302
|
-
#==========================================
|
303
|
-
# Main functions
|
304
|
-
#==========================================
|
305
|
-
# Reset the cart service internal data
|
306
|
-
service.initialize = ()->
|
307
|
-
service.$bundle = {}
|
308
|
-
service.$q = {}
|
309
|
-
service.data = {
|
310
|
-
apps: [],
|
311
|
-
organizations: null,
|
312
|
-
user: null
|
313
|
-
fasttrack: false
|
314
|
-
}
|
315
|
-
service.cart = {
|
316
|
-
id: null
|
317
|
-
lastItemId: 0
|
318
|
-
content: {
|
319
|
-
appInstances: {}
|
320
|
-
services: {}
|
321
|
-
support: null
|
322
|
-
deal: null
|
323
|
-
}
|
324
|
-
total: {}
|
325
|
-
orderList: {
|
326
|
-
hourly: []
|
327
|
-
monthly: []
|
328
|
-
adhoc: []
|
329
|
-
variable: []
|
330
|
-
}
|
331
|
-
}
|
332
|
-
service.state = {
|
333
|
-
subStep: null
|
334
|
-
step: null
|
335
|
-
stepHist: []
|
336
|
-
loading: false
|
337
|
-
totalsLoading: false
|
338
|
-
itemIdCounter: 0
|
339
|
-
}
|
340
|
-
|
341
|
-
# Initialize a new shopping cart workflow
|
342
|
-
service.start = (bundle = null)->
|
343
|
-
self = service
|
344
|
-
# Reset the service
|
345
|
-
self.initialize()
|
346
|
-
|
347
|
-
# Process the bundle
|
348
|
-
self.addBundle(bundle)
|
349
|
-
|
350
|
-
# Load the apps in the background
|
351
|
-
self.getApps()
|
352
|
-
|
353
|
-
# Get the user info
|
354
|
-
self.getUser().then ->
|
355
|
-
# Move to the next step
|
356
|
-
self.next()
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
return service
|
361
|
-
])
|