Commit 1c7ee398e35fe35ded816d5343f1769cf56b2906
1 parent
640e6dbe
Exists in
master
and in
28 other branches
ActionItem371: added a button to send requests to friends
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2434 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
17 additions
and
8 deletions
Show diff stats
app/controllers/my_profile/tasks_controller.rb
... | ... | @@ -23,7 +23,9 @@ class TasksController < MyProfileController |
23 | 23 | end |
24 | 24 | |
25 | 25 | def new |
26 | + target = profile.friends.find_by_id(params[:target_id]) | |
26 | 27 | @ticket = Ticket.new(params[:ticket]) |
28 | + @ticket.target = target | |
27 | 29 | @ticket.requestor = profile |
28 | 30 | if request.post? |
29 | 31 | if @ticket.save | ... | ... |
app/views/blocks/profile_info_actions/person.rhtml
1 | 1 | <ul> |
2 | - <%if logged_in? && (user != profile) && (! user.friends.include?(profile)) && !user.already_request_friendship?(profile) %> | |
3 | - <li><%= link_to content_tag('span', __('Add friend')), { :profile => user.identifier, :controller => 'friends', :action => 'add', :id => profile.id }, :class => 'button with-text icon-add' %></li> | |
2 | + <%if logged_in? && (user != profile) %> | |
3 | + <%if user.friends.include?(profile) %> | |
4 | + <li> <%= link_to content_tag('span', _('Send request')), {:profile => user.identifier, :controller => 'tasks', :action => 'new', :target_id => profile.id}, :class => 'button with-text icon-menu-mail' %> </li> | |
5 | + <% elsif !user.already_request_friendship?(profile) %> | |
6 | + <li><%= link_to content_tag('span', __('Add friend')), { :profile => user.identifier, :controller => 'friends', :action => 'add', :id => profile.id }, :class => 'button with-text icon-add' %></li> | |
7 | + <% end %> | |
4 | 8 | <% end %> |
5 | 9 | </ul> | ... | ... |
app/views/tasks/index.rhtml
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | |
15 | 15 | <% button_bar do %> |
16 | 16 | <%= button(:edit, _('View processed tasks'), :action => 'processed') %> |
17 | - <%= button(:edit, _('View my requested tasks'), :action => 'list_requested') %> | |
18 | - <%= button(:new, _('Create task'), :action => 'new') %> | |
17 | + <%= button(:edit, _('View my requests'), :action => 'list_requested') %> | |
18 | + <%= button('menu-mail', _('Send request'), :action => 'new') %> | |
19 | 19 | <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> |
20 | 20 | <% end %> | ... | ... |
app/views/tasks/new.rhtml
1 | +<h1><%= @ticket.target ? _('New request for %s') % @ticket.target.name : _('New request') %></h1> | |
2 | + | |
3 | +<%# FIXME: put style in css %> | |
1 | 4 | <% labelled_form_for :ticket, @ticket do |f| %> |
2 | - <%= f.text_field :title %> | |
3 | - <%= display_form_field( _('Owner: '), f.select(:target_id, profile.friends.map{|p|[p.name, p.id]})) %> | |
4 | - <%= f.text_area :description %> | |
5 | + <%= display_form_field( _('To: '), f.select(:target_id, profile.friends.map{|p|[p.name, p.id]})) unless @ticket.target %> | |
6 | + <%= f.text_field :title, :style => 'width:80%;' %> | |
7 | + <%= f.text_area :description, :style => 'height:200px; width:80%;' %> | |
5 | 8 | |
6 | 9 | <% button_bar do %> |
7 | - <%= submit_button('save', _('Create'), :cancel => {:action => 'index'}) %> | |
10 | + <%= submit_button(:ok, _('Send'), :cancel => {:action => 'index'}) %> | |
8 | 11 | <% end %> |
9 | 12 | <% end %> | ... | ... |