releaf-core 1.1.21 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/config/releaf_core_manifest.js +3 -0
- data/app/assets/images/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png +0 -0
- data/app/assets/images/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
- data/app/assets/images/ckeditor/plugins/flash/images/placeholder.png +0 -0
- data/app/assets/images/ckeditor/plugins/forms/images/hiddenfield.gif +0 -0
- data/app/assets/images/ckeditor/plugins/icons.png +0 -0
- data/app/assets/images/ckeditor/plugins/iframe/images/placeholder.png +0 -0
- data/app/assets/images/ckeditor/plugins/image/images/noimage.png +0 -0
- data/app/assets/images/ckeditor/plugins/link/images/anchor.png +0 -0
- data/app/assets/images/ckeditor/plugins/link/images/hidpi/anchor.png +0 -0
- data/app/assets/images/ckeditor/plugins/magicline/images/hidpi/icon-rtl.png +0 -0
- data/app/assets/images/ckeditor/plugins/magicline/images/hidpi/icon.png +0 -0
- data/app/assets/images/ckeditor/plugins/magicline/images/icon-rtl.png +0 -0
- data/app/assets/images/ckeditor/plugins/magicline/images/icon.png +0 -0
- data/app/assets/images/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
- data/app/assets/images/ckeditor/plugins/showblocks/images/block_address.png +0 -0
- data/app/assets/images/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
- data/app/assets/images/ckeditor/plugins/showblocks/images/block_div.png +0 -0
- data/app/assets/images/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
- data/app/assets/images/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
- data/app/assets/images/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
- data/app/assets/images/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
- data/app/assets/images/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
- data/app/assets/images/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
- data/app/assets/images/ckeditor/plugins/showblocks/images/block_p.png +0 -0
- data/app/assets/images/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/angel_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/angry_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/broken_heart.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/confused_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/cry_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/devil_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/embarrassed_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/embarrassed_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/envelope.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/envelope.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/heart.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/heart.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/kiss.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/kiss.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/lightbulb.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/omg_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/regular_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/sad_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/shades_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/teeth_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/thumbs_down.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/thumbs_up.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/tongue_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/tongue_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
- data/app/assets/images/ckeditor/plugins/smiley/images/wink_smile.png +0 -0
- data/app/assets/images/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
- data/app/assets/images/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
- data/app/assets/images/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
- data/app/assets/images/ckeditor/plugins/widget/images/handle.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/icons.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/icons_hidpi.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/images/arrow.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/images/close.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/images/hidpi/close.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/images/hidpi/lock-open.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/images/hidpi/lock.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/images/hidpi/refresh.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/images/lock-open.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/images/lock.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/images/refresh.png +0 -0
- data/app/assets/images/ckeditor/skins/moono-lisa/images/spinner.gif +0 -0
- data/app/assets/javascripts/ckeditor-jquery.js +3 -0
- data/app/assets/javascripts/ckeditor/CHANGES.md +1637 -0
- data/app/assets/javascripts/ckeditor/LICENSE.md +1420 -0
- data/app/assets/javascripts/ckeditor/README.md +39 -0
- data/app/assets/javascripts/ckeditor/basepath.js.erb +6 -0
- data/app/assets/javascripts/ckeditor/build-config.js +190 -0
- data/app/assets/javascripts/ckeditor/ckeditor.js +1331 -0
- data/app/assets/javascripts/ckeditor/config.js +10 -0
- data/app/assets/javascripts/ckeditor/jquery.js +10 -0
- data/app/assets/javascripts/ckeditor/lang/af.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/ar.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/az.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/bg.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/bn.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/bs.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/ca.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/cs.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/cy.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/da.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/de-ch.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/de.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/el.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/en-au.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/en-ca.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/en-gb.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/en.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/eo.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/es-mx.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/es.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/et.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/eu.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/fa.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/fi.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/fo.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/fr-ca.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/fr.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/gl.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/gu.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/he.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/hi.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/hr.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/hu.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/id.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/is.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/it.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/ja.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/ka.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/km.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/ko.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/ku.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/lt.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/lv.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/mk.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/mn.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/ms.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/nb.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/nl.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/no.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/oc.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/pl.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/pt-br.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/pt.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/ro.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/ru.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/si.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/sk.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/sl.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/sq.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/sr-latn.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/sr.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/sv.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/th.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/tr.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/tt.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/ug.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/uk.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/vi.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/zh-cn.js +5 -0
- data/app/assets/javascripts/ckeditor/lang/zh.js +5 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +10 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/af.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ar.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/az.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/bg.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ca.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cs.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cy.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/da.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/de-ch.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/de.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/el.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en-au.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en-gb.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/eo.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/es-mx.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/es.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/et.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/eu.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fa.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fi.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fo.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fr-ca.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fr.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/gl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/gu.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/he.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hi.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hr.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hu.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/id.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/it.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ja.js +9 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/km.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ko.js +10 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ku.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/lt.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/lv.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/mk.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/mn.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nb.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/no.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/oc.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pl.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt-br.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ro.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/si.js +10 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sk.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sl.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sq.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sr-latn.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sr.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sv.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/th.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/tr.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/tt.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ug.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/uk.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/vi.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/zh-cn.js +9 -0
- data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/zh.js +9 -0
- data/app/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +14 -0
- data/app/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +4 -0
- data/app/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +9 -0
- data/app/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +25 -0
- data/app/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +24 -0
- data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +9 -0
- data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +9 -0
- data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +21 -0
- data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +10 -0
- data/app/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +44 -0
- data/app/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +8 -0
- data/app/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +30 -0
- data/app/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +10 -0
- data/app/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +55 -0
- data/app/assets/javascripts/ckeditor/plugins/preview/preview.html +13 -0
- data/app/assets/javascripts/ckeditor/plugins/scayt/CHANGELOG.md +20 -0
- data/app/assets/javascripts/ckeditor/plugins/scayt/LICENSE.md +28 -0
- data/app/assets/javascripts/ckeditor/plugins/scayt/README.md +25 -0
- data/app/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +32 -0
- data/app/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/af.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ar.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/az.js +10 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/bg.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ca.js +14 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/cs.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/cy.js +14 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/da.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/de-ch.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/de.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/el.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en-au.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en-ca.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en-gb.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/eo.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/es-mx.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/es.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/et.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/eu.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fa.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fi.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fr-ca.js +10 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fr.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/gl.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/he.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/hr.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/hu.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/id.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/it.js +14 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ja.js +9 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/km.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ko.js +10 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ku.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/lt.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/lv.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/nb.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/nl.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/no.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/oc.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pt-br.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pt.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ro.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/si.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sk.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sl.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sq.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sv.js +11 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/th.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/tr.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/tt.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ug.js +13 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/uk.js +12 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/vi.js +14 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/zh-cn.js +9 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/zh.js +9 -0
- data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +14 -0
- data/app/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +21 -0
- data/app/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +18 -0
- data/app/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +10 -0
- data/app/assets/javascripts/ckeditor/plugins/templates/templates/default.js +7 -0
- data/app/assets/javascripts/ckeditor/plugins/wsc/LICENSE.md +28 -0
- data/app/assets/javascripts/ckeditor/plugins/wsc/README.md +25 -0
- data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/ciframe.html +66 -0
- data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +52 -0
- data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +91 -0
- data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc_ie.js +11 -0
- data/app/assets/javascripts/ckeditor/styles.js +137 -0
- data/app/assets/javascripts/releaf/include/remote_validator.js +1 -1
- data/app/assets/javascripts/releaf/include/store_settings.js +2 -2
- data/app/assets/javascripts/releaf/include/url_builder.js +130 -130
- data/app/assets/stylesheets/ckeditor/contents.css +208 -0
- data/app/assets/stylesheets/ckeditor/plugins/colordialog/dialogs/colordialog.css +20 -0
- data/app/assets/stylesheets/ckeditor/plugins/copyformatting/styles/copyformatting.css +45 -0
- data/app/assets/stylesheets/ckeditor/plugins/scayt/dialogs/dialog.css +23 -0
- data/app/assets/stylesheets/ckeditor/plugins/scayt/dialogs/toolbar.css +71 -0
- data/app/assets/stylesheets/ckeditor/plugins/scayt/skins/moono-lisa/scayt.css +25 -0
- data/app/assets/stylesheets/ckeditor/plugins/tableselection/styles/tableselection.css +36 -0
- data/app/assets/stylesheets/ckeditor/plugins/templates/dialogs/templates.css +84 -0
- data/app/assets/stylesheets/ckeditor/plugins/wsc/dialogs/wsc.css +82 -0
- data/app/assets/stylesheets/ckeditor/plugins/wsc/skins/moono-lisa/wsc.css +43 -0
- data/app/assets/stylesheets/ckeditor/skins/moono-lisa/dialog.css +5 -0
- data/app/assets/stylesheets/ckeditor/skins/moono-lisa/dialog_ie.css +5 -0
- data/app/assets/stylesheets/ckeditor/skins/moono-lisa/dialog_ie8.css +5 -0
- data/app/assets/stylesheets/ckeditor/skins/moono-lisa/dialog_iequirks.css +5 -0
- data/app/assets/stylesheets/ckeditor/skins/moono-lisa/editor.css +5 -0
- data/app/assets/stylesheets/ckeditor/skins/moono-lisa/editor_gecko.css +5 -0
- data/app/assets/stylesheets/ckeditor/skins/moono-lisa/editor_ie.css +5 -0
- data/app/assets/stylesheets/ckeditor/skins/moono-lisa/editor_ie8.css +5 -0
- data/app/assets/stylesheets/ckeditor/skins/moono-lisa/editor_iequirks.css +5 -0
- data/app/builders/releaf/builders.rb +4 -1
- data/app/builders/releaf/builders/base.rb +1 -1
- data/app/builders/releaf/builders/form_builder/associations.rb +1 -1
- data/app/builders/releaf/builders/page/layout_builder.rb +1 -1
- data/app/builders/releaf/builders/pagination_builder.rb +1 -1
- data/app/builders/releaf/builders/table_builder.rb +0 -1
- data/app/controllers/releaf/action_controller.rb +2 -2
- data/app/controllers/releaf/root_controller.rb +9 -7
- data/app/helpers/releaf/application_helper.rb +2 -2
- data/app/lib/releaf/action_controller/features.rb +1 -6
- data/app/lib/releaf/build_errors_hash.rb +12 -12
- data/app/lib/releaf/responders.rb +0 -1
- data/app/lib/releaf/search.rb +5 -18
- data/app/models/releaf/settings.rb +1 -1
- data/app/views/releaf/action/create_releaf_richtext_attachment.haml +2 -1
- data/app/views/releaf/error_pages/access_denied.html.haml +1 -1
- data/lib/generators/dummy/install_generator.rb +2 -1
- data/lib/generators/dummy/templates/assets/config/manifest.js +3 -0
- data/lib/generators/dummy/templates/controllers/application_controller.rb +1 -1
- data/lib/generators/dummy/templates/migrations/create_authors.rb +1 -1
- data/lib/generators/dummy/templates/migrations/create_banner_groups.rb +1 -1
- data/lib/generators/dummy/templates/migrations/create_banner_pages.rb +2 -2
- data/lib/generators/dummy/templates/migrations/create_banners.rb +2 -2
- data/lib/generators/dummy/templates/migrations/create_book_sequels.rb +1 -1
- data/lib/generators/dummy/templates/migrations/create_books.rb +1 -1
- data/lib/generators/dummy/templates/migrations/create_bundles.rb +1 -1
- data/lib/generators/dummy/templates/migrations/create_chapters.rb +1 -1
- data/lib/generators/dummy/templates/migrations/create_home_pages.rb +1 -1
- data/lib/generators/dummy/templates/migrations/create_node_extra_fields.rb +1 -1
- data/lib/generators/dummy/templates/migrations/create_other_nodes.rb +1 -1
- data/lib/generators/dummy/templates/migrations/create_publishers.rb +1 -1
- data/lib/generators/dummy/templates/migrations/create_text_pages.rb +1 -1
- data/lib/generators/dummy/templates/models/author.rb +1 -1
- data/lib/generators/dummy/templates/models/banner.rb +1 -1
- data/lib/generators/dummy/templates/models/banner_group.rb +1 -1
- data/lib/generators/dummy/templates/models/book.rb +1 -1
- data/lib/generators/releaf/templates/migrations/create_releaf_nodes.rb +1 -1
- data/lib/generators/releaf/templates/migrations/create_releaf_permissions.rb +1 -1
- data/lib/generators/releaf/templates/migrations/create_releaf_richtext_attachments.rb +1 -1
- data/lib/generators/releaf/templates/migrations/create_releaf_roles.rb +1 -1
- data/lib/generators/releaf/templates/migrations/create_releaf_settings.rb +1 -1
- data/lib/generators/releaf/templates/migrations/create_releaf_translations.rb +1 -1
- data/lib/generators/releaf/templates/migrations/create_releaf_users.rb +1 -1
- data/lib/releaf-core.rb +1 -2
- data/lib/releaf/engine.rb +2 -3
- data/lib/releaf/rails_ext/globalize-accessors.rb +64 -0
- data/lib/releaf/rails_ext/validation_error_codes.rb +0 -36
- metadata +420 -222
- data/app/lib/releaf/responders/feature_disabled_responder.rb +0 -9
- data/app/views/releaf/error_pages/feature_disabled.html.haml +0 -1
- data/spec/builders/releaf/builders/association_reflector_spec.rb +0 -138
- data/spec/builders/releaf/builders/base_spec.rb +0 -272
- data/spec/builders/releaf/builders/collection_spec.rb +0 -18
- data/spec/builders/releaf/builders/confirm_destroy_dialog_builder_spec.rb +0 -71
- data/spec/builders/releaf/builders/confirm_dialog_builder_spec.rb +0 -107
- data/spec/builders/releaf/builders/edit_builder_spec.rb +0 -322
- data/spec/builders/releaf/builders/form_builder/associations_spec.rb +0 -129
- data/spec/builders/releaf/builders/form_builder/date_fields_spec.rb +0 -86
- data/spec/builders/releaf/builders/form_builder/i18n_fields_spec.rb +0 -48
- data/spec/builders/releaf/builders/form_builder/label_spec.rb +0 -106
- data/spec/builders/releaf/builders/form_builder/number_fields_spec.rb +0 -37
- data/spec/builders/releaf/builders/form_builder_spec.rb +0 -228
- data/spec/builders/releaf/builders/index_builder_spec.rb +0 -364
- data/spec/builders/releaf/builders/page/header_builder_spec.rb +0 -65
- data/spec/builders/releaf/builders/page/layout_builder_spec.rb +0 -237
- data/spec/builders/releaf/builders/page/menu_builder_spec.rb +0 -345
- data/spec/builders/releaf/builders/pagination_builder_spec.rb +0 -330
- data/spec/builders/releaf/builders/resource_dialog_spec.rb +0 -21
- data/spec/builders/releaf/builders/resource_view_spec.rb +0 -158
- data/spec/builders/releaf/builders/show_builder_spec.rb +0 -7
- data/spec/builders/releaf/builders/table_builder_spec.rb +0 -637
- data/spec/builders/releaf/builders/template_spec.rb +0 -12
- data/spec/builders/releaf/builders/toolbox_builder_spec.rb +0 -67
- data/spec/builders/releaf/builders/toolbox_spec.rb +0 -48
- data/spec/builders/releaf/builders/utilities/date_fields_spec.rb +0 -125
- data/spec/builders/releaf/builders/utilities/resolve_attribute_field_method_name_spec.rb +0 -318
- data/spec/builders/releaf/builders/view_spec.rb +0 -281
- data/spec/builders/releaf/builders_spec.rb +0 -134
- data/spec/builders/releaf/settings/form_builder_spec.rb +0 -48
- data/spec/builders/releaf/settings/table_builder_spec.rb +0 -23
- data/spec/controllers/concerns/releaf/richtext_attachments_spec.rb +0 -51
- data/spec/controllers/releaf/action_controller_spec.rb +0 -423
- data/spec/controllers/releaf/root_controller_spec.rb +0 -45
- data/spec/controllers/releaf/settings_controller_spec.rb +0 -52
- data/spec/error_hash_builder_spec.rb +0 -83
- data/spec/ext/array_reorder_spec.rb +0 -12
- data/spec/features/ajaxbox_spec.rb +0 -111
- data/spec/features/authorization_spec.rb +0 -50
- data/spec/features/breadcrumbs_spec.rb +0 -16
- data/spec/features/dragonfly_integration_spec.rb +0 -24
- data/spec/features/edit_actions_spec.rb +0 -186
- data/spec/features/errors_spec.rb +0 -47
- data/spec/features/index_actions_spec.rb +0 -85
- data/spec/features/index_table_spec.rb +0 -35
- data/spec/features/menu_spec.rb +0 -71
- data/spec/features/richtext_attachments_spec.rb +0 -64
- data/spec/features/richtext_custom_config_spec.rb +0 -28
- data/spec/features/richtext_embed_spec.rb +0 -29
- data/spec/features/richtext_spec.rb +0 -31
- data/spec/features/search_spec.rb +0 -825
- data/spec/features/settings_spec.rb +0 -70
- data/spec/features/title_spec.rb +0 -13
- data/spec/fixtures/common_fields.yml +0 -17
- data/spec/fixtures/cs.png +0 -0
- data/spec/fixtures/time.formats.xlsx +0 -0
- data/spec/fixtures/unicorn.jpg +0 -0
- data/spec/helpers/application_helper_spec.rb +0 -73
- data/spec/helpers/button_helper_spec.rb +0 -146
- data/spec/lib/releaf/action_controller/features_spec.rb +0 -171
- data/spec/lib/releaf/action_controller/search_spec.rb +0 -84
- data/spec/lib/releaf/application_spec.rb +0 -43
- data/spec/lib/releaf/assets_resolver_spec.rb +0 -130
- data/spec/lib/releaf/build_errors_hash_spec.rb +0 -141
- data/spec/lib/releaf/configuration_spec.rb +0 -205
- data/spec/lib/releaf/controller_definition_spec.rb +0 -78
- data/spec/lib/releaf/controller_group_definition_spec.rb +0 -33
- data/spec/lib/releaf/default_searchable_fields_spec.rb +0 -161
- data/spec/lib/releaf/instance_cache_spec.rb +0 -98
- data/spec/lib/releaf/resource_base_spec.rb +0 -212
- data/spec/lib/releaf/resource_fields_spec.rb +0 -12
- data/spec/lib/releaf/resource_params_spec.rb +0 -115
- data/spec/lib/releaf/resource_table_fields_spec.rb +0 -20
- data/spec/lib/releaf/resource_utilities_spec.rb +0 -87
- data/spec/lib/releaf/responders/access_denied_responder_spec.rb +0 -12
- data/spec/lib/releaf/responders/after_save_responder_spec.rb +0 -88
- data/spec/lib/releaf/responders/confirm_destroy_responder_spec.rb +0 -26
- data/spec/lib/releaf/responders/destroy_responder_spec.rb +0 -30
- data/spec/lib/releaf/responders/error_responder_spec.rb +0 -26
- data/spec/lib/releaf/responders/feature_disabled_responder_spec.rb +0 -12
- data/spec/lib/releaf/responders/page_not_found_responder_spec.rb +0 -12
- data/spec/lib/releaf/responders_spec.rb +0 -60
- data/spec/lib/releaf/root/configuration_spec.rb +0 -9
- data/spec/lib/releaf/root/default_controller_resolver_spec.rb +0 -44
- data/spec/lib/releaf/root_spec.rb +0 -13
- data/spec/lib/releaf/service_spec.rb +0 -20
- data/spec/lib/releaf/settings/normalize_value_spec.rb +0 -103
- data/spec/lib/releaf/settings/register_spec.rb +0 -135
- data/spec/lib/releaf/settings_manager_spec.rb +0 -22
- data/spec/lib/validation_error_codes_spec.rb +0 -56
- data/spec/misc/factories_spec.rb +0 -31
- data/spec/models/settings_spec.rb +0 -100
- data/spec/routing/route_mapper_spec.rb +0 -185
- data/spec/rspec_helpers/test_helpers_spec.rb +0 -20
- data/spec/rspec_helpers/test_spec.rb +0 -14
- data/spec/services/array/reorder_spec.rb +0 -121
@@ -1,345 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
describe Releaf::Builders::Page::MenuBuilder, type: :class do
|
4
|
-
class MenuBuilderTestHelper < ActionView::Base
|
5
|
-
include FontAwesome::Rails::IconHelper
|
6
|
-
end
|
7
|
-
|
8
|
-
let(:controller){ Releaf::ActionController.new }
|
9
|
-
let(:template){ MenuBuilderTestHelper.new }
|
10
|
-
let(:group_item){ Releaf::ControllerGroupDefinition.new(name: "_group_name", items: []) }
|
11
|
-
let(:controller_item){ Releaf::ControllerDefinition.new(name: "y", controller: "_controller_") }
|
12
|
-
subject { described_class.new(template) }
|
13
|
-
|
14
|
-
before do
|
15
|
-
allow(template).to receive(:controller).and_return(controller)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "includes Releaf::Builders::Base" do
|
19
|
-
expect(described_class.ancestors).to include(Releaf::Builders::Base)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "includes Releaf::Builders::Template" do
|
23
|
-
expect(described_class.ancestors).to include(Releaf::Builders::Template)
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "#output" do
|
27
|
-
it "returns compacter and first level menu" do
|
28
|
-
allow(Releaf.application.config).to receive(:menu).and_return("_menu_config")
|
29
|
-
allow(subject).to receive(:compacter).and_return("cmpt")
|
30
|
-
allow(subject).to receive(:menu_level).with("_menu_config").and_return("_items")
|
31
|
-
|
32
|
-
expect(subject.output).to eq("cmpt<nav>_items</nav>")
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe "#active?" do
|
37
|
-
context "when item is instance of `Releaf::ControllerGroupDefinition`" do
|
38
|
-
before do
|
39
|
-
allow(subject).to receive(:active?).and_call_original
|
40
|
-
allow(group_item).to receive(:controllers).and_return([:a, :b, :c])
|
41
|
-
end
|
42
|
-
|
43
|
-
context "when any of group item controller is active" do
|
44
|
-
it "returns true" do
|
45
|
-
allow(subject).to receive(:active?).with(:a).and_return(false)
|
46
|
-
allow(subject).to receive(:active?).with(:b).and_return(true)
|
47
|
-
expect(subject).to_not receive(:active?).with(:c)
|
48
|
-
expect(subject.active?(group_item)).to be true
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
context "when none of group item controller is active" do
|
53
|
-
it "returns false" do
|
54
|
-
allow(subject).to receive(:active?).with(:a).and_return(false)
|
55
|
-
allow(subject).to receive(:active?).with(:b).and_return(false)
|
56
|
-
allow(subject).to receive(:active?).with(:c).and_return(false)
|
57
|
-
expect(subject.active?(group_item)).to be false
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context "when item is instance of `Releaf::ControllerDefinition`" do
|
63
|
-
context "when item controller name is same as current controller short name" do
|
64
|
-
it "returns true" do
|
65
|
-
allow(controller).to receive(:short_name).and_return("_controller_")
|
66
|
-
expect(subject.active?(controller_item)).to be true
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context "when item controller name is not same as current controller short name" do
|
71
|
-
it "returns false" do
|
72
|
-
allow(controller).to receive(:short_name).and_return("_another_controller_")
|
73
|
-
expect(subject.active?(controller_item)).to be false
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
describe "#menu_level" do
|
80
|
-
it "returns unordered list of menu level from given items" do
|
81
|
-
allow(subject).to receive(:menu_item).with("a").and_return("_a_")
|
82
|
-
allow(subject).to receive(:menu_item).with("b").and_return("_b_")
|
83
|
-
expect(subject.menu_level(%w(a b))).to eq("<ul>_a__b_</ul>")
|
84
|
-
end
|
85
|
-
|
86
|
-
context "when all menu items content is empty" do
|
87
|
-
it "returns nil" do
|
88
|
-
allow(subject).to receive(:menu_item).with("a").and_return(nil)
|
89
|
-
allow(subject).to receive(:menu_item).with("b").and_return(nil)
|
90
|
-
expect(subject.menu_level(%w(a b))).to be nil
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "#menu_item" do
|
96
|
-
before do
|
97
|
-
allow(subject).to receive(:item_attributes).with(controller_item).and_return(class: "red")
|
98
|
-
allow(subject).to receive(:menu_item_single).with(controller_item).and_return("_item")
|
99
|
-
allow(subject).to receive(:item_attributes).with(group_item).and_return(class: "blue")
|
100
|
-
allow(subject).to receive(:menu_item_group).with(group_item).and_return("_items_group")
|
101
|
-
end
|
102
|
-
|
103
|
-
context "when item is instance of `Releaf::ControllerDefinition`" do
|
104
|
-
it "returns single menu item" do
|
105
|
-
expect(subject.menu_item(controller_item)).to eq("<li class=\"red\">_item</li>")
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
context "when item is instance of `Releaf::ControllerGroupDefinition`" do
|
110
|
-
it "returns group menu item" do
|
111
|
-
expect(subject.menu_item(group_item)).to eq("<li class=\"blue\">_items_group</li>")
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
describe "#menu_item_single" do
|
117
|
-
it "returns single menu item" do
|
118
|
-
allow(controller_item).to receive(:path).and_return("_url")
|
119
|
-
allow(subject).to receive(:item_name_content).with(controller_item).and_return("_name")
|
120
|
-
expect(subject.menu_item_single(controller_item)).to eq("<a class=\"trigger\" href=\"_url\">_name</a>")
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
describe "#menu_item_group" do
|
125
|
-
it "returns group menu item" do
|
126
|
-
allow(group_item).to receive(:controllers).and_return(["a"])
|
127
|
-
allow(subject).to receive(:item_collapser).with(group_item).and_return("_collapser")
|
128
|
-
allow(subject).to receive(:item_name_content).with(group_item).and_return("_name")
|
129
|
-
allow(subject).to receive(:menu_level).with(["a"]).and_return("_level")
|
130
|
-
expect(subject.menu_item_group(group_item)).to eq("<span class=\"trigger\">_name_collapser</span>_level")
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe "#collapsed_item?" do
|
135
|
-
before do
|
136
|
-
allow(subject).to receive(:layout_settings).with("releaf.menu.collapsed._group_name").and_return(true)
|
137
|
-
allow(subject).to receive(:active?).with(group_item).and_return(false)
|
138
|
-
end
|
139
|
-
|
140
|
-
context "when non-active and permanently collapsed group item given" do
|
141
|
-
it "returns true" do
|
142
|
-
expect(subject.collapsed_item?(group_item)).to be true
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
context "when non-active and non-permanently collapsed group item given" do
|
147
|
-
it "returns false" do
|
148
|
-
allow(subject).to receive(:layout_settings).with("releaf.menu.collapsed._group_name").and_return(false)
|
149
|
-
expect(subject.collapsed_item?(group_item)).to be false
|
150
|
-
|
151
|
-
allow(subject).to receive(:layout_settings).with("releaf.menu.collapsed._group_name").and_return(nil)
|
152
|
-
expect(subject.collapsed_item?(group_item)).to be false
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
context "when active and permanently collapsed group item given" do
|
157
|
-
it "returns false" do
|
158
|
-
allow(subject).to receive(:active?).with(group_item).and_return(true)
|
159
|
-
expect(subject.collapsed_item?(group_item)).to be false
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
context "when non-active and permanently collapsed single item given" do
|
164
|
-
it "returns false" do
|
165
|
-
expect(subject).to_not receive(:active?)
|
166
|
-
expect(subject.collapsed_item?(controller_item)).to be false
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
describe "#item_attributes" do
|
172
|
-
it "returns data name and classes within hash" do
|
173
|
-
allow(subject).to receive(:item_classes).with(controller_item).and_return(["ol", "al"])
|
174
|
-
expect(subject.item_attributes(controller_item)).to eq(class: ["ol", "al"], data: {name: "y"})
|
175
|
-
end
|
176
|
-
|
177
|
-
context "when classes attribute is empty" do
|
178
|
-
it "does not return class attribute within returned hash" do
|
179
|
-
allow(subject).to receive(:item_classes).with(controller_item).and_return([])
|
180
|
-
expect(subject.item_attributes(controller_item)).to_not include(:class)
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
describe "#item_classes" do
|
186
|
-
context "when given item is active" do
|
187
|
-
it "adds `active` class to returned array" do
|
188
|
-
allow(subject).to receive(:active?).with(controller_item).and_return(true)
|
189
|
-
expect(subject.item_classes(controller_item)).to include("active")
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
context "when given item is collapsed" do
|
194
|
-
it "adds `collapsed` class to returned array" do
|
195
|
-
allow(subject).to receive(:collapsed_item?).with(controller_item).and_return(true)
|
196
|
-
expect(subject.item_classes(controller_item)).to include("collapsed")
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
context "when no extra classes added" do
|
201
|
-
it "returns empty array" do
|
202
|
-
allow(subject).to receive(:active?).with(controller_item).and_return(false)
|
203
|
-
expect(subject.item_classes(controller_item)).to eq([])
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
describe "#item_name_content" do
|
209
|
-
it "returns abbreviation and full name elements" do
|
210
|
-
allow(controller_item).to receive(:localized_name).and_return('Item full name')
|
211
|
-
allow(subject).to receive(:item_name_abbreviation).with('Item full name').and_return('Item abbreviation')
|
212
|
-
expect( subject.item_name_content(controller_item) ).to eq('<abbr title="Item full name">Item abbreviation</abbr><span class="name">Item full name</span>')
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
describe "#item_name_abbreviation" do
|
217
|
-
|
218
|
-
it "returns first two letters of given text string" do
|
219
|
-
expect( subject.item_name_abbreviation( "Foo bar" )).to eq("Fo")
|
220
|
-
end
|
221
|
-
|
222
|
-
context "when the first two letters are lowercase" do
|
223
|
-
it "capitalizes the first letter" do
|
224
|
-
expect( subject.item_name_abbreviation( "foo bar" )).to eq("Fo")
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
context "when the first two letters are uppercase" do
|
229
|
-
it "makes the second letter lowercase" do
|
230
|
-
expect( subject.item_name_abbreviation( "FOO BAR" )).to eq("Fo")
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
context "when the string contains slashes" do
|
235
|
-
|
236
|
-
it "uses the first word after the last slash" do
|
237
|
-
expect( subject.item_name_abbreviation( "Releaf/core/settings" )).to eq("Se")
|
238
|
-
end
|
239
|
-
|
240
|
-
it "ignores slashes surrounded by spaces" do
|
241
|
-
expect( subject.item_name_abbreviation( "Inputs / Outputs" )).to eq("In")
|
242
|
-
end
|
243
|
-
|
244
|
-
it "ignores trailing slashes" do
|
245
|
-
expect( subject.item_name_abbreviation( "Releaf/core/settings/" )).to eq("Se")
|
246
|
-
end
|
247
|
-
|
248
|
-
context "when string consists of a single slash" do
|
249
|
-
it "returns an empty string" do
|
250
|
-
expect( subject.item_name_abbreviation( "/" )).to eq("")
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
it "works with non-latin characters" do
|
256
|
-
expect( subject.item_name_abbreviation( "žņ" )).to eq("Žņ")
|
257
|
-
end
|
258
|
-
|
259
|
-
context "when given an empty string value" do
|
260
|
-
it "returns an empty string" do
|
261
|
-
expect( subject.item_name_abbreviation( "" )).to eq("")
|
262
|
-
end
|
263
|
-
end
|
264
|
-
|
265
|
-
context "when given nil" do
|
266
|
-
it "returns an empty string" do
|
267
|
-
expect( subject.item_name_abbreviation( nil )).to eq("")
|
268
|
-
end
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
describe "#item_collapser" do
|
273
|
-
|
274
|
-
it "returns a collapser span with a button and collapser icon" do
|
275
|
-
allow(subject).to receive(:item_collapser_icon).with(:foo).and_return(subject.icon('dummy'))
|
276
|
-
expect(subject.item_collapser(:foo)).to eq '<span class="collapser"><button type="button"><i class="fa fa-dummy"></i></button></span>'
|
277
|
-
end
|
278
|
-
|
279
|
-
end
|
280
|
-
|
281
|
-
describe "#item_collapser_icon" do
|
282
|
-
let(:item) { {} }
|
283
|
-
|
284
|
-
before do
|
285
|
-
allow(subject).to receive(:layout_settings).with('releaf.side.compact').and_return(false)
|
286
|
-
end
|
287
|
-
|
288
|
-
context "when side is compacted in layout settings" do
|
289
|
-
it "returns a beak pointing right" do
|
290
|
-
allow(subject).to receive(:layout_settings).with('releaf.side.compact').and_return(true)
|
291
|
-
allow(subject).to receive(:icon).with('chevron-right').and_return("icon ok")
|
292
|
-
expect(subject.item_collapser_icon(item)).to eq "icon ok"
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
context "when side is not compacted in layout settings" do
|
297
|
-
context "when the given item is collapsed" do
|
298
|
-
it "returns a beak pointing down" do
|
299
|
-
allow(subject).to receive(:collapsed_item?).with(item).and_return(true)
|
300
|
-
allow(subject).to receive(:icon).with('chevron-down').and_return("icon ok")
|
301
|
-
expect(subject.item_collapser_icon(item)).to eq "icon ok"
|
302
|
-
end
|
303
|
-
end
|
304
|
-
context "when the given item is expanded" do
|
305
|
-
it "returns a beak pointing up" do
|
306
|
-
allow(subject).to receive(:collapsed_item?).with(item).and_return(false)
|
307
|
-
allow(subject).to receive(:icon).with('chevron-up').and_return("icon ok")
|
308
|
-
expect(subject.item_collapser_icon(item)).to eq "icon ok"
|
309
|
-
end
|
310
|
-
end
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
describe "#compact_side?" do
|
315
|
-
it "returns layout settings for `releaf.side.compact`" do
|
316
|
-
allow(subject).to receive(:layout_settings).with("releaf.side.compact").and_return("_ls")
|
317
|
-
expect(subject.compact_side?).to eq("_ls")
|
318
|
-
end
|
319
|
-
end
|
320
|
-
|
321
|
-
describe "#compacter" do
|
322
|
-
before do
|
323
|
-
allow(subject).to receive(:button)
|
324
|
-
.with(nil, "angle-double-right", title: "Expand", data: {"title-expand"=>"Expand", "title-collapse"=>"Collapse"})
|
325
|
-
.and_return("_expand_btn")
|
326
|
-
allow(subject).to receive(:button)
|
327
|
-
.with(nil, "angle-double-left", title: "Collapse", data: {"title-expand"=>"Expand", "title-collapse"=>"Collapse"})
|
328
|
-
.and_return("_collapse_btn")
|
329
|
-
end
|
330
|
-
|
331
|
-
context "when compact mode" do
|
332
|
-
it "returns expanding button" do
|
333
|
-
allow(subject).to receive(:compact_side?).and_return(true)
|
334
|
-
expect(subject.compacter).to eq("<div class=\"compacter\">_expand_btn</div>")
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
context "when non-compact mode" do
|
339
|
-
it "returns collapsing button" do
|
340
|
-
allow(subject).to receive(:compact_side?).and_return(false)
|
341
|
-
expect(subject.compacter).to eq("<div class=\"compacter\">_collapse_btn</div>")
|
342
|
-
end
|
343
|
-
end
|
344
|
-
end
|
345
|
-
end
|
@@ -1,330 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
describe Releaf::Builders::PaginationBuilder, type: :class do
|
4
|
-
|
5
|
-
class PaginationTestView < ActionView::Base
|
6
|
-
include Releaf::ApplicationHelper
|
7
|
-
include Releaf::ButtonHelper
|
8
|
-
include FontAwesome::Rails::IconHelper
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:template){ PaginationTestView.new }
|
12
|
-
|
13
|
-
let(:items_per_page) { 3 }
|
14
|
-
let(:current_page_number) { 1 }
|
15
|
-
let(:collection){ Book.page(current_page_number).per_page(items_per_page) }
|
16
|
-
let(:params){ { search: "xxx"} }
|
17
|
-
let(:subject){ described_class.new(template, collection: collection, params: params ) }
|
18
|
-
|
19
|
-
before do |example|
|
20
|
-
unless example.metadata[:stub_url_for] === false
|
21
|
-
allow(template).to receive(:url_for) { |params| "http://example.com/?#{params.to_query}" }
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
it "provides accessor for template given in constructor" do
|
26
|
-
subject = described_class.new( :foo )
|
27
|
-
expect( subject.template ).to eq :foo
|
28
|
-
end
|
29
|
-
|
30
|
-
it "provides accessor for collection given in constructor" do
|
31
|
-
subject = described_class.new( nil, collection: :foo )
|
32
|
-
expect( subject.collection ).to eq :foo
|
33
|
-
end
|
34
|
-
|
35
|
-
it "provides accessor for params given in constructor" do
|
36
|
-
subject = described_class.new( nil, params: :foo )
|
37
|
-
expect( subject.params ).to eq :foo
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
describe "#output" do
|
42
|
-
|
43
|
-
context "when collection has no entries" do
|
44
|
-
it "returns nil" do
|
45
|
-
expect(subject.total_entries).to eq 0
|
46
|
-
expect(subject).to_not receive(:pagination_block)
|
47
|
-
expect(subject.output).to be nil
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context "when collection has less entries than allowed on one page" do
|
52
|
-
before do
|
53
|
-
FactoryGirl.create( :book )
|
54
|
-
end
|
55
|
-
|
56
|
-
it "returns nil" do
|
57
|
-
expect(subject.total_entries).to eq 1
|
58
|
-
expect(subject).to_not receive(:pagination_block)
|
59
|
-
expect(subject.output).to be nil
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context "when collection has exactly the number of entries that fits on one page" do
|
64
|
-
before do
|
65
|
-
items_per_page.times do
|
66
|
-
FactoryGirl.create( :book )
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
it "returns nil" do
|
71
|
-
expect(subject.total_entries).to eq 3
|
72
|
-
expect(subject).to_not receive(:pagination_block)
|
73
|
-
expect(subject.output).to be nil
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
context "when collection has more than one page" do
|
79
|
-
before do
|
80
|
-
(items_per_page + 1).times do
|
81
|
-
FactoryGirl.create( :book )
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
it "returns #pagination_block" do
|
86
|
-
expect(subject.total_entries).to eq 4
|
87
|
-
expect(subject).to receive(:pagination_block).and_return('ok')
|
88
|
-
expect(subject.output).to eq "ok"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
describe "#pagination_block" do
|
95
|
-
|
96
|
-
let(:current_page_number) { 2 }
|
97
|
-
|
98
|
-
it "returns pagination parts wrapped in a container" do
|
99
|
-
allow(subject).to receive(:pagination_parts).and_return [ "<strong>weak</strong>".html_safe, "<escape_me>" ]
|
100
|
-
expect(subject.pagination_block).to match_html %Q[
|
101
|
-
<div class="pagination">
|
102
|
-
<strong>weak</strong>
|
103
|
-
<escape_me>
|
104
|
-
</div>
|
105
|
-
]
|
106
|
-
end
|
107
|
-
|
108
|
-
it "returns pagination buttons and select with options" do
|
109
|
-
|
110
|
-
14.times do
|
111
|
-
FactoryGirl.create :book
|
112
|
-
end
|
113
|
-
|
114
|
-
expect(subject.pagination_block).to match_html %Q[
|
115
|
-
<div class="pagination">
|
116
|
-
|
117
|
-
<a class="button only-icon secondary previous" title="Previous page" rel="prev" href="http://example.com/?page=1&search=xxx">
|
118
|
-
<i class="fa fa-chevron-left"></i>
|
119
|
-
</a>
|
120
|
-
|
121
|
-
<select name="page">
|
122
|
-
<option value="1">1-3</option>
|
123
|
-
<option value="2" selected="selected">4-6</option>
|
124
|
-
<option value="3">7-9</option>
|
125
|
-
<option value="4">10-12</option>
|
126
|
-
<option value="5">13-14</option>
|
127
|
-
</select>
|
128
|
-
|
129
|
-
<a class="button only-icon secondary next" title="Next page" rel="next" href="http://example.com/?page=3&search=xxx">
|
130
|
-
<i class="fa fa-chevron-right"></i>
|
131
|
-
</a>
|
132
|
-
|
133
|
-
</div>
|
134
|
-
]
|
135
|
-
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
|
140
|
-
|
141
|
-
describe "#pagination_parts" do
|
142
|
-
it "returns an array with previous page button, page select and next page button" do
|
143
|
-
allow(subject).to receive(:previous_page_button).and_return("previous")
|
144
|
-
allow(subject).to receive(:next_page_button).and_return("next")
|
145
|
-
allow(subject).to receive(:pagination_select).and_return("select")
|
146
|
-
expect(subject.pagination_parts).to eq [ "previous", "select", "next" ]
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
|
151
|
-
def previous_page_button
|
152
|
-
page_button( -1, 'previous', 'chevron-left' )
|
153
|
-
end
|
154
|
-
|
155
|
-
def next_page_button
|
156
|
-
page_button( 1, 'next', 'chevron-right' )
|
157
|
-
end
|
158
|
-
|
159
|
-
describe "#previous_page_button" do
|
160
|
-
it "returns #page_button with -1 offset and appropriate class and icon names" do
|
161
|
-
expect(subject).to receive(:page_button).with( -1, 'previous', 'chevron-left').and_return('ok')
|
162
|
-
expect(subject.previous_page_button).to eq 'ok'
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
describe "#next_page_button" do
|
167
|
-
it "returns #page_button with +1 offset and appropriate class and icon names" do
|
168
|
-
expect(subject).to receive(:page_button).with( 1, 'next', 'chevron-right').and_return('ok')
|
169
|
-
expect(subject.next_page_button).to eq 'ok'
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
describe "#page_button" do
|
174
|
-
|
175
|
-
before do
|
176
|
-
allow(subject).to receive(:t).with('Foo page', scope: 'pagination').and_return('Foo page label')
|
177
|
-
allow(subject).to receive(:t).with('Bar page', scope: 'pagination').and_return('Bar page label')
|
178
|
-
|
179
|
-
end
|
180
|
-
|
181
|
-
context "when calculated relative page number is valid" do
|
182
|
-
|
183
|
-
it "returns a button with correct class and rel attributes and a href pointing to the offset page" do
|
184
|
-
|
185
|
-
5.times do
|
186
|
-
FactoryGirl.create(:book)
|
187
|
-
end
|
188
|
-
|
189
|
-
expect(subject.page_button( 1, 'foo', 'foo-icon' )).to match_html %Q[
|
190
|
-
<a class="button only-icon secondary foo" title="Foo page label" rel="next" href="http://example.com/?page=2&search=xxx">
|
191
|
-
<i class="fa fa-foo-icon"></i>
|
192
|
-
</a>
|
193
|
-
]
|
194
|
-
end
|
195
|
-
|
196
|
-
end
|
197
|
-
|
198
|
-
context "when the calculated relative page number is invalid" do
|
199
|
-
|
200
|
-
it "returns a disabled button with correct class" do
|
201
|
-
expect(subject.page_button( -1, 'bar', 'bar-icon' )).to match_html %Q[
|
202
|
-
<button class="button only-icon secondary bar" title="Bar page label" type="button" autocomplete="off" disabled="disabled">
|
203
|
-
<i class="fa fa-bar-icon"></i>
|
204
|
-
</button>
|
205
|
-
]
|
206
|
-
end
|
207
|
-
|
208
|
-
end
|
209
|
-
|
210
|
-
end
|
211
|
-
|
212
|
-
|
213
|
-
describe "#page_numbers" do
|
214
|
-
|
215
|
-
it "returns an array of integers from 1 to total number of pages" do
|
216
|
-
allow(collection).to receive(:total_pages).and_return(12)
|
217
|
-
expect(subject.page_numbers).to eq [1,2,3,4,5,6,7,8,9,10,11,12]
|
218
|
-
end
|
219
|
-
|
220
|
-
end
|
221
|
-
|
222
|
-
|
223
|
-
describe "#relative_page_number" do
|
224
|
-
|
225
|
-
before do
|
226
|
-
allow(collection).to receive(:current_page).and_return(3)
|
227
|
-
allow(collection).to receive(:total_pages).and_return(12)
|
228
|
-
end
|
229
|
-
|
230
|
-
context "when adding the offset to current page number" do
|
231
|
-
context "results in a valid page number" do
|
232
|
-
it "returns the page number" do
|
233
|
-
expect(subject.relative_page_number(-1)).to eq 2
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
context "results in a page number larger than the total number of pages" do
|
238
|
-
it "returns nil" do
|
239
|
-
expect(subject.relative_page_number(10)).to be nil
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
context "results in a page number less than one" do
|
244
|
-
it "returns nil" do
|
245
|
-
expect(subject.relative_page_number(-3)).to be nil
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
end
|
251
|
-
|
252
|
-
|
253
|
-
describe "#relative_page_relationship" do
|
254
|
-
|
255
|
-
context "when given -1" do
|
256
|
-
it "returns :prev" do
|
257
|
-
expect(subject.relative_page_relationship(-1)).to eq :prev
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
context "when given 1" do
|
262
|
-
it "returns :next" do
|
263
|
-
expect(subject.relative_page_relationship(1)).to eq :next
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
[0, -2, 3, nil, true, false].each do |arg|
|
268
|
-
context "when given #{arg.nil? ? 'nil' : arg.to_s}" do
|
269
|
-
it "returns nil" do
|
270
|
-
expect(subject.relative_page_relationship(arg)).to be nil
|
271
|
-
end
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
end
|
276
|
-
|
277
|
-
describe "#page_url", stub_url_for: false do
|
278
|
-
|
279
|
-
it "calls url_for on template with added page number param" do
|
280
|
-
expect(template).to receive(:url_for).with( search: "xxx", page: 3).and_return("ok")
|
281
|
-
expect(subject.page_url(3)).to eq "ok"
|
282
|
-
end
|
283
|
-
|
284
|
-
end
|
285
|
-
|
286
|
-
describe "#pagination_select" do
|
287
|
-
|
288
|
-
it "returns select tag with pagination options" do
|
289
|
-
allow(subject).to receive(:pagination_options).and_return [ "<option>1-2</option>".html_safe, "<escape_me>" ]
|
290
|
-
expect(subject.pagination_select).to match_html %Q[
|
291
|
-
<select name="page">
|
292
|
-
<option>1-2</option>
|
293
|
-
<escape_me>
|
294
|
-
</select>
|
295
|
-
]
|
296
|
-
end
|
297
|
-
|
298
|
-
end
|
299
|
-
|
300
|
-
describe "#pagination_options" do
|
301
|
-
|
302
|
-
let(:current_page_number) { 2 }
|
303
|
-
|
304
|
-
it "returns an array with option tags for page select" do
|
305
|
-
allow(subject).to receive(:page_numbers).and_return( [ 1, 2, 3 ] )
|
306
|
-
allow(subject).to receive(:page_label) { |page_number| "page label #{page_number}" }
|
307
|
-
expect(subject.pagination_options).to eq [
|
308
|
-
'<option value="1">page label 1</option>',
|
309
|
-
'<option value="2" selected="selected">page label 2</option>',
|
310
|
-
'<option value="3">page label 3</option>'
|
311
|
-
]
|
312
|
-
end
|
313
|
-
|
314
|
-
end
|
315
|
-
|
316
|
-
|
317
|
-
describe "#page_label" do
|
318
|
-
|
319
|
-
before do
|
320
|
-
14.times { FactoryGirl.create :book }
|
321
|
-
end
|
322
|
-
|
323
|
-
it "returns a string with the numbers of first and last items in page" do
|
324
|
-
expect(subject.page_label(1)).to eq "1-3"
|
325
|
-
expect(subject.page_label(5)).to eq "13-14"
|
326
|
-
end
|
327
|
-
end
|
328
|
-
|
329
|
-
|
330
|
-
end
|