OSDN Git Service

no committed files add
authorAkira Saito <akrstjp@users.sourceforge.jp>
Thu, 28 Aug 2014 15:26:42 +0000 (00:26 +0900)
committerAkira Saito <akrstjp@users.sourceforge.jp>
Thu, 28 Aug 2014 15:26:42 +0000 (00:26 +0900)
app/controllers/quick_edit_relations_controller.rb [new file with mode: 0644]
app/views/hooks/_head.erb [new file with mode: 0644]

diff --git a/app/controllers/quick_edit_relations_controller.rb b/app/controllers/quick_edit_relations_controller.rb
new file mode 100644 (file)
index 0000000..4852aaa
--- /dev/null
@@ -0,0 +1,50 @@
+class QuickEditRelationsController < ApplicationController
+  before_filter :find_issue, :find_project_from_association, :authorize, :only => [:create]
+  before_filter :find_relation, :except => [:index, :create]
+
+  def index
+  end
+
+  def create
+    @relation = IssueRelation.new(params[:relation])
+    @relation.issue_from = @issue
+    if params[:relation] && m = params[:relation][:issue_to_id].to_s.strip.match(/^#?(\d+)$/)
+      @relation.issue_to = Issue.visible.find_by_id(m[1].to_i)
+    end
+    saved = @relation.save
+
+    back_url = params[:back_url]
+    respond_to do |format|
+      format.html { redirect_to back_url }
+      format.js {
+        @relations = @issue.reload.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
+      }
+    end
+  end
+
+  def destroy
+    raise Unauthorized unless @relation.deletable?
+    @relation.destroy
+
+    back_url = params[:back_url]
+    respond_to do |format|
+      format.html { redirect_to back_url }
+      format.js
+      format.api  { render_api_ok }
+    end
+  end
+
+private
+  def find_issue
+    @issue = @object = Issue.find(params[:issue_id])
+  rescue ActiveRecord::RecordNotFound
+    render_404
+  end
+
+  def find_relation
+    @relation = IssueRelation.find(params[:id])
+  rescue ActiveRecord::RecordNotFound
+    render_404
+  end
+
+end
diff --git a/app/views/hooks/_head.erb b/app/views/hooks/_head.erb
new file mode 100644 (file)
index 0000000..b3f5e40
--- /dev/null
@@ -0,0 +1 @@
+<% include_calendar_headers_tags %>