Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow enter key to submit link and image popups. Closes #4

  • Loading branch information...
commit bb439682701bba212ee295fb812deef42fbbfdc9 1 parent 1eb06c5
@jgarber authored
View
2  app/views/admin/pages/_image_popup.html.haml
@@ -36,6 +36,6 @@
.transform_title
%strong 2. Alternate text:
%input#alt_text{:type => "text", :size => "25", :name => "alt_text"}
- %button#image-popup-submit.submit{:type=>"button"} OK
+ %input#image-popup-submit.submit{:type=>"submit", :value => "OK"}
or
= link_to_function('Cancel', :class => 'close-link') {|page| page.hide 'image-popup' }
View
2  app/views/admin/pages/_link_popup.html.haml
@@ -50,6 +50,6 @@
.transform_title
%strong 2. Text to display:
%input#display_text{:type => "text", :size => "25", :name => "display_text"}
- %button#link-popup-submit.submit{:type => "button"} OK
+ %input#link-popup-submit.submit{:type => "submit", :value => "OK"}
or
= link_to_function('Cancel', :class => 'close-link') {|page| page.hide 'link-popup' }
View
9 public/javascripts/textile-editor-radiant.js
@@ -40,7 +40,6 @@ Popup.prototype = {
this.textArea = $(button).canvas;
this.popupElement = this.getPopupWindow();
this.form = this.popupElement.getElementsBySelector('form')[0];
- this.submit = this.popupElement.getElementsBySelector('button.submit')[0];
this.copyLabelFromAddress = true;
this.textSelection = this.getTextSelection();
@@ -52,7 +51,7 @@ Popup.prototype = {
this.initializeObservers();
// General observers
- Event.observe(this.submit, 'click', this.transform.bindAsEventListener(this));
+ Event.observe(this.form, 'submit', this.transform.bindAsEventListener(this));
this.popupElement.getElementsBySelector('.transform_choice input').each(function(item) {
Event.observe(item, 'click', this.switchTransformChoice.bindAsEventListener(this));
}.bind(this));
@@ -212,7 +211,8 @@ Object.extend(Object.extend(LinkPopup.prototype,Popup.prototype),{
}
},
- transform: function() {
+ transform: function(event) {
+ Event.stop(event);
displayText = $('display_text');
switch(this.transformationType()) {
case 'web':
@@ -314,7 +314,8 @@ Object.extend(Object.extend(ImagePopup.prototype,Popup.prototype), {
}
},
- transform: function() {
+ transform: function(event) {
+ Event.stop(event);
altText = $('alt_text').value;
switch(this.transformationType()) {
case 'web':
Please sign in to comment.
Something went wrong with that request. Please try again.