Skip to content

Commit

Permalink
[#388 state:resolved] Updated to latest version of Config Assistant w…
Browse files Browse the repository at this point in the history
…hich improves cross Melody and MT compatibility.
  • Loading branch information
byrnereese authored and jayallen committed Oct 13, 2010
1 parent 5c1de5e commit f4ef495
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 51 deletions.
4 changes: 2 additions & 2 deletions addons/ConfigAssistant.plugin/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ key: ConfigAssistant
author_link: http://www.majordojo.com/
author_name: Byrne Reese
description: This plugin provides a simple YAML based framework for creating plugin and theme configuration options.
version: 2.0
static_version: 3
version: 2.0.1
static_version: 4
schema_version: 2

applications:
Expand Down
10 changes: 7 additions & 3 deletions addons/ConfigAssistant.plugin/lib/ConfigAssistant/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ sub entry_search_api_prep {
my ($terms, $args, $blog_id) = @_;

$terms->{blog_id} = $blog_id if $blog_id;
$terms->{status} = $app->query->param('status') if ($app->query->param('status'));
$terms->{status} = $app->param('status') if ($app->param('status'));

my $search_api = $app->registry("search_apis");
my $api = $search_api->{entry};
Expand Down Expand Up @@ -1310,12 +1310,16 @@ END_TMPL
<mt:setvarblock name="html_head" append="1">
<link rel="stylesheet" href="<mt:PluginStaticWebPath component="configassistant">css/app.css" type="text/css" />
<script src="<mt:StaticWebPath>jquery/jquery.js" type="text/javascript"></script>
<script src="<mt:PluginStaticWebPath component="configassistant">js/app.js" type="text/javascript"></script>
<script src="<mt:PluginStaticWebPath component="configassistant">js/options.js" type="text/javascript"></script>
</mt:setvarblock>
END_TMPL

# MT 4.34
# <form method="post" action="<mt:var name="script_url">" id="plugin-<mt:var name="plugin_id">-form">
# Melody
# <form method="post" action="<$mt:var name="script_url"$>" id="plugin-<$mt:var name="plugin_id" dirify="1"$>-form">
$$tmpl =~
s{(<form method="post" action="<mt:var name="script_url">" id="plugin-<mt:var name="plugin_id">-form">.*</form>)}{$slug1}msg;
s{(<form method="post" action="<\$?mt:var name="script_url"\$?>" id="plugin-<\$?mt:var name="plugin_id"( dirify="1"\$?)?>-form">.*</form>)}{$slug1}msg;
$$tmpl =~ s{^}{$slug2};
}

Expand Down
46 changes: 0 additions & 46 deletions addons/ConfigAssistant.plugin/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,49 +25,3 @@ $(document).ready( function() {
$('#content-nav ul li.'+changed).addClass('changed');
});
});
// Utility Functions
function handle_edit_click() {
var link = $(this).parent().find('a.link');
if (link.length > 0) {
$(this).parent().replaceWith( render_link_form( link.html(), link.attr('href') ) );
} else {
$(this).parent().before( render_link_form( '','' ) );
$(this).parent().hide();
}
return false;
};
function render_link(label,url) {
var dom = '<li class="pkg"><a class="link" href="'+url+'">'+label+'</a> <a class="remove" href="javascript:void(0);"><img src="'+StaticURI+'images/icon_close.png" /></a> <a class="edit" href="javascript:void(0);">edit</a></li>';
var e = $(dom);
e.find('a.edit').click( handle_edit_click );
e.find('a.remove').click( handle_delete_click );
return e;
};
function handle_save_click() {
var label = $(this).parent().find('input[class=label]').val();
var url = $(this).parent().find('input[class=url]').val();
if (!label && !url) { return false; }
$(this).parents('ul').find('li.last').show();
$(this).parent().replaceWith( render_link(label,url) );
return false;
};
function handle_delete_click() {
$(this).parent().remove(); return false;
};
function render_link_form(label,url) {
var dom = '<li class="pkg"><label class="link-text">Label: <input type="text" class="label" value="'+(typeof label != 'undefined' ? label : '')+'" /></label><label class="link-url">URL: <input type="text" class="url" value="'+(typeof url != 'undefined' ? url : '')+'" /></label> <button>Save</button></li>';
var e = $(dom);
e.find('button').click( handle_save_click );
e.find('input.url').focus( function() {
$(this).bind('keypress', function(event) {
if (event.keyCode == 13) {
event.stopPropagation();
e.find('button').trigger('click');
return false;
}
});
}).blur( function() {
$(this).unbind('keypress');
});
return e;
};
46 changes: 46 additions & 0 deletions addons/ConfigAssistant.plugin/static/js/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Utility Functions
function handle_edit_click() {
var link = $(this).parent().find('a.link');
if (link.length > 0) {
$(this).parent().replaceWith( render_link_form( link.html(), link.attr('href') ) );
} else {
$(this).parent().before( render_link_form( '','' ) );
$(this).parent().hide();
}
return false;
};
function render_link(label,url) {
var dom = '<li class="pkg"><a class="link" href="'+url+'">'+label+'</a> <a class="remove" href="javascript:void(0);"><img src="'+StaticURI+'images/icon_close.png" /></a> <a class="edit" href="javascript:void(0);">edit</a></li>';
var e = $(dom);
e.find('a.edit').click( handle_edit_click );
e.find('a.remove').click( handle_delete_click );
return e;
};
function handle_save_click() {
var label = $(this).parent().find('input[class=label]').val();
var url = $(this).parent().find('input[class=url]').val();
if (!label && !url) { return false; }
$(this).parents('ul').find('li.last').show();
$(this).parent().replaceWith( render_link(label,url) );
return false;
};
function handle_delete_click() {
$(this).parent().remove(); return false;
};
function render_link_form(label,url) {
var dom = '<li class="pkg"><label class="link-text">Label: <input type="text" class="label" value="'+(typeof label != 'undefined' ? label : '')+'" /></label><label class="link-url">URL: <input type="text" class="url" value="'+(typeof url != 'undefined' ? url : '')+'" /></label> <button>Save</button></li>';
var e = $(dom);
e.find('button').click( handle_save_click );
e.find('input.url').focus( function() {
$(this).bind('keypress', function(event) {
if (event.keyCode == 13) {
event.stopPropagation();
e.find('button').trigger('click');
return false;
}
});
}).blur( function() {
$(this).unbind('keypress');
});
return e;
};
1 change: 1 addition & 0 deletions addons/ConfigAssistant.plugin/tmpl/theme_options.mtml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<link rel="stylesheet" href="<$mt:PluginStaticWebPath component="configassistant"$>colorpicker/css/colorpicker.css" type="text/css" />
<script src="<$mt:StaticWebPath$>jquery/jquery.js" type="text/javascript"></script>
<script src="<$mt:PluginStaticWebPath component="configassistant"$>js/app.js" type="text/javascript"></script>
<script src="<$mt:PluginStaticWebPath component="configassistant"$>js/options.js" type="text/javascript"></script>
<script src="<$mt:PluginStaticWebPath component="configassistant"$>colorpicker/js/colorpicker.js" type="text/javascript"></script>
<script src="<$mt:PluginStaticWebPath component="configassistant"$>js/jquery.json-2.2.min.js" type="text/javascript"></script>
</mt:setvarblock>
Expand Down

0 comments on commit f4ef495

Please sign in to comment.