sunrise-cms 1.0.3 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (353) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +25 -0
  3. data/.rubocop.yml +87 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.rdoc +11 -3
  6. data/Gemfile +49 -0
  7. data/README.md +6 -0
  8. data/Rakefile +4 -2
  9. data/app/assets/images/sunrise/icons/export.svg +4 -0
  10. data/app/assets/images/sunrise/icons/import.svg +5 -0
  11. data/app/assets/javascripts/sunrise/application.js +2 -3
  12. data/app/assets/javascripts/sunrise/jquery-ui-timepicker-addon.js +2143 -831
  13. data/app/assets/javascripts/sunrise/jquery.dialog.js.coffee +113 -40
  14. data/app/assets/javascripts/sunrise/jquery.editable.js.coffee +21 -21
  15. data/app/assets/javascripts/sunrise/manage.js.coffee +29 -28
  16. data/app/assets/stylesheets/sunrise/application.css +4 -4
  17. data/app/assets/stylesheets/sunrise/customize.css +7 -16
  18. data/app/assets/stylesheets/sunrise/jquery-ui-timepicker-addon.css +11 -0
  19. data/app/assets/stylesheets/sunrise/main.css +883 -606
  20. data/app/controllers/sunrise/activities_controller.rb +7 -5
  21. data/app/controllers/sunrise/application_controller.rb +17 -17
  22. data/app/controllers/sunrise/dashboard_controller.rb +6 -5
  23. data/app/controllers/sunrise/manager_controller.rb +145 -104
  24. data/app/controllers/sunrise/settings_controller.rb +5 -3
  25. data/app/helpers/sunrise/activities_helper.rb +8 -7
  26. data/app/helpers/sunrise/application_helper.rb +11 -9
  27. data/app/helpers/sunrise/dashboard_helper.rb +3 -1
  28. data/app/helpers/sunrise/manager_helper.rb +28 -27
  29. data/app/helpers/sunrise/structure_helper.rb +11 -8
  30. data/app/views/layouts/sunrise/application.html.erb +7 -6
  31. data/app/views/sunrise/manager/buttons/_export.html.erb +9 -2
  32. data/app/views/sunrise/manager/buttons/_import.html.erb +25 -0
  33. data/app/views/sunrise/manager/buttons/_sort.html.erb +3 -3
  34. data/app/views/sunrise/manager/tree/index.html.erb +1 -1
  35. data/config/locales/defaults/datetime.rb +7 -7
  36. data/config/locales/defaults/pluralize.rb +5 -3
  37. data/config/routes.rb +23 -20
  38. data/db/migrate/20111216144515_create_assets.rb +9 -7
  39. data/db/migrate/20111216144915_create_structures.rb +14 -12
  40. data/db/migrate/20111216145015_create_users.rb +20 -18
  41. data/db/migrate/20120611095315_create_settings.rb +7 -5
  42. data/lib/generators/sunrise/install_generator.rb +51 -49
  43. data/lib/generators/sunrise/templates/config/active_record/sunrise.rb +12 -10
  44. data/lib/generators/sunrise/templates/config/mongoid/sunrise.rb +14 -12
  45. data/lib/generators/sunrise/templates/config/seeds.rb +7 -7
  46. data/lib/generators/sunrise/templates/models/active_record/ability.rb +4 -3
  47. data/lib/generators/sunrise/templates/models/active_record/asset.rb +5 -3
  48. data/lib/generators/sunrise/templates/models/active_record/attachment_file.rb +4 -2
  49. data/lib/generators/sunrise/templates/models/active_record/avatar.rb +7 -5
  50. data/lib/generators/sunrise/templates/models/active_record/picture.rb +6 -4
  51. data/lib/generators/sunrise/templates/models/active_record/position_type.rb +5 -3
  52. data/lib/generators/sunrise/templates/models/active_record/role_type.rb +6 -4
  53. data/lib/generators/sunrise/templates/models/active_record/settings.rb +5 -3
  54. data/lib/generators/sunrise/templates/models/active_record/structure.rb +3 -1
  55. data/lib/generators/sunrise/templates/models/active_record/structure_type.rb +7 -5
  56. data/lib/generators/sunrise/templates/models/active_record/user.rb +5 -3
  57. data/lib/generators/sunrise/templates/models/mongoid/ability.rb +4 -3
  58. data/lib/generators/sunrise/templates/models/mongoid/asset.rb +18 -16
  59. data/lib/generators/sunrise/templates/models/mongoid/attachment_file.rb +4 -2
  60. data/lib/generators/sunrise/templates/models/mongoid/avatar.rb +7 -5
  61. data/lib/generators/sunrise/templates/models/mongoid/picture.rb +4 -2
  62. data/lib/generators/sunrise/templates/models/mongoid/position_type.rb +5 -3
  63. data/lib/generators/sunrise/templates/models/mongoid/role_type.rb +6 -4
  64. data/lib/generators/sunrise/templates/models/mongoid/settings.rb +9 -7
  65. data/lib/generators/sunrise/templates/models/mongoid/structure.rb +12 -10
  66. data/lib/generators/sunrise/templates/models/mongoid/structure_type.rb +7 -5
  67. data/lib/generators/sunrise/templates/models/mongoid/user.rb +37 -35
  68. data/lib/generators/sunrise/templates/models/sunrise/sunrise_navigation.rb +9 -7
  69. data/lib/generators/sunrise/templates/models/sunrise/sunrise_page.rb +5 -3
  70. data/lib/generators/sunrise/templates/models/sunrise/sunrise_structure.rb +10 -9
  71. data/lib/generators/sunrise/templates/models/sunrise/sunrise_user.rb +15 -13
  72. data/lib/generators/sunrise/templates/spec/controllers/pages_controller_spec.rb +12 -10
  73. data/lib/generators/sunrise/templates/spec/controllers/welcome_controller_spec.rb +8 -6
  74. data/lib/generators/sunrise/templates/spec/factories/structure_factory.rb +6 -5
  75. data/lib/generators/sunrise/templates/spec/factories/user_factory.rb +19 -18
  76. data/lib/generators/sunrise/templates/spec/spec_helper.rb +9 -7
  77. data/lib/generators/sunrise/templates/spec/support/helpers/controller_macros.rb +10 -9
  78. data/lib/generators/sunrise/templates/uploaders/attachment_file_uploader.rb +4 -2
  79. data/lib/generators/sunrise/templates/uploaders/avatar_uploader.rb +10 -7
  80. data/lib/generators/sunrise/templates/uploaders/picture_uploader.rb +9 -6
  81. data/lib/sunrise-cms.rb +2 -0
  82. data/lib/sunrise.rb +20 -13
  83. data/lib/sunrise/abstract_model.rb +103 -106
  84. data/lib/sunrise/carrierwave/base_uploader.rb +43 -46
  85. data/lib/sunrise/carrierwave/file_size_validator.rb +16 -11
  86. data/lib/sunrise/carrierwave/glue.rb +9 -9
  87. data/lib/sunrise/config.rb +14 -12
  88. data/lib/sunrise/config/association.rb +4 -3
  89. data/lib/sunrise/config/base.rb +15 -13
  90. data/lib/sunrise/config/export.rb +5 -3
  91. data/lib/sunrise/config/field.rb +26 -24
  92. data/lib/sunrise/config/form.rb +2 -0
  93. data/lib/sunrise/config/group.rb +9 -6
  94. data/lib/sunrise/config/has_fields.rb +6 -5
  95. data/lib/sunrise/config/has_groups.rb +4 -2
  96. data/lib/sunrise/config/index.rb +9 -7
  97. data/lib/sunrise/config/model.rb +20 -14
  98. data/lib/sunrise/config/navigation.rb +21 -19
  99. data/lib/sunrise/config/navigation_item.rb +7 -5
  100. data/lib/sunrise/config/nested_field.rb +13 -12
  101. data/lib/sunrise/config/page_presenter.rb +5 -2
  102. data/lib/sunrise/config/show.rb +2 -0
  103. data/lib/sunrise/core_ext.rb +2 -0
  104. data/lib/sunrise/core_ext/i18n.rb +9 -9
  105. data/lib/sunrise/core_ext/string.rb +4 -2
  106. data/lib/sunrise/engine.rb +22 -16
  107. data/lib/sunrise/hooks/adapters/active_record.rb +3 -1
  108. data/lib/sunrise/hooks/adapters/mongoid.rb +4 -2
  109. data/lib/sunrise/models/ability.rb +12 -10
  110. data/lib/sunrise/models/asset.rb +43 -43
  111. data/lib/sunrise/models/position_type.rb +7 -6
  112. data/lib/sunrise/models/role_type.rb +8 -7
  113. data/lib/sunrise/models/structure.rb +27 -28
  114. data/lib/sunrise/models/structure_type.rb +7 -6
  115. data/lib/sunrise/models/user.rb +39 -37
  116. data/lib/sunrise/utils.rb +16 -17
  117. data/lib/sunrise/utils/csv_document.rb +23 -23
  118. data/lib/sunrise/utils/eval_helpers.rb +41 -39
  119. data/lib/sunrise/utils/search_wrapper.rb +8 -7
  120. data/lib/sunrise/utils/transliteration.rb +42 -41
  121. data/lib/sunrise/version.rb +3 -1
  122. data/lib/sunrise/views/date_time_input.rb +19 -17
  123. data/lib/sunrise/views/form_builder.rb +15 -13
  124. data/lib/sunrise/views/helper.rb +32 -32
  125. data/lib/sunrise/views/search_wrapper.rb +5 -3
  126. data/lib/tasks/assets.rake +11 -9
  127. data/sunrise-cms.gemspec +50 -0
  128. metadata +85 -596
  129. data/spec/controllers/sunrise/activities_controller_spec.rb +0 -33
  130. data/spec/controllers/sunrise/manager_controller_spec.rb +0 -64
  131. data/spec/controllers/sunrise/settings_controller_spec.rb +0 -45
  132. data/spec/dummy/Rakefile +0 -7
  133. data/spec/dummy/app/assets/javascripts/application.js +0 -9
  134. data/spec/dummy/app/assets/javascripts/sunrise/plugins.js +0 -0
  135. data/spec/dummy/app/assets/javascripts/welcome.js +0 -2
  136. data/spec/dummy/app/assets/stylesheets/application.css +0 -7
  137. data/spec/dummy/app/assets/stylesheets/sunrise/plugins.css +0 -0
  138. data/spec/dummy/app/assets/stylesheets/welcome.css +0 -4
  139. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  140. data/spec/dummy/app/controllers/welcome_controller.rb +0 -5
  141. data/spec/dummy/app/helpers/application_helper.rb +0 -12
  142. data/spec/dummy/app/helpers/welcome_helper.rb +0 -2
  143. data/spec/dummy/app/models/active_record/post.rb +0 -18
  144. data/spec/dummy/app/models/mongoid/post.rb +0 -27
  145. data/spec/dummy/app/sunrise/sunrise_post.rb +0 -34
  146. data/spec/dummy/app/views/layouts/application.html.erb +0 -20
  147. data/spec/dummy/app/views/public_activity/post/_create.html.erb +0 -5
  148. data/spec/dummy/app/views/public_activity/post/_destroy.html.erb +0 -5
  149. data/spec/dummy/app/views/public_activity/post/_update.html.erb +0 -5
  150. data/spec/dummy/app/views/sunrise/manager/users/thumbs/_record.html.erb +0 -34
  151. data/spec/dummy/app/views/welcome/index.html.erb +0 -2
  152. data/spec/dummy/config.ru +0 -4
  153. data/spec/dummy/config/application.rb +0 -55
  154. data/spec/dummy/config/boot.rb +0 -10
  155. data/spec/dummy/config/database.yml +0 -42
  156. data/spec/dummy/config/database.yml.sample +0 -34
  157. data/spec/dummy/config/environment.rb +0 -5
  158. data/spec/dummy/config/environments/development.rb +0 -33
  159. data/spec/dummy/config/environments/production.rb +0 -66
  160. data/spec/dummy/config/environments/test.rb +0 -41
  161. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  162. data/spec/dummy/config/initializers/devise.rb +0 -216
  163. data/spec/dummy/config/initializers/inflections.rb +0 -10
  164. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  165. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  166. data/spec/dummy/config/initializers/session_store.rb +0 -8
  167. data/spec/dummy/config/initializers/sunrise.rb +0 -51
  168. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  169. data/spec/dummy/config/locales/en.yml +0 -5
  170. data/spec/dummy/config/mongoid.yml +0 -80
  171. data/spec/dummy/config/routes.rb +0 -10
  172. data/spec/dummy/db/migrate/20111227111941_install_acts_as_audited.rb +0 -28
  173. data/spec/dummy/db/migrate/20111227143901_create_page_parts.rb +0 -20
  174. data/spec/dummy/db/migrate/20111228152051_create_posts.rb +0 -14
  175. data/spec/dummy/db/migrate/20120105114018_create_meta_tags.rb +0 -21
  176. data/spec/dummy/db/migrate/20130214090723_create_activities.rb +0 -23
  177. data/spec/dummy/db/schema.rb +0 -90
  178. data/spec/dummy/log/test.log +0 -235
  179. data/spec/dummy/public/404.html +0 -26
  180. data/spec/dummy/public/422.html +0 -26
  181. data/spec/dummy/public/500.html +0 -26
  182. data/spec/dummy/public/favicon.ico +0 -0
  183. data/spec/dummy/script/rails +0 -6
  184. data/spec/dummy/tmp/cache/696/1F0/settings%3Ato_key +0 -1
  185. data/spec/dummy/tmp/cache/87C/5D0/settings%3Apersisted%3F +0 -1
  186. data/spec/dummy/tmp/cache/91C/830/settings%3Asome_setting +0 -1
  187. data/spec/dummy/tmp/cache/94E/D10/settings%3Asome_setting2 +0 -1
  188. data/spec/dummy/tmp/cache/assets/test/sass/f4a02ee710d6db0936c29533f2166c1526a55a9e/select2.scssc +0 -0
  189. data/spec/dummy/tmp/cache/assets/test/sprockets/03bae0b322a9c8706915fdb4f8d50961 +0 -0
  190. data/spec/dummy/tmp/cache/assets/test/sprockets/0a4412d6feb107cf35e452cc82a01134 +0 -0
  191. data/spec/dummy/tmp/cache/assets/test/sprockets/0c538631f0f094ca39bdb1448da8a4bc +0 -0
  192. data/spec/dummy/tmp/cache/assets/test/sprockets/0c94e795dfbbbf3599fdf312aeb577b9 +0 -0
  193. data/spec/dummy/tmp/cache/assets/test/sprockets/0e7270936d642e566d747ab335c44ec2 +0 -0
  194. data/spec/dummy/tmp/cache/assets/test/sprockets/0f894abd40c0b6114a9dff3a0599af7e +0 -0
  195. data/spec/dummy/tmp/cache/assets/test/sprockets/0fdc292bf2b2ddb2d0bf079950c8e770 +0 -0
  196. data/spec/dummy/tmp/cache/assets/test/sprockets/10bb80e2753b3d1716765b02ad9a2db3 +0 -0
  197. data/spec/dummy/tmp/cache/assets/test/sprockets/1349c61c2b491567c1632fcae44110a0 +0 -0
  198. data/spec/dummy/tmp/cache/assets/test/sprockets/13e20c0d57b7b851a7f025f5606f833f +0 -0
  199. data/spec/dummy/tmp/cache/assets/test/sprockets/146ce2f3522fd98d4a8a1501f16c7092 +0 -0
  200. data/spec/dummy/tmp/cache/assets/test/sprockets/172c139e25cc08516d5a8c72c777dd4d +0 -0
  201. data/spec/dummy/tmp/cache/assets/test/sprockets/18b64b11b8b00cc21a396da25a5ff156 +0 -0
  202. data/spec/dummy/tmp/cache/assets/test/sprockets/197d8d604ec08a638b656e053944b734 +0 -0
  203. data/spec/dummy/tmp/cache/assets/test/sprockets/1b73ae25962d8ff98f9f008b73c64bf4 +0 -0
  204. data/spec/dummy/tmp/cache/assets/test/sprockets/1bdb903463fe67323dbadb0f78337c70 +0 -0
  205. data/spec/dummy/tmp/cache/assets/test/sprockets/1ea532f332f1ff667097010cda704c99 +0 -0
  206. data/spec/dummy/tmp/cache/assets/test/sprockets/20215d59350863282208d478ea94cf08 +0 -0
  207. data/spec/dummy/tmp/cache/assets/test/sprockets/212fc15df4fd708ebdef5bd3be2191c1 +0 -0
  208. data/spec/dummy/tmp/cache/assets/test/sprockets/256dcb01e7f35659d770584fd71a85d2 +0 -0
  209. data/spec/dummy/tmp/cache/assets/test/sprockets/27ec6453d976c5e273e6f2c25830492c +0 -0
  210. data/spec/dummy/tmp/cache/assets/test/sprockets/3006732de695a5dfe249dcbf6852b543 +0 -0
  211. data/spec/dummy/tmp/cache/assets/test/sprockets/3008328e1cba59ad00ac79ac20275f17 +0 -0
  212. data/spec/dummy/tmp/cache/assets/test/sprockets/31ffcb9d2aba762160a2f4341e5cfd50 +0 -0
  213. data/spec/dummy/tmp/cache/assets/test/sprockets/32ae3cda2e7c692fc9711ab76fcf1c62 +0 -0
  214. data/spec/dummy/tmp/cache/assets/test/sprockets/35948a84ebda6147e5e5b67191ae37d8 +0 -0
  215. data/spec/dummy/tmp/cache/assets/test/sprockets/37766ae8287a873cb196a187f3253e66 +0 -0
  216. data/spec/dummy/tmp/cache/assets/test/sprockets/37b44bd55598f75d532d9edbe8c98336 +0 -0
  217. data/spec/dummy/tmp/cache/assets/test/sprockets/383908afbabb6096b774ab7c1856a102 +0 -0
  218. data/spec/dummy/tmp/cache/assets/test/sprockets/38611f05ed0bf72a4755c136796ff5d4 +0 -0
  219. data/spec/dummy/tmp/cache/assets/test/sprockets/3b99bacd5915b4ff7fb2664bc2aa30d0 +0 -0
  220. data/spec/dummy/tmp/cache/assets/test/sprockets/443ca9dc693ccf91d6e1cecaffe0fa9a +0 -0
  221. data/spec/dummy/tmp/cache/assets/test/sprockets/45c759123f4f6b42cdcff44b446655a5 +0 -0
  222. data/spec/dummy/tmp/cache/assets/test/sprockets/4ca01587005a9b895bca383881bec87d +0 -0
  223. data/spec/dummy/tmp/cache/assets/test/sprockets/4cffdba2a7aac80c1765e060b152b382 +0 -0
  224. data/spec/dummy/tmp/cache/assets/test/sprockets/4d38783b41d7c000fed2419b5173f87a +0 -0
  225. data/spec/dummy/tmp/cache/assets/test/sprockets/51fe2df168cee49df9d4136f59c87872 +0 -0
  226. data/spec/dummy/tmp/cache/assets/test/sprockets/564db16c8d964c3505bfca526e3fccf2 +0 -0
  227. data/spec/dummy/tmp/cache/assets/test/sprockets/56e5bd2f3c94d7a9d0da7c4e05c7ad78 +0 -0
  228. data/spec/dummy/tmp/cache/assets/test/sprockets/5807e61754ed8b16702f6ad7ba34d439 +0 -0
  229. data/spec/dummy/tmp/cache/assets/test/sprockets/593d990734170367188181754939b317 +0 -0
  230. data/spec/dummy/tmp/cache/assets/test/sprockets/5a44970074ecbfeae2cc9798ed7da7aa +0 -0
  231. data/spec/dummy/tmp/cache/assets/test/sprockets/5e7901fbee32b66040fd6376a8c981d8 +0 -0
  232. data/spec/dummy/tmp/cache/assets/test/sprockets/5ecbfe03cab317594d2bc1c6866d26db +0 -0
  233. data/spec/dummy/tmp/cache/assets/test/sprockets/609ce9936a503352d73f954f68be7f81 +0 -0
  234. data/spec/dummy/tmp/cache/assets/test/sprockets/65224b6e799d399f4e6cf4bf98155de2 +0 -0
  235. data/spec/dummy/tmp/cache/assets/test/sprockets/6a1e72555b75237fffccb5de8937b4d4 +0 -0
  236. data/spec/dummy/tmp/cache/assets/test/sprockets/6a8187f5c6f2e115d1a1c21ca2ec81a0 +0 -0
  237. data/spec/dummy/tmp/cache/assets/test/sprockets/6c9a2f7ab6f8d1f8e3e4cf1d7d6cc68a +0 -0
  238. data/spec/dummy/tmp/cache/assets/test/sprockets/6f4f668f70fb14b2132289fed6718f0e +0 -0
  239. data/spec/dummy/tmp/cache/assets/test/sprockets/727e0f830601f307d4c8b9a76e464c1a +0 -0
  240. data/spec/dummy/tmp/cache/assets/test/sprockets/749bd767d6654c80265f5ca0959dc8e1 +0 -0
  241. data/spec/dummy/tmp/cache/assets/test/sprockets/7a92952d5fff10f09ce91b852d6a744f +0 -0
  242. data/spec/dummy/tmp/cache/assets/test/sprockets/7ad564910e515e335bb008989a97efb7 +0 -0
  243. data/spec/dummy/tmp/cache/assets/test/sprockets/7b55037b89f2debe558b43fe7542e409 +0 -0
  244. data/spec/dummy/tmp/cache/assets/test/sprockets/7bb04b7318793726b5414daaa4f049d4 +0 -0
  245. data/spec/dummy/tmp/cache/assets/test/sprockets/7c5f37d1af8a5557b67d6ffb8afcc2b5 +0 -0
  246. data/spec/dummy/tmp/cache/assets/test/sprockets/7f5092f53db371ea56be62557677a506 +0 -0
  247. data/spec/dummy/tmp/cache/assets/test/sprockets/7f9ced6d264f71631c80df15194abf4d +0 -0
  248. data/spec/dummy/tmp/cache/assets/test/sprockets/80870efa2a2ddb1de325c224daff5712 +0 -0
  249. data/spec/dummy/tmp/cache/assets/test/sprockets/831e225c0e792be993a1d1dc58f20e54 +0 -0
  250. data/spec/dummy/tmp/cache/assets/test/sprockets/83f98047f864c578534b34068cb015e0 +0 -0
  251. data/spec/dummy/tmp/cache/assets/test/sprockets/84361af51e20dcfad7fae0f32f284ab7 +0 -0
  252. data/spec/dummy/tmp/cache/assets/test/sprockets/894aeaae9cc8483fa9f7a5146ff6ff6f +0 -0
  253. data/spec/dummy/tmp/cache/assets/test/sprockets/89567cbb5e7770a065e88360dcd02833 +0 -0
  254. data/spec/dummy/tmp/cache/assets/test/sprockets/89a5be65dc0d00fa22be4375c029d69c +0 -0
  255. data/spec/dummy/tmp/cache/assets/test/sprockets/8bf0319a2b612416dfde2d3b939dbf99 +0 -0
  256. data/spec/dummy/tmp/cache/assets/test/sprockets/8cfeb6443a5f7398e67010a202ee2de2 +0 -0
  257. data/spec/dummy/tmp/cache/assets/test/sprockets/8e3769f6378278754105f0924e6dd1ff +0 -0
  258. data/spec/dummy/tmp/cache/assets/test/sprockets/96c321f84bd796096692021bc4a87eed +0 -0
  259. data/spec/dummy/tmp/cache/assets/test/sprockets/97e875e2282fba5939cf71198faab1f0 +0 -0
  260. data/spec/dummy/tmp/cache/assets/test/sprockets/9911ee0fc41f519a1c4faa7912547cce +0 -0
  261. data/spec/dummy/tmp/cache/assets/test/sprockets/9ac84ed11232b2f7fc9f80c18844abc8 +0 -0
  262. data/spec/dummy/tmp/cache/assets/test/sprockets/9ba0cab624f25b68f79447e62fbc6112 +0 -0
  263. data/spec/dummy/tmp/cache/assets/test/sprockets/9e9edfa954375fd0cc6498f70b883e8e +0 -0
  264. data/spec/dummy/tmp/cache/assets/test/sprockets/a3863764f2fbc185e0d2ea584c7e2174 +0 -0
  265. data/spec/dummy/tmp/cache/assets/test/sprockets/a4c4a00b0d2b8334de3ee3169064adad +0 -0
  266. data/spec/dummy/tmp/cache/assets/test/sprockets/a744e8f2a7ce02e7af9784f40c711ed5 +0 -0
  267. data/spec/dummy/tmp/cache/assets/test/sprockets/a78a33e8cea959257da93b3e67786300 +0 -0
  268. data/spec/dummy/tmp/cache/assets/test/sprockets/a9956bd25bbe4c811a1a758f71aec748 +0 -0
  269. data/spec/dummy/tmp/cache/assets/test/sprockets/aa4822def20c419f0e50e2a38e73a1df +0 -0
  270. data/spec/dummy/tmp/cache/assets/test/sprockets/aaa24da6bd0fcf694077519e189b7392 +0 -0
  271. data/spec/dummy/tmp/cache/assets/test/sprockets/b0493d9dbe3afb3268b7ffce2b87bf78 +0 -0
  272. data/spec/dummy/tmp/cache/assets/test/sprockets/b2c398b7a51a65be12ba944bdea13415 +0 -0
  273. data/spec/dummy/tmp/cache/assets/test/sprockets/b81381e4a978aa69cc2ab1f892a40e97 +0 -0
  274. data/spec/dummy/tmp/cache/assets/test/sprockets/b82707486d5133da748e4382c62de995 +0 -0
  275. data/spec/dummy/tmp/cache/assets/test/sprockets/bb83cb3c179681d65c77a41e98f1c70f +0 -0
  276. data/spec/dummy/tmp/cache/assets/test/sprockets/bbc50f2009705d8fd7b91330bc24dcb8 +0 -0
  277. data/spec/dummy/tmp/cache/assets/test/sprockets/bcb7548b203cc2c5a484ef7649911c2d +0 -0
  278. data/spec/dummy/tmp/cache/assets/test/sprockets/becade26fead85d486f136be49b45e23 +0 -0
  279. data/spec/dummy/tmp/cache/assets/test/sprockets/bfc0fef30976427a03ddccb1ce78d6e7 +0 -0
  280. data/spec/dummy/tmp/cache/assets/test/sprockets/c0dd93a468e038b3653ed4d28874e0cb +0 -0
  281. data/spec/dummy/tmp/cache/assets/test/sprockets/c1d2340cbfe5e80d388f95e7a08698d9 +0 -0
  282. data/spec/dummy/tmp/cache/assets/test/sprockets/c25afdb537c84a18bd62fc782164d298 +0 -0
  283. data/spec/dummy/tmp/cache/assets/test/sprockets/c3dc3ada4560805584739bfe7c2b24d9 +0 -0
  284. data/spec/dummy/tmp/cache/assets/test/sprockets/c4dc50a79ec929d33d9e2835d1926fd9 +0 -0
  285. data/spec/dummy/tmp/cache/assets/test/sprockets/c5f990ee58d3727faeb4cfd3f5667e8a +0 -0
  286. data/spec/dummy/tmp/cache/assets/test/sprockets/c622effcf1aa225bf2920d2b63ca525c +0 -0
  287. data/spec/dummy/tmp/cache/assets/test/sprockets/d09dc20f2dc66183aa23ce1fd8fc9f2c +0 -0
  288. data/spec/dummy/tmp/cache/assets/test/sprockets/d60bdefb444e91b75e4cc2f3fc49228b +0 -0
  289. data/spec/dummy/tmp/cache/assets/test/sprockets/d7c40ebee2fb9471bab352337570ba40 +0 -0
  290. data/spec/dummy/tmp/cache/assets/test/sprockets/d9bc94e1e0cc114986f8760bc4eb42ce +0 -0
  291. data/spec/dummy/tmp/cache/assets/test/sprockets/da4488b32bd6fb75c655a077956c9034 +0 -0
  292. data/spec/dummy/tmp/cache/assets/test/sprockets/daeb51b1ca3de2a1f2146dea431249d3 +0 -0
  293. data/spec/dummy/tmp/cache/assets/test/sprockets/dd0e13880601ea049b7c6d8c76ea535f +0 -0
  294. data/spec/dummy/tmp/cache/assets/test/sprockets/dd15d7b9860a8a187c4a6c167dc56547 +0 -0
  295. data/spec/dummy/tmp/cache/assets/test/sprockets/dd8ed9b0203321fd815ba48a5867620e +0 -0
  296. data/spec/dummy/tmp/cache/assets/test/sprockets/e1e036b04a3a20b2fb589420ad03b926 +0 -0
  297. data/spec/dummy/tmp/cache/assets/test/sprockets/e4f46080338c0c52e3933999a7f8106d +0 -0
  298. data/spec/dummy/tmp/cache/assets/test/sprockets/e59a3c2ff941e0fdc7987168580bf4cc +0 -0
  299. data/spec/dummy/tmp/cache/assets/test/sprockets/e6cfe2e09e34ec2b24494a74eed5243a +0 -0
  300. data/spec/dummy/tmp/cache/assets/test/sprockets/e8e088454cc6f38324bd168e299cf08f +0 -0
  301. data/spec/dummy/tmp/cache/assets/test/sprockets/e949207f9e9578cfd48ab90bb82ea384 +0 -0
  302. data/spec/dummy/tmp/cache/assets/test/sprockets/ee5a41236d43159aac87f9224a0bcfb8 +0 -0
  303. data/spec/dummy/tmp/cache/assets/test/sprockets/ef5f76363cd723089ce62b8c207415a4 +0 -0
  304. data/spec/dummy/tmp/cache/assets/test/sprockets/f2de4855fd4840abb2f6e80afee5f4ed +0 -0
  305. data/spec/dummy/tmp/cache/assets/test/sprockets/f5165c4d7cee0e7cb99bc069fd4c09b9 +0 -0
  306. data/spec/dummy/tmp/cache/assets/test/sprockets/f660938bc4a80358883ba6c576e1dd13 +0 -0
  307. data/spec/dummy/tmp/cache/assets/test/sprockets/f7379cc2d3a2fc4b87d64c68d2d8684f +0 -0
  308. data/spec/dummy/tmp/cache/assets/test/sprockets/f81b83e98592ff24dd8518985baa48cd +0 -0
  309. data/spec/dummy/tmp/cache/assets/test/sprockets/f94b13174ed1cc7f087a66c0094ef4cf +0 -0
  310. data/spec/dummy/tmp/cache/assets/test/sprockets/f975cba8c490022ddfc45bab0b512879 +0 -0
  311. data/spec/dummy/tmp/cache/assets/test/sprockets/face6eb5e3ee8802296bdc38e5704d72 +0 -0
  312. data/spec/dummy/tmp/cache/assets/test/sprockets/fc9155176668e1a56a5ca3843febe3c3 +0 -0
  313. data/spec/dummy/tmp/cache/assets/test/sprockets/fd7e46e0b42a510b40f17d1f1bacf80e +0 -0
  314. data/spec/factories/asset_factory.rb +0 -21
  315. data/spec/factories/files/rails.png +0 -0
  316. data/spec/factories/files/silicon_valley.jpg +0 -0
  317. data/spec/factories/page_factory.rb +0 -10
  318. data/spec/factories/post_factory.rb +0 -9
  319. data/spec/factories/structure_factory.rb +0 -22
  320. data/spec/factories/user_factory.rb +0 -49
  321. data/spec/generators/install_generator_spec.rb +0 -55
  322. data/spec/models/avatar_spec.rb +0 -138
  323. data/spec/models/i18n_backend.rb +0 -30
  324. data/spec/models/structure_spec.rb +0 -120
  325. data/spec/models/sunrise/abstract_model_spec.rb +0 -88
  326. data/spec/models/sunrise/carrierwave/picture_uploader_spec.rb +0 -49
  327. data/spec/models/sunrise/search_wrapper_spec.rb +0 -21
  328. data/spec/models/user_spec.rb +0 -63
  329. data/spec/orm/active_record.rb +0 -5
  330. data/spec/orm/kaminari/active_record.rb +0 -18
  331. data/spec/orm/kaminari/mongoid.rb +0 -20
  332. data/spec/orm/mongoid.rb +0 -15
  333. data/spec/requests/activities_spec.rb +0 -41
  334. data/spec/requests/dashboard_spec.rb +0 -35
  335. data/spec/requests/manager/default/create_spec.rb +0 -43
  336. data/spec/requests/manager/default/destroy_spec.rb +0 -36
  337. data/spec/requests/manager/default/edit_spec.rb +0 -72
  338. data/spec/requests/manager/default/export_spec.rb +0 -121
  339. data/spec/requests/manager/default/index_spec.rb +0 -67
  340. data/spec/requests/manager/default/new_spec.rb +0 -59
  341. data/spec/requests/manager/default/show_spec.rb +0 -41
  342. data/spec/requests/manager/default/update_spec.rb +0 -73
  343. data/spec/requests/manager/many/create_spec.rb +0 -52
  344. data/spec/requests/manager/many/destroy_spec.rb +0 -41
  345. data/spec/requests/manager/many/edit_spec.rb +0 -43
  346. data/spec/requests/manager/many/index_spec.rb +0 -54
  347. data/spec/requests/manager/many/new_spec.rb +0 -40
  348. data/spec/requests/manager/many/update_spec.rb +0 -55
  349. data/spec/spec_helper.rb +0 -90
  350. data/spec/sunrise_spec.rb +0 -29
  351. data/spec/support/helpers/controller_helper.rb +0 -27
  352. data/spec/support/helpers/controller_macros.rb +0 -40
  353. data/spec/support/hooks/structure.rb +0 -5
