diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 73867aba..d75601a4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,18 +1,18 @@ class UsersController < ApplicationController before_filter :login_required, :except => [:lost_password, :fetch_otp] access_control [:new, :edit, :create, :update, :destroy, :reset_password] => 'sysadmin', - [:index, :list, :show, :search, :next, :previous, :export, :export_import, - :import, :process_imported] => '(sysadmin | allocmgr)' - + [:index, :list, :show, :search, :next, :previous, :export, :export_import, + :import, :process_imported, :activity] => '(sysadmin | allocmgr)' + # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) - verify :method => :post, :only => [ :destroy, :create, :update, :update_profile, :reset_password, :process_imported, :import, :fetch_otp ], - :redirect_to => { :action => :list } - + verify :method => :post, :only => [:destroy, :create, :update, :update_profile, :reset_password, :process_imported, :import, :fetch_otp], + :redirect_to => {:action => :list} + def index list render :action => 'list' end - + def list session[:users_start_filter] = params[:start_filter] unless params[:start_filter].nil? session[:users_end_filter] = params[:end_filter] unless params[:end_filter].nil? @@ -22,22 +22,22 @@ def list session[:users_search] = nil end set_start_stop_tags - @users = User.list params[:page], current_user.row_limit, session[:users_start_filter], - session[:users_end_filter], nil + @users = User.list params[:page], current_user.row_limit, session[:users_start_filter], + session[:users_end_filter], nil end - + def search - session[:users_start_filter] = "All" - session[:users_end_filter] = "All" - session[:users_search] = (params[:user] ? params[:user][:email] : "") - @user = User.new(:email => session[:users_search]) + session[:users_start_filter] = "All" + session[:users_end_filter] = "All" + session[:users_search] = (params[:user] ? params[:user][:email] : "") + @user = User.new(:email => session[:users_search]) # params[:search] = StringUtils.sanitize_search_terms params[:search] if @user.email.blank? list render :list return end - + set_start_stop_tags begin search_results = User.search_for_ids @user.email, :order => :email @@ -48,19 +48,19 @@ def search redirect_to :action => 'list' else @users = User.list params[:page], 999, - session[:users_start_filter], - session[:users_end_filter], - search_results + session[:users_start_filter], + session[:users_end_filter], + search_results render :action => 'list' end end - + def show @user = User.find(params[:id]) end - + def next - user = User.find(params[:id]) + user = User.find(params[:id]) users = User.next(user.email) if users.empty? @user = user @@ -69,9 +69,9 @@ def next end render :action => 'show' end - + def previous - user = User.find(params[:id]) + user = User.find(params[:id]) users = User.previous(user.email) if users.empty? @user = user @@ -80,7 +80,7 @@ def previous end render :action => 'show' end - + def process_imported counter = 0 for user in User.imported_users @@ -92,7 +92,7 @@ def process_imported flash[:notice] = "Processed #{StringUtils.pluralize(counter, 'imported user')}" redirect_to :action => 'list' end - + def reset_password @user = User.find(params[:id]) @user.reset_password @@ -105,15 +105,15 @@ def reset_password render :action => 'show', :id => @user end end - - def create - params[:user][:role_ids] ||= [] + + def create + params[:user][:role_ids] ||= [] params[:user][:group_ids] ||= [] - @user = User.new(params[:user]) - @user.first_name = @user.first_name.try(:strip) - @user.last_name = @user.last_name.try(:strip) - @user.login = @user.login.try(:strip) - @user.hide_contact_info = params[:user][:hide_contact_info] + @user = User.new(params[:user]) + @user.first_name = @user.first_name.try(:strip) + @user.last_name = @user.last_name.try(:strip) + @user.login = @user.login.try(:strip) + @user.hide_contact_info = params[:user][:hide_contact_info] if CustomField.users_custom_boolean1 @user.custom_boolean1 = params[:user][:custom_boolean1] end @@ -130,9 +130,9 @@ def create return elsif qty > 0 alloc = UserAllocation.new( - :quantity => qty, - :comments => "", - :expiration_date => Allocation.calculate_expiration_date) + :quantity => qty, + :comments => "", + :expiration_date => Allocation.calculate_expiration_date) end end if @user.save @@ -147,11 +147,11 @@ def create render :action => 'new' end end - + def fetch_otp - user = nil - trusted_sites = (APP_CONFIG['otp_trusted_sites'] || "").gsub(/^\s*\(|\)\s*$/, "").split(/,/) || [""] - if trusted_sites.include? request.remote_ip + user = nil + trusted_sites = (APP_CONFIG['otp_trusted_sites'] || "") + if Regexp.new(trusted_sites).match(request.remote_ip) user = User.find_by_email(params[:login]) else logger.warn("Request for a otp from an untrusted site: #{request.remote_ip} is not in #{APP_CONFIG['otp_trusted_sites']}") @@ -168,11 +168,11 @@ def fetch_otp end end end - + def lost_password - return unless request.post? + return unless request.post? @email = params[:email] # needed to remember email info if fails - user = User.find_by_email(@email) + user = User.find_by_email(@email) if user.nil? flash[:notice] = "No such user #{@email}" elsif !user.active @@ -186,55 +186,67 @@ def lost_password end end end - + + def activity + session[:activity_email] = params[:user][:email] if params[:user] && params[:user][:email] + @user = User.find_by_email(session[:activity_email]) + if @user + @topics = Topic.find(:all, + :include => [{:forum => :slug }, :user, :slug], + :conditions => ["topics.id IN (?)", @user.topic_comments.topic_ids.collect(&:topic_id) + [-1]], + :order => "topics.created_at") + end + end + + def auto_complete_for_user_email search_txt = "%#{params[:user][:email]}%" - @users = User.find(:all, :conditions => ['email LIKE ? or first_name like ? or last_name like ?', - search_txt, search_txt, search_txt], - :order => 'email ASC', :limit => 10) + @users = User.find(:all, :conditions => ['email LIKE ? or first_name like ? or last_name like ?', + search_txt, search_txt, search_txt], + :order => 'email ASC', :limit => 10) render :inline => "<%= auto_complete_result(@users, 'email') %>" end - + def new - @user = User.new(:initial_allocation => 0) + @user = User.new(:initial_allocation => 0) # default timezone @user.time_zone = APP_CONFIG['default_user_timezone'] setup_session_properties end - + def update - params[:user][:role_ids] ||= [] + params[:user][:role_ids] ||= [] params[:user][:group_ids] ||= [] - @user = User.find(params[:id]) - + @user = User.find(params[:id]) + # if the password was updated, force a password change params[:user][:force_change_password] = 1 unless params[:user][:password].nil? or params[:user][:password].length == 0 params[:user][:identity_url] = add_trailing_slash params[:user][:identity_url] - + if @user.update_attributes(params[:user]) flash[:notice] = "User #{@user.login} was successfully updated." redirect_to :action => 'show', :id => @user else - @user.errors.each{|attr,msg| puts ">>>>>>>#{attr} - #{msg}" } + @user.errors.each { |attr, msg| puts ">>>>>>>#{attr} - #{msg}" } setup_session_properties render :action => 'edit' end end - + def edit_profile @user = current_user end - + def update_profile - @user = User.find(params[:id]) - @user.first_name = params[:user][:first_name] - @user.last_name = params[:user][:last_name] - @user.time_zone = params[:user][:time_zone] + @user = User.find(params[:id]) + @user.first_name = params[:user][:first_name] + @user.last_name = params[:user][:last_name] + @user.time_zone = params[:user][:time_zone] @user.topic_notification_digests = params[:user][:topic_notification_digests] - @user.row_limit = params[:user][:row_limit] - @user.identity_url = add_trailing_slash params[:user][:identity_url] - @user.hide_contact_info = params[:user][:hide_contact_info] - @user.watch_on_vote = params[:user][:watch_on_vote] + @user.row_limit = params[:user][:row_limit] + @user.identity_url = add_trailing_slash params[:user][:identity_url] + @user.hide_contact_info = params[:user][:hide_contact_info] + @user.watch_on_vote = params[:user][:watch_on_vote] if @user.save flash[:notice] = "User #{@user.login}'s profile was successfully updated." # redirect_back_or_default home_path @@ -245,81 +257,80 @@ def update_profile render :action => 'edit_profile' end end - + def destroy - user = User.find(params[:id]) + user = User.find(params[:id]) email = user.email user.destroy flash[:notice] = "User #{email} was successfully deleted." redirect_to :action => 'list' end - + def edit @user = User.find(params[:id]) setup_session_properties end - + def export_import session[:user_load_toggle_pix] ||= "HIDE" - @errors = [] - @users = [] - @enterprises = [] + @errors = [] + @users = [] + @enterprises = [] end - + # Generate a csv file of users and enterprises def export - + response = "" - csv = FasterCSV.new(response, :row_sep => "\r\n") - + csv = FasterCSV.new(response, :row_sep => "\r\n") + csv << ["email", - "first name", - "last name", - "enterprise", - "allocations mgr (Y|N)", - "voter (Y|N)" + "first name", + "last name", + "enterprise", + "allocations mgr (Y|N)", + "voter (Y|N)" ] CsvUtils.setup_request_for_csv headers, request, "users.csv" render :text => response end - - def import - @parsed_file=CSV::Reader.parse(params[:dump][:file]) - @errors = [] - @users = [] - @enterprises = [] - + + def import + @parsed_file =CSV::Reader.parse(params[:dump][:file]) + @errors = [] + @users = [] + @enterprises = [] + allocmgr_role = Role.find_by_title "allocmgr" - voter_role = Role.find_by_title "voter" - - n = -1 + voter_role = Role.find_by_title "voter" + + n = -1 @parsed_file.each do |row| if n == -1 # skip the first line -- it's the header n = 0 next end - n += 1 - - email = row[0] - first_name = row[1] - last_name = row[2] + n += 1 + + email = row[0] + first_name = row[1] + last_name = row[2] enterprise_name = row[3] - allocation_mgr = row[4] - voter = row[5] - + allocation_mgr = row[4] + voter = row[5] + if enterprise_name.blank? @errors << "Enterprise must be specified for '#{email}'" next end # Create a dummy enterprise for now... enterprise = Enterprise.new(:name => enterprise_name) if enterprise.nil? - - if - user = User.new(:email => email, :first_name => first_name, - :last_name => last_name, :enterprise => enterprise, - :password => "Dummy", :password_confirmation => "Dummy", - :activation_code => "SKIP") + + if user = User.new(:email => email, :first_name => first_name, + :last_name => last_name, :enterprise => enterprise, + :password => "Dummy", :password_confirmation => "Dummy", + :activation_code => "SKIP") if yes? allocation_mgr user.roles << allocmgr_role end @@ -340,14 +351,14 @@ def import n = 0 for user in @users enterprise_name = user.enterprise.name - enterprise = Enterprise.find_by_name(enterprise_name) + enterprise = Enterprise.find_by_name(enterprise_name) if enterprise.nil? - enterprise = Enterprise.create(:name => enterprise_name) - @enterprises << enterprise + enterprise = Enterprise.create(:name => enterprise_name) + @enterprises << enterprise end user.enterprise = enterprise if user.save - n += 1 + n += 1 else fail = true break @@ -356,59 +367,59 @@ def import flash[:notice] = "Import successful, #{StringUtils.pluralize(n, 'user')} created, #{StringUtils.pluralize(@enterprises.length, 'enterprise')} created" unless fail end if fail || !@errors.empty? - @users = [] - @enterprises = [] + @users = [] + @enterprises = [] flash[:error] = "Import failed, see below for details" end render :action => 'export_import' end - + def toggle_pix if session[:user_load_toggle_pix] == "HIDE" session[:user_load_toggle_pix] = "SHOW" else session[:user_load_toggle_pix] = "HIDE" end - + respond_to do |format| - format.html { + format.html { export_import render :action => 'export_import' } - format.js { do_rjs_toggle_pix } + format.js { do_rjs_toggle_pix } end end - + def toggle_image_button - "   #{link_to pix_button_text, - options = { :action => 'toggle_pix'}, - html_options = {:class=> "button"} }" + "   #{link_to pix_button_text, + options = {:action => 'toggle_pix'}, + html_options = {:class=> "button"} }" end - + private - + def stream_csv - filename = params[:action] + ".csv" - - #this is required if you want this to work with IE + filename = params[:action] + ".csv" + + #this is required if you want this to work with IE if request.env['HTTP_USER_AGENT'] =~ /msie/i - headers['Pragma'] = 'public' - headers["Content-type"] = "text/plain" - headers['Cache-Control'] = 'private' - headers['Content-Disposition'] = "attachment; filename=\"#{filename}\"" - headers['Expires'] = "0" + headers['Pragma'] = 'public' + headers["Content-type"] = "text/plain" + headers['Cache-Control'] = 'private' + headers['Content-Disposition'] = "attachment; filename=\"#{filename}\"" + headers['Expires'] = "0" else - headers["Content-Type"] ||= 'text/csv' - headers["Content-Disposition"] = "attachment; filename=\"#{filename}\"" + headers["Content-Type"] ||= 'text/csv' + headers["Content-Disposition"] = "attachment; filename=\"#{filename}\"" end - + render :text => Proc.new { |response, output| - csv = FasterCSV.new(output, :row_sep => "\r\n") + csv = FasterCSV.new(output, :row_sep => "\r\n") yield csv } - end - - def do_rjs_toggle_pix + end + + def do_rjs_toggle_pix render :update do |page| if session[:user_load_toggle_pix] == "HIDE" page.visual_effect :squish, :image1, :duration => 0.5 @@ -423,34 +434,34 @@ def do_rjs_toggle_pix end end end - + def setup_session_properties - @enterprises = Enterprise.active + @enterprises = Enterprise.active end - + def yes? str return false if str.nil? str.upcase == "Y" || str.upcase == "YES" || str.upcase == "T" || str.upcase == "TRUE" end - + def add_trailing_slash str str = str + '/' unless str.blank? or str =~ /\/$/ str end - + def set_start_stop_tags count = User.count if count > 100 @tag1_begin = User.find(:first, :select => "email", :order => "email").email - @tag1_end = User.find(:first, :select => "email", :offset => count/5, :order => "email").email + @tag1_end = User.find(:first, :select => "email", :offset => count/5, :order => "email").email @tag2_begin = User.find(:first, :select => "email", :offset => count/5 + 1, :order => "email").email - @tag2_end = User.find(:first, :select => "email", :offset => 2*count/5, :order => "email").email + @tag2_end = User.find(:first, :select => "email", :offset => 2*count/5, :order => "email").email @tag3_begin = User.find(:first, :select => "email", :offset => 2*count/5 + 1, :order => "email").email - @tag3_end = User.find(:first, :select => "email", :offset => 3*count/5, :order => "email").email + @tag3_end = User.find(:first, :select => "email", :offset => 3*count/5, :order => "email").email @tag4_begin = User.find(:first, :select => "email", :offset => 3*count/5 + 1, :order => "email").email - @tag4_end = User.find(:first, :select => "email", :offset => 4*count/5, :order => "email").email + @tag4_end = User.find(:first, :select => "email", :offset => 4*count/5, :order => "email").email @tag5_begin = User.find(:first, :select => "email", :offset => 4*count/5 + 1, :order => "email").email - @tag5_end = User.find(:first, :select => "email", :offset => count-1, :order => "email").email + @tag5_end = User.find(:first, :select => "email", :offset => count-1, :order => "email").email end end -end \ No newline at end of file +end diff --git a/app/models/topic_comment.rb b/app/models/topic_comment.rb index 9026aec9..31fa684d 100644 --- a/app/models/topic_comment.rb +++ b/app/models/topic_comment.rb @@ -17,23 +17,26 @@ class TopicComment < Comment # acts_as_solr :fields => [:body, {:created_at => :date}] - + define_index do indexes body has created_at, updated_at set_property :delta => true end - + belongs_to :topic, :counter_cache => true belongs_to :endorser, :class_name => 'User' before_create :update_topic_commented_at_on_create before_create :notify_immediate_watchers before_update :update_topic_commented_at_on_update - + validates_presence_of :topic_id - + + named_scope :by_user, + lambda{|user|{:conditions => ['comments.user_id = ?', user.id]}} named_scope :by_moderator, :joins => {:topic => { :forum => :mediators }}, :conditions => [ "comments.user_id = forum_mediators.user_id" ] + named_scope :topic_ids, :select => ["comments.topic_id"] def update_topic_commented_at_on_create unless private @@ -49,7 +52,7 @@ def update_topic_commented_at_on_update def can_see? current_user !self.private or topic.forum.mediators.include? current_user end - + def can_edit? current_user, role_override=false return true if role_override (topic.last_comment?(self) and user.id == current_user.id) or @@ -67,7 +70,7 @@ def can_endorse? current_user def can_unendorse? current_user !self.endorser.nil? and topic.forum.mediators.include? current_user end - + def self.top_users forum=nil sql = %Q{ select u.id, u.first_name, u.last_name, u.email, u.hide_contact_info, count(*) @@ -84,11 +87,11 @@ def self.top_users forum=nil User.find(:all, :conditions => ["id in (?)", User.find_by_sql([sql, forum_id, forum_id]).collect(&:id)]).sort_by{|u| u.topic_comments.size * -1} end - + def rss_headline "Forum: #{topic.forum.name}, Topic: #{topic.title}" end - + def rss_body "#{user.display_name} wrote:
#{body}" end diff --git a/app/models/user_logon.rb b/app/models/user_logon.rb index 578b76e5..c3ebd6e2 100644 --- a/app/models/user_logon.rb +++ b/app/models/user_logon.rb @@ -11,11 +11,14 @@ class UserLogon < ActiveRecord::Base belongs_to :user - + + named_scope :in_last_year, :conditions => ['created_at > ?', 1.year.ago.to_s(:db)] + def self.list(page, per_page) - paginate :page => page, + paginate :page => page, + :include => [:user], :conditions => ['created_at > ?', (Time.zone.now - 60*60*24*90).to_s(:db)], - :order => 'created_at desc', + :order => 'created_at desc', :per_page => per_page end end diff --git a/app/models/vote.rb b/app/models/vote.rb index 984ade23..bd240434 100644 --- a/app/models/vote.rb +++ b/app/models/vote.rb @@ -14,11 +14,13 @@ # class Vote < ActiveRecord::Base - + belongs_to :idea belongs_to :allocation belongs_to :user - + + named_scope :include_idea, :include => [:idea] + validates_presence_of :user_id, :allocation_id, :idea_id def self.list(page, per_page, enterprise = nil, user = nil) @@ -38,10 +40,10 @@ def self.list(page, per_page, enterprise = nil, user = nil) conditions[1] = enterprise.id conditions[2] = user.id end - - paginate :page => page, + + paginate :page => page, :conditions => conditions, - :order => 'votes.created_at DESC', + :order => 'votes.created_at DESC', :per_page => per_page, :include => :idea end @@ -50,7 +52,7 @@ def can_delete? true end - # The number of seconds until a vote can no longer be rescinded + # The number of seconds until a vote can no longer be rescinded def self.rescind_seconds APP_CONFIG['rescind_minutes'].to_i * 60 end diff --git a/app/views/groups/_tab_menu.rhtml b/app/views/groups/_tab_menu.rhtml index a98fbb8b..ea78f29d 100644 --- a/app/views/groups/_tab_menu.rhtml +++ b/app/views/groups/_tab_menu.rhtml @@ -1,21 +1,26 @@
- \ No newline at end of file + diff --git a/app/views/user_logons/_tab_menu.rhtml b/app/views/user_logons/_tab_menu.rhtml index 22ba9eda..c214677b 100644 --- a/app/views/user_logons/_tab_menu.rhtml +++ b/app/views/user_logons/_tab_menu.rhtml @@ -1,20 +1,25 @@
- \ No newline at end of file + diff --git a/app/views/user_requests/_tab_menu.rhtml b/app/views/user_requests/_tab_menu.rhtml index fa9a058c..eaaeb11b 100644 --- a/app/views/user_requests/_tab_menu.rhtml +++ b/app/views/user_requests/_tab_menu.rhtml @@ -1,21 +1,26 @@
- \ No newline at end of file + diff --git a/app/views/users/_logon.html.erb b/app/views/users/_logon.html.erb new file mode 100644 index 00000000..e4fc621c --- /dev/null +++ b/app/views/users/_logon.html.erb @@ -0,0 +1,5 @@ + + + <%= om_date_time logon.created_at %> + + diff --git a/app/views/users/_tab_menu.rhtml b/app/views/users/_tab_menu.rhtml index 8e2f54e0..7f2f7011 100644 --- a/app/views/users/_tab_menu.rhtml +++ b/app/views/users/_tab_menu.rhtml @@ -1,21 +1,26 @@
- \ No newline at end of file + diff --git a/app/views/users/_topic.html.erb b/app/views/users/_topic.html.erb new file mode 100644 index 00000000..27b4f170 --- /dev/null +++ b/app/views/users/_topic.html.erb @@ -0,0 +1,7 @@ + + <%= link_to h(topic.forum.name), forum_path(topic.forum) %> + <%= link_to h(topic.title), topic_path(topic) %> + <%= user_display_name(topic.user) %> + <%= topic.comments.by_user(@user).count %> + <%= om_date_time topic.comments.by_user(@user).last.try(:created_at) %> + diff --git a/app/views/users/_vote.html.erb b/app/views/users/_vote.html.erb new file mode 100644 index 00000000..2bd516bd --- /dev/null +++ b/app/views/users/_vote.html.erb @@ -0,0 +1,8 @@ + + + <%= om_date_time vote.created_at %> + + + <%= link_to "#{vote.idea.id}: #{h vote.idea.title}", {:action => 'show', :id => vote.idea } %> + + diff --git a/app/views/users/activity.html.erb b/app/views/users/activity.html.erb new file mode 100644 index 00000000..fb26964a --- /dev/null +++ b/app/views/users/activity.html.erb @@ -0,0 +1,121 @@ +<% content_for :head do -%> + <%= javascript_include_tag "tablecloth" %> +<% end %> +<% content_for :bodyTag do -%> + <%= set_focus_to_id 'user_email' -%> +<% end %> + +
+ +
+ + +
+ +

