changeset 263:03f1fbe64104

The Submit button now attaches comments to the appropriate DB entries.
author James D. Callahan III <jcallahan@curse.com>
date Tue, 19 Mar 2013 14:51:50 -0500
parents 7f5982e01953
children 58b090074eda
files Comments.lua Main.lua
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Comments.lua	Tue Mar 19 12:54:21 2013 -0500
+++ b/Comments.lua	Tue Mar 19 14:51:50 2013 -0500
@@ -14,6 +14,7 @@
 
 local ParseGUID = private.ParseGUID
 local ItemLinkToID = private.ItemLinkToID
+local DBEntry = private.DBEntry
 
 -- CONSTANTS ----------------------------------------------------------
 
@@ -257,7 +258,15 @@
     submit:Enable(false)
 
     submit:SetScript("OnClick", function()
-    -- TODO: Make this assign the comment to the correct SavedVariables entry.
+        local entry = DBEntry(URL_TYPE_MAP[comment_subject.type_name], comment_subject.id)
+
+        if not entry then
+            WDP:Print("An error has occurred; please report at http://wow.curseforge.com/addons/wowdb-profiler/create-ticket/")
+            return
+        end
+        entry.comments = entry.comments or {}
+        entry.comments[#entry.comments + 1] = edit_box:GetText()
+
         edit_box:SetText("")
         _G.HideUIPanel(panel)
     end)
--- a/Main.lua	Tue Mar 19 12:54:21 2013 -0500
+++ b/Main.lua	Tue Mar 19 14:51:50 2013 -0500
@@ -299,6 +299,7 @@
     end
     return unit
 end
+private.DBEntry = DBEntry
 
 local NPCEntry
 do
@@ -778,6 +779,7 @@
         local _, item_link = _G.GetItemInfo(identifier)
         HandleItemUse(item_link)
     end)
+
     self:SetCurrentAreaID("OnEnable")
     self:GROUP_ROSTER_CHANGE()
 end