Merge branch 'master' into navbar_collapse

This commit is contained in:
Naman Gupta 2018-02-28 01:23:01 +05:30 • committed by GitHub
commit f67983b806
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 355 additions and 50 deletions

View file

@ -115,3 +115,9 @@ p.comment-body {
float: right;
}
}
/* omniauth btn grp */
#openid-btn-grp{
display: flex;
justify-content: center;
}

View file

@ -20,6 +20,10 @@ module Admin
@total_submissions = Event.count
@new_submissions = Event.where('created_at > ?', current_user.last_sign_in_at).count
@total_withdrawn = Event.where(state: :withdrawn).count
@new_withdrawn = Event
.where('state = ? and created_at > ?', 'withdrawn', current_user.last_sign_in_at).count
@active_conferences = Conference.get_active_conferences_for_dashboard # pending or the last two
@deactive_conferences = Conference
.get_conferences_without_active_for_dashboard(@active_conferences) # conferences without active
@ -116,13 +120,19 @@ module Admin
@total_reg = @conference.registrations.count
@new_reg = @conference.registrations.where('created_at > ?', current_user.last_sign_in_at).count
@total_submissions = @program.events.count
@new_submissions = @program.events
@all_events = @program.events
@total_submissions = @all_events.count
@new_submissions = @all_events
.where('created_at > ?', current_user.last_sign_in_at).count
@program_length = @conference.current_program_hours
@new_program_length = @conference.new_program_hours(current_user.last_sign_in_at)
@total_withdrawn = @all_events.where(state: :withdrawn).count
@new_withdrawn = @all_events
.where('state = "withdrawn" and created_at > ?', current_user.last_sign_in_at).count
# Step by step list
@conference_progress = @conference.get_status
@ -162,13 +172,17 @@ module Admin
# Doughnut charts
@event_type_distribution = @conference.event_type_distribution
@event_type_distribution_confirmed = @conference.event_type_distribution(:confirmed)
@event_type_distribution_withdrawn = @conference.event_type_distribution(:withdrawn)
@difficulty_levels_distribution = @conference.difficulty_levels_distribution
@difficulty_levels_distribution_confirmed = @conference
.difficulty_levels_distribution(:confirmed)
@difficulty_levels_distribution_withdrawn = @conference
.difficulty_levels_distribution(:withdrawn)
@tracks_distribution = @conference.tracks_distribution
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)
@tracks_distribution_withdrawn = @conference.tracks_distribution(:withdrawn)
# Recent actions information
@recent_events = @conference.program.events.limit(5).order(created_at: :desc)

View file

@ -20,6 +20,11 @@ class ConferencesController < ApplicationController
authorize! :show, @conference # TODO: reduce the 10 queries performed here
splashpage = @conference.splashpage
unless splashpage.present?
redirect_to admin_conference_splashpage_path(@conference.short_title) && return
end
if splashpage.include_cfp
cfps = @conference.program.cfps
@call_for_events = cfps.find { |call| call.cfp_type == 'events' }
@ -50,6 +55,7 @@ class ConferencesController < ApplicationController
@sponsorship_levels = @conference.sponsorship_levels.eager_load(
:sponsors
).order('sponsorship_levels.position ASC', 'sponsors.name')
@sponsors = @conference.sponsors
end
end

View file

@ -10,7 +10,7 @@ class PhysicalTicketsController < ApplicationController
end
def show
@file_name = "ticket_for_#{@conference.short_title}"
@file_name = "ticket_for_#{@conference.short_title}.pdf"
@user = @physical_ticket.user
@ticket_layout = @conference.ticket_layout.to_sym
@qrcode_image = RQRCode::QRCode.new(@physical_ticket.token).as_png(size: 180, border_modules: 0)

View file

@ -66,7 +66,13 @@ class Ability
can [:new, :create], Registration do |registration|
conference = registration.conference
conference.registration_open? && !conference.registration_limit_exceeded? || conference.program.speakers.confirmed.include?(user)
if conference.user_registered? user
false
elsif conference.program.speakers.confirmed.include?(user) && conference.registration_period
true
else
conference.registration_open? && !conference.registration_limit_exceeded?
end
end
can :index, Organization

