doc/app/classes/Cms/ContentBlockController.html in browsercms-3.0.6 vs doc/app/classes/Cms/ContentBlockController.html in browsercms-3.1.0

- old
+ new

@@ -92,49 +92,50 @@ <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> - <a href="#M000678">after_create_on_error</a>&nbsp;&nbsp; - <a href="#M000677">after_create_on_failure</a>&nbsp;&nbsp; - <a href="#M000676">after_create_on_success</a>&nbsp;&nbsp; - <a href="#M000682">after_update_on_edit_conflict</a>&nbsp;&nbsp; - <a href="#M000683">after_update_on_error</a>&nbsp;&nbsp; - <a href="#M000681">after_update_on_failure</a>&nbsp;&nbsp; - <a href="#M000680">after_update_on_success</a>&nbsp;&nbsp; - <a href="#M000672">block_form</a>&nbsp;&nbsp; - <a href="#M000670">block_path</a>&nbsp;&nbsp; - <a href="#M000671">blocks_path</a>&nbsp;&nbsp; - <a href="#M000673">build_block</a>&nbsp;&nbsp; - <a href="#M000663">content_type</a>&nbsp;&nbsp; - <a href="#M000662">content_type_name</a>&nbsp;&nbsp; - <a href="#M000653">create</a>&nbsp;&nbsp; - <a href="#M000675">create_block</a>&nbsp;&nbsp; - <a href="#M000656">destroy</a>&nbsp;&nbsp; - <a href="#M000687">determine_layout</a>&nbsp;&nbsp; - <a href="#M000684">do_command</a>&nbsp;&nbsp; - <a href="#M000654">edit</a>&nbsp;&nbsp; - <a href="#M000650">index</a>&nbsp;&nbsp; - <a href="#M000667">load_block</a>&nbsp;&nbsp; - <a href="#M000668">load_block_draft</a>&nbsp;&nbsp; - <a href="#M000666">load_blocks</a>&nbsp;&nbsp; - <a href="#M000664">model_class</a>&nbsp;&nbsp; - <a href="#M000665">model_name</a>&nbsp;&nbsp; - <a href="#M000652">new</a>&nbsp;&nbsp; - <a href="#M000669">new_block_path</a>&nbsp;&nbsp; - <a href="#M000657">publish</a>&nbsp;&nbsp; - <a href="#M000685">revert_block</a>&nbsp;&nbsp; - <a href="#M000658">revert_to</a>&nbsp;&nbsp; - <a href="#M000674">set_default_category</a>&nbsp;&nbsp; - <a href="#M000686">set_toolbar_tab</a>&nbsp;&nbsp; - <a href="#M000651">show</a>&nbsp;&nbsp; - <a href="#M000688">template_directory</a>&nbsp;&nbsp; - <a href="#M000655">update</a>&nbsp;&nbsp; - <a href="#M000679">update_block</a>&nbsp;&nbsp; - <a href="#M000661">usages</a>&nbsp;&nbsp; - <a href="#M000659">version</a>&nbsp;&nbsp; - <a href="#M000660">versions</a>&nbsp;&nbsp; + <a href="#M000725">after_create_on_error</a>&nbsp;&nbsp; + <a href="#M000724">after_create_on_failure</a>&nbsp;&nbsp; + <a href="#M000723">after_create_on_success</a>&nbsp;&nbsp; + <a href="#M000729">after_update_on_edit_conflict</a>&nbsp;&nbsp; + <a href="#M000730">after_update_on_error</a>&nbsp;&nbsp; + <a href="#M000728">after_update_on_failure</a>&nbsp;&nbsp; + <a href="#M000727">after_update_on_success</a>&nbsp;&nbsp; + <a href="#M000719">block_form</a>&nbsp;&nbsp; + <a href="#M000717">block_path</a>&nbsp;&nbsp; + <a href="#M000718">blocks_path</a>&nbsp;&nbsp; + <a href="#M000720">build_block</a>&nbsp;&nbsp; + <a href="#M000733">check_permissions</a>&nbsp;&nbsp; + <a href="#M000710">content_type</a>&nbsp;&nbsp; + <a href="#M000709">content_type_name</a>&nbsp;&nbsp; + <a href="#M000700">create</a>&nbsp;&nbsp; + <a href="#M000722">create_block</a>&nbsp;&nbsp; + <a href="#M000703">destroy</a>&nbsp;&nbsp; + <a href="#M000735">determine_layout</a>&nbsp;&nbsp; + <a href="#M000731">do_command</a>&nbsp;&nbsp; + <a href="#M000701">edit</a>&nbsp;&nbsp; + <a href="#M000697">index</a>&nbsp;&nbsp; + <a href="#M000714">load_block</a>&nbsp;&nbsp; + <a href="#M000715">load_block_draft</a>&nbsp;&nbsp; + <a href="#M000713">load_blocks</a>&nbsp;&nbsp; + <a href="#M000711">model_class</a>&nbsp;&nbsp; + <a href="#M000712">model_name</a>&nbsp;&nbsp; + <a href="#M000699">new</a>&nbsp;&nbsp; + <a href="#M000716">new_block_path</a>&nbsp;&nbsp; + <a href="#M000704">publish</a>&nbsp;&nbsp; + <a href="#M000732">revert_block</a>&nbsp;&nbsp; + <a href="#M000705">revert_to</a>&nbsp;&nbsp; + <a href="#M000721">set_default_category</a>&nbsp;&nbsp; + <a href="#M000734">set_toolbar_tab</a>&nbsp;&nbsp; + <a href="#M000698">show</a>&nbsp;&nbsp; + <a href="#M000736">template_directory</a>&nbsp;&nbsp; + <a href="#M000702">update</a>&nbsp;&nbsp; + <a href="#M000726">update_block</a>&nbsp;&nbsp; + <a href="#M000708">usages</a>&nbsp;&nbsp; + <a href="#M000706">version</a>&nbsp;&nbsp; + <a href="#M000707">versions</a>&nbsp;&nbsp; </div> </div> </div> @@ -152,103 +153,104 @@ <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Instance methods</h3> - <div id="method-M000653" class="method-detail"> - <a name="M000653"></a> + <div id="method-M000700" class="method-detail"> + <a name="M000700"></a> <div class="method-heading"> - <a href="#M000653" class="method-signature"> + <a href="#M000700" class="method-signature"> <span class="method-name">create</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000653-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000653-source"> + onclick="toggleCode('M000700-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000700-source"> <pre> <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 29</span> 29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create</span> 30: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">create_block</span> 31: <span class="ruby-identifier">after_create_on_success</span> 32: <span class="ruby-keyword kw">else</span> 33: <span class="ruby-identifier">after_create_on_failure</span> 34: <span class="ruby-keyword kw">end</span> 35: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@exception</span> -36: <span class="ruby-identifier">after_create_on_error</span> -37: <span class="ruby-keyword kw">end</span> +36: <span class="ruby-identifier">raise</span> <span class="ruby-ivar">@exception</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Cms</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessDenied</span>) +37: <span class="ruby-identifier">after_create_on_error</span> +38: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000656" class="method-detail"> - <a name="M000656"></a> + <div id="method-M000703" class="method-detail"> + <a name="M000703"></a> <div class="method-heading"> - <a href="#M000656" class="method-signature"> + <a href="#M000703" class="method-signature"> <span class="method-name">destroy</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000656-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000656-source"> + onclick="toggleCode('M000703-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000703-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 56</span> -56: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy</span> -57: <span class="ruby-identifier">do_command</span>(<span class="ruby-value str">&quot;deleted&quot;</span>) { <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">destroy</span> } -58: <span class="ruby-identifier">redirect_to_first</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:_redirect_to</span>], <span class="ruby-identifier">blocks_path</span> -59: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 58</span> +58: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy</span> +59: <span class="ruby-identifier">do_command</span>(<span class="ruby-value str">&quot;deleted&quot;</span>) { <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">destroy</span> } +60: <span class="ruby-identifier">redirect_to_first</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:_redirect_to</span>], <span class="ruby-identifier">blocks_path</span> +61: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000654" class="method-detail"> - <a name="M000654"></a> + <div id="method-M000701" class="method-detail"> + <a name="M000701"></a> <div class="method-heading"> - <a href="#M000654" class="method-signature"> + <a href="#M000701" class="method-signature"> <span class="method-name">edit</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000654-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000654-source"> + onclick="toggleCode('M000701-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000701-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 39</span> -39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">edit</span> -40: <span class="ruby-identifier">load_block_draft</span> -41: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/edit&quot;</span> -42: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 40</span> +40: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">edit</span> +41: <span class="ruby-identifier">load_block_draft</span> +42: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/edit&quot;</span> +43: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000650" class="method-detail"> - <a name="M000650"></a> + <div id="method-M000697" class="method-detail"> + <a name="M000697"></a> <div class="method-heading"> - <a href="#M000650" class="method-signature"> + <a href="#M000697" class="method-signature"> <span class="method-name">index</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Basic REST Crud Action </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000650-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000650-source"> + onclick="toggleCode('M000697-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000697-source"> <pre> <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 13</span> 13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">index</span> 14: <span class="ruby-identifier">load_blocks</span> 15: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/index&quot;</span> @@ -256,23 +258,23 @@ </pre> </div> </div> </div> - <div id="method-M000652" class="method-detail"> - <a name="M000652"></a> + <div id="method-M000699" class="method-detail"> + <a name="M000699"></a> <div class="method-heading"> - <a href="#M000652" class="method-signature"> + <a href="#M000699" class="method-signature"> <span class="method-name">new</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000652-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000652-source"> + onclick="toggleCode('M000699-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000699-source"> <pre> <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 23</span> 23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new</span> 24: <span class="ruby-identifier">build_block</span> 25: <span class="ruby-identifier">set_default_category</span> @@ -281,76 +283,76 @@ </pre> </div> </div> </div> - <div id="method-M000657" class="method-detail"> - <a name="M000657"></a> + <div id="method-M000704" class="method-detail"> + <a name="M000704"></a> <div class="method-heading"> - <a href="#M000657" class="method-signature"> + <a href="#M000704" class="method-signature"> <span class="method-name">publish</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Additional CMS Action </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000657-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000657-source"> + onclick="toggleCode('M000704-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000704-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 63</span> -63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">publish</span> -64: <span class="ruby-identifier">do_command</span>(<span class="ruby-value str">&quot;published&quot;</span>) { <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">publish!</span> } -65: <span class="ruby-identifier">redirect_to_first</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:_redirect_to</span>], <span class="ruby-identifier">block_path</span> -66: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 65</span> +65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">publish</span> +66: <span class="ruby-identifier">do_command</span>(<span class="ruby-value str">&quot;published&quot;</span>) { <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">publish!</span> } +67: <span class="ruby-identifier">redirect_to_first</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:_redirect_to</span>], <span class="ruby-identifier">block_path</span> +68: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000658" class="method-detail"> - <a name="M000658"></a> + <div id="method-M000705" class="method-detail"> + <a name="M000705"></a> <div class="method-heading"> - <a href="#M000658" class="method-signature"> + <a href="#M000705" class="method-signature"> <span class="method-name">revert_to</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000658-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000658-source"> + onclick="toggleCode('M000705-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000705-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 68</span> -68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revert_to</span> -69: <span class="ruby-identifier">do_command</span>(<span class="ruby-node">&quot;reverted to version #{params[:version]}&quot;</span>) <span class="ruby-keyword kw">do</span> -70: <span class="ruby-identifier">revert_block</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:version</span>]) -71: <span class="ruby-keyword kw">end</span> -72: <span class="ruby-identifier">redirect_to_first</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:_redirect_to</span>], <span class="ruby-identifier">block_path</span> -73: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 70</span> +70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revert_to</span> +71: <span class="ruby-identifier">do_command</span>(<span class="ruby-node">&quot;reverted to version #{params[:version]}&quot;</span>) <span class="ruby-keyword kw">do</span> +72: <span class="ruby-identifier">revert_block</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:version</span>]) +73: <span class="ruby-keyword kw">end</span> +74: <span class="ruby-identifier">redirect_to_first</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:_redirect_to</span>], <span class="ruby-identifier">block_path</span> +75: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000651" class="method-detail"> - <a name="M000651"></a> + <div id="method-M000698" class="method-detail"> + <a name="M000698"></a> <div class="method-heading"> - <a href="#M000651" class="method-signature"> + <a href="#M000698" class="method-signature"> <span class="method-name">show</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000651-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000651-source"> + onclick="toggleCode('M000698-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000698-source"> <pre> <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 18</span> 18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show</span> 19: <span class="ruby-identifier">load_block_draft</span> 20: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/show&quot;</span> @@ -358,498 +360,539 @@ </pre> </div> </div> </div> - <div id="method-M000655" class="method-detail"> - <a name="M000655"></a> + <div id="method-M000702" class="method-detail"> + <a name="M000702"></a> <div class="method-heading"> - <a href="#M000655" class="method-signature"> + <a href="#M000702" class="method-signature"> <span class="method-name">update</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000655-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000655-source"> + onclick="toggleCode('M000702-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000702-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 44</span> -44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span> -45: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">update_block</span> -46: <span class="ruby-identifier">after_update_on_success</span> -47: <span class="ruby-keyword kw">else</span> -48: <span class="ruby-identifier">after_update_on_failure</span> -49: <span class="ruby-keyword kw">end</span> -50: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">StaleObjectError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@exception</span> -51: <span class="ruby-identifier">after_update_on_edit_conflict</span> -52: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@exception</span> -53: <span class="ruby-identifier">after_update_on_error</span> -54: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 45</span> +45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span> +46: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">update_block</span> +47: <span class="ruby-identifier">after_update_on_success</span> +48: <span class="ruby-keyword kw">else</span> +49: <span class="ruby-identifier">after_update_on_failure</span> +50: <span class="ruby-keyword kw">end</span> +51: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">StaleObjectError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@exception</span> +52: <span class="ruby-identifier">after_update_on_edit_conflict</span> +53: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@exception</span> +54: <span class="ruby-identifier">raise</span> <span class="ruby-ivar">@exception</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Cms</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessDenied</span>) +55: <span class="ruby-identifier">after_update_on_error</span> +56: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000661" class="method-detail"> - <a name="M000661"></a> + <div id="method-M000708" class="method-detail"> + <a name="M000708"></a> <div class="method-heading"> - <a href="#M000661" class="method-signature"> + <a href="#M000708" class="method-signature"> <span class="method-name">usages</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000661-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000661-source"> + onclick="toggleCode('M000708-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000708-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 92</span> -92: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">usages</span> -93: <span class="ruby-identifier">load_block_draft</span> -94: <span class="ruby-ivar">@pages</span> = <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">connected_pages</span>.<span class="ruby-identifier">all</span>(<span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'name'</span>) -95: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/usages&quot;</span> -96: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 94</span> +94: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">usages</span> +95: <span class="ruby-identifier">load_block_draft</span> +96: <span class="ruby-ivar">@pages</span> = <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">connected_pages</span>.<span class="ruby-identifier">all</span>(<span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'name'</span>) +97: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/usages&quot;</span> +98: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000659" class="method-detail"> - <a name="M000659"></a> + <div id="method-M000706" class="method-detail"> + <a name="M000706"></a> <div class="method-heading"> - <a href="#M000659" class="method-signature"> + <a href="#M000706" class="method-signature"> <span class="method-name">version</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000659-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000659-source"> + onclick="toggleCode('M000706-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000706-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 75</span> -75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">version</span> -76: <span class="ruby-identifier">load_block</span> -77: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:version</span>] -78: <span class="ruby-ivar">@block</span> = <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">as_of_version</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:version</span>]) -79: <span class="ruby-keyword kw">end</span> -80: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/show&quot;</span> -81: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 77</span> +77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">version</span> +78: <span class="ruby-identifier">load_block</span> +79: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:version</span>] +80: <span class="ruby-ivar">@block</span> = <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">as_of_version</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:version</span>]) +81: <span class="ruby-keyword kw">end</span> +82: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/show&quot;</span> +83: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000660" class="method-detail"> - <a name="M000660"></a> + <div id="method-M000707" class="method-detail"> + <a name="M000707"></a> <div class="method-heading"> - <a href="#M000660" class="method-signature"> + <a href="#M000707" class="method-signature"> <span class="method-name">versions</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000660-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000660-source"> + onclick="toggleCode('M000707-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000707-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 83</span> -83: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">versions</span> -84: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">versioned?</span> -85: <span class="ruby-identifier">load_block</span> -86: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/versions&quot;</span> -87: <span class="ruby-keyword kw">else</span> -88: <span class="ruby-identifier">render</span> <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;Not Implemented&quot;</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:not_implemented</span> -89: <span class="ruby-keyword kw">end</span> -90: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 85</span> +85: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">versions</span> +86: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">versioned?</span> +87: <span class="ruby-identifier">load_block</span> +88: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/versions&quot;</span> +89: <span class="ruby-keyword kw">else</span> +90: <span class="ruby-identifier">render</span> <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;Not Implemented&quot;</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:not_implemented</span> +91: <span class="ruby-keyword kw">end</span> +92: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <h3 class="section-bar">Protected Instance methods</h3> - <div id="method-M000678" class="method-detail"> - <a name="M000678"></a> + <div id="method-M000725" class="method-detail"> + <a name="M000725"></a> <div class="method-heading"> - <a href="#M000678" class="method-signature"> + <a href="#M000725" class="method-signature"> <span class="method-name">after_create_on_error</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000678-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000678-source"> + onclick="toggleCode('M000725-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000725-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 194</span> -194: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_create_on_error</span> -195: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{@exception.message}\n#{@exception.backtrace.join('\n')}&quot;</span> -196: <span class="ruby-identifier">after_create_on_failure</span> -197: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 200</span> +200: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_create_on_error</span> +201: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{@exception.message}\n#{@exception.backtrace.join('\n')}&quot;</span> +202: <span class="ruby-identifier">after_create_on_failure</span> +203: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000677" class="method-detail"> - <a name="M000677"></a> + <div id="method-M000724" class="method-detail"> + <a name="M000724"></a> <div class="method-heading"> - <a href="#M000677" class="method-signature"> + <a href="#M000724" class="method-signature"> <span class="method-name">after_create_on_failure</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000677-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000677-source"> + onclick="toggleCode('M000724-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000724-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 190</span> -190: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_create_on_failure</span> -191: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/new&quot;</span> -192: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 196</span> +196: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_create_on_failure</span> +197: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/new&quot;</span> +198: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000676" class="method-detail"> - <a name="M000676"></a> + <div id="method-M000723" class="method-detail"> + <a name="M000723"></a> <div class="method-heading"> - <a href="#M000676" class="method-signature"> + <a href="#M000723" class="method-signature"> <span class="method-name">after_create_on_success</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000676-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000676-source"> + onclick="toggleCode('M000723-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000723-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 180</span> -180: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_create_on_success</span> -181: <span class="ruby-identifier">block</span> = <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">versioned?</span> <span class="ruby-value">? </span><span class="ruby-ivar">@block</span>.<span class="ruby-identifier">draft</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@block</span> -182: <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:notice</span>] = <span class="ruby-node">&quot;#{content_type.display_name} '#{block.name}' was created&quot;</span> -183: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">connectable?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">connected_page</span> -184: <span class="ruby-identifier">redirect_to</span> <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">connected_page</span>.<span class="ruby-identifier">path</span> -185: <span class="ruby-keyword kw">else</span> -186: <span class="ruby-identifier">redirect_to_first</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:_redirect_to</span>], <span class="ruby-identifier">block_path</span> -187: <span class="ruby-keyword kw">end</span> -188: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 186</span> +186: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_create_on_success</span> +187: <span class="ruby-identifier">block</span> = <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">versioned?</span> <span class="ruby-value">? </span><span class="ruby-ivar">@block</span>.<span class="ruby-identifier">draft</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@block</span> +188: <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:notice</span>] = <span class="ruby-node">&quot;#{content_type.display_name} '#{block.name}' was created&quot;</span> +189: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">connectable?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">connected_page</span> +190: <span class="ruby-identifier">redirect_to</span> <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">connected_page</span>.<span class="ruby-identifier">path</span> +191: <span class="ruby-keyword kw">else</span> +192: <span class="ruby-identifier">redirect_to_first</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:_redirect_to</span>], <span class="ruby-identifier">block_path</span> +193: <span class="ruby-keyword kw">end</span> +194: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000682" class="method-detail"> - <a name="M000682"></a> + <div id="method-M000729" class="method-detail"> + <a name="M000729"></a> <div class="method-heading"> - <a href="#M000682" class="method-signature"> + <a href="#M000729" class="method-signature"> <span class="method-name">after_update_on_edit_conflict</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000682-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000682-source"> + onclick="toggleCode('M000729-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000729-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 214</span> -214: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_update_on_edit_conflict</span> -215: <span class="ruby-ivar">@other_version</span> = <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">find</span>(<span class="ruby-ivar">@block</span>.<span class="ruby-identifier">id</span>) -216: <span class="ruby-identifier">after_update_on_failure</span> -217: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 220</span> +220: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_update_on_edit_conflict</span> +221: <span class="ruby-ivar">@other_version</span> = <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">find</span>(<span class="ruby-ivar">@block</span>.<span class="ruby-identifier">id</span>) +222: <span class="ruby-identifier">after_update_on_failure</span> +223: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000683" class="method-detail"> - <a name="M000683"></a> + <div id="method-M000730" class="method-detail"> + <a name="M000730"></a> <div class="method-heading"> - <a href="#M000683" class="method-signature"> + <a href="#M000730" class="method-signature"> <span class="method-name">after_update_on_error</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000683-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000683-source"> + onclick="toggleCode('M000730-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000730-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 219</span> -219: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_update_on_error</span> -220: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{@exception.message}\n#{@exception.backtrace.join('\n')}&quot;</span> -221: <span class="ruby-identifier">after_update_on_failure</span> -222: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 225</span> +225: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_update_on_error</span> +226: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{@exception.message}\n#{@exception.backtrace.join('\n')}&quot;</span> +227: <span class="ruby-identifier">after_update_on_failure</span> +228: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000681" class="method-detail"> - <a name="M000681"></a> + <div id="method-M000728" class="method-detail"> + <a name="M000728"></a> <div class="method-heading"> - <a href="#M000681" class="method-signature"> + <a href="#M000728" class="method-signature"> <span class="method-name">after_update_on_failure</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000681-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000681-source"> + onclick="toggleCode('M000728-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000728-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 210</span> -210: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_update_on_failure</span> -211: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/edit&quot;</span> -212: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 216</span> +216: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_update_on_failure</span> +217: <span class="ruby-identifier">render</span> <span class="ruby-node">&quot;#{template_directory}/edit&quot;</span> +218: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000680" class="method-detail"> - <a name="M000680"></a> + <div id="method-M000727" class="method-detail"> + <a name="M000727"></a> <div class="method-heading"> - <a href="#M000680" class="method-signature"> + <a href="#M000727" class="method-signature"> <span class="method-name">after_update_on_success</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000680-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000680-source"> + onclick="toggleCode('M000727-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000727-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 205</span> -205: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_update_on_success</span> -206: <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:notice</span>] = <span class="ruby-node">&quot;#{content_type_name.titleize} '#{@block.name}' was updated&quot;</span> -207: <span class="ruby-identifier">redirect_to_first</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:_redirect_to</span>], <span class="ruby-identifier">block_path</span> -208: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 211</span> +211: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after_update_on_success</span> +212: <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:notice</span>] = <span class="ruby-node">&quot;#{content_type_name.titleize} '#{@block.name}' was updated&quot;</span> +213: <span class="ruby-identifier">redirect_to_first</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:_redirect_to</span>], <span class="ruby-identifier">block_path</span> +214: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000672" class="method-detail"> - <a name="M000672"></a> + <div id="method-M000719" class="method-detail"> + <a name="M000719"></a> <div class="method-heading"> - <a href="#M000672" class="method-signature"> + <a href="#M000719" class="method-signature"> <span class="method-name">block_form</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> This is the partial that will be used in the form </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000672-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000672-source"> + onclick="toggleCode('M000719-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000719-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 157</span> -157: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">block_form</span> -158: <span class="ruby-ivar">@content_type</span>.<span class="ruby-identifier">form</span> -159: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 162</span> +162: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">block_form</span> +163: <span class="ruby-ivar">@content_type</span>.<span class="ruby-identifier">form</span> +164: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000670" class="method-detail"> - <a name="M000670"></a> + <div id="method-M000717" class="method-detail"> + <a name="M000717"></a> <div class="method-heading"> - <a href="#M000670" class="method-signature"> + <a href="#M000717" class="method-signature"> <span class="method-name">block_path</span><span class="method-args">(action=nil)</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000670-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000670-source"> + onclick="toggleCode('M000717-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000717-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 147</span> -147: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">block_path</span>(<span class="ruby-identifier">action</span>=<span class="ruby-keyword kw">nil</span>) -148: <span class="ruby-identifier">path</span> = [<span class="ruby-identifier">:cms</span>, <span class="ruby-ivar">@block</span>] -149: <span class="ruby-identifier">action</span> <span class="ruby-value">? </span><span class="ruby-identifier">path</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">action</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">path</span> -150: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 152</span> +152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">block_path</span>(<span class="ruby-identifier">action</span>=<span class="ruby-keyword kw">nil</span>) +153: <span class="ruby-identifier">path</span> = [<span class="ruby-identifier">:cms</span>, <span class="ruby-ivar">@block</span>] +154: <span class="ruby-identifier">action</span> <span class="ruby-value">? </span><span class="ruby-identifier">path</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">action</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">path</span> +155: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000671" class="method-detail"> - <a name="M000671"></a> + <div id="method-M000718" class="method-detail"> + <a name="M000718"></a> <div class="method-heading"> - <a href="#M000671" class="method-signature"> + <a href="#M000718" class="method-signature"> <span class="method-name">blocks_path</span><span class="method-args">(options={})</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000671-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000671-source"> + onclick="toggleCode('M000718-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000718-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 152</span> -152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">blocks_path</span>(<span class="ruby-identifier">options</span>={}) -153: <span class="ruby-identifier">cms_index_url_for</span>(<span class="ruby-ivar">@block</span>, <span class="ruby-identifier">options</span>) -154: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 157</span> +157: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">blocks_path</span>(<span class="ruby-identifier">options</span>={}) +158: <span class="ruby-identifier">cms_index_url_for</span>(<span class="ruby-ivar">@block</span>, <span class="ruby-identifier">options</span>) +159: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000673" class="method-detail"> - <a name="M000673"></a> + <div id="method-M000720" class="method-detail"> + <a name="M000720"></a> <div class="method-heading"> - <a href="#M000673" class="method-signature"> + <a href="#M000720" class="method-signature"> <span class="method-name">build_block</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> -<a href="ContentBlockController.html#M000652">new</a> related methods +<a href="ContentBlockController.html#M000699">new</a> related methods </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000673-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000673-source"> + onclick="toggleCode('M000720-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000720-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 163</span> -163: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_block</span> -164: <span class="ruby-ivar">@block</span> = <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">model_name</span>]) -165: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 168</span> +168: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_block</span> +169: <span class="ruby-ivar">@block</span> = <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">model_name</span>]) +170: <span class="ruby-identifier">check_permissions</span> +171: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000663" class="method-detail"> - <a name="M000663"></a> + <div id="method-M000733" class="method-detail"> + <a name="M000733"></a> <div class="method-heading"> - <a href="#M000663" class="method-signature"> + <a href="#M000733" class="method-signature"> + <span class="method-name">check_permissions</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + <p> +Use a &quot;whitelist&quot; approach to access to avoid mistakes By default +everyone can <a href="ContentBlockController.html#M000700">create</a> <a +href="ContentBlockController.html#M000699">new</a> block and view them and +their properties, but blocks can only be modified based on the permissions +of the pages they are connected to. +</p> + <p><a class="source-toggle" href="#" + onclick="toggleCode('M000733-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000733-source"> +<pre> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 258</span> +258: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">check_permissions</span> +259: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">action_name</span> +260: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;index&quot;</span>, <span class="ruby-value str">&quot;show&quot;</span>, <span class="ruby-value str">&quot;new&quot;</span>, <span class="ruby-value str">&quot;create&quot;</span>, <span class="ruby-value str">&quot;version&quot;</span>, <span class="ruby-value str">&quot;versions&quot;</span>, <span class="ruby-value str">&quot;usages&quot;</span> +261: <span class="ruby-comment cmt"># Allow</span> +262: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;edit&quot;</span>, <span class="ruby-value str">&quot;update&quot;</span> +263: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Cms</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessDenied</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">able_to_edit?</span>(<span class="ruby-ivar">@block</span>) +264: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;destroy&quot;</span>, <span class="ruby-value str">&quot;publish&quot;</span>, <span class="ruby-value str">&quot;revert_to&quot;</span> +265: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Cms</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessDenied</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">able_to_publish?</span>(<span class="ruby-ivar">@block</span>) +266: <span class="ruby-keyword kw">else</span> +267: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Cms</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessDenied</span> +268: <span class="ruby-keyword kw">end</span> +269: <span class="ruby-keyword kw">end</span> +</pre> + </div> + </div> + </div> + + <div id="method-M000710" class="method-detail"> + <a name="M000710"></a> + + <div class="method-heading"> + <a href="#M000710" class="method-signature"> <span class="method-name">content_type</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000663-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000663-source"> + onclick="toggleCode('M000710-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000710-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 105</span> -105: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type</span> -106: <span class="ruby-ivar">@content_type</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">ContentType</span>.<span class="ruby-identifier">find_by_key</span>(<span class="ruby-identifier">content_type_name</span>) -107: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 107</span> +107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type</span> +108: <span class="ruby-ivar">@content_type</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">ContentType</span>.<span class="ruby-identifier">find_by_key</span>(<span class="ruby-identifier">content_type_name</span>) +109: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000662" class="method-detail"> - <a name="M000662"></a> + <div id="method-M000709" class="method-detail"> + <a name="M000709"></a> <div class="method-heading"> - <a href="#M000662" class="method-signature"> + <a href="#M000709" class="method-signature"> <span class="method-name">content_type_name</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> methods that are used to detemine what content block type we are dealing with </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000662-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000662-source"> + onclick="toggleCode('M000709-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000709-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 101</span> -101: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type_name</span> -102: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/Controller/</span>,<span class="ruby-value str">''</span>).<span class="ruby-identifier">demodulize</span>.<span class="ruby-identifier">singularize</span> -103: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 103</span> +103: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type_name</span> +104: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/Controller/</span>,<span class="ruby-value str">''</span>).<span class="ruby-identifier">demodulize</span>.<span class="ruby-identifier">singularize</span> +105: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000675" class="method-detail"> - <a name="M000675"></a> + <div id="method-M000722" class="method-detail"> + <a name="M000722"></a> <div class="method-heading"> - <a href="#M000675" class="method-signature"> + <a href="#M000722" class="method-signature"> <span class="method-name">create_block</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> -<a href="ContentBlockController.html#M000653">create</a> related methods +<a href="ContentBlockController.html#M000700">create</a> related methods </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000675-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000675-source"> + onclick="toggleCode('M000722-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000722-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 175</span> -175: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_block</span> -176: <span class="ruby-identifier">build_block</span> -177: <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">save</span> -178: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 181</span> +181: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_block</span> +182: <span class="ruby-identifier">build_block</span> +183: <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">save</span> +184: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000687" class="method-detail"> - <a name="M000687"></a> + <div id="method-M000735" class="method-detail"> + <a name="M000735"></a> <div class="method-heading"> - <a href="#M000687" class="method-signature"> + <a href="#M000735" class="method-signature"> <span class="method-name">determine_layout</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000687-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000687-source"> + onclick="toggleCode('M000735-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000735-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 254</span> -254: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">determine_layout</span> -255: <span class="ruby-value str">'cms/content_library'</span> -256: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 277</span> +277: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">determine_layout</span> +278: <span class="ruby-value str">'cms/content_library'</span> +279: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000684" class="method-detail"> - <a name="M000684"></a> + <div id="method-M000731" class="method-detail"> + <a name="M000731"></a> <div class="method-heading"> - <a href="#M000684" class="method-signature"> + <a href="#M000731" class="method-signature"> <span class="method-name">do_command</span><span class="method-args">(result) {|| ...}</span> </a> </div> <div class="method-description"> @@ -857,305 +900,308 @@ A &quot;command&quot; is when you want to perform an action on a content block You pass a ruby block to this method, this calls it and then sets a flash message based on success or failure </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000684-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000684-source"> + onclick="toggleCode('M000731-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000731-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 229</span> -229: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_command</span>(<span class="ruby-identifier">result</span>) -230: <span class="ruby-identifier">load_block</span> -231: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">yield</span> -232: <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:notice</span>] = <span class="ruby-node">&quot;#{content_type_name.titleize} '#{@block.name}' was #{result}&quot;</span> -233: <span class="ruby-keyword kw">else</span> -234: <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:error</span>] = <span class="ruby-node">&quot;#{content_type_name.titleize} '#{@block.name}' could not be #{result}&quot;</span> -235: <span class="ruby-keyword kw">end</span> -236: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 235</span> +235: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_command</span>(<span class="ruby-identifier">result</span>) +236: <span class="ruby-identifier">load_block</span> +237: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">yield</span> +238: <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:notice</span>] = <span class="ruby-node">&quot;#{content_type_name.titleize} '#{@block.name}' was #{result}&quot;</span> +239: <span class="ruby-keyword kw">else</span> +240: <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:error</span>] = <span class="ruby-node">&quot;#{content_type_name.titleize} '#{@block.name}' could not be #{result}&quot;</span> +241: <span class="ruby-keyword kw">end</span> +242: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000667" class="method-detail"> - <a name="M000667"></a> + <div id="method-M000714" class="method-detail"> + <a name="M000714"></a> <div class="method-heading"> - <a href="#M000667" class="method-signature"> + <a href="#M000714" class="method-signature"> <span class="method-name">load_block</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000667-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000667-source"> + onclick="toggleCode('M000714-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000714-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 132</span> -132: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_block</span> -133: <span class="ruby-ivar">@block</span> = <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>]) -134: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 135</span> +135: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_block</span> +136: <span class="ruby-ivar">@block</span> = <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>]) +137: <span class="ruby-identifier">check_permissions</span> +138: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000668" class="method-detail"> - <a name="M000668"></a> + <div id="method-M000715" class="method-detail"> + <a name="M000715"></a> <div class="method-heading"> - <a href="#M000668" class="method-signature"> + <a href="#M000715" class="method-signature"> <span class="method-name">load_block_draft</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000668-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000668-source"> + onclick="toggleCode('M000715-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000715-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 136</span> -136: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_block_draft</span> -137: <span class="ruby-identifier">load_block</span> -138: <span class="ruby-ivar">@block</span> = <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">as_of_draft_version</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">versioned?</span> -139: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 140</span> +140: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_block_draft</span> +141: <span class="ruby-ivar">@block</span> = <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>]) +142: <span class="ruby-ivar">@block</span> = <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">as_of_draft_version</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">versioned?</span> +143: <span class="ruby-identifier">check_permissions</span> +144: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000666" class="method-detail"> - <a name="M000666"></a> + <div id="method-M000713" class="method-detail"> + <a name="M000713"></a> <div class="method-heading"> - <a href="#M000666" class="method-signature"> + <a href="#M000713" class="method-signature"> <span class="method-name">load_blocks</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> methods for loading one or a collection of blocks </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000666-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000666-source"> + onclick="toggleCode('M000713-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000713-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 119</span> -119: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_blocks</span> -120: <span class="ruby-identifier">options</span> = {} -121: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:section_id</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:section_id</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'all'</span> -122: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:include</span>] = { <span class="ruby-identifier">:attachment</span> =<span class="ruby-operator">&gt;</span> { <span class="ruby-identifier">:section_node</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:section</span> }} -123: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:conditions</span>] = [<span class="ruby-value str">&quot;sections.id = ?&quot;</span>, <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:section_id</span>]] -124: <span class="ruby-keyword kw">end</span> -125: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:page</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:page</span>] -126: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:order</span>] = <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">default_order</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:default_order</span>) -127: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:order</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:order</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:order</span>].<span class="ruby-identifier">blank?</span> -128: <span class="ruby-identifier">scope</span> = <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:list</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">list</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">model_class</span> -129: <span class="ruby-ivar">@blocks</span> = <span class="ruby-identifier">scope</span>.<span class="ruby-identifier">searchable?</span> <span class="ruby-value">? </span><span class="ruby-identifier">scope</span>.<span class="ruby-identifier">search</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:search</span>]).<span class="ruby-identifier">paginate</span>(<span class="ruby-identifier">options</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">scope</span>.<span class="ruby-identifier">paginate</span>(<span class="ruby-identifier">options</span>) -130: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 121</span> +121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_blocks</span> +122: <span class="ruby-identifier">options</span> = {} +123: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:section_id</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:section_id</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'all'</span> +124: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:include</span>] = { <span class="ruby-identifier">:attachment</span> =<span class="ruby-operator">&gt;</span> { <span class="ruby-identifier">:section_node</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:section</span> }} +125: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:conditions</span>] = [<span class="ruby-value str">&quot;sections.id = ?&quot;</span>, <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:section_id</span>]] +126: <span class="ruby-keyword kw">end</span> +127: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:page</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:page</span>] +128: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:order</span>] = <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">default_order</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:default_order</span>) +129: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:order</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:order</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:order</span>].<span class="ruby-identifier">blank?</span> +130: <span class="ruby-identifier">scope</span> = <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:list</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">list</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">model_class</span> +131: <span class="ruby-ivar">@blocks</span> = <span class="ruby-identifier">scope</span>.<span class="ruby-identifier">searchable?</span> <span class="ruby-value">? </span><span class="ruby-identifier">scope</span>.<span class="ruby-identifier">search</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:search</span>]).<span class="ruby-identifier">paginate</span>(<span class="ruby-identifier">options</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">scope</span>.<span class="ruby-identifier">paginate</span>(<span class="ruby-identifier">options</span>) +132: <span class="ruby-identifier">check_permissions</span> +133: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000664" class="method-detail"> - <a name="M000664"></a> + <div id="method-M000711" class="method-detail"> + <a name="M000711"></a> <div class="method-heading"> - <a href="#M000664" class="method-signature"> + <a href="#M000711" class="method-signature"> <span class="method-name">model_class</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000664-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000664-source"> + onclick="toggleCode('M000711-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000711-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 109</span> -109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">model_class</span> -110: <span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">model_class</span> -111: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 111</span> +111: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">model_class</span> +112: <span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">model_class</span> +113: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000665" class="method-detail"> - <a name="M000665"></a> + <div id="method-M000712" class="method-detail"> + <a name="M000712"></a> <div class="method-heading"> - <a href="#M000665" class="method-signature"> + <a href="#M000712" class="method-signature"> <span class="method-name">model_name</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000665-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000665-source"> + onclick="toggleCode('M000712-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000712-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 113</span> -113: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">model_name</span> -114: <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">underscore</span>.<span class="ruby-identifier">to_sym</span> -115: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 115</span> +115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">model_name</span> +116: <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">underscore</span>.<span class="ruby-identifier">to_sym</span> +117: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000669" class="method-detail"> - <a name="M000669"></a> + <div id="method-M000716" class="method-detail"> + <a name="M000716"></a> <div class="method-heading"> - <a href="#M000669" class="method-signature"> + <a href="#M000716" class="method-signature"> <span class="method-name">new_block_path</span><span class="method-args">(options={})</span> </a> </div> <div class="method-description"> <p> path related methods - available in the view as helpers </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000669-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000669-source"> + onclick="toggleCode('M000716-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000716-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 143</span> -143: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_block_path</span>(<span class="ruby-identifier">options</span>={}) -144: <span class="ruby-identifier">cms_new_url_for</span>(<span class="ruby-ivar">@block</span>, <span class="ruby-identifier">options</span>) -145: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 148</span> +148: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_block_path</span>(<span class="ruby-identifier">options</span>={}) +149: <span class="ruby-identifier">cms_new_url_for</span>(<span class="ruby-ivar">@block</span>, <span class="ruby-identifier">options</span>) +150: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000685" class="method-detail"> - <a name="M000685"></a> + <div id="method-M000732" class="method-detail"> + <a name="M000732"></a> <div class="method-heading"> - <a href="#M000685" class="method-signature"> + <a href="#M000732" class="method-signature"> <span class="method-name">revert_block</span><span class="method-args">(to_version)</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000685-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000685-source"> + onclick="toggleCode('M000732-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000732-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 238</span> -238: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revert_block</span>(<span class="ruby-identifier">to_version</span>) -239: <span class="ruby-keyword kw">begin</span> -240: <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">revert_to</span>(<span class="ruby-identifier">to_version</span>) -241: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@exception</span> -242: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Could not revert #{@block.inspect} to version #{to_version}&quot;</span> -243: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;#{@exception.message}\n:#{@exception.backtrace.join(&quot;\n&quot;)}&quot;</span> -244: <span class="ruby-keyword kw">false</span> -245: <span class="ruby-keyword kw">end</span> -246: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 244</span> +244: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revert_block</span>(<span class="ruby-identifier">to_version</span>) +245: <span class="ruby-keyword kw">begin</span> +246: <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">revert_to</span>(<span class="ruby-identifier">to_version</span>) +247: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@exception</span> +248: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Could not revert #{@block.inspect} to version #{to_version}&quot;</span> +249: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;#{@exception.message}\n:#{@exception.backtrace.join(&quot;\n&quot;)}&quot;</span> +250: <span class="ruby-keyword kw">false</span> +251: <span class="ruby-keyword kw">end</span> +252: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000674" class="method-detail"> - <a name="M000674"></a> + <div id="method-M000721" class="method-detail"> + <a name="M000721"></a> <div class="method-heading"> - <a href="#M000674" class="method-signature"> + <a href="#M000721" class="method-signature"> <span class="method-name">set_default_category</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000674-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000674-source"> + onclick="toggleCode('M000721-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000721-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 167</span> -167: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_default_category</span> -168: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@last_block</span> = <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">last</span> -169: <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">category</span> = <span class="ruby-ivar">@last_block</span>.<span class="ruby-identifier">category</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:category=</span>) -170: <span class="ruby-keyword kw">end</span> -171: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 173</span> +173: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_default_category</span> +174: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@last_block</span> = <span class="ruby-identifier">model_class</span>.<span class="ruby-identifier">last</span> +175: <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">category</span> = <span class="ruby-ivar">@last_block</span>.<span class="ruby-identifier">category</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:category=</span>) +176: <span class="ruby-keyword kw">end</span> +177: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000686" class="method-detail"> - <a name="M000686"></a> + <div id="method-M000734" class="method-detail"> + <a name="M000734"></a> <div class="method-heading"> - <a href="#M000686" class="method-signature"> + <a href="#M000734" class="method-signature"> <span class="method-name">set_toolbar_tab</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> methods to setup the view </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000686-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000686-source"> + onclick="toggleCode('M000734-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000734-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 250</span> -250: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_toolbar_tab</span> -251: <span class="ruby-ivar">@toolbar_tab</span> = <span class="ruby-identifier">:content_library</span> -252: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 273</span> +273: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_toolbar_tab</span> +274: <span class="ruby-ivar">@toolbar_tab</span> = <span class="ruby-identifier">:content_library</span> +275: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000688" class="method-detail"> - <a name="M000688"></a> + <div id="method-M000736" class="method-detail"> + <a name="M000736"></a> <div class="method-heading"> - <a href="#M000688" class="method-signature"> + <a href="#M000736" class="method-signature"> <span class="method-name">template_directory</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000688-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000688-source"> + onclick="toggleCode('M000736-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000736-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 258</span> -258: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">template_directory</span> -259: <span class="ruby-value str">&quot;cms/blocks&quot;</span> -260: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 281</span> +281: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">template_directory</span> +282: <span class="ruby-value str">&quot;cms/blocks&quot;</span> +283: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000679" class="method-detail"> - <a name="M000679"></a> + <div id="method-M000726" class="method-detail"> + <a name="M000726"></a> <div class="method-heading"> - <a href="#M000679" class="method-signature"> + <a href="#M000726" class="method-signature"> <span class="method-name">update_block</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> -<a href="ContentBlockController.html#M000655">update</a> related methods +<a href="ContentBlockController.html#M000702">update</a> related methods </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000679-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000679-source"> + onclick="toggleCode('M000726-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000726-source"> <pre> - <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 200</span> -200: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_block</span> -201: <span class="ruby-identifier">load_block</span> -202: <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">update_attributes</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">model_name</span>]) -203: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File app/controllers/cms/content_block_controller.rb, line 206</span> +206: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_block</span> +207: <span class="ruby-identifier">load_block</span> +208: <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">update_attributes</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">model_name</span>]) +209: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> \ No newline at end of file