Skip to content

Commit

Permalink
Remove some code duplication in prevision header and disqus use
Browse files Browse the repository at this point in the history
  • Loading branch information
ospsuite committed Sep 26, 2012
1 parent 5a854be commit d0d7245
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 32 deletions.
8 changes: 1 addition & 7 deletions app/views/monologue/posts/_post.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<% revision = post.active_revision %>
<section>
<header>
<h1><%= link_to revision.title, revision.full_url %></h1>
<time datetime="<%= revision.published_at %>">
<%= revision.published_at.to_date.to_formatted_s(:long_ordinal) %>
</time>
&nbsp;&nbsp;|&nbsp;&nbsp;<%= revision.user.name %>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<%= revision.full_url + "#disqus_thread" %>"></a>
</header>
<%= render :partial => 'monologue/posts/revision_header', :locals => {:revision=>revision} %>

<p>
<%= truncate_html(revision.content, :length => 1000, :omission => '...') %>
Expand Down
7 changes: 7 additions & 0 deletions app/views/monologue/posts/_revision_header.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<header><h1><%= link_to revision.title, revision.full_url %></h1></header>
<div class="posted">
<time datetime="<%= revision.published_at %>">
<%= revision.published_at.to_date.to_formatted_s(:long_ordinal) %>
</time>
&nbsp;&nbsp;|&nbsp;&nbsp;<%= revision.user.name %>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<%= revision.full_url + "#disqus_thread" %>"></a>
</div>
31 changes: 6 additions & 25 deletions app/views/monologue/posts/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,17 @@
<% end %>

<article>
<header><h1><%= link_to @revision.title, @revision.full_url %></h1></header>
<div class="posted">
<time datetime="<%= @revision.published_at %>">
<%= @revision.published_at.to_date.to_formatted_s(:long_ordinal) %>
</time>
&nbsp;&nbsp;|&nbsp;&nbsp;<%= @revision.user.name %>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<%= @revision.full_url + "#disqus_thread" %>"></a>
</div>
<%= render :partial => 'monologue/posts/revision_header', :locals => {:revision=>@revision}%>
<p><%= raw @revision.content %></p>

<div id='tags'>
<%= render @revision.post.tags %>
</div>

<%= render "social_sharing" %>

<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = '<%= Monologue.disqus_shortname%>'; // required: replace example with your forum shortname

<% if Rails.env.development? %>
var disqus_developer = 1; // developer mode is on
<% end %>

/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<%= render 'layouts/monologue/application/disqus' %>
<noscript>Please enable JavaScript to view the comments.</noscript>
</article>
</article>

0 comments on commit d0d7245

Please sign in to comment.