hallo_rails 0.1.3 → 0.1.5
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.
data/lib/hallo_rails/version.rb
CHANGED
@@ -1755,35 +1755,33 @@
|
|
1755
1755
|
dialog_html += "<div id='hallo_img_file_select_ui'></div>";
|
1756
1756
|
}
|
1757
1757
|
this.options.dialog = $("<div>").attr('id', "" + this.options.uuid + "-insert-image-dialog").html(dialog_html);
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
});
|
1786
|
-
}
|
1758
|
+
$buttonset = $("<span>").addClass(this.widgetName);
|
1759
|
+
$buttonHolder = $('<span>');
|
1760
|
+
$buttonHolder.hallobutton({
|
1761
|
+
label: this.options.button_label,
|
1762
|
+
icon: 'icon-picture',
|
1763
|
+
editable: this.options.editable,
|
1764
|
+
command: null,
|
1765
|
+
queryState: false,
|
1766
|
+
uuid: this.options.uuid,
|
1767
|
+
cssClass: this.options.buttonCssClass
|
1768
|
+
});
|
1769
|
+
$buttonset.append($buttonHolder);
|
1770
|
+
this.button = $buttonHolder;
|
1771
|
+
this.button.click(function() {
|
1772
|
+
if (widget.options.dialog.dialog("isOpen")) {
|
1773
|
+
widget._closeDialog();
|
1774
|
+
} else {
|
1775
|
+
widget.lastSelection = widget.options.editable.getSelection();
|
1776
|
+
widget._openDialog();
|
1777
|
+
}
|
1778
|
+
return false;
|
1779
|
+
});
|
1780
|
+
this.options.editable.element.on("halloselected, hallounselected", function() {
|
1781
|
+
if (widget.options.dialog.dialog("isOpen")) {
|
1782
|
+
return widget.lastSelection = widget.options.editable.getSelection();
|
1783
|
+
}
|
1784
|
+
});
|
1787
1785
|
this.options.editable.element.on("hallodeactivated", function() {
|
1788
1786
|
return widget._closeDialog();
|
1789
1787
|
});
|
@@ -1817,14 +1815,14 @@
|
|
1817
1815
|
this.options.dialog.dialog("open");
|
1818
1816
|
if (this.$image) {
|
1819
1817
|
this.options.dialog.dialog("option", "title", 'Image Properties');
|
1820
|
-
this._load_dialog_image_properties_ui();
|
1821
1818
|
$(document).keyup(function(e) {
|
1822
|
-
if (e.keyCode === 46) {
|
1819
|
+
if (e.keyCode === 46 || e.keyCode === 8) {
|
1823
1820
|
$(document).off();
|
1824
1821
|
widget._closeDialog();
|
1825
1822
|
widget.$image.remove();
|
1826
|
-
|
1823
|
+
widget.$image = null;
|
1827
1824
|
}
|
1825
|
+
return e.preventDefault();
|
1828
1826
|
});
|
1829
1827
|
this.options.editable.element.on("click", function() {
|
1830
1828
|
widget.$image = null;
|
@@ -1837,6 +1835,7 @@
|
|
1837
1835
|
$('#hallo_img_file_select_title').text('');
|
1838
1836
|
}
|
1839
1837
|
}
|
1838
|
+
this._load_dialog_image_properties_ui();
|
1840
1839
|
this.options.dialog.bind('dialogclose', function() {
|
1841
1840
|
var scrollbar_pos;
|
1842
1841
|
$('label', _this.button).removeClass('ui-state-active');
|
@@ -1857,17 +1856,20 @@
|
|
1857
1856
|
widget.$image.attr('src', new_source);
|
1858
1857
|
$('#hallo_img_source').val(new_source);
|
1859
1858
|
} else {
|
1860
|
-
widget.
|
1861
|
-
document.execCommand("insertImage", null, $(this).attr('src').replace(/-thumb/, ''));
|
1862
|
-
widget.options.editable.element.trigger('change');
|
1863
|
-
widget.options.editable.removeAllSelections();
|
1864
|
-
widget._closeDialog();
|
1859
|
+
widget._insert_image($(this).attr('src').replace(/-thumb/, ''));
|
1865
1860
|
}
|
1866
1861
|
return false;
|
1867
1862
|
});
|
1868
1863
|
return this._load_dialog_image_selection_ui();
|
1869
1864
|
}
|
1870
1865
|
},
|
1866
|
+
_insert_image: function(source) {
|
1867
|
+
this.options.editable.restoreSelection(this.lastSelection);
|
1868
|
+
document.execCommand("insertImage", null, source);
|
1869
|
+
this.options.editable.element.trigger('change');
|
1870
|
+
this.options.editable.removeAllSelections();
|
1871
|
+
return this._closeDialog();
|
1872
|
+
},
|
1871
1873
|
_closeDialog: function() {
|
1872
1874
|
return this.options.dialog.dialog("close");
|
1873
1875
|
},
|
@@ -1891,74 +1893,95 @@
|
|
1891
1893
|
var $img_properties, html, widget;
|
1892
1894
|
widget = this;
|
1893
1895
|
$img_properties = this.options.dialog.children('#hallo_img_properties');
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1896
|
+
if (this.$image) {
|
1897
|
+
html = this._property_input_html('source', this.$image.attr('src'), {
|
1898
|
+
label: 'Source'
|
1899
|
+
}) + this._property_input_html('alt', this.$image.attr('alt'), {
|
1900
|
+
label: 'Alt text'
|
1901
|
+
}) + this._property_row_html(this._property_input_html('width', (this.$image.is('[width]') ? this.$image.attr('width') : ''), {
|
1902
|
+
label: 'Width',
|
1903
|
+
row: false
|
1904
|
+
}) + this._property_input_html('height', (this.$image.is('[height]') ? this.$image.attr('height') : ''), {
|
1905
|
+
label: 'Height',
|
1906
|
+
row: false
|
1907
|
+
})) + this._property_input_html('padding', this.$image.css('padding'), {
|
1908
|
+
label: 'Padding'
|
1909
|
+
}) + this._property_row_html(this._property_cb_html('float_left', this.$image.css('float') === 'left', {
|
1910
|
+
label: 'left',
|
1911
|
+
row: false
|
1912
|
+
}) + this._property_cb_html('float_right', this.$image.css('float') === 'right', {
|
1913
|
+
label: 'right',
|
1914
|
+
row: false
|
1915
|
+
}) + this._property_cb_html('unfloat', this.$image.css('float') === 'none', {
|
1916
|
+
label: 'no',
|
1917
|
+
row: false
|
1918
|
+
}), 'Float');
|
1919
|
+
$img_properties.html(html);
|
1920
|
+
$img_properties.show();
|
1921
|
+
} else {
|
1922
|
+
if (!this.options.insert_file_dialog_ui_url) {
|
1923
|
+
$img_properties.html(this._property_input_html('source', '', {
|
1924
|
+
label: 'Source'
|
1925
|
+
}));
|
1926
|
+
$img_properties.show();
|
1927
|
+
}
|
1920
1928
|
}
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
$('#hallo_img_properties #hallo_img_alt').keyup(function() {
|
1925
|
-
return widget.$image.attr('alt', this.value);
|
1926
|
-
});
|
1927
|
-
$('#hallo_img_properties #hallo_img_padding').keyup(function() {
|
1928
|
-
return widget.$image.css('padding', this.value);
|
1929
|
-
});
|
1930
|
-
$('#hallo_img_properties #hallo_img_height').keyup(function() {
|
1931
|
-
widget.$image.css('height', this.value);
|
1932
|
-
return widget.$image.attr('height', this.value);
|
1933
|
-
});
|
1934
|
-
$('#hallo_img_properties #hallo_img_width').keyup(function() {
|
1935
|
-
widget.$image.css('width', this.value);
|
1936
|
-
return widget.$image.attr('width', this.value);
|
1937
|
-
});
|
1938
|
-
$('#hallo_img_properties #hallo_img_float_left').click(function() {
|
1939
|
-
if (!this.checked) {
|
1940
|
-
return false;
|
1929
|
+
if (this.$image) {
|
1930
|
+
if (!this.options.insert_file_dialog_ui_url) {
|
1931
|
+
$('#insert_image_btn').remove();
|
1941
1932
|
}
|
1942
|
-
|
1943
|
-
|
1944
|
-
return $('#hallo_img_properties #hallo_img_unfloat').removeAttr('checked');
|
1945
|
-
});
|
1946
|
-
$('#hallo_img_properties #hallo_img_float_right').click(function() {
|
1947
|
-
if (!this.checked) {
|
1948
|
-
return false;
|
1933
|
+
if ($('#hallo_img_file_select_title').length > 0) {
|
1934
|
+
$('#hallo_img_file_select_title').text('Change image:');
|
1949
1935
|
}
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1936
|
+
$('#hallo_img_properties #hallo_img_source').keyup(function() {
|
1937
|
+
return widget.$image.attr('src', this.value);
|
1938
|
+
});
|
1939
|
+
$('#hallo_img_properties #hallo_img_alt').keyup(function() {
|
1940
|
+
return widget.$image.attr('alt', this.value);
|
1941
|
+
});
|
1942
|
+
$('#hallo_img_properties #hallo_img_padding').keyup(function() {
|
1943
|
+
return widget.$image.css('padding', this.value);
|
1944
|
+
});
|
1945
|
+
$('#hallo_img_properties #hallo_img_height').keyup(function() {
|
1946
|
+
widget.$image.css('height', this.value);
|
1947
|
+
return widget.$image.attr('height', this.value);
|
1948
|
+
});
|
1949
|
+
$('#hallo_img_properties #hallo_img_width').keyup(function() {
|
1950
|
+
widget.$image.css('width', this.value);
|
1951
|
+
return widget.$image.attr('width', this.value);
|
1952
|
+
});
|
1953
|
+
$('#hallo_img_properties #hallo_img_float_left').click(function() {
|
1954
|
+
if (!this.checked) {
|
1955
|
+
return false;
|
1956
|
+
}
|
1957
|
+
widget.$image.css('float', 'left');
|
1958
|
+
$('#hallo_img_properties #hallo_img_float_right').removeAttr('checked');
|
1959
|
+
return $('#hallo_img_properties #hallo_img_unfloat').removeAttr('checked');
|
1960
|
+
});
|
1961
|
+
$('#hallo_img_properties #hallo_img_float_right').click(function() {
|
1962
|
+
if (!this.checked) {
|
1963
|
+
return false;
|
1964
|
+
}
|
1965
|
+
widget.$image.css('float', 'right');
|
1966
|
+
$('#hallo_img_properties #hallo_img_unfloat').removeAttr('checked');
|
1967
|
+
return $('#hallo_img_properties #hallo_img_float_left').removeAttr('checked');
|
1968
|
+
});
|
1969
|
+
return $('#hallo_img_properties #hallo_img_unfloat').click(function() {
|
1970
|
+
if (!this.checked) {
|
1971
|
+
return false;
|
1972
|
+
}
|
1973
|
+
widget.$image.css('float', 'none');
|
1974
|
+
$('#hallo_img_properties #hallo_img_float_right').removeAttr('checked');
|
1975
|
+
return $('#hallo_img_properties #hallo_img_float_left').removeAttr('checked');
|
1976
|
+
});
|
1977
|
+
} else {
|
1978
|
+
if (!this.options.insert_file_dialog_ui_url) {
|
1979
|
+
$img_properties.after('<button id="insert_image_btn">Insert</button>');
|
1980
|
+
return $('#insert_image_btn').click(function() {
|
1981
|
+
return widget._insert_image($('#hallo_img_properties #hallo_img_source').val());
|
1982
|
+
});
|
1957
1983
|
}
|
1958
|
-
|
1959
|
-
$('#hallo_img_properties #hallo_img_float_right').removeAttr('checked');
|
1960
|
-
return $('#hallo_img_properties #hallo_img_float_left').removeAttr('checked');
|
1961
|
-
});
|
1984
|
+
}
|
1962
1985
|
},
|
1963
1986
|
_property_col_html: function(col_html) {
|
1964
1987
|
return "<div class='hallo_img_property_col'>" + col_html + "</div>";
|
@@ -2517,8 +2540,9 @@
|
|
2517
2540
|
return;
|
2518
2541
|
}
|
2519
2542
|
_this._updatePosition(position, data.selection);
|
2520
|
-
if (_this.toolbar.html()
|
2543
|
+
if (_this.toolbar.html() !== '') {
|
2521
2544
|
return _this.toolbar.show();
|
2545
|
+
}
|
2522
2546
|
});
|
2523
2547
|
this.element.bind('hallounselected', function(event, data) {
|
2524
2548
|
return _this.toolbar.hide();
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hallo_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -60,7 +60,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
60
|
version: '0'
|
61
61
|
segments:
|
62
62
|
- 0
|
63
|
-
hash:
|
63
|
+
hash: 1432534018060092975
|
64
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
version: '0'
|
70
70
|
segments:
|
71
71
|
- 0
|
72
|
-
hash:
|
72
|
+
hash: 1432534018060092975
|
73
73
|
requirements: []
|
74
74
|
rubyforge_project:
|
75
75
|
rubygems_version: 1.8.24
|