Diff
Modified: trunk/app/controllers/search_controller.rb (2120 => 2121)
--- trunk/app/controllers/search_controller.rb 2009-03-13 16:55:17 UTC (rev 2120)
+++ trunk/app/controllers/search_controller.rb 2009-03-16 15:48:35 UTC (rev 2121)
@@ -9,15 +9,15 @@
@type = params[:type].to_s.downcase
+ if !Conf.search_categories.include(@type)
+ error(@type)
+ return false
+ end
+
# Hacks for 'Groups' --> 'Networks' and 'Files' --> 'Blobs' renames
@type = 'networks' if @type == 'groups'
@type = 'blobs' if @type == 'files'
- unless @@valid_types.include? @type
- error(@type)
- return false
- end
-
if @type == "all"
search_all
else
@@ -120,8 +120,6 @@
private
- @@valid_types = ["all", "workflows", "users", "networks", "blobs", "packs"]
-
def error(type)
flash[:error] = "'#{type}' is an invalid search type"
Modified: trunk/app/helpers/application_helper.rb (2120 => 2121)
--- trunk/app/helpers/application_helper.rb 2009-03-13 16:55:17 UTC (rev 2120)
+++ trunk/app/helpers/application_helper.rb 2009-03-16 15:48:35 UTC (rev 2121)
@@ -1535,5 +1535,8 @@
return permissions_categorised
end
+ def indefinite_article(text)
+ text.match(/^[aeiou]/i) ? "an" : "a"
+ end
end
Modified: trunk/app/views/layouts/_search.rhtml (2120 => 2121)
--- trunk/app/views/layouts/_search.rhtml 2009-03-13 16:55:17 UTC (rev 2120)
+++ trunk/app/views/layouts/_search.rhtml 2009-03-16 15:48:35 UTC (rev 2121)
@@ -1,7 +1,5 @@
-<% valid_types = ["all", "users", "groups", "workflows", "files", "packs"] -%>
-
<% form_tag search_path, :method => :get do %>
<%= text_field_tag :query, nil, :style => "padding: 0.1em;" %>
- <%= select_tag :type, options_for_select(valid_types.collect { |t| [t.capitalize, t] }, 'all') %>
+ <%= select_tag :type, options_for_select(Conf.search_categories.collect { |t| [t.capitalize, t] }, 'all') %>
<%= submit_tag "Search", :disable_with => "Searching..." %>
<% end %>
Modified: trunk/app/views/mailer/friendship_invite_new_user.rhtml (2120 => 2121)
--- trunk/app/views/mailer/friendship_invite_new_user.rhtml 2009-03-13 16:55:17 UTC (rev 2120)
+++ trunk/app/views/mailer/friendship_invite_new_user.rhtml 2009-03-16 15:48:35 UTC (rev 2121)
@@ -18,7 +18,7 @@
To become my friend you will have to follow these simple steps:
-1. Register for a <%= Conf.sitename %> account at: <%= url_for : false, :host => @base_url, :controller => 'users', :action ="" 'new', :token => @token %>
+1. Register for <%= indefinite_article(Conf.sitename) %> <%= Conf.sitename %> account at: <%= url_for : false, :host => @base_url, :controller => 'users', :action ="" 'new', :token => @token %>
2. Confirm your email address as instructed during the registration process.
3. Accept my friendship request that you will receive directly to your account once the registration is complete.
Modified: trunk/app/views/mailer/group_invite_new_user.rhtml (2120 => 2121)
--- trunk/app/views/mailer/group_invite_new_user.rhtml 2009-03-13 16:55:17 UTC (rev 2120)
+++ trunk/app/views/mailer/group_invite_new_user.rhtml 2009-03-16 15:48:35 UTC (rev 2121)
@@ -20,7 +20,7 @@
To join the group you will have to follow these simple steps:
-1. Register for a <%= Conf.sitename %> account at: <%= url_for : false, :host => @base_url, :controller => 'users', :action ="" 'new', :token => @token %>
+1. Register for <%= indefinite_article(Conf.sitename) %> <%= Conf.sitename %> account at: <%= url_for : false, :host => @base_url, :controller => 'users', :action ="" 'new', :token => @token %>
2. Confirm your email address as instructed during the registration process.
3. Accept the group membership request that you will receive directly to your account once the registration is complete.
Modified: trunk/app/views/users/edit.rhtml (2120 => 2121)
--- trunk/app/views/users/edit.rhtml 2009-03-13 16:55:17 UTC (rev 2120)
+++ trunk/app/views/users/edit.rhtml 2009-03-16 15:48:35 UTC (rev 2121)
@@ -20,7 +20,7 @@
<br/>
<h2>User Authentication</h2>
<p style="text-align: center; line-height: 1.5;">
- You have two options to log in: using a <%= Conf.sitename %> username and password <b>OR</b> OpenID login details.
+ You have two options to log in: using <%= indefinite_article(Conf.sitename) %> <%= Conf.sitename %> username and password <b>OR</b> OpenID login details.
<br/>
<i>Your account can have either of these or even both registered, as below.</i>
</p>
Modified: trunk/lib/conf.rb (2120 => 2121)
--- trunk/lib/conf.rb 2009-03-13 16:55:17 UTC (rev 2120)
+++ trunk/lib/conf.rb 2009-03-16 15:48:35 UTC (rev 2121)
@@ -43,6 +43,10 @@
@vars['new_menu']
end
+ def self.search_categories
+ @vars['search_categories']
+ end
+
# This method is required to create an administrator in the test fixtures
def self.admins=(value)