diff --git a/app/controllers/my_profile/tasks_controller.rb b/app/controllers/my_profile/tasks_controller.rb index c80593f..2d23b11 100644 --- a/app/controllers/my_profile/tasks_controller.rb +++ b/app/controllers/my_profile/tasks_controller.rb @@ -23,7 +23,9 @@ class TasksController < MyProfileController end def new + target = profile.friends.find_by_id(params[:target_id]) @ticket = Ticket.new(params[:ticket]) + @ticket.target = target @ticket.requestor = profile if request.post? if @ticket.save diff --git a/app/views/blocks/profile_info_actions/person.rhtml b/app/views/blocks/profile_info_actions/person.rhtml index 5310917..0fa80e1 100644 --- a/app/views/blocks/profile_info_actions/person.rhtml +++ b/app/views/blocks/profile_info_actions/person.rhtml @@ -1,5 +1,9 @@ diff --git a/app/views/tasks/index.rhtml b/app/views/tasks/index.rhtml index 4350c33..f78426a 100644 --- a/app/views/tasks/index.rhtml +++ b/app/views/tasks/index.rhtml @@ -14,7 +14,7 @@ <% button_bar do %> <%= button(:edit, _('View processed tasks'), :action => 'processed') %> - <%= button(:edit, _('View my requested tasks'), :action => 'list_requested') %> - <%= button(:new, _('Create task'), :action => 'new') %> + <%= button(:edit, _('View my requests'), :action => 'list_requested') %> + <%= button('menu-mail', _('Send request'), :action => 'new') %> <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> <% end %> diff --git a/app/views/tasks/new.rhtml b/app/views/tasks/new.rhtml index d95b68b..369d208 100644 --- a/app/views/tasks/new.rhtml +++ b/app/views/tasks/new.rhtml @@ -1,9 +1,12 @@ +

<%= @ticket.target ? _('New request for %s') % @ticket.target.name : _('New request') %>

+ +<%# FIXME: put style in css %> <% labelled_form_for :ticket, @ticket do |f| %> - <%= f.text_field :title %> - <%= display_form_field( _('Owner: '), f.select(:target_id, profile.friends.map{|p|[p.name, p.id]})) %> - <%= f.text_area :description %> + <%= display_form_field( _('To: '), f.select(:target_id, profile.friends.map{|p|[p.name, p.id]})) unless @ticket.target %> + <%= f.text_field :title, :style => 'width:80%;' %> + <%= f.text_area :description, :style => 'height:200px; width:80%;' %> <% button_bar do %> - <%= submit_button('save', _('Create'), :cancel => {:action => 'index'}) %> + <%= submit_button(:ok, _('Send'), :cancel => {:action => 'index'}) %> <% end %> <% end %> -- libgit2 0.21.2