diff --git a/app/assets/javascripts/admin/all.js b/app/assets/javascripts/admin/all.js
index 60ca6f330a..3485f45e23 100644
--- a/app/assets/javascripts/admin/all.js
+++ b/app/assets/javascripts/admin/all.js
@@ -27,6 +27,7 @@
//= require ./customers/customers
//= require ./dropdown/dropdown
//= require ./enterprises/enterprises
+//= require ./enterprise_fees/enterprise_fees
//= require ./enterprise_groups/enterprise_groups
//= require ./index_utils/index_utils
//= require ./line_items/line_items
diff --git a/app/assets/javascripts/admin/enterprise_fees.js b/app/assets/javascripts/admin/enterprise_fees.js
deleted file mode 100644
index 79b1876263..0000000000
--- a/app/assets/javascripts/admin/enterprise_fees.js
+++ /dev/null
@@ -1,69 +0,0 @@
-angular.module('enterprise_fees', [])
- .controller('AdminEnterpriseFeesCtrl', ['$scope', '$http', '$window', function($scope, $http, $window) {
- $scope.enterpriseFeesUrl = function() {
- var url = '/admin/enterprise_fees.json?include_calculators=1';
-
- var match = $window.location.search.match(/enterprise_id=(\d+)/);
- if(match) {
- url += "&"+match[0];
- }
-
- return url;
- };
-
- $http.get($scope.enterpriseFeesUrl()).success(function(data) {
- $scope.enterprise_fees = data;
-
- // TODO: Angular 1.1.0 will have a means to reset a form to its pristine state, which
- // would avoid the need to save off original calculator types for comparison.
- for(i in $scope.enterprise_fees) {
- $scope.enterprise_fees[i].orig_calculator_type = $scope.enterprise_fees[i].calculator_type;
- }
- });
- }])
-
- .directive('ngBindHtmlUnsafeCompiled', ['$compile', function($compile) {
- return function(scope, element, attrs) {
- scope.$watch(attrs.ngBindHtmlUnsafeCompiled, function(value) {
- element.html($compile(value)(scope));
- });
- }
- }])
-
- .directive('spreeDeleteResource', function() {
- return function(scope, element, attrs) {
- if(scope.enterprise_fee.id) {
- var url = "/admin/enterprise_fees/" + scope.enterprise_fee.id
- var html = '';
- //var html = '
Delete';
- element.append(html);
- }
- }
- })
-
- .directive('spreeEnsureCalculatorPreferencesMatchType', function() {
- // Hide calculator preference fields when calculator type changed
- // Fixes 'Enterprise fee is not found' error when changing calculator type
- // See spree/core/app/assets/javascripts/admin/calculator.js
-
- // Note: For some reason, DOM --> model bindings aren't working here, so
- // we use element.val() instead of querying the model itself.
-
- return function(scope, element, attrs) {
- scope.$watch(function(scope) {
- //return scope.enterprise_fee.calculator_type;
- return element.val();
- }, function(value) {
- var settings = element.parent().parent().find("div.calculator-settings");
-
- // scope.enterprise_fee.calculator_type == scope.enterprise_fee.orig_calculator_type
- if(element.val() == scope.enterprise_fee.orig_calculator_type) {
- settings.show();
- settings.find("input").prop("disabled", false);
- } else {
- settings.hide();
- settings.find("input").prop("disabled", true);
- }
- });
- }
- });
diff --git a/app/assets/javascripts/admin/enterprise_fees/controllers/enterprise_fees_controller.js.coffee b/app/assets/javascripts/admin/enterprise_fees/controllers/enterprise_fees_controller.js.coffee
new file mode 100644
index 0000000000..3dd860fb56
--- /dev/null
+++ b/app/assets/javascripts/admin/enterprise_fees/controllers/enterprise_fees_controller.js.coffee
@@ -0,0 +1,17 @@
+angular.module('admin.enterpriseFees').controller 'enterpriseFeesCtrl', ($scope, $http, $window) ->
+ $scope.enterpriseFeesUrl = ->
+ url = '/admin/enterprise_fees.json?include_calculators=1'
+ match = $window.location.search.match(/enterprise_id=(\d+)/)
+ if match
+ url += '&' + match[0]
+ url
+
+ $http.get($scope.enterpriseFeesUrl()).success (data) ->
+ $scope.enterprise_fees = data
+ # TODO: Angular 1.1.0 will have a means to reset a form to its pristine state, which
+ # would avoid the need to save off original calculator types for comparison.
+ for i of $scope.enterprise_fees
+ $scope.enterprise_fees[i].orig_calculator_type = $scope.enterprise_fees[i].calculator_type
+ return
+
+ return
diff --git a/app/assets/javascripts/admin/enterprise_fees/directives/bind_html_unsafe_compiled.js.coffee b/app/assets/javascripts/admin/enterprise_fees/directives/bind_html_unsafe_compiled.js.coffee
new file mode 100644
index 0000000000..96c2292257
--- /dev/null
+++ b/app/assets/javascripts/admin/enterprise_fees/directives/bind_html_unsafe_compiled.js.coffee
@@ -0,0 +1,6 @@
+angular.module("admin.enterpriseFees").directive 'ngBindHtmlUnsafeCompiled', ($compile) ->
+ (scope, element, attrs) ->
+ scope.$watch attrs.ngBindHtmlUnsafeCompiled, (value) ->
+ element.html $compile(value)(scope)
+ return
+ return
diff --git a/app/assets/javascripts/admin/enterprise_fees/directives/delete_resource.js.coffee b/app/assets/javascripts/admin/enterprise_fees/directives/delete_resource.js.coffee
new file mode 100644
index 0000000000..0ae1b3f6fd
--- /dev/null
+++ b/app/assets/javascripts/admin/enterprise_fees/directives/delete_resource.js.coffee
@@ -0,0 +1,8 @@
+angular.module('admin.enterpriseFees').directive 'spreeDeleteResource', ->
+ (scope, element, attrs) ->
+ if scope.enterprise_fee.id
+ url = '/admin/enterprise_fees/' + scope.enterprise_fee.id
+ html = ''
+ #var html = '
Delete';
+ element.append html
+ return
diff --git a/app/assets/javascripts/admin/enterprise_fees/directives/ensure_calculator_preferences_match_type.js.coffee b/app/assets/javascripts/admin/enterprise_fees/directives/ensure_calculator_preferences_match_type.js.coffee
new file mode 100644
index 0000000000..5b128b4d34
--- /dev/null
+++ b/app/assets/javascripts/admin/enterprise_fees/directives/ensure_calculator_preferences_match_type.js.coffee
@@ -0,0 +1,21 @@
+angular.module("admin.enterpriseFees").directive 'spreeEnsureCalculatorPreferencesMatchType', ->
+ # Hide calculator preference fields when calculator type changed
+ # Fixes 'Enterprise fee is not found' error when changing calculator type
+ # See spree/core/app/assets/javascripts/admin/calculator.js
+ # Note: For some reason, DOM --> model bindings aren't working here, so
+ # we use element.val() instead of querying the model itself.
+ (scope, element, attrs) ->
+ scope.$watch ((scope) ->
+ #return scope.enterprise_fee.calculator_type;
+ element.val()
+ ), (value) ->
+ settings = element.parent().parent().find('div.calculator-settings')
+ # scope.enterprise_fee.calculator_type == scope.enterprise_fee.orig_calculator_type
+ if element.val() == scope.enterprise_fee.orig_calculator_type
+ settings.show()
+ settings.find('input').prop 'disabled', false
+ else
+ settings.hide()
+ settings.find('input').prop 'disabled', true
+ return
+ return
diff --git a/app/assets/javascripts/admin/enterprise_fees/enterprise_fees.js b/app/assets/javascripts/admin/enterprise_fees/enterprise_fees.js
new file mode 100644
index 0000000000..a256834946
--- /dev/null
+++ b/app/assets/javascripts/admin/enterprise_fees/enterprise_fees.js
@@ -0,0 +1 @@
+angular.module("admin.enterpriseFees", [])
diff --git a/app/views/admin/enterprise_fees/index.html.haml b/app/views/admin/enterprise_fees/index.html.haml
index 08199d4c4a..60d818ed34 100644
--- a/app/views/admin/enterprise_fees/index.html.haml
+++ b/app/views/admin/enterprise_fees/index.html.haml
@@ -1,7 +1,7 @@
= content_for :page_title do
Enterprise Fees
-= ng_form_for @enterprise_fee_set, :url => main_app.bulk_update_admin_enterprise_fees_path, :html => {'ng-app' => 'enterprise_fees', 'ng-controller' => 'AdminEnterpriseFeesCtrl'} do |enterprise_fee_set_form|
+= ng_form_for @enterprise_fee_set, :url => main_app.bulk_update_admin_enterprise_fees_path, :html => {'ng-app' => 'admin.enterpriseFees', 'ng-controller' => 'enterpriseFeesCtrl'} do |enterprise_fee_set_form|
= hidden_field_tag 'enterprise_id', @enterprise.id if @enterprise
= render :partial => 'spree/shared/error_messages', :locals => { :target => @enterprise_fee_set }