push_type_admin 0.6.0.beta.1 → 0.6.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/push_type/admin.js.coffee +7 -4
  3. data/app/assets/javascripts/push_type/fields/asset_field.js.coffee +2 -1
  4. data/app/assets/javascripts/push_type/fields/date_time_fields.js.coffee +9 -6
  5. data/app/assets/javascripts/push_type/fields/repeater_field.js.coffee +28 -12
  6. data/app/assets/javascripts/push_type/fields/{relation_fields.js.coffee → select_fields.js.coffee} +18 -3
  7. data/app/helpers/push_type/fields_helper.rb +2 -27
  8. data/app/views/push_type/fields/_asset.html.haml +3 -3
  9. data/app/views/push_type/fields/_date.html.haml +1 -1
  10. data/app/views/push_type/fields/_matrix.html.haml +20 -10
  11. data/app/views/push_type/fields/_relation.html.haml +1 -1
  12. data/app/views/push_type/fields/_repeater.html.haml +18 -10
  13. data/app/views/push_type/fields/_select.html.haml +1 -1
  14. data/test/dummy/config/initializers/push_type.rb +1 -1
  15. data/test/dummy/config/secrets.yml +2 -2
  16. data/test/dummy/db/schema.rb +1 -1
  17. data/test/dummy/log/test.log +4520 -4520
  18. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{b9JQPxW4JXsEMPg6IuwbcxAuP2OhDDjLKHRDAmL9gi0.cache → 2EThNHqLu_xwuBEx4vHV3OET28iaKx6e_PUWDDYCfNA.cache} +1 -1
  19. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/3LxVbFL3l9A2TlSeH7h2o-F13L_JW1mkCx_M9d4C7A8.cache +46 -0
  20. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/68-rfVTVnRlWELlXq3fFfQ-DJzuJPuIRXihjH-A4DDw.cache +0 -0
  21. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/8Yus8_gDNuUFZEcVfeXKTB56TPihlWLL6d8qBUtlxhs.cache +0 -0
  22. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{EFi353vPjI0mCdem6bROYjtNuvlKj3EcwMkp5g5Mpj0.cache → 9uv1sZD3AP_O2KaJodca_1LtmauwIODXfzHvRu2G7-c.cache} +1 -1
  23. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/AKNuwBosUS_xVARIwHOtZLhpTj0VGfcpMSDOzY5VYSM.cache +1 -0
  24. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{gTuX3cv-vdz9qv8gNX5F84Ei5mIJttVCsJjrqv4Np5g.cache → CASd7mtaP88OldKeSPlNlSe5Z0rXQDEwSVTCfeSoblw.cache} +1 -1
  25. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/FtlieXse4_zwRlqG_RseVlz-TXIop-wClSIXiGyCa-k.cache +0 -0
  26. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/GSuwmAmknqPxy3lOcjsmOG1cGtWUAK67WCqDt3pWc0E.cache +0 -0
  27. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/NOLzY4N8876kNz0nVXOuWtF5FApAsa9NO-e4quADtHM.cache +1 -0
  28. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{WzG6jRDGbAJ41fKtKf8Rmip8oknkkLAfWgvOd0kkgjY.cache → RZ7U3cmHsXIKt6ekhKZP6Pw8KEtCwk7Hy9HViUWfQj0.cache} +2 -1
  29. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/Ti3ckxVqeNRd1ShfRfv4oOZZ8Boq8qKJB6y_Fv9ytU0.cache +0 -0
  30. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{4AF6EbpH49NMHFQdc9OnIUfkRLM8lKlSBqaBvUVo3KM.cache → Uh8MXM6z2fmNXc4sqqPfSRoLUQPEFMEmu2Ifr44NsEc.cache} +1 -1
  31. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{VkZ0DGEafpmCHjq-WFxDxbu3tQIQdddqOV-7qXmT_Js.cache → VT4ptrpfuw0joWBCiDIXoO5_j6knZOUqsEHVhSzZDug.cache} +0 -0
  32. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/Z1wb-zyOfM070cy_9rtWent0zzV8LZK8Sj8a3WfQhps.cache +0 -0
  33. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/Za-bWpyPHwDgncSmeFii-kf2OBoGGfM9hq7a2ek4UB0.cache +0 -0
  34. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{bn4g9rKX92aXFOIF45FlF5DA0zMZCBDpiTSbD55ZsWA.cache → Zy6nYRgc2MyEGXCZnYSq-m1aAY44ChWxkTH6HT8TdOU.cache} +0 -0
  35. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/_lObpVI6whu6Za3BTLG5Hx8sNP9CVQ3ZMVzzdeK0NTQ.cache +2 -0
  36. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{pbDdMevTripqjdLgZ-5gJL5yJ9u8_WN_wvD-2bDKchs.cache → fUjwjDI8TTWz2HrWHI5JMUs6j5Zhhpt4gu6RUqI_mUI.cache} +1 -1
  37. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/oGabhBAYxeJ2uXArE6IRQrs9lp2BEAwkEQNAVAlZJr8.cache +1 -0
  38. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/o_4u5rpJosTLleHQ6oFN50tkbxKhh8vZ-pV_WowjSHI.cache +1 -0
  39. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/oa9cqTFdyQ42k9Pg0lPDUvvUhMMoQ_GRclViUq6uaRg.cache +0 -0
  40. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/t3hCHk9ruCftcpXnkKI-fJNua82etX3bwNBEUtZ9lto.cache +1 -0
  41. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/vcC8Jy6hXCQmtvaDthKUCjhefi2JHvMcweAO6q6iCrQ.cache +30 -0
  42. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{hHilQ4bcUd8onLMrObWVvrbBXGQji2ic5mYuEwKnnNY.cache → xW0MZCmr6qsKPiKHi-p_tpm4quTg9MjmOa-Od5_rIU4.cache} +10 -3
  43. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/y-lokYJWyt-TTTl8aQ5SR0Bjp8EDmS6mpAPPdm__J0w.cache +0 -0
  44. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{tli_LD_p18lfhUBkYvg05DnTi6ub4yzVxobMsgAhJ80.cache → yVAlvXhvMp6zOjyiiyQBHnvrEidq7VqKYL8AtUH97uY.cache} +1 -1
  45. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{oPvGci8wIDxeMOWgaH9tg9cmiw_uXWAnEgNSB1G36C4.cache → zU6SWg93-hpgJyTjFP15NSTMQgfkIQ0RK2aq5zpJXaQ.cache} +30 -4
  46. metadata +83 -116
  47. data/app/assets/javascripts/push_type/fields/matrix_field.js.coffee +0 -15
  48. data/app/assets/javascripts/push_type/fields/select_field.js.coffee +0 -6
  49. data/app/assets/javascripts/push_type/fields/tag_list_field.js.coffee +0 -7
  50. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/0Mgh5nyc3Pzes6lDtGL-Gv6ROsVKBh0lUsGUKzXw9kc.cache +0 -1
  51. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/1bVhd3dFMo9Ta1ZpKfvQhdvM5qaev4RvY_3DMATQbrM.cache +0 -0
  52. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/1nNN5hiPJhSBFbXuNhBFG9MAnwLc93VFIaeblAGZ3To.cache +0 -1
  53. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/5P1BK5rrkt_pXJofFRcpFsmzd_MJW8pl403ygUGDDxs.cache +0 -0
  54. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/5eYnCJcXnQkAOctRXxDskITlrtsk7nrYlEf8qxbEpgo.cache +0 -2
  55. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/5qCJaEhgPbRPDUGCudAamasvrzwHon7PLBJ3kPdq21s.cache +0 -1
  56. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/8OSaAe5xd1TtBUWFtqunZLYGKr-iTN8p_PgoaSfNjB4.cache +0 -2
  57. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/AFosvpRRM0x48rPHPouVE6eBrYZY6rcsRuUatpTfJzY.cache +0 -10
  58. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/EfhRYuSCpVmiWXUWtbKDKzGwk58paaV2GPb4_rREQPg.cache +0 -2
  59. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/H3uM2R6qlfQ8WXNmFFe23Sw3CSzcZm5YubuWd5pUIQA.cache +0 -0
  60. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/KYdGQ31taQ80bQiRyD5P527fNvIZmseD3OPEXwkWAYE.cache +0 -1
  61. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/Nut9NY263iE2JHbMgV8KTaKMThqrxHG242447k_-VG4.cache +0 -1
  62. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/PJ2ondm6na55yEj8Q6fzW4hErJNAV0hEJpN9a04eZ6I.cache +0 -1
  63. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/PLJqtbGuGip_S21FMzWEwuL8tHSd3_L_e9lBchsOD_Q.cache +0 -0
  64. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/YFAro2UoBm8P_QlrbBg2oTTP4EJddGbzgT_-7tFdP9M.cache +0 -11
  65. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/YNPSWoHxiTzJIdNt3nDkJQuR60jdFqw58LfFMz2WUkE.cache +0 -0
  66. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/YiHXNl-e6pgl9d3wk6J5jSq2zt9W9tmKloipy49G6XE.cache +0 -1
  67. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/cgRz1kQTuswK7Bo8D5znvQXHywdhrORz5fWIydag1F0.cache +0 -21
  68. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/e6yFwTLDDEwVn9G3mpsV_5f5r68_Ht5HSyOBjhhrioY.cache +0 -1
  69. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/hHoFdLF-c8SLdDf6BH8UmOS6j1HFnvT40DiKakWrRJE.cache +0 -1
  70. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ij1h-nsseqe7QjynUzOIy_ewVf4ChzVoR2uAAuEvjCY.cache +0 -0
  71. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/jKX8VTCvXUSDC6yVThQiAX_wf1EWIkrZDhShrJnpFbQ.cache +0 -21
  72. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/kpJyJzfaviaCFO-XtHlJ7f40Em4nABVAVQHoqQHzzeA.cache +0 -0
  73. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/mZf34r0DjzryIiaM7TY7d5qOdD02esR0mCd6sNH3r-k.cache +0 -0
  74. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/muDDpoKNrUnYa7QCaUYWGeiwHFzO5RDGJUA-wj606Bs.cache +0 -1
  75. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/rpmymrTDaltDPEmKOAQPQ2FObPIrhRDS-6ImndpqPb0.cache +0 -17
  76. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/sEa2reB8yNAAce0aN3ByKwFb1NmMmqK3hh9CDh6wYdA.cache +0 -1
  77. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/t_gbM3iDelNCbFx1f94Th2HHAAEr9E6mgKDWru8YYpI.cache +0 -0
  78. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/wHBZ11mt80O4IBCWSmsX_xLwmIgkoS-zXRE2O80Jg-4.cache +0 -0
  79. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/y3KGeoqel0zi9J24AzufRd1-enK-SZMtCdTOxn3pxHQ.cache +0 -1
  80. /data/test/dummy/db/migrate/{20151015181712_create_push_type_users.push_type.rb → 20151102165855_create_push_type_users.push_type.rb} +0 -0
  81. /data/test/dummy/db/migrate/{20151015181713_create_push_type_nodes.push_type.rb → 20151102165856_create_push_type_nodes.push_type.rb} +0 -0
  82. /data/test/dummy/db/migrate/{20151015181714_create_push_type_node_hierarchies.push_type.rb → 20151102165857_create_push_type_node_hierarchies.push_type.rb} +0 -0
  83. /data/test/dummy/db/migrate/{20151015181715_create_push_type_assets.push_type.rb → 20151102165858_create_push_type_assets.push_type.rb} +0 -0
  84. /data/test/dummy/db/migrate/{20151015181716_create_push_type_taxonomies.push_type.rb → 20151102165859_create_push_type_taxonomies.push_type.rb} +0 -0
  85. /data/test/dummy/db/migrate/{20151015181717_create_push_type_taxonomy_hierarchies.push_type.rb → 20151102165860_create_push_type_taxonomy_hierarchies.push_type.rb} +0 -0
  86. /data/test/dummy/db/migrate/{20151015181718_add_field_store_default_values.push_type.rb → 20151102165861_add_field_store_default_values.push_type.rb} +0 -0
  87. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{b_s0LvGnXotYeP7ueqwDIpeRe_32gsm1zkbeE2UmozQ.cache → A3QMbn17wDkitGAvrQzrM5Yvwc4n485nbIme7P3pipI.cache} +0 -0
  88. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{UXhmsxcPbGcG36Pk6KUujzn9noRkcRgGOohZ8wP8O58.cache → JWU4QAKxpGFz1WxBsIoXKK6IH5hWAZ6ulEAwKiOz1X4.cache} +0 -0
  89. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{5fEpjdfAeqZsIjcnsi0MPOE80IWL2sGRCSSxfUUIIoM.cache → Lix1By3vZQ-BSL0QFJuiriDgj0L7Tl9DD-8Feoiaa-Q.cache} +0 -0
  90. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{PghaRuu1VpTYo6FSvTUg-wiFBQhv4uj69lpKjI6JjKQ.cache → emReUhkfaQkbNvBYnI2hyBwbph-vKsk323NNnNZP2v0.cache} +0 -0
  91. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{DlH-DnEsmWl8jIHY3k5keLk6ZTl0UcGFooi9qEQzg0Q.cache → nhJuId471nk5_X22-JkYdy2xSm6cLXff_H6Xt5COar8.cache} +0 -0
  92. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{uZWjCUafkm7SECxzLEtFxy5P7sfw2rYKt8yN59KJ42Q.cache → uWg65r77iUJib7MTS9pw5aH9FKMjlzUSRKBD331BPtI.cache} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f93ae03dc6ed6fab62b7bbf7932077fdf4f379fa
