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,59 +0,0 @@
|
|
1
|
-
module = angular.module('maestrano.components.mno-partner-contact',['maestrano.assets'])
|
2
|
-
|
3
|
-
#============================================
|
4
|
-
# Component 'partner contact'
|
5
|
-
#============================================
|
6
|
-
module.controller('MnoPartnerContactCtrl',[
|
7
|
-
'$scope', '$rootScope', '$http','$modal',
|
8
|
-
($scope, $rootScope, $http, $modal) ->
|
9
|
-
$scope.assetPath = $rootScope.assetPath
|
10
|
-
|
11
|
-
$scope.templateParameter = {}
|
12
|
-
$scope.templateParameter.modalOpen = false
|
13
|
-
$scope.templateParameter.feedbackMessage = ""
|
14
|
-
$scope.templateParameter.errorMessage = ""
|
15
|
-
|
16
|
-
$scope.openCloseModal = ->
|
17
|
-
if $scope.templateParameter.modalOpen
|
18
|
-
$scope.templateParameterInstance.close()
|
19
|
-
$scope.templateParameter.modalOpen = false
|
20
|
-
else
|
21
|
-
$scope.templateParameterInstance = $modal.open(templateUrl: 'internal-template-param-modal.html', scope: $scope)
|
22
|
-
$scope.templateParameter.modalOpen = true
|
23
|
-
|
24
|
-
$scope.form = {}
|
25
|
-
|
26
|
-
$scope.sendRequest = ->
|
27
|
-
$scope.form.partner_id = $scope.partnerId
|
28
|
-
$scope.form.inProgress = true
|
29
|
-
$http.post('/mnoe/jpi/v1/partners/contact', { form: $scope.form }).then(
|
30
|
-
(success) ->
|
31
|
-
$scope.form.inProgress = false
|
32
|
-
$scope.form.first_name = ""
|
33
|
-
$scope.form.last_name = ""
|
34
|
-
$scope.form.email = ""
|
35
|
-
$scope.form.message = ""
|
36
|
-
$scope.templateParameter.feedbackMessage = "Your message has been successfully sent"
|
37
|
-
,(errors) ->
|
38
|
-
$scope.templateParameter.errorMessage = "Your message couldn't be sent. Please try again later."
|
39
|
-
|
40
|
-
)
|
41
|
-
|
42
|
-
|
43
|
-
$scope.openCloseModalFun = $scope.openCloseModal
|
44
|
-
|
45
|
-
])
|
46
|
-
|
47
|
-
module.directive('mnoPartnerContact', ['TemplatePath', (TemplatePath) ->
|
48
|
-
return {
|
49
|
-
restrict: 'A',
|
50
|
-
scope: {
|
51
|
-
openCloseModalFun: '=',
|
52
|
-
partnerName: '@',
|
53
|
-
partnerId: '@',
|
54
|
-
},
|
55
|
-
templateUrl: TemplatePath['mno_enterprise/maestrano-components/partner_contact.html'],
|
56
|
-
controller: 'MnoPartnerContactCtrl',
|
57
|
-
}
|
58
|
-
])
|
59
|
-
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module = angular.module('maestrano.components.mno-price-converter',['maestrano.assets'])
|
2
|
-
|
3
|
-
#============================================
|
4
|
-
# Component 'Price Converter'
|
5
|
-
#============================================
|
6
|
-
|
7
|
-
|
8
|
-
module.controller('MnoPriceConverterCtrl',['$scope', 'ExchangeRates', 'CurrentCurrency', ($scope, ExchangeRates, CurrentCurrency) ->
|
9
|
-
|
10
|
-
ExchangeRates.then ->
|
11
|
-
|
12
|
-
$scope.currencies = ["AUD","CAD","CNY","EUR","GBP","HKD","INR","JPY","NZD","SGD","USD",]
|
13
|
-
$scope.currentCurrency = ExchangeRates.defaultCurrency()
|
14
|
-
|
15
|
-
# Set currency and outject currency in scope
|
16
|
-
$scope.setCurrency = (currency) ->
|
17
|
-
ExchangeRates.defaultCurrency(currency)
|
18
|
-
$scope.currency = currency
|
19
|
-
|
20
|
-
$scope.convertedPrice = ->
|
21
|
-
if $scope.noConversion
|
22
|
-
return ExchangeRates.newMoneyObject($scope.price,$scope.currency)
|
23
|
-
else
|
24
|
-
return ExchangeRates.exchange($scope.price, ($scope.currency || 'AUD')).to(CurrentCurrency.val)
|
25
|
-
|
26
|
-
$scope.style = ->
|
27
|
-
if $scope.currencyResponsive
|
28
|
-
switch CurrentCurrency.val
|
29
|
-
when 'CNY' then 'font-size:28px;'
|
30
|
-
when 'HKD' then 'font-size:29px;'
|
31
|
-
when 'INR' then 'font-size:25px;'
|
32
|
-
when 'JPY' then 'font-size:26px;'
|
33
|
-
when 'PHP' then 'font-size:28px;'
|
34
|
-
else 'font-size:38px;'
|
35
|
-
|
36
|
-
])
|
37
|
-
|
38
|
-
module.directive('mnoPriceConverter', ['TemplatePath', (TemplatePath) ->
|
39
|
-
return {
|
40
|
-
restrict: 'A',
|
41
|
-
scope:
|
42
|
-
price:'='
|
43
|
-
currencyResponsive:'@'
|
44
|
-
currency: '@'
|
45
|
-
noConversion: '@'
|
46
|
-
template: "<span style='{{style()}}'>{{convertedPrice().format()}}</span>",
|
47
|
-
controller: 'MnoPriceConverterCtrl',
|
48
|
-
}
|
49
|
-
])
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module = angular.module('maestrano.components.mno-scroll-to',['maestrano.assets'])
|
2
|
-
|
3
|
-
module.directive('mnoScrollTo', ['$location', '$anchorScroll', ($location, $anchorScroll) ->
|
4
|
-
return {
|
5
|
-
restrict: 'A'
|
6
|
-
scope:
|
7
|
-
mnoScrollTo: '@'
|
8
|
-
link: (scope, element, attrs) ->
|
9
|
-
element.on "click", (event) ->
|
10
|
-
event.preventDefault()
|
11
|
-
$location.hash(scope.mnoScrollTo)
|
12
|
-
$anchorScroll()
|
13
|
-
}
|
14
|
-
])
|
@@ -1,89 +0,0 @@
|
|
1
|
-
module = angular.module('maestrano.components.mno-typeahead',[])
|
2
|
-
|
3
|
-
# Remote typeahead.
|
4
|
-
# E.g:
|
5
|
-
#
|
6
|
-
# <input type="text" mno-typeahead='tpaResult' remote = '/path/to/typeahead', 'min-length' => '6'>
|
7
|
-
# <div ng-show="tpaResult.isReady() && tpaResult.isEmpty()" }>
|
8
|
-
# No results!
|
9
|
-
# </div>
|
10
|
-
#
|
11
|
-
#
|
12
|
-
# In this case the scope variable 'tpaResult' can be used to:
|
13
|
-
# tpaResult.list: get the list of results
|
14
|
-
# tpaResult.isEmpty(): check if the list of results is empty
|
15
|
-
# tpaResult.hasAny(): check if the list has any result
|
16
|
-
# tpaResult.isReady(): check the input has a value that's greater than the 'min-length'
|
17
|
-
# tpaResult.isLoading(): check whether the widget is loading
|
18
|
-
#
|
19
|
-
module.directive('mnoTypeahead', ['$http', '$window', ($http, $window) ->
|
20
|
-
return {
|
21
|
-
restrict: 'A'
|
22
|
-
scope: {
|
23
|
-
mnoTypeahead: '='
|
24
|
-
minLength: '@'
|
25
|
-
remote: '@'
|
26
|
-
}
|
27
|
-
link: (scope, element, attrs) ->
|
28
|
-
scope.minLength ||= 3
|
29
|
-
scope.mnoTypeahead = { list:[] }
|
30
|
-
return false unless angular.isString(scope.remote)
|
31
|
-
scope.qList = []
|
32
|
-
|
33
|
-
scope.mnoTypeahead.isLoading = ->
|
34
|
-
scope.loading
|
35
|
-
|
36
|
-
scope.mnoTypeahead.hasAny = ->
|
37
|
-
scope.mnoTypeahead.list.length > 0
|
38
|
-
|
39
|
-
scope.mnoTypeahead.isEmpty = ->
|
40
|
-
scope.mnoTypeahead.list.length == 0
|
41
|
-
|
42
|
-
scope.mnoTypeahead.isReady = ->
|
43
|
-
!scope.loading && scope.currVal? && scope.currVal.length > 0 && scope.currVal.length > scope.minLength
|
44
|
-
|
45
|
-
# Fetch data remotely. The typeahead widget is kept 'loading'
|
46
|
-
# if there is a need to refetch or if there are still queries
|
47
|
-
# being performed (qList)
|
48
|
-
scope.fetchData = ->
|
49
|
-
scope.needFetch = false
|
50
|
-
q = $http.get(scope.remote + "?q=#{scope.currVal}")
|
51
|
-
scope.qList.push(q)
|
52
|
-
|
53
|
-
q.success (data) ->
|
54
|
-
scope.qList.shift()
|
55
|
-
unless scope.needFetch || scope.qList.length > 0
|
56
|
-
scope.loading = false
|
57
|
-
angular.copy(data,scope.mnoTypeahead.list)
|
58
|
-
|
59
|
-
# Trigger a fetch if there is a need for it
|
60
|
-
# Used by the scheduler at the bottom
|
61
|
-
scope.pollData = ->
|
62
|
-
if scope.needFetch
|
63
|
-
scope.fetchData()
|
64
|
-
|
65
|
-
# Flag the widget as 'loading' and set needFetch to
|
66
|
-
# true to trigger a fetch at next interval
|
67
|
-
scope.triggerFetch = ->
|
68
|
-
scope.loading = true
|
69
|
-
scope.needFetch = true
|
70
|
-
|
71
|
-
# Binding method to be used on keyup/keydown event
|
72
|
-
scope.refresh = ->
|
73
|
-
scope.minLength ||= 3
|
74
|
-
scope.currVal = element.val()
|
75
|
-
|
76
|
-
if scope.currVal.length > 0 && scope.currVal.length >= scope.minLength
|
77
|
-
scope.triggerFetch()
|
78
|
-
else
|
79
|
-
scope.mnoTypeahead.list.length = 0
|
80
|
-
|
81
|
-
# Bind refresh on keystrokes
|
82
|
-
element.keyup(scope.refresh)
|
83
|
-
element.keydown(scope.refresh)
|
84
|
-
|
85
|
-
# Schedule periodic data polling (rate limit of one query per second)
|
86
|
-
$window.setInterval((-> scope.pollData()), 1000)
|
87
|
-
|
88
|
-
}
|
89
|
-
])
|
@@ -1,256 +0,0 @@
|
|
1
|
-
module = angular.module('maestrano.user-setup.index',['maestrano.assets'])
|
2
|
-
|
3
|
-
module.controller('UserSetupIndexCtrl',[
|
4
|
-
'$scope','$http','$q','$filter','$modal','$mdToast','$timeout','$log','AssetPath','Utilities','Miscellaneous','DhbOrganizationSvc','CurrentUserSvc','MarketplaceSvc','TemplatePath',
|
5
|
-
($scope, $http, $q, $filter, $modal, $mdToast, $timeout, $log, AssetPath, Utilities, Miscellaneous, DhbOrganizationSvc, CurrentUserSvc, MarketplaceSvc, TemplatePath) ->
|
6
|
-
|
7
|
-
REAL_PROVISIONING_ENABLED = false
|
8
|
-
|
9
|
-
#====================================
|
10
|
-
# Construction
|
11
|
-
#====================================
|
12
|
-
$scope.isLoading = true
|
13
|
-
$scope.myApps = []
|
14
|
-
$scope.selectedCategories = {}
|
15
|
-
|
16
|
-
$scope.lists = {
|
17
|
-
industries: [
|
18
|
-
"Agriculture",
|
19
|
-
"Arts",
|
20
|
-
"Construction",
|
21
|
-
"Consumer Goods",
|
22
|
-
"Corporate",
|
23
|
-
"Educational",
|
24
|
-
"Finance",
|
25
|
-
"Government",
|
26
|
-
"High Tech",
|
27
|
-
"Legal",
|
28
|
-
"Manufacturing",
|
29
|
-
"Media",
|
30
|
-
"Medical",
|
31
|
-
"Non-Profit",
|
32
|
-
"Recreational",
|
33
|
-
"Service Transportation",
|
34
|
-
"Other",
|
35
|
-
],
|
36
|
-
sizes: [
|
37
|
-
{label: "1 to 5 employees", value: "1 - 5"},
|
38
|
-
{label: "6 to 10 employees", value: "6 - 10"},
|
39
|
-
{label: "11 to 50 employees", value: "11 - 50"},
|
40
|
-
{label: "51 to 200 employees", value: "51 - 200"},
|
41
|
-
{label: "+200 employees", value: "+200"},
|
42
|
-
],
|
43
|
-
popularApps: [
|
44
|
-
'xero','quickbooks','myob','vtiger6','sugarcrm','wordpress','timetrex','simpleinvoices','orangehrm', 'prestashop'
|
45
|
-
],
|
46
|
-
bundleCategories: {
|
47
|
-
"Accounting": [
|
48
|
-
"Manage your books",
|
49
|
-
"Manage multiple currency invoices",
|
50
|
-
"Track your finances",
|
51
|
-
"Reconcile your bank statements",
|
52
|
-
"Manage your inventory",
|
53
|
-
"Automate general ledger generation"
|
54
|
-
],
|
55
|
-
"Sales and Marketing": [
|
56
|
-
"Manage my contacts, customers and suppliers",
|
57
|
-
"Automate sales management",
|
58
|
-
"Forecast sales",
|
59
|
-
"Manage my purchase orders",
|
60
|
-
"Create and manage accounts payable & receivable",
|
61
|
-
"Manage support tickets"
|
62
|
-
],
|
63
|
-
"Content Management": [
|
64
|
-
"Create my website",
|
65
|
-
"Create a private portal",
|
66
|
-
"Organize my files",
|
67
|
-
"Create a vault for my files"
|
68
|
-
],
|
69
|
-
"Business Operations": [
|
70
|
-
"Have an overview on tasks to perform",
|
71
|
-
"Schedule an agenda and create milestones",
|
72
|
-
"Keep track of my production"
|
73
|
-
"Map processes"
|
74
|
-
"Design and test my company's processes"
|
75
|
-
],
|
76
|
-
"Project Managment": [
|
77
|
-
"Automate reminders on projects",
|
78
|
-
"Communicate instantly with my collaborators",
|
79
|
-
"Manage to do lists",
|
80
|
-
"create Gantt charts"
|
81
|
-
],
|
82
|
-
"HR": [
|
83
|
-
"Manage and automate payroll",
|
84
|
-
"Manage recruitment process",
|
85
|
-
"Automate absence management",
|
86
|
-
"Manage training and development"
|
87
|
-
],
|
88
|
-
"Learning Management System": [
|
89
|
-
"Create online classes and lessons",
|
90
|
-
"Create and manage discussion forum",
|
91
|
-
"Grade assignments",
|
92
|
-
"Create surveys"
|
93
|
-
],
|
94
|
-
"Online Surveying": [
|
95
|
-
"Follow up on online survey reports",
|
96
|
-
"Collect data through online surveys",
|
97
|
-
"Create graphs with your data"
|
98
|
-
]
|
99
|
-
},
|
100
|
-
recommendations: {
|
101
|
-
"Accounting": 'xero',
|
102
|
-
"Sales and Marketing": 'vtiger6',
|
103
|
-
"Content Management": 'wordpress',
|
104
|
-
"Business Operations": 'dolibarr',
|
105
|
-
"Project Managment": 'collabtive',
|
106
|
-
"HR": 'orangehrm',
|
107
|
-
"Learning Management System": 'moodle',
|
108
|
-
"Online Surveying": 'limesurvey'
|
109
|
-
}
|
110
|
-
}
|
111
|
-
|
112
|
-
$scope.workflows = {
|
113
|
-
step1: -> DhbOrganizationSvc.organization.update($scope.company)
|
114
|
-
}
|
115
|
-
|
116
|
-
# Scope initialization
|
117
|
-
$scope.initialize = ->
|
118
|
-
$scope.step = 1
|
119
|
-
$scope.locals = {}
|
120
|
-
$scope.user = CurrentUserSvc.document.current_user
|
121
|
-
$scope.company = DhbOrganizationSvc.data.organization
|
122
|
-
$scope.apps = MarketplaceSvc.data.apps
|
123
|
-
$scope.isLoading = false
|
124
|
-
|
125
|
-
#====================================
|
126
|
-
# Functions
|
127
|
-
#====================================
|
128
|
-
# Go to the next step - potentially perform an action
|
129
|
-
$scope.next = ->
|
130
|
-
$scope.isLoading = true
|
131
|
-
|
132
|
-
# Fetch "next" action or default to resolved promise
|
133
|
-
nextAction = $scope.workflows["step#{$scope.step}"]
|
134
|
-
unless nextAction
|
135
|
-
q = $q.defer()
|
136
|
-
q.resolve()
|
137
|
-
nextAction = -> q.promise
|
138
|
-
|
139
|
-
nextAction().then ->
|
140
|
-
$scope.skip()
|
141
|
-
|
142
|
-
# Skip the current step - no action performed
|
143
|
-
$scope.skip = ->
|
144
|
-
$scope.step += 1
|
145
|
-
$scope.isLoading = false
|
146
|
-
|
147
|
-
$scope.back = ->
|
148
|
-
$scope.step -= 1
|
149
|
-
$scope.isLoading = false
|
150
|
-
|
151
|
-
$scope.finishSetup = ->
|
152
|
-
if REAL_PROVISIONING_ENABLED && $scope.myApps.length > 0
|
153
|
-
$scope.provisionBasket()
|
154
|
-
else
|
155
|
-
$scope.redirectToMyspace()
|
156
|
-
|
157
|
-
$scope.redirectToMyspace = ->
|
158
|
-
window.location.href = "/mnoe/myspace"
|
159
|
-
|
160
|
-
$scope.provisionBasket = ->
|
161
|
-
q = _.reduce($scope.myApps, ((memo, e) -> "#{memo}&apps[]=#{e.nid}"),"")
|
162
|
-
window.location.href = "/mnoe/provision/new?#{q}"
|
163
|
-
|
164
|
-
# Return the list of popular apps in the order specified by the configuration array
|
165
|
-
$scope.popularApps = ->
|
166
|
-
_.map $scope.lists.popularApps, (e) -> _.findWhere($scope.apps, nid: e)
|
167
|
-
|
168
|
-
|
169
|
-
# Show a notification message at the top right of the screen
|
170
|
-
$scope.showMessageToast = (msg)->
|
171
|
-
$mdToast.show(
|
172
|
-
$mdToast.simple()
|
173
|
-
.content(msg)
|
174
|
-
.position("top right")
|
175
|
-
.hideDelay(4000)
|
176
|
-
.parent(angular.element('.user-setup'))
|
177
|
-
)
|
178
|
-
|
179
|
-
# Recommend applications based on selected categories
|
180
|
-
$scope.recommendedApps = ->
|
181
|
-
bla = _.reduce $scope.selectedCategories, (memo, v,k) ->
|
182
|
-
memo.push(_.findWhere($scope.apps, nid: $scope.lists.recommendations[k])) if v
|
183
|
-
memo
|
184
|
-
,[]
|
185
|
-
|
186
|
-
# Add an application to the user basket
|
187
|
-
$scope.addAppToBasket = (app) ->
|
188
|
-
$scope.showMessageToast("#{app.name} has been successfully added to your free trial!")
|
189
|
-
$scope.myApps.push(app) unless $scope.isAppInBasket(app)
|
190
|
-
|
191
|
-
# Remove an application from the user basket
|
192
|
-
$scope.removeAppFromBasket = (app) ->
|
193
|
-
$scope.showMessageToast("#{app.name} has been removed from your free trial")
|
194
|
-
if $scope.isAppInBasket
|
195
|
-
index = $scope.myApps.indexOf(app)
|
196
|
-
$scope.myApps.splice(index, 1)
|
197
|
-
|
198
|
-
# Add/remove an application from the user basket
|
199
|
-
$scope.toggleAppInBasket = (app) ->
|
200
|
-
if $scope.isAppInBasket(app) then $scope.removeAppFromBasket(app) else $scope.addAppToBasket(app)
|
201
|
-
|
202
|
-
# Return true if the provided app is in the user basket - false otherwise
|
203
|
-
$scope.isAppInBasket = (app) ->
|
204
|
-
_.contains($scope.myApps,app)
|
205
|
-
|
206
|
-
|
207
|
-
$scope.toggleOrConnect = (app) ->
|
208
|
-
if $scope.isAppInBasket(app) then $scope.removeAppFromBasket(app) else $scope.connectApp(app)
|
209
|
-
|
210
|
-
# Switch to the connect screen
|
211
|
-
$scope.connectApp = (app) ->
|
212
|
-
$scope.connectPane.currentApp = app
|
213
|
-
$timeout(
|
214
|
-
->
|
215
|
-
$scope.connectPane.shown = true
|
216
|
-
,300)
|
217
|
-
|
218
|
-
#====================================
|
219
|
-
# Connect Pane
|
220
|
-
#====================================
|
221
|
-
$scope.connectPane = {}
|
222
|
-
|
223
|
-
$scope.connectPane.connect = ->
|
224
|
-
self = $scope.connectPane
|
225
|
-
self.loading = true
|
226
|
-
$timeout(
|
227
|
-
->
|
228
|
-
$scope.addAppToBasket(self.currentApp)
|
229
|
-
self.cancel()
|
230
|
-
, 2000)
|
231
|
-
|
232
|
-
|
233
|
-
$scope.connectPane.cancel = ->
|
234
|
-
self = $scope.connectPane
|
235
|
-
self.loading = false
|
236
|
-
self.shown = false
|
237
|
-
self.currentApp = undefined
|
238
|
-
|
239
|
-
#====================================
|
240
|
-
# Initialization
|
241
|
-
#====================================
|
242
|
-
CurrentUserSvc.loadDocument().then ->
|
243
|
-
DhbOrganizationSvc.configure(id: CurrentUserSvc.document.current_user.organizations[0].id)
|
244
|
-
$q.all([DhbOrganizationSvc.load(),MarketplaceSvc.load()]).then ->
|
245
|
-
$scope.initialize()
|
246
|
-
])
|
247
|
-
|
248
|
-
module.directive('userSetupIndex', ['TemplatePath', (TemplatePath) ->
|
249
|
-
return {
|
250
|
-
restrict: 'AE',
|
251
|
-
scope: {
|
252
|
-
},
|
253
|
-
templateUrl: TemplatePath['mno_enterprise/user-setup/index.html'],
|
254
|
-
controller: 'UserSetupIndexCtrl'
|
255
|
-
}
|
256
|
-
])
|