aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/admin_public_body/_form.rhtml82
-rw-r--r--app/views/admin_public_body/_tag_help.rhtml18
-rw-r--r--app/views/admin_public_body/edit.rhtml41
-rw-r--r--app/views/admin_public_body/import_csv.rhtml7
-rw-r--r--app/views/admin_public_body/new.rhtml26
-rw-r--r--app/views/admin_public_body/show.rhtml11
-rw-r--r--app/views/general/_frontpage_search_examples.es.rhtml1
-rw-r--r--app/views/general/_frontpage_search_examples.rhtml1
-rw-r--r--app/views/general/frontpage.rhtml6
-rw-r--r--app/views/layouts/admin.rhtml6
10 files changed, 129 insertions, 70 deletions
diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.rhtml
index b1516be2e..191b29e89 100644
--- a/app/views/admin_public_body/_form.rhtml
+++ b/app/views/admin_public_body/_form.rhtml
@@ -2,48 +2,60 @@
<!--[form:public_body]-->
-<div id="tag_help">
- <h2>List of tags</h2>
- <% first_row = true %>
- <% for row in PublicBodyCategories::CATEGORIES_WITH_HEADINGS %>
- <% if row.instance_of?(Array) %>
- <% if row[0] != 'other' %>
- <strong><%= row[0] %></strong>=<%= row[1] %>
- <br/>
- <% end %>
- <% elsif row != 'Miscellaneous' %>
- <% if not first_row %>
- <% else %>
- <% first_row = false %>
- <% end %>
- <h3><%=h row%></h3>
- <% end %>
+<div id="div-locales">
+ <ul>
+ <% for locale in I18n.available_locales do %>
+ <li><a href="#div-locale-<%=locale.to_s%>"><%=locale_name(locale.to_s)%></a></li>
<% end %>
+ </ul>
+
+<%
+ for locale in I18n.available_locales do
+ 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 id="div-locale-<%=locale.to_s%>">
+ <%= t.hidden_field :locale, :value => locale.to_s %>
+
+ <p><label for="public_body_name">Name</label><br/>
+ <%= 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/>
+ <%= 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/>
+ <%= t.text_field :request_email, :size => 40 %></p>
+
+ <p><label for="public_body_publication_scheme">Publication scheme URL</label><br/>
+ <%= 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/>
+ <%= t.text_area :notes, :rows => 3, :cols => 60 %></p>
+ </div>
+<%
+ end
+ end
+%>
</div>
-<p><label for="public_body_name">Name</label><br/>
-<%= text_field 'public_body', '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 'public_body', '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 'public_body', 'request_email', :size => 40 %></p>
+<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>
-
-<p><label for="public_body_publication_scheme">Publication scheme URL</label><br/>
-<%= text_field 'public_body', '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 'public_body', 'notes', :rows => 3, :cols => 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>
-<!--[eoform:public_body]-->
-
+<%= f.text_area :last_edit_comment, :rows => 3, :cols => 60 %></p>
+<!--[eoform:public_body]-->
diff --git a/app/views/admin_public_body/_tag_help.rhtml b/app/views/admin_public_body/_tag_help.rhtml
new file mode 100644
index 000000000..7954ff992
--- /dev/null
+++ b/app/views/admin_public_body/_tag_help.rhtml
@@ -0,0 +1,18 @@
+<div id="tag_help">
+ <h2>List of tags</h2>
+ <% first_row = true %>
+ <% for row in PublicBodyCategories::CATEGORIES_WITH_HEADINGS %>
+ <% if row.instance_of?(Array) %>
+ <% if row[0] != 'other' %>
+ <strong><%= row[0] %></strong>=<%= row[1] %>
+ <br/>
+ <% end %>
+ <% elsif row != 'Miscellaneous' %>
+ <% if not first_row %>
+ <% else %>
+ <% first_row = false %>
+ <% end %>
+ <h3><%=h row%></h3>
+ <% end %>
+ <% end %>
+</div> \ No newline at end of file
diff --git a/app/views/admin_public_body/edit.rhtml b/app/views/admin_public_body/edit.rhtml
index 005ec93ce..1883eb083 100644
--- a/app/views/admin_public_body/edit.rhtml
+++ b/app/views/admin_public_body/edit.rhtml
@@ -1,23 +1,30 @@
-
-
<h1><%=@title%></h1>
-<% form_tag '../update/' + @public_body.id.to_s do %>
- <%= render :partial => 'form' %>
- <p><%= submit_tag 'Save', :accesskey => 's' %></p>
-<% end %>
+<script>
+ $(function() {
+ $("#div-locales").tabs();
+ });
+</script>
-<p>
-<%= link_to 'Show', '../show/' + @public_body.id.to_s %> |
-<%= link_to 'List all', '../list' %>
-</p>
+<%= render :partial => 'tag_help' %>
-<% if @public_body.info_requests.size == 0 %>
- <% form_tag('../destroy/' + @public_body.id.to_s) do %>
- <p>
- <%= hidden_field_tag(:public_body_id, { :value => @public_body.id } ) %>
- <%= submit_tag "Destroy " + @public_body.name %> (this is permanent!)
- </p>
+<div id="public_body_form">
+ <% form_for @public_body, :url => {:action => 'update'} do |f| %>
+ <%= render :partial => 'form', :locals => {:f => f} %>
+ <p><%= f.submit 'Save', :accesskey => 's' %></p>
<% end %>
-<% end %>
+ <p>
+ <%= link_to 'Show', '../show/' + @public_body.id.to_s %> |
+ <%= link_to 'List all', '../list' %>
+ </p>
+
+ <% if @public_body.info_requests.size == 0 %>
+ <% form_tag('../destroy/' + @public_body.id.to_s) do %>
+ <p>
+ <%= hidden_field_tag(:public_body_id, { :value => @public_body.id } ) %>
+ <%= submit_tag "Destroy " + @public_body.name %> (this is permanent!)
+ </p>
+ <% end %>
+ <% end %>
+</div>
diff --git a/app/views/admin_public_body/import_csv.rhtml b/app/views/admin_public_body/import_csv.rhtml
index 50a4b951a..3bcc4bf41 100644
--- a/app/views/admin_public_body/import_csv.rhtml
+++ b/app/views/admin_public_body/import_csv.rhtml
@@ -23,16 +23,19 @@
<p><strong>CSV file format:</strong> A first row with the list of fields,
starting with '#', is optional but highly recommended. The fields 'name'
- and 'email' are required; additionaly, translated values are supported by
+ and 'request_email' are required; additionaly, translated values are supported by
adding the locale name to the field name, e.g. 'name.es', 'name.de'... Example:
</p>
<blockquote>
- #id,name,email,name.es<br/>
+ #id,name,request_email,name.es<br/>
1,An Authority,a@example.com,Un organismo<br/>
2,Another One,another@example.com,Otro organismo<br/>
</blockquote>
+ <p>Supported files: name (i18n), short_name (i18n), request_email (i18n), notes (i18n),
+ publication_scheme (i18n), home_page.</p>
+
<p><strong>Note:</strong> Choose <strong>dry run</strong> to test, without
actually altering the database. Choose <strong>upload</strong> to actually
make the changes. In either case, you will be shown any errors, or details
diff --git a/app/views/admin_public_body/new.rhtml b/app/views/admin_public_body/new.rhtml
index 95208b5b3..11186ee47 100644
--- a/app/views/admin_public_body/new.rhtml
+++ b/app/views/admin_public_body/new.rhtml
@@ -2,11 +2,21 @@
<h1><%=@title%></h1>
-<% form_tag 'create' do %>
- <%= render :partial => 'form' %>
- <p><%= submit_tag "Create" %></p>
-<% end %>
-
-<p>
-<%= link_to 'List all', 'list' %>
-</p>
+<script>
+ $(function() {
+ $("#div-locales").tabs();
+ });
+</script>
+
+<%= render :partial => 'tag_help' %>
+
+<div id="public_body_form">
+ <% form_for :public_body, @public_body, :url => {:action => "create"} do |f| %>
+ <%= render :partial => 'form', :locals => {:f => f} %>
+ <p><%= f.submit "Create" %></p>
+ <% end %>
+
+ <p>
+ <%= link_to 'List all', 'list' %>
+ </p>
+</div>
diff --git a/app/views/admin_public_body/show.rhtml b/app/views/admin_public_body/show.rhtml
index c1292c63a..643ccf5e8 100644
--- a/app/views/admin_public_body/show.rhtml
+++ b/app/views/admin_public_body/show.rhtml
@@ -12,7 +12,7 @@
<% if column.name == 'home_page' and !column.name.empty? %>
<%= link_to(h(@public_body.send(column.name)), @public_body.send(column.name)) %>
<% elsif column.name == 'request_email' and !column.name.empty? %>
- <%= link_to(h(@public_body.send(column.name)), "mailto:" + @public_body.send(column.name)) %>
+ <%= link_to(h(@public_body.send(column.name)), "mailto:#{@public_body.send(column.name)}") %>
<% if !@public_body.is_requestable? %>
(not requestable due to: <%=h @public_body.not_requestable_reason %><% if @public_body.is_followupable? %>; but followupable<% end %>)
<% end %>
@@ -32,7 +32,14 @@
</p>
<p>
- <%= link_to 'Public page', main_url(public_body_url(@public_body)) %>
+ <%=
+ # url_name can be missing if the name hasn't been set for this locale
+ if !@public_body.url_name.nil?
+ link_to 'Public page', main_url(public_body_url(@public_body))
+ else
+ 'Public page not available'
+ end
+ %>
| <%= link_to 'Edit', '../edit/' + @public_body.id.to_s %>
</p>
diff --git a/app/views/general/_frontpage_search_examples.es.rhtml b/app/views/general/_frontpage_search_examples.es.rhtml
new file mode 100644
index 000000000..63c7c3c1e
--- /dev/null
+++ b/app/views/general/_frontpage_search_examples.es.rhtml
@@ -0,0 +1 @@
+por ejemplo <a href="/es/search/El%20Geraldine%20Quango">El Geraldine Quango</a>, <a href="/search/fancy%20dog">Fancy Dog</a>.
diff --git a/app/views/general/_frontpage_search_examples.rhtml b/app/views/general/_frontpage_search_examples.rhtml
new file mode 100644
index 000000000..359a132e2
--- /dev/null
+++ b/app/views/general/_frontpage_search_examples.rhtml
@@ -0,0 +1 @@
+for example <a href="/search/Geraldine%20Quango">Geraldine Quango</a> or <a href="/search/fancy%20dog">Fancy Dog</a>.
diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml
index abed0294e..44b4980df 100644
--- a/app/views/general/frontpage.rhtml
+++ b/app/views/general/frontpage.rhtml
@@ -13,11 +13,7 @@
<%= hidden_field_tag 'bodies', 1 %>
<%= submit_tag _('Search') %>
<br>
- <%= _('e.g.') %>
- <% @search_examples.each_with_index do |name, i| %>
- <%=link_to name, search_url(name, 'bodies')%><% if i < 2 %>, <% else %>. <% break %><% end %>
- <% end %>
-
+ <%= render :partial => 'frontpage_search_examples' %>
<br>
<br>
<%= _('OR, <strong>search</strong> for information others have requested using {{site_name}}', :site_name => site_name) %>
diff --git a/app/views/layouts/admin.rhtml b/app/views/layouts/admin.rhtml
index f0e9a7019..42ca5dbbb 100644
--- a/app/views/layouts/admin.rhtml
+++ b/app/views/layouts/admin.rhtml
@@ -3,6 +3,10 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" >
<title><%= site_name %> admin<%= @title ? ":" : "" %> <%=@title%></title>
+
+ <%= javascript_include_tag 'jquery.js', 'jquery-ui.min' %>
+
+ <%= stylesheet_link_tag 'admin-theme/jquery-ui-1.8.15.custom.css', :rel => 'stylesheet'%>
<%= stylesheet_link_tag 'admin', :title => "Main", :rel => "stylesheet" %>
</head>
<body>
@@ -30,6 +34,6 @@
<% end %>
<%= yield %>
-
+
</body>
</html>