Commit a766ba55880a7f9765c770936b4c1cc2a746b4f4
1 parent
54bc457e
Exists in
profile_api_improvements
and in
1 other branch
Ticket #85: Adding plugin that allows people to have tags (aka interests) - API pending
Showing
6 changed files
with
69 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +Feature: person tags | ||
2 | + | ||
3 | +Background: | ||
4 | + Given the following users | ||
5 | + | login | | ||
6 | + | joao | | ||
7 | + And I am logged in as "joao" | ||
8 | + And "PersonTags" plugin is enabled | ||
9 | + | ||
10 | +Scenario: add tags to person | ||
11 | + Given I am on joao's control panel | ||
12 | + And I follow "Edit Profile" | ||
13 | + When I fill in "profile_data_interest_list" with "linux,debian" | ||
14 | + And I press "Save" | ||
15 | + And I go to joao's control panel | ||
16 | + And I follow "Edit Profile" | ||
17 | + Then the "profile_data_interest_list" field should contain "linux" | ||
18 | + And the "profile_data_interest_list" field should contain "debian" |
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +class PersonTagsPlugin < Noosfero::Plugin | ||
2 | + | ||
3 | + include ActionView::Helpers::TagHelper | ||
4 | + include ActionView::Helpers::FormTagHelper | ||
5 | + include FormsHelper | ||
6 | + | ||
7 | + def self.plugin_name | ||
8 | + "PersonTagsPlugin" | ||
9 | + end | ||
10 | + | ||
11 | + def self.plugin_description | ||
12 | + _("People can define tags that describe their interests.") | ||
13 | + end | ||
14 | + | ||
15 | + def profile_editor_extras | ||
16 | + expanded_template('profile-editor-extras.html.erb').html_safe | ||
17 | + end | ||
18 | +end |
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +require_relative '../../../test/test_helper' |
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +require 'test_helper' | ||
2 | + | ||
3 | +class PersonTagsPluginTest < ActiveSupport::TestCase | ||
4 | + | ||
5 | + def setup | ||
6 | + @environment = Environment.default | ||
7 | + @environment.enable_plugin(PersonTagsPlugin) | ||
8 | + end | ||
9 | + | ||
10 | + should 'have interests' do | ||
11 | + person = create_user('person').person | ||
12 | + assert_equal [], person.interests | ||
13 | + person.interest_list.add('linux') | ||
14 | + assert_equal ['linux'], person.interest_list | ||
15 | + end | ||
16 | +end |
plugins/person_tags/views/profile-editor-extras.html.erb
0 → 100644
@@ -0,0 +1,8 @@ | @@ -0,0 +1,8 @@ | ||
1 | +<h2><%= _('Select your fields of interest') %></h2> | ||
2 | +<%= text_field_tag('profile_data[interest_list]', context.profile.interest_list.join(','), size: 64) %> | ||
3 | +<br /> | ||
4 | +<%= content_tag( 'small', _('Separate tags with commas') ) %> | ||
5 | + | ||
6 | +<script> | ||
7 | + jQuery('#profile_data_interest_list').inputosaurus(); | ||
8 | +</script> |