Group proposals by user

This commit is contained in:
Andrew Radev 2015-07-26 14:55:01 +03:00
parent 752fc6262a
commit 8f2707ffe7
5 changed files with 24 additions and 12 deletions

4
TODO
View File

@ -11,8 +11,8 @@
- sponsorships#index -> generate token, links to send around - sponsorships#index -> generate token, links to send around
- scheduling -> calendar with events - scheduling -> calendar with events
- proposals#index -> undecided events, grouped by user - # proposals#index -> undecided events, grouped by user
- events#index -> approved events - # events#index -> approved events
- users: - users:
- # edit profile: image upload and stuff - # edit profile: image upload and stuff

View File

@ -1,9 +1,8 @@
module Management module Management
# TODO (2015-07-19) Group by user
class PropositionsController < ManagementController class PropositionsController < ManagementController
def index def index
@conference = find_conference @conference = find_conference
@proposed_events = Event.undecided @events_by_proposer = @conference.events.undecided.group_by(&:proposer)
end end
private private

View File

@ -1,6 +1,10 @@
module Proposable module Proposable
extend ActiveSupport::Concern extend ActiveSupport::Concern
def proposer
proposition.proposer
end
included do included do
has_one :proposition, as: :proposable has_one :proposition, as: :proposable

View File

@ -10,14 +10,18 @@
tr tr
th = Event.human_attribute_name :title th = Event.human_attribute_name :title
th = Event.human_attribute_name :subtitle th = Event.human_attribute_name :subtitle
th = Event.human_attribute_name :user
th = Event.human_attribute_name :length th = Event.human_attribute_name :length
th = Event.human_attribute_name :language th = Event.human_attribute_name :language
th.actions th.actions
tbody tbody
- @events.each do |event| - @events.each do |event|
- proposer = event.proposer
tr tr
td= event.title td= event.title
td= event.subtitle td= event.subtitle
td= link_to proposer.personal_profile(@conference).name, [:management, @conference, proposer]
td #{event.length} minutes td #{event.length} minutes
td= event.language td= event.language

View File

@ -14,13 +14,18 @@
th = Event.human_attribute_name :language th = Event.human_attribute_name :language
th.actions th.actions
tbody tbody
- @proposed_events.each do |event| - @events_by_proposer.each do |proposer, events|
- profile = proposer.personal_profile(@conference)
tr tr
td= event.title th[colspan="5"]= link_to profile.name, [:management, @conference, proposer]
td= event.subtitle
td #{event.length} minutes
td= event.language
td.actions - events.each do |event|
div.btn-group.btn-group-sm tr
= action_buttons(@conference, event, [:show, :edit, :destroy]) 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])