app/controllers/configuration_controller.rb
# AJAX driven routine to check for changes in ANY field on the user form
AJAX driven routine to check for changes in ANY field on the user form
AJAX driven routine to check for changes in ANY field on the user form
def filters_field_changed
    return unless load_edit("config_edit__ui3", "configuration")
    if params[:all_checked]                         
      @edit[:show_ids] = params[:all_checked].split(',')
      if !@edit[:show_ids].blank?
        @edit[:new].each_with_index do |arr, i|
          if @edit[:show_ids].include?(arr.id.to_s)
            @edit[:new][i].search_key = nil
          else
            @edit[:new][i].search_key = "_hidden_"
          end
        end
      else      
        @edit[:new].each_with_index do |_search, i|
          @edit[:new][i].search_key = nil
        end
      end
    end
    @edit[:current].each_with_index do |arr, i|          
      if @edit[:new][i].search_key != arr.search_key
        @changed = true
        break
      end
    end
    render :update do |page|
      @edit[:current].each_with_index do |_arr, i|
        id = @edit[:new][i].id
        if @edit[:new][i].search_key != @edit[:current][i].search_key
          style_class = 'cfme-blue-bold-node'
        else
          style_class = 'dynatree-title'
        end
        page << "miqDynatreeNodeAddClass('#{session[:tree_name]}', '#{id}', '#{style_class}')"
      end
      page << javascript_for_miq_button_visibility(@changed) if @changed
    end
  end
def filters_field_changed return unless load_edit ( "config_edit__ui3" , "configuration" ) if params [ :all_checked ] @edit [ :show_ids ] = params [ :all_checked ] . split ( ',' ) if ! @edit [ :show_ids ] . blank? @edit [ :new ] . each_with_index do | arr , i | if @edit [ :show_ids ] . include? ( arr . id . to_s ) @edit [ :new ] [ i ] . search_key = nil else @edit [ :new ] [ i ] . search_key = "_hidden_" end end else @edit [ :new ] . each_with_index do | _search , i | @edit [ :new ] [ i ] . search_key = nil end end end @edit [ :current ] . each_with_index do | arr , i | if @edit [ :new ] [ i ] . search_key != arr . search_key @changed = true break end end render :update do | page | @edit [ :current ] . each_with_index do | _arr , i | id = @edit [ :new ] [ i ] . id if @edit [ :new ] [ i ] . search_key != @edit [ :current ] [ i ] . search_key style_class = 'cfme-blue-bold-node' else style_class = 'dynatree-title' end page << "miqDynatreeNodeAddClass('#{session[:tree_name]}', '#{id}', '#{style_class}')" end page << javascript_for_miq_button_visibility ( @changed ) if @changed end end
AJAX driven routine to check for changes in ANY field on the user form
AJAX driven routine to check for changes in ANY field on the user form
# ui3 form # User checked/unchecked a tree node # if everything was unchecked # needed to compare each array element's attributes to find out if something has changed # needed to compare each array element's attributes to find out if something has changed