View file

@ -1029,7 +1029,7 @@ class Conference < ApplicationRecord
# * +hash+ -> object_type => {color, value}
def calculate_event_distribution(group_by_id, association_symbol, state = nil)
grouped = if state
program.events.select(group_by_id).where('state = ?', 'confirmed').group(group_by_id)
program.events.select(group_by_id).where('state = ?', state).group(group_by_id)
else
program.events.select(group_by_id).group(group_by_id)
end

View file

@ -1,4 +1,5 @@
class Registration < ApplicationRecord
require 'csv'
belongs_to :user
belongs_to :conference

View file

@ -62,7 +62,11 @@ class Ticket < ApplicationRecord
def tickets_turnover_total(id)
tickets = TicketPurchase.where(ticket_id: id).paid
tickets.inject(0){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) }
if tickets.blank?
Money.new(0, Ticket.find(id).price_currency)
else
tickets.inject(Money.new(0, tickets.first.price_currency)){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) }
end
end
def tickets_sold

View file

@ -1,5 +1,5 @@
.row
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-user.fa-lg
%span.fa.fa-lg
@ -11,7 +11,7 @@
%span.label.label-success{ title: "+ #{@new_user} since you last logged in!" }
+
= @new_user
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-check-square.fa-lg
%span.fa.fa-lg
@ -23,7 +23,7 @@
%span.label.label-success{ title: "+#{@new_reg} since you last logged in!" }
+
= @new_reg
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-file-text.fa-lg
%span.fa.fa-lg
@ -35,6 +35,18 @@
%span.label.label-success{ title: "+#{@new_submissions} since you last logged in!" }
+
= @new_submissions
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-archive.fa-lg
%span.fa.fa-lg
= @total_withdrawn
%p
%small
#{'Withdrawn'.pluralize(@total_withdrawn)}
- if @new_withdrawn
%span.label.label-success{ title: "+#{@new_withdrawn} since you last logged in!" }
+
= @new_withdrawn
.row#registrations
.col-md-8

View file

@ -3,7 +3,7 @@
Dashboard for #{@conference.title}
%hr
.row
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-user.fa-lg
%span.fa.fa-lg
@ -16,7 +16,7 @@
+
= @new_reg
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-check-square.fa-lg
%span.fa.fa-lg
@ -29,7 +29,7 @@
+
= @new_submissions
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-file-text.fa-lg
%span.fa.fa-lg
@ -42,6 +42,19 @@
+
= @new_program_length
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-archive.fa-lg
%span.fa.fa-lg
= @total_withdrawn
%p
%small
#{'Withdrawn'.pluralize(@total_withdrawn)}
- if @new_withdrawn
%span.label.label-success{ title: "+#{@new_withdrawn} since you last logged in!" }
+
= @new_withdrawn
.row
.col-md-12
.row
@ -91,6 +104,10 @@
%a{ href: '#distribution_confirmed', 'data-toggle' => 'tab' }
%span.fa.fa-comment
Confirmed
%li
%a{ href: '#distribution_withdrawn', 'data-toggle' => 'tab' }
%span.fa.fa-archive
Withdrawn
.tab-content
.tab-pane.active#distribution_all
.row
@ -108,6 +125,14 @@
= render partial: 'doughnut_chart', locals: {title: 'Difficulty levels', data: @difficulty_levels_distribution_confirmed}
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Tracks', data: @tracks_distribution_confirmed}
.tab-pane#distribution_withdrawn
.row
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Event types', data: @event_type_distribution_withdrawn}
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Difficulty levels', data: @difficulty_levels_distribution_withdrawn}
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Tracks', data: @tracks_distribution_withdrawn}
.row
.col-md-8

View file