User Activity

+ + <% form_for :user, :url => activity_users_path, :html => {:class => 'cssform searchform'} do |f| %> +

+ + <%= text_field_with_auto_complete :user, :email, {}, {:method => :get} %> +

+ +

+ + <%= submit_tag 'View', :name => nil, :class=> "button" %> +

+ <% end %> + + <% if @user %> + +

Votes

+ + + + + + <% if @user.all_votes.include_idea.present? %> + <%= render :partial => 'vote', :collection => @user.all_votes.sort{|v| v.id * -1} %> + <% else %> + + <% end %> +
+ Voted On + + Idea +
+ No records found +
+ +

Forum Activity

+ + + + + + + + + <% if @topics.present? %> + <%= render :partial => 'topic', :collection => @topics %> + <% else %> + + <% end %> +
+ Forum + + Topic + + Author + + Posts By User + + Last Posted At +
+ No records found +
+ +

User Logons

+ + + + + <% if @user.user_logons.in_last_year.present? %> + <%= render :partial => 'logon', :collection => @user.user_logons.in_last_year %> + <% else %> + + <% end %> +
+ Logged On At +
+ No records found +
+ <% elsif session[:activity_email] %> + No such user + <% end %> +
diff --git a/app/views/users/new.rhtml b/app/views/users/new.rhtml index 701ecc4f..741ec94a 100644 --- a/app/views/users/new.rhtml +++ b/app/views/users/new.rhtml @@ -7,7 +7,7 @@ <%= error_messages_for 'user' %> <% form_for :user, :url => { :action => "create" } do |form| %>
- <%= theme_image_tag("icons/16x16/userEdit.png", + <%= theme_image_tag("icons/16x16/userEdit.png", options = {:alt=>"Create User"}) %> Create User
@@ -76,8 +76,8 @@

<%= submit_tag 'Create', html_options = {:class=> "button", :disable_with => "Please wait..."} %> - <%= link_to 'Cancel', options = {:action => 'list'}, html_options = {:class=> "button"}%> + <%= link_to 'Cancel', users_path, html_options = {:class=> "button"}%>

<% end %> - \ No newline at end of file + diff --git a/config/routes.rb b/config/routes.rb index 1e4c96d4..dda4c303 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,17 +1,17 @@ ActionController::Routing::Routes.draw do |map| - + # The priority is based upon order of creation: first created -> highest # priority. - + # Sample of regular route: map.connect 'products/:id', :controller => # 'catalog', :action => 'view' Keep in mind you can assign values other than # :controller and :action - + # Sample of named route: map.purchase 'products/:id/purchase', :controller => # 'catalog', :action => 'purchase' This route can be invoked with # purchase_url(:id => product.id) - + map.resources :allocations, :collection => { :export_import => :get, :export => :post, :import => :post, :toggle_pix => :get } map.resources :announcements, :collection => { :preview => :get, :rss => :get } @@ -24,7 +24,7 @@ :collection => { :search => :get, :auto_complete_for_enterprise_name => :get } map.resources :forums, :collection => { :search => :get, :rss => :get, :tag => :get, :metrics => :get, :metrics_graphs => :get, - :open_count_graphs => :get, :days_pending_graphs => :get, :pending_count_graphs => :get}, + :open_count_graphs => :get, :days_pending_graphs => :get, :pending_count_graphs => :get}, :member => { :mark_all_as_read => :post } map.resources :groups map.resources :link_sets, :member => { :update_sort => :post } @@ -32,16 +32,17 @@ map.resources :merge_ideas map.resources :periodic_jobs, :member => { :rerun => :post, :runnow => :post } map.resources :polls, :member => { :publish => :post, :unpublish => :post, :pie => :get, - :present_survey => :get, :take_survey => :post}, + :present_survey => :get, :take_survey => :post}, :collection => {:toggle_details => :get, :display_comments => :get } map.resources :portal, :only => :index, :collection => {:auto_complete_for_user_email => :get } map.resources :products map.resources :releases, :member => { :commit => :post }, - :collection => { :preview => :get, :list => :get, :check_for_updates => :get, + :collection => { :preview => :get, :list => :get, :check_for_updates => :get, :compatibility => :get } map.resources :topics, :collection => { :preview => :get, :search => :get, :tag => :get }, :member => {:rate => :post, :toggle_status => :put} + map.resources :users, :collection => { :activity => :get, :auto_complete_for_user_email => :get } map.resources :user_logons map.resources :user_requests, :member => { :approve => :post, :reject => :post, :acknowledge => :get, :next => :get, :previous => :get }, @@ -52,30 +53,30 @@ # which fills the hoptoadapp log...so we'll handle enforcement down at # the controller level instead map.resources :watches, :member => { :create_topic_watch => [:post, :get], - :destroy_topic_watch => :delete, :create_forum_watch => :post, - :create_product_watch => :post, + :destroy_topic_watch => :delete, :create_forum_watch => :post, + :create_product_watch => :post, :create_product_watch_from_check_for_update => :post, :destroy_forum_watch => :delete, :destroy_product_watch => :delete}, :collection => {:create_from_show => :post, :create_product_watches => :get } - + # Allow downloading Web Service WSDL as a file with an extension instead of a # file named 'wsdl' map.connect ':controller/service.wsdl', :action => 'wsdl' - + # Default home page #map.connect '', :controller => 'ideas', :action => # 'index' map.home '', :controller => 'ideas', :action => 'index' - + # Install the default route as the lowest priority. map.connect 'download/:id', :controller => 'attachments', :action => 'download' map.connect 'html/:id', :controller => 'attachments', :action => 'html' map.connect ':controller/:action/:id.:format' map.connect ':controller/:action/:id' map.connect ':controller/:action.:format' - + map.simple_captcha '/simple_captcha/:action', :controller => 'simple_captcha' # map.connect ':id', :controller => 'ideas', :action => 'show' - + map.connect ':path', :controller => 'static' end