Skip to content

Commit

Permalink
reordering works differently, now you select the parent page when edi…
Browse files Browse the repository at this point in the history
…ting a page and limited reordering is supported. Also some dialogues are now using jquery UI not thickbox. We'll move completely away from thickbox soon.
  • Loading branch information
parndt committed Feb 4, 2010
1 parent de6d523 commit e68a31c
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 24 deletions.
28 changes: 16 additions & 12 deletions public/javascripts/refinery/admin.js
Expand Up @@ -34,15 +34,18 @@ init_flash_messages = function(){
init_modal_dialogs = function(){
$('a[href*="dialog=true"]').each(function(i, anchor)
{
$.each(['modal=true', 'width=928', 'height=473', 'titlebar=true', 'draggable=true'], function(index, feature)
{
if (anchor.href.indexOf(feature.split('=')[0] + '=') == -1)
{
anchor.href += "&" + feature;
}
$(anchor).click(function(e){
iframe = $("<iframe id='dialog_iframe' src='" + $(this).attr('href') + "'></iframe>");
iframe.dialog({
title: $(anchor).attr('title') || $(anchor).attr('name') || $(anchor).html() || null,
modal: true,
resizable: false,
autoOpen: true,
width: (parseInt($(anchor.href.match("width=([0-9]*)")).last().get(0))||928),
height: (parseInt($(anchor.href.match("height=([0-9]*)")).last().get(0))||473)
});
e.preventDefault();
});

tb_init(anchor);
});
}

Expand Down Expand Up @@ -350,7 +353,7 @@ var page_options = {
// Wipe the title and increment the index counter by one.
$('#new_page_part_index').val(parseInt($('#new_page_part_index').val()) + 1);
$('#new_page_part_title').val('');

$('#page-tabs').tabs();
}
);
Expand Down Expand Up @@ -499,17 +502,18 @@ var list_reorder = {

list_reorder.sortable_list.find('li').each(function(index, li) {
if ($('ul', li).length) { return; }
$("<ul class='spacing'><li></li></ul>").appendTo(li);
$("<ul></ul>").appendTo(li);
});

list_reorder.sortable_list.add(list_reorder.sortable_list.find('ul')).sortable({
'connectWith':$(list_reorder.sortable_list, list_reorder.sortable_list.find('ul'))
'connectWith': $(list_reorder.sortable_list.find('ul'))
, 'tolerance': 'pointer'
, 'placeholder': 'placeholder'
, 'cursor': 'drag'
, 'items': 'li'
, 'axis': 'y'
});

$('#reorder_action').hide();
$('#reorder_action_done').show();
}
Expand Down
36 changes: 26 additions & 10 deletions public/stylesheets/refinery/refinery.css
Expand Up @@ -438,11 +438,11 @@ pre {

#content .ui-sortable {
margin: 0;
padding: 0;
padding: 12px 0px;
}

#content .ui-sortable li ul{
padding: 6px 10px 0px 40px !important;
padding: 6px 10px 12px 40px !important;
}

#content ul.ui-sortable li {
Expand All @@ -455,6 +455,9 @@ pre {
#content ul.ui-sortable li ul.empty {
display: block;
}
#content ul.ui-sortable li ul li.empty {
border: 0px none;
}
#content .ui-sortable .actions {
display: none !important;
}
Expand All @@ -463,15 +466,20 @@ pre {
border: 0px none;
}
#content .ui-sortable ul {
min-height: 30px;
min-height: 12px;
}
#content .ui-sortable li.placeholder {
opacity: 0.4;
border-width: 2px;
border-style: dashed;
height: 38px;
}

#content ul.ui-sortable li.ui-sortable-helper {
height: 38px !important;
}
#content ul.ui-sortable li.ui-sortable-helper ul {
display: none;
}
.ui-sortable-helper {
opacity: 0.7;
}
Expand Down Expand Up @@ -1137,14 +1145,14 @@ ul#plugins li {

.ui-widget-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
width: auto !important;
height: auto !important;
opacity: .75;
filter:Alpha(Opacity=75);
}
.ui-widget-overlay {
background: #000;
}

Expand Down Expand Up @@ -1201,4 +1209,12 @@ ul#plugins li {
color: #fff;
line-height: 33px;
margin-top: 0px;
}
.ui-dialog iframe {
clear:both;
border:none;
margin-bottom:-1px;
margin-top:1px;
_margin-bottom:1px;
width: 100% !important;
}
4 changes: 4 additions & 0 deletions vendor/plugins/pages/app/models/page.rb
Expand Up @@ -60,6 +60,10 @@ def destroy!
self.destroy
end

def indented_title
"#{"--" * self.ancestors.size} #{self.title}".chomp
end

# Used for the browser title to get the full path to this page
# It automatically prints out this page title and all of it's parent page titles joined by a PATH_SEPERATOR
def path(reverse = true)
Expand Down
4 changes: 4 additions & 0 deletions vendor/plugins/pages/app/views/admin/pages/_form.html.erb
Expand Up @@ -39,6 +39,10 @@
<a href="#" id="toggle_advanced_options" rel="Click to access meta tag settings and menu options">&raquo; Hide/Show Advanced Options</a>
</p>
<div id='more_options' style="display:none;">
<div class='field'>
<%= f.label :parent_id %>
<%= f.collection_select :parent_id, Page.find(:all, :order => "parent_id, position ASC"), :id, :indented_title, :include_blank => true %>
</div>
<div class='field'>
<%= label_tag :custom_title %>
<%= label_tag "", 'Type:', :class => "stripped" %>
Expand Down
Expand Up @@ -4,7 +4,7 @@
or
<%= render :partial => "/shared/admin/continue_editing", :locals => {:f => f} -%>
<% end -%>
<% unless (hide_cancel ||= false) -%>
<% unless (hide_cancel ||= from_dialog?) -%>
or
<%= link_to "Cancel", (cancel_url ||= send("admin_#{f.object.class.name.pluralize.underscore}_url")),
:title => (title ||= "Cancelling will lose all changes you've made to this #{f.object.class.name.underscore.gsub("_", " ")}"),
Expand Down
Expand Up @@ -7,7 +7,7 @@
<script type='text/javascript' src="http://www.google.com/jsapi"></script>
<script type='text/javascript'>
google.load("jquery", "1.4");
google.load("jqueryui", "1.7.2");
google.load("jqueryui", "1.8");
</script>
<% end %>
<%= javascript_include_tag('jquery.js', 'jquery-ui-1.8rc1.min.js', :cache => (use_caching ? "cache/libraries" : false)) if !using_google_libs or local_request? %>
Expand Down

0 comments on commit e68a31c

Please sign in to comment.