lit 1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (297) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -5
  3. data/app/assets/javascripts/lit/backend/bootstrap.min.js +7 -0
  4. data/app/assets/javascripts/lit/backend/localizations.js.coffee +13 -6
  5. data/app/assets/stylesheets/lit/application.css +16 -13
  6. data/app/controllers/lit/api/v1/localizations_controller.rb +12 -15
  7. data/app/controllers/lit/cloud_translations_controller.rb +1 -1
  8. data/app/controllers/lit/concerns/request_info_store.rb +16 -10
  9. data/app/controllers/lit/concerns/request_keys_store.rb +17 -10
  10. data/app/controllers/lit/localization_keys_controller.rb +40 -34
  11. data/app/controllers/lit/localizations_controller.rb +1 -1
  12. data/app/controllers/lit/sources_controller.rb +1 -1
  13. data/app/helpers/lit/frontend_helper.rb +1 -1
  14. data/app/helpers/lit/localizations_helper.rb +9 -0
  15. data/app/models/lit/base.rb +33 -17
  16. data/app/models/lit/incomming_localization.rb +13 -27
  17. data/app/models/lit/localization.rb +6 -14
  18. data/app/services/remote_interactor_service.rb +3 -1
  19. data/app/services/synchronize_source_service.rb +4 -8
  20. data/app/views/layouts/lit/application.html.erb +0 -1
  21. data/app/views/lit/dashboard/index.html.erb +1 -1
  22. data/app/views/lit/incomming_localizations/index.html.erb +1 -1
  23. data/app/views/lit/localization_keys/_localizations_list.html.erb +19 -11
  24. data/app/views/lit/localization_keys/batch_touch.js.erb +1 -0
  25. data/app/views/lit/localization_keys/index.html.erb +2 -0
  26. data/app/views/lit/localization_keys/not_translated.html.erb +2 -0
  27. data/app/views/lit/localization_keys/visited_again.html.erb +3 -0
  28. data/app/views/lit/localizations/update.js.erb +1 -1
  29. data/config/routes.rb +1 -0
  30. data/lib/generators/lit/install/templates/initializer.rb +6 -3
  31. data/lib/lit.rb +19 -6
  32. data/lib/lit/adapters/hash_storage.rb +35 -1
  33. data/lib/lit/adapters/redis_storage.rb +42 -7
  34. data/lib/lit/cache.rb +66 -10
  35. data/lib/lit/cloud_translation/providers/google.rb +2 -0
  36. data/lib/lit/cloud_translation/providers/yandex.rb +2 -0
  37. data/lib/lit/engine.rb +12 -5
  38. data/lib/lit/export.rb +2 -18
  39. data/lib/lit/i18n_backend.rb +20 -7
  40. data/lib/lit/import.rb +18 -15
  41. data/lib/lit/loader.rb +1 -0
  42. data/lib/lit/middleware.rb +29 -0
  43. data/lib/lit/rails.rb +1 -0
  44. data/lib/lit/railtie.rb +6 -7
  45. data/lib/lit/services/localization_keys_to_hash_service.rb +23 -0
  46. data/lib/lit/version.rb +1 -1
  47. metadata +30 -263
  48. data/app/assets/images/lit/famfamfam_flags/ad.png +0 -0
  49. data/app/assets/images/lit/famfamfam_flags/ae.png +0 -0
  50. data/app/assets/images/lit/famfamfam_flags/af.png +0 -0
  51. data/app/assets/images/lit/famfamfam_flags/ag.png +0 -0
  52. data/app/assets/images/lit/famfamfam_flags/ai.png +0 -0
  53. data/app/assets/images/lit/famfamfam_flags/al.png +0 -0
  54. data/app/assets/images/lit/famfamfam_flags/am.png +0 -0
  55. data/app/assets/images/lit/famfamfam_flags/an.png +0 -0
  56. data/app/assets/images/lit/famfamfam_flags/ao.png +0 -0
  57. data/app/assets/images/lit/famfamfam_flags/ar.png +0 -0
  58. data/app/assets/images/lit/famfamfam_flags/as.png +0 -0
  59. data/app/assets/images/lit/famfamfam_flags/at.png +0 -0
  60. data/app/assets/images/lit/famfamfam_flags/au.png +0 -0
  61. data/app/assets/images/lit/famfamfam_flags/aw.png +0 -0
  62. data/app/assets/images/lit/famfamfam_flags/ax.png +0 -0
  63. data/app/assets/images/lit/famfamfam_flags/az.png +0 -0
  64. data/app/assets/images/lit/famfamfam_flags/ba.png +0 -0
  65. data/app/assets/images/lit/famfamfam_flags/bb.png +0 -0
  66. data/app/assets/images/lit/famfamfam_flags/bd.png +0 -0
  67. data/app/assets/images/lit/famfamfam_flags/be.png +0 -0
  68. data/app/assets/images/lit/famfamfam_flags/bf.png +0 -0
  69. data/app/assets/images/lit/famfamfam_flags/bg.png +0 -0
  70. data/app/assets/images/lit/famfamfam_flags/bh.png +0 -0
  71. data/app/assets/images/lit/famfamfam_flags/bi.png +0 -0
  72. data/app/assets/images/lit/famfamfam_flags/bj.png +0 -0
  73. data/app/assets/images/lit/famfamfam_flags/bm.png +0 -0
  74. data/app/assets/images/lit/famfamfam_flags/bn.png +0 -0
  75. data/app/assets/images/lit/famfamfam_flags/bo.png +0 -0
  76. data/app/assets/images/lit/famfamfam_flags/br.png +0 -0
  77. data/app/assets/images/lit/famfamfam_flags/bs.png +0 -0
  78. data/app/assets/images/lit/famfamfam_flags/bt.png +0 -0
  79. data/app/assets/images/lit/famfamfam_flags/bv.png +0 -0
  80. data/app/assets/images/lit/famfamfam_flags/bw.png +0 -0
  81. data/app/assets/images/lit/famfamfam_flags/by.png +0 -0
  82. data/app/assets/images/lit/famfamfam_flags/bz.png +0 -0
  83. data/app/assets/images/lit/famfamfam_flags/ca.png +0 -0
  84. data/app/assets/images/lit/famfamfam_flags/catalonia.png +0 -0
  85. data/app/assets/images/lit/famfamfam_flags/cc.png +0 -0
  86. data/app/assets/images/lit/famfamfam_flags/cd.png +0 -0
  87. data/app/assets/images/lit/famfamfam_flags/cf.png +0 -0
  88. data/app/assets/images/lit/famfamfam_flags/cg.png +0 -0
  89. data/app/assets/images/lit/famfamfam_flags/ch.png +0 -0
  90. data/app/assets/images/lit/famfamfam_flags/ci.png +0 -0
  91. data/app/assets/images/lit/famfamfam_flags/ck.png +0 -0
  92. data/app/assets/images/lit/famfamfam_flags/cl.png +0 -0
  93. data/app/assets/images/lit/famfamfam_flags/cm.png +0 -0
  94. data/app/assets/images/lit/famfamfam_flags/cn.png +0 -0
  95. data/app/assets/images/lit/famfamfam_flags/co.png +0 -0
  96. data/app/assets/images/lit/famfamfam_flags/cr.png +0 -0
  97. data/app/assets/images/lit/famfamfam_flags/cs.png +0 -0
  98. data/app/assets/images/lit/famfamfam_flags/cu.png +0 -0
  99. data/app/assets/images/lit/famfamfam_flags/cv.png +0 -0
  100. data/app/assets/images/lit/famfamfam_flags/cx.png +0 -0
  101. data/app/assets/images/lit/famfamfam_flags/cy.png +0 -0
  102. data/app/assets/images/lit/famfamfam_flags/cz.png +0 -0
  103. data/app/assets/images/lit/famfamfam_flags/da.png +0 -0
  104. data/app/assets/images/lit/famfamfam_flags/de.png +0 -0
  105. data/app/assets/images/lit/famfamfam_flags/dj.png +0 -0
  106. data/app/assets/images/lit/famfamfam_flags/dk.png +0 -0
  107. data/app/assets/images/lit/famfamfam_flags/dm.png +0 -0
  108. data/app/assets/images/lit/famfamfam_flags/do.png +0 -0
  109. data/app/assets/images/lit/famfamfam_flags/dz.png +0 -0
  110. data/app/assets/images/lit/famfamfam_flags/ec.png +0 -0
  111. data/app/assets/images/lit/famfamfam_flags/ee.png +0 -0
  112. data/app/assets/images/lit/famfamfam_flags/eg.png +0 -0
  113. data/app/assets/images/lit/famfamfam_flags/eh.png +0 -0
  114. data/app/assets/images/lit/famfamfam_flags/en.png +0 -0
  115. data/app/assets/images/lit/famfamfam_flags/england.png +0 -0
  116. data/app/assets/images/lit/famfamfam_flags/er.png +0 -0
  117. data/app/assets/images/lit/famfamfam_flags/es.png +0 -0
  118. data/app/assets/images/lit/famfamfam_flags/et.png +0 -0
  119. data/app/assets/images/lit/famfamfam_flags/europeanunion.png +0 -0
  120. data/app/assets/images/lit/famfamfam_flags/fam.png +0 -0
  121. data/app/assets/images/lit/famfamfam_flags/fi.png +0 -0
  122. data/app/assets/images/lit/famfamfam_flags/fj.png +0 -0
  123. data/app/assets/images/lit/famfamfam_flags/fk.png +0 -0
  124. data/app/assets/images/lit/famfamfam_flags/fm.png +0 -0
  125. data/app/assets/images/lit/famfamfam_flags/fo.png +0 -0
  126. data/app/assets/images/lit/famfamfam_flags/fr.png +0 -0
  127. data/app/assets/images/lit/famfamfam_flags/ga.png +0 -0
  128. data/app/assets/images/lit/famfamfam_flags/gb.png +0 -0
  129. data/app/assets/images/lit/famfamfam_flags/gd.png +0 -0
  130. data/app/assets/images/lit/famfamfam_flags/ge.png +0 -0
  131. data/app/assets/images/lit/famfamfam_flags/gf.png +0 -0
  132. data/app/assets/images/lit/famfamfam_flags/gh.png +0 -0
  133. data/app/assets/images/lit/famfamfam_flags/gi.png +0 -0
  134. data/app/assets/images/lit/famfamfam_flags/gl.png +0 -0
  135. data/app/assets/images/lit/famfamfam_flags/gm.png +0 -0
  136. data/app/assets/images/lit/famfamfam_flags/gn.png +0 -0
  137. data/app/assets/images/lit/famfamfam_flags/gp.png +0 -0
  138. data/app/assets/images/lit/famfamfam_flags/gq.png +0 -0
  139. data/app/assets/images/lit/famfamfam_flags/gr.png +0 -0
  140. data/app/assets/images/lit/famfamfam_flags/gs.png +0 -0
  141. data/app/assets/images/lit/famfamfam_flags/gt.png +0 -0
  142. data/app/assets/images/lit/famfamfam_flags/gu.png +0 -0
  143. data/app/assets/images/lit/famfamfam_flags/gw.png +0 -0
  144. data/app/assets/images/lit/famfamfam_flags/gy.png +0 -0
  145. data/app/assets/images/lit/famfamfam_flags/hk.png +0 -0
  146. data/app/assets/images/lit/famfamfam_flags/hm.png +0 -0
  147. data/app/assets/images/lit/famfamfam_flags/hn.png +0 -0
  148. data/app/assets/images/lit/famfamfam_flags/hr.png +0 -0
  149. data/app/assets/images/lit/famfamfam_flags/ht.png +0 -0
  150. data/app/assets/images/lit/famfamfam_flags/hu.png +0 -0
  151. data/app/assets/images/lit/famfamfam_flags/id.png +0 -0
  152. data/app/assets/images/lit/famfamfam_flags/ie.png +0 -0
  153. data/app/assets/images/lit/famfamfam_flags/il.png +0 -0
  154. data/app/assets/images/lit/famfamfam_flags/in.png +0 -0
  155. data/app/assets/images/lit/famfamfam_flags/io.png +0 -0
  156. data/app/assets/images/lit/famfamfam_flags/iq.png +0 -0
  157. data/app/assets/images/lit/famfamfam_flags/ir.png +0 -0
  158. data/app/assets/images/lit/famfamfam_flags/is.png +0 -0
  159. data/app/assets/images/lit/famfamfam_flags/it.png +0 -0
  160. data/app/assets/images/lit/famfamfam_flags/ja.png +0 -0
  161. data/app/assets/images/lit/famfamfam_flags/jm.png +0 -0
  162. data/app/assets/images/lit/famfamfam_flags/jo.png +0 -0
  163. data/app/assets/images/lit/famfamfam_flags/jp.png +0 -0
  164. data/app/assets/images/lit/famfamfam_flags/ke.png +0 -0
  165. data/app/assets/images/lit/famfamfam_flags/kg.png +0 -0
  166. data/app/assets/images/lit/famfamfam_flags/kh.png +0 -0
  167. data/app/assets/images/lit/famfamfam_flags/ki.png +0 -0
  168. data/app/assets/images/lit/famfamfam_flags/km.png +0 -0
  169. data/app/assets/images/lit/famfamfam_flags/kn.png +0 -0
  170. data/app/assets/images/lit/famfamfam_flags/kp.png +0 -0
  171. data/app/assets/images/lit/famfamfam_flags/kr.png +0 -0
  172. data/app/assets/images/lit/famfamfam_flags/kw.png +0 -0
  173. data/app/assets/images/lit/famfamfam_flags/ky.png +0 -0
  174. data/app/assets/images/lit/famfamfam_flags/kz.png +0 -0
  175. data/app/assets/images/lit/famfamfam_flags/la.png +0 -0
  176. data/app/assets/images/lit/famfamfam_flags/lb.png +0 -0
  177. data/app/assets/images/lit/famfamfam_flags/lc.png +0 -0
  178. data/app/assets/images/lit/famfamfam_flags/li.png +0 -0
  179. data/app/assets/images/lit/famfamfam_flags/lk.png +0 -0
  180. data/app/assets/images/lit/famfamfam_flags/lr.png +0 -0
  181. data/app/assets/images/lit/famfamfam_flags/ls.png +0 -0
  182. data/app/assets/images/lit/famfamfam_flags/lt.png +0 -0
  183. data/app/assets/images/lit/famfamfam_flags/lu.png +0 -0
  184. data/app/assets/images/lit/famfamfam_flags/lv.png +0 -0
  185. data/app/assets/images/lit/famfamfam_flags/ly.png +0 -0
  186. data/app/assets/images/lit/famfamfam_flags/ma.png +0 -0
  187. data/app/assets/images/lit/famfamfam_flags/mc.png +0 -0
  188. data/app/assets/images/lit/famfamfam_flags/md.png +0 -0
  189. data/app/assets/images/lit/famfamfam_flags/me.png +0 -0
  190. data/app/assets/images/lit/famfamfam_flags/mg.png +0 -0
  191. data/app/assets/images/lit/famfamfam_flags/mh.png +0 -0
  192. data/app/assets/images/lit/famfamfam_flags/mk.png +0 -0
  193. data/app/assets/images/lit/famfamfam_flags/ml.png +0 -0
  194. data/app/assets/images/lit/famfamfam_flags/mm.png +0 -0
  195. data/app/assets/images/lit/famfamfam_flags/mn.png +0 -0
  196. data/app/assets/images/lit/famfamfam_flags/mo.png +0 -0
  197. data/app/assets/images/lit/famfamfam_flags/mp.png +0 -0
  198. data/app/assets/images/lit/famfamfam_flags/mq.png +0 -0
  199. data/app/assets/images/lit/famfamfam_flags/mr.png +0 -0
  200. data/app/assets/images/lit/famfamfam_flags/ms.png +0 -0
  201. data/app/assets/images/lit/famfamfam_flags/mt.png +0 -0
  202. data/app/assets/images/lit/famfamfam_flags/mu.png +0 -0
  203. data/app/assets/images/lit/famfamfam_flags/mv.png +0 -0
  204. data/app/assets/images/lit/famfamfam_flags/mw.png +0 -0
  205. data/app/assets/images/lit/famfamfam_flags/mx.png +0 -0
  206. data/app/assets/images/lit/famfamfam_flags/my.png +0 -0
  207. data/app/assets/images/lit/famfamfam_flags/mz.png +0 -0
  208. data/app/assets/images/lit/famfamfam_flags/na.png +0 -0
  209. data/app/assets/images/lit/famfamfam_flags/nc.png +0 -0
  210. data/app/assets/images/lit/famfamfam_flags/ne.png +0 -0
  211. data/app/assets/images/lit/famfamfam_flags/nf.png +0 -0
  212. data/app/assets/images/lit/famfamfam_flags/ng.png +0 -0
  213. data/app/assets/images/lit/famfamfam_flags/ni.png +0 -0
  214. data/app/assets/images/lit/famfamfam_flags/nl.png +0 -0
  215. data/app/assets/images/lit/famfamfam_flags/no.png +0 -0
  216. data/app/assets/images/lit/famfamfam_flags/np.png +0 -0
  217. data/app/assets/images/lit/famfamfam_flags/nr.png +0 -0
  218. data/app/assets/images/lit/famfamfam_flags/nu.png +0 -0
  219. data/app/assets/images/lit/famfamfam_flags/nz.png +0 -0
  220. data/app/assets/images/lit/famfamfam_flags/om.png +0 -0
  221. data/app/assets/images/lit/famfamfam_flags/pa.png +0 -0
  222. data/app/assets/images/lit/famfamfam_flags/pe.png +0 -0
  223. data/app/assets/images/lit/famfamfam_flags/pf.png +0 -0
  224. data/app/assets/images/lit/famfamfam_flags/pg.png +0 -0
  225. data/app/assets/images/lit/famfamfam_flags/ph.png +0 -0
  226. data/app/assets/images/lit/famfamfam_flags/pk.png +0 -0
  227. data/app/assets/images/lit/famfamfam_flags/pl.png +0 -0
  228. data/app/assets/images/lit/famfamfam_flags/pm.png +0 -0
  229. data/app/assets/images/lit/famfamfam_flags/pn.png +0 -0
  230. data/app/assets/images/lit/famfamfam_flags/pr.png +0 -0
  231. data/app/assets/images/lit/famfamfam_flags/ps.png +0 -0
  232. data/app/assets/images/lit/famfamfam_flags/pt.png +0 -0
  233. data/app/assets/images/lit/famfamfam_flags/pw.png +0 -0
  234. data/app/assets/images/lit/famfamfam_flags/py.png +0 -0
  235. data/app/assets/images/lit/famfamfam_flags/qa.png +0 -0
  236. data/app/assets/images/lit/famfamfam_flags/re.png +0 -0
  237. data/app/assets/images/lit/famfamfam_flags/ro.png +0 -0
  238. data/app/assets/images/lit/famfamfam_flags/rs.png +0 -0
  239. data/app/assets/images/lit/famfamfam_flags/ru.png +0 -0
  240. data/app/assets/images/lit/famfamfam_flags/rw.png +0 -0
  241. data/app/assets/images/lit/famfamfam_flags/sa.png +0 -0
  242. data/app/assets/images/lit/famfamfam_flags/sb.png +0 -0
  243. data/app/assets/images/lit/famfamfam_flags/sc.png +0 -0
  244. data/app/assets/images/lit/famfamfam_flags/scotland.png +0 -0
  245. data/app/assets/images/lit/famfamfam_flags/sd.png +0 -0
  246. data/app/assets/images/lit/famfamfam_flags/se.png +0 -0
  247. data/app/assets/images/lit/famfamfam_flags/sg.png +0 -0
  248. data/app/assets/images/lit/famfamfam_flags/sh.png +0 -0
  249. data/app/assets/images/lit/famfamfam_flags/si.png +0 -0
  250. data/app/assets/images/lit/famfamfam_flags/sj.png +0 -0
  251. data/app/assets/images/lit/famfamfam_flags/sk.png +0 -0
  252. data/app/assets/images/lit/famfamfam_flags/sl.png +0 -0
  253. data/app/assets/images/lit/famfamfam_flags/sm.png +0 -0
  254. data/app/assets/images/lit/famfamfam_flags/sn.png +0 -0
  255. data/app/assets/images/lit/famfamfam_flags/so.png +0 -0
  256. data/app/assets/images/lit/famfamfam_flags/sr.png +0 -0
  257. data/app/assets/images/lit/famfamfam_flags/st.png +0 -0
  258. data/app/assets/images/lit/famfamfam_flags/sv.png +0 -0
  259. data/app/assets/images/lit/famfamfam_flags/sy.png +0 -0
  260. data/app/assets/images/lit/famfamfam_flags/sz.png +0 -0
  261. data/app/assets/images/lit/famfamfam_flags/tc.png +0 -0
  262. data/app/assets/images/lit/famfamfam_flags/td.png +0 -0
  263. data/app/assets/images/lit/famfamfam_flags/tf.png +0 -0
  264. data/app/assets/images/lit/famfamfam_flags/tg.png +0 -0
  265. data/app/assets/images/lit/famfamfam_flags/th.png +0 -0
  266. data/app/assets/images/lit/famfamfam_flags/tj.png +0 -0
  267. data/app/assets/images/lit/famfamfam_flags/tk.png +0 -0
  268. data/app/assets/images/lit/famfamfam_flags/tl.png +0 -0
  269. data/app/assets/images/lit/famfamfam_flags/tm.png +0 -0
  270. data/app/assets/images/lit/famfamfam_flags/tn.png +0 -0
  271. data/app/assets/images/lit/famfamfam_flags/to.png +0 -0
  272. data/app/assets/images/lit/famfamfam_flags/tr.png +0 -0
  273. data/app/assets/images/lit/famfamfam_flags/tt.png +0 -0
  274. data/app/assets/images/lit/famfamfam_flags/tv.png +0 -0
  275. data/app/assets/images/lit/famfamfam_flags/tw.png +0 -0
  276. data/app/assets/images/lit/famfamfam_flags/tz.png +0 -0
  277. data/app/assets/images/lit/famfamfam_flags/ua.png +0 -0
  278. data/app/assets/images/lit/famfamfam_flags/ug.png +0 -0
  279. data/app/assets/images/lit/famfamfam_flags/um.png +0 -0
  280. data/app/assets/images/lit/famfamfam_flags/us.png +0 -0
  281. data/app/assets/images/lit/famfamfam_flags/uy.png +0 -0
  282. data/app/assets/images/lit/famfamfam_flags/uz.png +0 -0
  283. data/app/assets/images/lit/famfamfam_flags/va.png +0 -0
  284. data/app/assets/images/lit/famfamfam_flags/vc.png +0 -0
  285. data/app/assets/images/lit/famfamfam_flags/ve.png +0 -0
  286. data/app/assets/images/lit/famfamfam_flags/vg.png +0 -0
  287. data/app/assets/images/lit/famfamfam_flags/vi.png +0 -0
  288. data/app/assets/images/lit/famfamfam_flags/vn.png +0 -0
  289. data/app/assets/images/lit/famfamfam_flags/vu.png +0 -0
  290. data/app/assets/images/lit/famfamfam_flags/wales.png +0 -0
  291. data/app/assets/images/lit/famfamfam_flags/wf.png +0 -0
  292. data/app/assets/images/lit/famfamfam_flags/ws.png +0 -0
  293. data/app/assets/images/lit/famfamfam_flags/ye.png +0 -0
  294. data/app/assets/images/lit/famfamfam_flags/yt.png +0 -0
  295. data/app/assets/images/lit/famfamfam_flags/za.png +0 -0
  296. data/app/assets/images/lit/famfamfam_flags/zm.png +0 -0
  297. data/app/assets/images/lit/famfamfam_flags/zw.png +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab6fb4274b54171f64b3e24002ee6f2d23645ffa88cb9fb6d9bfe919b95d27bc
