Skip to content

Commit

Permalink
Complete rewrite.
Browse files Browse the repository at this point in the history
  • Loading branch information
bradt committed Sep 11, 2013
1 parent 4e30fe1 commit e84936d
Show file tree
Hide file tree
Showing 48 changed files with 606 additions and 1,910 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mirror
.sass-cache
25 changes: 25 additions & 0 deletions assets/config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Require any additional compass plugins here.

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"
javascripts_dir = "js"

# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
output_style = :compressed

# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true

# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = false


# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
1 change: 1 addition & 0 deletions assets/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.as3cf-settings select.bucket{margin-bottom:5px;width:380px}
78 changes: 78 additions & 0 deletions assets/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
(function($) {

$(document).ready(function() {

$('.as3cf-settings').each(function() {
var $container = $(this);

$('select.bucket', $container).change(function() {
var $select = $(this);

if ($select.val() !== 'new') {
return;
}

var error_func = function(jqXHR, textStatus, errorThrown) {
alert(as3cf_i18n.create_bucket_error + errorThrown);
$select[0].selectedIndex = 0;
console.log( jqXHR );
console.log( textStatus );
console.log( errorThrown );
};

var success_func = function(data, textStatus, jqXHR) {
if (typeof data['success'] !== 'undefined') {
var opt = document.createElement('option');
opt.value = opt.innerHTML = bucket_name;
var inserted_at_position = 0;
$('option', $select).each(function() {
// For some reason, no error occurs when
// adding a bucket you've already added
if ($(this).val() == bucket_name) {
return false;
}
if ($(this).val() > bucket_name) {
$(opt).insertBefore($(this));
return false;
}
inserted_at_position = inserted_at_position + 1;
});
$select[0].selectedIndex = inserted_at_position;

// If they decided to create a new bucket before refreshing
// the page, we need another nonce
as3cf_i18n.create_bucket_nonce = data['_nonce'];
}
else {
alert(as3cf_i18n.create_bucket_error + data['error']);
$select[0].selectedIndex = 0;
}
};

var bucket_name = window.prompt(as3cf_i18n.create_bucket_prompt);
if (!bucket_name) {
$select[0].selectedIndex = 0;
return;
}

var data = {
action: 'as3cf-create-bucket',
bucket_name: bucket_name,
_nonce: as3cf_i18n.create_bucket_nonce
};

$.ajax({
url: ajaxurl,
type: 'POST',
dataType: 'JSON',
success: success_func,
error: error_func,
data: data
});
});

});

});

})(jQuery);
1 change: 1 addition & 0 deletions assets/js/script.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions assets/sass/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.as3cf-settings {
select.bucket {
margin-bottom: 5px;
width: 380px;
}
}
Loading

0 comments on commit e84936d

Please sign in to comment.