Skip to content

Commit

Permalink
updated page/edit actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Woodall committed Dec 30, 2012
1 parent 983b4b6 commit 810f64c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
13 changes: 10 additions & 3 deletions app/views/pages/_actions.html.haml
@@ -1,5 +1,12 @@
.navbar .navbar
.navbar-inner .navbar-inner
= link_to icon('file')+" Add New Page", new_admin_page_path, :id => "add_block", :class => 'btn' .pull-left
= link_to icon('th-list')+" List All Pages", admin_pages_path, :id => "add_block", :class => 'btn' = link_to icon('file')+" New Page", new_admin_page_path, :id => "add_block", :class => 'btn'
= link_to icon('edit')+" Edit This Page", edit_page_path(@page), :id => "add_block", :class => 'btn' = link_to icon('th-list')+" Pages", admin_pages_path, :id => "add_block", :class => 'btn'
= link_to icon('cog')+" Settings", edit_admin_page_path(@page), :id => "add_block", :class => 'btn'
%a.btn{ :id => "add_section", :role => "button", :"data-toggle" => "modal", :"href" => "#section-catalog"}= icon('plus')+" Add Section"
.pull-right
.btn-group{:"data-toggle" => "buttons-radio"}
%button.btn.active{ type: "button"}= icon("pencil")+" Edit"
%button.btn{ type: "button"}= icon("th")+" Organize"
%button.btn{ type: "button"}= icon("eye-open")+" Preview"
21 changes: 12 additions & 9 deletions app/views/pages/edit.html.haml
@@ -1,12 +1,6 @@
- title "Edit " + @page.title - title "Edit " + @page.title


.navbar = render :partial => "actions"
.navbar-inner
= link_to "Hide Controls", "#", :id => "toggle_editor", :class => 'btn'
= link_to icon('file')+" New Page", new_admin_page_path, :id => "add_block", :class => 'btn'
= link_to icon('th-list')+" Pages", admin_pages_path, :id => "add_block", :class => 'btn'
= link_to icon('cog')+" Settings", edit_admin_page_path(@page), :id => "add_block", :class => 'btn'
%a.btn{ :id => "add_section", :role => "button", :"data-toggle" => "modal", :"href" => "#section-catalog"}= icon('plus')+" Add Section"


#sections #sections
= render :partial => "admin/sections/section", :collection => @page.sections.asc(:position) = render :partial => "admin/sections/section", :collection => @page.sections.asc(:position)
Expand Down Expand Up @@ -66,7 +60,9 @@
:javascript :javascript
$(function() { $(function() {
$("#toggle_editor").click(function(){ $("#toggle_editor").click(function(){
if ($(this).text() == 'Show Controls') { if ($(this).hasClass('icon-eye-close')) {
$(this).removeClass('icon-eye-close');
$(this).addClass('icon-eye-open');
$('.block').addClass('editable'); $('.block').addClass('editable');
$(this).text('Hide Controls'); $(this).text('Hide Controls');
} else { } else {
Expand Down Expand Up @@ -102,7 +98,14 @@
$('#block_type').val( $(this).attr('data-block_type') ); $('#block_type').val( $(this).attr('data-block_type') );
}); });
}); });


function toggleVisibleIcon(control) {
if (control.hasClass('icon-eye-close')) {
control.removeClass('icon-eye-close').addClass('icon-eye-open');
} else {
control.removeClass('icon-eye-open').addClass('icon-eye-close');
}
}


function toggleEditor($button){ function toggleEditor($button){
var $block = $button.closest('.block'); var $block = $button.closest('.block');
Expand Down

0 comments on commit 810f64c

Please sign in to comment.