ns_settings_ui 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/ns_settings_ui/settings_helper.rb +16 -0
- data/app/models/ns_settings_ui/setting.rb +58 -8
- data/app/views/ns_settings_ui/settings/_edit.html.erb +2 -2
- data/lib/ns_settings_ui/version.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +15519 -87712
- data/spec/dummy/log/test.log +24 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-h/-huUZEeWsF1Y2GoLl7VPI262u6aQ2zRy7csSUW4EGnM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3O/3OYCHhSogcnpPO8TEU0IMXa7dt93tjoV_oCcCouefgk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{pM/pMAWnfeeeCzm8dlVCdOHIbhjUtmpJOVmvpIR01zfw7I.cache → 4y/4y88Hco-j0gb_bUcD33Vy_ETqLQZcw3SldmBnjxzb-k.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{Zt/ZtMkfyfrpm9qwpYx_4WLbUavfFQfotBfakrEWO2657o.cache → 6e/6eaQ1xmlgyG2oVlvnUdXFLKig1kYY9gJIT7w5OnMvOM.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{V_/V_SH9w1FYS9Dk0I47az4RNyDVjuVZf1NZjKUBTx7DKE.cache → 7D/7DN0SNCFuuj5pjdweaSZbZtIJi-yvD8lNG-5ufopP-0.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{66/66IMTAtFvaISY2aArUKcYSBALYsZa508NwlGHpcnJ2Y.cache → 7E/7E8wzRY74VYhkWwZku4gLXFnve2mO52AGE1u7vAY5tA.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7Z/7Z6lWMsjMcroLzoX5XW3SSjSBjcRdF0R57IgdpPdsgk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/9q/9qhHvz5DDDkWvrXdAhPdHHJ_4gTeVSrRtvj7E7OeZB8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/9s/9syJMx2iCHRP_PY1pFB5n3xG7WP9cxZprcJbss1ICm8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AQ/AQiAOCtziPqB7mPelfPZWFysKMS_8DdW9d9GAvg7nDo.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Db/DbmLC3wtG7ztEvkzmVAubW8vf37XdD0bT3Kh73oed1A.cache +1 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Do/DopyKfloh2QmFXAbplf-Q75zVrdUHoaer7Bv06rQZX8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Dr/DrsRzr20ToTrVLYf9S2Iyl5__kMCD31Ufi7hjBqBDzM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/EL/ELacTpJi76Y38Tpfrp4vMyzBCGYaRBD9DFtuomHbqhk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{bx/bxrmzZMCa6H7tW_I9GevT5rQ4WdmPZN7VwgR8yuVkiU.cache → Eq/EqrkFWl4FDY_ODV3qq3Cbwq8AiLASXEohfmzPPhRSdU.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/GZ/GZkpHgNs8yy14wzmIHHp7ab11B8b3gAEZ0PnuCTFMZw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Hl/HlVZgN65pvvw0SlUOG6Ec37E4PFLQ-HoHWYOcl2xoHo.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{6-/6-ClR3PgOb6GBybMdmH3CDGt3cBerX0FVYL6-qqNasM.cache → KO/KOyT6IOJ4iHXQ79M7Fr4IxVGHuYVE5G8fHCfvelFpDs.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ne/NeKqTXEb-H1Hz6gDq6NcGirFDj9Pk7LGhOAzKRVWJR4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{5h/5hshogdtG_xqu53KWr8VuK8t0y_ATOm5nYbxRalQL3E.cache → OE/OEIhEr3z8UoH2EsCmx5UGx7soZ1Ig8qSs1gHnOtFvQE.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Q-/Q-I1m-kbKv1L96nWQk4A5Z7hIHWvnZMW3-M6wxbeZmQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Qj/QjdmUkKv3N2KKb2sE7HfJHfCkTRTsyiKWcaQE0dLmyI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Tg/TgTcVvqf5KTGti25aDSVdPzdEFSzFCA7TIgv36nVcSw.cache +1 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{yM/yMWpYftJ6pj2YLfOnkGZPmh0MIJC5ADlXuhKIs7q150.cache → Wp/WpF0Ar6BqxCRChbnD7ADsnnIhuCyAYEhSS3wrnv8PZE.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{JA/JAogC-UUMjEcwkx52-5KPnEkwOKLDyhSaDmpdGs5VrA.cache → al/alf1Lxf86R0vjIdVj6cZepiLsNlRG8Ks3N2ZaRnVhFI.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/cQ/cQCpVHz-I595ffaQdVyapH7sAo2uGhu4gddOeI8fXwE.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/eN/eNqm8oKaAS_dbccyL9N1GwByJNxUWI-B_ePWmy_iTC0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{Pv/PvQkjcglr7ZLyuBIFOUrh7dHgNpeViNZWL23FVQla30.cache → fi/fiUvXX8DObrJlwuE5zIPsctigzDJZi_91AyzXc1hjCU.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gQ/gQ610EkvmTMaVuLAgUGJk4eK9m9tERZUILLW3Fbmg5s.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hn/hnYRMoTDOi8vmbFOEh7ieo2dQiukt77l3jLxZWOd0qc.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{MU/MUqHQfvjj5BLT0A6jU2kpiIk8FkH0EqnBJ4EXbyIK04.cache → iV/iVOjizkUshjWMEQsVsZKHHsQtsN3TpmEJcqdv2eyuXU.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{bF/bFgiSDRTiUvuc3LjoAYkvQEd_wGXIU8pIHM35pqVm1I.cache → kN/kNttJNDzp2Boo1hHrtqY8gQzDPzjtZkIOgZnbvWYFe0.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/n2/n2Kio2la0DGZfPZc8LIV3swEvv_0BO9m3iGgBBhBRsw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/nk/nk0gugIxBh-1LQv1BmR7uY6F8qVYFuUIFeZ7ISpn_sc.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{2A/2AuVCEUkqURI89dt0__pL_-mTzxouKnE_3oX5pHynKM.cache → pw/pw-XzhXWwjJm1inQWgGwg_GAupW3Z1WuHOcbUIhX1z0.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/q6/q6BYa32YJF11eGVapO4ouNl6gayPIsARgMavlzZmoi0.cache +1 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qp/qpvU0DP1OGt-mJF0d0eikYkkhkdRPwb3MJsp2bmk0tw.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{1n/1n-QlIPebozz18AW27-wC9aJCZ5Ua_C3V5X2y9wrsX4.cache → rW/rWgaUUE_x6YhQkm9XUyaZVg4CAaz9d6iRBMc-Uw21WM.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ru/ru8QRjiZ5xAMQfZZHu_fOew2fg6_ZxPyTxPArLLOx70.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/sk/sk0hg41M7iP_3iMQtCbooF5Jvju9Pw8zw7YeCrfrB6E.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{18/18jjehmj_LEVg35UjaZLf0c_8OFrnSHl_s0qGB9BOzE.cache → sr/srzIrkat4qkUSsKuYzLzvf2IhMDpVt1sD6HKLfqkehs.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/t8/t8Tx-sJKyrQ0l0aBIvf2Y-tV66cthiBS9qK-Gew62g8.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/te/teyuM1EAaRCeXQTB7jiESwi6LSw6QPMvEHp-XYRwVvU.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{Zq/ZqJ3NOYi5cdFvRBHXLAMPmVxzBi6tVyAqUbswIRMBmQ.cache → uL/uLgJhsyU4HD4eXpDH5EYQ9VQYsukqsW_kNv4CsFYqwQ.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/uy/uy-hsk58Ix6CUgI_TU_Tz8qZJUFjS7YXmCDqcvllASU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/{_2/_2otSeXazBlDDqyWBE9RNhILhE5inYBUTijaedTum6A.cache → vO/vO__Xc42mWGQwobS_nnK-EejIwQtU53w4u024hmkPS8.cache} +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/x7/x7KkTV3ibfIEysLB_ug5bfmnn2VLV_BldukPR3EoPBk.cache +1 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xr/xrAO6ua989MS_-82pmRISzmSJ_unbIQtuUlclLAF9tE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zO/zOl6ReMn6jGgcBxWvF2FCzGWjOP11xy_uaiooTwnfQU.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zv/zvdAR94V-vLj1PMhn157FjLzagrfv_vss0DxZexqnLY.cache +1 -0
- data/spec/models/ns_settings_ui/setting_spec.rb +107 -19
- metadata +122 -158
- data/spec/dummy/tmp/cache/assets/C78/6C0/sprockets%2F5de19048739df46a34203b61520930ec +0 -0
- data/spec/dummy/tmp/cache/assets/C7B/1E0/sprockets%2Fa9d43ec510343970736b1e2b58583f12 +0 -0
- data/spec/dummy/tmp/cache/assets/C80/9B0/sprockets%2F02417790a872c443bb53c704de6d9817 +0 -0
- data/spec/dummy/tmp/cache/assets/D06/B10/sprockets%2F372b42d142d2148d2ac2e59f14e56b6f +0 -0
- data/spec/dummy/tmp/cache/assets/D35/050/sprockets%2Fc2125dacd7b550fce2e54d514136f872 +0 -0
- data/spec/dummy/tmp/cache/assets/D3D/300/sprockets%2Fbbe4e11574fda9e128081b0265cfd758 +0 -0
- data/spec/dummy/tmp/cache/assets/D4F/DC0/sprockets%2Fc357d3d555d38c53f8b96c3a8b91cb86 +0 -0
- data/spec/dummy/tmp/cache/assets/D71/4E0/sprockets%2F3bfa8a8e669189e3d4154eefa0cf1070 +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-J/-J3gsIpPAHQT_B27lQLnp7CXO16hrLZCdCSbG4WuP3A.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/05/05FrW4XpbjdyW7ogDXsYPqFDO3A87CBWQstNe3DZ87A.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/1P/1PWb4WMXakQ5IP3MTgk_o6-fI785NEDcJB2CPfcEHW0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2P/2P8jkNKzvqRhyW6gO5ULdbxCd4-G9X6OLgbX8KYrGDY.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3-/3-fkwJ2IK-Ne3obnak0JqJN1Lov_rLg6BX2ttFLT86E.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5t/5tE-fOOgDVkbBfJm8SkU1nSjFb3J4hw-OmRNm3FiNGw.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AV/AVEAO-o9UtvJmoTUXJ9S-PYUFlFpMU60MtzmYrH5DKU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/E_/E_FRQ_pWFSXXmjl4AQOE6-J8pr9ZMY0GmWoOgsX_iZk.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Fm/FmPA5Rp7xtZUNggNQDiPInqCREUxfA_O5LloCjZJsR8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Gg/GgyimpP6ro_85uvAT83E1u9M-kabjyrWlWkji9vVAwQ.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/It/ItnesFcCy4vwlO44OO1FBKLnqPl3EBSZiKdtldWrpMY.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Jx/JxQa1X47JTgQjmQgGGktog5MMcpPvHXTXkm3jwI4qso.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Kw/KwWaC3xOqGInPkzZvScIZvqJ3TMGIS9UQg-Qp4K-hRE.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/L0/L0ORVVrwT9e8lnV6cNlW2iSRaUNJ8bD5jUF_QxPAFok.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/MY/MYK2HZM9cBrP0W8yO0XctOsUBwAYZsiRDtjBysWrPJI.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/R1/R1u30BA-totiUjc8_Xarqu-soqknc3bkJQHWZeFmgmw.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/R3/R3TiDQh6oqYkJg0OPukvuPtLq4coTfxuEoWmZToq0hQ.cache +0 -3
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/SI/SImwoOdwfjVbSIh5es1DCqmCmBu8nSF-YD9tD_nDW3k.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Sz/SzKoQ8LgD73mi7vIRNTfY3irZeKdo_1LG1CBcHAQa8k.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/V9/V90panAmSm2agBwp9J-1PjcFi7mTT5Cghbe7wnSR-iY.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/V9/V9slK7F0D--OKKokpWfwJUAZw7f52nnfOg0cMV_hwGk.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/WT/WTPpZew93ClEY_W-BrZ3GP3L5Bm68bDmqjNlfsLq-2o.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Yp/Ype1uPGBytD6Usuot46gyU38x6O8h4G8AHOM62d_SfI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/bx/bxFQweQ7TMRCzOfItARcRfIr0IGtWQ7ztcLP4aUpid8.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/cP/cPXYN8EErRQMS_lq5P2u62DIbkCyNamtKyn8-U0w1YM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dp/dpoHMsf77LE7HhEArU4TroyGiUN77Tpu2PGqdZTxSIE.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/eF/eFgalkU7HIoDx0y9pHo_iKuDXTgDTQTZV1sEbxyQ0g8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/go/gohXbfaP8G4DfBIrDS9fVEDzjqdXKvajxFuhLRR5sUc.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/h6/h68ZnnTjy-IbwXXWhLkAWZYTb_TGWxXf7U3pV6lu2SQ.cache +0 -3
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/io/io66dkgGX7u0GfGqyiGMV17NoalcY-1bFTlDhblVCLs.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/jM/jM28TsnOgDifkeE6m8VtuAqSv3i2Ry3lLw8OAZLVrZA.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/kn/kn2haBwBXKZdd2NgyGaXXP8O6--21bJtaAB5Kapf6MQ.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/nC/nCf7WzpsKIJpNCviB0JraqJ-YpThZw3wjxrXp-AxH1I.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pO/pOP55ndP168amZ4zCEzpb3ywkvDqngogS72lsku_hGI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/sz/szKqx7oRsb345g4AoPIah09KQmg7rNJrcn6SGd6KQRw.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vw/vwiNPTEWL6_yq9SluFfj119gdQgzpDbr1pPucgBneBg.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/yT/yTLcg8Qnq0KIWuMqbEEJDE3upO7JmeCBScTLP180tis.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/yV/yVEUe1EjE1P-4SKGg31dww1VJNJdY36aT0ioGY2-Kxs.cache +0 -3
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ye/yeOeMsoB9-2IEyrLgohQ4dAUMrsu2FQsAFzD4olBqNY.cache +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d9b2b4a991c36cc2be310f19940b957cb8f6c65
|
4
|
+
data.tar.gz: 65a18901d726cdea6b777bffd12d8600ebd036de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2634b223242bf47f936c8a0fbf0fd997c891d61f1a5ef23dbb8cb8750c77a7e18e6bb13d63e3b1a41f02d70da3724cb2a59ad53fcf70a93a0eb39496eafa506b
|
7
|
+
data.tar.gz: 6014bd6f271e65ab697db33c41931efa503888c2912e264e60e59dee4e897db8df2f3d88a2c71b1948891fe7ff308f1510ff3a5ba5cdd4323b357386f45fd9fe
|
@@ -6,8 +6,24 @@ module NsSettingsUi
|
|
6
6
|
''
|
7
7
|
end
|
8
8
|
|
9
|
+
def render_value_field(form, setting)
|
10
|
+
render_field(form, setting.value_type, :value, setting_value_class(setting))
|
11
|
+
end
|
12
|
+
|
13
|
+
def render_default_value_field(form, setting)
|
14
|
+
render_field(form, setting.value_type, :default_value)
|
15
|
+
end
|
16
|
+
|
9
17
|
private
|
10
18
|
|
19
|
+
def render_field(form, value_type, name, additional_class = '')
|
20
|
+
if [NsSettingsUi::Setting::TYPES[:boolean], NsSettingsUi::Setting::TYPES[:nullable_boolean]].include?(value_type)
|
21
|
+
form.select(name, [[:true, 'true'], [:false, 'false']], include_blank: true)
|
22
|
+
else
|
23
|
+
form.text_field(name, size: 10, class: "form-control #{additional_class}")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
11
27
|
def recursive_hash
|
12
28
|
Hash.new { |hash, key| hash[key] = recursive_hash }
|
13
29
|
end
|
@@ -2,9 +2,35 @@ module NsSettingsUi
|
|
2
2
|
class Setting < ActiveRecord::Base
|
3
3
|
TYPES = {
|
4
4
|
string: 1,
|
5
|
-
integer: 2
|
5
|
+
integer: 2,
|
6
|
+
boolean: 3,
|
7
|
+
nullable_string: 4,
|
8
|
+
nullable_integer: 5,
|
9
|
+
nullable_boolean: 6
|
6
10
|
}.freeze
|
7
11
|
|
12
|
+
TYPE_HANDLERS = {
|
13
|
+
1 => :string_value,
|
14
|
+
2 => :integer_value,
|
15
|
+
3 => :boolean_value,
|
16
|
+
4 => :nullable_string,
|
17
|
+
5 => :nullable_integer,
|
18
|
+
6 => :nullable_boolean
|
19
|
+
}.freeze
|
20
|
+
|
21
|
+
NULL_VALUES = [nil, ''].freeze
|
22
|
+
|
23
|
+
# TODO: in Nttr
|
24
|
+
# belongs_to :country
|
25
|
+
#
|
26
|
+
# def self.get(country, *keys)
|
27
|
+
# where(country: country, key: keys.join('.')).first_or_create
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# def country_code
|
31
|
+
# country.try(:alpha2).to_s
|
32
|
+
# end
|
33
|
+
|
8
34
|
def self.get(*keys)
|
9
35
|
where(key: keys.join('.')).first_or_create
|
10
36
|
end
|
@@ -14,13 +40,37 @@ module NsSettingsUi
|
|
14
40
|
end
|
15
41
|
|
16
42
|
def formatted_value
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
43
|
+
TYPE_HANDLERS[value_type] ? send(TYPE_HANDLERS[value_type]) : value
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def nullify?
|
49
|
+
NULL_VALUES.include?(value)
|
50
|
+
end
|
51
|
+
|
52
|
+
def nullable_string
|
53
|
+
string_value unless nullify?
|
54
|
+
end
|
55
|
+
|
56
|
+
def nullable_integer
|
57
|
+
integer_value unless nullify?
|
58
|
+
end
|
59
|
+
|
60
|
+
def nullable_boolean
|
61
|
+
boolean_value unless nullify?
|
62
|
+
end
|
63
|
+
|
64
|
+
def string_value
|
65
|
+
value.to_s
|
66
|
+
end
|
67
|
+
|
68
|
+
def integer_value
|
69
|
+
value.to_i
|
70
|
+
end
|
71
|
+
|
72
|
+
def boolean_value
|
73
|
+
value == 'true'
|
24
74
|
end
|
25
75
|
end
|
26
76
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<div id="setting_<%= setting.id -%>">
|
2
2
|
<%= form_for(setting, url: ns_settings_ui.setting_path(setting), method: :put, remote: true, html: {class: 'form-inline'}) do |f| %>
|
3
3
|
<%= f.label(:value) %>
|
4
|
-
<%= f
|
4
|
+
<%= render_value_field(f, setting) %>
|
5
5
|
<%= f.label(:default_value) %>
|
6
|
-
<%= f
|
6
|
+
<%= render_default_value_field(f, setting) %>
|
7
7
|
<%= f.submit('Update', class: 'btn btn-default') %>
|
8
8
|
<% end %>
|
9
9
|
<%= form_for(setting, url: ns_settings_ui.reset_setting_path(setting), method: :put, remote: true) do |f| %>
|
Binary file
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|