jquery_cheats 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -15,15 +15,15 @@ However, if you choose this version it may not work. For the github version use
15
15
 
16
16
  gem 'jquery_cheats',:git=>"git://github.com/plowdawg/jquery_cheats.git"
17
17
 
18
- ==USage VERSION >= 1.0.0
18
+ ==Usage VERSION >= 1.1.0
19
19
 
20
- As of version 1.0.0 a railtie was introduced loading methods directly into ActionView.
21
- This change makes it imposible to call it as it was previously called and use a more simpiler
22
- syntax just because it is much shorter. Version 1.0.0 still only has one method but now
23
- is called just by:
20
+ As of version 1.0.0 a railtie was introduced loading methods directly into ActionView
21
+ you can call the two methods now by:
24
22
 
25
23
  mouseoverimage("/path/to/image1.png","/path/to/image1-hover.png")
26
24
 
25
+ submitimage("/path/to/image","Alternate Text")
26
+
27
27
  ==Usage VERSION < 1.0.0
28
28
 
29
29
  As of the current version there is only one available method, future versions will
@@ -35,6 +35,4 @@ JQueryCheats::HoverImage.mouseoverimage("/path/to/image1.jpg","/path/to/hover/im
35
35
 
36
36
  ===Future Speculation
37
37
 
38
- In the future we plan on cutting the syntax down to possibly just:
39
-
40
- mouseoverimage("image1.jpg","image2.jpg)
38
+ Future move from .rdoc to .md
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{jquery_cheats}
5
- s.version = "1.0.0"
5
+ s.version = "1.2.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [%q{Travis Pessettto}]
data/lib/jquery_cheats.rb CHANGED
@@ -6,9 +6,32 @@ module JQueryCheats
6
6
  #class << self
7
7
 
8
8
  def mouseoverimage(initimage,hoverimage)
9
- @cheats_image_tag =""
10
- @cheats_image_tag = "<img src=\"#{initimage}\" alt=\"image\" onmouseover=\"$(this).attr('src','#{hoverimage}')\" onmouseout=\"$(this).attr('src','#{initimage}')\">"
11
- return @cheats_image_tag.html_safe
9
+ cheats_image_tag =""
10
+ cheats_image_tag = "<img src=\"#{initimage}\" alt=\"image\" onmouseover=\"$(this).attr('src','#{hoverimage}')\" onmouseout=\"$(this).attr('src','#{initimage}')\">"
11
+ return cheats_image_tag.html_safe
12
+ end
13
+
14
+ def submitimage(imagepath,alt="Image Tag")
15
+ button_tag = "<a href=\"#\" onclick=\"$('form').submit(); return false;\">
16
+ <img src=\"#{imagepath}\" alt=\"#{alt}\"></a>".html_safe
17
+ button_tag += "<script type=\"text/javascript\">
18
+ $(document).ready(function(){
19
+ $('html').keypress(function(e){
20
+ if(e.which == 13){
21
+ $('form').submit();
22
+ return false;
23
+ }
24
+ });
25
+ });</script>".html_safe
26
+ return button_tag
27
+ end
28
+
29
+ def simplemolink(imagepath,link)
30
+ hover_arry = imagepath.split('.')
31
+ extension = hover_arry.pop
32
+ newpath = hover_arry.join
33
+ newlink = "<a href=\"#{link}\">#{self.mouseoverimage(imagepath,newpath+"-hover."+extension)}</a>".html_safe
34
+ return newlink
12
35
  end
13
36
 
14
37
  def initialize()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery_cheats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: