polyblock 0.6.7 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/polyblock/init.js +1 -1
  3. data/app/controllers/polyblock/polyblocks_controller.rb +14 -2
  4. data/app/views/polyblock/_fields_for.html.haml +3 -0
  5. data/lib/polyblock/version.rb +1 -1
  6. data/lib/polyblock/view_helpers.rb +30 -10
  7. data/test/dummy/app/views/home/index.html.haml +27 -3
  8. data/test/dummy/db/development.sqlite3 +0 -0
  9. data/test/dummy/log/development.log +10248 -0
  10. data/test/dummy/tmp/cache/assets/development/sprockets/03473d71d3bdea15f5ace0ae2d25d5af +0 -0
  11. data/test/dummy/tmp/cache/assets/development/sprockets/051c4961a24c2cd7735c122ca0532bfa +0 -0
  12. data/test/dummy/tmp/cache/assets/development/sprockets/059961ab8ef1cf9cf07b58a2632538ad +0 -0
  13. data/test/dummy/tmp/cache/assets/development/sprockets/0620d0f63e3c3e69865b8cf6a6dd00e2 +0 -0
  14. data/test/dummy/tmp/cache/assets/development/sprockets/071036640f42500b0d2f362d7a02820c +0 -0
  15. data/test/dummy/tmp/cache/assets/development/sprockets/07f7d6c55e18da50e504d239d07155e8 +0 -0
  16. data/test/dummy/tmp/cache/assets/development/sprockets/08943e87265a8f1bf590ebfcbc8ffdc5 +0 -0
  17. data/test/dummy/tmp/cache/assets/development/sprockets/09edc185a9fa3af2dd63b69f391e869d +0 -0
  18. data/test/dummy/tmp/cache/assets/development/sprockets/0b20c473b1cf85262fb413ec514eba2d +0 -0
  19. data/test/dummy/tmp/cache/assets/development/sprockets/0b740acd21b0a5d53a8b8c7fe3a00906 +0 -0
  20. data/test/dummy/tmp/cache/assets/development/sprockets/0c18e08f3d314843be7f5c7494e5703c +0 -0
  21. data/test/dummy/tmp/cache/assets/development/sprockets/0cb7136469620370aa8cc6797eb1508e +0 -0
  22. data/test/dummy/tmp/cache/assets/development/sprockets/0cc340620454c5dc53cc409eb8668ad1 +0 -0
  23. data/test/dummy/tmp/cache/assets/development/sprockets/0d464257883db1efbf725354a6922338 +0 -0
  24. data/test/dummy/tmp/cache/assets/development/sprockets/0dc7008cc6e22c8c292752d5a7b1aee3 +0 -0
  25. data/test/dummy/tmp/cache/assets/development/sprockets/118f3141e06bf97881217824b8c258af +0 -0
  26. data/test/dummy/tmp/cache/assets/development/sprockets/11ed0be09fd8a639f2056a0e913c1d7d +0 -0
  27. data/test/dummy/tmp/cache/assets/development/sprockets/12c8326259a26ef2005651142b56334b +0 -0
  28. data/test/dummy/tmp/cache/assets/development/sprockets/184477034b78eb3823310122283488c3 +0 -0
  29. data/test/dummy/tmp/cache/assets/development/sprockets/1a6b22f75dd733f37a58256e17f3df25 +0 -0
  30. data/test/dummy/tmp/cache/assets/development/sprockets/1da0c72e16a0864f9aeaba0017159ea7 +0 -0
  31. data/test/dummy/tmp/cache/assets/development/sprockets/1f0360ff47d4081b90af9e248e0c1236 +0 -0
  32. data/test/dummy/tmp/cache/assets/development/sprockets/1f24ddf998c3fe539c8960b789ec8ca0 +0 -0
  33. data/test/dummy/tmp/cache/assets/development/sprockets/2314de0948718071a416c8b3e596cd04 +0 -0
  34. data/test/dummy/tmp/cache/assets/development/sprockets/246733177bb4aedd4d96ba705a820f98 +0 -0
  35. data/test/dummy/tmp/cache/assets/development/sprockets/29304a00cec9257fbcd1f2e5e9d1db8f +0 -0
  36. data/test/dummy/tmp/cache/assets/development/sprockets/2958076612069e5a80f532cacf98079a +0 -0
  37. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  38. data/test/dummy/tmp/cache/assets/development/sprockets/301fa4c10c602b996c8f476e392ebc9e +0 -0
  39. data/test/dummy/tmp/cache/assets/development/sprockets/34162dfb4f1c8271ab39babcb743eea2 +0 -0
  40. data/test/dummy/tmp/cache/assets/development/sprockets/36d7c41f3b7b9aab6e3d1783e81ed836 +0 -0
  41. data/test/dummy/tmp/cache/assets/development/sprockets/37c793e172067ec2f94a4bc735d705c4 +0 -0
  42. data/test/dummy/tmp/cache/assets/development/sprockets/38f2f07142ef51b466aa497d8f03ad42 +0 -0
  43. data/test/dummy/tmp/cache/assets/development/sprockets/44232740647b68f5762819e4cf6b2054 +0 -0
  44. data/test/dummy/tmp/cache/assets/development/sprockets/451c8c61669b2feb8c94f616a272dba4 +0 -0
  45. data/test/dummy/tmp/cache/assets/development/sprockets/487ad6f41473560e31841a4733e9de5a +0 -0
  46. data/test/dummy/tmp/cache/assets/development/sprockets/494d5d0170b351d9b5e868ae9bce055e +0 -0
  47. data/test/dummy/tmp/cache/assets/development/sprockets/4a0bcabb7b935c52b147526848ccfe55 +0 -0
  48. data/test/dummy/tmp/cache/assets/development/sprockets/4c3bdb23c16ef706c96f2caf1805ce72 +0 -0
  49. data/test/dummy/tmp/cache/assets/development/sprockets/50578344fad2eb35bebe2c90f79d8152 +0 -0
  50. data/test/dummy/tmp/cache/assets/development/sprockets/52b71f4583cc2a5e9d4028f189d51e6e +0 -0
  51. data/test/dummy/tmp/cache/assets/development/sprockets/566ee534d5ab65eca581a8e63ee6975b +0 -0
  52. data/test/dummy/tmp/cache/assets/development/sprockets/5918460939390be48992c19d33cef9ca +0 -0
  53. data/test/dummy/tmp/cache/assets/development/sprockets/5a84131c2277290d1714c13637316ca2 +0 -0
  54. data/test/dummy/tmp/cache/assets/development/sprockets/5b41f7cb38d7bae91ec56c36c55fea69 +0 -0
  55. data/test/dummy/tmp/cache/assets/development/sprockets/5d845aed1dd15093aa72502effba43cd +0 -0
  56. data/test/dummy/tmp/cache/assets/development/sprockets/5ff9e2a84a3d72e0568db062d14ef5f4 +0 -0
  57. data/test/dummy/tmp/cache/assets/development/sprockets/608e3320cec60884f0c7c252303b54da +0 -0
  58. data/test/dummy/tmp/cache/assets/development/sprockets/62def6d38d984d87f4d427ba84ac4fe9 +0 -0
  59. data/test/dummy/tmp/cache/assets/development/sprockets/64a1c0ee864f1ebe737afe5f5c74b0fc +0 -0
  60. data/test/dummy/tmp/cache/assets/development/sprockets/65527e18de81e3462d422079cc71c584 +0 -0
  61. data/test/dummy/tmp/cache/assets/development/sprockets/65efc83abec4ecd0ae0dc7026fd8aa15 +0 -0
  62. data/test/dummy/tmp/cache/assets/development/sprockets/667cdbd854cab7f8b6e083ca927ea46e +0 -0
  63. data/test/dummy/tmp/cache/assets/development/sprockets/66ae10edc6c88334560cce5d769d9bff +0 -0
  64. data/test/dummy/tmp/cache/assets/development/sprockets/6903053f5f6fef17373b867091469d04 +0 -0
  65. data/test/dummy/tmp/cache/assets/development/sprockets/7061033015aa3bbbe8fe50ad6facb91d +0 -0
  66. data/test/dummy/tmp/cache/assets/development/sprockets/717b281c4c0de6a22eecc7a2d4c1d547 +0 -0
  67. data/test/dummy/tmp/cache/assets/development/sprockets/75941f09a40f48b0e60ac822426c7468 +0 -0
  68. data/test/dummy/tmp/cache/assets/development/sprockets/797b38be0934660a9f3279006e0eb665 +0 -0
  69. data/test/dummy/tmp/cache/assets/development/sprockets/7ab902cb0c51a85ee8394eb1a466f2fb +0 -0
  70. data/test/dummy/tmp/cache/assets/development/sprockets/7abec587f310cd518769bd1c431b4c71 +0 -0
  71. data/test/dummy/tmp/cache/assets/development/sprockets/7c4b154241f66501fc6dade32aeec9a1 +0 -0
  72. data/test/dummy/tmp/cache/assets/development/sprockets/82ebad49445e18807f74440fc1bc1500 +0 -0
  73. data/test/dummy/tmp/cache/assets/development/sprockets/83666f08340fba6ca5828333bd24c3be +0 -0
  74. data/test/dummy/tmp/cache/assets/development/sprockets/893432edf5fd95ef67c41c851ce82e01 +0 -0
  75. data/test/dummy/tmp/cache/assets/development/sprockets/8c1d0399f49f982996b93da17d9b2a33 +0 -0
  76. data/test/dummy/tmp/cache/assets/development/sprockets/8e5c708dfab5148a0b5f88968093fc4d +0 -0
  77. data/test/dummy/tmp/cache/assets/development/sprockets/92cb08054175a2d919e005206c8d291c +0 -0
  78. data/test/dummy/tmp/cache/assets/development/sprockets/943233bb22329544d8af6771bf7501d2 +0 -0
  79. data/test/dummy/tmp/cache/assets/development/sprockets/97e19c72d154870603773c4b4d3c4bb1 +0 -0
  80. data/test/dummy/tmp/cache/assets/development/sprockets/986ab131457bafd6d60dc54ba21b5c1a +0 -0
  81. data/test/dummy/tmp/cache/assets/development/sprockets/98d8e86da91a5a83d22883d46c59b255 +0 -0
  82. data/test/dummy/tmp/cache/assets/development/sprockets/993dd9d6904a974a8722b0b8e5273484 +0 -0
  83. data/test/dummy/tmp/cache/assets/development/sprockets/9bbb3fb70f5cec723c532d248620ca99 +0 -0
  84. data/test/dummy/tmp/cache/assets/development/sprockets/9bc958e40a870b9672ab5e29e86766a1 +0 -0
  85. data/test/dummy/tmp/cache/assets/development/sprockets/9eb778978a0e9d87471847c69bce70ed +0 -0
  86. data/test/dummy/tmp/cache/assets/development/sprockets/a080b0a9ab275c573722039721fe09d5 +0 -0
  87. data/test/dummy/tmp/cache/assets/development/sprockets/a0ec59fbcdd74422901f1b9eb9bdf24f +0 -0
  88. data/test/dummy/tmp/cache/assets/development/sprockets/a4f012604acd8a8c3ab03ff6f5d0cb86 +0 -0
  89. data/test/dummy/tmp/cache/assets/development/sprockets/a527a50f4e5906e4f861b5e3c2281dfe +0 -0
  90. data/test/dummy/tmp/cache/assets/development/sprockets/a60997386667c497e528df87d93166c2 +0 -0
  91. data/test/dummy/tmp/cache/assets/development/sprockets/a6b71e79c7730e623c940cb7a067ad6a +0 -0
  92. data/test/dummy/tmp/cache/assets/development/sprockets/a8d81a773509f7b8a37f4d8389417e09 +0 -0
  93. data/test/dummy/tmp/cache/assets/development/sprockets/a90c6d08ab2998930c54955d53f7e19b +0 -0
  94. data/test/dummy/tmp/cache/assets/development/sprockets/aa667babce18740d37c11bb0579d11e3 +0 -0
  95. data/test/dummy/tmp/cache/assets/development/sprockets/aa8326dde73930667cfa3fcbafd3cfc1 +0 -0
  96. data/test/dummy/tmp/cache/assets/development/sprockets/aec527b927ba2a20383dac0494353415 +0 -0
  97. data/test/dummy/tmp/cache/assets/development/sprockets/b15660ad62bf19152ff961f89ef78a12 +0 -0
  98. data/test/dummy/tmp/cache/assets/development/sprockets/b2931f2276d8397965feab2b895a5dd1 +0 -0
  99. data/test/dummy/tmp/cache/assets/development/sprockets/b7d4d6d5c827be7632ea1f4c0c020657 +0 -0
  100. data/test/dummy/tmp/cache/assets/development/sprockets/c2baf423df953ea56cb246910da0f90d +0 -0
  101. data/test/dummy/tmp/cache/assets/development/sprockets/c3640ca3287a69b32c42b89fc087dcdb +0 -0
  102. data/test/dummy/tmp/cache/assets/development/sprockets/c38ccf3c1a09d316e52662e6c435afb8 +0 -0
  103. data/test/dummy/tmp/cache/assets/development/sprockets/c46d6f640ff33aeb14c795d83f67999a +0 -0
  104. data/test/dummy/tmp/cache/assets/development/sprockets/c55d7115b11fdd3c8ccd80202cba192e +0 -0
  105. data/test/dummy/tmp/cache/assets/development/sprockets/c663d8df586455ad4bd74a6e0e43d08a +0 -0
  106. data/test/dummy/tmp/cache/assets/development/sprockets/c71695a5f2a250b7259cd4639233e0b0 +0 -0
  107. data/test/dummy/tmp/cache/assets/development/sprockets/c7d50bbb710ea76b819956d6d1c3f8b9 +0 -0
  108. data/test/dummy/tmp/cache/assets/development/sprockets/c828de49f28a90716dd23df0d9a53763 +0 -0
  109. data/test/dummy/tmp/cache/assets/development/sprockets/c9d8f3e0bf5f8a64f08979c33630bbd7 +0 -0
  110. data/test/dummy/tmp/cache/assets/development/sprockets/cd6621aed025ee026e9ea1fdef041fae +0 -0
  111. data/test/dummy/tmp/cache/assets/development/sprockets/ce0d26700021c28e69607f9123a14b68 +0 -0
  112. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  113. data/test/dummy/tmp/cache/assets/development/sprockets/d124ce041980df3914af9e8184a2f307 +0 -0
  114. data/test/dummy/tmp/cache/assets/development/sprockets/d526697ea3535de3b319b6cc909093cf +0 -0
  115. data/test/dummy/tmp/cache/assets/development/sprockets/d59f66b53a9d2f911c58825bc5fc6e14 +0 -0
  116. data/test/dummy/tmp/cache/assets/development/sprockets/d6147f316721184b5ca171ce44534389 +0 -0
  117. data/test/dummy/tmp/cache/assets/development/sprockets/db17cf8b91438fb4eb4d505bcd55150a +0 -0
  118. data/test/dummy/tmp/cache/assets/development/sprockets/e0398f8dd3ec1d07d3f2a0ddc6d5820b +0 -0
  119. data/test/dummy/tmp/cache/assets/development/sprockets/e0908d171c0a2cdbc725a062babfeac8 +0 -0
  120. data/test/dummy/tmp/cache/assets/development/sprockets/e381cbb42a853529029a80bcc3faf8e6 +0 -0
  121. data/test/dummy/tmp/cache/assets/development/sprockets/e6387cca5c7c0bcc340188596d3ad7a5 +0 -0
  122. data/test/dummy/tmp/cache/assets/development/sprockets/eb4ac8237cf3c0e9c7b9c3c998b357ab +0 -0
  123. data/test/dummy/tmp/cache/assets/development/sprockets/ec74f3828a27e6c1f3563a9e36ab0d32 +0 -0
  124. data/test/dummy/tmp/cache/assets/development/sprockets/ed1dba4e1b4b34a915ec9d97c27c1c5c +0 -0
  125. data/test/dummy/tmp/cache/assets/development/sprockets/f0aa8cfbbc8b5de30b97fb527c2bd094 +0 -0
  126. data/test/dummy/tmp/cache/assets/development/sprockets/f160d2c3a8496281439004a3820859fb +0 -0
  127. data/test/dummy/tmp/cache/assets/development/sprockets/f56d1daf8765fdaeaca926ce869ff5ec +0 -0
  128. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  129. data/test/dummy/tmp/cache/assets/development/sprockets/f7cc9f846c456d82f7bf1ef4c10cdd6a +0 -0
  130. data/test/dummy/tmp/pids/server.pid +1 -0
  131. metadata +233 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aea70ec23a74860c96e50a39ee228a3e830b6fef
