Mercurial > wow > wowdb-profiler
comparison Comments.lua @ 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 |
comparison
equal
deleted
inserted
replaced
262:7f5982e01953 | 263:03f1fbe64104 |
---|---|
12 local WDP = LibStub("AceAddon-3.0"):GetAddon(ADDON_NAME) | 12 local WDP = LibStub("AceAddon-3.0"):GetAddon(ADDON_NAME) |
13 local Dialog = LibStub("LibDialog-1.0") | 13 local Dialog = LibStub("LibDialog-1.0") |
14 | 14 |
15 local ParseGUID = private.ParseGUID | 15 local ParseGUID = private.ParseGUID |
16 local ItemLinkToID = private.ItemLinkToID | 16 local ItemLinkToID = private.ItemLinkToID |
17 local DBEntry = private.DBEntry | |
17 | 18 |
18 -- CONSTANTS ---------------------------------------------------------- | 19 -- CONSTANTS ---------------------------------------------------------- |
19 | 20 |
20 local EDIT_MAXCHARS = 3000 | 21 local EDIT_MAXCHARS = 3000 |
21 local EDIT_DESCRIPTION_FORMAT = "Enter your comment below, being as descriptive as possible. Comments are limited to %s characters, including newlines and spaces." | 22 local EDIT_DESCRIPTION_FORMAT = "Enter your comment below, being as descriptive as possible. Comments are limited to %s characters, including newlines and spaces." |
255 submit:SetPoint("BOTTOM", 0, 15) | 256 submit:SetPoint("BOTTOM", 0, 15) |
256 submit:SetText(_G.SUBMIT) | 257 submit:SetText(_G.SUBMIT) |
257 submit:Enable(false) | 258 submit:Enable(false) |
258 | 259 |
259 submit:SetScript("OnClick", function() | 260 submit:SetScript("OnClick", function() |
260 -- TODO: Make this assign the comment to the correct SavedVariables entry. | 261 local entry = DBEntry(URL_TYPE_MAP[comment_subject.type_name], comment_subject.id) |
262 | |
263 if not entry then | |
264 WDP:Print("An error has occurred; please report at http://wow.curseforge.com/addons/wowdb-profiler/create-ticket/") | |
265 return | |
266 end | |
267 entry.comments = entry.comments or {} | |
268 entry.comments[#entry.comments + 1] = edit_box:GetText() | |
269 | |
261 edit_box:SetText("") | 270 edit_box:SetText("") |
262 _G.HideUIPanel(panel) | 271 _G.HideUIPanel(panel) |
263 end) | 272 end) |
264 panel.submitButton = submit | 273 panel.submitButton = submit |
265 end | 274 end |