diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/public_body.rb | 2 | ||||
-rw-r--r-- | app/views/admin_public_body/_form.rhtml | 43 | ||||
-rw-r--r-- | app/views/admin_public_body/edit.rhtml | 8 | ||||
-rw-r--r-- | app/views/admin_public_body/new.rhtml | 9 | ||||
-rw-r--r-- | app/views/layouts/admin.rhtml | 6 |
5 files changed, 48 insertions, 20 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index a476db8c0..c19433704 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -53,7 +53,7 @@ class PublicBody < ActiveRecord::Base # XXX - Don't like repeating this! def calculate_cached_fields(t) - t.first_letter = t.name.scan(/^./mu)[0].upcase + t.first_letter = t.name.scan(/^./mu)[0].upcase unless t.name.nil? or t.name.empty? short_long_name = t.name short_long_name = t.short_name if t.short_name and !t.short_name.empty? t.url_name = MySociety::Format.simplify_url_part(short_long_name, 'body') diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.rhtml index 98749154c..15313bbdd 100644 --- a/app/views/admin_public_body/_form.rhtml +++ b/app/views/admin_public_body/_form.rhtml @@ -2,7 +2,10 @@ <!--[form:public_body]--> -<div id="tag_help"> +<!-- + XXX: disabled temporarily while testing jQuery tabs + + <div id="tag_help"> <h2>List of tags</h2> <% first_row = true %> <% for row in PublicBodyCategories::CATEGORIES_WITH_HEADINGS %> @@ -19,9 +22,17 @@ <h3><%=h row%></h3> <% end %> <% end %> -</div> +</div> --> <h3>Localized Fields</h3> +<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 @@ -37,29 +48,29 @@ fields_for prefix, object do |t| %> -<div> - <p>Locale: <%= locale_name(locale.to_s) %></p> - <%= t.hidden_field :locale, :value => locale.to_s %> + <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_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_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_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_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> + <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> <h3>Common Fields</h3> diff --git a/app/views/admin_public_body/edit.rhtml b/app/views/admin_public_body/edit.rhtml index ae4066dc7..b895fbd70 100644 --- a/app/views/admin_public_body/edit.rhtml +++ b/app/views/admin_public_body/edit.rhtml @@ -1,7 +1,11 @@ - - <h1><%=@title%></h1> +<script> + $(function() { + $("#div-locales").tabs(); + }); +</script> + <% form_for @public_body, :url => {:action => 'update'} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <p><%= f.submit 'Save', :accesskey => 's' %></p> diff --git a/app/views/admin_public_body/new.rhtml b/app/views/admin_public_body/new.rhtml index fe0b5b670..dcef8ae9f 100644 --- a/app/views/admin_public_body/new.rhtml +++ b/app/views/admin_public_body/new.rhtml @@ -2,6 +2,13 @@ <h1><%=@title%></h1> +<script> + $(function() { + $("#div-locales").tabs(); + }); +</script> + + <% form_for :public_body, @public_body, :url => {:action => "create"} do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <p><%= f.submit "Create" %></p> @@ -9,4 +16,4 @@ <p> <%= link_to 'List all', 'list' %> -</p> +</p>
\ No newline at end of file diff --git a/app/views/layouts/admin.rhtml b/app/views/layouts/admin.rhtml index f0e9a7019..c81ac889f 100644 --- a/app/views/layouts/admin.rhtml +++ b/app/views/layouts/admin.rhtml @@ -3,7 +3,13 @@ <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" > <title><%= site_name %> admin<%= @title ? ":" : "" %> <%=@title%></title> + + <!-- XXX: use local versions once we agree on tabs --> + <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> + <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js"></script> + <%= stylesheet_link_tag 'admin', :title => "Main", :rel => "stylesheet" %> + <%= stylesheet_link_tag 'ui-lightness/jquery-ui-1.8.15.custom.css', :rel => 'stylesheet'%> </head> <body> |