4
- data.tar.gz: 52a3826a8da2dae3c37c08383ebd58e2547a7214e6b2eae4b83f22cfd027c7c8
3
+ metadata.gz: 4d3b3569eb99f453aea4b65451511bdeb76680774b664ab108f445359b9e10f0
4
+ data.tar.gz: cbf55f8eefb23231f5201087e612a58172e2ce4537fc0c8211a597ebba8e5f88
5
5
  SHA512:
6
- metadata.gz: becbc8639368bad9748d0815adf579031a6beb4f79610ae9920f896e5a6d9ae6c39bd071363756d1f937578b75745eed80b4c80805caf58e221f1cdee630481d
7
- data.tar.gz: 01a66a00855eba89bbfe2057d8792d978e1435ea3a79e986463d0948d771304a96e9ebaf048000a2f2e748a529d5f56b931a04d6413d942ef327fc09bfe8097c
6
+ metadata.gz: be93a781bdea6ff7a095bd86a60fc671c5f325f6d6f37a45bfea883b549f3655c4d9d5e768b125181501b944303dccc89d3032180952f4f870a8878bc7d6816d
7
+ data.tar.gz: 8655233c8aba69f06bf775bd28df3bc7e17f81f4378dab0f8818c6fac05e22e521ef966c5ae3706dfc3f2552d747687d22c241422f51aeab1f34764bc30bd698
data/README.md CHANGED
@@ -37,10 +37,10 @@ gem 'lit'
37
37
 
