1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

update jbuilder and add cache in progress

This commit is contained in:
Peng DU 2016-06-20 19:41:05 +02:00
parent 9e1468cb31
commit 8b699153cc
7 changed files with 27 additions and 23 deletions

View File

@ -16,7 +16,8 @@ gem 'therubyracer', '= 0.12.0', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
gem 'jbuilder', '~> 2.5'
gem 'jbuilder_cache_multi'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc #TODO remove unused ?

View File

@ -179,9 +179,11 @@ GEM
multi_xml (>= 0.5.2)
i18n (0.7.0)
ice_nine (0.11.1)
jbuilder (2.2.12)
activesupport (>= 3.0.0, < 5)
jbuilder (2.5.0)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jbuilder_cache_multi (0.0.3)
jbuilder (>= 1.5.0, < 3)
jquery-rails (4.0.3)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
@ -208,13 +210,13 @@ GEM
mime-types (2.99)
mini_magick (4.2.0)
mini_portile2 (2.0.0)
minitest (5.8.4)
minitest (5.9.0)
minitest-reporters (1.1.8)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
multi_json (1.11.2)
multi_json (1.12.1)
multi_xml (0.5.5)
multipart-post (2.0.0)
naught (1.0.0)
@ -452,7 +454,8 @@ DEPENDENCIES
foreman
forgery
friendly_id (~> 5.1.0)
jbuilder (~> 2.0)
jbuilder (~> 2.5)
jbuilder_cache_multi
jquery-rails
kaminari
letter_opener
@ -497,4 +500,4 @@ DEPENDENCIES
webmock
BUNDLED WITH
1.11.2
1.12.5

View File

@ -1 +1,3 @@
json.partial! 'api/groups/group', collection: @groups, as: :group
json.cache! @groups do
json.partial! 'api/groups/group', collection: @groups, as: :group
end

View File

@ -1,13 +1,7 @@
user_is_admin = (current_user and current_user.is_admin?)
json.array!(@machines) do |machine|
json.extract! machine, :id, :name, :description, :spec, :slug
json.url machine_url(machine, format: :json)
json.machine_image machine.machine_image.attachment.medium.url if machine.machine_image
json.current_user_is_training current_user.is_training_machine?(machine) if current_user
json.current_user_training_reservation do
json.partial! 'api/reservations/reservation', reservation: current_user.training_reservation_by_machine(machine)
end if current_user and !current_user.is_training_machine?(machine) and current_user.training_reservation_by_machine(machine)
json.plan_ids machine.plan_ids if user_is_admin
json.cache! @machines do
json.array!(@machines) do |machine|
json.extract! machine, :id, :name, :description, :spec, :slug
json.url machine_url(machine, format: :json)
json.machine_image machine.machine_image.attachment.medium.url if machine.machine_image
end
end

View File

@ -1 +1,3 @@
json.prices @prices, partial: 'api/prices/price', as: :price
json.cache! @prices do
json.prices @prices, partial: 'api/prices/price', as: :price
end

View File

@ -1 +1,3 @@
json.partial! 'api/trainings_pricings/trainings_pricing', collection: @trainings_pricings, as: :trainings_pricing
json.cache! @trainings_pricings do
json.partial! 'api/trainings_pricings/trainings_pricing', collection: @trainings_pricings, as: :trainings_pricing
end

View File

@ -11,7 +11,7 @@ Rails.application.configure do
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_controller.perform_caching = true
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false