Finished Checkin/out feature for now

-Checkin/out api methods can be used while signed in
-Added checkout button in Netzke App, which also signs out in addition to checking out.
This commit is contained in:
Jason Denney
2013-05-19 16:41:43 -04:00
parent d7755f00ed
commit a00c1ed925
4 changed files with 29 additions and 12 deletions
+6 -2
View File
@@ -6,6 +6,11 @@ class AppTabPanel < Netzke::Basepack::TabPanel
c.text = "Sign out #{controller.current_user.email}" if controller.current_user
end
action :check_out do |c|
c.icon = :door_out
c.text = "CHECK OUT" if controller.current_user
end
def configure(c)
#all users
@@ -49,7 +54,7 @@ class AppTabPanel < Netzke::Basepack::TabPanel
end
c.prevent_header = true
c.tbar = [:sign_out]
c.tbar = [:sign_out, :check_out]
c.items = @@app_tab_panel_items
super
end
@@ -58,6 +63,5 @@ class AppTabPanel < Netzke::Basepack::TabPanel
#gets js from app_tab_panel/javascripts/sign_out.js
c.mixin :sign_out
end
end
@@ -5,5 +5,17 @@
url: '/users/sign_out',
method: 'DELETE'
});
},
onCheckOut: function(){
Ext.Ajax.request({
url: '/api/v1/checkout',
method: 'POST',
success: function(response, opts) {
Ext.Ajax.request({
url: '/users/sign_out',
method: 'DELETE'
});
}
});
}
}