complete preview for both new and announcement
This commit is contained in:
1 parent
8bd5481b3f
commit
6044857fea
24 files changed
+301
-67
No files matched your search
@@ -1,14 +1,14 @@
|
||||
module OrbitCoreLib
|
||||
module Preview
|
||||
def self.included(base)
|
||||
base.instance_eval("field :is_preview,type: Boolean,:default => false")
|
||||
base.instance_eval("scope :not_preview,where(:is_preview=>false)")
|
||||
base.define_singleton_method :new_preview do |*args|
|
||||
temp_obj = self.new(args.first)
|
||||
temp_obj.is_preview = true
|
||||
temp_obj.save(:validate => false) rescue
|
||||
temp_obj
|
||||
end
|
||||
|
||||
# base.instance_eval("field :is_preview,type: Boolean,:default => false")
|
||||
# base.instance_eval("scope :not_preview,where(:is_preview=>false)")
|
||||
base.class_eval ("
|
||||
def to_preview
|
||||
raise 'Developer,please override to_preview method'
|
||||
end
|
||||
")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user