aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/admin_public_body/_form.rhtml32
-rw-r--r--app/views/admin_public_body/edit.rhtml6
-rw-r--r--app/views/admin_public_body/new.rhtml6
3 files changed, 28 insertions, 16 deletions
diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.rhtml
index 1fb573994..98749154c 100644
--- a/app/views/admin_public_body/_form.rhtml
+++ b/app/views/admin_public_body/_form.rhtml
@@ -25,40 +25,52 @@
<%
for locale in I18n.available_locales do
- object_name = locale==:en ? 'public_body' : "public_body_#{locale.to_s}"
+ if locale==I18n.default_locale # The default locale is submitted as part of the bigger object...
+ prefix = 'public_body'
+ object = @public_body
+ else # ...but additional locales go "on the side"
+ prefix = "public_body[translated_versions][]"
+ object = @public_body.new_record? ?
+ PublicBody::Translation.new :
+ @public_body.translation(locale.to_s) || PublicBody::Translation.new
+ end
+
+ fields_for prefix, object do |t|
%>
<div>
<p>Locale: <%= locale_name(locale.to_s) %></p>
-
+ <%= t.hidden_field :locale, :value => locale.to_s %>
+
<p><label for="public_body_name">Name</label><br/>
- <%= text_field object_name, 'name', :size => 60 %></p>
+ <%= t.text_field :name, :size => 60 %></p>
<p><label for="public_body_short_name">Short name <small>(only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL - don't worry about breaking URLs through renaming, as the history is used to redirect)</small></label><br/>
- <%= text_field object_name, 'short_name', :size => 60 %></p>
+ <%= t.text_field :short_name, :size => 60 %></p>
<p><label for="public_body_request_email">Request email <small>(set to <strong>blank</strong> (empty string) if can't find an address; these emails are <strong>public</strong> as anyone can view with a CAPTCHA)</small></label><br/>
- <%= text_field object_name, 'request_email', :size => 40 %></p>
+ <%= t.text_field :request_email, :size => 40 %></p>
<p><label for="public_body_publication_scheme">Publication scheme URL</label><br/>
- <%= text_field object_name, 'publication_scheme', :size => 60 %></p>
+ <%= t.text_field :publication_scheme, :size => 60 %></p>
<p><label for="public_body_notes">Public notes</label> <small>(HTML, for users to consider when making FOI requests to the authority)</small><br/>
- <%= text_area object_name, 'notes', :rows => 3, :cols => 60 %></p>
+ <%= t.text_area :notes, :rows => 3, :cols => 60 %></p>
</div>
<%
+ end
end
%>
<h3>Common Fields</h3>
<p><label for="public_body_tag_string">Tags <small>(space separated; see list of tags on the right; also <strong>not_apply</strong> if FOI and EIR no longer apply to authority, <strong>eir_only</strong> if EIR but not FOI applies to authority, <strong>defunct</strong> if the authority no longer exists; charity:NUMBER if a registered charity)</small></label><br/>
-<%= text_field 'public_body', 'tag_string', :size => 60 %></p>
+<%= f.text_field :tag_string, :size => 60 %></p>
<p><label for="public_body_home_page">Home page <small>(of whole authority, not just their FOI page; set to <strong>blank</strong> (empty string) to guess it from the email)</small></label><br/>
-<%= text_field 'public_body', 'home_page', :size => 60 %></p>
+<%= f.text_field :home_page, :size => 60 %></p>
<p><label for="public_body_last_edit_comment"><strong>Comment</strong> for this edit</label> <small>(put URL or other source of new info)</small><br/>
-<%= text_area 'public_body', 'last_edit_comment', :rows => 3, :cols => 60 %></p>
+<%= f.text_area :last_edit_comment, :rows => 3, :cols => 60 %></p>
<!--[eoform:public_body]-->
diff --git a/app/views/admin_public_body/edit.rhtml b/app/views/admin_public_body/edit.rhtml
index 005ec93ce..ae4066dc7 100644
--- a/app/views/admin_public_body/edit.rhtml
+++ b/app/views/admin_public_body/edit.rhtml
@@ -2,9 +2,9 @@
<h1><%=@title%></h1>
-<% form_tag '../update/' + @public_body.id.to_s do %>
- <%= render :partial => 'form' %>
- <p><%= submit_tag 'Save', :accesskey => 's' %></p>
+<% form_for @public_body, :url => {:action => 'update'} do |f| %>
+ <%= render :partial => 'form', :locals => {:f => f} %>
+ <p><%= f.submit 'Save', :accesskey => 's' %></p>
<% end %>
<p>
diff --git a/app/views/admin_public_body/new.rhtml b/app/views/admin_public_body/new.rhtml
index 95208b5b3..fe0b5b670 100644
--- a/app/views/admin_public_body/new.rhtml
+++ b/app/views/admin_public_body/new.rhtml
@@ -2,9 +2,9 @@
<h1><%=@title%></h1>
-<% form_tag 'create' do %>
- <%= render :partial => 'form' %>
- <p><%= submit_tag "Create" %></p>
+<% form_for :public_body, @public_body, :url => {:action => "create"} do |f| %>
+ <%= render :partial => 'form', :locals => {:f => f} %>
+ <p><%= f.submit "Create" %></p>
<% end %>
<p>