diff --git a/app/controllers/my_profile/friends_controller.rb b/app/controllers/my_profile/friends_controller.rb index 36ca05a..cc57a3f 100644 --- a/app/controllers/my_profile/friends_controller.rb +++ b/app/controllers/my_profile/friends_controller.rb @@ -7,8 +7,9 @@ class FriendsController < MyProfileController def add @friend = Person.find(params[:id]) if request.post? && params[:confirmation] - AddFriend.create!(:person => profile, :friend => @friend) + AddFriend.create!(:person => profile, :friend => @friend, :group_for_person => params[:group]) + flash[:notice] = _('%s still needs to accept being your friend.') % @friend.name # FIXME shouldn't redirect to the friend's page? redirect_to :action => 'index' end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e343ff4..9574a6c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -383,4 +383,13 @@ module ApplicationHelper :help => _('Click on this icon to go to the %s\'s home page') % profile.name ) end + def text_field_with_local_autocomplete(name, choices, html_options = {}) + id = html_options[:id] || name + + text_field_tag(name, '', html_options) + + content_tag('div', '', :id => "autocomplete-for-#{id}", :class => 'auto-complete', :style => 'display: none;') + + javascript_tag('new Autocompleter.Local(%s, %s, %s)' % [ id.to_json, "autocomplete-for-#{id}".to_json, choices.to_json ] ) + + end + end diff --git a/app/views/friends/add.rhtml b/app/views/friends/add.rhtml index caa7b6b..5957bd2 100644 --- a/app/views/friends/add.rhtml +++ b/app/views/friends/add.rhtml @@ -12,6 +12,15 @@ <% form_tag do %> <%= hidden_field_tag(:confirmation, 1) %> + +
+ <%= _('Classify your new friend %s: ') % @friend.name %> + <%= text_field_with_local_autocomplete('group', profile.suggested_friend_groups) %> +

+ <%= _('Suggestions: %s') % profile.suggested_friend_groups.join(', ') %> +

+
+ <%= submit_button(:ok, _("Yes, I want to add %s as my friend") % @friend.name) %> <%= button(:cancel, _("No, I don't want"), :action => 'index') %> <% end %> diff --git a/app/views/profile_editor/index.rhtml b/app/views/profile_editor/index.rhtml index c37c7e9..dcbb72e 100644 --- a/app/views/profile_editor/index.rhtml +++ b/app/views/profile_editor/index.rhtml @@ -9,6 +9,8 @@ <%= file_manager_button(_('Edit Profile'), 'icons-app/edit-profile.png', :controller => 'profile_editor', :action => 'edit') %> + <%= file_manager_button(_('Pending tasks'), 'icons-app/todo.png', :controller => 'tasks', :action => 'index') %> + <%= file_manager_button(_('Edit Visual Design'), 'icons-app/design-editor.png', :controller => 'profile_design', :action => 'index') %> <%= file_manager_button(_('Manage Content'), 'icons-app/cms.png', :controller => 'cms') %> diff --git a/app/views/tasks/_add_friend.rhtml b/app/views/tasks/_add_friend.rhtml index 4a10784..77aedc7 100644 --- a/app/views/tasks/_add_friend.rhtml +++ b/app/views/tasks/_add_friend.rhtml @@ -7,16 +7,22 @@ <% form_for('task', task, :url => { :action => 'close', :id => task.id } ) do |f| %>
- <%= radio_button_tag(:decision, 'finish', true, :id => "decision-finish-#{task.id}", :onclick => "Element.show('group-for-person-#{task.id}')") %> + <%= radio_button_tag(:decision, 'finish', true, :id => "decision-finish-#{task.id}", :onclick => "Element.show('group-for-friend-#{task.id}')") %> <%= _('Accept') %> - <% content_tag('div', :id => "group-for-person-#{task.id}") do %> - <%= labelled_form_field(_('Add %s to the following group:') % task.requestor.name, f.text_field(:group_for_person)) %> + <% + content_tag('div', :id => "group-for-friend-#{task.id}", :help => _('You can select one of the existing groups or type the name of a new group.')) do %> + <%= _('Classify your new friend %s: ') % task.requestor.name %> + <%= text_field_with_local_autocomplete("task[group_for_friend]", profile.suggested_friend_groups, :id => "field-group-for-friend-#{task.id}") %> +

+ <%= _('Suggestions: %s') % profile.suggested_friend_groups.join(', ') %> +

+ <% end %>
- <%= radio_button_tag(:decision, 'cancel', false, :id => "decision-cancel-#{task.id}", :onclick => "Element.hide('group-for-person-#{task.id}')") %> + <%= radio_button_tag(:decision, 'cancel', false, :id => "decision-cancel-#{task.id}", :onclick => "Element.hide('group-for-friend-#{task.id}')") %> <%= _('Ignore') %>
diff --git a/public/images/icons-app/README b/public/images/icons-app/README index 16cdea2..4127bdf 100644 --- a/public/images/icons-app/README +++ b/public/images/icons-app/README @@ -26,6 +26,7 @@ user_icon.png dlg-neu gnome-home.png Nuovo gtk-yes.png dlg-neu users.png (locally modified) dlg-neu +stock_todo.png Nuovo Icons rasterization =================== diff --git a/public/images/icons-app/stock_todo.png b/public/images/icons-app/stock_todo.png new file mode 100644 index 0000000..15bb806 Binary files /dev/null and b/public/images/icons-app/stock_todo.png differ diff --git a/public/images/icons-app/todo.png b/public/images/icons-app/todo.png new file mode 120000 index 0000000..f71c1ff --- /dev/null +++ b/public/images/icons-app/todo.png @@ -0,0 +1 @@ +stock_todo.png \ No newline at end of file diff --git a/public/stylesheets/common.css b/public/stylesheets/common.css index e44824d..060eb84 100644 --- a/public/stylesheets/common.css +++ b/public/stylesheets/common.css @@ -425,3 +425,22 @@ th { color: black; font-weight: bold; } + +div.auto-complete { + background: #729FCF; + border: 2px solid #204A87; +} +div.auto-complete ul { + margin: 0px; + padding: 0px; +} +div.auto-complete li { + list-style: none; + margin: 0px; + padding: 0px; + color: #204A87; +} +div.auto-complete li.selected { + background: #B8CFE7; + color: #204A87; +} -- libgit2 0.21.2