diff --git a/examples/blog/app/views/posts/preview.erb b/examples/blog/app/views/posts/preview.erb new file mode 100644 index 0000000..948a40a --- /dev/null +++ b/examples/blog/app/views/posts/preview.erb @@ -0,0 +1,46 @@ +
<%= t('posts.preview_noop') %>
+<% else %> +| <%= t('posts.preview_field') %> | <%= t('posts.preview_current') %> | <%= t('posts.preview_proposed') %> |
|---|---|---|
| <%= field %> | +<%= old_value %> | +<%= new_value %> | +
<%= t('posts.preview_currently_saved', title: post.title) %>
+ +<% if errors.empty? %> +<% form_for(post, url: url_for(:post, slug: post.to_param), method: :patch) do |f| %> + <%== f.hidden_field(:title, value: attempted['title']) %> + <%== f.hidden_field(:body, value: attempted['body']) %> + <%== f.hidden_field(:lock_version) %> + <%== f.submit(t('posts.preview_confirm')) %> +<% end %> +<% end %> + +<%== link_to(t('posts.edit_link'), url_for(:edit_post, slug: post.to_param)) %>
diff --git a/examples/blog/app/views/posts/show.erb b/examples/blog/app/views/posts/show.erb index c84a437..c70df6f 100644 --- a/examples/blog/app/views/posts/show.erb +++ b/examples/blog/app/views/posts/show.erb @@ -1,2 +1,75 @@ +<% if notice %> +<%= notice %>
+<% end %> +<%= t("posts.status_#{post.status}") %>
+<% if post.cover %> +<%= post.body %>
+<%= t('posts.last_activity', when: l(post.updated_at)) %>
++ <%= t('likes.count', count: likes_count(post)) %> + <% if user_signed_in? %> + <% own_like = current_user_like(post) %> + <% if own_like %> + <%== button_to(t('likes.unlike'), "/likes/#{own_like.id}", method: :delete) %> + <% else %> + <%== button_to(t('likes.like'), "/likes?likeable_type=Post&likeable_id=#{post.id}") %> + <% end %> + <% end %> +
+<% if post.giveaway? %> ++ <% if post.giveaway_sold_out? %> + <%= t('claims.sold_out_label') %> + <% else %> + <%= t('claims.remaining_label', count: post.giveaway_remaining) %> + <% end %> + <% if user_signed_in? %> + <% if current_user_claim(post) %> + <%= t('claims.already_claimed_label') %> + <% elsif !post.giveaway_sold_out? %> + <%== button_to(t('claims.claim_button'), "/posts/#{post.to_param}/claims") %> + <% end %> + <% end %> +
+<% end %> +<%== link_to(t('posts.back_to_list'), url_for(:posts)) %>
+<% if current_user && current_user.id == post.user_id %> +<%== link_to(t('posts.edit_link'), url_for(:edit_post, slug: post.to_param)) %>
+<% if post.published? %> +<%== button_to(t('posts.unpublish'), url_for(:unpublish_post, slug: post.to_param), method: :patch) %> +<% else %> +<%== button_to(t('posts.publish'), url_for(:publish_post, slug: post.to_param), method: :patch) %> +<% end %> +<%== button_to(t('posts.delete'), url_for(:post, slug: post.to_param), method: :delete, data_confirm: t('posts.confirm_delete')) %> +<%== link_to(t('posts.trash_heading'), url_for(:trash_posts)) %> +<% end %> + +<%== link_to(t('comments.view_all_link'), url_for(:comments, post_id: post.to_param)) %>
+<% if comments.empty? %> +<%= t('comments.empty') %>
+<% else %> ++ <%== f.label(:author, t('comments.author_label')) %> + <%== f.text_field(:author) %> +
++ <%== f.label(:body, t('comments.body_label')) %> + <%== f.text_area(:body) %> +
+ <%== f.submit(t('comments.submit')) %> +<% end %> +<% end %> diff --git a/examples/blog/app/views/posts/trash.erb b/examples/blog/app/views/posts/trash.erb new file mode 100644 index 0000000..9ef786e --- /dev/null +++ b/examples/blog/app/views/posts/trash.erb @@ -0,0 +1,21 @@ +<% if notice %> +<%= notice %>
+<% end %> + +<%= t('posts.trash_empty') %>
+<% else %> +<%= post.body %>
+ <%== button_to(t('posts.restore'), url_for(:restore_post, slug: post.to_param), method: :patch) %> +<%== link_to(t('posts.back_to_list'), url_for(:posts)) %>