Commit e6966300 authored by Bryce Johnson's avatar Bryce Johnson

Add serialize_issuable helper and implement.

parent feeda94b
...@@ -30,6 +30,15 @@ module IssuablesHelper ...@@ -30,6 +30,15 @@ module IssuablesHelper
end end
end end
def serialize_issuable(issuable)
case issuable
when Issue
IssueSerializer.new.represent(issuable).to_json
when MergeRequest
MergeRequestSerializer.new.represent(issuable).to_json
end
end
def can_add_template?(issuable) def can_add_template?(issuable)
names = issuable_templates(issuable) names = issuable_templates(issuable)
names.empty? && can?(current_user, :push_code, @project) && !@project.private? names.empty? && can?(current_user, :push_code, @project) && !@project.private?
......
...@@ -206,7 +206,7 @@ ...@@ -206,7 +206,7 @@
:javascript :javascript
gl.IssuableResource = new gl.SubbableResource('#{issuable_json_path(issuable)}'); gl.IssuableResource = new gl.SubbableResource('#{issuable_json_path(issuable)}');
new gl.IssuableTimeTracking('#{issuable.to_json}'); new gl.IssuableTimeTracking('#{serialize_issuable(issuable)}');
new MilestoneSelect('{"namespace":"#{@project.namespace.path}","path":"#{@project.path}"}'); new MilestoneSelect('{"namespace":"#{@project.namespace.path}","path":"#{@project.path}"}');
new LabelsSelect(); new LabelsSelect();
new WeightSelect(); new WeightSelect();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment