Permalink
Browse files

move block and section catalogs to partial

  • Loading branch information...
1 parent 810f64c commit 47003c59b488e65c50dafe0e96919ccd613a82f4 @game7 committed Dec 30, 2012
View
20 app/views/pages/_block_catalog.html.haml
@@ -0,0 +1,20 @@
+#block-catalog.modal.hide.fade{ :role => "dialog"}
+ .modal-header
+ %button.close{ :"data-dismiss" => 'modal', :"aria-hidden" => 'true' }!= "×"
+ %h3 Add Block
+ .modal-body
+ = form_for [@page, Block.new], :html => { :id => 'new_block' }, :remote => true do |f|
+ %input{ :type => :hidden, :id => :block_type, :name => :block_type }
+ %input{ :type => :hidden, :id => :page_id, :name => :page_id, :value => @page.id }
+ %input{ :type => :hidden, :id => :section_id, :name => :section_id }
+ %input{ :type => :hidden, :id => :column, :name => :column }
+ - t('blocks').each do |block|
+ %div{ :style => "border-bottom: 1px solid #dedede;"}
+ %div.pull-left{ :style => ""}
+ %button.btn.add_block{ :type => :submit, :"data-block_type" => block[0], :style => "margin-top: 5px;" }= icon('plus')+" Add"
+ %div.pull-left{ :style => "margin-left: 10px"}
+ %strong= block[1][:name]
+ %br
+ =block[1][:description]
+ .clear
+ .modal-footer
View
16 app/views/pages/_section_catalog.html.haml
@@ -0,0 +1,16 @@
+#section-catalog.modal.hide.fade{ :role => "dialog"}
+ .modal-header
+ %button.close{ :"data-dismiss" => 'modal', :"aria-hidden" => 'true' }!= "×"
+ %h3 Add Section
+ .modal-body
+ - Section.patterns.each do |pattern|
+ %div{ :style => "border-bottom: 1px solid #dedede;"}
+ %div.pull-left{ :style => ""}
+ = link_to icon('plus')+" Add", admin_page_sections_path(@page.id, :pattern => pattern), :method => :post, :remote => true, :class => 'btn', :style => "margin-top: 2px; margin-bottom: 2px;"
+ %div.pull-left{ :style => "margin-left: 10px"}
+ %table{ :"cell-spacing" => 4, :border => 4, :width => "400"}
+ %tr
+ - pattern.split("|").each do |col|
+ %td{ :width => "#{col}%", :align => "center" }= "#{col}"
+ .clear
+ .modal-footer
View
41 app/views/pages/edit.html.haml
@@ -7,43 +7,10 @@
#dialog-modal
-#block-catalog.modal.hide.fade{ :role => "dialog"}
- .modal-header
- %button.close{ :"data-dismiss" => 'modal', :"aria-hidden" => 'true' }!= "×"
- %h3 Add Block
- .modal-body
- = form_for [@page, Block.new], :html => { :id => 'new_block' }, :remote => true do |f|
- %input{ :type => :hidden, :id => :block_type, :name => :block_type }
- %input{ :type => :hidden, :id => :page_id, :name => :page_id, :value => @page.id }
- %input{ :type => :hidden, :id => :section_id, :name => :section_id }
- %input{ :type => :hidden, :id => :column, :name => :column }
- - t('blocks').each do |block|
- %div{ :style => "border-bottom: 1px solid #dedede;"}
- %div.pull-left{ :style => ""}
- %button.btn.add_block{ :type => :submit, :"data-block_type" => block[0], :style => "margin-top: 5px;" }= icon('plus')+" Add"
- %div.pull-left{ :style => "margin-left: 10px"}
- %strong= block[1][:name]
- %br
- =block[1][:description]
- .clear
- .modal-footer
-
-#section-catalog.modal.hide.fade{ :role => "dialog"}
- .modal-header
- %button.close{ :"data-dismiss" => 'modal', :"aria-hidden" => 'true' }!= "×"
- %h3 Add Section
- .modal-body
- - Section.patterns.each do |pattern|
- %div{ :style => "border-bottom: 1px solid #dedede;"}
- %div.pull-left{ :style => ""}
- = link_to icon('plus')+" Add", admin_page_sections_path(@page.id, :pattern => pattern), :method => :post, :remote => true, :class => 'btn', :style => "margin-top: 2px; margin-bottom: 2px;"
- %div.pull-left{ :style => "margin-left: 10px"}
- %table{ :"cell-spacing" => 4, :border => 4, :width => "400"}
- %tr
- - pattern.split("|").each do |col|
- %td{ :width => "#{col}%", :align => "center" }= "#{col}"
- .clear
- .modal-footer
+= render :partial => "block_catalog"
+
+= render :partial => "section_catalog"
+
:css
.blocks .block:first-child .move_up {

0 comments on commit 47003c5

Please sign in to comment.