diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 41041d8e..edff9a95 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,4 @@ class UsersController < ApplicationController - before_filter :authenticate_user! load_and_authorize_resource # GET /users/1 diff --git a/app/models/conference.rb b/app/models/conference.rb index 7d4213ae..43ff5a31 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -44,6 +44,10 @@ class Conference < ActiveRecord::Base where(state: :confirmed) end + def scheduled + where.not(start_time: nil) + end + def highlights where(state: :confirmed, is_highlight: true) end diff --git a/app/models/event.rb b/app/models/event.rb index 47206b94..320c4b28 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -205,11 +205,11 @@ class Event < ActiveRecord::Base end def speaker_names - result = [] + result = Set.new speakers.each do |speaker| - result.push(speaker.name) + result.add(speaker.name) end - result.to_sentence + result.to_a.to_sentence end private diff --git a/app/views/conference/_all_events.html.erb b/app/views/conference/_all_events.html.erb new file mode 100644 index 00000000..248cd604 --- /dev/null +++ b/app/views/conference/_all_events.html.erb @@ -0,0 +1,19 @@ +

Program for <%= @conference.title %>

+<% @conference.events.confirmed.each do |event| %> +
+

+ <%= link_to event.title, conference_proposal_path(@conference.short_title, event.id) %> +
+ + <%= event.subtitle %> + +

+

+ presented by <%= event.speaker_names %> +

+

+ <%= truncate(event.abstract, :length => 400) -%> + <%= link_to 'more', conference_proposal_path(@conference.short_title, event.id) if event.abstract.length > 400 %> +

+
+<% end %> \ No newline at end of file diff --git a/app/views/conference/_schedule.html.erb b/app/views/conference/_schedule.html.erb new file mode 100644 index 00000000..baf466b5 --- /dev/null +++ b/app/views/conference/_schedule.html.erb @@ -0,0 +1,137 @@ +
+

Schedule for <%= @conference.title %>