4
- data.tar.gz: 19f745c42c090f9dacae3b97bdcd157c2a9a3460
3
+ metadata.gz: 7a34b274eeb17eccee9b3954265ab72a69c96c70
4
+ data.tar.gz: 3da8bebd6539ebeb37da176960110425adbe1f71
5
5
  SHA512:
6
- metadata.gz: e74abb601ff2e6336e84ad7c6093da357d883687e7c564a455129ed9e0281113597ef066c52a2e61926d398c218b334f3eed5ebc740a0c4dd658acf2ffe5395a
7
- data.tar.gz: 71989795eda90d361c7a33ec8a96be133a2c85b930da18d96f5d79a026714d261487116a3add425e0718ebcfdeacf8e689d59330c25752945edb7bcb439dc004
6
+ metadata.gz: 8a5bbf35600501b56f1e3c2211492d6d73e6d4f75002602e49e4bd7e783a50def319767726b350922d9aeae73b9a107a8976b348e0eb25853d34abf7796669ec
7
+ data.tar.gz: 24c744776cd98ebf4714e6e9e835359fa5dd258c19cf32512aca6b075ad46d187ee511ef3cf789dcbf462982bbe6e5e5d102addf510d8ac42e5b68af110bec1f
@@ -33,6 +33,8 @@
33
33
 
