hallo_rails 0.1.6 → 0.1.7

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.
@@ -1,3 +1,3 @@
1
1
  module HalloRails
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -859,7 +859,8 @@
859
859
  this.options.dialog.children('.html_source').val(html);
860
860
  this.options.dialog.prepend($("<button>" + this.texts.update + "</button>"));
861
861
  return this.options.dialog.on('click', 'button', function() {
862
- widget.options.editable.element.html(widget.options.dialog.children('.html_source').val());
862
+ html = widget.options.dialog.children('.html_source').val();
863
+ widget.options.editable.element.html(html);
863
864
  widget.options.editable.element.trigger('change');
864
865
  return false;
865
866
  });
@@ -1655,7 +1656,8 @@
1655
1656
  editableEl = jQuery(this.options.editable.element);
1656
1657
  toolbarEl = jQuery(this.options.toolbar);
1657
1658
  xposition = editableEl.offset().left + editableEl.outerWidth() - 3;
1658
- yposition = toolbarEl.offset().top - jQuery(document).scrollTop() - 29;
1659
+ yposition = toolbarEl.offset().top + toolbarEl.outerHeight() + 29;
1660
+ yposition -= jQuery(document).scrollTop();
1659
1661
  this.options.dialog.dialog("option", "position", [xposition, yposition]);
1660
1662
  cleanUp();
1661
1663
  widget.options.loaded = 1;
@@ -1774,7 +1776,7 @@
1774
1776
  },
1775
1777
  de: {
1776
1778
  title_insert: 'Bild einfügen',
1777
- title_properties: 'Bild Eigenschaften',
1779
+ title_properties: 'Bildeigenschaften',
1778
1780
  insert: 'Einfügen',
1779
1781
  chage_image: 'Bild ändern:',
1780
1782
  source: 'URL',
@@ -1836,7 +1838,9 @@
1836
1838
  return false;
1837
1839
  });
