diff --git a/TODO b/TODO index b36fa48..39f2bb0 100644 --- a/TODO +++ b/TODO @@ -11,8 +11,8 @@ - sponsorships#index -> generate token, links to send around - scheduling -> calendar with events - - proposals#index -> undecided events, grouped by user - - events#index -> approved events + - # proposals#index -> undecided events, grouped by user + - # events#index -> approved events - users: - # edit profile: image upload and stuff diff --git a/app/controllers/management/propositions_controller.rb b/app/controllers/management/propositions_controller.rb index 05b7d7a..ebb8eb2 100644 --- a/app/controllers/management/propositions_controller.rb +++ b/app/controllers/management/propositions_controller.rb @@ -1,9 +1,8 @@ module Management - # TODO (2015-07-19) Group by user class PropositionsController < ManagementController def index @conference = find_conference - @proposed_events = Event.undecided + @events_by_proposer = @conference.events.undecided.group_by(&:proposer) end private diff --git a/app/models/concerns/proposable.rb b/app/models/concerns/proposable.rb index aa79043..c6c287e 100644 --- a/app/models/concerns/proposable.rb +++ b/app/models/concerns/proposable.rb @@ -1,6 +1,10 @@ module Proposable extend ActiveSupport::Concern + def proposer + proposition.proposer + end + included do has_one :proposition, as: :proposable diff --git a/app/views/management/events/index.html.slim b/app/views/management/events/index.html.slim index 5b20420..41aaa15 100644 --- a/app/views/management/events/index.html.slim +++ b/app/views/management/events/index.html.slim @@ -10,14 +10,18 @@ tr th = Event.human_attribute_name :title th = Event.human_attribute_name :subtitle + th = Event.human_attribute_name :user th = Event.human_attribute_name :length th = Event.human_attribute_name :language th.actions tbody - @events.each do |event| + - proposer = event.proposer + tr td= event.title td= event.subtitle + td= link_to proposer.personal_profile(@conference).name, [:management, @conference, proposer] td #{event.length} minutes td= event.language diff --git a/app/views/management/propositions/index.html.slim b/app/views/management/propositions/index.html.slim index c6c7d67..f942a41 100644 --- a/app/views/management/propositions/index.html.slim +++ b/app/views/management/propositions/index.html.slim @@ -14,13 +14,18 @@ th = Event.human_attribute_name :language th.actions tbody - - @proposed_events.each do |event| + - @events_by_proposer.each do |proposer, events| + - profile = proposer.personal_profile(@conference) tr - td= event.title - td= event.subtitle - td #{event.length} minutes - td= event.language + th[colspan="5"]= link_to profile.name, [:management, @conference, proposer] - td.actions - div.btn-group.btn-group-sm - = action_buttons(@conference, event, [:show, :edit, :destroy]) + - events.each do |event| + tr + td= event.title + td= event.subtitle + td #{event.length} minutes + td= event.language + + td.actions + div.btn-group.btn-group-sm + = action_buttons(@conference, event, [:show, :edit, :destroy])