Skip to content

Instantly share code, notes, and snippets.

@Echos
Created October 15, 2012 13:10
Show Gist options
  • Save Echos/3892382 to your computer and use it in GitHub Desktop.
Save Echos/3892382 to your computer and use it in GitHub Desktop.
Massr用ユーザ削除機能復元パッチ
diff --git public/js/default.js public/js/default.js
index 92b0891..3a0f63d 100644
--- public/js/default.js
+++ public/js/default.js
@@ -337,21 +337,6 @@ $(function(){
});
/*
- * delete user by myself
- */
- $(document).on('click', '#delete-user', function(){
- if(window.confirm('本当に削除してよろしいいですか?')){
- $.ajax({
- url: '/user',
- type: 'DELETE',
- success: function(result) {
- location.href = "/";
- }
- });
- }
- });
-
- /*
* admin
*/
var ADMIN = 0;
diff --git routes/user.rb routes/user.rb
index ff33294..463a707 100644
--- routes/user.rb
+++ routes/user.rb
@@ -108,13 +108,6 @@ module Massr
redirect '/'
end
- delete '/user' do
- user = User.find_by_id(session[:user_id])
- user.destroy
- session.clear
- redirect '/'
- end
-
put '/user/:massr_id' do
user = User.find_by_id(session[:user_id])
redirect '/' unless user.admin?
diff --git views/user.haml views/user.haml
index 38bc18b..276f8c3 100644
--- views/user.haml
+++ views/user.haml
@@ -42,10 +42,6 @@
%input.btn.btn-large{:type => "submit" , :value => "保存"}
- else
%input.btn.btn-primary.btn-large{:type => "submit" , :value => "登録"}
- -if user
- %hr
- %input.btn.btn-danger.btn-small{:id => 'delete-user', :type => "button" , :value => "ユーザ削除"}
- ※データもすべて削除されます
.span3
- if user
!= haml :sidebar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment