Skip to content

Commit

Permalink
Move _tag helpers into the template
Browse files Browse the repository at this point in the history
**Why**: Error in production due to "request.protocol" being nil,
using the asset_url helper in the view should provide access to the request
  • Loading branch information
zachmargolis authored and jmhooper committed Aug 25, 2017
1 parent ac6684f commit 4c53f13
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions app/view_models/sign_up_completions_show.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class SignUpCompletionsShow
include ActionView::Helpers::AssetTagHelper
include ActionView::Helpers::TagHelper

def initialize(loa3_requested:, decorated_session:)
Expand Down Expand Up @@ -36,10 +35,8 @@ def title
)
end

def image
image_tag(
helper.asset_url("user-signup-#{requested_loa}.svg"), width: 97, alt: '', class: 'mb2'
)
def image_name
"user-signup-#{requested_loa}.svg"
end

def requested_attributes_partial
Expand All @@ -61,8 +58,4 @@ def requested_attributes
def requested_loa
loa3_requested ? 'loa3' : 'loa1'
end

def helper
ActionController::Base.helpers
end
end
2 changes: 1 addition & 1 deletion app/views/sign_up/completions/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.clearfix
.col-10.sm-col-8.mx-auto
.center
= @view_model.image
= image_tag(asset_url(@view_model.image_name), width: 97, alt: '', class: 'mb2')
h1.h3.mb3.my0.regular = @view_model.heading

p = t('help_text.requested_attributes.intro_html', app_name: APP_NAME,
Expand Down

0 comments on commit 4c53f13

Please sign in to comment.