app/controllers/data_objects_controller.rb
def index
    @data_objects = current_department.data_objects
    @group_type_options = options_for_group_type
    @group_by_options = []
    @selected_type = ["Department", "departments"]
    if params[:group_type]
      @group_by_options = options_for_group_by(params[:group_type])
      if params[:group_by] && !params[:group_by].blank?
        @data_objects &= params[:group_type].classify.constantize.find(params[:group_by]).data_objects
        @selected_by = @group_by_options.select{|opt| opt.include? params[:group_by].to_i}.flatten
      else
        @selected_by = @group_by_options.first
      end
      @selected_type = @group_type_options.select{|a|a.include? params[:group_type]}.flatten
    end
    @types_objects_hash = @data_objects.group_by &:data_type
    #this is for users who are not admins
    @personal_types_objects_hash = DataObject.find(current_user.user_config.watched_data_objects.split(', ')).group_by(&:data_type)
    respond_to do |format|
      format.html #{ update_page{|page| page.hide 'submit'}}
      format.js
    end
  end
# Needs views revised for non-ajax degradeability -ben
# Note: there are good reasons not to do this by merely hiding the group_by divs
Needs views revised for non-ajax degradeability -ben
Note: there are good reasons not to do this by merely hiding the group_by divs
Needs views revised for non - ajax degradeability - ben Note : there are good reasons not to do this by merely hiding the group_by divs
def index
    @data_objects = current_department.data_objects
    @group_type_options = options_for_group_type
    @group_by_options = []
    @selected_type = ["Department", "departments"]
    if params[:group_type]
      @group_by_options = options_for_group_by(params[:group_type])
      if params[:group_by] && !params[:group_by].blank?
        @data_objects &= params[:group_type].classify.constantize.find(params[:group_by]).data_objects
        @selected_by = @group_by_options.select{|opt| opt.include? params[:group_by].to_i}.flatten
      else
        @selected_by = @group_by_options.first
      end
      @selected_type = @group_type_options.select{|a|a.include? params[:group_type]}.flatten
    end
    @types_objects_hash = @data_objects.group_by &:data_type
    @personal_types_objects_hash = DataObject.find(current_user.user_config.watched_data_objects.split(', ')).group_by(&:data_type)
    respond_to do |format|
      format.html 
      format.js
    end
  end
def index @data_objects = current_department . data_objects @group_type_options = options_for_group_type @group_by_options = [ ] @selected_type = [ "Department" , "departments" ] if params [ :group_type ] @group_by_options = options_for_group_by ( params [ :group_type ] ) if params [ :group_by ] && ! params [ :group_by ] . blank? @data_objects &= params [ :group_type ] . classify . constantize . find ( params [ :group_by ] ) . data_objects @selected_by = @group_by_options . select { | opt | opt . include? params [ :group_by ] . to_i } . flatten else @selected_by = @group_by_options . first end @selected_type = @group_type_options . select { | a | a . include? params [ :group_type ] } . flatten end @types_objects_hash = @data_objects . group_by & :data_type @personal_types_objects_hash = DataObject . find ( current_user . user_config . watched_data_objects . split ( ', ' ) ) . group_by ( & :data_type ) respond_to do | format | format . html format . js end end
Needs views revised for non-ajax degradeability -ben
Note: there are good reasons not to do this by merely hiding the group_by divs
Needs views revised for non - ajax degradeability - ben Note : there are good reasons not to do this by merely hiding the group_by divs
#this is for users who are not admins #{ update_page{|page| page.hide 'submit'}}