Skip to content

Commit

Permalink
Merge pull request #285 from enoodle/simple_format_with_links
Browse files Browse the repository at this point in the history
move formating with links to application helper
  • Loading branch information
enoodle authored Mar 12, 2018
2 parents c44b634 + e13eb2e commit a9d1f55
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
module ApplicationHelper
def simple_format_with_links(text)
simple_format(sanitize(Rinku.auto_link(text, :all, 'target="_blank"'),
attributes: ['href', 'target']),
{class: "auto-#{@detector.direction(text)}"},
sanitize: false )
end
end
14 changes: 7 additions & 7 deletions app/views/camps/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -137,49 +137,49 @@
<% if Rails.configuration.x.firestarter_settings["description"] and @camp.description.present? %>
<div class="camp-description">
<b><%=t :form_description_label %></b>
<%= simple_format(Rinku.auto_link(@camp.description, :all, 'target="_blank"'), class: "auto-#{@detector.direction(@camp.description)}" ) %>
<%= simple_format_with_links(@camp.description) %>
</div>
<% end %>

<% if @camp.about_the_artist.present? %>
<div class="camp-description">
<b><%=t :form_about_the_artist_label %></b>
<%= simple_format(Rinku.auto_link(@camp.about_the_artist, :all, 'target="_blank"'), class: "auto-#{@detector.direction(@camp.about_the_artist)}" ) %>
<%= simple_format_with_links(@camp.about_the_artist) %>
</div>
<% end %>

<% if Rails.configuration.x.firestarter_settings["plan"] and @camp.plan.present? %>
<div class="camp-description">
<b><%=t :form_plan_label %></b>
<%= simple_format(Rinku.auto_link(@camp.plan, :all, 'target="_blank"'), class: "auto-#{@detector.direction(@camp.plan)}" ) %>
<%= simple_format_with_links(@camp.plan) %>
</div>
<% end %>

<% if Rails.configuration.x.firestarter_settings["moop"] and @camp.moop.present? %>
<div class="camp-description">
<b><%=t :form_moop_label %></b>
<%= simple_format(Rinku.auto_link(@camp.moop, :all, 'target="_blank"'), class: "auto-#{@detector.direction(@camp.moop)}" ) %>
<%= simple_format_with_links(@camp.moop) %>
</div>
<% end %>

<% if Rails.configuration.x.firestarter_settings["recycling"] and @camp.recycling.present? %>
<div class="camp-description">
<b><%=t :form_recycling_label %></b>
<%= simple_format(Rinku.auto_link(@camp.recycling, :all, 'target="_blank"'), class: "auto-#{@detector.direction(@camp.recycling)}" ) %>
<%= simple_format_with_links(@camp.recycling) %>
</div>
<% end %>

<% if Rails.configuration.x.firestarter_settings["budgetplan"] and @camp.budgetplan.present? %>
<div class="camp-description">
<b><%=t :form_budgetplan_label %></b>
<%= simple_format(Rinku.auto_link(@camp.budgetplan, :all, 'target="_blank"'), class: "auto-#{@detector.direction(@camp.budgetplan)}" ) %>
<%= simple_format_with_links(@camp.budgetplan) %>
</div>
<% end %>

<% if Rails.configuration.x.firestarter_settings["cocreation"] and @camp.cocreation.present? %>
<div class="camp-description">
<b><%=t :form_cocreation_label %></b>
<%= simple_format(Rinku.auto_link(@camp.cocreation, :all, 'target="_blank"'), class: "auto-#{@detector.direction(@camp.cocreation)}" ) %>
<%= simple_format_with_links(@camp.cocreation) %>
</div>
<% end %>

Expand Down

0 comments on commit a9d1f55

Please sign in to comment.