Skip to content

Commit

Permalink
Implement the Smithy::AssetLink.fix method everywhere it is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Glen committed Feb 3, 2016
1 parent 3c547f8 commit 40b2453
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/smithy/content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def formatted_content
def to_liquid
{
'id' => self.id,
'content' => self.content,
'content' => Smithy::AssetLink.fix(self.content),
'formatted_content' => self.formatted_content
}
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/smithy/content_block_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def liquid_template

private
def content_with_fixed_asset_links
content.gsub(/\/smithy\/assets\/([0-9]+)/) { Smithy::Asset.find($1).url }
Smithy::AssetLink.fix(self.content)
end

def touch_page_contents
Expand Down
2 changes: 1 addition & 1 deletion app/models/smithy/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def liquid_template
end

def content_with_fixed_asset_links
content.gsub(/\/smithy\/assets\/([0-9]+)/) { Smithy::Asset.find($1).url }
Smithy::AssetLink.fix(self.content)
end

private
Expand Down
2 changes: 1 addition & 1 deletion lib/smithy/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def render

private
def fix_asset_links
@current = @current.gsub(/\/smithy\/assets\/([0-9]+)/) { Smithy::Asset.find($1).url }
@current = Smithy::AssetLink.fix(@current)
self
end

Expand Down

0 comments on commit 40b2453

Please sign in to comment.