+ + +
+ <% @dates.each do |date| %> +
+ + + + <% @rooms.each do |room| %> + + <% end %> + + + <% span = {} %> + <% @rooms.each do |room| %> + <% span[room.id] = 1 %> + <% end %> + + <% conf_start = DateTime.parse("#{date} 09:00") %> + <% conf_end = DateTime.parse("#{date} 19:00") %> + + <% while conf_start < conf_end %> + <%- + start_hour = conf_start.hour + start_min = conf_start.min %> + + + + + <% @rooms.each do |room| %> + <% events_for_date = @events.find_all {|e| e.room_id == room.id && e.start_time && e.start_time.to_date == date } %> + <% event = events_for_date.find_all{|e| e.start_time.hour == start_hour && e.start_time.min == start_min } %> + <% if !event.empty? %> + + <% span[room.id] = event[0].event_type.length / 15 %> + + <% span[room.id] = span[room.id] + 1 %> + <% elsif span[room.id] > 1 %> + + <% span[room.id] = ( span[room.id] - 1 ) if span[room.id] > 1 %> + <% end %> + <% if span[room.id] == 1 %> + + + <% end %> + <%end %> + + <% conf_start += 15.minutes %> + <%end %> +
Time<%= room.name %>
+ <%= conf_start.strftime("%H:%M") %> + + <%- if speaker = event[0].speakers.first %> + <%= image_tag speaker.gravatar_url, :class => "img-circle pull-right", + :alt => speaker.name, + :title => speaker.name, + :style => "padding:8px;" %> + <%- end %> +
+ + <%= event[0].title %> + <% unless event[0].subtitle.blank? %> + + <%= event[0].subtitle %> + + <% end %> +
+ + + + <%= "#{speaker.name}" %> + + <% if event[0].track%> + + + <%= event[0].track.name %> + + <% end -%> +
+
+
+ <% end %> +
+
+<%= javascript_tag do %> + jQuery( function($) { + $('tbody tr td[data-href]').addClass('clickable').mouseup(function(e) { + var url = $(this).attr('data-href'); + if (e.which === 1 && e.ctrlKey){ + var win = window.open(url, '_blank'); + win.focus(); + } + else if(e.which === 1) + { + window.location = url; + } + else if(e.which === 2) + { + var win = window.open(url, '_blank'); + win.focus(); + } + }); +}); + +$(function() { + // add a hash to the URL when the user clicks on a tab + $('a[data-toggle="tab"]').on('click', function(e) { + history.pushState(null, null, $(this).attr('href')); + }); + // navigate to a tab when the history changes + window.addEventListener("popstate", function(e) { + var activeTab = $('[href=' + location.hash + ']'); + if (activeTab.length) { + activeTab.tab('show'); + } else { + $('.nav-tabs a[href=#<%= j @today %>]').tab('show'); + } + }); +}); + +$(function() { + var hash = window.location.hash; + hash && $('ul.nav a[href="' + hash + '"]').tab('show'); +}); + +<% end %> diff --git a/app/views/conference/_program.html.haml b/app/views/conference/_schedule_splashpage.html.haml similarity index 100% rename from app/views/conference/_program.html.haml rename to app/views/conference/_schedule_splashpage.html.haml diff --git a/app/views/conference/schedule.html.erb b/app/views/conference/schedule.html.erb index 99f80e0d..d7c30da7 100644 --- a/app/views/conference/schedule.html.erb +++ b/app/views/conference/schedule.html.erb @@ -1,138 +1,27 @@
-
-

Schedule for <%= @conference.title %>

- - -
- <% @dates.each do |date| %> -
- - - - <% @rooms.each do |room| %> - - <% end %> - - - <% span = {} %> - <% @rooms.each do |room| %> - <% span[room.id] = 1 %> - <% end %> - - <% conf_start = DateTime.parse("#{date} 09:00") %> - <% conf_end = DateTime.parse("#{date} 19:00") %> - - <% while conf_start < conf_end %> - <%- - start_hour = conf_start.hour - start_min = conf_start.min %> - - - - - <% @rooms.each do |room| %> - <% events_for_date = @events.find_all {|e| e.room_id == room.id && e.start_time && e.start_time.to_date == date } %> - <% event = events_for_date.find_all{|e| e.start_time.hour == start_hour && e.start_time.min == start_min } %> - <% if !event.empty? %> - - <% span[room.id] = event[0].event_type.length / 15 %> - - <% span[room.id] = span[room.id] + 1 %> - <% elsif span[room.id] > 1 %> - - <% span[room.id] = ( span[room.id] - 1 ) if span[room.id] > 1 %> - <% end %> - <% if span[room.id] == 1 %> - - - <% end %> - <%end %> - - <% conf_start += 15.minutes %> - <%end %> -
Time<%= room.name %>
- <%= conf_start.strftime("%H:%M") %> - - <%- if speaker = event[0].speakers.first %> - <%= image_tag speaker.gravatar_url, :class => "img-circle pull-right", - :alt => speaker.name, - :title => speaker.name, - :style => "padding:8px;" %> - <%- end %> -
- - <%= event[0].title %> - <% unless event[0].subtitle.blank? %> - - <%= event[0].subtitle %> - - <% end %> -
- - - - <%= "#{speaker.name}" %> - - <% if event[0].track%> - - - <%= event[0].track.name %> - - <% end -%> -
-
+ <% if @conference.events.scheduled.any? %> +
+ + + + +
+
+ <%= render 'schedule' %> +
+
+ <%= render 'all_events' %> +
- <% end %> -
-
-<%= javascript_tag do %> - jQuery( function($) { - $('tbody tr td[data-href]').addClass('clickable').mouseup(function(e) { - var url = $(this).attr('data-href'); - if (e.which === 1 && e.ctrlKey){ - var win = window.open(url, '_blank'); - win.focus(); - } - else if(e.which === 1) - { - window.location = url; - } - else if(e.which === 2) - { - var win = window.open(url, '_blank'); - win.focus(); - } - }); -}); - -$(function() { - // add a hash to the URL when the user clicks on a tab - $('a[data-toggle="tab"]').on('click', function(e) { - history.pushState(null, null, $(this).attr('href')); - }); - // navigate to a tab when the history changes - window.addEventListener("popstate", function(e) { - var activeTab = $('[href=' + location.hash + ']'); - if (activeTab.length) { - activeTab.tab('show'); - } else { - $('.nav-tabs a[href=#<%= j @today %>]').tab('show'); - } - }); -}); - -$(function() { - var hash = window.location.hash; - hash && $('ul.nav a[href="' + hash + '"]').tab('show'); -}); - -<% end %> +
+ <% else %> + <%= render 'all_events' %> + <% end %> +
\ No newline at end of file diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index e4354598..f5065b3e 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -31,7 +31,7 @@ - if @conference.splashpage.include_program %section#program - = render 'program' + = render 'schedule_splashpage' - if @conference.cfp_open? and @conference.splashpage.include_cfp %section#callforpapers diff --git a/app/views/proposal/show.html.haml b/app/views/proposal/show.html.haml index 409165bb..5cb91ff8 100644 --- a/app/views/proposal/show.html.haml +++ b/app/views/proposal/show.html.haml @@ -57,10 +57,8 @@ .col-md-8 %h3 by - = @speaker.name - ( - = @speaker.email - ) + = link_to @speaker.name, user_path(@speaker.id) + = "(#{@speaker.email})" - if @speaker.affiliation? %br %span.muted diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 9755310d..98352e00 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -3,7 +3,7 @@ .col-md-12 .page-header %h1 - = image_tag(current_user.gravatar_url(size: '48'), title: "Yo #{current_user.name}!", :alt => '') + = image_tag(@user.gravatar_url(size: '48'), title: "Yo #{@user.name}!", :alt => '') = @user.name %small = @user.nickname diff --git a/spec/views/conference/show.html.haml_spec.rb b/spec/views/conference/show.html.haml_spec.rb index c70c32cf..87219c90 100644 --- a/spec/views/conference/show.html.haml_spec.rb +++ b/spec/views/conference/show.html.haml_spec.rb @@ -43,7 +43,7 @@ describe 'conference/show.html.haml' do end it 'renders program partial' do - expect(view).to render_template(partial: 'conference/_program') + expect(view).to render_template(partial: 'conference/_schedule_splashpage') end it 'renders registration partial' do