4
- data.tar.gz: 139793e42037272e9013e2d670c32617a580546f
3
+ metadata.gz: 94bc45958a0c364700d0eaefba71688b8d8e4bc2
4
+ data.tar.gz: 44e18333dcd72d3383d012d365fd6b1dd87951aa
5
5
  SHA512:
6
- metadata.gz: b281ac95c4ed3ca11991db5295831fc6176296ad650871b595e0f07470c28338b830dc312a1a60b33348ffb9d6c6968d0569048079cb60a5e9b8fd027330d5df
7
- data.tar.gz: aecc427525e25bc7b528366d4e47a0e634c48c544cfba522d940151f5ed99fecdfef28c326365f2b931125e87acbdb7e58ba7aa4e71951de97fab39aa194c7b0
6
+ metadata.gz: dd407769d10b23e4ce3ecdf731618b088dd364d65adf5fbd2e2d0a1b0ceb55090f70df774a09c10a1260fcb802e0f39fa80ac3e6755329ccb60ba9c0c47bf67c
7
+ data.tar.gz: 25da5bb6468e2e457341a9ae1be4e8a92e0145a4b7eb4cd7ce2f922ca47ac628fef0d7a1668f632e48a10e52119978c0a48276bd2fe2878dbcf2fef3d6d521d5
@@ -12,7 +12,7 @@
12
12
  //