1838
1840
  this.options.editable.element.on('halloselected', function(event, data) {
1839
- if (widget.options.editable.options.toolbar === "halloToolbarContextual" && $(data.originalEvent.target).is('img')) {
1841
+ var toolbar_option;
1842
+ toolbar_option = widget.options.editable.options.toolbar;
1843
+ if (toolbar_option === "halloToolbarContextual" && $(data.originalEvent.target).is('img')) {
1840
1844
  $toolbar.hide();
1841
1845
  return false;
1842
1846
  }
@@ -1925,9 +1929,14 @@
1925
1929
  return $.ajax({
1926
1930
  url: this.options.insert_file_dialog_ui_url,
1927
1931
  success: function(data, textStatus, jqXHR) {
1928
- var file_select_title;
1929
- file_select_title = widget.options.dialog.children('#hallo_img_properties').is(':visible') ? widget.texts.change_image : '';
1930
- widget.options.dialog.children('#hallo_img_file_select_ui').html(("<div id='hallo_img_file_select_title'>" + file_select_title + "</div>") + data);
1932
+ var $properties, file_select_title, t;
1933
+ file_select_title = '';
1934
+ $properties = widget.options.dialog.children('#hallo_img_properties');
1935
+ if ($properties.is(':visible')) {
1936
+ file_select_title = widget.texts.change_image;
1937
+ }
1938
+ t = "<div id='hallo_img_file_select_title'>" + file_select_title + "</div>";
1939
+ widget.options.dialog.children('#hallo_img_file_select_ui').html(t + data);
1931
1940
  return widget.dialog_image_selection_ui_loaded = true;
1932
1941
  },
1933
1942
  beforeSend: function() {
@@ -1936,18 +1945,20 @@
1936
1945
  });
1937
1946
  },
1938
1947
  _load_dialog_image_properties_ui: function() {
1939
- var $img_properties, html, widget;
1948
+ var $img_properties, button, height, html, widget, width;
1940
1949
  widget = this;
1941
1950
  $img_properties = this.options.dialog.children('#hallo_img_properties');
1942
1951
  if (this.$image) {
1952
+ width = this.$image.is('[width]') ? this.$image.attr('width') : '';
1953
+ height = this.$image.is('[height]') ? this.$image.attr('height') : '';
1943
1954
  html = this._property_input_html('source', this.$image.attr('src'), {
1944
1955
  label: this.texts.source
1945
1956
  }) + this._property_input_html('alt', this.$image.attr('alt') || '', {
1946
1957
  label: this.texts.alt
1947
- }) + this._property_row_html(this._property_input_html('width', (this.$image.is('[width]') ? this.$image.attr('width') : ''), {
1958
+ }) + this._property_row_html(this._property_input_html('width', width, {
1948
1959
  label: this.texts.width,
1949
1960
  row: false
1950
- }) + this._property_input_html('height', (this.$image.is('[height]') ? this.$image.attr('height') : ''), {
1961
+ }) + this._property_input_html('height', height, {
1951
1962
  label: this.texts.height,
1952
1963
  row: false
1953
1964
  })) + this._property_input_html('padding', this.$image.css('padding'), {
@@ -2022,9 +2033,12 @@
2022
2033
  });
2023
2034
  } else {
2024
2035
  if (!this.options.insert_file_dialog_ui_url) {
2025
- $img_properties.after("<button id=\"insert_image_btn\">" + this.texts.insert + "</button>");
2036
+ button = "<button id=\"insert_image_btn\">" + this.texts.insert + "</button>";
2037
+ $img_properties.after(button);
2026
2038
  return $('#insert_image_btn').click(function() {
2027
- return widget._insert_image($('#hallo_img_properties #hallo_img_source').val());
2039
+ var $img_source;
2040
+ $img_source = $('#hallo_img_properties #hallo_img_source');
2041
+ return widget._insert_image($img_source.val());
2028
2042
  });
2029
2043
  }
2030
2044
  }
@@ -2036,32 +2050,41 @@
2036
2050
  if (label == null) {
2037
2051
  label = '';
2038
2052
  }
2039
- return "<div class='hallo_img_property_row'>" + (this._property_col_html(label) + this._property_col_html(row_html)) + "</div>";
2053
+ row_html = this._property_col_html(label) + this._property_col_html(row_html);
2054
+ return "<div class='hallo_img_property_row'>" + row_html + "</div>";
2040
2055
  },
2041
2056
  _property_html: function(property_html, options) {
2057
+ var entry;
2042
2058
  if (options == null) {
2043
2059
  options = {};
2044
2060
  }
2045
2061
  if (options.row === false) {
2046
2062
  if (options.label) {
2047
- property_html = "<span class='img_property_entry'>" + options.label + " " + property_html + "</span>";
2063
+ entry = "" + options.label + " " + property_html;
2064
+ property_html = "<span class='img_property_entry'>" + entry + "</span>";
2048
2065
  }
2049
2066
  return property_html;
2050
2067
  } else {
2051
- return this._property_row_html("<span class='img_property_entry'>" + property_html + "</span>", options.label);
2068
+ entry = "<span class='img_property_entry'>" + property_html + "</span>";
2069
+ return this._property_row_html(entry, options.label);
2052
2070
  }
2053
2071
  },
2054
2072
  _property_input_html: function(id, value, options) {
2073
+ var text_field;
2055
2074
  if (options == null) {
2056
2075
  options = {};
2057
2076
  }
2058
- return this._property_html("<input type='text' id='hallo_img_" + id + "' value='" + value + "'>", options);
2077
+ text_field = "<input type='text' id='hallo_img_" + id + "' value='" + value + "'>";
2078
+ return this._property_html(text_field, options);
2059
2079
  },
2060
2080
  _property_cb_html: function(id, checked, options) {
2081
+ var cb, checked_attr;
2061
2082
  if (options == null) {
2062
2083
  options = {};
2063
2084
  }
2064
- return this._property_html("<input type='checkbox' id='hallo_img_" + id + "' " + (checked ? 'checked=checked' : '') + "'>", options);
2085
+ checked_attr = checked ? 'checked=checked' : '';
2086
+ cb = "<input type='checkbox' id='hallo_img_" + id + "' " + checked_attr + "'>";
2087
+ return this._property_html(cb, options);
2065
2088
  }
2066
2089
  });
2067
2090
 
@@ -2179,11 +2202,12 @@
2179
2202
  buttonCssClass: null
2180
2203
  },
2181
2204
  populateToolbar: function(toolbar) {
2182
- var buttonize, buttonset, dialog, dialogId, dialogSubmitCb, isEmptyLink, urlInput, widget,
2205
+ var butTitle, buttonize, buttonset, dialog, dialogId, dialogSubmitCb, isEmptyLink, urlInput, widget,
2183
2206
  _this = this;
2184
2207
  widget = this;
2185
2208
  dialogId = "" + this.options.uuid + "-dialog";
2186
- dialog = jQuery("<div id=\"" + dialogId + "\"> <form action=\"#\" method=\"post\" class=\"linkForm\"> <input class=\"url\" type=\"text\" name=\"url\" value=\"" + this.options.defaultUrl + "\" /> <input type=\"submit\" id=\"addlinkButton\" value=\"" + this.options.dialogOpts.buttonTitle + "\" /> </form></div>");
2209
+ butTitle = this.options.dialogOpts.buttonTitle;
2210
+ dialog = jQuery("<div id=\"" + dialogId + "\"> <form action=\"#\" method=\"post\" class=\"linkForm\"> <input class=\"url\" type=\"text\" name=\"url\" value=\"" + this.options.defaultUrl + "\" /> <input type=\"submit\" id=\"addlinkButton\" value=\"" + butTitle + "\"/> </form></div>");
2187
2211
  urlInput = jQuery('input[name=url]', dialog).focus(function(e) {
2188
2212
  return this.select();
2189
2213
  });
@@ -2210,7 +2234,7 @@
2210
2234
  }
2211
2235
  document.execCommand("unlink", null, "");
2212
2236
  } else {
2213
- if (!((new RegExp(/:\/\//)).test(link))) {
2237
+ if (!(/:\/\//.test(link)) && !(/^mailto:/.test(link))) {
2214
2238
  link = 'http://' + link;
2215
2239
  }
2216
2240
  if (widget.lastSelection.startContainer.parentNode.href === void 0) {
@@ -2567,11 +2591,19 @@
2567
2591
  toolbar_height_offset = this.toolbar.outerHeight() + 10;
2568
2592
  if (selection && !selection.collapsed && selection.nativeRange) {
2569
2593
  selectionRect = selection.nativeRange.getBoundingClientRect();
2570
- top_offset = this.options.positionAbove ? selectionRect.top - toolbar_height_offset : selectionRect.bottom + 10;
2594
+ if (this.options.positionAbove) {
2595
+ top_offset = selectionRect.top - toolbar_height_offset;
2596
+ } else {
2597
+ top_offset = selectionRect.bottom + 10;
2598
+ }
2571
2599
  top = $(window).scrollTop() + top_offset;
2572
2600
  left = $(window).scrollLeft() + selectionRect.left;
2573
2601
  } else {
2574
- top_offset = this.options.positionAbove ? -10 - toolbar_height_offset : 20;
2602
+ if (this.options.positionAbove) {
2603
+ top_offset = -10 - toolbar_height_offset;
2604
+ } else {
2605
+ top_offset = 20;
2606
+ }
2575
2607
  top = position.top + top_offset;
2576
2608
  left = position.left - this.toolbar.outerWidth() / 2 + 30;
2577
2609
  }
@@ -2870,7 +2902,7 @@
2870
2902
  var buttonEl, classes, id;
2871
2903
  id = "" + this.options.uuid + "-" + this.options.label;
2872
2904
  classes = ['ui-button', 'ui-widget', 'ui-state-default', 'ui-corner-all', 'ui-button-text-only'];
2873
- buttonEl = jQuery("<button id=\"" + id + "\" class=\"" + (classes.join(' ')) + "\" title=\"" + this.options.label + "\"> <span class=\"ui-button-text\"> <i class=\"" + this.options.icon + "\"></i> </span> </button>");
2905
+ buttonEl = jQuery("<button id=\"" + id + "\" class=\"" + (classes.join(' ')) + "\" title=\"" + this.options.label + "\"> <span class=\"ui-button-text\"><i class=\"" + this.options.icon + "\"></i></span> </button>");
2874
2906
  if (this.options.cssClass) {
2875
2907
  buttonEl.addClass(this.options.cssClass);
2876
2908
  }
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.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -60,7 +60,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  segments:
62
62
  - 0
63
- hash: 3054115558163806407
63
+ hash: -3110425116344916177
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: 3054115558163806407
72
+ hash: -3110425116344916177
73
73
  requirements: []
74
74
  rubyforge_project:
75
75
  rubygems_version: 1.8.24