From cd32ddd422eb5ce781ed08d971a93b1a4e69a0fe Mon Sep 17 00:00:00 2001 From: Ana Date: Thu, 30 Jun 2016 13:57:25 +0200 Subject: [PATCH] _schedule hamlfy _schedule changed to haml --- app/views/conference/_schedule.html.erb | 82 ------------------------ app/views/conference/_schedule.html.haml | 68 ++++++++++++++++++++ 2 files changed, 68 insertions(+), 82 deletions(-) delete mode 100644 app/views/conference/_schedule.html.erb create mode 100644 app/views/conference/_schedule.html.haml diff --git a/app/views/conference/_schedule.html.erb b/app/views/conference/_schedule.html.erb deleted file mode 100644 index 991529cc..00000000 --- a/app/views/conference/_schedule.html.erb +++ /dev/null @@ -1,82 +0,0 @@ -
-

Schedule for <%= @conference.title %>

- - -
- <% @dates.each do |date| %> -
- -
- <% number_columns = 1 %> - <%= render 'carousel', date: date, number_columns: number_columns %> -
- -
- <% number_columns = 2 %> - <%= render 'carousel', date: date, number_columns: number_columns %> -
- -
- <% number_columns = 3 %> - <%= render 'carousel', date: date, number_columns: number_columns %> -
- -
- <% end %> -
-
-<%= javascript_tag do %> -// change of active tab and the button title when a date clicked -$(function() { - $('.date-tab').on('click', function(e) { - $('.li-dropdown-schedule').removeClass('active'); - $('.schedule-dropdown').find('button').text($(this).text()); - }); -}); - -// use the date tag in the url to select a tab and the title of the button -$(function() { - var hash = window.location.hash; - if(hash && !(hash === '#schedule')){ - hash && $('ul a[href="' + hash + '"]').tab('show'); - $('button.dropdown-toggle').text(hash.substr(1)); - } -}); - -// hide the right and left controls when neccesary after moving the carousel -$('.carousel').on('slid.bs.carousel', '', -function(){ - $(this).children('.left.carousel-control').show(); - $(this).children('.right.carousel-control').show(); - if($(this).find('.first').hasClass('active')) { - $(this).children('.left.carousel-control').hide(); - } else if($(this).find('.last').hasClass('active')) { - $(this).children('.right.carousel-control').hide(); - } -}); - -$(document).ready(function(){ - // hide the left control when the page is ready - $('.carousel').children('.left.carousel-control').hide(); - - // carousel swipe - $(".carousel-inner").swiperight(function() { - $(this).parent().carousel('prev'); - }); - $(".carousel-inner").swipeleft(function() { - $(this).parent().carousel('next'); - }); -}); -<% end %> diff --git a/app/views/conference/_schedule.html.haml b/app/views/conference/_schedule.html.haml new file mode 100644 index 00000000..d0d1e3de --- /dev/null +++ b/app/views/conference/_schedule.html.haml @@ -0,0 +1,68 @@ +#schedule-content + %h1.text-center + Schedule for + = @conference.title + .dropdown.schedule-dropdown + %button{ type: "button", class: "btn btn-default dropdown-toggle", 'data-toggle' => "dropdown" } + = @dates.first + %span.caret + %ul.dropdown-menu + - @dates.each do |date| + %li.li-dropdown-schedule + = link_to date, "#" + "#{date}", "data-toggle" => "tab", "class" => "date-tab" + + .tab-content + - @dates.each do |date| + %div{ class: "tab-pane #{ 'active' if @dates.first == date }", id: "#{ date }" } + + .visible-xs-inline + = render partial: 'carousel', locals: { date: date, number_columns: 1 } + + .visible-sm-inline + = render partial: 'carousel', locals: { date: date, number_columns: 2 } + + .visible-md-inline.visible-lg-inline + = render partial: 'carousel', locals: { date: date, number_columns: 3 } + +:javascript + // change of active tab and the button title when a date clicked + $(function() { + $('.date-tab').on('click', function(e) { + $('.li-dropdown-schedule').removeClass('active'); + $('.schedule-dropdown').find('button').text($(this).text()); + }); + }); + + // use the date tag in the url to select a tab and the title of the button + $(function() { + var hash = window.location.hash; + if(hash && !(hash === '#schedule')){ + hash && $('ul a[href="' + hash + '"]').tab('show'); + $('button.dropdown-toggle').text(hash.substr(1)); + } + }); + + // hide the right and left controls when neccesary after moving the carousel + $('.carousel').on('slid.bs.carousel', '', + function(){ + $(this).children('.left.carousel-control').show(); + $(this).children('.right.carousel-control').show(); + if($(this).find('.first').hasClass('active')) { + $(this).children('.left.carousel-control').hide(); + } else if($(this).find('.last').hasClass('active')) { + $(this).children('.right.carousel-control').hide(); + } + }); + + $(document).ready(function(){ + // hide the left control when the page is ready + $('.carousel').children('.left.carousel-control').hide(); + + // carousel swipe + $(".carousel-inner").swiperight(function() { + $(this).parent().carousel('prev'); + }); + $(".carousel-inner").swipeleft(function() { + $(this).parent().carousel('next'); + }); + });