13
13
  //= require jquery
14
14
  //= require jquery_ujs
15
- //= require jquery.ui.all
15
+ //= require jquery-ui
16
16
  //= require underscore
17
17
  //= require underscore.string
18
18
  //= require beautify
@@ -4,7 +4,7 @@ module Polyblock
4
4
  class PolyblocksController < ApplicationController
5
5
 
6
6
  def update
7
- if params.has_key? :pbs and params[:pbs].any?
7
+ if params.key?(:pbs) && params[:pbs].any?
8
8
  params[:pbs].each do |i, attrs|
9
9
  pb_find = Block.where(:id => attrs[:id])
10
10
  attrs.delete(:id)
@@ -14,8 +14,15 @@ module Polyblock
14
14
  Block.create! attrs
15
15
  end
16
16
  end
17
+ render :text => "OK!"
18
+ elsif params.key?(:polyblocks)
19
+ params[:polyblocks].each do |name, pb_attrs|
20
+ pb = Block.fetch_or_create name
21
+ pb.update_attributes! pb_attrs
22
+ end
23
+ flash[:success] = 'Your polyblocks have been updated!'
24
+ redirect_to :back
17
25
  end
18
- render :text => "OK!"
19
26
  end
20
27
 
21
28
  def convert_haml_to_html
