diff options
Diffstat (limited to 'app/models/node.rb')
| -rw-r--r-- | app/models/node.rb | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/app/models/node.rb b/app/models/node.rb index 2820f30..b04aeba 100644 --- a/app/models/node.rb +++ b/app/models/node.rb | |||
| @@ -60,22 +60,27 @@ class Node < ActiveRecord::Base | |||
| 60 | elsif draft && draft.user != user | 60 | elsif draft && draft.user != user |
| 61 | raise "Page is locked" | 61 | raise "Page is locked" |
| 62 | else | 62 | else |
| 63 | # TODO clone tags later on | 63 | create_new_draft user |
| 64 | p = self.pages.create! | 64 | end |
| 65 | 65 | end | |
| 66 | I18n.available_locales.each do |l| | 66 | |
| 67 | next if l == :root | 67 | def create_new_draft user |
| 68 | I18n.locale = l | 68 | p = self.pages.create! |
| 69 | 69 | ||
| 70 | p.title = self.head.title | 70 | p.tag_list = self.head.tag_list.join(", ") |
| 71 | p.abstract = self.head.abstract | 71 | |
| 72 | p.body = self.head.body | 72 | I18n.available_locales.each do |l| |
| 73 | end | 73 | next if l == :root |
| 74 | I18n.locale = l | ||
| 74 | 75 | ||
| 75 | p.user = user | 76 | p.title = self.head.title |
| 76 | p.save | 77 | p.abstract = self.head.abstract |
| 77 | p | 78 | p.body = self.head.body |
| 78 | end | 79 | end |
| 80 | |||
| 81 | p.user = user | ||
| 82 | p.save | ||
| 83 | p | ||
| 79 | end | 84 | end |
| 80 | 85 | ||
| 81 | def publish_draft! | 86 | def publish_draft! |