34
34
  Turbolinks.enableProgressBar()
35
35
 
36
+ Math.uid = -> Math.floor(Math.random()*16777215).toString(16)
37
+
36
38
  @app = angular.module 'push_type', ['ui.tree']
37
39
 
38
40
  @app.run ['$http', ($http) ->
@@ -50,12 +52,13 @@ Turbolinks.enableProgressBar()
50
52
  # jQuery init
51
53
  $(document).on 'ready page:load', ->
52
54
 
53
- # Bootstrap foundation
54
- $(document).foundation()
55
- $(document).confirmWithReveal()
55
+ $(document).on 'init.fndtn', (a,b,c) ->
56
+ $(a.target).foundation()
57
+ $(a.target).confirmWithReveal()
56
58
 
57
- # Bootstrap Angular
59
+ # Bootstrap Angular and Foundation
58
60
  angular.bootstrap $('[role="main"]'), ['push_type']
61
+ $(document).trigger 'init.fndtn'
59
62
 
60
63
  $('.node-list.sortable').sortable
61
64
  handle: '.handle'
@@ -3,6 +3,7 @@
3
3
  $scope.$modal = null
4
4
  $scope.assets = []
5
5
  $scope.meta = {}
6
+ $scope.uid = 'asset-' + Math.uid()
6
7
 
7
8
  $scope.loadAssets = (page) ->
8
9
  config = if page? then { params: { page: page } } else null
@@ -47,7 +48,7 @@
47
48
  $(document).on 'ready page:load', ->
48
49
 
49
50
  $(document).on 'open.fndtn.reveal', '.asset-field-modal', ->
50
- $scope = angular.element($(this)).scope()
51
+ $scope = angular.element($(this)).scope()
51
52
  $scope.$modal = $(this)
52
53
  $scope.loadAssets()
53
54
  $scope.$apply()
@@ -1,13 +1,16 @@
1
- # jQuery init
2
- $(document).on 'ready page:load', ->
3
-
4
- $('input', '.date').pickadate
1
+ opts =
2
+ date:
5
3
  format: 'd mmmm yyyy'
6
4
  formatSubmit: 'yyyy-mm-dd'
7
5
  hiddenName: true
8
-
9
- $('input', '.time').pickatime
6
+ time:
10
7
  format: 'h:i A'
11
8
  formatSubmit: 'HH:i'
12
9
  formatLabel: 'h:i A <sm!all>HH:i</sm!all>'
13
10
  hiddenName: true
11
+
12
+ @app.directive 'pickadate', ->
13
+ ($scope, $el, $attrs) ->
14
+ switch $attrs['pickadate']
15
+ when 'date' then $($el).pickadate opts.date
16
+ when 'time' then $($el).pickatime opts.time
@@ -1,15 +1,31 @@
1
- @app.controller 'RepeaterFieldCtrl', ['$scope', ($scope) ->
1
+ @app.directive 'repeaterField', ['$compile', '$timeout', ($compile, $timeout) ->
2
+ {
3
+ restrict: 'A'
4
+ scope: true
5
+ link: ($scope, $el, $attrs) ->
6
+ $rows = $('.rows', $el)
7
+ template = $('.template', $el).text()
2
8
 
3
- $scope.rows = [null]
9
+ $scope.addRow = ->
10
+ uid = Math.uid()
11
+ $row = $(template)
12
+ $row.attr 'data-uid', uid
13
+ $rows.append $row
14
+ $dom = $("[data-uid='#{ uid }']", $rows)
15
+ $compile($dom)($scope)
16
+ $timeout -> $dom.trigger('init.fndtn')
17
+ true
4
18
 
5
- $scope.initRows = (rows) ->
6
- $scope.rows = rows if rows?
19
+ $scope.addRow() unless $rows.children().length
20
+ }
21
+ ]
7
22
 
8
- $scope.addRow = ->
9
- $scope.rows.push null
10
-
11
- $scope.removeRow = (i) ->
12
- console.log "Removeing #{i}"
13
- $scope.rows.splice(i, 1);
14
-
15
- ]
23
+ @app.directive 'repeaterRow', ->
24
+ {
25
+ restrict: 'A'
26
+ scope: true
27
+ link: ($scope, $el, $attrs) ->
28
+ $scope.removeRow = ->
29
+ $el.remove()
30
+ true
31
+ }
@@ -1,7 +1,14 @@
1
- # jQuery init
2
- $(document).on 'ready page:load', ->
1
+ opts =
2
+ select:
3
+ plugins: ['remove_button']
4
+ hideSelected: false
5
+
6
+ tag_list:
7
+ plugins: ['remove_button', 'drag_drop']
8
+ create: true
9
+ persist: false
3
10
 
4
- $('select', '.relation, .node, .taxonomy').selectize
11
+ relation:
5
12
  plugins: ['remove_button']
6
13
  hideSelected: false
7
14
  onInitialize: ->
@@ -17,3 +24,11 @@ $(document).on 'ready page:load', ->
17
24
  option: (item, esc) ->
18
25
  pre = if item.depth > 0 then '- '.repeat(item.depth) else ''
19
26
  """<div class="option">#{ pre }#{ esc item.text }</div>"""
27
+
28
+
29
+ @app.directive 'selectize', ->
30
+ ($scope, $el, $attrs) ->
31
+ switch $attrs['selectize']
32
+ when 'select' then $($el).selectize opts.select
33
+ when 'tag_list' then $($el).selectize opts.tag_list
34
+ when 'relation', 'node', 'taxonomy' then $($el).selectize opts.relation
@@ -1,7 +1,8 @@
1
1
  module PushType
2
2
  module FieldsHelper
3
3
 
4
- def render_field(field, f)
4
+ def render_field(field, f, html_options = {})
5
+ field.instance_variable_get(:@opts)[:html_options].merge! html_options
5
6
  content_tag :div, class: field.kind do
6
7
  render "push_type/fields/#{ field.template }", f: f, field: field
7
8
  end
@@ -11,31 +12,5 @@ module PushType
11
12
  [field.css_class, 'columns end'].compact.join(' ')
12
13
  end
13
14
 
14
- def merge_repeater_html_options(object_name, field, sub_field)
15
- opts = {
16
- name: "#{ object_name }[#{ field.name }][]",
17
- id: "#{ object_name }_#{ field.name }_{{ $index }}"
18
- }
19
- if [:text_area, :select].include?(sub_field.form_helper)
20
- opts.merge!(:'ng-model' => "rows[$index]")
21
- else
22
- opts.merge!(:'ng-value' => "rows[$index]")
23
- end
24
- sub_field.instance_variable_get(:@opts)[:html_options].merge! opts
25
- end
26
-
27
- def merge_matrix_html_options(object_name, field, sub_field)
28
- opts = {
29
- name: "#{ object_name }[#{ field.name }][][#{ sub_field.name }]",
30
- id: "#{ object_name }_#{ field.name }_{{ $index }}_#{ sub_field.name }"
31
- }
32
- if [:text_area, :select].include?(sub_field.form_helper)
33
- opts.merge!(:'ng-model' => "row.#{ sub_field.name }")
34
- else
35
- opts.merge!(:'ng-value' => "row.#{ sub_field.name }")
36
- end
37
- sub_field.instance_variable_get(:@opts)[:html_options].merge! opts
38
- end
39
-
40
15
  end
41
16
  end
@@ -1,5 +1,5 @@
1
1
  .asset-field{ class: ('error' if f.object.errors[field.name].present?), ng: { controller: 'AssetFieldCtrl', init: "assetsPath='#{ push_type.assets_path }'; asset=#{ asset_hash(f.object.send(field.relation_name.to_sym)).to_json }" } }
2
- = f.hidden_field field.name, value: '{{ asset.id }}'
2
+ = f.hidden_field field.name, field.html_options.merge(value: '{{ asset.id }}')
3
3
 
4
4
  .row{ ng: { show: 'asset' } }
5
5
  .small-4.medium-3.columns
@@ -17,9 +17,9 @@
17
17
  %td {{ asset.mime_type }}
18
18
  %a.button.secondary.small.radius{ ng: { click: 'deselectAsset()' } } Remove media
19
19
  %div{ ng: { hide: 'asset' } }
20
- %a.button.success.small.radius{ data: { reveal: { id: field.id_attr } } } Pick media
20
+ %a.button.success.small.radius{ data: { reveal: { id: '{{ uid }}' } } } Pick media
21
21
 
22
- .reveal-modal.asset-field-modal{ id: field.id_attr, data: { reveal: true } }
22
+ .reveal-modal.asset-field-modal{ id: '{{ uid }}', data: { reveal: true } }
23
23
 
24
24
  %ul.tabs{ data: { tab: true } }
25
25
  %li.tab-title.active= link_to ficon(:thumbnails, 'Media'), '#media', data: { success: true }
@@ -1 +1 @@
1
- = f.send field.form_helper, field.name, field.html_options.merge(data: { value: field.json_value })
1
+ = f.send field.form_helper, field.name, field.html_options.merge(data: { value: field.json_value }, pickadate: field.kind)
@@ -1,17 +1,27 @@
1
- .repeater-field{ ng: { controller: 'MatrixFieldCtrl', init: "initRows(#{ field.json_value.to_json })" } }
1
+ .repeater-field.mat{ repeater: { field: true } }
2
2
  %table
3
3
  %thead
4
4
  %tr
5
5
  - field.fields.keys.each do |name|
6
6
  %th= name.to_s.humanize
7
7
  %th &nbsp;
8
- %tbody
9
- %tr{ ng: { repeat: 'row in rows track by $index' } }
10
- = fields_for :matrix do |m|
11
- - field.fields.each do |name, sub_field|
12
- - merge_matrix_html_options f.object_name, field, sub_field
13
- %td= render_field sub_field, m
14
- %td.remove
15
- %a.alert{ ng: { click: 'removeRow($index)' } }= ficon(:x)
8
+ %tbody.rows
9
+ - field.rows.each do |row|
10
+ = f.fields_for "#{ field.name }[]", row do |r|
11
+ %tr{ repeater: { row: true } }
12
+ - row.fields.each do |name, sub_field|
13
+ %td= render_field sub_field, r, id: nil
14
+ %td.remove
15
+ %a.alert{ ng: { click: 'removeRow()' } }= ficon(:x)
16
+
16
17
  .plus
17
- %a.button.success.tiny.radius{ ng: { click: 'addRow()' } }= ficon :plus, 'Add row'
18
+ %a.button.success.tiny.radius{ ng: { click: 'addRow()' } }
19
+ = ficon :plus, 'Add row'
20
+
21
+ %script{:type => 'html/template', :class => 'template' }
22
+ = f.fields_for "#{ field.name }[]", field.structure do |r|
23
+ %tr{ repeater: { row: true } }
24
+ - field.fields.each do |name, sub_field|
25
+ %td= render_field sub_field, r, id: nil
26
+ %td.remove
27
+ %a.alert{ ng: { click: 'removeRow()' } }= ficon(:x)
@@ -1 +1 @@
1
- = f.select field.name, [], field.field_options, field.html_options.merge(data: { options: field.choices.to_json, items: field.json_value })
1
+ = f.select field.name, [], field.field_options, field.html_options.merge(data: { options: field.choices.to_json, items: field.json_value }, selectize: field.kind)
@@ -1,12 +1,20 @@
1
- .repeater-field{ ng: { controller: 'RepeaterFieldCtrl', init: "initRows(#{ field.json_value.to_json })" } }
1
+ .repeater-field.rep{ repeater: { field: true } }
2
2
  %table
3
- %tbody
4
- %tr{ ng: { repeat: 'row in rows track by $index' } }
5
- = f.fields_for field.name do |m|
6
- %td
7
- - merge_repeater_html_options f.object_name, field, field.field
8
- = render_field field.field, m
9
- %td.remove
10
- %a.alert{ ng: { click: 'removeRow($index)' } }= ficon(:x)
3
+ %tbody.rows
4
+ - field.rows.each do |row|
5
+ = f.fields_for field.name, row do |r|
6
+ %tr{ repeater: { row: true } }
7
+ %td= render_field row.f, r, name: "#{ f.object_name }[#{ field.name }][]", id: nil
8
+ %td.remove
9
+ %a.alert{ ng: { click: 'removeRow()' } }= ficon(:x)
10
+
11
11
  .plus
12
- %a.button.success.tiny.radius{ ng: { click: 'addRow()' } }= ficon :plus, 'Add row'
12
+ %a.button.success.tiny.radius{ ng: { click: 'addRow()' } }
13
+ = ficon :plus, 'Add row'
14
+
15
+ %script{:type => 'html/template', :class => 'template' }
16
+ = f.fields_for field.name, field.structure do |r|
17
+ %tr{ repeater: { row: true } }
18
+ %td= render_field field.structure.f, r, name: "#{ f.object_name }[#{ field.name }][]", id: nil
19
+ %td.remove
20
+ %a.alert{ ng: { click: 'removeRow()' } }= ficon(:x)
@@ -1 +1 @@
1
- = f.select field.name, field.choices, field.field_options, field.html_options
1
+ = f.select field.name, field.choices, field.field_options, field.html_options.merge(selectize: field.kind)
@@ -50,6 +50,6 @@ PushType.setup do |config|
50
50
  # secret_access_key: ENV['SECRET_ACCESS_KEY_ID']
51
51
  # }
52
52
 
53
- # config.dragonfly_secret = '2542d62d66fa7ca4238bb61e6f4dfcd1a0234b025752343ee31f606926ec829e'
53
+ # config.dragonfly_secret = 'd2cf92edc302f046840548786fbb0965b055bb82fc5c0daf0b3488ed8ab5a623'
54
54
 
55
55
  end
@@ -11,10 +11,10 @@
11
11
  # if you're sharing your code publicly.
12
12
 
13
13
  development:
14
- secret_key_base: 082dfbae4ce05ff87db8dc7406a2ab20ecb6a191996319e045568be651276c49bf0d5b90552a812e7cd73fa131f4d58890248602378520e174710ac788052db5
14
+ secret_key_base: e89cd103f737dab6d4cdaad964f0421191509fccbd3477bd234e6a8a5c3436ae2195372a17d11f3a8f3a9982b050dd72cac42d8f9770b96c2ff0242ec9f0422f
15
15
 
16
16
  test:
17
- secret_key_base: c305599cd12060dcffe2fedee9935d508e193115b6c91f0a6217b191c014c1dd9254a5d30944cb98be2b985d097b1fbe25d3edfdbc3a342c8fe459647cb548b3
17
+ secret_key_base: d2cd4dc8c57a758eda7618eb22e3acaace8ac2dd36755724aa39deef622c8c628425b77f20d79a25cce7ea820b5b19474c9c1d9edfa1d8c00b08c13651a07621
18
18
 
19
19
  # Do not keep production secrets in the repository,
20
20
  # instead read values from the environment.
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20151015181718) do
14
+ ActiveRecord::Schema.define(version: 20151102165861) do
15
15
 
16
16
  # These are extensions that must be enabled in order to support this database
17
17
  enable_extension "plpgsql"