Added all registration data in a table on the stats page
This commit is contained in:
parent
2d76af89d9
commit
99898c0823
@ -152,7 +152,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.initNodeFunctions = [ function(node) {
|
window.initNodeFunctions = [ function(node) {
|
||||||
forEachElement('.number-field,.email-field,.text-field,.password-field', function(field) {
|
forEachElement('.number-field,.email-field,.text-field,.password-field,.search-field', function(field) {
|
||||||
var input = field.querySelector('input');
|
var input = field.querySelector('input');
|
||||||
var positionLabel = function(input) {
|
var positionLabel = function(input) {
|
||||||
field.classList[input.value ? 'remove' : 'add']('empty');
|
field.classList[input.value ? 'remove' : 'add']('empty');
|
||||||
|
23
app/assets/javascripts/registrations.js
Normal file
23
app/assets/javascripts/registrations.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
(function() {
|
||||||
|
var searchControl = document.getElementById('search');
|
||||||
|
|
||||||
|
function filterTable() {
|
||||||
|
forEach(document.getElementById('search-rows').getElementsByTagName('tr'), function(tr) {
|
||||||
|
tr.classList.remove('hidden');
|
||||||
|
|
||||||
|
var value = searchControl.value;
|
||||||
|
if (value) {
|
||||||
|
var words = value.split(/\s+/);
|
||||||
|
for (var i = 0; i < words.length; i++) {
|
||||||
|
var word = new RegExp(words[i].replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), "i");
|
||||||
|
if (tr.innerHTML.search(word) == -1) {
|
||||||
|
tr.classList.add('hidden');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
searchControl.addEventListener('keyup', filterTable);
|
||||||
|
searchControl.addEventListener('search', filterTable);
|
||||||
|
})();
|
@ -166,6 +166,10 @@ table, .table {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.bold {
|
||||||
|
@include font-family(secondary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tbody th {
|
tbody th {
|
||||||
@ -175,6 +179,14 @@ table, .table {
|
|||||||
&.admin-edit {
|
&.admin-edit {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-scroller {
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
@ -376,6 +388,7 @@ input {
|
|||||||
|
|
||||||
.number-field,
|
.number-field,
|
||||||
.email-field,
|
.email-field,
|
||||||
|
.search-field,
|
||||||
.telephone-field,
|
.telephone-field,
|
||||||
.password-field,
|
.password-field,
|
||||||
.text-field {
|
.text-field {
|
||||||
@ -449,6 +462,7 @@ input {
|
|||||||
.email-field,
|
.email-field,
|
||||||
.password-field,
|
.password-field,
|
||||||
.telephone-field,
|
.telephone-field,
|
||||||
|
.search-field,
|
||||||
.text-field,
|
.text-field,
|
||||||
.text-area-field {
|
.text-area-field {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
@ -336,9 +336,7 @@ class ConferencesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
when :stats
|
when :stats
|
||||||
if request.format.xlsx?
|
|
||||||
@registrations = ConferenceRegistration.where(:conference_id => @this_conference.id).sort { |a,b| (a.user.present? ? (a.user.firstname || '') : '').downcase <=> (b.user.present? ? (b.user.firstname || '') : '').downcase }
|
@registrations = ConferenceRegistration.where(:conference_id => @this_conference.id).sort { |a,b| (a.user.present? ? (a.user.firstname || '') : '').downcase <=> (b.user.present? ? (b.user.firstname || '') : '').downcase }
|
||||||
logger.info "Generating stats.xls"
|
|
||||||
@excel_data = {
|
@excel_data = {
|
||||||
columns: [
|
columns: [
|
||||||
:name,
|
:name,
|
||||||
@ -420,11 +418,14 @@ class ConferencesController < ApplicationController
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if request.format.xlsx?
|
||||||
|
logger.info "Generating stats.xls"
|
||||||
return respond_to do | format |
|
return respond_to do | format |
|
||||||
format.xlsx { render xlsx: :stats, filename: "stats-#{DateTime.now.strftime('%Y-%m-%d')}" }
|
format.xlsx { render xlsx: :stats, filename: "stats-#{DateTime.now.strftime('%Y-%m-%d')}" }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@registrations = ConferenceRegistration.where(:conference_id => @this_conference.id)
|
# @registrations = ConferenceRegistration.where(:conference_id => @this_conference.id)
|
||||||
@registration_count = @registrations.size
|
@registration_count = @registrations.size
|
||||||
@completed_registrations = 0
|
@completed_registrations = 0
|
||||||
@bikes = 0
|
@bikes = 0
|
||||||
|
@ -1288,6 +1288,10 @@ module ApplicationHelper
|
|||||||
textfield(name, value, options.merge({type: :number}))
|
textfield(name, value, options.merge({type: :number}))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def searchfield(name, value, options = {})
|
||||||
|
textfield(name, value, options.merge({type: :search}))
|
||||||
|
end
|
||||||
|
|
||||||
def emailfield(name, value, options = {})
|
def emailfield(name, value, options = {})
|
||||||
textfield(name, value, options.merge({type: :email}))
|
textfield(name, value, options.merge({type: :email}))
|
||||||
end
|
end
|
||||||
@ -1345,7 +1349,7 @@ module ApplicationHelper
|
|||||||
when :phone
|
when :phone
|
||||||
input_options[:autocomplete] = 'tel'
|
input_options[:autocomplete] = 'tel'
|
||||||
when :paypal_email_address, :paypal_username, :paypal_password, :paypal_signature
|
when :paypal_email_address, :paypal_username, :paypal_password, :paypal_signature
|
||||||
input_options[:autocomplete] = 'false'
|
input_options[:autocomplete] = 'off'
|
||||||
end
|
end
|
||||||
|
|
||||||
case options[:type]
|
case options[:type]
|
||||||
@ -1358,6 +1362,7 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
html += select_tag(name, option_list, input_options)
|
html += select_tag(name, option_list, input_options)
|
||||||
else
|
else
|
||||||
|
input_options[:autocomplete] = 'off' if options[:type] == :search
|
||||||
html += send("#{(options[:type] || :text).to_s}_field_tag", name, value, input_options)
|
html += send("#{(options[:type] || :text).to_s}_field_tag", name, value, input_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1544,8 +1549,6 @@ module ApplicationHelper
|
|||||||
format 'td.bold', font_name: 'Calibri', fg_color: '333333', b: true
|
format 'td.bold', font_name: 'Calibri', fg_color: '333333', b: true
|
||||||
end
|
end
|
||||||
|
|
||||||
key = excel_data[:key] || 'excel.columns'
|
|
||||||
|
|
||||||
content_tag(:table) do
|
content_tag(:table) do
|
||||||
(content_tag(:thead) do
|
(content_tag(:thead) do
|
||||||
content_tag(:tr, excel_header_columns(excel_data))
|
content_tag(:tr, excel_header_columns(excel_data))
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
- add_inline_script :registrations
|
||||||
.details
|
.details
|
||||||
= data_set(:h4, 'articles.admin.stats.headings.completed_registrations') do
|
= data_set(:h4, 'articles.admin.stats.headings.completed_registrations') do
|
||||||
= (@completed_registrations || 0).to_s
|
= (@completed_registrations || 0).to_s
|
||||||
@ -18,3 +19,10 @@
|
|||||||
.actions
|
.actions
|
||||||
= link_to (_'links.download.Excel'), administration_step_path(@this_conference.slug, :stats, :format => :xlsx), class: [:button, :download]
|
= link_to (_'links.download.Excel'), administration_step_path(@this_conference.slug, :stats, :format => :xlsx), class: [:button, :download]
|
||||||
= link_to (_'links.download.Organizations_Excel'), administration_step_path(@this_conference.slug, :organizations, :format => :xlsx), class: [:button, :download, :subdued]
|
= link_to (_'links.download.Organizations_Excel'), administration_step_path(@this_conference.slug, :organizations, :format => :xlsx), class: [:button, :download, :subdued]
|
||||||
|
%h4 Registrations
|
||||||
|
= searchfield :search, nil, big: true
|
||||||
|
.table-scroller
|
||||||
|
%table.registrations.admin-edit
|
||||||
|
%thead
|
||||||
|
%tr=excel_header_columns(@excel_data)
|
||||||
|
%tbody#search-rows=excel_rows(@excel_data)
|
||||||
|
@ -8,4 +8,4 @@ Rails.application.config.assets.version = '1.0'
|
|||||||
|
|
||||||
# Precompile additional assets.
|
# Precompile additional assets.
|
||||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||||
Rails.application.config.assets.precompile += %w( user-mailer.css map.js pen.js time.js editor.js markdown.js html2canvas.js main.js housing.js schedule.js favicon.ico )
|
Rails.application.config.assets.precompile += %w( user-mailer.css map.js pen.js time.js editor.js markdown.js html2canvas.js main.js registrations.js housing.js schedule.js favicon.ico )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user