Skip to content

Commit

Permalink
Merge pull request #2 from LANeo64/session-mixin
Browse files Browse the repository at this point in the history
[WIP]Session mixin
  • Loading branch information
LANeo64 authored Mar 24, 2017
2 parents 96e53c7 + 6b9c4a5 commit 267bb90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 0 additions & 8 deletions app/controllers/mixins/generic_session_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,18 @@ def get_session_data
@display = session["#{prefix}_display".to_sym]
@filters = session["#{prefix}_filters".to_sym]
@catinfo = session["#{prefix}_catinfo".to_sym]
@cats = session["#{prefix}_cats".to_sym]
@showtype = session["#{prefix}_showtype".to_sym]
@base = session["#{prefix}_compare_base".to_sym]
@polArr = session[:polArr] || "" # current tags in effect
@policy_options = session[:policy_options] || ""
end

def set_session_data
prefix = self.class.session_key_prefix
session["#{prefix}_lastaction".to_sym] = @lastaction
session["#{prefix}_display".to_sym] = @display unless @display.nil?
session["#{prefix}_compare_base".to_sym] = @base
session["#{prefix}_filters".to_sym] = @filters
session["#{prefix}_catinfo".to_sym] = @catinfo
session["#{prefix}_cats".to_sym] = @cats
session["#{prefix}_showtype".to_sym] = @showtype
session[:miq_compressed] = @compressed unless @compressed.nil?
session[:miq_exists_mode] = @exists_mode unless @exists_mode.nil?
session[:polArr] = @polArr unless @polArr.nil?
session[:policy_options] = @policy_options unless @policy_options.nil?
end
end
end
12 changes: 12 additions & 0 deletions app/controllers/vm_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ def show_list
process_show_list(options)
end

private ####

def get_session_data
@polArr = session[:polArr] || "" # current tags in effect
@policy_options = session[:policy_options] || ""
end

def set_session_data
session[:polArr] = @polArr unless @polArr.nil?
session[:policy_options] = @policy_options unless @policy_options.nil?
end

def title
_("Virtual Machines")
end
Expand Down

0 comments on commit 267bb90

Please sign in to comment.