@@ -1,18 +1,19 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  module Sunrise
3
4
  module Utils
4
5
  module SearchWrapper
5
6
  extend ActiveSupport::Concern
6
-
7
+
7
8
  included do
8
9
  helper_method :search_wrapper
9
10
  end
10
-
11
+
11
12
  protected
12
-
13
- def search_wrapper
14
- @search_wrapper ||= Sunrise::Views::SearchWrapper.new(params[:search])
15
- end
13
+
14
+ def search_wrapper
15
+ @search_wrapper ||= Sunrise::Views::SearchWrapper.new(params[:search])
16
+ end
16
17
  end
17
18
  end
18
19
  end
@@ -1,7 +1,8 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  module Sunrise
3
4
  module Utils
4
- # Russian transliteration
5
+ # Russian transliteration
5
6
  #
6
7
  module Transliteration
7
8
  extend self
@@ -11,58 +12,58 @@ module Sunrise
11
12
  # Cleaned up and optimized.
12
13
 
13
14
  LOWER_SINGLE = {
14
- "і"=>"i","ґ"=>"g","ё"=>"yo",""=>"#","є"=>"e",
15
- "ї"=>"yi","а"=>"a","б"=>"b",
16
- "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"zh",
17
- "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l",
18
- "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
19
- "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
20
- "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"'",
21
- "ы"=>"y","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya",
22
- }
15
+ 'і' => 'i', 'ґ' => 'g', 'ё' => 'yo', '' => '#', 'є' => 'e',
16
+ 'ї' => 'yi', 'а' => 'a', 'б' => 'b',
17
+ 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ж' => 'zh',
18
+ 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l',
19
+ 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r',
20
+ 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h',
21
+ 'ц' => 'ts', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sch', 'ъ' => "'",
22
+ 'ы' => 'y', 'ь' => '', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya'
23
+ }.freeze
23
24
  LOWER_MULTI = {
24
- "ье"=>"ie",
25
- "ьё"=>"ie",
26
- }
25
+ 'ье' => 'ie',
26
+ 'ьё' => 'ie'
27
+ }.freeze
27
28
 
