Created
April 9, 2010 02:26
-
-
Save rbarazi/360814 to your computer and use it in GitHub Desktop.
[Beginning Rails 3] Listing 11-7 – Updated article partial in app/views/articles/_article.html.erb and other views
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
<%= div_for article do %> | |
<h3> | |
<%= link_to article.title, article %> | |
<% if article.owned_by? current_user %> | |
<span class='actions'> | |
<%= link_to t('general.edit'), edit_article_path(article) %> | |
<%= link_to t('general.delete'), article, :confirm => t('general.are_you_sure'), :method => :delete %> | |
</span> | |
<% end %> | |
</h3> | |
<%= simple_format raw(article.body) %> | |
<% 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
<%= div_for comment do %> | |
<h3> | |
<%= comment.name %> <<%= comment.email %>> said: | |
<% if @article.owned_by? current_user %> | |
<span class='actions'> | |
<%= link_to t('general.delete'), [@article, comment], :confirm => t('general.are_you_sure'), :method => :delete, :remote => true %> | |
</span> | |
<% end %> | |
</h3> | |
<%= comment.body %> | |
<% 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
<%= form_tag(notify_friend_article_path(@article), :id => 'notify_friend_form', :style => 'display:none') do %> | |
<div class="field"> | |
<%= label_tag :name, t('general.your_name') %><br /> | |
<%= text_field_tag :name %> | |
</div> | |
<div class="field"> | |
<%= label_tag :email, t('general.your_friend_email') %><br /> | |
<%= text_field_tag :email %> | |
</div> | |
<div class="actions"> | |
<%= submit_tag t('general.send_email') %> | |
<%= t('general.or') %> | |
<%= link_to t('general.cancel'), '#', :onclick => "$('#notify_friend_form').slideUp()" %> | |
</div> | |
<% 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
<h1><%= t('articles.editing_article') %></h1> | |
<%= render 'form' %> | |
<%= link_to t('general.show'), @article %> | | |
<%= link_to t('general.back'), articles_path %> |
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
<h1><%= t('articles.listing_articles') %></h1> | |
<div id="articles"> | |
<%= render @articles %> | |
</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
<h1><%= t('users.new_user') %></h1> | |
<%= render 'form' %> | |
<%= link_to t('general.back'), articles_path %> |
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
<%= render @article %> | |
<%= link_to t('general.email_a_friend'), '#', :onclick => "$('#notify_friend_form').slideDown()" %> | |
<%= render 'notify_friend' %> | |
<h3><%= t('comments.comments') %></h3> | |
<div id="comments"> | |
<%= render @article.comments %> | |
</div> | |
<%= link_to t('comments.new_comment'), new_article_comment_path(@article, :format => :js), :remote => true, :id => 'new_comment_link' %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment