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) {
|
||||
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 positionLabel = function(input) {
|
||||
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 {
|
||||
@ -175,6 +179,14 @@ table, .table {
|
||||
&.admin-edit {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
tr.hidden {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.table-scroller {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.table {
|
||||
@ -376,6 +388,7 @@ input {
|
||||
|
||||
.number-field,
|
||||
.email-field,
|
||||
.search-field,
|
||||
.telephone-field,
|
||||
.password-field,
|
||||
.text-field {
|
||||
@ -449,6 +462,7 @@ input {
|
||||
.email-field,
|
||||
.password-field,
|
||||
.telephone-field,
|
||||
.search-field,
|
||||
.text-field,
|
||||
.text-area-field {
|
||||
text-align: left;
|
||||
|
@ -336,9 +336,7 @@ class ConferencesController < ApplicationController
|
||||
end
|
||||
end
|
||||
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 }
|
||||
logger.info "Generating stats.xls"
|
||||
@excel_data = {
|
||||
columns: [
|
||||
:name,
|
||||
@ -420,11 +418,14 @@ class ConferencesController < ApplicationController
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if request.format.xlsx?
|
||||
logger.info "Generating stats.xls"
|
||||
return respond_to do | format |
|
||||
format.xlsx { render xlsx: :stats, filename: "stats-#{DateTime.now.strftime('%Y-%m-%d')}" }
|
||||
end
|
||||
else
|
||||
@registrations = ConferenceRegistration.where(:conference_id => @this_conference.id)
|
||||
# @registrations = ConferenceRegistration.where(:conference_id => @this_conference.id)
|
||||
@registration_count = @registrations.size
|
||||
@completed_registrations = 0
|
||||
@bikes = 0
|
||||
|
@ -1288,6 +1288,10 @@ module ApplicationHelper
|
||||
textfield(name, value, options.merge({type: :number}))
|
||||
end
|
||||
|
||||
def searchfield(name, value, options = {})
|
||||
textfield(name, value, options.merge({type: :search}))
|
||||
end
|
||||
|
||||
def emailfield(name, value, options = {})
|
||||
textfield(name, value, options.merge({type: :email}))
|
||||
end
|
||||
@ -1345,7 +1349,7 @@ module ApplicationHelper
|
||||
when :phone
|
||||
input_options[:autocomplete] = 'tel'
|
||||
when :paypal_email_address, :paypal_username, :paypal_password, :paypal_signature
|
||||
input_options[:autocomplete] = 'false'
|
||||
input_options[:autocomplete] = 'off'
|
||||
end
|
||||
|
||||
case options[:type]
|
||||
@ -1358,6 +1362,7 @@ module ApplicationHelper
|
||||
end
|
||||
html += select_tag(name, option_list, input_options)
|
||||
else
|
||||
input_options[:autocomplete] = 'off' if options[:type] == :search
|
||||
html += send("#{(options[:type] || :text).to_s}_field_tag", name, value, input_options)
|
||||
end
|
||||
|
||||
@ -1544,8 +1549,6 @@ module ApplicationHelper
|
||||
format 'td.bold', font_name: 'Calibri', fg_color: '333333', b: true
|
||||
end
|
||||
|
||||
key = excel_data[:key] || 'excel.columns'
|
||||
|
||||
content_tag(:table) do
|
||||
(content_tag(:thead) do
|
||||
content_tag(:tr, excel_header_columns(excel_data))
|
||||
|
@ -1,3 +1,4 @@
|
||||
- add_inline_script :registrations
|
||||
.details
|
||||
= data_set(:h4, 'articles.admin.stats.headings.completed_registrations') do
|
||||
= (@completed_registrations || 0).to_s
|
||||
@ -18,3 +19,10 @@
|
||||
.actions
|
||||
= 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]
|
||||
%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.
|
||||
# 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