motorefi-lit 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (347) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +170 -0
  4. data/Rakefile +38 -0
  5. data/app/assets/images/lit/famfamfam_flags/ad.png +0 -0
  6. data/app/assets/images/lit/famfamfam_flags/ae.png +0 -0
  7. data/app/assets/images/lit/famfamfam_flags/af.png +0 -0
  8. data/app/assets/images/lit/famfamfam_flags/ag.png +0 -0
  9. data/app/assets/images/lit/famfamfam_flags/ai.png +0 -0
  10. data/app/assets/images/lit/famfamfam_flags/al.png +0 -0
  11. data/app/assets/images/lit/famfamfam_flags/am.png +0 -0
  12. data/app/assets/images/lit/famfamfam_flags/an.png +0 -0
  13. data/app/assets/images/lit/famfamfam_flags/ao.png +0 -0
  14. data/app/assets/images/lit/famfamfam_flags/ar.png +0 -0
  15. data/app/assets/images/lit/famfamfam_flags/as.png +0 -0
  16. data/app/assets/images/lit/famfamfam_flags/at.png +0 -0
  17. data/app/assets/images/lit/famfamfam_flags/au.png +0 -0
  18. data/app/assets/images/lit/famfamfam_flags/aw.png +0 -0
  19. data/app/assets/images/lit/famfamfam_flags/ax.png +0 -0
  20. data/app/assets/images/lit/famfamfam_flags/az.png +0 -0
  21. data/app/assets/images/lit/famfamfam_flags/ba.png +0 -0
  22. data/app/assets/images/lit/famfamfam_flags/bb.png +0 -0
  23. data/app/assets/images/lit/famfamfam_flags/bd.png +0 -0
  24. data/app/assets/images/lit/famfamfam_flags/be.png +0 -0
  25. data/app/assets/images/lit/famfamfam_flags/bf.png +0 -0
  26. data/app/assets/images/lit/famfamfam_flags/bg.png +0 -0
  27. data/app/assets/images/lit/famfamfam_flags/bh.png +0 -0
  28. data/app/assets/images/lit/famfamfam_flags/bi.png +0 -0
  29. data/app/assets/images/lit/famfamfam_flags/bj.png +0 -0
  30. data/app/assets/images/lit/famfamfam_flags/bm.png +0 -0
  31. data/app/assets/images/lit/famfamfam_flags/bn.png +0 -0
  32. data/app/assets/images/lit/famfamfam_flags/bo.png +0 -0
  33. data/app/assets/images/lit/famfamfam_flags/br.png +0 -0
  34. data/app/assets/images/lit/famfamfam_flags/bs.png +0 -0
  35. data/app/assets/images/lit/famfamfam_flags/bt.png +0 -0
  36. data/app/assets/images/lit/famfamfam_flags/bv.png +0 -0
  37. data/app/assets/images/lit/famfamfam_flags/bw.png +0 -0
  38. data/app/assets/images/lit/famfamfam_flags/by.png +0 -0
  39. data/app/assets/images/lit/famfamfam_flags/bz.png +0 -0
  40. data/app/assets/images/lit/famfamfam_flags/ca.png +0 -0
  41. data/app/assets/images/lit/famfamfam_flags/catalonia.png +0 -0
  42. data/app/assets/images/lit/famfamfam_flags/cc.png +0 -0
  43. data/app/assets/images/lit/famfamfam_flags/cd.png +0 -0
  44. data/app/assets/images/lit/famfamfam_flags/cf.png +0 -0
  45. data/app/assets/images/lit/famfamfam_flags/cg.png +0 -0
  46. data/app/assets/images/lit/famfamfam_flags/ch.png +0 -0
  47. data/app/assets/images/lit/famfamfam_flags/ci.png +0 -0
  48. data/app/assets/images/lit/famfamfam_flags/ck.png +0 -0
  49. data/app/assets/images/lit/famfamfam_flags/cl.png +0 -0
  50. data/app/assets/images/lit/famfamfam_flags/cm.png +0 -0
  51. data/app/assets/images/lit/famfamfam_flags/cn.png +0 -0
  52. data/app/assets/images/lit/famfamfam_flags/co.png +0 -0
  53. data/app/assets/images/lit/famfamfam_flags/cr.png +0 -0
  54. data/app/assets/images/lit/famfamfam_flags/cs.png +0 -0
  55. data/app/assets/images/lit/famfamfam_flags/cu.png +0 -0
  56. data/app/assets/images/lit/famfamfam_flags/cv.png +0 -0
  57. data/app/assets/images/lit/famfamfam_flags/cx.png +0 -0
  58. data/app/assets/images/lit/famfamfam_flags/cy.png +0 -0
  59. data/app/assets/images/lit/famfamfam_flags/cz.png +0 -0
  60. data/app/assets/images/lit/famfamfam_flags/da.png +0 -0
  61. data/app/assets/images/lit/famfamfam_flags/de.png +0 -0
  62. data/app/assets/images/lit/famfamfam_flags/dj.png +0 -0
  63. data/app/assets/images/lit/famfamfam_flags/dk.png +0 -0
  64. data/app/assets/images/lit/famfamfam_flags/dm.png +0 -0
  65. data/app/assets/images/lit/famfamfam_flags/do.png +0 -0
  66. data/app/assets/images/lit/famfamfam_flags/dz.png +0 -0
  67. data/app/assets/images/lit/famfamfam_flags/ec.png +0 -0
  68. data/app/assets/images/lit/famfamfam_flags/ee.png +0 -0
  69. data/app/assets/images/lit/famfamfam_flags/eg.png +0 -0
  70. data/app/assets/images/lit/famfamfam_flags/eh.png +0 -0
  71. data/app/assets/images/lit/famfamfam_flags/en.png +0 -0
  72. data/app/assets/images/lit/famfamfam_flags/england.png +0 -0
  73. data/app/assets/images/lit/famfamfam_flags/er.png +0 -0
  74. data/app/assets/images/lit/famfamfam_flags/es.png +0 -0
  75. data/app/assets/images/lit/famfamfam_flags/et.png +0 -0
  76. data/app/assets/images/lit/famfamfam_flags/europeanunion.png +0 -0
  77. data/app/assets/images/lit/famfamfam_flags/fam.png +0 -0
  78. data/app/assets/images/lit/famfamfam_flags/fi.png +0 -0
  79. data/app/assets/images/lit/famfamfam_flags/fj.png +0 -0
  80. data/app/assets/images/lit/famfamfam_flags/fk.png +0 -0
  81. data/app/assets/images/lit/famfamfam_flags/fm.png +0 -0
  82. data/app/assets/images/lit/famfamfam_flags/fo.png +0 -0
  83. data/app/assets/images/lit/famfamfam_flags/fr.png +0 -0
  84. data/app/assets/images/lit/famfamfam_flags/ga.png +0 -0
  85. data/app/assets/images/lit/famfamfam_flags/gb.png +0 -0
  86. data/app/assets/images/lit/famfamfam_flags/gd.png +0 -0
  87. data/app/assets/images/lit/famfamfam_flags/ge.png +0 -0
  88. data/app/assets/images/lit/famfamfam_flags/gf.png +0 -0
  89. data/app/assets/images/lit/famfamfam_flags/gh.png +0 -0
  90. data/app/assets/images/lit/famfamfam_flags/gi.png +0 -0
  91. data/app/assets/images/lit/famfamfam_flags/gl.png +0 -0
  92. data/app/assets/images/lit/famfamfam_flags/gm.png +0 -0
  93. data/app/assets/images/lit/famfamfam_flags/gn.png +0 -0
  94. data/app/assets/images/lit/famfamfam_flags/gp.png +0 -0
  95. data/app/assets/images/lit/famfamfam_flags/gq.png +0 -0
  96. data/app/assets/images/lit/famfamfam_flags/gr.png +0 -0
  97. data/app/assets/images/lit/famfamfam_flags/gs.png +0 -0
  98. data/app/assets/images/lit/famfamfam_flags/gt.png +0 -0
  99. data/app/assets/images/lit/famfamfam_flags/gu.png +0 -0
  100. data/app/assets/images/lit/famfamfam_flags/gw.png +0 -0
  101. data/app/assets/images/lit/famfamfam_flags/gy.png +0 -0
  102. data/app/assets/images/lit/famfamfam_flags/hk.png +0 -0
  103. data/app/assets/images/lit/famfamfam_flags/hm.png +0 -0
  104. data/app/assets/images/lit/famfamfam_flags/hn.png +0 -0
  105. data/app/assets/images/lit/famfamfam_flags/hr.png +0 -0
  106. data/app/assets/images/lit/famfamfam_flags/ht.png +0 -0
  107. data/app/assets/images/lit/famfamfam_flags/hu.png +0 -0
  108. data/app/assets/images/lit/famfamfam_flags/id.png +0 -0
  109. data/app/assets/images/lit/famfamfam_flags/ie.png +0 -0
  110. data/app/assets/images/lit/famfamfam_flags/il.png +0 -0
  111. data/app/assets/images/lit/famfamfam_flags/in.png +0 -0
  112. data/app/assets/images/lit/famfamfam_flags/io.png +0 -0
  113. data/app/assets/images/lit/famfamfam_flags/iq.png +0 -0
  114. data/app/assets/images/lit/famfamfam_flags/ir.png +0 -0
  115. data/app/assets/images/lit/famfamfam_flags/is.png +0 -0
  116. data/app/assets/images/lit/famfamfam_flags/it.png +0 -0
  117. data/app/assets/images/lit/famfamfam_flags/ja.png +0 -0
  118. data/app/assets/images/lit/famfamfam_flags/jm.png +0 -0
  119. data/app/assets/images/lit/famfamfam_flags/jo.png +0 -0
  120. data/app/assets/images/lit/famfamfam_flags/jp.png +0 -0
  121. data/app/assets/images/lit/famfamfam_flags/ke.png +0 -0
  122. data/app/assets/images/lit/famfamfam_flags/kg.png +0 -0
  123. data/app/assets/images/lit/famfamfam_flags/kh.png +0 -0
  124. data/app/assets/images/lit/famfamfam_flags/ki.png +0 -0
  125. data/app/assets/images/lit/famfamfam_flags/km.png +0 -0
  126. data/app/assets/images/lit/famfamfam_flags/kn.png +0 -0
  127. data/app/assets/images/lit/famfamfam_flags/kp.png +0 -0
  128. data/app/assets/images/lit/famfamfam_flags/kr.png +0 -0
  129. data/app/assets/images/lit/famfamfam_flags/kw.png +0 -0
  130. data/app/assets/images/lit/famfamfam_flags/ky.png +0 -0
  131. data/app/assets/images/lit/famfamfam_flags/kz.png +0 -0
  132. data/app/assets/images/lit/famfamfam_flags/la.png +0 -0
  133. data/app/assets/images/lit/famfamfam_flags/lb.png +0 -0
  134. data/app/assets/images/lit/famfamfam_flags/lc.png +0 -0
  135. data/app/assets/images/lit/famfamfam_flags/li.png +0 -0
  136. data/app/assets/images/lit/famfamfam_flags/lk.png +0 -0
  137. data/app/assets/images/lit/famfamfam_flags/lr.png +0 -0
  138. data/app/assets/images/lit/famfamfam_flags/ls.png +0 -0
  139. data/app/assets/images/lit/famfamfam_flags/lt.png +0 -0
  140. data/app/assets/images/lit/famfamfam_flags/lu.png +0 -0
  141. data/app/assets/images/lit/famfamfam_flags/lv.png +0 -0
  142. data/app/assets/images/lit/famfamfam_flags/ly.png +0 -0
  143. data/app/assets/images/lit/famfamfam_flags/ma.png +0 -0
  144. data/app/assets/images/lit/famfamfam_flags/mc.png +0 -0
  145. data/app/assets/images/lit/famfamfam_flags/md.png +0 -0
  146. data/app/assets/images/lit/famfamfam_flags/me.png +0 -0
  147. data/app/assets/images/lit/famfamfam_flags/mg.png +0 -0
  148. data/app/assets/images/lit/famfamfam_flags/mh.png +0 -0
  149. data/app/assets/images/lit/famfamfam_flags/mk.png +0 -0
  150. data/app/assets/images/lit/famfamfam_flags/ml.png +0 -0
  151. data/app/assets/images/lit/famfamfam_flags/mm.png +0 -0
  152. data/app/assets/images/lit/famfamfam_flags/mn.png +0 -0
  153. data/app/assets/images/lit/famfamfam_flags/mo.png +0 -0
  154. data/app/assets/images/lit/famfamfam_flags/mp.png +0 -0
  155. data/app/assets/images/lit/famfamfam_flags/mq.png +0 -0
  156. data/app/assets/images/lit/famfamfam_flags/mr.png +0 -0
  157. data/app/assets/images/lit/famfamfam_flags/ms.png +0 -0
  158. data/app/assets/images/lit/famfamfam_flags/mt.png +0 -0
  159. data/app/assets/images/lit/famfamfam_flags/mu.png +0 -0
  160. data/app/assets/images/lit/famfamfam_flags/mv.png +0 -0
  161. data/app/assets/images/lit/famfamfam_flags/mw.png +0 -0
  162. data/app/assets/images/lit/famfamfam_flags/mx.png +0 -0
  163. data/app/assets/images/lit/famfamfam_flags/my.png +0 -0
  164. data/app/assets/images/lit/famfamfam_flags/mz.png +0 -0
  165. data/app/assets/images/lit/famfamfam_flags/na.png +0 -0
  166. data/app/assets/images/lit/famfamfam_flags/nc.png +0 -0
  167. data/app/assets/images/lit/famfamfam_flags/ne.png +0 -0
  168. data/app/assets/images/lit/famfamfam_flags/nf.png +0 -0
  169. data/app/assets/images/lit/famfamfam_flags/ng.png +0 -0
  170. data/app/assets/images/lit/famfamfam_flags/ni.png +0 -0
  171. data/app/assets/images/lit/famfamfam_flags/nl.png +0 -0
  172. data/app/assets/images/lit/famfamfam_flags/no.png +0 -0
  173. data/app/assets/images/lit/famfamfam_flags/np.png +0 -0
  174. data/app/assets/images/lit/famfamfam_flags/nr.png +0 -0
  175. data/app/assets/images/lit/famfamfam_flags/nu.png +0 -0
  176. data/app/assets/images/lit/famfamfam_flags/nz.png +0 -0
  177. data/app/assets/images/lit/famfamfam_flags/om.png +0 -0
  178. data/app/assets/images/lit/famfamfam_flags/pa.png +0 -0
  179. data/app/assets/images/lit/famfamfam_flags/pe.png +0 -0
  180. data/app/assets/images/lit/famfamfam_flags/pf.png +0 -0
  181. data/app/assets/images/lit/famfamfam_flags/pg.png +0 -0
  182. data/app/assets/images/lit/famfamfam_flags/ph.png +0 -0
  183. data/app/assets/images/lit/famfamfam_flags/pk.png +0 -0
  184. data/app/assets/images/lit/famfamfam_flags/pl.png +0 -0
  185. data/app/assets/images/lit/famfamfam_flags/pm.png +0 -0
  186. data/app/assets/images/lit/famfamfam_flags/pn.png +0 -0
  187. data/app/assets/images/lit/famfamfam_flags/pr.png +0 -0
  188. data/app/assets/images/lit/famfamfam_flags/ps.png +0 -0
  189. data/app/assets/images/lit/famfamfam_flags/pt.png +0 -0
  190. data/app/assets/images/lit/famfamfam_flags/pw.png +0 -0
  191. data/app/assets/images/lit/famfamfam_flags/py.png +0 -0
  192. data/app/assets/images/lit/famfamfam_flags/qa.png +0 -0
  193. data/app/assets/images/lit/famfamfam_flags/re.png +0 -0
  194. data/app/assets/images/lit/famfamfam_flags/ro.png +0 -0
  195. data/app/assets/images/lit/famfamfam_flags/rs.png +0 -0
  196. data/app/assets/images/lit/famfamfam_flags/ru.png +0 -0
  197. data/app/assets/images/lit/famfamfam_flags/rw.png +0 -0
  198. data/app/assets/images/lit/famfamfam_flags/sa.png +0 -0
  199. data/app/assets/images/lit/famfamfam_flags/sb.png +0 -0
  200. data/app/assets/images/lit/famfamfam_flags/sc.png +0 -0
  201. data/app/assets/images/lit/famfamfam_flags/scotland.png +0 -0
  202. data/app/assets/images/lit/famfamfam_flags/sd.png +0 -0
  203. data/app/assets/images/lit/famfamfam_flags/se.png +0 -0
  204. data/app/assets/images/lit/famfamfam_flags/sg.png +0 -0
  205. data/app/assets/images/lit/famfamfam_flags/sh.png +0 -0
  206. data/app/assets/images/lit/famfamfam_flags/si.png +0 -0
  207. data/app/assets/images/lit/famfamfam_flags/sj.png +0 -0
  208. data/app/assets/images/lit/famfamfam_flags/sk.png +0 -0
  209. data/app/assets/images/lit/famfamfam_flags/sl.png +0 -0
  210. data/app/assets/images/lit/famfamfam_flags/sm.png +0 -0
  211. data/app/assets/images/lit/famfamfam_flags/sn.png +0 -0
  212. data/app/assets/images/lit/famfamfam_flags/so.png +0 -0
  213. data/app/assets/images/lit/famfamfam_flags/sr.png +0 -0
  214. data/app/assets/images/lit/famfamfam_flags/st.png +0 -0
  215. data/app/assets/images/lit/famfamfam_flags/sv.png +0 -0
  216. data/app/assets/images/lit/famfamfam_flags/sy.png +0 -0
  217. data/app/assets/images/lit/famfamfam_flags/sz.png +0 -0
  218. data/app/assets/images/lit/famfamfam_flags/tc.png +0 -0
  219. data/app/assets/images/lit/famfamfam_flags/td.png +0 -0
  220. data/app/assets/images/lit/famfamfam_flags/tf.png +0 -0
  221. data/app/assets/images/lit/famfamfam_flags/tg.png +0 -0
  222. data/app/assets/images/lit/famfamfam_flags/th.png +0 -0
  223. data/app/assets/images/lit/famfamfam_flags/tj.png +0 -0
  224. data/app/assets/images/lit/famfamfam_flags/tk.png +0 -0
  225. data/app/assets/images/lit/famfamfam_flags/tl.png +0 -0
  226. data/app/assets/images/lit/famfamfam_flags/tm.png +0 -0
  227. data/app/assets/images/lit/famfamfam_flags/tn.png +0 -0
  228. data/app/assets/images/lit/famfamfam_flags/to.png +0 -0
  229. data/app/assets/images/lit/famfamfam_flags/tr.png +0 -0
  230. data/app/assets/images/lit/famfamfam_flags/tt.png +0 -0
  231. data/app/assets/images/lit/famfamfam_flags/tv.png +0 -0
  232. data/app/assets/images/lit/famfamfam_flags/tw.png +0 -0
  233. data/app/assets/images/lit/famfamfam_flags/tz.png +0 -0
  234. data/app/assets/images/lit/famfamfam_flags/ua.png +0 -0
  235. data/app/assets/images/lit/famfamfam_flags/ug.png +0 -0
  236. data/app/assets/images/lit/famfamfam_flags/um.png +0 -0
  237. data/app/assets/images/lit/famfamfam_flags/us.png +0 -0
  238. data/app/assets/images/lit/famfamfam_flags/uy.png +0 -0
  239. data/app/assets/images/lit/famfamfam_flags/uz.png +0 -0
  240. data/app/assets/images/lit/famfamfam_flags/va.png +0 -0
  241. data/app/assets/images/lit/famfamfam_flags/vc.png +0 -0
  242. data/app/assets/images/lit/famfamfam_flags/ve.png +0 -0
  243. data/app/assets/images/lit/famfamfam_flags/vg.png +0 -0
  244. data/app/assets/images/lit/famfamfam_flags/vi.png +0 -0
  245. data/app/assets/images/lit/famfamfam_flags/vn.png +0 -0
  246. data/app/assets/images/lit/famfamfam_flags/vu.png +0 -0
  247. data/app/assets/images/lit/famfamfam_flags/wales.png +0 -0
  248. data/app/assets/images/lit/famfamfam_flags/wf.png +0 -0
  249. data/app/assets/images/lit/famfamfam_flags/ws.png +0 -0
  250. data/app/assets/images/lit/famfamfam_flags/ye.png +0 -0
  251. data/app/assets/images/lit/famfamfam_flags/yt.png +0 -0
  252. data/app/assets/images/lit/famfamfam_flags/za.png +0 -0
  253. data/app/assets/images/lit/famfamfam_flags/zm.png +0 -0
  254. data/app/assets/images/lit/famfamfam_flags/zw.png +0 -0
  255. data/app/assets/images/lit/jquery-te.png +0 -0
  256. data/app/assets/javascripts/lit/application.js +19 -0
  257. data/app/assets/javascripts/lit/backend/bootstrap.js.coffee +4 -0
  258. data/app/assets/javascripts/lit/backend/dashboard.js +2 -0
  259. data/app/assets/javascripts/lit/backend/jquery-te-1.4.0.min.js +9 -0
  260. data/app/assets/javascripts/lit/backend/localizations.js.coffee +26 -0
  261. data/app/assets/javascripts/lit/backend/sources.js.coffee +24 -0
  262. data/app/assets/javascripts/lit/lit_frontend.js +103 -0
  263. data/app/assets/javascripts/lit/mousetrap.js +1044 -0
  264. data/app/assets/stylesheets/lit/application.css +59 -0
  265. data/app/assets/stylesheets/lit/backend/jquery-te-1.4.0.css.scss +457 -0
  266. data/app/assets/stylesheets/lit/lit_frontend.css +86 -0
  267. data/app/controllers/lit/api/v1/base_controller.rb +19 -0
  268. data/app/controllers/lit/api/v1/locales_controller.rb +14 -0
  269. data/app/controllers/lit/api/v1/localization_keys_controller.rb +15 -0
  270. data/app/controllers/lit/api/v1/localizations_controller.rb +18 -0
  271. data/app/controllers/lit/application_controller.rb +49 -0
  272. data/app/controllers/lit/concerns/request_info_store.rb +16 -0
  273. data/app/controllers/lit/concerns/request_keys_store.rb +16 -0
  274. data/app/controllers/lit/dashboard_controller.rb +9 -0
  275. data/app/controllers/lit/incomming_localizations_controller.rb +49 -0
  276. data/app/controllers/lit/locales_controller.rb +31 -0
  277. data/app/controllers/lit/localization_keys_controller.rb +117 -0
  278. data/app/controllers/lit/localizations_controller.rb +60 -0
  279. data/app/controllers/lit/sources_controller.rb +77 -0
  280. data/app/helpers/lit/application_helper.rb +4 -0
  281. data/app/helpers/lit/dashboard_helper.rb +4 -0
  282. data/app/helpers/lit/frontend_helper.rb +71 -0
  283. data/app/helpers/lit/localization_keys_helper.rb +5 -0
  284. data/app/helpers/lit/localizations_helper.rb +15 -0
  285. data/app/helpers/lit/sources_helper.rb +7 -0
  286. data/app/jobs/lit/synchronize_source_job.rb +11 -0
  287. data/app/models/lit/incomming_localization.rb +77 -0
  288. data/app/models/lit/locale.rb +48 -0
  289. data/app/models/lit/localization.rb +103 -0
  290. data/app/models/lit/localization_key.rb +107 -0
  291. data/app/models/lit/localization_version.rb +12 -0
  292. data/app/models/lit/source.rb +111 -0
  293. data/app/views/kaminari/lit/_first_page.html.erb +5 -0
  294. data/app/views/kaminari/lit/_gap.html.erb +3 -0
  295. data/app/views/kaminari/lit/_last_page.html.erb +6 -0
  296. data/app/views/kaminari/lit/_next_page.html.erb +5 -0
  297. data/app/views/kaminari/lit/_page.html.erb +3 -0
  298. data/app/views/kaminari/lit/_paginator.html.erb +17 -0
  299. data/app/views/kaminari/lit/_prev_page.html.erb +5 -0
  300. data/app/views/layouts/lit/_messages.html.erb +6 -0
  301. data/app/views/layouts/lit/_navigation.html.erb +23 -0
  302. data/app/views/layouts/lit/application.html.erb +46 -0
  303. data/app/views/lit/dashboard/index.html.erb +5 -0
  304. data/app/views/lit/incomming_localizations/accept.js.erb +2 -0
  305. data/app/views/lit/incomming_localizations/destroy.js.erb +1 -0
  306. data/app/views/lit/incomming_localizations/index.html.erb +52 -0
  307. data/app/views/lit/locales/_hide_link.html.erb +1 -0
  308. data/app/views/lit/locales/hide.js.erb +1 -0
  309. data/app/views/lit/locales/index.html.erb +20 -0
  310. data/app/views/lit/localization_keys/_localization_row.html.erb +14 -0
  311. data/app/views/lit/localization_keys/destroy.js.erb +1 -0
  312. data/app/views/lit/localization_keys/index.html.erb +127 -0
  313. data/app/views/lit/localization_keys/star.js.erb +1 -0
  314. data/app/views/lit/localizations/_form.html.erb +23 -0
  315. data/app/views/lit/localizations/_previous_versions_rows.html.erb +15 -0
  316. data/app/views/lit/localizations/edit.js.erb +7 -0
  317. data/app/views/lit/localizations/previous_versions.js.erb +3 -0
  318. data/app/views/lit/localizations/update.js.erb +4 -0
  319. data/app/views/lit/sources/_form.html.erb +35 -0
  320. data/app/views/lit/sources/edit.html.erb +6 -0
  321. data/app/views/lit/sources/index.html.erb +42 -0
  322. data/app/views/lit/sources/new.html.erb +5 -0
  323. data/app/views/lit/sources/show.html.erb +19 -0
  324. data/config/routes.rb +49 -0
  325. data/db/migrate/20180101010101_lit_create_lit_locales.rb +16 -0
  326. data/db/migrate/20180101010102_lit_create_lit_localization_keys.rb +18 -0
  327. data/db/migrate/20180101010103_lit_create_lit_localizations.rb +24 -0
  328. data/db/migrate/20180101010104_lit_add_is_completed_and_is_starred_to_localization_keys.rb +17 -0
  329. data/db/migrate/20180101010105_lit_add_is_hidden_to_locales.rb +12 -0
  330. data/db/migrate/20180101010106_lit_create_lit_localization_versions.rb +20 -0
  331. data/db/migrate/20180101010107_lit_create_lit_sources.rb +19 -0
  332. data/db/migrate/20180101010108_lit_create_lit_incomming_localizations.rb +34 -0
  333. data/db/migrate/20180101010109_lit_add_sync_complete_to_lit_sources.rb +12 -0
  334. data/lib/generators/lit/install/templates/initializer.rb +52 -0
  335. data/lib/generators/lit/install_generator.rb +66 -0
  336. data/lib/lit.rb +65 -0
  337. data/lib/lit/adapters/hash_storage.rb +12 -0
  338. data/lib/lit/adapters/redis_storage.rb +99 -0
  339. data/lib/lit/cache.rb +356 -0
  340. data/lib/lit/engine.rb +28 -0
  341. data/lib/lit/i18n_backend.rb +192 -0
  342. data/lib/lit/loader.rb +16 -0
  343. data/lib/lit/rails.rb +17 -0
  344. data/lib/lit/railtie.rb +12 -0
  345. data/lib/lit/version.rb +3 -0
  346. data/lib/tasks/lit_tasks.rake +29 -0
  347. 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,4 @@
1
+ module Lit
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Lit
2
+ module DashboardHelper
3
+ end
4
+ 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,5 @@
1
+ module Lit
2
+ module LocalizationKeysHelper
3
+ include LocalizationsHelper
4
+ end
5
+ 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,7 @@
1
+ module Lit
2
+ module SourcesHelper
3
+ def source_loading_class(source)
4
+ source.sync_complete ? 'loaded' : 'loading'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module Lit
2
+ if defined?(::ActiveJob)
3
+ class SynchronizeSourceJob < ::ActiveJob::Base
4
+ queue_as :default
5
+
6
+ def perform(source)
7
+ source.synchronize
8
+ end
9
+ end
10
+ end
11
+ 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