_all_events hamlfy

_all_events changed to haml and margins moved inside the content of bootstrat cols
This commit is contained in:
Ana 2016-07-06 19:53:02 +02:00
parent 6f20031bc1
commit 24364d0136
3 changed files with 62 additions and 74 deletions

View file

@ -171,6 +171,11 @@ td.no-padding{
margin-top: 20px;
}
.date-content{
border-bottom: 1px solid #6E6E6E;
margin-top: 30px;
}
.unscheduled-event{
margin-top: 8px;
}

View file

@ -1,74 +0,0 @@
<h1 class="text-center">Program for <%= @conference.title %></h1>
<div class="dropdown program-dropdown">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Dates
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<% @dates.each do |date| %>
<!-- we check if there is any event that day to indicate it appropiately -->
<li class='li-dropdown-program'>
<%= link_to date, "#program-" + "#{date}", class: "program-selector#{ ' no-events-day' unless @conference.program.any_event_for_this_date?(date) }" %>
</li>
<% end %>
<% if @unscheduled_events.any? %>
<li class='li-dropdown-program'>
<%= link_to('Unscheduled', "#program-unscheduled", class: 'program-selector') %>
</li>
<% end %>
</ul>
</div>
<div class="row">
<!-- scheduled events -->
<% date = nil %>
<% time = nil %>
<% @scheduled_events.each do |event| %>
<% unless event.start_time.strftime('%Y-%m-%d').eql?(date) %>
<div class='col-xs-12 col-md-12 all-events-title'>
<span class='date-title' id='program-<%= event.start_time.strftime('%Y-%m-%d') %>'>
<%= date = event.start_time.strftime('%Y-%m-%d') %>
</span>
<a title="Go up" class="pull-right" href="#program">
<i class="fa fa-angle-double-up fa-lg" aria-hidden="true"></i>
</a>
</div>
<% end %>
<% unless event.start_time.strftime('%H:%M').eql?(time) %>
<div class='col-xs-12 col-md-1 start-time'>
<%= time = event.start_time.strftime('%H:%M') %>
</div>
<div class='col-xs-12 col-md-11 new-time-event'>
<%= render partial: 'event', locals: {event: event} %>
</div>
<% else %>
<div class='col-xs-12 col-md-11 col-md-offset-1'>
<%= render partial: 'event', locals: {event: event} %>
</div>
<% end %>
<% end %>
<!-- confirmed events that are not scheduled -->
<% if @unscheduled_events.any? %>
<div class='col-xs-12 col-md-12 all-events-title'>
<span class='date-title' id='program-unscheduled'>
Unscheduled events
</span>
<a title="Go up" class="pull-right" href="#program">
<i class="fa fa-angle-double-up fa-lg" aria-hidden="true"></i>
</a>
</div>
<% end %>
<% @unscheduled_events.each do |event| %>
<div class='col-xs-12 col-md-12 unscheduled-event'>
<%= render partial: 'event', locals: {event: event} %>
</div>
<% end %>
</div>
<%= javascript_tag do %>
$('.program-selector').on('click', function(e) {
$('.li-dropdown-program').removeClass('active');
});
<% end %>

View file

@ -0,0 +1,57 @@
%h1.text-center
Program for
= @conference.title
.dropdown.program-dropdown
%button{ type: "button", class: "btn btn-default dropdown-toggle", 'data-toggle' => "dropdown" }
Dates
%span.caret
%ul.dropdown-menu
- @dates.each do |date|
/ we check if there is any event that day to indicate it appropiately
%li.li-dropdown-program
= link_to date, "#program-" + "#{date}", class: "program-selector#{ ' no-events-day' unless @conference.program.any_event_for_this_date?(date) }"
- if @unscheduled_events.any?
%li.li-dropdown-program
= link_to('Unscheduled', "#program-unscheduled", class: 'program-selector')
.row
/ scheduled events
- date = nil
- time = nil
- @scheduled_events.each do |event|
- unless event.start_time.strftime('%Y-%m-%d').eql?(date)
.col-xs-12.col-md-12
.date-content
%span{ class: 'date-title', id: "program-#{ event.start_time.strftime('%Y-%m-%d') }" }
= date = event.start_time.strftime('%Y-%m-%d')
%a{ title: "Go up", class: "pull-right", href: "#program" }
%i{ class: "fa fa-angle-double-up fa-lg", 'aria-hidden' => true }
- unless event.start_time.strftime('%H:%M').eql?(time)
.col-xs-12.col-md-1
.start-time
= time = event.start_time.strftime('%H:%M')
.col-xs-12.col-md-11
.new-time-event
= render partial: 'event', locals: {event: event}
- else
.col-xs-12.col-md-11.col-md-offset-1
= render partial: 'event', locals: {event: event}
/ confirmed events that are not scheduled
- if @unscheduled_events.any?
.col-xs-12.col-md-12
.date-content
%span.date-title#program-unscheduled
Unscheduled events
%a{ title: "Go up", class: "pull-right", href: "#program" }
%i{ class: "fa fa-angle-double-up fa-lg", 'aria-hidden' => true }
- @unscheduled_events.each do |event|
.col-xs-12.col-md-12
.unscheduled-event
= render partial: 'event', locals: {event: event}
:javascript
$('.program-selector').on('click', function(e) {
$('.li-dropdown-program').removeClass('active');
});