1
0
Fork 0

Various PR fixes inc moving flag data to yml, making accepted image upload files a site setting and adding class binding for image uploads

Dieser Commit ist enthalten in:
Robert Barrow 2019-10-04 22:13:41 +01:00
Ursprung fe67efdb3c
Commit 96d5a189dc
6 geänderte Dateien mit 275 neuen und 793 gelöschten Zeilen

Datei anzeigen

@ -3,6 +3,7 @@ import { getToken } from "wizard/lib/ajax";
export default Ember.Component.extend({
classNames: ["wizard-field-upload"],
classNameBindings: ["isImage"],
uploading: false,
isImage: false,
@ -31,7 +32,7 @@ export default Ember.Component.extend({
"field.value": response.result,
"uploading": false
});
if (['jpg','jpeg','png','gif'].includes(response.result.extension)) {
if ( Discourse.SiteSettings.wizard_recognised_image_upload_formats.split('|').includes(response.result.extension)) {
this.setProperties({
"isImage": true
})

Datei anzeigen

@ -22,3 +22,4 @@ en:
site_settings:
wizard_redirect_exclude_paths: "Routes excluded from wizard redirects."
wizard_recognised_image_upload_formats: "File types which will result in upload displaying an image preview"

259
config/national_flags.yml Normale Datei
Datei anzeigen

@ -0,0 +1,259 @@
none: none.png
ad: ad.png
ae: ae.png
af: af.png
ag: ag.png
ai: ai.png
al: al.png
am: am.png
ao: ao.png
aq: aq.png
ar: ar.png
as: as.png
at: at.png
au: au.png
aw: aw.png
ax: ax.png
az: az.png
ba: ba.png
bb: bb.png
bd: bd.png
be: be.png
bf: bf.png
bg: bg.png
bh: bh.png
bi: bi.png
bj: bj.png
bl: bl.png
bm: bm.png
bn: bn.png
bo: bo.png
bq: bq.png
br: br.png
bs: bs.png
bt: bt.png
bv: bv.png
bw: bw.png
by: by.png
bz: bz.png
ca: ca.png
cc: cc.png
cd: cd.png
cf: cf.png
cg: cg.png
ch: ch.png
ci: ci.png
ck: ck.png
cl: cl.png
cm: cm.png
cn: cn.png
co: co.png
cr: cr.png
cu: cu.png
cv: cv.png
cw: cw.png
cx: cx.png
cy: cy.png
cz: cz.png
de: de.png
de-at: de-at.png
dj: dj.png
dk: dk.png
dm: dm.png
do: do.png
dz: dz.png
ec: ec.png
ee: ee.png
eg: eg.png
eh: eh.png
er: er.png
es: es.png
et: et.png
eu: eu.png
fi: fi.png
fj: fj.png
fk: fk.png
fm: fm.png
fo: fo.png
fr: fr.png
fr-br: fr-br.png
ga: ga.png
gb-eng: gb-eng.png
gb-nir: gb-nir.png
gb-sct: gb-sct.png
gb-wls: gb-wls.png
gb: gb.png
gd: gd.png
ge: ge.png
gf: gf.png
gg: gg.png
gh: gh.png
gi: gi.png
gl: gl.png
gm: gm.png
gn: gn.png
gp: gp.png
gq: gq.png
gr: gr.png
gs: gs.png
gt: gt.png
gu: gu.png
gw: gw.png
gy: gy.png
hk: hk.png
hm: hm.png
hn: hn.png
hr: hr.png
ht: ht.png
hu: hu.png
id: id.png
ie: ie.png
il: il.png
im: im.png
in: in.png
io: io.png
iq: iq.png
ir: ir.png
is: is.png
it: it.png
je: je.png
jm: jm.png
jo: jo.png
jp: jp.png
ke: ke.png
kg: kg.png
kh: kh.png
ki: ki.png
km: km.png
kn: kn.png
kp: kp.png
kr: kr.png
kw: kw.png
ky: ky.png
kz: kz.png
la: la.png
lb: lb.png
lc: lc.png
li: li.png
lk: lk.png
lr: lr.png
ls: ls.png
lt: lt.png
lu: lu.png
lv: lv.png
ly: ly.png
ma: ma.png
mc: mc.png
md: md.png
me: me.png
mf: mf.png
mg: mg.png
mh: mh.png
mk: mk.png
ml: ml.png
mm: mm.png
mn: mn.png
mo: mo.png
mp: mp.png
mq: mq.png
mr: mr.png
ms: ms.png
mt: mt.png
mu: mu.png
mv: mv.png
mw: mw.png
mx: mx.png
my: my.png
mz: mz.png
na: na.png
nc: nc.png
ne: ne.png
nf: nf.png
ng: ng.png
ni: ni.png
nl: nl.png
no: no.png
np: np.png
nr: nr.png
nu: nu.png
nz: nz.png
om: om.png
pa: pa.png
pe: pe.png
pf: pf.png
pg: pg.png
ph: ph.png
pk: pk.png
pl: pl.png
pm: pm.png
pn: pn.png
pr: pr.png
ps: ps.png
pt: pt.png
pw: pw.png
py: py.png
qa: qa.png
re: re.png
ro: ro.png
rs: rs.png
ru: ru.png
rw: rw.png
sa: sa.png
sb: sb.png
sc: sc.png
sd: sd.png
se: se.png
sg: sg.png
sh: sh.png
si: si.png
sj: sj.png
sk: sk.png
sl: sl.png
sm: sm.png
sn: sn.png
so: so.png
sr: sr.png
ss: ss.png
st: st.png
sv: sv.png
sx: sx.png
sy: sy.png
sz: sz.png
tc: tc.png
td: td.png
tf: tf.png
tg: tg.png
th: th.png
tj: tj.png
tk: tk.png
tl: tl.png
tm: tm.png
tn: tn.png
to: to.png
tr: tr.png
tt: tt.png
tv: tv.png
tw: tw.png
tz: tz.png
ua: ua.png
ug: ug.png
um: um.png
un: un.png
us: us.png
us-at: us-at.png
uy: uy.png
uz: uz.png
va: va.png
vc: vc.png
ve: ve.png
vg: vg.png
vi: vi.png
vn: vn.png
vu: vu.png
wf: wf.png
ws: ws.png
ye: ye.png
yt: yt.png
za: za.png
zm: zm.png
zw: zw.png

Datei anzeigen

@ -6,3 +6,9 @@ plugins:
choices:
- admin
- privacy
wizard_recognised_image_upload_formats:
client: true
default: "jpg|jpeg|png|gif"
refresh: true
type: list
list_type: compact

Datei anzeigen

@ -433,10 +433,10 @@ class CustomWizard::Builder
# leave if there are any empty fields
return if empty_data
unless action['custom_title_enabled']
title = data[action['title']]
if action['custom_title_enabled']
title = CustomWizard::Builder.fill_placeholders(action['custom_title'], user, data)
else
title = action['custom_title']
title = data[action['title']]
end
if action['post_builder']

Datei anzeigen

@ -21,799 +21,14 @@ end
class CustomWizard::Flags
def self.list
flags = [
{ "id" => 0,
"name"=> "none",
"value"=> "none.png"
}, {
"id"=> 1,
"name"=> "ad",
"value"=> "ad.png"
}, {
"id"=> 2,
"name"=> "ae",
"value"=> "ae.png"
}, {
"name"=> "af",
"value"=> "af.png"
}, {
"name"=> "ag",
"value"=> "ag.png"
}, {
"name"=> "ai",
"value"=> "ai.png"
}, {
"name"=> "al",
"value"=> "al.png"
}, {
"name"=> "am",
"value"=> "am.png"
}, {
"name"=> "ao",
"value"=> "ao.png"
}, {
"name"=> "aq",
"value"=> "aq.png"
}, {
"name"=> "ar",
"value"=> "ar.png"
}, {
"name"=> "as",
"value"=> "as.png"
}, {
"name"=> "at",
"value"=> "at.png"
}, {
"name"=> "au",
"value"=> "au.png"
}, {
"name"=> "aw",
"value"=> "aw.png"
}, {
"name"=> "ax",
"value"=> "ax.png"
}, {
"name"=> "az",
"value"=> "az.png"
}, {
"name"=> "ba",
"value"=> "ba.png"
}, {
"name"=> "bb",
"value"=> "bb.png"
}, {
"name"=> "bd",
"value"=> "bd.png"
}, {
"name"=> "be",
"value"=> "be.png"
}, {
"name"=> "bf",
"value"=> "bf.png"
}, {
"name"=> "bg",
"value"=> "bg.png"
}, {
"name"=> "bh",
"value"=> "bh.png"
}, {
"name"=> "bi",
"value"=> "bi.png"
}, {
"name"=> "bj",
"value"=> "bj.png"
}, {
"name"=> "bl",
"value"=> "bl.png"
}, {
"name"=> "bm",
"value"=> "bm.png"
}, {
"name"=> "bn",
"value"=> "bn.png"
}, {
"name"=> "bo",
"value"=> "bo.png"
}, {
"name"=> "bq",
"value"=> "bq.png"
}, {
"name"=> "br",
"value"=> "br.png"
}, {
"name"=> "bs",
"value"=> "bs.png"
}, {
"name"=> "bt",
"value"=> "bt.png"
}, {
"name"=> "bv",
"value"=> "bv.png"
}, {
"name"=> "bw",
"value"=> "bw.png"
}, {
"name"=> "by",
"value"=> "by.png"
}, {
"name"=> "bz",
"value"=> "bz.png"
}, {
"name"=> "ca",
"value"=> "ca.png"
}, {
"name"=> "cc",
"value"=> "cc.png"
}, {
"name"=> "cd",
"value"=> "cd.png"
}, {
"name"=> "cf",
"value"=> "cf.png"
}, {
"name"=> "cg",
"value"=> "cg.png"
}, {
"name"=> "ch",
"value"=> "ch.png"
}, {
"name"=> "ci",
"value"=> "ci.png"
}, {
"name"=> "ck",
"value"=> "ck.png"
}, {
"name"=> "cl",
"value"=> "cl.png"
}, {
"name"=> "cm",
"value"=> "cm.png"
}, {
"name"=> "cn",
"value"=> "cn.png"
}, {
"name"=> "co",
"value"=> "co.png"
}, {
"name"=> "cr",
"value"=> "cr.png"
}, {
"name"=> "cu",
"value"=> "cu.png"
}, {
"name"=> "cv",
"value"=> "cv.png"
}, {
"name"=> "cw",
"value"=> "cw.png"
}, {
"name"=> "cx",
"value"=> "cx.png"
}, {
"name"=> "cy",
"value"=> "cy.png"
}, {
"name"=> "cz",
"value"=> "cz.png"
}, {
"name"=> "de",
"value"=> "de.png"
}, {
"name"=> "de-at",
"value"=> "de-at.png"
}, {
"name"=> "dj",
"value"=> "dj.png"
}, {
"name"=> "dk",
"value"=> "dk.png"
}, {
"name"=> "dm",
"value"=> "dm.png"
}, {
"name"=> "do",
"value"=> "do.png"
}, {
"name"=> "dz",
"value"=> "dz.png"
}, {
"name"=> "ec",
"value"=> "ec.png"
}, {
"name"=> "ee",
"value"=> "ee.png"
}, {
"name"=> "eg",
"value"=> "eg.png"
}, {
"name"=> "eh",
"value"=> "eh.png"
}, {
"name"=> "er",
"value"=> "er.png"
}, {
"name"=> "es",
"value"=> "es.png"
}, {
"name"=> "et",
"value"=> "et.png"
}, {
"name"=> "eu",
"value"=> "eu.png"
}, {
"name"=> "fi",
"value"=> "fi.png"
}, {
"name"=> "fj",
"value"=> "fj.png"
}, {
"name"=> "fk",
"value"=> "fk.png"
}, {
"name"=> "fm",
"value"=> "fm.png"
}, {
"name"=> "fo",
"value"=> "fo.png"
}, {
"name"=> "fr",
"value"=> "fr.png"
}, {
"name"=> "fr-br",
"value"=> "fr-br.png"
}, {
"name"=> "ga",
"value"=> "ga.png"
}, {
"name"=> "gb-eng",
"value"=> "gb-eng.png"
}, {
"name"=> "gb-nir",
"value"=> "gb-nir.png"
}, {
"name"=> "gb-sct",
"value"=> "gb-sct.png"
}, {
"name"=> "gb-wls",
"value"=> "gb-wls.png"
}, {
"name"=> "gb",
"value"=> "gb.png"
}, {
"name"=> "gd",
"value"=> "gd.png"
}, {
"name"=> "ge",
"value"=> "ge.png"
}, {
"name"=> "gf",
"value"=> "gf.png"
}, {
"name"=> "gg",
"value"=> "gg.png"
}, {
"name"=> "gh",
"value"=> "gh.png"
}, {
"name"=> "gi",
"value"=> "gi.png"
}, {
"name"=> "gl",
"value"=> "gl.png"
}, {
"name"=> "gm",
"value"=> "gm.png"
}, {
"name"=> "gn",
"value"=> "gn.png"
}, {
"name"=> "gp",
"value"=> "gp.png"
}, {
"name"=> "gq",
"value"=> "gq.png"
}, {
"name"=> "gr",
"value"=> "gr.png"
}, {
"name"=> "gs",
"value"=> "gs.png"
}, {
"name"=> "gt",
"value"=> "gt.png"
}, {
"name"=> "gu",
"value"=> "gu.png"
}, {
"name"=> "gw",
"value"=> "gw.png"
}, {
"name"=> "gy",
"value"=> "gy.png"
}, {
"name"=> "hk",
"value"=> "hk.png"
}, {
"name"=> "hm",
"value"=> "hm.png"
}, {
"name"=> "hn",
"value"=> "hn.png"
}, {
"name"=> "hr",
"value"=> "hr.png"
}, {
"name"=> "ht",
"value"=> "ht.png"
}, {
"name"=> "hu",
"value"=> "hu.png"
}, {
"name"=> "id",
"value"=> "id.png"
}, {
"name"=> "ie",
"value"=> "ie.png"
}, {
"name"=> "il",
"value"=> "il.png"
}, {
"name"=> "im",
"value"=> "im.png"
}, {
"name"=> "in",
"value"=> "in.png"
}, {
"name"=> "io",
"value"=> "io.png"
}, {
"name"=> "iq",
"value"=> "iq.png"
}, {
"name"=> "ir",
"value"=> "ir.png"
}, {
"name"=> "is",
"value"=> "is.png"
}, {
"name"=> "it",
"value"=> "it.png"
}, {
"name"=> "je",
"value"=> "je.png"
}, {
"name"=> "jm",
"value"=> "jm.png"
}, {
"name"=> "jo",
"value"=> "jo.png"
}, {
"name"=> "jp",
"value"=> "jp.png"
}, {
"name"=> "ke",
"value"=> "ke.png"
}, {
"name"=> "kg",
"value"=> "kg.png"
}, {
"name"=> "kh",
"value"=> "kh.png"
}, {
"name"=> "ki",
"value"=> "ki.png"
}, {
"name"=> "km",
"value"=> "km.png"
}, {
"name"=> "kn",
"value"=> "kn.png"
}, {
"name"=> "kp",
"value"=> "kp.png"
}, {
"name"=> "kr",
"value"=> "kr.png"
}, {
"name"=> "kw",
"value"=> "kw.png"
}, {
"name"=> "ky",
"value"=> "ky.png"
}, {
"name"=> "kz",
"value"=> "kz.png"
}, {
"name"=> "la",
"value"=> "la.png"
}, {
"name"=> "lb",
"value"=> "lb.png"
}, {
"name"=> "lc",
"value"=> "lc.png"
}, {
"name"=> "li",
"value"=> "li.png"
}, {
"name"=> "lk",
"value"=> "lk.png"
}, {
"name"=> "lr",
"value"=> "lr.png"
}, {
"name"=> "ls",
"value"=> "ls.png"
}, {
"name"=> "lt",
"value"=> "lt.png"
}, {
"name"=> "lu",
"value"=> "lu.png"
}, {
"name"=> "lv",
"value"=> "lv.png"
}, {
"name"=> "ly",
"value"=> "ly.png"
}, {
"name"=> "ma",
"value"=> "ma.png"
}, {
"name"=> "mc",
"value"=> "mc.png"
}, {
"name"=> "md",
"value"=> "md.png"
}, {
"name"=> "me",
"value"=> "me.png"
}, {
"name"=> "mf",
"value"=> "mf.png"
}, {
"name"=> "mg",
"value"=> "mg.png"
}, {
"name"=> "mh",
"value"=> "mh.png"
}, {
"name"=> "mk",
"value"=> "mk.png"
}, {
"name"=> "ml",
"value"=> "ml.png"
}, {
"name"=> "mm",
"value"=> "mm.png"
}, {
"name"=> "mn",
"value"=> "mn.png"
}, {
"name"=> "mo",
"value"=> "mo.png"
}, {
"name"=> "mp",
"value"=> "mp.png"
}, {
"name"=> "mq",
"value"=> "mq.png"
}, {
"name"=> "mr",
"value"=> "mr.png"
}, {
"name"=> "ms",
"value"=> "ms.png"
}, {
"name"=> "mt",
"value"=> "mt.png"
}, {
"name"=> "mu",
"value"=> "mu.png"
}, {
"name"=> "mv",
"value"=> "mv.png"
}, {
"name"=> "mw",
"value"=> "mw.png"
}, {
"name"=> "mx",
"value"=> "mx.png"
}, {
"name"=> "my",
"value"=> "my.png"
}, {
"name"=> "mz",
"value"=> "mz.png"
}, {
"name"=> "na",
"value"=> "na.png"
}, {
"name"=> "nc",
"value"=> "nc.png"
}, {
"name"=> "ne",
"value"=> "ne.png"
}, {
"name"=> "nf",
"value"=> "nf.png"
}, {
"name"=> "ng",
"value"=> "ng.png"
}, {
"name"=> "ni",
"value"=> "ni.png"
}, {
"name"=> "nl",
"value"=> "nl.png"
}, {
"name"=> "no",
"value"=> "no.png"
}, {
"name"=> "np",
"value"=> "np.png"
}, {
"name"=> "nr",
"value"=> "nr.png"
}, {
"name"=> "nu",
"value"=> "nu.png"
}, {
"name"=> "nz",
"value"=> "nz.png"
}, {
"name"=> "om",
"value"=> "om.png"
}, {
"name"=> "pa",
"value"=> "pa.png"
}, {
"name"=> "pe",
"value"=> "pe.png"
}, {
"name"=> "pf",
"value"=> "pf.png"
}, {
"name"=> "pg",
"value"=> "pg.png"
}, {
"name"=> "ph",
"value"=> "ph.png"
}, {
"name"=> "pk",
"value"=> "pk.png"
}, {
"name"=> "pl",
"value"=> "pl.png"
}, {
"name"=> "pm",
"value"=> "pm.png"
}, {
"name"=> "pn",
"value"=> "pn.png"
}, {
"name"=> "pr",
"value"=> "pr.png"
}, {
"name"=> "ps",
"value"=> "ps.png"
}, {
"name"=> "pt",
"value"=> "pt.png"
}, {
"name"=> "pw",
"value"=> "pw.png"
}, {
"name"=> "py",
"value"=> "py.png"
}, {
"name"=> "qa",
"value"=> "qa.png"
}, {
"name"=> "re",
"value"=> "re.png"
}, {
"name"=> "ro",
"value"=> "ro.png"
}, {
"name"=> "rs",
"value"=> "rs.png"
}, {
"name"=> "ru",
"value"=> "ru.png"
}, {
"name"=> "rw",
"value"=> "rw.png"
}, {
"name"=> "sa",
"value"=> "sa.png"
}, {
"name"=> "sb",
"value"=> "sb.png"
}, {
"name"=> "sc",
"value"=> "sc.png"
}, {
"name"=> "sd",
"value"=> "sd.png"
}, {
"name"=> "se",
"value"=> "se.png"
}, {
"name"=> "sg",
"value"=> "sg.png"
}, {
"name"=> "sh",
"value"=> "sh.png"
}, {
"name"=> "si",
"value"=> "si.png"
}, {
"name"=> "sj",
"value"=> "sj.png"
}, {
"name"=> "sk",
"value"=> "sk.png"
}, {
"name"=> "sl",
"value"=> "sl.png"
}, {
"name"=> "sm",
"value"=> "sm.png"
}, {
"name"=> "sn",
"value"=> "sn.png"
}, {
"name"=> "so",
"value"=> "so.png"
}, {
"name"=> "sr",
"value"=> "sr.png"
}, {
"name"=> "ss",
"value"=> "ss.png"
}, {
"name"=> "st",
"value"=> "st.png"
}, {
"name"=> "sv",
"value"=> "sv.png"
}, {
"name"=> "sx",
"value"=> "sx.png"
}, {
"name"=> "sy",
"value"=> "sy.png"
}, {
"name"=> "sz",
"value"=> "sz.png"
}, {
"name"=> "tc",
"value"=> "tc.png"
}, {
"name"=> "td",
"value"=> "td.png"
}, {
"name"=> "tf",
"value"=> "tf.png"
}, {
"name"=> "tg",
"value"=> "tg.png"
}, {
"name"=> "th",
"value"=> "th.png"
}, {
"name"=> "tj",
"value"=> "tj.png"
}, {
"name"=> "tk",
"value"=> "tk.png"
}, {
"name"=> "tl",
"value"=> "tl.png"
}, {
"name"=> "tm",
"value"=> "tm.png"
}, {
"name"=> "tn",
"value"=> "tn.png"
}, {
"name"=> "to",
"value"=> "to.png"
}, {
"name"=> "tr",
"value"=> "tr.png"
}, {
"name"=> "tt",
"value"=> "tt.png"
}, {
"name"=> "tv",
"value"=> "tv.png"
}, {
"name"=> "tw",
"value"=> "tw.png"
}, {
"name"=> "tz",
"value"=> "tz.png"
}, {
"name"=> "ua",
"value"=> "ua.png"
}, {
"name"=> "ug",
"value"=> "ug.png"
}, {
"name"=> "um",
"value"=> "um.png"
}, {
"name"=> "un",
"value"=> "un.png"
}, {
"name"=> "us",
"value"=> "us.png"
}, {
"name"=> "us-at",
"value"=> "us-at.png"
}, {
"name"=> "uy",
"value"=> "uy.png"
}, {
"name"=> "uz",
"value"=> "uz.png"
}, {
"name"=> "va",
"value"=> "va.png"
}, {
"name"=> "vc",
"value"=> "vc.png"
}, {
"name"=> "ve",
"value"=> "ve.png"
}, {
"name"=> "vg",
"value"=> "vg.png"
}, {
"name"=> "vi",
"value"=> "vi.png"
}, {
"name"=> "vn",
"value"=> "vn.png"
}, {
"name"=> "vu",
"value"=> "vu.png"
}, {
"name"=> "wf",
"value"=> "wf.png"
}, {
"name"=> "ws",
"value"=> "ws.png"
}, {
"name"=> "ye",
"value"=> "ye.png"
}, {
"name"=> "yt",
"value"=> "yt.png"
}, {
"name"=> "za",
"value"=> "za.png"
}, {
"name"=> "zm",
"value"=> "zm.png"
}, {
"name"=> "zw",
"value"=> "zw.png"
}
]
raw_flags = YAML.safe_load(File.read(File.join(Rails.root, 'plugins', 'discourse-custom-wizard', 'config', 'national_flags.yml')))
flagscollection = []
id = 0
flags.each do |f|
flagscollection << CustomWizard::Flag.new(f['name'], f['name'], f['value'])
id += 1
raw_flags.map do |name, code|
flagscollection << CustomWizard::Flag.new(name, name, code)
end
return flagscollection
flagscollection
end
end