This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DataHelper | |
def data_to_table(data) | |
content_tag :table do | |
rows = data.map do |row| | |
content_tag :tr do | |
cells = row.map do |cell| | |
content_tag :td, cell | |
end | |
safe_join(cells) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DataHelper | |
def data_to_table(data) | |
content_tag :table do | |
data.map do |row| | |
content_tag :tr do | |
row.map {|cell| content_tag :td, cell}.reduce(:<<) | |
end | |
end.reduce(:<<) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DataHelper | |
... | |
output << "<td>#{h cell}</td>" | |
... | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DataHelper | |
# Expects a nested array such as: | |
# [[1,'Jez','iHiD'], [2,'Bob','<b>xyz</b>']] | |
# | |
# and outputs: | |
# <table> | |
# <tr><td>1</td><td>Jez</td><td>iHiD</td></tr> | |
# <tr><td>2</td><td>Bob</td><td><b>xyz</b></td></tr> | |
# </table> | |
def data_to_table(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2><%= @blog_post.title %></h2> | |
<div id="content"><%= sanitize(@blog_post.content, tags: tags %w(b strong i em)) %></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=cache "#{current_user.is_admin?}_user_#{@user.id}_#{@user.updated_at}_#{@user.media_files_updated_at}_#{@user.wall_updated_at}" do | |
%h2= @user.name | |
=cache "#{current_user.is_admin?}_user_#{@user.id}_information_#{@user.updated_at}" do | |
=render "users/information" | |
=cache "user_#{@user.id}_media_files_#{@user.media_files_updated_at}" do | |
=render "users/media_files" | |
=cache "user_#{@user.id}_wall_#{@user.wall_updated_at}" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=cache "user_#{@user.id}_#{@user.updated_at}_#{@user.media_files_updated_at}_#{@user.wall_updated_at}" do | |
%h2= @user.name | |
=cache "user_#{@user.id}_information_#{@user.updated_at}" do | |
=render "users/information" | |
=cache "user_#{@user.id}_media_files_#{@user.media_files_updated_at}" do | |
=render "users/media_files" | |
=cache "user_#{@user.id}_wall_#{@user.wall_updated_at}" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.bio= @user.bio | |
.university | |
.field University | |
.value= @user.university | |
.university_year | |
.field Year | |
.value= @user.university_year |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%h2= @user.name | |
=render "users/information" | |
=render "users/media_files" | |
=render "users/wall" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2><%= @blog_post.title %></h2> | |
<div id="content"><%= raw @blog_post.content %></div> |