Commit fbdc8a69d843f77a8d8412c2dd3d9f065c9fcd65
1 parent
72e75dbd
Exists in
master
and in
22 other branches
ActionItem8: documenting info interface to profiles
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@416 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
19 additions
and
2 deletions
Show diff stats
app/models/profile.rb
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | class Profile < ActiveRecord::Base | 4 | class Profile < ActiveRecord::Base |
| 5 | 5 | ||
| 6 | after_create do |profile| | 6 | after_create do |profile| |
| 7 | - homepage = Comatose::Page.new | 7 | + homepage = Article.new |
| 8 | homepage.title = profile.name | 8 | homepage.title = profile.name |
| 9 | homepage.parent = Comatose::Page.root | 9 | homepage.parent = Comatose::Page.root |
| 10 | homepage.slug = profile.identifier | 10 | homepage.slug = profile.identifier |
| @@ -12,7 +12,7 @@ class Profile < ActiveRecord::Base | @@ -12,7 +12,7 @@ class Profile < ActiveRecord::Base | ||
| 12 | end | 12 | end |
| 13 | 13 | ||
| 14 | after_destroy do |profile| | 14 | after_destroy do |profile| |
| 15 | - Comatose::Page.find_by_path(profile.identifier).destroy | 15 | + Article.find_by_path(profile.identifier).destroy |
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | # Valid identifiers must match this format. | 18 | # Valid identifiers must match this format. |
| @@ -65,4 +65,21 @@ class Profile < ActiveRecord::Base | @@ -65,4 +65,21 @@ class Profile < ActiveRecord::Base | ||
| 65 | find_tagged_with(term) + find_all_by_name(term) | 65 | find_tagged_with(term) + find_all_by_name(term) |
| 66 | end | 66 | end |
| 67 | 67 | ||
| 68 | + # Returns information about the profile's owner that was made public by | ||
| 69 | + # him/her. The returned value must be an array in the followinf format: | ||
| 70 | + # | ||
| 71 | + # [ | ||
| 72 | + # [ 'First Field', first_field_value ], | ||
| 73 | + # [ 'Second Field', second_field_value ], | ||
| 74 | + # ] | ||
| 75 | + # | ||
| 76 | + # This information shall be used by user interface to present the information | ||
| 77 | + # | ||
| 78 | + # In this class, this method returns nil, what is interpreted as "no | ||
| 79 | + # information at all". Subclasses must override this method to provide their | ||
| 80 | + # specific information. | ||
| 81 | + def info | ||
| 82 | + nil | ||
| 83 | + end | ||
| 84 | + | ||
| 68 | end | 85 | end |