From fffae46a636bedab0f418b76c0404f19cfc6b357 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley Date: Fri, 12 Jan 2018 13:40:54 +0000 Subject: [PATCH] Remove enterpriseRoles from enterprsies controller --- app/assets/javascripts/admin/admin_ofn.js.coffee | 2 +- .../enterprises/controllers/enterprise_controller.js.coffee | 3 +-- .../javascripts/admin/enterprises/enterprises.js.coffee | 2 +- app/controllers/admin/enterprises_controller.rb | 6 ------ app/helpers/admin/injection_helper.rb | 2 +- app/views/admin/enterprises/_form_data.html.haml | 1 - app/views/admin/enterprises/form/_users.html.haml | 4 ++-- 7 files changed, 6 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/admin/admin_ofn.js.coffee b/app/assets/javascripts/admin/admin_ofn.js.coffee index 3ff1e0f43f..d617722175 100644 --- a/app/assets/javascripts/admin/admin_ofn.js.coffee +++ b/app/assets/javascripts/admin/admin_ofn.js.coffee @@ -1,3 +1,3 @@ -angular.module("ofn.admin", ["admin.enterpriseRoles", "ngResource", "ngAnimate", "admin.utils", "admin.indexUtils", "admin.dropdown", "admin.products", "admin.taxons", "infinite-scroll"]).config ($httpProvider) -> +angular.module("ofn.admin", ["ngResource", "ngAnimate", "admin.utils", "admin.indexUtils", "admin.dropdown", "admin.products", "admin.taxons", "infinite-scroll"]).config ($httpProvider) -> $httpProvider.defaults.headers.common["X-CSRF-Token"] = $("meta[name=csrf-token]").attr("content") $httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*" diff --git a/app/assets/javascripts/admin/enterprises/controllers/enterprise_controller.js.coffee b/app/assets/javascripts/admin/enterprises/controllers/enterprise_controller.js.coffee index 7e36a498fd..33381741c6 100644 --- a/app/assets/javascripts/admin/enterprises/controllers/enterprise_controller.js.coffee +++ b/app/assets/javascripts/admin/enterprises/controllers/enterprise_controller.js.coffee @@ -1,7 +1,6 @@ angular.module("admin.enterprises") - .controller "enterpriseCtrl", ($scope, $window, NavigationCheck, enterprise, enterpriseRoles, EnterprisePaymentMethods, EnterpriseShippingMethods, SideMenu, StatusMessage) -> + .controller "enterpriseCtrl", ($scope, $window, NavigationCheck, enterprise, EnterprisePaymentMethods, EnterpriseShippingMethods, SideMenu, StatusMessage) -> $scope.Enterprise = enterprise - $scope.EnterpriseRoles = enterpriseRoles $scope.PaymentMethods = EnterprisePaymentMethods.paymentMethods $scope.ShippingMethods = EnterpriseShippingMethods.shippingMethods $scope.navClear = NavigationCheck.clear diff --git a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee index a9ef204358..da122761b8 100644 --- a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee +++ b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee @@ -1 +1 @@ -angular.module("admin.enterprises", [ "admin.paymentMethods", "admin.utils", "admin.enterpriseRoles", "admin.shippingMethods", "admin.users", "textAngular", "admin.side_menu", "admin.taxons", 'admin.indexUtils', 'admin.tagRules', 'admin.dropdown', 'ngSanitize'] ) \ No newline at end of file +angular.module("admin.enterprises", [ "admin.paymentMethods", "admin.utils", "admin.shippingMethods", "admin.users", "textAngular", "admin.side_menu", "admin.taxons", 'admin.indexUtils', 'admin.tagRules', 'admin.dropdown', 'ngSanitize'] ) \ No newline at end of file diff --git a/app/controllers/admin/enterprises_controller.rb b/app/controllers/admin/enterprises_controller.rb index d5672eccda..cff0227aa8 100644 --- a/app/controllers/admin/enterprises_controller.rb +++ b/app/controllers/admin/enterprises_controller.rb @@ -11,7 +11,6 @@ module Admin before_filter :load_methods_and_fees, :only => [:edit, :update] before_filter :load_groups, :only => [:new, :edit, :update, :create] before_filter :load_taxons, :only => [:new, :edit, :update, :create] - before_filter :load_roles, only: :edit before_filter :check_can_change_sells, only: :update before_filter :check_can_change_bulk_sells, only: :bulk_update before_filter :check_can_change_owner, only: :update @@ -186,11 +185,6 @@ module Admin @taxons = Spree::Taxon.order(:name) end - def load_roles - @enterprise_roles = EnterpriseRole.find_all_by_enterprise_id(@enterprise.id) - @current_contact = @enterprise.contact.id - end - def update_tag_rules(tag_rules_attributes) # Due to the combination of trying to use nested attributes and type inheritance # we cannot apply all attributes to tag rules in one hit because mass assignment diff --git a/app/helpers/admin/injection_helper.rb b/app/helpers/admin/injection_helper.rb index 7d291280f5..b528eb84a4 100644 --- a/app/helpers/admin/injection_helper.rb +++ b/app/helpers/admin/injection_helper.rb @@ -16,7 +16,7 @@ module Admin end def admin_inject_enterprise_roles - admin_inject_json_ams_array "admin.enterpriseRoles", "enterpriseRoles", @enterprise_roles, Api::Admin::EnterpriseRoleSerializer + admin_inject_json_ams_array "ofn.admin", "enterpriseRoles", @enterprise_roles, Api::Admin::EnterpriseRoleSerializer end def admin_inject_payment_methods diff --git a/app/views/admin/enterprises/_form_data.html.haml b/app/views/admin/enterprises/_form_data.html.haml index edd45d6ebd..ee3d17d4aa 100644 --- a/app/views/admin/enterprises/_form_data.html.haml +++ b/app/views/admin/enterprises/_form_data.html.haml @@ -1,5 +1,4 @@ = admin_inject_enterprise -= admin_inject_enterprise_roles = admin_inject_taxons = admin_inject_payment_methods = admin_inject_shipping_methods diff --git a/app/views/admin/enterprises/form/_users.html.haml b/app/views/admin/enterprises/form/_users.html.haml index e939778a80..51dd745532 100644 --- a/app/views/admin/enterprises/form/_users.html.haml +++ b/app/views/admin/enterprises/form/_users.html.haml @@ -24,8 +24,8 @@ - if full_permissions .eight.columns.omega - %select.select2.fullwidth{id: 'receives_notifications_dropdown', name: 'receives_notifications', ng: {model: 'receivesNotifications', init: "receivesNotifications = '#{@current_contact}'"}} - %option{ng: {repeat: 'user in Enterprise.users', selected: "user.id == #{@current_contact}", hide: '!user.confirmed'}, value: '{{user.id}}'} + %select.select2.fullwidth{id: 'receives_notifications_dropdown', name: 'receives_notifications', ng: {model: 'receivesNotifications', init: "receivesNotifications = '#{@enterprise.contact.id}'"}} + %option{ng: {repeat: 'user in Enterprise.users', selected: "user.id == #{@enterprise.contact.id}", hide: '!user.confirmed'}, value: '{{user.id}}'} {{user.email}} .row