forked from ethangunderson/vanity
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating templates to allow for templates that do automatic html esca…
…ping because of xss
- Loading branch information
Showing
8 changed files
with
37 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<h3><%=h experiment.name %> <span class="type">(<%= experiment.class.friendly_name %>)</span></h3> | ||
<%= experiment.description.to_s.split(/\n\s*\n/).map { |para| %{<p class="description">#{h para}</p>} }.join %> | ||
<h3><%=vanity_h experiment.name %> <span class="type">(<%= experiment.class.friendly_name %>)</span></h3> | ||
<%= experiment.description.to_s.split(/\n\s*\n/).map { |para| vanity_html_safe(%{<p class="description">#{vanity_h para}</p>}) }.join %> | ||
<%= render Vanity.template(experiment.type), :experiment=>experiment %> | ||
<p class="meta">Started <%= experiment.created_at.strftime("%a, %b %d") %> | ||
<%= " | Completed #{experiment.completed_at.strftime("%a, %b %d")}" unless experiment.active? %></p> |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
<h3><%=h metric.name %></h3> | ||
<%= simple_format h(Vanity::Metric.description(metric).to_s), :class=>"description" %> | ||
<h3><%=vanity_h metric.name %></h3> | ||
<%= vanity_simple_format vanity_h(Vanity::Metric.description(metric).to_s), :class=>"description" %> | ||
<%= | ||
begin | ||
data = Vanity::Metric.data(metric) | ||
min, max = data.map(&:last).minmax | ||
js = data.map { |date,value| "['#{date.to_time.httpdate}',#{value}]" }.join(",") | ||
%{<div class="chart"></div> | ||
vanity_html_safe(%{<div class="chart"></div> | ||
<script type="text/javascript"> | ||
$(function(){Vanity.metric("#{h id.to_s}").plot([{label:"#{h metric.name}", data: [#{js}]}])}) | ||
</script>} | ||
$(function(){Vanity.metric("#{vanity_h id.to_s}").plot([{label:"#{vanity_h metric.name}", data: [#{js}]}])}) | ||
</script>}) | ||
rescue Exception=>ex | ||
%{<div class="error">#{h ex.message}</div>} | ||
%{<div class="error">#{vanity_h ex.message}</div>} | ||
end %> |
This file contains 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
This file contains 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