mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Only render calculator HTML in enterprise fee JSON if explicitly requested. Improves load time of order cycles page.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
angular.module('enterprise_fees', [])
|
||||
.controller('AdminEnterpriseFeesCtrl', ['$scope', '$http', function($scope, $http) {
|
||||
$http.get('/admin/enterprise_fees.json').success(function(data) {
|
||||
$http.get('/admin/enterprise_fees.json?include_calculators=1').success(function(data) {
|
||||
$scope.enterprise_fees = data;
|
||||
|
||||
for(i=0; i<3; i++) {
|
||||
|
||||
@@ -6,6 +6,8 @@ module Admin
|
||||
|
||||
|
||||
def index
|
||||
@include_calculators = params[:include_calculators].present?
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { @presented_collection = @collection.each_with_index.map { |ef, i| EnterpriseFeePresenter.new(self, ef, i) } }
|
||||
|
||||
@@ -6,5 +6,5 @@ r.list_of :enterprise_fees, @presented_collection do
|
||||
r.element :name
|
||||
r.element :calculator_type
|
||||
r.element :calculator_description
|
||||
r.element :calculator_settings
|
||||
r.element :calculator_settings if @include_calculators
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user