active_admin_pro 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ebfc0c84234ba5d727c8409f3a0e6b936b9a96b
|
4
|
+
data.tar.gz: b60b1ba8e7ffc83628f26544818fcb260d694e55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b7d82e2e40f13b3a8787842aa7fedb5e3eeef8361fc288701a30b26e8594671e96ce25fd47cc25d4d80d253b7778a6e3c69316b9b272450893c262379851770
|
7
|
+
data.tar.gz: 3ca8c3c20dd46838be4fbdba0afe4ea3797ca12323988f355889daafbfa7c5371a09b42cfb2d5a06eb740712b1029ac41eca28350761609168b7a1c4c2b55694
|
@@ -53,7 +53,6 @@
|
|
53
53
|
|
54
54
|
// Override the default image dialog with an Active Admin (jQuery UI) dialog
|
55
55
|
var pictureButton = wrapper.find('button[data-original-title="Picture"]');
|
56
|
-
pictureButton.unbind('click');
|
57
56
|
pictureButton.click(function(event) {
|
58
57
|
var dialogHtml = '<div id="summernote_image_dialog">';
|
59
58
|
dialogHtml += '<div class="input file">';
|
@@ -9,7 +9,7 @@ ActiveAdmin.application.tap do |config|
|
|
9
9
|
config.localize_format = :short
|
10
10
|
|
11
11
|
# Include Font Awesome in ActiveAdmin
|
12
|
-
config.register_stylesheet "//
|
12
|
+
config.register_stylesheet "//maxcdn.bootstrapcdn.com/font-awesome/#{ENV['FONT_AWESOME_VERSION'] || '4.5.0'}/css/font-awesome.min.css"
|
13
13
|
|
14
14
|
# Add Apple web application icons
|
15
15
|
base_url = "//s3.amazonaws.com/codelation.activeadmin/apple-touch-icon"
|
@@ -5447,8 +5447,7 @@
|
|
5447
5447
|
context.memo('button.picture', function () {
|
5448
5448
|
return ui.button({
|
5449
5449
|
contents: ui.icon(options.icons.picture),
|
5450
|
-
tooltip: lang.image.image
|
5451
|
-
click: context.createInvokeHandler('imageDialog.show')
|
5450
|
+
tooltip: lang.image.image
|
5452
5451
|
}).render();
|
5453
5452
|
});
|
5454
5453
|
|
@@ -5994,122 +5993,43 @@
|
|
5994
5993
|
};
|
5995
5994
|
};
|
5996
5995
|
|
5997
|
-
var
|
5998
|
-
var self = this;
|
5996
|
+
var ImagePopover = function (context) {
|
5999
5997
|
var ui = $.summernote.ui;
|
6000
5998
|
|
6001
|
-
var $editor = context.layoutInfo.editor;
|
6002
5999
|
var options = context.options;
|
6003
|
-
var lang = options.langInfo;
|
6004
|
-
|
6005
|
-
this.initialize = function () {
|
6006
|
-
var $container = options.dialogsInBody ? $(document.body) : $editor;
|
6007
|
-
|
6008
|
-
var imageLimitation = '';
|
6009
|
-
if (options.maximumImageFileSize) {
|
6010
|
-
var unit = Math.floor(Math.log(options.maximumImageFileSize) / Math.log(1024));
|
6011
|
-
var readableSize = (options.maximumImageFileSize / Math.pow(1024, unit)).toFixed(2) * 1 +
|
6012
|
-
' ' + ' KMGTP'[unit] + 'B';
|
6013
|
-
imageLimitation = '<small>' + lang.image.maximumFileSize + ' : ' + readableSize + '</small>';
|
6014
|
-
}
|
6015
|
-
|
6016
|
-
var body = '<div class="form-group note-group-select-from-files">' +
|
6017
|
-
'<label>' + lang.image.selectFromFiles + '</label>' +
|
6018
|
-
'<input class="note-image-input form-control" type="file" name="files" accept="image/*" multiple="multiple" />' +
|
6019
|
-
imageLimitation +
|
6020
|
-
'</div>' +
|
6021
|
-
'<div class="form-group" style="overflow:auto;">' +
|
6022
|
-
'<label>' + lang.image.url + '</label>' +
|
6023
|
-
'<input class="note-image-url form-control col-md-12" type="text" />' +
|
6024
|
-
'</div>';
|
6025
|
-
var footer = '<button href="#" class="btn btn-primary note-image-btn disabled" disabled>' + lang.image.insert + '</button>';
|
6026
6000
|
|
6027
|
-
|
6028
|
-
|
6029
|
-
fade: options.dialogsFade,
|
6030
|
-
body: body,
|
6031
|
-
footer: footer
|
6032
|
-
}).render().appendTo($container);
|
6001
|
+
this.shouldInitialize = function () {
|
6002
|
+
return !list.isEmpty(options.popover.image);
|
6033
6003
|
};
|
6034
6004
|
|
6035
|
-
this.
|
6036
|
-
ui.
|
6037
|
-
|
6038
|
-
|
6005
|
+
this.initialize = function () {
|
6006
|
+
this.$popover = ui.popover({
|
6007
|
+
className: 'note-image-popover'
|
6008
|
+
}).render().appendTo('body');
|
6009
|
+
var $content = this.$popover.find('.popover-content');
|
6039
6010
|
|
6040
|
-
|
6041
|
-
$input.on('keypress', function (event) {
|
6042
|
-
if (event.keyCode === key.code.ENTER) {
|
6043
|
-
$btn.trigger('click');
|
6044
|
-
}
|
6045
|
-
});
|
6011
|
+
context.invoke('buttons.build', $content, options.popover.image);
|
6046
6012
|
};
|
6047
6013
|
|
6048
|
-
this.
|
6049
|
-
|
6050
|
-
this.showImageDialog().then(function (data) {
|
6051
|
-
// [workaround] hide dialog before restore range for IE range focus
|
6052
|
-
ui.hideDialog(self.$dialog);
|
6053
|
-
context.invoke('editor.restoreRange');
|
6054
|
-
|
6055
|
-
if (typeof data === 'string') { // image url
|
6056
|
-
context.invoke('editor.insertImage', data);
|
6057
|
-
} else { // array of files
|
6058
|
-
context.invoke('editor.insertImagesOrCallback', data);
|
6059
|
-
}
|
6060
|
-
}).fail(function () {
|
6061
|
-
context.invoke('editor.restoreRange');
|
6062
|
-
});
|
6014
|
+
this.destroy = function () {
|
6015
|
+
this.$popover.remove();
|
6063
6016
|
};
|
6064
6017
|
|
6065
|
-
|
6066
|
-
|
6067
|
-
|
6068
|
-
|
6069
|
-
|
6070
|
-
|
6071
|
-
|
6072
|
-
return $.Deferred(function (deferred) {
|
6073
|
-
var $imageInput = self.$dialog.find('.note-image-input'),
|
6074
|
-
$imageUrl = self.$dialog.find('.note-image-url'),
|
6075
|
-
$imageBtn = self.$dialog.find('.note-image-btn');
|
6076
|
-
|
6077
|
-
ui.onDialogShown(self.$dialog, function () {
|
6078
|
-
context.triggerEvent('dialog.shown');
|
6079
|
-
|
6080
|
-
// Cloning imageInput to clear element.
|
6081
|
-
$imageInput.replaceWith($imageInput.clone()
|
6082
|
-
.on('change', function () {
|
6083
|
-
deferred.resolve(this.files || this.value);
|
6084
|
-
})
|
6085
|
-
.val('')
|
6086
|
-
);
|
6087
|
-
|
6088
|
-
$imageBtn.click(function (event) {
|
6089
|
-
event.preventDefault();
|
6090
|
-
|
6091
|
-
deferred.resolve($imageUrl.val());
|
6092
|
-
});
|
6093
|
-
|
6094
|
-
$imageUrl.on('keyup paste', function () {
|
6095
|
-
var url = $imageUrl.val();
|
6096
|
-
ui.toggleBtn($imageBtn, url);
|
6097
|
-
}).val('').trigger('focus');
|
6098
|
-
self.bindEnterKey($imageUrl, $imageBtn);
|
6099
|
-
});
|
6100
|
-
|
6101
|
-
ui.onDialogHidden(self.$dialog, function () {
|
6102
|
-
$imageInput.off('change');
|
6103
|
-
$imageUrl.off('keyup paste keypress');
|
6104
|
-
$imageBtn.off('click');
|
6105
|
-
|
6106
|
-
if (deferred.state() === 'pending') {
|
6107
|
-
deferred.reject();
|
6108
|
-
}
|
6018
|
+
this.update = function (target) {
|
6019
|
+
if (dom.isImg(target)) {
|
6020
|
+
var pos = dom.posFromPlaceholder(target);
|
6021
|
+
this.$popover.css({
|
6022
|
+
display: 'block',
|
6023
|
+
left: pos.left,
|
6024
|
+
top: pos.top
|
6109
6025
|
});
|
6026
|
+
} else {
|
6027
|
+
this.hide();
|
6028
|
+
}
|
6029
|
+
};
|
6110
6030
|
|
6111
|
-
|
6112
|
-
|
6031
|
+
this.hide = function () {
|
6032
|
+
this.$popover.hide();
|
6113
6033
|
};
|
6114
6034
|
};
|
6115
6035
|
|
@@ -6687,8 +6607,7 @@
|
|
6687
6607
|
'toolbar': Toolbar,
|
6688
6608
|
'linkDialog': LinkDialog,
|
6689
6609
|
'linkPopover': LinkPopover,
|
6690
|
-
'
|
6691
|
-
// 'imagePopover': ImagePopover,
|
6610
|
+
'imagePopover': ImagePopover,
|
6692
6611
|
'videoDialog': VideoDialog,
|
6693
6612
|
'helpDialog': HelpDialog,
|
6694
6613
|
'airPopover': AirPopover
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_admin_pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Pattison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|