38
38
  2. run `bundle install`
39
39
 
40
- 3. run installation generator `bundle exec rails g lit:install`
41
- (for production/staging environment `redis` is suggested as key value engine. `hash` will not work in multi process environment)
40
+ 3. Add `config.i18n.available_locales = [...]` to `application.rb` - it's required to precompile appropriate language flags in lit backend.
42
41
 
43
- 4. Add `config.i18n.available_locales = [...]` to `application.rb` - it's required to precompile appropriate language flags in lit backend.
42
+ 4. run installation generator `bundle exec rails g lit:install`
43
+ (for production/staging environment `redis` is suggested as key value engine. `hash` will not work in multi process environment)
44
44
 
45
45
  5. After doing above and restarting app, point your browser to `http://app/lit`
46
46
 
@@ -128,7 +128,7 @@ Lit::CloudTranslation.provider = Lit::CloudTranslation::Providers::Google
128
128
 
129
129
  ...and make sure you have this in your Gemfile:
130
130
  ```
131
- gem 'google-cloud-translate'
131
+ gem 'google-cloud-translate', '~> 1.2.4'
132
132
  ```
133
133
 
134
134
  To use translation via Google, you need to obtain a [service account key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) containing all the credentials required by the API.
@@ -145,6 +145,13 @@ These credentials can be given in three ways:
145
145
  ... # see Google docs link above for reference