28
29
  UPPER_SINGLE = {
29
- "Ґ"=>"G","Ё"=>"YO","Є"=>"E","Ї"=>"YI","І"=>"I",
30
- "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
31
- "Д"=>"D","Е"=>"E","Ж"=>"ZH","З"=>"Z","И"=>"I",
32
- "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
33
- "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
34
- "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH",
35
- "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"'","Ы"=>"Y","Ь"=>"",
36
- "Э"=>"E","Ю"=>"YU","Я"=>"YA",
37
- }
30
+ 'Ґ' => 'G', 'Ё' => 'YO', 'Є' => 'E', 'Ї' => 'YI', 'І' => 'I',
31
+ 'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G',
32
+ 'Д' => 'D', 'Е' => 'E', 'Ж' => 'ZH', 'З' => 'Z', 'И' => 'I',
33
+ 'Й' => 'Y', 'К' => 'K', 'Л' => 'L', 'М' => 'M', 'Н' => 'N',
34
+ 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T',
35
+ 'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'TS', 'Ч' => 'CH',
36
+ 'Ш' => 'SH', 'Щ' => 'SCH', 'Ъ' => "'", 'Ы' => 'Y', 'Ь' => '',
37
+ 'Э' => 'E', 'Ю' => 'YU', 'Я' => 'YA'
38
+ }.freeze
38
39
  UPPER_MULTI = {
39
- "ЬЕ"=>"IE",
40
- "ЬЁ"=>"IE",
41
- }
40
+ 'ЬЕ' => 'IE',
41
+ 'ЬЁ' => 'IE'
42
+ }.freeze
42
43
 