@ -2,8 +2,9 @@
.col-md-12
.page-header
%h1 Organizations
.btn-group.pull-right
= link_to 'Create Organization', new_admin_organization_path, class: 'btn btn-success pull-right'
- if can? :manage, :all
.btn-group.pull-right
= link_to 'Create Organization', new_admin_organization_path, class: 'btn btn-success pull-right'
%p.text-muted
Manage organizations in OSEM
.row

View file

@ -15,6 +15,9 @@
- unless contact.googleplus.blank?
= link_to "#{ contact.googleplus }" do
%i.fa.fa-google-plus-square.fa-4x
- unless contact.mastodon.blank?
= link_to "#{ contact.mastodon }" do
%i.fa.icon-mastodon.fa-4x
- unless contact.email.blank?
= mail_to "#{ contact.email }" do
%i.fa.fa-envelope-o.fa-4x

View file

@ -1,21 +0,0 @@
.container
.row
.col-md-12.text-center
- unless @conference.contact.facebook.blank?
= link_to "#{ @conference.contact.facebook }" do
%i.fa.fa-facebook-square.fa-4x
- unless @conference.contact.twitter.blank?
= link_to "#{ @conference.contact.twitter }" do
%i.fa.fa-twitter.fa-4x
- unless @conference.contact.instagram.blank?
= link_to "#{ @conference.contact.instagram }" do
%i.fa.fa-instagram.fa-4x
- unless @conference.contact.googleplus.blank?
= link_to "#{ @conference.contact.googleplus }" do
%i.fa.fa-google-plus-square.fa-4x
- unless @conference.contact.mastodon.blank?
= link_to "#{ @conference.contact.mastodon }" do
%i.fa.icon-mastodon.fa-4x
- unless @conference.contact.email.blank?
= mail_to "#{ @conference.contact.email }" do
%i.fa.fa-envelope-o.fa-4x

View file

@ -2,7 +2,7 @@
%li
%a.smoothscroll{ href: '#sponsors' } Sponsors
- cache [conference, sponsorship_levels, '#splash#sponsors'] do
- cache [conference, sponsors, sponsorship_levels, '#splash#sponsors'] do
%section#sponsors
.container
- sponsorship_levels.each do |sponsorship_level|
@ -31,6 +31,6 @@
= link_to(sponsorship_mailto(conference)) do
Contact us!
- sponsorship_levels.collect(&:sponsors).flatten.each do |sponsor|
- sponsors.each do |sponsor|
- content_for :modals do
= render 'modal_description', object: sponsor

View file

@ -43,7 +43,8 @@
-# sponsorship
- if @conference.splashpage.include_sponsors
= render 'sponsors', conference: @conference,
sponsorship_levels: @sponsorship_levels
sponsorship_levels: @sponsorship_levels,
sponsors: @sponsors
-# footer
- if @conference.splashpage.include_social_media

View file

@ -1,5 +1,5 @@
.text-center
.btn-group.btn-group-lg
.btn-group.btn-group-lg#openid-btn-grp
- omniauth_configured.each do |provider|
= link_to "user_#{provider}_omniauth_authorize".to_sym, class: "btn btn-success btn-lg",
id: "omniauth-#{provider}",

View file

@ -37,11 +37,14 @@
%p.muted.text-center
%small
This tool is
=link_to "free software,", "http://www.gnu.org/philosophy/free-sw.html"
#{link_to "free software", "http://www.gnu.org/philosophy/free-sw.html"},
released under the
=link_to "MIT license.", "http://opensource.org/licenses/MIT"
#{link_to "MIT license", "http://opensource.org/licenses/MIT"}.
You can run, copy, distribute, study, change and improve it.
The source code and the developers are on
=link_to "github.", "https://github.com/openSUSE/osem"
#{link_to "GitHub", "https://github.com/openSUSE/osem"}.
- if ENV["SKYLIGHT_PUBLIC_DASHBOARD_URL"].present?
Performance data is available on
#{link_to "Skylight", ENV["SKYLIGHT_PUBLIC_DASHBOARD_URL"]}.
= yield :script_body
= piwik_tracking_tag