polaris_view_helpers 1.2.10 → 1.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/polaris/_select.html.erb +37 -0
- data/lib/polaris_view_helpers/helper.rb +32 -0
- data/lib/polaris_view_helpers/version.rb +1 -1
- data/test/dummy/app/assets/config/manifest.js +3 -0
- data/test/dummy/app/views/home/_select.html.erb +13 -0
- data/test/dummy/app/views/home/index.html.erb +8 -0
- data/test/dummy/log/development.log +6489 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/0P/0PA8lhjUeA2yh9vlf14Q8N1hcYC_ZLo8xuVnR1WdgbA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/0c/0cXvGUaOc67YRQFU3TatZe9zr3CNe5Jvb45abPnwqkY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/2A/2AeSpAWIECvYTmad6--idv097zJ_LrYyOd9cPYY96Vk.cache +3 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/30/30CiE_8hhU0qIYXxd60KTshZ6b6enRsEFs91KsO7ScE.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/3b/3b3BCkmAMzkmzI-fPvlN892PylScIS4pDMkQHr6Q1Uc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/4g/4gI7n8i6G02Vu3uLhGjiYhwRemlQVfOZTjvM0O9MTFA.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/7v/7vk4hwhM9F8DmZoh-F-Mt18TBvjlJD5_m32_BTCJJi4.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/8M/8MSsAZ_rCO2JhotTfYD1ih-p2doMRZi2Bym5pPpkTL0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/8o/8oRrz0awpXd8CJMcnp9yVjfdKhpwHzxy0L18HLTfzQs.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/9o/9oLvCBjLME789byrT0xYXP7xY5n6dG-DmNwjJPmVOQE.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/BA/BAt35knR-ppMRvxOryCWVfheHaikL1N7Zj50AAKwFsQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/BI/BIkkM5uhdY6YNdz7XXLDdvatO6AWcUwTVV9sZdhfYmY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/BP/BPie9MLQ8VLjltQ2oz2MfmtYxVLBC7yLaEuvm8oxVeI.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/DT/DTgCOa_h___A5D-HckgyuPDnob4JQOYcCuDp62qMmaI.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Dj/DjuNYAMaS6YJQWe6UfvZAJH3VOi68O8KbIB1mxVMZb8.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Do/Do83AoOat5W-c1g7piDGy2GMmffsY6JY0Qfuh5PY3GM.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Dv/DvIS-GVcaO73gloI1zqCQP7EEA-SvAEhKsDhvgrMjPA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/E7/E7NAEc9qxjG16J4HDb5ybPYDRtfEKjj2jDuEs4zGaV4.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/EF/EF9wzNmwN2NGBnLp-NWUxzVk5fq8Fa1irW0RfMgDdkY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/F1/F1N0a90_FIi6q5eXfSISvhxD73gjjTle50lmSQUJPyo.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/F4/F4YY9_AM-EGBwUUUTPCK3qVUtY8liI7_nbzER0vSlaI.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Fb/FbWHXMbkvnTQ0UEZ0Tg98WOIRIdjokPRQrmbK55sUYs.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Fg/Fg_POAa3hAbmGsI8YDMBdC2G6hIFUtEoebJGbojvHOE.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/GV/GVy2UbF2R6zR8ahlzssAA1oDhALTOXF3ChAL5RxKY6o.cache +3 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/GW/GWk0mJSJz2hDwaMpqTobW4bxMMB2fdrg0CuksDgU5hM.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Hv/HvqrF7xSjuoKz7WeMQx_oCS-g1vgZmP4MyrMuVDFOjA.cache +3 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/JB/JBRtcUCBrUnfbgmxICcc4EghYp2blrDWPhne8l1GlwU.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/JP/JPG3h-Vqdd_hebgjNTF1YON96qx95rK7Admx5s09K1I.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Jd/JdP6HYe9zaCywWEcrpKwEF33nozW6rdPeQXYAv1aIQA.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/K6/K6fzb9GH_ziFk_Sl5WS6un8hOhpPKsnIqUxhV2LpBjY.cache +3 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Ku/KudNBtflrIu2VWuCxCfij54Q4K_sHfUPvk7s95CM9Rs.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/LN/LNr2CdiMlqB7i66-BLRzwNN6CgqIQG9HkREpEfhOEtc.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/LQ/LQs-QWKpBF3TQga2A1OjTGc2Ou6oX6T4OISTSjNawCY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/L_/L_WOCjM0ZxHJ6Iq8oVvyzLTAeIe407GquhxHNX7nzQE.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ME/MEJLDV4iCdV7uWS5yQ3dMaZuG5obDb7JGI8vtUsdHfo.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/MT/MTp9DoBHH-o5tLbPTEDInoyTnfm0lpHMnktZosMv2yg.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/MV/MViOA0vJb9nfkA4b1Ej1YNxrKfcOwayWVgOO8gNjbq0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Mu/Muudo2j1n7YViq1MiOkakXaqNA7c9YrYp93WnkJ3yRA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Oz/Oz8EyhwnJlbsLaiqA_30hr4vfzxTth1yGKA8kUw1gAM.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Oz/OzLHYUePxMJbSGq0WIHaoBjSFkF1c7ibEdlS6MZbGJ0.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Q-/Q-Q3JASW8ApJC__TwvyXN_JXUKrMw2cL6E48kZs8Coo.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Q8/Q86gzqvM0UlFDq6tkhejJ4M4YHunew5j3PTsvf9ytuA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Ro/Ro2MKWKyB9LTf_wsVckwR9FbIWkc07ioVQAXpc-eFvc.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/SR/SRlBuVekx5voijkM7Pur-7CEeD9aOoItZYTK7KkxrPc.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/TN/TNv-g6M0JvoUKQNPoJ8AtLxCLZdcgp1H__Q_kB6-cGY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Tg/Tgoo9TJIzNqmqLnpkSCB_NZOtYps5qGgllrtX0WTTVM.cache +3 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/UY/UYwgKYqrtNI3s7c2yy6paHvnxM9mfYfoIgF-vbsuChE.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/VB/VBsrJ5Xg31FA5mNJOA1WDLL8wyiBslP-dDDXHd95dEc.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/XE/XEIMewVgX888W-UD3K34E9JZ4y1dGla5jjXRM65ZW5E.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Y2/Y2BlLXgtc_HX_79jplJqJjaR34bU-Y8JHYQWni-hy2U.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/YS/YS3MUEaONY9c98fNstTUTnElFJovAxTBHRhgRkAkqNA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Z2/Z2lJ_k-LvmxJ-qKfZXuZhRAtCBlAVM7I-t6WWHwCOr0.cache +3 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ZF/ZFsVteUEPfoOB3KSv-XCd4qVbikDJ07lhr855hUxed8.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Zs/ZsIHCp1mL8BikJ5H-iF3y9sbEmLkPQ4mEUcE-xMm2ag.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/_4/_4gAyWfKwoZxJcCWZT4CYkOgru4V764wsxQnni4K53w.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/_A/_AEw87IzJObIFip1YuHiiDPKoMBmaWn7g5vgLW_T0KM.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/_b/_b2Zlet0n1c72D1lIqmEYVmRW3pBqVrSeuwA2znUfNM.cache +3 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/aG/aGsmi850WiHQ_iFYRldn7U5ZcOcTiJztdvm2mvn8lfY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/aT/aTSj0XMg0AGCkXc1prv0PRSZpv9ESny7fh9yNVZz_pA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/bZ/BZtMmALKjIOApgC5ANY-s6WcGtQ2GoNuYREwyd-RBAU.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/bZ/bZCpEjiG_RWZzW_efE2iISecOBmORVG81zifJZS41vo.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/bj/bjCx2u_iziMlSH3QuaKpyKrfDPC7C42Bp0yfoNf2fLQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/dI/dI-8f4QV16FjtzcPjyGqPPjZCjtSdy0C5KQBxEh_rgE.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/fd/fdnt36n4Qp_00I0msQtPbtyvqTFOCTQk5gT0xwW9ocg.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/g7/g7uDcwNoo56QrzBRNBXPsdXAlTZykxQ2KbOv0I-Ghzw.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/gL/GLKvySDjncNGJU4vF3-ZlJ9XbWSHQkLc4bj2H7wwp2I.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/gL/gLwN2uBS-uJYMw3V7ZOxNY0RIzrAH7Cd58AfpMkYmSc.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/gZ/gZp3uXMHuYQC4hzCr7bQfetKNdJAtbQmg3so2KpW1Dw.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/gf/gfVdewijFoWgaJmSE7lDx0SlQIj4UG-3tcHl-qk9jjE.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/gy/gySLfA7Zpl_sNU_XxtRsfCRfX29oOrgqR6Avb3Zi5Wg.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/hK/hKWTYDk4zLfa21QeIz5H0_n9pMfei-z4KP03Ybby0kk.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/iR/iRLnRZjjChsZvUkimRXR6oPnkzM036obI7IXH_Ue45E.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/iW/iW-C1HgihKUdrV6yKJhpTyUDCeFh_R6W1y-nyrJgSFI.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/j0/j0_K3Aqj2Ebx1RI4_syN9l4fK40vSMS4uIrdiFfxcmU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/jT/jTm-o2UUCqlYysYqphwL3r1hI26dOUlfJLypBOskD3c.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/jk/jkYjhPbl38yFTnJKCQ2LxulSdfwl0WftbQq09YS1MxE.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/jm/jmDh6VH3_s_bJbW04HKRnKy6k5R6m02F9PkHI6R9lTE.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ju/juTT-86I5TWi3Q_1YTE9DjgGv-39Zpy-2c0CwVUE3cw.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/kw/kwNFhW24nxXy_HfVKYdXJyRqhu7ljgl9wR2DcJUo-nA.cache +3 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/mb/mbN99uK1bPSTuMMgSGxUh4jXfuP_l6BjabUYyrrg_Ek.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/nL/nLuwaSIMLleatlISRD-omR7WZGm14K3N-lzsahuYIXI.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/oU/oUlWTLsPPBgArgLK8zzwz9N9Ew3q0GLHS3qowdHBmHI.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/pg/pg0QRs5woSuv2FR_nJ6wfKYTqJdM6SVT5tfJ1bUlD2k.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/pn/pnW3u_1AN48ig6ngefI89y96xoSlvnJurx-e3J-leoE.cache +3 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/pv/pv6tV3CDkIAmLXdU8EPLlNEkXAKJPufVD4VP30o4fWo.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/qk/qkbACUu4ifIRBNzSGv9JBL3sWESoQ-6vxy01DLK7g8s.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/rA/rAMmSCovSvjww_RHoFNJs7DU6IsGEkRV68WhYXS1Fgc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/s6/s6MNUD4r5c3eikG8wgdcW7QYkuPcNS_DTUaSjRs12dk.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/sA/sAID5Eq1BKCYx_B0P34Tl7d6zF3C6hFtLfL7QY2K07M.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ss/ssS2x0Wl67rwXHaVHsh6CO7ayn9fQ5saIwATKN6O-nI.cache +3 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/tA/tA17hbDcEyZi0P-Jq6ZR0SGJmTsq_Sf5hYAQ2Ie5A1w.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/uH/uHEyjJ3iWuP3zitEOhXr9neoSDJvES65YQ8A1mUzjLw.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ue/uegHHU3jGGdA2Gsz-0VC1tXeiKELDiN5XgmQGq-AaTs.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/v0/v0TDV1yaNJ52MB8N0o_xMcOrLzZn5JEQ-BxHWFOOcco.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/vS/vSgw5EJZJBi5GGqDpT3jrXgppxnwLSWVf-E-__ntVOo.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/vi/ViqVabl6wuowboPOjUaLPrMvoqJoMLsg_EVS7dSVSBU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/vi/viba4ojhukZCTHBLvq122lb5uydI0GXYo5xJ7sYtn-g.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/vv/vvhOybmmENpEJUQeWCBs-hCkVbow5chG6Li6xfe93_o.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/wD/wDEvj9As_Vf18RT8VzwGGxl5WrwkdrSd7p-fRUJQvGg.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/wN/wNw4kAG0E_RrvLeFAizMmTp_0jh-HGw1ONLtRyw92z0.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/wu/wu0U-zv1xzQ-jZBCABtH9E9UW209LvfVDc2z_RVAuWE.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/xU/xUsjf0IcYm4X43VKjgC3AJTMpjkHLCKl_P-ysNWJc0c.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/yP/Yp0DznVYvASSzI6YzWAGvlMQav1-L1z-Ocs4AV-cpEA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/yP/yP7Qq5WOatwlg1JfjbVyKOmcnvpJ7c8I6Q7Uq0yGRjs.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/yn/yndI79omu3HVFPyVKkn9KZ0U1fezM01AsR2aj5uNfbE.cache +2 -0
- metadata +221 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a9b7641e9cd98c805a8417e48b2f8c69fcd4e8d6d5d9654055c6531bf0016f4
|
4
|
+
data.tar.gz: 7034940dea69410517836739ae68fc83ea2d9d44af9c94734c4264511a93c04a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2f6b82676c53921e9e2d769ac13abd2e45957111f891242ec45bbb21abd54c93257399dc063faa3e2e51af24b2973bfcefb22a255411ed930d276996ce38ff1
|
7
|
+
data.tar.gz: 790ebe28fc88ce3740a2ad1f382576d8c8530cbaef2ad548074e87fa8993339d12c953ccea32558c43bd79a3095a64dc6b48188a22be951a5cc7d1dcfb1b96b5
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<% listname = attribute %>
|
2
|
+
|
3
|
+
<div class="">
|
4
|
+
<div class="Polaris-Labelled__LabelWrapper">
|
5
|
+
<div class="Polaris-Label">
|
6
|
+
<label id="<%= listname %>_label" for="<%= listname %>" class="Polaris-Label__Text"><%= title %></label>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<div class="Polaris-Select">
|
10
|
+
<%= form.collection_select(attribute, options, :value, :label, select_options, {id: listname, class: "Polaris-Select__Input"}) %>
|
11
|
+
<div class="Polaris-Select__Content" aria-hidden="true">
|
12
|
+
<span class="Polaris-Select__SelectedOption" id="<%= listname %>_selected_option_label"><%= selected_label || form.object&.send(attribute) %></span>
|
13
|
+
<span class="Polaris-Select__Icon">
|
14
|
+
<span class="Polaris-Icon">
|
15
|
+
<span class="Polaris-Text--root Polaris-Text--visuallyHidden">
|
16
|
+
</span>
|
17
|
+
<svg viewBox="0 0 20 20" class="Polaris-Icon__Svg" focusable="false" aria-hidden="true">
|
18
|
+
<path d="M7.676 9h4.648c.563 0 .879-.603.53-1.014l-2.323-2.746a.708.708 0 0 0-1.062 0l-2.324 2.746c-.347.411-.032 1.014.531 1.014Zm4.648 2h-4.648c-.563 0-.878.603-.53 1.014l2.323 2.746c.27.32.792.32 1.062 0l2.323-2.746c.349-.411.033-1.014-.53-1.014Z">
|
19
|
+
</path>
|
20
|
+
</svg>
|
21
|
+
</span>
|
22
|
+
</span>
|
23
|
+
</div>
|
24
|
+
<div class="Polaris-Select__Backdrop">
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<script charset="utf-8">
|
29
|
+
var selectElement = document.querySelector("#<%= listname %>");
|
30
|
+
console.log('selectElement', selectElement);
|
31
|
+
selectElement.addEventListener("change", function(){
|
32
|
+
var selectElement = document.querySelector("#<%= listname %>");
|
33
|
+
var label = selectElement.options[ selectElement.selectedIndex ].label;
|
34
|
+
var labelElement = document.querySelector("#<%= listname %>_selected_option_label");
|
35
|
+
labelElement.innerText = label;
|
36
|
+
});
|
37
|
+
</script>
|
@@ -44,6 +44,38 @@ module PolarisViewHelpers
|
|
44
44
|
)
|
45
45
|
end
|
46
46
|
|
47
|
+
def polaris_select(form:, attribute:, title: nil, selected: nil, options:, data: nil, select_options: {})
|
48
|
+
selected ||= form.object&.send(attribute)
|
49
|
+
selected_label = selected
|
50
|
+
our_options = options.map do |option|
|
51
|
+
real_option = option
|
52
|
+
if option.is_a? Array
|
53
|
+
real_option = OpenStruct.new(label: option[0], value: option[1])
|
54
|
+
elsif option.respond_to?(:label) && options.respond_to?(:value)
|
55
|
+
#real_option = option
|
56
|
+
else
|
57
|
+
real_option = OpenStruct.new(label: option[:label], value: option[:value])
|
58
|
+
end
|
59
|
+
if real_option.value.to_s == selected.to_s
|
60
|
+
selected_label = real_option.label
|
61
|
+
end
|
62
|
+
real_option
|
63
|
+
end
|
64
|
+
render(
|
65
|
+
partial: 'polaris/select',
|
66
|
+
locals: {
|
67
|
+
form: form,
|
68
|
+
attribute: attribute,
|
69
|
+
title: title,
|
70
|
+
selected: selected,
|
71
|
+
selected_label: selected_label,
|
72
|
+
options: our_options,
|
73
|
+
select_options: select_options,
|
74
|
+
data: data
|
75
|
+
}
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
47
79
|
def polaris_page(&block)
|
48
80
|
render(
|
49
81
|
partial: 'polaris/page',
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= form_with url: root_url do |form| %>
|
2
|
+
<%= polaris_select(
|
3
|
+
form: form,
|
4
|
+
attribute: 'select_company_name',
|
5
|
+
title: "Company name",
|
6
|
+
selected: 'octolabs',
|
7
|
+
options: [
|
8
|
+
{label: "Luther Corp", value: 'luther_corp'},
|
9
|
+
["OctoLabs", 'octolabs'],
|
10
|
+
OpenStruct.new({label: "Vought", value: 'vought'})
|
11
|
+
]
|
12
|
+
)%>
|
13
|
+
<% end %>
|
@@ -62,6 +62,14 @@ between the <code><body></code> tags with something like this.</p>
|
|
62
62
|
<p> </p>
|
63
63
|
<p> </p>
|
64
64
|
|
65
|
+
<%= polaris_heading "Select" %>
|
66
|
+
<%= demo_partial 'select' %>
|
67
|
+
<p> </p>
|
68
|
+
<p> </p>
|
69
|
+
<p> </p>
|
70
|
+
|
71
|
+
|
72
|
+
|
65
73
|
|
66
74
|
<%= polaris_heading "Links" %>
|
67
75
|
<%= demo_partial 'links' %>
|