Module: JQueryCheats::HoverImage

Defined in:
lib/jquery_cheats.rb

Instance Method Summary collapse

Instance Method Details

#barchart(name, xmlurl) ⇒ Object



39
40
41
42
43
# File 'lib/jquery_cheats.rb', line 39

def barchart(name,xmlurl)
  #create a new barchar div tag, class of jqplot is used to simplify jquery binding
  html = "<div id=\"#{name}\" class=\"barchart\" data-xmlurl=\"#{xmlurl}\"></div>".html_safe
  #we will have to relly on XML to get the rest of the data...
end

#initializeObject



51
52
53
# File 'lib/jquery_cheats.rb', line 51

def initialize
 
end

#mouseoverimage(initimage, hoverimage) ⇒ Object

class << self



10
11
12
13
14
# File 'lib/jquery_cheats.rb', line 10

def mouseoverimage(initimage,hoverimage)
  cheats_image_tag =""
  cheats_image_tag = "<img src=\"#{initimage}\" alt=\"image\" onmouseover=\"$(this).attr('src','#{hoverimage}')\" onmouseout=\"$(this).attr('src','#{initimage}')\">"
  return cheats_image_tag.html_safe
end

#piechart(name, xmlurl) ⇒ Object



45
46
47
48
49
# File 'lib/jquery_cheats.rb', line 45

def piechart(name,xmlurl)
  #create a new barchar div tag, class of jqplot is used to simplify jquery binding
  html = "<div id=\"#{name}\" class=\"piechart\" data-xmlurl=\"#{xmlurl}\"></div>".html_safe
  #we will have to relly on XML to get the rest of the data...
end


31
32
33
34
35
36
37
# File 'lib/jquery_cheats.rb', line 31

def simplemolink(imagepath,link)
  hover_arry = imagepath.split('.')
  extension = hover_arry.pop
  newpath = hover_arry.join
  newlink = "<a href=\"#{link}\">#{self.mouseoverimage(imagepath,newpath+"-hover."+extension)}</a>".html_safe
  return newlink
end

#submitimage(imagepath, alt = "Image Tag") ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/jquery_cheats.rb', line 16

def submitimage(imagepath,alt="Image Tag")
     button_tag = "<a href=\"#\" onclick=\"$('form').submit(); return false;\">
      <img src=\"#{imagepath}\" alt=\"#{alt}\"></a>".html_safe
      button_tag += "<script type=\"text/javascript\">
      $(document).ready(function(){
      $('html').keypress(function(e){
        if(e.which == 13){
         $('form').submit();
          return false;
          }
         });
         });</script>".html_safe
     return button_tag
end