146
146
  }
147
147
  end
148
+
149
+ # For example, for Rails 6, from encrypted credentials file (HashWithIndifferentAccess is used, because the keys in
150
+ the credentials.config could be strings or, as well, symbols):
151
+
152
+ Lit::CloudTranslation.configure do |config|
153
+ config.keyfile_hash = HashWithIndifferentAccess.new(Rails.application.credentials.config[:google_translate_api])
154
+ end
148
155
  ```
149
156
  * directly via `GOOGLE_TRANSLATE_API_<element>` environment variables, where e.g. the `GOOGLE_TRANSLATE_API_PROJECT_ID` variable corresponds to the `project_id` element of a JSON keyfile. Typically, only the following variables are mandatory:
150
157
  * `GOOGLE_TRANSLATE_API_PROJECT_ID`
@@ -273,7 +280,8 @@ Lit.store_request_info = true
273
280
  1. `gem install bundler && bundle install` - ensure Bundler and all required gems are installed
274
281
  2. `bundle exec appraisal install` - install gems from appraisal's gemfiles
275
282
  3. `cp test/dummy/config/database.yml.sample test/dummy/config/database.yml` - move a database.yml in place (remember to fill your DB credentials in it)
276
- 4. `RAILS_ENV=test appraisal rails-5.2 rake db:setup` - setup lit DB (see test/config/database.yml); do it only once, it does not matter which Rails version you use for `appraisal`
283
+ 4. `RAILS_ENV=test bundle exec appraisal rails-5.2 rake db:setup` - setup lit DB (see test/config/database.yml); do it
284
+ only once, it does not matter which Rails version you use for `appraisal`
277
285
  5. `bundle exec appraisal rake` - run the tests!
278
286
 
279
287
  ### License
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Bootstrap v3.0.3 (http://getbootstrap.com)
3
+ * Copyright 2013 Twitter, Inc.
4
+ * Licensed under http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+
7
+ if("undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]'),b=!0;if(a.length){var c=this.$element.find("input");"radio"===c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?b=!1:a.find(".active").removeClass("active")),b&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}b&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b),f.trigger(d=a.Event("show.bs.dropdown")),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown"),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=a("[role=menu] li:not(.divider):visible a",f);if(h.length){var i=h.index(h.filter(":focus"));38==b.keyCode&&i>0&&i--,40==b.keyCode&&i<h.length-1&&i++,~i||(i=0),h.eq(i).focus()}}}};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new f(this)),"string"==typeof b&&d[b].call(c)})},a.fn.dropdown.Constructor=f,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",e,f.prototype.toggle).on("keydown.bs.dropdown.data-api",e+", [role=menu]",f.prototype.keydown)}(jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.load(this.options.remote)};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show(),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)}))},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var d=a.support.transition&&c;if(this.$backdrop=a('<div class="modal-backdrop '+c+'" />').appendTo(document.body),this.$element.on("click.dismiss.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focus",i="hover"==g?"mouseleave":"blur";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show),void 0):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide),void 0):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this.tip();this.setContent(),this.options.animation&&c.addClass("fade");var d="function"==typeof this.options.placement?this.options.placement.call(this,c[0],this.$element[0]):this.options.placement,e=/\s?auto?\s?/i,f=e.test(d);f&&(d=d.replace(e,"")||"top"),c.detach().css({top:0,left:0,display:"block"}).addClass(d),this.options.container?c.appendTo(this.options.container):c.insertAfter(this.$element);var g=this.getPosition(),h=c[0].offsetWidth,i=c[0].offsetHeight;if(f){var j=this.$element.parent(),k=d,l=document.documentElement.scrollTop||document.body.scrollTop,m="body"==this.options.container?window.innerWidth:j.outerWidth(),n="body"==this.options.container?window.innerHeight:j.outerHeight(),o="body"==this.options.container?0:j.offset().left;d="bottom"==d&&g.top+g.height+i-l>n?"top":"top"==d&&g.top-l-i<0?"bottom":"right"==d&&g.right+h>m?"left":"left"==d&&g.left-h<o?"right":d,c.removeClass(k).addClass(d)}var p=this.getCalculatedOffset(d,g,h,i);this.applyPlacement(p,d),this.$element.trigger("shown.bs."+this.type)}},b.prototype.applyPlacement=function(a,b){var c,d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),a.top=a.top+g,a.left=a.left+h,d.offset(a).addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;if("top"==b&&j!=f&&(c=!0,a.top=a.top+f-j),/bottom|top/.test(b)){var k=0;a.left<0&&(k=-2*a.left,a.left=0,d.offset(a),i=d[0].offsetWidth,j=d[0].offsetHeight),this.replaceArrow(k-e+i,i,"left")}else this.replaceArrow(j-f,j,"top");c&&d.offset(a)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach()}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,b).emulateTransitionEnd(150):b(),this.$element.trigger("hidden.bs."+this.type),this)},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},"function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof c&&c;e||d.data("bs.tooltip",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery);
@@ -2,25 +2,32 @@
2
2
  $(document).ready ->
3
3
  $('td.localization_row[data-editing=0]').on 'click', ->
4
4
  $this = $(this)
5
- if parseInt($this.data('editing'))==0
5
+ if parseInt($this.data('editing')) == 0
6
6
  edited_rows[$this.data('id')] = $this.html()
7
7
  unless parseInt($this.data('editing'))
8
8
  $this.data('editing', '1')
9
9
  $.get $this.data('edit')
10
- $('td.localization_row').on 'click', 'form button.cancel', (e)->
10
+ $('td.localization_row').on 'click', 'form button.cancel', (e) ->
11
11
  $this = $(this)
12
- if $this[0].localName=='button'
12
+ if $this[0].localName == 'button'
13
13
  $this = $this.parents('td.localization_row')
14
14
  $this.data('editing', 0)
15
15
  $this.html edited_rows[$this.data('id')]
16
16
  e.preventDefault()
17
17
  false
18
- $('tr.localization_versions_row').on 'click', '.close_versions', (e)->
18
+ $('tr.localization_versions_row').on 'click', '.close_versions', (e) ->
19
19
  $this = $(this)
20
20
  $parent = $this.parents('tr.localization_versions_row')
21
21
  $parent.addClass('hidden')
22
22
  $parent.children('td').html('')
23
- $('tr.localization_key_row').on 'click', 'input.wysiwyg_switch', (e)->
23
+ $('tr.localization_key_row').on 'click', 'input.wysiwyg_switch', (e) ->
24
24
  $(this).parents('form').find("textarea").jqte()
25
- $('tr.localization_key_row').on 'click', '.request_info_link', (e)->
25
+ $('tr.localization_key_row').on 'click', '.request_info_link', (e) ->
26
26
  $(this).parents('tr.localization_key_row').find(".request_info_row").toggleClass('hidden')
27
+ $('tr.localization_key_row').on 'click', '.js-copy_to_clipboard', (e) ->
28
+ if(!navigator.clipboard)
29
+ alert('No browser support for clipboard')
30
+ else
31
+ navigator.clipboard.writeText($(this).data('key'))
32
+ e.preventDefault()
33
+ false
@@ -11,17 +11,17 @@
11
11
  *= require './backend/jquery-te-1.4.0.css'
12
12
  *= require_self
13
13
  */
14
- .detail_wrapper{
15
- padding: 10px 0 0 50px;
14
+ .detail_wrapper {
15
+ padding: 10px 0 0 10px;
16
16
  }
17
- .detail_wrapper table tr td.locale_row{
17
+ .detail_wrapper table tr td.locale_row {
18
18
  width: 75px;
19
19
  }
20
- .localization_key_row .localization_keys_options{
20
+ .localization_key_row .localization_keys_options {
21
21
  display: none;
22
22
  float: right;
23
23
  }
24
- .localization_key_row:hover .localization_keys_options{
24
+ .localization_key_row:hover .localization_keys_options {
25
25
  display: block;
26
26
  }
27
27
 
@@ -29,29 +29,29 @@ li.key_prefix .fa-chevron-right {
29
29
  float: right;
30
30
  margin-top: 2px;
31
31
  margin-right: -6px;
32
- opacity: .25;
32
+ opacity: 0.25;
33
33
  }
34
34
 
35
- .hidden{
35
+ .hidden {
36
36
  display: none;
37
37
  }
38
- i.fa{
38
+ i.fa {
39
39
  color: black;
40
40
  }
41
- .nav.nav-stacked>li>a {
42
- padding: 5px 7px;
41
+ .nav.nav-stacked > li > a {
42
+ padding: 5px 7px;
43
43
  }
44
- .well{
44
+ .well {
45
45
  background-color: white;
46
46
  border-radius: 0px;
47
47
  }
48
- .well label{
48
+ .well label {
49
49
  font-weight: normal;
50
50
  }
51
51
  .well .form-search {
52
52
  margin-bottom: 15px;
53
53
  }
54
- .localization_row em{
54
+ .localization_row em {
55
55
  color: #bbb;
56
56
  }
57
57
  .loading {
@@ -60,3 +60,6 @@ padding: 5px 7px;
60
60
  .loaded {
61
61
  display: none;
62
62
  }
63
+ .copy_to_clipboard_btn {
64
+ cursor: pointer;
65
+ }
@@ -2,32 +2,29 @@ module Lit
2
2
  class Api::V1::LocalizationsController < Api::V1::BaseController
3
3
  def index
4
4
  @localizations = fetch_localizations
5
- render json: @localizations.as_json(
6
- root: false,
7
- only: %i[id localization_key_id locale_id],
8
- methods: %i[
9
- value localization_key_str locale_str
10
- localization_key_is_deleted
11
- ]
12
- )
5
+ render json:
6
+ @localizations.as_json(
7
+ root: false,
8
+ only: %i[id localization_key_id locale_id],
9
+ methods: %i[value localization_key_str locale_str localization_key_is_deleted],
10
+ )
13
11
  end
14
12
 
15
13
  def last_change
16
14
  @localization = Localization.order(updated_at: :desc).first
17
- render json: @localization.as_json(
18
- root: false, only: [], methods: [:last_change]
19
- )
15
+ render json: @localization.as_json(root: false, only: [], methods: [:last_change])
20
16
  end
21
17
 
22
18
  private
23
19
 
24
20
  def fetch_localizations
21
+ scope = Localization.includes(:locale, :localization_key)
22
+
25
23
  if params[:after].present?
26
- after_date = Time.parse("#{params[:after]} #{Time.zone.name}")
27
- .in_time_zone
28
- Localization.after(after_date).to_a
24
+ after_date = Time.parse("#{params[:after]} #{Time.zone.name}").in_time_zone
25
+ scope.after(after_date).to_a
29
26
  else
30
- Localization.all
27
+ scope.all
31
28
  end
32
29
  end
33
30
  end
@@ -18,7 +18,7 @@ module Lit
18
18
  from: params[:from],
19
19
  to: @target_localization.locale.locale
20
20
  }.compact
21
- @translated_text = Lit::CloudTranslation.translate(opts)
21
+ @translated_text = Lit::CloudTranslation.translate(**opts)
22
22
  rescue Lit::CloudTranslation::TranslationError => e
23
23
  @error_message = "Translation failed. #{e.message}"
24
24
  end
@@ -1,17 +1,23 @@
1
1
  module Lit
2
- module Concerns
3
- module RequestInfoStore
4
- extend ::ActiveSupport::Concern
5
- included do
6
- before_action :store_request_path
7
- end
2
+ module RequestInfoStore
3
+ extend ::ActiveSupport::Concern
4
+ included do
5
+ before_action :store_request_path
6
+ end
8
7
 
9
- private
8
+ private
10
9
 
11
- def store_request_path
12
- Thread.current[:lit_current_request_path] = request&.path
13
- end
10
+ def store_request_path
11
+ Thread.current[:lit_current_request_path] = request&.path
14
12
  end
15
13
  end
16
14
  end
17
15
 
16
+ module Lit::Concerns::RequestInfoStore
17
+ extend ActiveSupport::Concern
18
+
19
+ included do
20
+ Rails.logger.info 'DEPRECATED: Use include Lit::RequestInfoStore'
21
+ include Lit::RequestInfoStore
22
+ end
23
+ end
@@ -1,16 +1,23 @@
1
1
  module Lit
2
- module Concerns
3
- module RequestKeysStore
4
- extend ::ActiveSupport::Concern
5
- included do
6
- before_action :init_request_keys
7
- end
2
+ module RequestKeysStore
3
+ extend ::ActiveSupport::Concern
4
+ included do
5
+ before_action :init_request_keys
6
+ end
8
7
 
9
- private
8
+ private
10
9
 
11
- def init_request_keys
12
- Thread.current[:lit_request_keys] = {}
13
- end
10
+ def init_request_keys
11
+ Thread.current[:lit_request_keys] = {}
14
12
  end
15
13
  end
16
14
  end
15
+
16
+ module Lit::Concerns::RequestKeysStore
17
+ extend ActiveSupport::Concern
18
+
19
+ included do
20
+ Rails.logger.info 'DEPRECATED: Use include Lit::RequestKeysStore'
21
+ include Lit::RequestKeysStore
22
+ end
23
+ end
@@ -1,9 +1,7 @@
1
1
  module Lit
2
2
  class LocalizationKeysController < ::Lit::ApplicationController
3
- before_action :find_localization_scope,
4
- except: %i[destroy find_localization]
5
- before_action :find_localization_key,
6
- only: %i[star destroy change_completed restore_deleted]
3
+ before_action :find_localization_scope, except: %i[destroy find_localization]
4
+ before_action :find_localization_key, only: %i[star destroy change_completed restore_deleted]
7
5
 
8
6
  def index
9
7
  get_localization_keys
@@ -20,23 +18,19 @@ module Lit
20
18
  end
21
19
 
22
20
  def find_localization
23
- localization_key = Lit::LocalizationKey.find_by!(
24
- localization_key: params[:key]
25
- )
21
+ localization_key = Lit::LocalizationKey.find_by!(localization_key: params[:key])
26
22
  locale = Lit::Locale.find_by!(locale: params[:locale])
27
23
  localization = localization_key.localizations.find_by(locale_id: locale)
28
- render json: {
29
- path: localization_key_localization_path(localization_key, localization)
30
- }
24
+ render json: { path: localization_key_localization_path(localization_key, localization) }
31
25
  end
32
26
 
33
27
  def starred
34
28
  @scope = @scope.where(is_starred: true)
35
29
 
36
- if defined?(Kaminari) &&
37
- @scope.respond_to?(Kaminari.config.page_method_name)
30
+ if defined?(Kaminari) && @scope.respond_to?(Kaminari.config.page_method_name)
38
31
  @scope = @scope.send(Kaminari.config.page_method_name, params[:page])
39
32
  end
33
+ @scope = @scope.paginate(page: params[:page]) if defined?(WillPaginate) && @scope.respond_to?(:paginate)
40
34
  get_localization_keys
41
35
  render action: :index
42
36
  end
@@ -62,6 +56,16 @@ module Lit
62
56
  respond_to :js
63
57
  end
64
58
 
59
+ def batch_touch
60
+ get_localization_keys
61
+ localization_key_ids = @scope.distinct(false).pluck(:id)
62
+ if localization_key_ids.any?
63
+ @scope.distinct(false).update_all updated_at: Time.current
64
+ Localization.where(localization_key_id: localization_key_ids).update_all updated_at: Time.current
65
+ end
66
+ respond_to :js
67
+ end
68
+
65
69
  private
66
70
 
67
71
  def find_localization_key
@@ -69,25 +73,24 @@ module Lit
69
73
  end
70
74
 
71
75
  def find_localization_scope
72
- @search_options = if params.respond_to?(:permit)
73
- params.permit(*valid_keys)
74
- else
75
- params.slice(*valid_keys)
76
- end
77
- @scope = LocalizationKey.distinct.active
78
- .preload(localizations: :locale)
79
- .search(@search_options)
76
+ @search_options = params.respond_to?(:permit) ? params.permit(*valid_keys) : params.slice(*valid_keys)
77
+ @scope = LocalizationKey.distinct.active.preload(localizations: :locale).search(@search_options)
80
78
  end
81
79
 
82
80
  def get_localization_keys
83
81
  key_parts = @search_options[:key_prefix].to_s.split('.').length
84
- @prefixes = @scope.reorder(nil).distinct.pluck(:localization_key).map { |lk| lk.split('.').shift(key_parts + 1).join('.') }.uniq.sort
82
+ @prefixes =
83
+ @scope.reorder(nil).distinct.pluck(:localization_key).map do |lk|
84
+ lk.split('.').shift(key_parts + 1).join('.')
85
+ end.uniq.sort
85
86
  if @search_options[:key_prefix].present?
86
87
  parts = @search_options[:key_prefix].split('.')
87
88
  @parent_prefix = parts[0, parts.length - 1].join('.')
88
89
  end
89
90
  if defined?(Kaminari) and @scope.respond_to?(Kaminari.config.page_method_name)
90
91
  @localization_keys = @scope.send(Kaminari.config.page_method_name, params[:page])
92
+ elsif defined?(WillPaginate) and @scope.respond_to?(:paginate)
93
+ @localization_keys = @scope.paginate(page: params[:page])
91
94
  else
92
95
  @localization_keys = @scope
93
96
  end
@@ -98,16 +101,15 @@ module Lit
98
101
  end
99
102
 
100
103
  def grouped_localizations
101
- @_grouped_localizations ||= begin
102
- {}.tap do |hash|
103
- @localization_keys.each do |lk|
104
- hash[lk] = {}
105
- lk.localizations.each do |l|
106
- hash[lk][l.locale.locale.to_sym] = l
104
+ @_grouped_localizations ||=
105
+ begin
106
+ {}.tap do |hash|
107
+ @localization_keys.each do |lk|
108
+ hash[lk] = {}
109
+ lk.localizations.each { |l| hash[lk][l.locale.locale.to_sym] = l }
107
110
  end
108
111
  end
109
112
  end
110
- end
111
113
  end
112
114
 
113
115
  def localization_for(locale, localization_key)
@@ -130,12 +132,16 @@ module Lit
130
132
  helper_method :localization_for
131
133
 
132
134
  def versions?(localization)
133
- @_versions ||= begin
134
- ids = grouped_localizations.values.map(&:values).flatten.map(&:id)
135
- Lit::Localization.active.where(id: ids).joins(:versions).group(
136
- "#{Lit::Localization.quoted_table_name}.id"
137
- ).count
138
- end
135
+ @_versions ||=
136
+ begin
137
+ ids = grouped_localizations.values.map(&:values).flatten.map(&:id)
138
+ Lit::Localization
139
+ .active
140
+ .where(id: ids)
141
+ .joins(:versions)
142
+ .group("#{Lit::Localization.quoted_table_name}.id")
143
+ .count
144
+ end
139
145
  @_versions[localization.id].to_i > 0
140
146
  end
141
147
  helper_method :versions?
@@ -20,7 +20,7 @@ module Lit
20
20
  # #after_update_operations. So it'll first set :is_changed to true
21
21
  # and then it will be properly read in the cache setting routine.
22
22
  @localization.transaction do
23
- after_update_operations if @localization.update_attributes(clear_params)
23
+ after_update_operations if @localization.update(clear_params)
24
24
  end
25
25
  respond_to do |f|
26
26
  f.js
@@ -40,7 +40,7 @@ module Lit
40
40
  end
41
41
 
42
42
  def update
43
- if @source.update_attributes(clear_params)
43
+ if @source.update(clear_params)
44
44
  redirect_to @source, notice: 'Source was successfully updated.'
45
45
  else
46
46
  render action: 'edit'