OSDN Git Service
(root)
/
pettanr
/
pettanr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fic picture publishing
[pettanr/pettanr.git]
/
app
/
models
/
writing_format.rb
diff --git
a/app/models/writing_format.rb
b/app/models/writing_format.rb
index
9ea43fc
..
5e54402
100644
(file)
--- a/
app/models/writing_format.rb
+++ b/
app/models/writing_format.rb
@@
-1,4
+1,5
@@
-class WritingFormat < ActiveRecord::Base
+class WritingFormat < Peta::SystemResource
+ load_manifest
has_many :speeches
belongs_to :system_picture
has_many :speeches
belongs_to :system_picture
@@
-9,15
+10,6
@@
class WritingFormat < ActiveRecord::Base
validates :system_picture_id, :presence => true, :numericality => true, :existence => {:both => false}
validates :settings, :presence => true
validates :system_picture_id, :presence => true, :numericality => true, :existence => {:both => false}
validates :settings, :presence => true
- before_validation :valid_encode
-
- def valid_encode
- ['name', 'classname', 'caption', 'settings'].each do |a|
- next if attributes[a] == nil
- raise Pettanr::BadRequest unless attributes[a].valid_encoding?
- end
- end
-
def supply_default
end
def supply_default
end
@@
-25,19
+17,21
@@
class WritingFormat < ActiveRecord::Base
self.t = WritingFormat.count.to_i if self.new_record?
end
self.t = WritingFormat.count.to_i if self.new_record?
end
- def
visible? author
- true
+ def
self.list_where
+ nil
end
end
- def self.list
- opt = {}
- opt.merge!(self.list_opt)
- opt.merge!({:order => 'writing_formats.t asc'})
- WritingFormat.find(:all, opt)
+ def self.list_order
+ 'writing_formats.t asc'
end
end
+#engine vw
+def self.list
+ self.enable_list
+end
+
def self.enable_list
def self.enable_list
- WritingFormat.
list
.delete_if {|wf|
+ WritingFormat.
find(:all)
.delete_if {|wf|
wf.enable? == false
}
end
wf.enable? == false
}
end
@@
-50,14
+44,6
@@
class WritingFormat < ActiveRecord::Base
{}
end
{}
end
- def self.show rid, au
- opt = {}
- opt.merge!(self.show_opt)
- res = WritingFormat.find(rid, opt)
- raise ActiveRecord::Forbidden unless res.visible?(au)
- res
- end
-
def self.show_opt
{}
end
def self.show_opt
{}
end
@@
-79,12
+65,16
@@
class WritingFormat < ActiveRecord::Base
@parsed_settings ||= JSON.parse(self.settings)
end
@parsed_settings ||= JSON.parse(self.settings)
end
+ def my_engine_resource
+ Manifest.manifest.system_resources.engine_resources['writing_formats']
+ end
+
def engine_name
def engine_name
-
Pettanr::Application.manifest.system_resources.writing_format
s[self.classname]
+
self.my_engine_resource.resource_item
s[self.classname]
end
def enable?
end
def enable?
-
Pettanr::Application.manifest.system_resources.writing_format
s.include? self.classname
+
self.my_engine_resource.resource_item
s.include? self.classname
end
def engine_module_name
end
def engine_module_name