@@ -42,5 +49,10 @@ module Polyblock
42
49
  render :text => engine.render
43
50
  end
44
51
 
52
+ private
53
+ def polyblocks_params
54
+ params.require(:polyblocks).permit()
55
+ end
56
+
45
57
  end
46
58
  end
@@ -0,0 +1,3 @@
1
+ = fields_for name do |ff|
2
+ = ff.hidden_field :name, :value => name.to_s
3
+ = ff.cktext_area :content, options.merge(name.is_a?(String) ? {:value => pb.content} : {})
@@ -1,3 +1,3 @@
1
1
  module Polyblock
2
- VERSION = "0.6.7"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -53,26 +53,46 @@ module Polyblock
53
53
  end
54
54
  end
55
55
 
56
+ def fields_for_polyblock(name, f, options={})
57
+ options = {}.merge(options)
58
+ pb = pb_from_name(name, f)
59
+ render :partial => 'polyblock/fields_for', :locals => {:f => f, :pb => pb, :name => name, :options => options}
60
+ end
61
+
56
62
  def simple_fields_for_polyblock(name, f, options={})
57
63
  options = {
58
- :label => false,
64
+ :label => true,
59
65
  :input_html => {}
60
66
  }.merge(options)
61
-
62
- pb = if name.is_a?(String)
63
- Block.fetch_or_initialize(name)
64
- elsif name.is_a?(Symbol)
65
- f.object
66
- else
67
- nil
68
- end
69
-
67
+ pb = pb_from_name(name, f)
70
68
  render :partial => 'polyblock/simple_fields_for', :locals => {:f => f, :pb => pb, :name => name, :options => options}
