Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rework watcher referral admin

  • Loading branch information...
commit e4275b753e3563d26f8947e25be79e1829af3bb4 1 parent e678bf0
@finist finist authored
View
17 app/controllers/admin/watcher_referrals_controller.rb
@@ -12,21 +12,26 @@ def index
end
def approve
- @referral.approve! params[:watcher_referral][:comment]
+ @referral.approve! #params[:watcher_referral][:comment]
- redirect_to admin_watcher_referrals_path
+ render :js => "$('#watcher_referral_#{@referral.id}_status').html('approve');$('#watcher_referral_#{@referral.id}_actions').remove()"
+ #redirect_to admin_watcher_referrals_path
end
def reject
- @referral.reject! params[:watcher_referral][:comment]
+ @referral.reject! #params[:watcher_referral][:comment]
- redirect_to admin_watcher_referrals_path
+ render :js => "$('#watcher_referral_#{@referral.id}_status').html('reject');$('#watcher_referral_#{@referral.id}_actions').remove()"
+
+ #redirect_to admin_watcher_referrals_path
end
def problem
- @referral.problem! params[:watcher_referral][:comment]
+ @referral.problem! #params[:watcher_referral][:comment]
+
+ render :js => "$('#watcher_referral_#{@referral.id}_status').html('problem');$('#watcher_referral_#{@referral.id}_actions').remove()"
- redirect_to admin_watcher_referrals_path
+ #redirect_to admin_watcher_referrals_path
end
protected
View
41 app/views/admin/watcher_referrals/index.html.haml
@@ -10,7 +10,8 @@
%p Комментарий:
%p= watcher_referral.comment
%p Статус:
- %p= watcher_referral.status
+ %div{:id => "watcher_referral_#{watcher_referral.id}_status"}
+ = watcher_referral.status
%p
- watcher_referral.referral_photos.each do |photo|
- if photo.image.url
@@ -18,24 +19,24 @@
= link_to photo.image.url, :target => "__blank" do
= image_tag photo.image.url, :width => 300
- if watcher_referral.status == 'pending'
- %p
- = link_to 'Подтвердить', '#', :class => 'watcher_referral_action', :remote => true, :data => {:action => 'approve'}
- = link_to 'Отклонить', '#', :class => 'watcher_referral_action', :remote => true, :data => {:action => 'reject'}
- = link_to 'Есть проблема', '#', :class => 'watcher_referral_action', :remote => true, :data => {:action => 'problem'}
- .approve{:style => 'display:none'}
- = form_for watcher_referral, :url => approve_admin_watcher_referral_path(watcher_referral), :method => :post do |f|
- %p= f.label 'Комментарий'
- %p= f.text_field :comment
- %p= f.submit 'Подтвердить'
- .reject{:style => 'display:none'}
- = form_for watcher_referral, :url => reject_admin_watcher_referral_path(watcher_referral), :method => :post do |f|
- %p= f.label 'Комментарий'
- %p= f.text_field :comment
- %p= f.submit 'Отклонить'
- .problem{:style => 'display:none'}
- = form_for watcher_referral, :url => problem_admin_watcher_referral_path(watcher_referral), :method => :post do |f|
- %p= f.label 'Комментарий'
- %p= f.text_field :comment
- %p= f.submit 'Есть проблема'
+ %div{:id => "watcher_referral_#{watcher_referral.id}_actions"}
+ = link_to 'Подтвердить', approve_admin_watcher_referral_path(watcher_referral), :remote => true, :method => :post
+ = link_to 'Отклонить', reject_admin_watcher_referral_path(watcher_referral), :remote => true, :method => :post
+ = link_to 'Есть проблема', problem_admin_watcher_referral_path(watcher_referral), :remote => true, :method => :post
+ -#.approve{:style => 'display:none'}
+ -# = form_for watcher_referral, :url => approve_admin_watcher_referral_path(watcher_referral), :method => :post do |f|
+ -# %p= f.label 'Комментарий'
+ -# %p= f.text_field :comment
+ -# %p= f.submit 'Подтвердить'
+ -#.reject{:style => 'display:none'}
+ -# = form_for watcher_referral, :url => reject_admin_watcher_referral_path(watcher_referral), :method => :post do |f|
+ -# %p= f.label 'Комментарий'
+ -# %p= f.text_field :comment
+ -# %p= f.submit 'Отклонить'
+ -#.problem{:style => 'display:none'}
+ -# = form_for watcher_referral, :url => problem_admin_watcher_referral_path(watcher_referral), :method => :post do |f|
+ -# %p= f.label 'Комментарий'
+ -# %p= f.text_field :comment
+ -# %p= f.submit 'Есть проблема'
= paginate @watcher_referrals
Please sign in to comment.
Something went wrong with that request. Please try again.