aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/public_body_controller.rb4
-rw-r--r--app/controllers/request_controller.rb6
-rw-r--r--app/models/public_body.rb8
-rw-r--r--app/models/public_body_tag.rb11
-rw-r--r--app/views/admin_public_body/_tags.rhtml13
5 files changed, 31 insertions, 11 deletions
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index f46e55014..4ca8d1404 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -76,6 +76,10 @@ class PublicBodyController < ApplicationController
elsif @tag.size == 1
@tag.upcase!
conditions = ['first_letter = ?', @tag]
+ elsif @tag.include?(":")
+ name, value = PublicBodyTag.split_tag_into_name_value(@tag)
+ conditions = ['(select count(*) from public_body_tags where public_body_tags.public_body_id = public_bodies.id
+ and public_body_tags.name = ? and public_body_tags.value = ?) > 0', name, value]
else
conditions = ['(select count(*) from public_body_tags where public_body_tags.public_body_id = public_bodies.id
and public_body_tags.name = ?) > 0', @tag]
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index b2f6e8631..767bb8488 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -131,6 +131,12 @@ class RequestController < ApplicationController
# Page new form posts to
def new
+ # Allow url_name
+ if !params[:public_body_url_name].nil? && params
+ end
+ if params[:submitted_new_request].nil?
+ end
+
# All new requests are of normal_sort
if !params[:outgoing_message].nil?
params[:outgoing_message][:what_doing] = 'normal_sort'
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 253ba1888..e0d02a5b6 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -197,13 +197,7 @@ class PublicBody < ActiveRecord::Base
self.public_body_tags = []
for tag in tags
# see if is a machine tags (i.e. a tag which has a value)
- sections = tag.split(/:/)
- name = sections[0]
- if sections[1]
- value = sections[1,sections.size].join(":")
- else
- value = nil
- end
+ name, value = PublicBodyTag.split_tag_into_name_value(tag)
public_body_tag = PublicBodyTag.new(:name => name, :value => value)
self.public_body_tags << public_body_tag
diff --git a/app/models/public_body_tag.rb b/app/models/public_body_tag.rb
index 74449abc4..42b3899a1 100644
--- a/app/models/public_body_tag.rb
+++ b/app/models/public_body_tag.rb
@@ -33,5 +33,16 @@ class PublicBodyTag < ActiveRecord::Base
end
return ret
end
+
+ def PublicBodyTag.split_tag_into_name_value(tag)
+ sections = tag.split(/:/)
+ name = sections[0]
+ if sections[1]
+ value = sections[1,sections.size].join(":")
+ else
+ value = nil
+ end
+ return name, value
+ end
end
diff --git a/app/views/admin_public_body/_tags.rhtml b/app/views/admin_public_body/_tags.rhtml
index a80c69fb8..362424013 100644
--- a/app/views/admin_public_body/_tags.rhtml
+++ b/app/views/admin_public_body/_tags.rhtml
@@ -1,6 +1,11 @@
-<%= body.public_body_tags.map { |t|
- link_to(h(t.name_and_value), main_url(list_public_bodies_url(:tag => t.name, :only_path => true))) +
- ' (<a href="' + admin_url('body/list') + "?query=" + h(t.name) + '">admin</a>)'
- }.join(' ') %>
+<% for t in body.public_body_tags %>
+ <% if t.value %>
+ <%= link_to(h(t.name), main_url(list_public_bodies_url(:tag => t.name, :only_path => true))) %>:<%= link_to(h(t.value), main_url(list_public_bodies_url(:tag => t.name_and_value, :only_path => true))) %>
+ <% else %>
+ <%= link_to(h(t.name), main_url(list_public_bodies_url(:tag => t.name, :only_path => true))) %>
+ <% end %>
+ (<a href="<%= admin_url('body/list') %>?query=<%= h(t.name)%>">admin</a>)
+<% end %>
+