Skip to content

Commit

Permalink
Load dynamic sites when there is no criteria (#83)
Browse files Browse the repository at this point in the history
When a dynamic site has not filtering criteria, the AJAX call not
returns an empty criteria array, whereas before it contained a minimal
frame. Handle this by defaulting the operator to 'AND', which allows the
site to load and to be saved as is.
  • Loading branch information
mdaines-r7 committed Oct 13, 2014
1 parent a506d85 commit 71b251a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/nexpose/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ def <<(criterion)
end

def self.parse(json)
ret = Criteria.new([], json['operator'])
# The call returns empty JSON, so default to 'AND' if not present.
operator = json['operator'] || 'AND'
ret = Criteria.new([], operator)
json['criteria'].each do |c|
ret.criteria << Criterion.parse(c)
end
Expand Down

0 comments on commit 71b251a

Please sign in to comment.