43
- LOWER = (LOWER_SINGLE.merge(LOWER_MULTI)).freeze
44
- UPPER = (UPPER_SINGLE.merge(UPPER_MULTI)).freeze
45
- MULTI_KEYS = (LOWER_MULTI.merge(UPPER_MULTI)).keys.sort_by {|s| s.length}.reverse.freeze
44
+ LOWER = LOWER_SINGLE.merge(LOWER_MULTI).freeze
45
+ UPPER = UPPER_SINGLE.merge(UPPER_MULTI).freeze
46
+ MULTI_KEYS = LOWER_MULTI.merge(UPPER_MULTI).keys.sort_by { |s| s.length }.reverse.freeze
46
47
 
47
48
  # Transliterate a string with russian characters
48
49
  #
49
50
  # Возвращает строку, в которой все буквы русского алфавита заменены на похожую по звучанию латиницу
50
51
  def transliterate(str)
51
- chars = str.scan(%r{#{MULTI_KEYS.join '|'}|\w|.})
52
+ chars = str.scan(/#{MULTI_KEYS.join '|'}|\w|./)
52
53
 
53
- result = ""
54
+ result = ''
54
55
 
55
56
  chars.each_with_index do |char, index|
56
- if UPPER.has_key?(char) && LOWER.has_key?(chars[index+1])
57
- # combined case
58
- result << UPPER[char].downcase.capitalize
59
- elsif UPPER.has_key?(char)
60
- result << UPPER[char]
61
- elsif LOWER.has_key?(char)
62
- result << LOWER[char]
63
- else
64
- result << char
65
- end
57
+ result << if UPPER.key?(char) && LOWER.key?(chars[index + 1])
58
+ # combined case
59
+ UPPER[char].downcase.capitalize
60
+ elsif UPPER.key?(char)
61
+ UPPER[char]
62
+ elsif LOWER.key?(char)
63
+ LOWER[char]
64
+ else
65
+ char
66
+ end
66
67
  end
67
68
 
68
69
  result
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Sunrise
2
- VERSION = "1.0.3".freeze
4
+ VERSION = '1.1.1'.freeze
3
5
  end
@@ -1,20 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simple_form'
2
4
 
3
5
  module SimpleForm
4
6
  module Inputs
5
7
  class DateTimeInput < Base
6
8
  include ActionView::Helpers::TagHelper
7
-
9
+
8
10
  def input
9
11
  input_html_options[:value] ||= formated_value
10
12
  month_count = input_html_options[:month_count] || 1
11
-
13
+
12
14
  icon = "<div class='but-holder icon'><div class='act-but'><a class='but-container calend' href='javascript:void(0);' id='#{@builder.object_name}_#{attribute_name}_icon'><img src='/assets/sunrise/empty.gif' /></a></div></div>".html_safe
13
- html = [content_tag(:div, @builder.text_field(attribute_name, input_html_options) + icon, :class => 'calend-holder')]
14
-
15
+ html = [content_tag(:div, @builder.text_field(attribute_name, input_html_options) + icon, class: 'calend-holder')]
16
+
15
17
  html << case input_type
16
- when :date then
17
- @builder.javascript_tag("$(function() {
18
+ when :date
19
+ @builder.javascript_tag("$(function() {
18
20
  $('##{@builder.object_name}_#{attribute_name}').datepicker({
19
21
  numberOfMonths: #{month_count},
20
22
  showButtonPanel: true
@@ -23,8 +25,8 @@ module SimpleForm
23
25
  $('##{@builder.object_name}_#{attribute_name}').datepicker('show');
24
26
  });
25
27
  });")
26
- when :datetime then
27
- @builder.javascript_tag("$(function() {
28
+ when :datetime
29
+ @builder.javascript_tag("$(function() {
28
30
  $('##{@builder.object_name}_#{attribute_name}').datetimepicker({
29
31
  numberOfMonths: #{month_count},
30
32
  hourGrid: 4,
@@ -34,25 +36,25 @@ module SimpleForm
34
36
  $('##{@builder.object_name}_#{attribute_name}').datetimepicker('show');
35
37
  });
36
38
  });")
37
- end
39
+ end
38
40
 
39
- html.join.html_safe
41
+ html.join.html_safe
40
42
  end
41
43
 
42
- private
43
-
44
+ private
45
+
44
46
  def formated_value
45
47
  object.send(attribute_name).try(:strftime, value_format)
46
48
  end
47
-
49
+
48
50
  def value_format
49
51
  case input_type
50
- when :date then "%d.%m.%Y"
51
- when :datetime then "%d.%m.%Y %H:%M"
52
- when :time then "%H:%M"
52
+ when :date then '%d.%m.%Y'
53
+ when :datetime then '%d.%m.%Y %H:%M'
54
+ when :time then '%H:%M'
53
55
  end
54
56
  end
55
-
57
+
56
58
  def has_required?
57
59
  false
58
60
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simple_form'
2
4
  require 'sunrise/views/date_time_input'
3
5
 
@@ -6,28 +8,28 @@ module Sunrise
6
8
  class FormBuilder < ::SimpleForm::FormBuilder
7
9
  include ActionView::Helpers::TagHelper
8
10
  include ActionView::Helpers::JavaScriptHelper
9
-
11
+
10
12
  def input(attribute_name, options = {}, &block)
11
13
  options[:input_html] ||= {}
12
- options[:input_html] = {:class => 'text'}.merge(options[:input_html])
13
-
14
- attribute_name = "#{attribute_name}_#{options[:locale]}" unless options[:locale].blank?
15
-
14
+ options[:input_html] = { class: 'text' }.merge(options[:input_html])
15
+
16
+ attribute_name = "#{attribute_name}_#{options[:locale]}" if options[:locale].present?
17
+
16
18
  super(attribute_name, options, &block)
17
19
  end
18
-
19
- def globalize(options={}, &block)
20
+
21
+ def globalize(options = {})
20
22
  locales = options[:locales] || Sunrise.available_locales
21
23
  html = []
22
-
24
+
23
25
  html.join.html_safe
24
26
  end
25
-
27
+
26
28
  protected
27
-
28
- def object_plural
29
- object_name.to_s.pluralize
30
- end
29
+
30
+ def object_plural
31
+ object_name.to_s.pluralize
32
+ end
31
33
  end
32
34
  end
33
35
  end
@@ -1,16 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Sunrise
2
4
  module Views
3
5
  module Helper
4
-
5
6
  def javascript(*args)
6
- content_for(:head) { javascript_include_tag(*args) }
7
+ content_for(:head) { javascript_include_tag(*args) }
7
8
  end
8
9
 
9
10
  def stylesheet(*args)
10
11
  content_for(:head) { stylesheet_link_tag(*args) }
11
12
  end
12
13
 
13
- def link_by_href(name, options={})
14
+ def link_by_href(name, options = {})
14
15
  link_to name, name, options
15
16
  end
16
17
 
@@ -21,9 +22,9 @@ module Sunrise
21
22
  def link_to_unless_span(condition, name, options = {}, html_options = {}, &block)
22
23
  if condition
23
24
  if block_given?
24
- block.arity <= 1 ? yield(name) : yield(name, options, html_options)
25
+ block.arity <= 1 ? yield(name) : yield(name, options, html_options)
25
26
  else
26
- content_tag(:span, name, html_options)
27
+ content_tag(:span, name, html_options)
27
28
  end
28
29
  else
29
30
  link_to(name, options, html_options)
@@ -40,70 +41,69 @@ module Sunrise
40
41
  link_to(name, options, html_options)
41
42
  else
42
43
  if block_given?
43
- block.arity <= 1 ? yield(name) : yield(name, options, html_options)
44
+ block.arity <= 1 ? yield(name) : yield(name, options, html_options)
44
45
  else
45
- content_tag(tag_name, name, html_options)
46
+ content_tag(tag_name, name, html_options)
46
47
  end
47
48
  end
48
- end
49
+ end
49
50
 
50
51
  def link_to_unless_tag(condition, name, options = {}, html_options = {}, &block)
51
52
  tag_name = html_options.delete(:tag) || :span
52
- unless condition
53
- link_to(name, options, html_options)
54
- else
53
+ if condition
55
54
  if block_given?
56
- block.arity <= 1 ? yield(name) : yield(name, options, html_options)
55
+ block.arity <= 1 ? yield(name) : yield(name, options, html_options)
57
56
  else
58
- content_tag(tag_name, name, html_options)
57
+ content_tag(tag_name, name, html_options)
59
58
  end
59
+ else
60
+ link_to(name, options, html_options)
60
61
  end
61
62
  end
62
63
 
63
64
  # swf_object
64
65
  def swf_object(swf, id, width, height, flash_version, options = {})
65
66
  options.symbolize_keys!
66
-
67
+
67
68
  params = options.delete(:params) || {}
68
69
  attributes = options.delete(:attributes) || {}
69
70
  flashvars = options.delete(:flashvars) || {}
70
-
71
- attributes[:classid] ||= "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
71
+
72
+ attributes[:classid] ||= 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
72
73
  attributes[:id] ||= id
73
74
  attributes[:name] ||= id
74
-
75
+
75
76
  output_buffer = ActiveSupport::SafeBuffer.new
76
-
77
+
77
78
  if options[:create_div]
78
- output_buffer << content_tag(:div,
79
- "This website requires <a href='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW' target='_blank'>Flash player</a> #{flash_version} or higher.",
80
- :id => id)
79
+ output_buffer << content_tag(:div,
80
+ "This website requires <a href='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW' target='_blank'>Flash player</a> #{flash_version} or higher.",
81
+ id: id)
81
82
  end
82
-
83
+
83
84
  js = []
84
-
85
- js << "var params = {#{params.to_a.map{|item| "#{item[0]}:'#{item[1]}'" }.join(',')}};"
86
- js << "var attributes = {#{attributes.to_a.map{|item| "#{item[0]}:'#{item[1]}'" }.join(',')}};"
87
- js << "var flashvars = {#{flashvars.to_a.map{|item| "#{item[0]}:'#{item[1]}'" }.join(',')}};"
85
+
86
+ js << "var params = {#{params.to_a.map { |item| "#{item[0]}:'#{item[1]}'" }.join(',')}};"
87
+ js << "var attributes = {#{attributes.to_a.map { |item| "#{item[0]}:'#{item[1]}'" }.join(',')}};"
88
+ js << "var flashvars = {#{flashvars.to_a.map { |item| "#{item[0]}:'#{item[1]}'" }.join(',')}};"
88
89
 
89
90
  js << "swfobject.embedSWF('#{swf}', '#{id}', '#{width}', '#{height}', '#{flash_version}', '/swf/expressInstall.swf', flashvars, params, attributes);"
90
91
 
91
92
  output_buffer << javascript_tag(js.join)
92
-
93
+
93
94
  output_buffer
94
95
  end
95
96
 
96
- def encode_email(email_address, options = {})
97
+ def encode_email(email_address, _options = {})
97
98
  email_address = email_address.to_s
98
99
  string = ''
99
100
 
100
101
  "document.write('#{email_address}');".each_byte do |c|
101
- string << sprintf("%%%x", c)
102
- end
103
-
102
+ string << format('%%%x', c)
103
+ end
104
+
104
105
  "<script type=\"#{Mime::JS}\">eval(decodeURIComponent('#{string}'))</script>"
105
106
  end
106
-
107
107
  end
108
108
  end
109
109
  end
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ostruct'
2
4
 
3
5
  module Sunrise
4
6
  module Views
5
7
  class SearchWrapper < ::OpenStruct
6
8
  extend ActiveModel::Naming
7
-
9
+
8
10
  def self.model_name
9
11
  @_model_name ||= begin
10
- namespace = self.parents.detect { |n| n.respond_to?(:_railtie) }
11
- ActiveModel::Name.new(self, namespace, "search")
12
+ namespace = parents.detect { |n| n.respond_to?(:_railtie) }
13
+ ActiveModel::Name.new(self, namespace, 'search')
12
14
  end
13
15
  end
14
16
  end
@@ -1,24 +1,26 @@
1
- require 'progressbar'
1
+ # frozen_string_literal: true
2
2
 
3
3
  namespace :assets do
4
- desc "Refresh carrierwave assets versions by model (CLASS=)"
5
- task :reprocess => :environment do
4
+ desc 'Refresh carrierwave assets versions by model (CLASS=)'
5
+ task reprocess: :environment do
6
+ require 'progressbar'
7
+
6
8
  name = (ENV['CLASS'] || ENV['class'] || 'Asset').to_s
7
9
  klass = name.safe_constantize
8
-
10
+
9
11
  raise "Cannot find a constant with the #{name} specified in the argument string" if klass.nil?
10
-
12
+
11
13
  pbar = ProgressBar.new(name, klass.count)
12
- pbar.bar_mark = "="
13
-
14
+ pbar.bar_mark = '='
15
+
14
16
  index = 0
15
-
17
+
16
18
  klass.find_each do |item|
17
19
  item.data.recreate_versions!
18
20
  index += 1
19
21
  pbar.set(index)
20
22
  end
21
-
23
+
22
24
  pbar.finish
23
25
  end
24
26
  end