diff options
author | Adrien Coquio <adrien.coquio@gmail.com> | 2012-06-03 21:37:41 +0200 |
---|---|---|
committer | Philip Arndt <parndt@gmail.com> | 2012-06-09 11:19:38 +1200 |
commit | d0c249af2a2e630ac993eb23a691ef996613b55f (patch) | |
tree | 6992cf3816a6f5b1e022637a6780a7d24f1753cf /app/views/refinery/blog/admin/posts | |
parent | 7743fab73a5c60d9f5f0cf2ce65a3f0914b1376f (diff) | |
download | refinerycms-blog-d0c249af2a2e630ac993eb23a691ef996613b55f.tar.gz refinerycms-blog-d0c249af2a2e630ac993eb23a691ef996613b55f.tar.bz2 refinerycms-blog-d0c249af2a2e630ac993eb23a691ef996613b55f.zip |
Added i18n support to models through globalize3.
* Added Post translation
* Added Category translation
* Use friendly_id globalize with category
* Added migrate_data option on migrations for translations
* Use Refinery locale instead of I18n
* Refactored duplicate locale_picker partial
* Removed useless .all call
* Use presence instead if / blank?
* Added with_globalize scopes when loading posts of one category
* Use Globalize when creating post factory
* Fix failing specs by creating blog posts/categories using needed locale.
Diffstat (limited to 'app/views/refinery/blog/admin/posts')
-rw-r--r-- | app/views/refinery/blog/admin/posts/_form.html.erb | 3 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/posts/_post.html.erb | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/app/views/refinery/blog/admin/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb index a977754..b6fc535 100644 --- a/app/views/refinery/blog/admin/posts/_form.html.erb +++ b/app/views/refinery/blog/admin/posts/_form.html.erb @@ -5,6 +5,9 @@ :include_object_name => true } %> + <%= render "/refinery/blog/admin/shared/locale_picker", + :current_locale => Thread.current[:globalize_locale] if Refinery.i18n_enabled? %> + <div class='field'> <%= f.label :title -%> <%= f.text_field :title, :class => 'larger widest' -%> diff --git a/app/views/refinery/blog/admin/posts/_post.html.erb b/app/views/refinery/blog/admin/posts/_post.html.erb index fea3eb8..781595a 100644 --- a/app/views/refinery/blog/admin/posts/_post.html.erb +++ b/app/views/refinery/blog/admin/posts/_post.html.erb @@ -1,7 +1,16 @@ <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(post) -%>"> <span class='title'> - <%= post.title %> + <%= post.title.presence || post.translations.detect {|t| t.title.present?}.title %> <span class="preview"> + <% post.translations.each do |translation| %> + <% if translation.title.present? %> + <%= link_to refinery_icon_tag("flags/#{translation.locale}.png", :size => '16x11'), + refinery.edit_blog_admin_post_path(post, :switch_locale => translation.locale), + :class => 'locale' %> + <% end %> + <% end %> + + <%= post.published_at.try(:strftime, '%b %d, %Y') || 'draft' %> <%= " by #{post.author.username}" if post.author.present? %> <% if post.draft? %> <span class="label notice"><%= t('refinery.blog.admin.posts.post.draft') %></span> |