Added Ajax form to update the member rate. #1150

This commit is contained in:
Eric Davis
2008-05-28 12:12:22 -07:00
parent 80e2d7cdcf
commit fb3f7c9977
2 changed files with 29 additions and 5 deletions
+1
View File
@@ -9,3 +9,4 @@ field_project_manager_signoff: Project Manager Signoff
field_client_signoff: Client Signoff
field_deliverable: Deliverable
field_deliverable_subject: Deliverable
label_member_rate: Rate ($)
+28 -5
View File
@@ -1,5 +1,5 @@
class BudgetProjectHook
# http://snippets.dzone.com/posts/show/1799
def self.help
Helper.instance
@@ -8,19 +8,42 @@ class BudgetProjectHook
class Helper
include Singleton
include ActionView::Helpers::TagHelper
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::FormHelper
include ActionView::Helpers::FormTagHelper
include ActionView::Helpers::FormOptionsHelper
include ActionView::Helpers::JavaScriptHelper
include ActionView::Helpers::PrototypeHelper
include ActionController::UrlWriter
def protect_against_forgery?
false
end
end
# TODO: Complete
def self.member_list_header(context ={ })
return "<th>#{GLoc.l(:label_member_rate) }</th>"
end
# TODO: Complete
def self.member_list_column_three(context = { })
return '<td align="center">Nothing yet</td>'
# Build a form_remote_tag by hand since this isn't in the scope of a controller
form = help.form_tag({:controller => 'members', :action => 'edit', :id => context[:member].id, :host => Setting.host_name},
:onsubmit => help.remote_function(:url => {
:controller => 'members',
:action => 'edit',
:id => context[:member].id,
:host => Setting.host_name
},
:host => Setting.host_name,
:form => true,
:method => 'post',
:return => 'false' )+ '; return false;') +
help.text_field_tag('member[rate]', context[:member].rate, :class => "small") +
help.submit_tag(GLoc.l(:button_change), :class => "small") + "</form>"
return help.content_tag(:td, form, :align => 'center' )
end
end