module C80Swiper
  module AppHelper

    def swipe(swslider_id=nil, effect='slide')

      swslider = swslider_id.nil? ?
          C80Swiper::Swslider.first :
          C80Swiper::Swslider.find(swslider_id)

      render :partial => 'c80_swiper/swipe',
             :locals => {
                 frames: swslider.sframes,
                 options: {
                     mark_pagination: true,
                     mark_buttons: true,
                     mark_scrollbar: false,
                     mark_lazy: false,
                     params: {
                         effect: effect,
                         autoplay: swslider.autoplay * 1000 # Delay between transitions (in ms). If this parameter is not specified, auto play will be disabled
                     }
                 }
             }
    rescue => e
      Rails.logger.debug "[TRACE] <app_helper.swipe> #{e}"
      render :partial => 'c80_swiper/shared/swipe_error_message',
             :locals => {
                 error_message: "#{e}"
             }
    end

  end
end
{'avg_line_length': 31.696969696969695, 'max_line_length': 159, 'alphanum_fraction': 0.491395793499044, 'licenses': ['MIT'], 'repository_name': 'c80609a/c80_swiper', 'path': 'app/helpers/c80_swiper/app_helper.rb', 'size': 1046, 'lang': 'Ruby'}