You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2018/03/02 15:37:30 UTC
[kibble] 05/09: make a forum explorer widget
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git
commit 02a7fec4d596b945dbeb18fbc736bac99277b476
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Fri Mar 2 16:36:12 2018 +0100
make a forum explorer widget
---
ui/js/coffee/explorer.coffee | 57 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/ui/js/coffee/explorer.coffee b/ui/js/coffee/explorer.coffee
index e06e7fa..e96ec2c 100644
--- a/ui/js/coffee/explorer.coffee
+++ b/ui/js/coffee/explorer.coffee
@@ -326,6 +326,62 @@ issueexplorer = (json, state) ->
+forumexplorer = (json, state) ->
+
+ org = json.organisation
+ if json.tag
+ org.name += " (Filter: " + json.tag + ")"
+ h = document.createElement('h4')
+ h.appendChild(document.createTextNode("Exploring " + org.name + ":"))
+ state.widget.inject(h, true)
+ list = document.createElement('select')
+ state.widget.inject(list)
+ opt = document.createElement('option')
+ opt.value = ""
+ slen = 0
+ for item in json.sources
+ if item.type in ['forum', 'discourse', 'askbot']
+ slen++
+ opt.text = "All " + slen + " forum(s)"
+ list.appendChild(opt)
+ json.sources.sort((a,b) ->
+ return if (a.sourceURL == b.sourceURL) then 0 else (if a.sourceURL > b.sourceURL then 1 else -1)
+ )
+ for item in json.sources
+ if item.type in ['forum', 'discourse', 'askbot']
+ opt = document.createElement('option')
+ opt.value = item.sourceID
+ ezURL = null
+ n = item.sourceURL.match(/^([a-z]+:\/\/.+?)\/([-.A-Z0-9]+)$/i)
+ m = item.sourceURL.match(/^([a-z]+:\/\/.+?)\s(.+)$/i)
+ if n and n.length == 3
+ ezURL = "#{n[2]} - (#{n[1]})"
+ else if m and m.length == 3
+ ezURL = "#{m[2]} - (#{m[1]})"
+ opt.text = if ezURL then ezURL else item.sourceURL
+ if globArgs.source and globArgs.source == item.sourceID
+ opt.selected = 'selected'
+ list.appendChild(opt)
+
+ ID = Math.floor(Math.random() * 987654321).toString(16)
+ list.setAttribute('id', ID)
+ $("#"+ID).chosen().change(() ->
+ source = this.value
+
+ if source == ""
+ source = null
+ globArgs.source = source
+ updateWidgets('donut', null, { source: source })
+ updateWidgets('gauge', null, { source: source })
+ updateWidgets('line', null, { source: source })
+ updateWidgets('contacts', null, { source: source })
+ updateWidgets('top5', null, { source: source })
+ updateWidgets('factors', null, { source: source })
+ updateWidgets('trends', null, { source: source })
+
+ )
+
+
imexplorer = (json, state) ->
@@ -505,6 +561,7 @@ subFilter = () ->
updateWidgets('sourcepicker', null, x)
updateWidgets('repopicker', null, x)
updateWidgets('issuepicker', null, x)
+ updateWidgets('forumpicker', null, x)
updateWidgets('mailpicker', null, x)
updateWidgets('logpicker', null, x)
updateWidgets('donut', null, x)
--
To stop receiving notification emails like this one, please contact
humbedooh@apache.org.