Management interface for Event Suggestions
This commit is contained in:
parent
2f711637fc
commit
62649edb67
|
@ -1,4 +1,4 @@
|
|||
.user-details {
|
||||
.model-details {
|
||||
@extend .modal;
|
||||
@extend .fade;
|
||||
.center {
|
|
@ -1,5 +1,6 @@
|
|||
.record-table {
|
||||
@extend .table;
|
||||
@extend .table-striped;
|
||||
|
||||
td {
|
||||
vertical-align: middle !important;
|
||||
|
@ -18,17 +19,6 @@
|
|||
width: 120px;
|
||||
}
|
||||
|
||||
.picture-placeholder {
|
||||
@extend .img-thumbnail;
|
||||
|
||||
.glyphicon {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
font-size: 48px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.actions div {
|
||||
@extend .pull-right;
|
||||
@extend .btn-group;
|
||||
|
@ -53,4 +43,20 @@
|
|||
@extend .btn-primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 0.9em;
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
|
||||
.picture-placeholder {
|
||||
@extend .img-thumbnail;
|
||||
|
||||
.glyphicon {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
font-size: 48px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,4 +5,4 @@
|
|||
@import "font-awesome";
|
||||
@import "navbar";
|
||||
@import "record_table";
|
||||
@import "user_details";
|
||||
@import "model_details";
|
|
@ -0,0 +1,18 @@
|
|||
module Management
|
||||
class EventsController < ManagementController
|
||||
before_action :assign_suggestion, only: [:show]
|
||||
|
||||
def index
|
||||
@suggestion_groups = SuggestionGroup.for_conference Conference.current
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def assign_suggestion
|
||||
@suggestion = Event.find params[:id]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,6 +10,7 @@ class Conference < ActiveRecord::Base
|
|||
|
||||
has_many :tracks, -> { order('id asc') }
|
||||
has_many :events, through: :tracks
|
||||
has_many :candidate_speakers, through: :events
|
||||
|
||||
scope :future, -> { where('start_date >= ?', Date.today).order('start_date ASC') }
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ class Event < ActiveRecord::Base
|
|||
|
||||
belongs_to :track
|
||||
has_one :conference, through: :track
|
||||
belongs_to :user
|
||||
belongs_to :user # XXX: Transition to candidate_speaker
|
||||
belongs_to :candidate_speaker, class_name: 'User', foreign_key: 'user_id'
|
||||
|
||||
after_create :send_new_event_notification
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
class SuggestionGroup
|
||||
include ActiveModel::Model
|
||||
attr_accessor :speaker, :suggestions
|
||||
|
||||
def self.where(conditions = {})
|
||||
Event.joins(:track).includes(:user).where(conditions).group_by(&:user).map do |speaker, suggestions|
|
||||
SuggestionGroup.new speaker: speaker, suggestions: suggestions
|
||||
end
|
||||
end
|
||||
|
||||
def self.for_conference(conference)
|
||||
where tracks: {conference_id: conference.id}
|
||||
end
|
||||
end
|
|
@ -7,6 +7,7 @@ class User < ActiveRecord::Base
|
|||
has_one :speaker_profile
|
||||
has_many :lectures
|
||||
has_many :workshops
|
||||
has_many :events
|
||||
|
||||
accepts_nested_attributes_for :speaker_profile, update_only: true
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ html
|
|||
= link_to 'Clarion', root_path, class: 'navbar-brand'
|
||||
.navbar-collapse.collapse
|
||||
ul.nav.navbar-nav
|
||||
li class="#{'active' if controller_name == 'home'}"
|
||||
= link_to t(:home), management_path
|
||||
li class="#{'active' if controller_name == 'users'}"
|
||||
= link_to User.model_name.human(count: 2), management_users_path
|
||||
li class="#{'active' if controller_name == 'events'}"
|
||||
= link_to Event.model_name.human(count: 2), management_events_path
|
||||
div.container
|
||||
== yield
|
||||
= javascript_include_tag "management/application"
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
.model-details id="suggestion-#{@suggestion.id}-details" tabindex="-1" role="dialog" aria-hidden="true"
|
||||
.modal-dialog
|
||||
.modal-content
|
||||
.modal-header
|
||||
button type="button" class="close" data-dismiss="modal" aria-hidden="true"
|
||||
h4.modal-title
|
||||
= @suggestion.title
|
||||
small<
|
||||
= @suggestion.subtitle
|
||||
br
|
||||
= t :meta_data, language: @suggestion.language, track: @suggestion.track.name, length: @suggestion.length
|
||||
|
||||
.modal-body
|
||||
.center
|
||||
h4 = @suggestion.class.human_attribute_name(:user)
|
||||
- unless @suggestion.user.speaker_profile.present?
|
||||
div.picture-placeholder
|
||||
= glyph(:user)
|
||||
h3.media-heading
|
||||
= @suggestion.user.email
|
||||
|
||||
- else
|
||||
= image_tag @suggestion.user.speaker_profile.picture.medium.url, class: "profile-image"
|
||||
h3.media-heading
|
||||
= @suggestion.user.speaker_profile.name
|
||||
- if @suggestion.user.speaker_profile.organisation.present?
|
||||
div
|
||||
=> fa_icon(:briefcase)
|
||||
= @suggestion.user.speaker_profile.organisation
|
||||
|
||||
div.social
|
||||
= link_to "mailto://#{@suggestion.user.email}"
|
||||
= fa_icon :envelope
|
||||
- if @suggestion.user.speaker_profile.github.present?
|
||||
= link_to "https://github.com/#{@suggestion.user.speaker_profile.github}"
|
||||
= fa_icon :github
|
||||
- if @suggestion.user.speaker_profile.twitter.present?
|
||||
= link_to "https://twitter.com/#{@suggestion.user.speaker_profile.twitter}"
|
||||
= fa_icon :twitter
|
||||
|
||||
h4 = @suggestion.class.human_attribute_name(:abstract)
|
||||
= simple_format @suggestion.abstract
|
||||
|
||||
h4 = @suggestion.class.human_attribute_name(:description)
|
||||
= simple_format @suggestion.description
|
||||
|
||||
|
||||
- if @suggestion.notes.present?
|
||||
h4 = @suggestion.class.human_attribute_name(:notes)
|
||||
= simple_format @suggestion.notes
|
||||
|
||||
.modal-footer
|
||||
button type="button" class="btn btn-default" data-dismiss="modal"
|
||||
= t(:close)
|
|
@ -0,0 +1,27 @@
|
|||
- suggestion_group.suggestions.each_with_index do |suggestion, index|
|
||||
tr
|
||||
- if index == 0
|
||||
td.picture rowspan="#{suggestion_group.suggestions.count}"
|
||||
- if suggestion_group.speaker.speaker_profile.present?
|
||||
= link_to management_user_path(suggestion_group.speaker), remote: true
|
||||
= image_tag suggestion_group.speaker.speaker_profile.picture.thumb.url, class: 'img-thumbnail'
|
||||
br
|
||||
= suggestion_group.speaker.speaker_profile.name
|
||||
- else
|
||||
.picture-placeholder
|
||||
= glyph(:user)
|
||||
= suggestion_group.speaker.email
|
||||
|
||||
td
|
||||
span.title
|
||||
= link_to management_event_path(suggestion), title: t(:view), remote: true
|
||||
= suggestion.title
|
||||
br
|
||||
span.subtitle
|
||||
= suggestion.subtitle
|
||||
td = suggestion.track.name
|
||||
td = suggestion.class.model_name.human
|
||||
td.actions
|
||||
div
|
||||
= link_to management_event_path(suggestion), title: t(:view), remote: true
|
||||
= glyph(:share)
|
|
@ -0,0 +1,11 @@
|
|||
.row
|
||||
table.record-table
|
||||
thead
|
||||
tr
|
||||
th.picture = Event.human_attribute_name(:user)
|
||||
th = Event.human_attribute_name(:title)
|
||||
th = Track.model_name.human
|
||||
th = Event.human_attribute_name(:type)
|
||||
th.actions
|
||||
tbody
|
||||
= render partial: 'suggestion_group', collection: @suggestion_groups
|
|
@ -0,0 +1,5 @@
|
|||
$('body').append('<%= j render 'suggestion_details' %>');
|
||||
$('#suggestion-<%= @suggestion.id %>-details').on('hidden.bs.modal', function () {
|
||||
$(this).remove();
|
||||
});
|
||||
$('#suggestion-<%= @suggestion.id %>-details').modal('show');
|
|
@ -1,4 +1,4 @@
|
|||
.user-details id="about-user-#{@user.id}" tabindex="-1" role="dialog" aria-hidden="true"
|
||||
.model-details id="about-user-#{@user.id}" tabindex="-1" role="dialog" aria-hidden="true"
|
||||
.modal-dialog
|
||||
.modal-content
|
||||
.modal-header
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<!-- Button trigger modal -->
|
||||
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
|
||||
Launch demo modal
|
||||
</button>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
...
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -31,6 +31,9 @@ bg:
|
|||
workshop:
|
||||
one: Уъркшоп
|
||||
other: Уъркшопи
|
||||
event:
|
||||
one: Предложение
|
||||
other: Предложения
|
||||
track: Поток от лекции
|
||||
attributes:
|
||||
user:
|
||||
|
@ -49,7 +52,7 @@ bg:
|
|||
biography: Биография
|
||||
github: Github акаунт
|
||||
twitter: Twitter акаунт
|
||||
lecture:
|
||||
event:
|
||||
title: Заглавие
|
||||
subtitle: Подзаглавие
|
||||
length: Продължителност
|
||||
|
@ -59,16 +62,7 @@ bg:
|
|||
notes: Забележки
|
||||
track_id: Поток от лекции
|
||||
agreement: Съгласен(на) съм
|
||||
workshop:
|
||||
title: Заглавие
|
||||
subtitle: Подзаглавие
|
||||
length: Продължителност
|
||||
language: Език
|
||||
abstract: Резюме
|
||||
description: Описание
|
||||
notes: Забележки
|
||||
track_id: Поток от уъркшопи
|
||||
agreement: Съгласен(на) съм
|
||||
user: Лектор
|
||||
errors:
|
||||
models:
|
||||
user:
|
||||
|
|
|
@ -32,6 +32,9 @@ en:
|
|||
one: Workshop
|
||||
other: Workshops
|
||||
track: track
|
||||
event:
|
||||
one: Suggestion
|
||||
other: Suggestions
|
||||
attributes:
|
||||
user:
|
||||
email: E-mail
|
||||
|
@ -49,7 +52,7 @@ en:
|
|||
biography: Short bography
|
||||
github: Github account
|
||||
twitter: Twitter account
|
||||
lecture:
|
||||
event:
|
||||
title: Title
|
||||
subtitle: Sub-title
|
||||
length: Length (should be between 40 and 45 minutes)
|
||||
|
@ -59,16 +62,7 @@ en:
|
|||
notes: Notes
|
||||
track: Track
|
||||
agreement: I accept
|
||||
workshop:
|
||||
title: Title
|
||||
subtitle: Sub-title
|
||||
length: Length (should be between 30 and 120 minutes)
|
||||
language: Language
|
||||
abstract: Abstract (one paragraph)
|
||||
description: Description (3-4 paragraphs)
|
||||
notes: Notes
|
||||
track: Track
|
||||
agreement: I accept
|
||||
user: Speaker
|
||||
errors:
|
||||
models:
|
||||
user:
|
||||
|
|
|
@ -66,3 +66,5 @@ bg:
|
|||
logout: Изход
|
||||
|
||||
of_motto: да споделим свободата
|
||||
|
||||
meta_data: "Език: %{language}, поток: „%{track}“, продължителност: %{length} мин."
|
|
@ -65,3 +65,4 @@ en:
|
|||
logout: Logout
|
||||
|
||||
of_motto: share the freedom
|
||||
meta_data: "Language: %{language}, track: \"%{track}\", length: %{length} min."
|
|
@ -5,12 +5,15 @@ Rails.application.routes.draw do
|
|||
devise_for :users, controllers: {registrations: 'registrations', sessions: 'sessions'}
|
||||
|
||||
namespace :management do
|
||||
get '/', to: 'home#index'
|
||||
get '/', to: 'events#index'
|
||||
|
||||
resources :users do
|
||||
member do
|
||||
post 'toggle_admin'
|
||||
end
|
||||
end
|
||||
|
||||
resources :events
|
||||
end
|
||||
|
||||
root 'home#index'
|
||||
|
|
Loading…
Reference in New Issue