Skip to content
This repository has been archived by the owner on Apr 28, 2019. It is now read-only.

added searchable to content_fields #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions lib/locomotive/mounter/models/content_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ class ContentField < Base
## fields ##
field :label
field :name
field :type, default: :string
field :type, default: :string
field :hint
field :position, default: 0
field :required, default: false
field :unique, default: false
field :localized, default: false
field :position, default: 0
field :required, default: false
field :unique, default: false
field :localized, default: false
field :searchable, default: false

# text
field :text_formatting
Expand Down Expand Up @@ -110,7 +111,7 @@ def find_select_option(name_or_id)
# @return [ Hash ] The params
#
def to_params
params = self.filter_attributes %w(label name type hint position required localized unique)
params = self.filter_attributes %w(label name type hint position required localized unique searchable)

# we set the _id / _destroy attributes for embedded documents
params[:_id] = self._id if self.persisted?
Expand Down Expand Up @@ -186,4 +187,4 @@ def select_options_to_hash

end
end
end
end
6 changes: 5 additions & 1 deletion spec/unit/models/content_field_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
build_content_field(type: 'date').type.should == :date
end

it 'has searchable which should default to false' do
build_content_field.searchable.should == false
end

end

describe '.is_relationship?' do
Expand Down Expand Up @@ -93,4 +97,4 @@ def build_options(names)
end
end

end
end