[logaling-commit] logaling/logaling-server [master] Destroy github project memberships

Back to archive index

SHIMADA Koji null+****@clear*****
Fri Sep 28 17:08:33 JST 2012


SHIMADA Koji	2012-09-28 17:08:33 +0900 (Fri, 28 Sep 2012)

  New Revision: 151adb4403079849f8bd201c7e00b5d6350addf1
  https://github.com/logaling/logaling-server/commit/151adb4403079849f8bd201c7e00b5d6350addf1

  Merged c72eddb: Merge pull request #22 from logaling/destroy-github-project-membership

  Log:
    Destroy github project memberships

  Modified files:
    app/controllers/github_project_memberships_controller.rb
    app/views/dashboard/show.html.haml
    config/routes.rb

  Modified: app/controllers/github_project_memberships_controller.rb (+8 -0)
===================================================================
--- app/controllers/github_project_memberships_controller.rb    2012-09-28 16:48:26 +0900 (27f049e)
+++ app/controllers/github_project_memberships_controller.rb    2012-09-28 17:08:33 +0900 (b4e1ffa)
@@ -12,4 +12,12 @@ class GithubProjectMembershipsController < ApplicationController
       render action: "new"
     end
   end
+
+  def destroy
+    membership = Membership.find(params[:id])
+    membership.destroy
+    redirect_to dashboard_path, notice: 'Github project membership was successfully destroyed.'
+  rescue ActiveRecord::RecordNotFound
+    render :file => 'public/404.html', :status => 404, :layout => false
+  end
 end

  Modified: app/views/dashboard/show.html.haml (+1 -2)
===================================================================
--- app/views/dashboard/show.html.haml    2012-09-28 16:48:26 +0900 (1a1bdf7)
+++ app/views/dashboard/show.html.haml    2012-09-28 17:08:33 +0900 (5091147)
@@ -34,8 +34,7 @@
       %li
         = github_project.full_name
         %span.btn-group.actions
-          %a.btn.btn-mini{ :href => '#', :title => '削除する' }
-            %i.icon-trash
+          = link_to raw("<i class=icon-trash></i>"), user_github_project_membership_path(current_user, github_project.memberships.of(current_user).first), method: :delete, :class => 'btn btn-mini'
         %ul.glossariesList
           - github_project.glossaries.each_with_index do |glossary, i|
             %li

  Modified: config/routes.rb (+1 -1)
===================================================================
--- config/routes.rb    2012-09-28 16:48:26 +0900 (5d29313)
+++ config/routes.rb    2012-09-28 17:08:33 +0900 (7d29069)
@@ -14,7 +14,7 @@ LogalingServer::Application.routes.draw do
 
   resources :users, :only => [] do
     resources :github_project_memberships,
-      :only => [:new, :create]
+      :only => [:new, :create, :destroy]
     resources :user_glossaries,
       :path => 'glossaries',
       :only => [:new, :create, :show, :destroy],
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



More information about the logaling-commit mailing list
Back to archive index