diff --git a/plugins/person_tags/features/person_tags.feature b/plugins/person_tags/features/person_tags.feature new file mode 100644 index 0000000..9f7a76a --- /dev/null +++ b/plugins/person_tags/features/person_tags.feature @@ -0,0 +1,18 @@ +Feature: person tags + +Background: + Given the following users + | login | + | joao | + And I am logged in as "joao" + And "PersonTags" plugin is enabled + +Scenario: add tags to person + Given I am on joao's control panel + And I follow "Edit Profile" + When I fill in "profile_data_interest_list" with "linux,debian" + And I press "Save" + And I go to joao's control panel + And I follow "Edit Profile" + Then the "profile_data_interest_list" field should contain "linux" + And the "profile_data_interest_list" field should contain "debian" diff --git a/plugins/person_tags/lib/ext/person.rb b/plugins/person_tags/lib/ext/person.rb new file mode 100644 index 0000000..0ed8eae --- /dev/null +++ b/plugins/person_tags/lib/ext/person.rb @@ -0,0 +1,8 @@ +require_dependency 'person' + +class Person + attr_accessible :interest_list + + acts_as_taggable_on :interests + N_('Fields of interest') +end diff --git a/plugins/person_tags/lib/person_tags_plugin.rb b/plugins/person_tags/lib/person_tags_plugin.rb new file mode 100644 index 0000000..e39cc39 --- /dev/null +++ b/plugins/person_tags/lib/person_tags_plugin.rb @@ -0,0 +1,18 @@ +class PersonTagsPlugin < Noosfero::Plugin + + include ActionView::Helpers::TagHelper + include ActionView::Helpers::FormTagHelper + include FormsHelper + + def self.plugin_name + "PersonTagsPlugin" + end + + def self.plugin_description + _("People can define tags that describe their interests.") + end + + def profile_editor_extras + expanded_template('profile-editor-extras.html.erb').html_safe + end +end diff --git a/plugins/person_tags/test/test_helper.rb b/plugins/person_tags/test/test_helper.rb new file mode 100644 index 0000000..70322cf --- /dev/null +++ b/plugins/person_tags/test/test_helper.rb @@ -0,0 +1 @@ +require_relative '../../../test/test_helper' diff --git a/plugins/person_tags/test/unit/person_tags_test.rb b/plugins/person_tags/test/unit/person_tags_test.rb new file mode 100644 index 0000000..ccc9914 --- /dev/null +++ b/plugins/person_tags/test/unit/person_tags_test.rb @@ -0,0 +1,16 @@ +require 'test_helper' + +class PersonTagsPluginTest < ActiveSupport::TestCase + + def setup + @environment = Environment.default + @environment.enable_plugin(PersonTagsPlugin) + end + + should 'have interests' do + person = create_user('person').person + assert_equal [], person.interests + person.interest_list.add('linux') + assert_equal ['linux'], person.interest_list + end +end diff --git a/plugins/person_tags/views/profile-editor-extras.html.erb b/plugins/person_tags/views/profile-editor-extras.html.erb new file mode 100644 index 0000000..12eccdd --- /dev/null +++ b/plugins/person_tags/views/profile-editor-extras.html.erb @@ -0,0 +1,8 @@ +