Module: Mokio::Backend::JavascriptHelper

Defined in:
app/helpers/mokio/backend/javascript_helper.rb

Instance Method Summary collapse

Instance Method Details

#fancyboxObject



13
14
15
16
17
18
19
# File 'app/helpers/mokio/backend/javascript_helper.rb', line 13

def fancybox
  "<script>
    $(document).ready(function() {
      $(\"a.fancybox\").fancybox();
    });
  </script>".html_safe
end

#flash_message(message) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/helpers/mokio/backend/javascript_helper.rb', line 21

def flash_message(message)
  "<script>
    $(document.body).prepend(\"<div id=\\\"FlashInfo\\\">\" + 
        \"<div id=\\\"FlashMessage\\\">\" +
          \"<span class=\\\"icomoon-icon-warning-2 white\\\"></span>\" +
          \"#{message}\" + 
          \"<span class=\\\"icon12 icomoon-icon-cancel white infobtn\\\"></span>\" +
        \"</div>\" +
    \"</div>\");

      var $info = $('#FlashInfo');
      $info.hide();

    // hide with user action
    $('.infobtn').click(function(event) {
      $info.slideUp();
    });

    // hide after 10sec
    $info.slideDown(1500, function() {
      setTimeout(function() {
        $info.slideUp();
      }, 5000);
    });
  </script>".html_safe
end

#noticeObject



5
6
7
8
9
10
11
# File 'app/helpers/mokio/backend/javascript_helper.rb', line 5

def notice
  "<script>
    setTimeout(function(){
      $(\".alert-block\").fadeOut(\"slow\");
    },4000)
  </script>".html_safe
end