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
- 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

View File

@ -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

View File

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

View File

@ -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

View File

@ -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])