Changeset 1707
- Timestamp:
- 07/19/08 21:18:20 (1 month ago)
- Files:
-
- hive/trunk/data_webapp/app/helpers/clients_helper.rb (modified) (1 diff)
- hive/trunk/data_webapp/app/models/configuration.rb (modified) (3 diffs)
- hive/trunk/data_webapp/app/views/clients/index.html.erb (modified) (1 diff)
- hive/trunk/data_webapp/db/migrate/035_create_default_client_configurations.rb (added)
- hive/trunk/data_webapp/db/migrate/036_create_default_history_url_configurations.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
hive/trunk/data_webapp/app/helpers/clients_helper.rb
r1701 r1707 42 42 klass = instance.class 43 43 klass_name = klass.table_name.singularize 44 @statuses = klass.find(:all,:select=>"DISTINCT(status)").map(&:status).to_a44 @statuses = Configuration.get_all(:name => 'status', :namespace => klass.to_s) 45 45 if not @statuses.nil? 46 46 out += render :controller => klass_name, :partial => 'status_chooser', hive/trunk/data_webapp/app/models/configuration.rb
r1574 r1707 1 1 class Configuration < ActiveRecord::Base 2 2 3 # Get accepts two required arguments:3 # get accepts two required arguments: 4 4 # 5 5 # * <tt>:name</tt>: The name of the variable to look for. … … 7 7 # 8 8 # If any configuration entry contains a matching name and 9 # namespace, then the corresponding value is returned. 9 # namespace, then the corresponding value of the first 10 # match is returned. 10 11 # 11 12 # Otherwise, nil will be returned. … … 14 15 return obj.nil? ? nil : obj.value 15 16 end 17 18 # get_all accepts two required arguments: 19 # 20 # * <tt>:name</tt>: The name of the variable to look for. 21 # * <tt>:namespace</tt>: The namespace to search within. 22 # 23 # If any configuration entry contains a matching name and 24 # namespace, then the corresponding values will be returned 25 # in an array. 26 # 27 # Otherwise, an empty array will be returned. 28 def self.get_all(args = {}) 29 return Configuration.find(:all, :conditions => args).map(&:value).to_a 30 end 16 31 17 32 end hive/trunk/data_webapp/app/views/clients/index.html.erb
r1501 r1707 1 1 <h2>Client data</h2> 2 2 View Clients of type: 3 <%= select(:client,:status,C lient.find(:all,:select=>"DISTINCT(status)").map(&:status).to_a,{:include_blank => true},{:onchange => remote_function(:url => clients_url, :method => 'get',:with => "'status='+this.value")}) %>3 <%= select(:client,:status,Configuration.get_all(:name => 'status', :namespace => 'Client'),{:include_blank => true},{:onchange => remote_function(:url => clients_url, :method => 'get',:with => "'status='+this.value")}) %> 4 4 <p/> 5 5 <div id="data">