71
69
  end
72
70
 
71
+ def simple_form_for_polyblocks(options={})
72
+ options = {
73
+ :url => '/polyblock/update'
74
+ }.merge(options)
75
+ simple_form_for(:polyblocks, options) do |f| yield(f) end
76
+ end
77
+
73
78
  def polyblock_editor_bar
74
79
  render :partial => 'polyblock/editor_bar'
75
80
  end
76
81
 
82
+ private
83
+ def pb_from_name(name, f)
84
+ if name.is_a?(String)
85
+ Block.fetch_or_initialize(name)
86
+ elsif name.is_a?(Symbol)
87
+ if f.object.is_a? Block
88
+ f.object
89
+ else
90
+ f.object.send(name)
91
+ end
92
+ else
93
+ raise 'Invalid name passed to Polyblock pb helper!'
94
+ end
95
+ end
96
+
77
97
  end
78
98
  end
@@ -3,12 +3,36 @@
3
3
  %h3 Polyblock with Inline Editing
4
4
  = pb 'Test', :editable => true
5
5
 
6
+ %h3 Uneditable Polyblock
7
+ = pb 'Test', :editable => false
8
+
6
9
  %h3 New Polyblock
7
10
  = pb Polyblock::Block.random_id, :editable => true
8
11
 
12
+ %h3 Polyblock Form Helper
13
+ = form_for @event do |f|
14
+ %p
15
+ Title:
16
+ = f.text_field :title
17
+ %p
18
+ Description:
19
+ %br
20
+ = fields_for_polyblock :description, f
21
+ %p
22
+ Some Random String
23
+ = fields_for_polyblock "Some Random String", f
24
+ = f.submit
25
+
26
+ %h3
27
+
9
28
  %h3 Polyblock SimpleForm
10
29
  = simple_form_for @event do |f|
11
30
  = f.input :title
12
- = simple_fields_for_polyblock :description, f, :label => true
13
- = simple_fields_for_polyblock "Random String", f, :label => true
14
- = f.submit "Save Event"
31
+ = simple_fields_for_polyblock :description, f
32
+ = simple_fields_for_polyblock "Some Other Random String", f
33
+ = f.submit "Save Event"
34
+
35
+ %h3 System Level Polyblocks in SimpleForm
36
+ = simple_form_for_polyblocks do |f|
37
+ = simple_fields_for_polyblock 'Another Random String', f
38
+ = f.submit
Binary file