Only render calculator HTML in enterprise fee JSON if explicitly requested. Improves load time of order cycles page.

This commit is contained in:
Rohan Mitchell
2013-10-16 10:37:09 +11:00
parent 4b7fc8b5e4
commit a6877c6981
3 changed files with 4 additions and 2 deletions

View File

@@ -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++) {

View File

@@ -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) } }

View File

@@ -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