Skip to content

Commit

Permalink
Expose preview_mode_enabled? to views as helper method (#61)
Browse files Browse the repository at this point in the history
* Expose preview_mode_enabled? to views as helper method

* Update version.rb
  • Loading branch information
ryantownsend authored and praweb committed Feb 22, 2019
1 parent 1b83b82 commit 8ecefd3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ module PreviewStateManagement
# if caching was to be applied, prevent it
skip_after_action :vary_page_caching_on_user, if: :preview_mode_enabled?, raise: false
skip_around_action :capture_and_apply_surrogate_keys, if: :preview_mode_enabled?, raise: false
# expose #preview_mode_enabled? to views
helper_method :preview_mode_enabled?
end

def preview_mode_enabled?
params[:preview].present?
end

protected

Expand All @@ -27,9 +32,5 @@ def handle_preview_state
ensure
FlexCommerceApi::ApiBase.reconfigure_all
end

def preview_mode_enabled?
params[:preview].present?
end
end
end
2 changes: 1 addition & 1 deletion lib/shift_commerce/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ShiftCommerce
VERSION = '0.6.11'
VERSION = '0.6.12'
end

0 comments on commit 8ecefd3

Please sign in to comment.