Browse files

Hook into i18n on the backend form and make Joe's replace function wo…

…rk with multiple matches for the permalink.
  • Loading branch information...
1 parent 9be0abd commit d9bd0d1f012a714063b80bdb27c262757c090733 @parndt committed Jul 24, 2010
Showing with 59 additions and 23 deletions.
  1. +26 −23 app/views/admin/blogs/_form.html.erb
  2. +32 −0 config/locales/en.yml
  3. +1 −0 rails/init.rb
View
49 app/views/admin/blogs/_form.html.erb
@@ -3,17 +3,17 @@
<div class='field'>
<%= f.label :title -%>
- <%= f.text_field :title, :class => 'larger', :style => 'width: 944px' -%>
+ <%= f.text_field :title, :class => 'larger widest' -%>
</div>
<div class='field'>
<%= f.label :excerpt -%>
- <%= f.text_area :excerpt, :rows => 5, :cols => 140, :class => 'wymeditor' -%>
+ <%= f.text_area :excerpt, :rows => 5, :class => 'wymeditor widest' -%>
</div>
<div class='field'>
<%= f.label :body -%>
- <%= f.text_area :body, :rows => 20, :cols => 140, :class => 'wymeditor' -%>
+ <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%>
</div>
<p>
@@ -25,59 +25,62 @@
<div id='more_options' style="display:none;">
<div class="hemisquare">
<div class='field'>
- <%= f.label :publishing_date, "Date published" -%>
+ <%= f.label :publishing_date -%>
<%= f.datetime_select :publishing_date -%>
</div>
<div class='field'>
<label>Allow comments</label>
<%= f.check_box :allow_comment -%>
- <%= f.label :allow_comment, "Allow readers to comment on this post", :class => "stripped" %>
+ <%= f.label :allow_comment, t('.allow_comments'),
+ :class => "stripped" %>
</div>
<div class='field'>
<%= f.label :permalink -%>
- <b>http://<%=h request.domain %>/blog/<%= f.text_field :permalink -%></b><br/>
- <small>
- Allowed characters are: lowercase letters, numbers, underscores and dashes.
- </small>
+ <b>
+ http://<%=h request.domain %>/blog/<%= f.text_field :permalink -%>
+ </b><br/>
+ <small><%= t('.allowed_characters') %></small>
</div>
<div class='field'>
<label>Draft</label>
<%= f.check_box :draft -%>
- <%= f.label :draft, "Save as Draft", :class => "stripped" %>
+ <%= f.label :draft, t('.draft'),
+ :class => "stripped" %>
</div>
</div>
<div class="hemisquare right_side">
<div class='field'>
<%= f.label :category_list, "Categories" %>
<%= f.text_field :category_list %><br/>
- <small>
- Separate with commas, e.g. "Programming, Web Design"
- </small>
+ <small><%= t('.separate.category_list') %></small>
</div>
<div class='field'>
- <%= f.label :tag_list, "Tags" %>
+ <%= f.label :tag_list %>
<%= f.text_field :tag_list %><br/>
- <small>
- Separate with commas, e.g. "RefineryCMS, Rails, Models, Validation"
- </small>
+ <small><%= t('.separate.tag_list') %></small>
</div>
<div class='field'>
- <%= f.label :author_list, "Authors" %>
+ <%= f.label :author_list %>
<%= f.text_field :author_list %><br/>
- <small>
- Separate with commas, e.g. "Bob Dylan, Jimi Hendrix, John Lennon"
- </small>
+ <small><%= t('.separate.author_list') %></small>
</div>
</div>
</div>
- <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %>
+ <%= render :partial => "/shared/admin/form_actions",
+ :locals => {
+ :f => f,
+ :continue_editing => false,
+ :delete_title => t('.delete.title'),
+ :delete_confirmation => t('.delete.confirm',
+ :title => @blog.title)
+ } %>
<% end -%>
<% content_for :head do %>
@@ -98,7 +101,7 @@
$('#blog_title').keyup(function(e) {
$('#blog_permalink').val($(this).val().replace(/\s+/g,'-')
.replace(/[^a-zA-Z0-9\-]/g,'')
- .replace(/\-{2,}/,'-')
+ .replace(/\-{2,}/ig,'-')
.toLowerCase());
});
});
View
32 config/locales/en.yml
@@ -0,0 +1,32 @@
+en:
+ plugins:
+ blog:
+ title: Blog
+ admin:
+ blogs:
+ form:
+ allow_comments: Allow readers to comment on this post
+ allowed_characters: "Allowed characters are: lowercase letters, numbers, underscores and dashes."
+ draft: Save as Draft
+ separate:
+ category_list: "Separate with commas, e.g. 'Programming, Web Design'"
+ tag_list: "Separate with commas, e.g. 'RefineryCMS, Rails, Models, Validation'"
+ author_list: "Separate with commas, e.g. 'Bob Dylan, Jimi Hendrix, John Lennon'"
+ blog:
+ delete:
+ confirm: "Are you sure you want to remove '{{title}}' forever?"
+ title: Remove this post forever
+ activerecord:
+ attributes:
+ blog:
+ allow_comment: Allow Comment
+ title: Title
+ excerpt: Excerpt
+ body: Body
+ publishing_date: Date Published
+ skip_to_first_child: Skip to first child?
+ permalink: Permalink
+ draft: Draft
+ category_list: Categories
+ tag_list: Tags
+ author_list: Authors
View
1 rails/init.rb
@@ -1,5 +1,6 @@
Refinery::Plugin.register do |plugin|
plugin.title = "Blog"
+ plugin.name = "blog"
plugin.description = "Manage Blog"
plugin.version = 1.0
plugin.menu_match = /admin\/(blog|comments|blog_comments)/

0 comments on commit d9bd0d1

Please sign in to comment.