motorefi-lit 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +170 -0
- data/Rakefile +38 -0
- data/app/assets/images/lit/famfamfam_flags/ad.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ae.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/af.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ag.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ai.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/al.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/am.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/an.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ao.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ar.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/as.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/at.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/au.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/aw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ax.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/az.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ba.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bb.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bd.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/be.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bi.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bj.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bo.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/br.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bs.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/by.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/bz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ca.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/catalonia.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cd.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ch.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ci.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ck.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/co.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cs.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cx.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cy.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/cz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/da.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/de.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/dj.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/dk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/dm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/do.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/dz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ec.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ee.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/eg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/eh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/en.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/england.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/er.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/es.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/et.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/europeanunion.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fam.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fi.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fj.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fo.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/fr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ga.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gb.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gd.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ge.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gi.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gp.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gq.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gs.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/gy.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/hk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/hm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/hn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/hr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ht.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/hu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/id.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ie.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/il.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/in.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/io.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/iq.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ir.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/is.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/it.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ja.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/jm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/jo.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/jp.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ke.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ki.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/km.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kp.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ky.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/kz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/la.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lb.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/li.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ls.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/lv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ly.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ma.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/md.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/me.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ml.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mo.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mp.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mq.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ms.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mx.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/my.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/mz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/na.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ne.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ng.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ni.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/no.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/np.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/nz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/om.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pa.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pe.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ph.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ps.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/pw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/py.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/qa.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/re.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ro.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/rs.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ru.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/rw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sa.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sb.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/scotland.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sd.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/se.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sh.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/si.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sj.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/so.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/st.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sy.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/sz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/td.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/th.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tj.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tk.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tl.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/to.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tr.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tv.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tw.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/tz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ua.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ug.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/um.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/us.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/uy.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/uz.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/va.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/vc.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ve.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/vg.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/vi.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/vn.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/vu.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/wales.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/wf.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ws.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/ye.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/yt.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/za.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/zm.png +0 -0
- data/app/assets/images/lit/famfamfam_flags/zw.png +0 -0
- data/app/assets/images/lit/jquery-te.png +0 -0
- data/app/assets/javascripts/lit/application.js +19 -0
- data/app/assets/javascripts/lit/backend/bootstrap.js.coffee +4 -0
- data/app/assets/javascripts/lit/backend/dashboard.js +2 -0
- data/app/assets/javascripts/lit/backend/jquery-te-1.4.0.min.js +9 -0
- data/app/assets/javascripts/lit/backend/localizations.js.coffee +26 -0
- data/app/assets/javascripts/lit/backend/sources.js.coffee +24 -0
- data/app/assets/javascripts/lit/lit_frontend.js +103 -0
- data/app/assets/javascripts/lit/mousetrap.js +1044 -0
- data/app/assets/stylesheets/lit/application.css +59 -0
- data/app/assets/stylesheets/lit/backend/jquery-te-1.4.0.css.scss +457 -0
- data/app/assets/stylesheets/lit/lit_frontend.css +86 -0
- data/app/controllers/lit/api/v1/base_controller.rb +19 -0
- data/app/controllers/lit/api/v1/locales_controller.rb +14 -0
- data/app/controllers/lit/api/v1/localization_keys_controller.rb +15 -0
- data/app/controllers/lit/api/v1/localizations_controller.rb +18 -0
- data/app/controllers/lit/application_controller.rb +49 -0
- data/app/controllers/lit/concerns/request_info_store.rb +16 -0
- data/app/controllers/lit/concerns/request_keys_store.rb +16 -0
- data/app/controllers/lit/dashboard_controller.rb +9 -0
- data/app/controllers/lit/incomming_localizations_controller.rb +49 -0
- data/app/controllers/lit/locales_controller.rb +31 -0
- data/app/controllers/lit/localization_keys_controller.rb +117 -0
- data/app/controllers/lit/localizations_controller.rb +60 -0
- data/app/controllers/lit/sources_controller.rb +77 -0
- data/app/helpers/lit/application_helper.rb +4 -0
- data/app/helpers/lit/dashboard_helper.rb +4 -0
- data/app/helpers/lit/frontend_helper.rb +71 -0
- data/app/helpers/lit/localization_keys_helper.rb +5 -0
- data/app/helpers/lit/localizations_helper.rb +15 -0
- data/app/helpers/lit/sources_helper.rb +7 -0
- data/app/jobs/lit/synchronize_source_job.rb +11 -0
- data/app/models/lit/incomming_localization.rb +77 -0
- data/app/models/lit/locale.rb +48 -0
- data/app/models/lit/localization.rb +103 -0
- data/app/models/lit/localization_key.rb +107 -0
- data/app/models/lit/localization_version.rb +12 -0
- data/app/models/lit/source.rb +111 -0
- data/app/views/kaminari/lit/_first_page.html.erb +5 -0
- data/app/views/kaminari/lit/_gap.html.erb +3 -0
- data/app/views/kaminari/lit/_last_page.html.erb +6 -0
- data/app/views/kaminari/lit/_next_page.html.erb +5 -0
- data/app/views/kaminari/lit/_page.html.erb +3 -0
- data/app/views/kaminari/lit/_paginator.html.erb +17 -0
- data/app/views/kaminari/lit/_prev_page.html.erb +5 -0
- data/app/views/layouts/lit/_messages.html.erb +6 -0
- data/app/views/layouts/lit/_navigation.html.erb +23 -0
- data/app/views/layouts/lit/application.html.erb +46 -0
- data/app/views/lit/dashboard/index.html.erb +5 -0
- data/app/views/lit/incomming_localizations/accept.js.erb +2 -0
- data/app/views/lit/incomming_localizations/destroy.js.erb +1 -0
- data/app/views/lit/incomming_localizations/index.html.erb +52 -0
- data/app/views/lit/locales/_hide_link.html.erb +1 -0
- data/app/views/lit/locales/hide.js.erb +1 -0
- data/app/views/lit/locales/index.html.erb +20 -0
- data/app/views/lit/localization_keys/_localization_row.html.erb +14 -0
- data/app/views/lit/localization_keys/destroy.js.erb +1 -0
- data/app/views/lit/localization_keys/index.html.erb +127 -0
- data/app/views/lit/localization_keys/star.js.erb +1 -0
- data/app/views/lit/localizations/_form.html.erb +23 -0
- data/app/views/lit/localizations/_previous_versions_rows.html.erb +15 -0
- data/app/views/lit/localizations/edit.js.erb +7 -0
- data/app/views/lit/localizations/previous_versions.js.erb +3 -0
- data/app/views/lit/localizations/update.js.erb +4 -0
- data/app/views/lit/sources/_form.html.erb +35 -0
- data/app/views/lit/sources/edit.html.erb +6 -0
- data/app/views/lit/sources/index.html.erb +42 -0
- data/app/views/lit/sources/new.html.erb +5 -0
- data/app/views/lit/sources/show.html.erb +19 -0
- data/config/routes.rb +49 -0
- data/db/migrate/20180101010101_lit_create_lit_locales.rb +16 -0
- data/db/migrate/20180101010102_lit_create_lit_localization_keys.rb +18 -0
- data/db/migrate/20180101010103_lit_create_lit_localizations.rb +24 -0
- data/db/migrate/20180101010104_lit_add_is_completed_and_is_starred_to_localization_keys.rb +17 -0
- data/db/migrate/20180101010105_lit_add_is_hidden_to_locales.rb +12 -0
- data/db/migrate/20180101010106_lit_create_lit_localization_versions.rb +20 -0
- data/db/migrate/20180101010107_lit_create_lit_sources.rb +19 -0
- data/db/migrate/20180101010108_lit_create_lit_incomming_localizations.rb +34 -0
- data/db/migrate/20180101010109_lit_add_sync_complete_to_lit_sources.rb +12 -0
- data/lib/generators/lit/install/templates/initializer.rb +52 -0
- data/lib/generators/lit/install_generator.rb +66 -0
- data/lib/lit.rb +65 -0
- data/lib/lit/adapters/hash_storage.rb +12 -0
- data/lib/lit/adapters/redis_storage.rb +99 -0
- data/lib/lit/cache.rb +356 -0
- data/lib/lit/engine.rb +28 -0
- data/lib/lit/i18n_backend.rb +192 -0
- data/lib/lit/loader.rb +16 -0
- data/lib/lit/rails.rb +17 -0
- data/lib/lit/railtie.rb +12 -0
- data/lib/lit/version.rb +3 -0
- data/lib/tasks/lit_tasks.rake +29 -0
- metadata +478 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
module Lit
|
2
|
+
class LocalizationsController < ::Lit::ApplicationController
|
3
|
+
before_action :find_localization_key
|
4
|
+
before_action :find_localization
|
5
|
+
|
6
|
+
def show
|
7
|
+
render json: { value: @localization.get_value }
|
8
|
+
end
|
9
|
+
|
10
|
+
def edit
|
11
|
+
@localization.translated_value = @localization.get_value
|
12
|
+
respond_to do |format|
|
13
|
+
format.js
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def update
|
18
|
+
if @localization.update_attributes(clear_params)
|
19
|
+
@localization.update_column :is_changed, true
|
20
|
+
Lit.init.cache.update_cache @localization.full_key, @localization.get_value
|
21
|
+
end
|
22
|
+
@localization.reload
|
23
|
+
respond_to do |f|
|
24
|
+
f.js
|
25
|
+
f.json do
|
26
|
+
render json: { value: @localization.get_value }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def previous_versions
|
32
|
+
@versions = @localization.versions.order('created_at DESC')
|
33
|
+
respond_to :js
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def find_localization_key
|
39
|
+
@localization_key = Lit::LocalizationKey. \
|
40
|
+
find(params[:localization_key_id])
|
41
|
+
end
|
42
|
+
|
43
|
+
def find_localization
|
44
|
+
@localization = @localization_key.localizations.find(params[:id])
|
45
|
+
end
|
46
|
+
|
47
|
+
def clear_params
|
48
|
+
if params.respond_to?(:permit)
|
49
|
+
# allow translated_value to be an array
|
50
|
+
if @localization.value.is_a?(Array)
|
51
|
+
params.require(:localization).permit(:locale_id, translated_value: [])
|
52
|
+
else
|
53
|
+
params.require(:localization).permit(:locale_id, :translated_value)
|
54
|
+
end
|
55
|
+
else
|
56
|
+
params[:localization].is_a?(Hash) ? params[:localization].slice(:translated_value, :locale_id) : {}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require_dependency 'lit/application_controller'
|
2
|
+
|
3
|
+
module Lit
|
4
|
+
class SourcesController < ApplicationController
|
5
|
+
def index
|
6
|
+
@sources = Source.all
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
@source = Source.find(params[:id])
|
11
|
+
end
|
12
|
+
|
13
|
+
def new
|
14
|
+
@source = Source.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def edit
|
18
|
+
@source = Source.find(params[:id])
|
19
|
+
end
|
20
|
+
|
21
|
+
def synchronize
|
22
|
+
@source = Source.find(params[:id])
|
23
|
+
@source.update_column(:sync_complete, false)
|
24
|
+
if defined?(ActiveJob)
|
25
|
+
SynchronizeSourceJob.perform_later(@source)
|
26
|
+
else
|
27
|
+
@source.synchronize
|
28
|
+
end
|
29
|
+
redirect_to lit.source_incomming_localizations_path(@source)
|
30
|
+
end
|
31
|
+
|
32
|
+
def touch
|
33
|
+
@source = Source.find(params[:id])
|
34
|
+
@source.touch_last_updated_at!
|
35
|
+
redirect_to request.env['HTTP_REFERER'].present? ? :back : @source
|
36
|
+
end
|
37
|
+
|
38
|
+
def create
|
39
|
+
@source = Source.new(clear_params)
|
40
|
+
if @source.save
|
41
|
+
redirect_to @source, notice: 'Source was successfully created.'
|
42
|
+
else
|
43
|
+
render action: 'new'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def update
|
48
|
+
@source = Source.find(params[:id])
|
49
|
+
if @source.update_attributes(clear_params)
|
50
|
+
redirect_to @source, notice: 'Source was successfully updated.'
|
51
|
+
else
|
52
|
+
render action: 'edit'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def destroy
|
57
|
+
@source = Source.find(params[:id])
|
58
|
+
@source.destroy
|
59
|
+
redirect_to sources_url
|
60
|
+
end
|
61
|
+
|
62
|
+
def sync_complete
|
63
|
+
@source = Source.find(params[:id])
|
64
|
+
render json: { sync_complete: @source.sync_complete }
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def clear_params
|
70
|
+
if defined?(::ActionController::StrongParameters)
|
71
|
+
params.require(:source).permit(:identifier, :url, :api_key)
|
72
|
+
else
|
73
|
+
params[:source]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Lit
|
2
|
+
module FrontendHelper
|
3
|
+
include ActionView::Helpers::TranslationHelper
|
4
|
+
module TranslationKeyWrapper
|
5
|
+
def translate(key, options = {})
|
6
|
+
options = options.with_indifferent_access
|
7
|
+
key = scope_key_by_partial(key)
|
8
|
+
ret = super(key, options)
|
9
|
+
if !options[:skip_lit] && lit_authorized?
|
10
|
+
ret = get_translateable_span(key, ret)
|
11
|
+
end
|
12
|
+
ret
|
13
|
+
end
|
14
|
+
|
15
|
+
def t(key, options = {})
|
16
|
+
translate(key, options)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
prepend Lit::FrontendHelper::TranslationKeyWrapper
|
20
|
+
|
21
|
+
def javascript_lit_tag
|
22
|
+
javascript_include_tag 'lit/lit_frontend'
|
23
|
+
end
|
24
|
+
|
25
|
+
def stylesheet_lit_tag
|
26
|
+
stylesheet_link_tag 'lit/lit_frontend'
|
27
|
+
end
|
28
|
+
|
29
|
+
def lit_frontend_assets
|
30
|
+
return unless lit_authorized?
|
31
|
+
meta = content_tag :meta,
|
32
|
+
'',
|
33
|
+
value: lit.find_localization_localization_keys_path,
|
34
|
+
name: 'lit-url-base'
|
35
|
+
safe_join([javascript_lit_tag, stylesheet_lit_tag, meta])
|
36
|
+
end
|
37
|
+
|
38
|
+
def lit_translations_info
|
39
|
+
return if Thread.current[:lit_request_keys].nil?
|
40
|
+
return unless lit_authorized?
|
41
|
+
content_tag :div, class: 'lit-translations-info collapsed' do
|
42
|
+
concat content_tag :span, 'Show translations', class: 'lit-open-button'
|
43
|
+
concat content_tag :span, 'X', class: 'lit-close-button'
|
44
|
+
concat(content_tag(:ul, class: 'lit-translations-list') do
|
45
|
+
Lit.init.cache.request_keys.each do |k, v|
|
46
|
+
concat(content_tag(:li) do
|
47
|
+
concat content_tag :code, "#{k}:"
|
48
|
+
concat get_translateable_span(k, v, alternative_text: '[empty]')
|
49
|
+
end)
|
50
|
+
end
|
51
|
+
end)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def lit_authorized?
|
56
|
+
if Lit.authentication_verification.present?
|
57
|
+
send(Lit.authentication_verification)
|
58
|
+
else
|
59
|
+
true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def get_translateable_span(key, localization, alternative_text: nil)
|
64
|
+
content_tag :span,
|
65
|
+
class: 'lit-key-generic',
|
66
|
+
data: { key: key, locale: I18n.locale } do
|
67
|
+
localization.blank? ? alternative_text : localization
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Lit
|
2
|
+
module LocalizationsHelper
|
3
|
+
def draw_icon(icon, opts = {})
|
4
|
+
raw("<i class=\"fa fa-#{icon} #{opts[:class]}\" title=\"#{opts[:title]}\" ></i>")
|
5
|
+
end
|
6
|
+
|
7
|
+
def ejs(val)
|
8
|
+
escape_javascript val.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def allow_wysiwyg_editor?(key)
|
12
|
+
Lit.all_translations_are_html_safe || key.to_s =~ /(\b|_|\.)html$/
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Lit
|
2
|
+
class IncommingLocalization < ActiveRecord::Base
|
3
|
+
serialize :translated_value
|
4
|
+
|
5
|
+
## ASSOCIATIONS
|
6
|
+
belongs_to :locale
|
7
|
+
belongs_to :localization_key
|
8
|
+
belongs_to :localization
|
9
|
+
belongs_to :source
|
10
|
+
|
11
|
+
unless defined?(::ActionController::StrongParameters)
|
12
|
+
attr_accessible
|
13
|
+
end
|
14
|
+
|
15
|
+
## BEFORE & AFTER
|
16
|
+
before_create :set_localization_id
|
17
|
+
|
18
|
+
def get_value
|
19
|
+
translated_value
|
20
|
+
end
|
21
|
+
|
22
|
+
def full_key
|
23
|
+
[locale_str, localization_key_str].join('.')
|
24
|
+
end
|
25
|
+
|
26
|
+
def accept
|
27
|
+
if localization.present?
|
28
|
+
localization.translated_value = translated_value
|
29
|
+
localization.is_changed = true
|
30
|
+
localization.save
|
31
|
+
else
|
32
|
+
unless locale.present?
|
33
|
+
self.locale = Lit::Locale.where(locale: locale_str).first_or_create
|
34
|
+
end
|
35
|
+
unless localization_key.present?
|
36
|
+
self.localization_key = Lit::LocalizationKey.
|
37
|
+
where(localization_key: localization_key_str).
|
38
|
+
first_or_create
|
39
|
+
end
|
40
|
+
unless localization.present?
|
41
|
+
self.localization = Lit::Localization.
|
42
|
+
where(localization_key_id: self.localization_key.id).
|
43
|
+
where(locale_id: self.locale.id).
|
44
|
+
first_or_initialize
|
45
|
+
localization.translated_value = translated_value
|
46
|
+
localization.is_changed = true
|
47
|
+
localization.save!
|
48
|
+
end
|
49
|
+
end
|
50
|
+
Lit.init.cache.update_cache localization.full_key, localization.get_value
|
51
|
+
destroy
|
52
|
+
end
|
53
|
+
|
54
|
+
def is_duplicate?(val)
|
55
|
+
set_localization_id unless localization.present?
|
56
|
+
if localization
|
57
|
+
translated_value = localization.
|
58
|
+
read_attribute_before_type_cast('translated_value')
|
59
|
+
if localization.is_changed? && !translated_value.nil?
|
60
|
+
translated_value == val
|
61
|
+
else
|
62
|
+
localization.read_attribute_before_type_cast('default_value') == val
|
63
|
+
end
|
64
|
+
else
|
65
|
+
false
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def set_localization_id
|
72
|
+
if locale.present? && localization_key.present?
|
73
|
+
self.localization = localization_key.localizations.where(locale_id: locale_id).first
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Lit
|
2
|
+
class Locale < ActiveRecord::Base
|
3
|
+
## SCOPES
|
4
|
+
scope :ordered, proc { order('locale ASC') }
|
5
|
+
scope :visible, proc { where(is_hidden: false) }
|
6
|
+
|
7
|
+
## ASSOCIATIONS
|
8
|
+
has_many :localizations, dependent: :destroy
|
9
|
+
|
10
|
+
## VALIDATIONS
|
11
|
+
validates :locale,
|
12
|
+
presence: true,
|
13
|
+
uniqueness: true
|
14
|
+
|
15
|
+
## BEFORE & AFTER
|
16
|
+
after_save :reset_available_locales_cache
|
17
|
+
after_destroy :reset_available_locales_cache
|
18
|
+
|
19
|
+
unless defined?(::ActionController::StrongParameters)
|
20
|
+
## ACCESSIBLE
|
21
|
+
attr_accessible :locale
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
locale
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_translated_percentage
|
29
|
+
total = get_all_localizations_count
|
30
|
+
total > 0 ? (get_changed_localizations_count * 100 / total) : 0
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_changed_localizations_count
|
34
|
+
localizations.changed.count(:id)
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_all_localizations_count
|
38
|
+
localizations.count(:id)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def reset_available_locales_cache
|
44
|
+
return unless I18n.backend.respond_to?(:reset_available_locales_cache)
|
45
|
+
I18n.backend.reset_available_locales_cache
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
module Lit
|
2
|
+
class Localization < ActiveRecord::Base
|
3
|
+
serialize :translated_value
|
4
|
+
serialize :default_value
|
5
|
+
|
6
|
+
## SCOPES
|
7
|
+
scope :changed, proc { where(is_changed: true) }
|
8
|
+
# @HACK: dirty, find a way to round date to full second
|
9
|
+
scope :after, proc { |dt|
|
10
|
+
where('updated_at >= ?', dt + 1.second)
|
11
|
+
.where('is_changed = true')
|
12
|
+
}
|
13
|
+
|
14
|
+
## ASSOCIATIONS
|
15
|
+
belongs_to :locale
|
16
|
+
belongs_to :localization_key, touch: true
|
17
|
+
has_many :localization_versions, dependent: :destroy
|
18
|
+
has_many :versions, class_name: '::Lit::LocalizationVersion'
|
19
|
+
|
20
|
+
## VALIDATIONS
|
21
|
+
validates :locale_id,
|
22
|
+
presence: true
|
23
|
+
|
24
|
+
unless defined?(::ActionController::StrongParameters)
|
25
|
+
## ACCESSIBLE
|
26
|
+
attr_accessible :translated_value, :locale_id
|
27
|
+
end
|
28
|
+
|
29
|
+
## BEFORE & AFTER
|
30
|
+
with_options if: :translated_value_changed? do |o|
|
31
|
+
o.before_update :update_should_mark_localization_key_completed
|
32
|
+
o.before_update :create_version
|
33
|
+
end
|
34
|
+
after_update :mark_localization_key_completed
|
35
|
+
after_commit :update_redis_version
|
36
|
+
|
37
|
+
def translated_value
|
38
|
+
read_attribute(:translated_value) || default_value
|
39
|
+
end
|
40
|
+
|
41
|
+
def update_redis_version
|
42
|
+
LIT_REDIS_VERSION.increment
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_s
|
46
|
+
get_value
|
47
|
+
end
|
48
|
+
|
49
|
+
def full_key
|
50
|
+
[locale.locale, localization_key.localization_key].join('.')
|
51
|
+
end
|
52
|
+
|
53
|
+
def get_value
|
54
|
+
is_changed? && !translated_value.nil? ? translated_value : default_value
|
55
|
+
end
|
56
|
+
|
57
|
+
def value
|
58
|
+
get_value
|
59
|
+
end
|
60
|
+
|
61
|
+
def localization_key_str
|
62
|
+
localization_key.localization_key
|
63
|
+
end
|
64
|
+
|
65
|
+
def locale_str
|
66
|
+
locale.locale
|
67
|
+
end
|
68
|
+
|
69
|
+
def last_change
|
70
|
+
updated_at.to_s(:db)
|
71
|
+
end
|
72
|
+
|
73
|
+
def update_default_value(value)
|
74
|
+
return true if persisted? && default_value == value
|
75
|
+
if persisted?
|
76
|
+
update_column(:default_value, value)
|
77
|
+
else
|
78
|
+
self.default_value = value
|
79
|
+
save!
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def update_should_mark_localization_key_completed
|
86
|
+
return if translated_value == translated_value_was
|
87
|
+
@should_mark_localization_key_completed = true
|
88
|
+
end
|
89
|
+
|
90
|
+
def mark_localization_key_completed
|
91
|
+
return if !instance_variable_defined?(:@should_mark_localization_key_completed) || \
|
92
|
+
@should_mark_localization_key_completed
|
93
|
+
localization_key.mark_completed!
|
94
|
+
end
|
95
|
+
|
96
|
+
def create_version
|
97
|
+
if translated_value.present?
|
98
|
+
l = localization_versions.new
|
99
|
+
l.translated_value = translated_value_was || default_value
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|