Before Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 131 KiB |
After Width: | Height: | Size: 320 B |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 255 B |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 389 B |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 390 B |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 286 B |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 584 B |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 762 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 676 B |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 459 B |
After Width: | Height: | Size: 582 B |
After Width: | Height: | Size: 290 B |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 377 B |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 423 B |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 272 B |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 519 B |
After Width: | Height: | Size: 858 KiB |
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 308 B |
After Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 470 B After Width: | Height: | Size: 470 B |
After Width: | Height: | Size: 972 B |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 1.0 KiB |
@ -1,115 +1,130 @@ |
|||||
(function() { |
(function() { |
||||
var pens = {}; |
var pens = {}; |
||||
|
|
||||
Array.prototype.forEach.call(document.querySelectorAll('.textarea'), function(editor) { |
Array.prototype.forEach.call(document.querySelectorAll('.textarea'), function(editor) { |
||||
var event= editor.dataset.editOn; |
var event= editor.dataset.editOn; |
||||
if (event == 'load') { |
if (event == 'load') { |
||||
startEditing(editor); |
startEditing(editor); |
||||
} else { |
} else { |
||||
editor.addEventListener(event, function() { |
editor.addEventListener(event, function() { |
||||
if (editor.getAttribute('contenteditable') !== 'true') { |
if (editor.getAttribute('contenteditable') !== 'true') { |
||||
startEditing(editor); |
startEditing(editor); |
||||
// for content editable, we need to refocus to show the caret
|
// for content editable, we need to refocus to show the caret
|
||||
editor.blur(); |
editor.blur(); |
||||
editor.focus(); |
editor.focus(); |
||||
} |
} |
||||
}); |
}); |
||||
} |
} |
||||
}); |
}); |
||||
|
|
||||
function startEditing(editor) { |
function startEditing(editor) { |
||||
var name = editor.dataset.name; |
var name = editor.dataset.name; |
||||
pens[name] = new Pen({ |
pens[name] = new Pen({ |
||||
editor: editor, |
editor: editor, |
||||
class: 'pen', |
class: 'pen', |
||||
textarea: '<textarea name="' + name + '"></textarea>', |
textarea: '<textarea name="' + name + '"></textarea>', |
||||
list: ['p', 'h1', 'h2', 'blockquote', 'insertorderedlist', 'insertunorderedlist', 'bold', 'italic', 'underline', 'strikethrough', 'createlink', 'insertimage'], |
list: ['p', 'h1', 'h2', 'blockquote', 'insertorderedlist', 'insertunorderedlist', 'bold', 'italic', 'underline', 'strikethrough', 'createlink', 'insertimage'], |
||||
title: { |
title: { |
||||
'p': 'Paragraph', |
'p': 'Paragraph', |
||||
'h1': 'Major Heading', |
'h1': 'Major Heading', |
||||
'h2': 'Minor Heading', |
'h2': 'Minor Heading', |
||||
'blockquote': 'Quotation', |
'blockquote': 'Quotation', |
||||
'insertorderedlist': 'Ordered List', |
'insertorderedlist': 'Ordered List', |
||||
'insertunorderedlist': 'Unordered List', |
'insertunorderedlist': 'Unordered List', |
||||
'bold': 'Bold', |
'bold': 'Bold', |
||||
'italic': 'Italic', |
'italic': 'Italic', |
||||
'underline': 'Underline', |
'underline': 'Underline', |
||||
'strikethrough': 'Strikethrough', |
'strikethrough': 'Strikethrough', |
||||
'createlink': 'Link', |
'createlink': 'Link', |
||||
'insertimage': 'Image' |
'insertimage': 'Image' |
||||
} |
} |
||||
}); |
}); |
||||
return pens[name]; |
return pens[name]; |
||||
} |
} |
||||
|
|
||||
Array.prototype.forEach.call(document.querySelectorAll('form'), function(form) { |
Array.prototype.forEach.call(document.querySelectorAll('form'), function(form) { |
||||
var shouldAllowAlert = false; |
var shouldAllowAlert = false; |
||||
form.addEventListener('submit', function() { |
form.addEventListener('submit', function() { |
||||
if (shouldAllowAlert) { |
if (shouldAllowAlert) { |
||||
return; |
return; |
||||
} |
} |
||||
Array.prototype.forEach.call(document.querySelectorAll('.textarea'), function(editor) { |
Array.prototype.forEach.call(document.querySelectorAll('.textarea'), function(editor) { |
||||
var name = editor.dataset.name; |
var name = editor.dataset.name; |
||||
var textarea = document.querySelector('textarea[name="' + name + '"]'); |
var textarea = document.querySelector('textarea[name="' + name + '"]'); |
||||
if (!textarea) { |
if (!textarea) { |
||||
textarea = document.createElement('textarea'); |
textarea = document.createElement('textarea'); |
||||
textarea.name = name; |
textarea.name = name; |
||||
textarea.style.display = 'none'; |
textarea.style.display = 'none'; |
||||
form.appendChild(textarea); |
form.appendChild(textarea); |
||||
} |
} |
||||
textarea.value = editor.innerHTML; |
textarea.value = editor.innerHTML; |
||||
if (pens[name]) { |
if (pens[name]) { |
||||
pens[name].destroy(); |
pens[name].destroy(); |
||||
} |
} |
||||
}); |
}); |
||||
}, false); |
}, false); |
||||
Array.prototype.forEach.call(form.querySelectorAll('button'), function(button) { |
Array.prototype.forEach.call(form.querySelectorAll('button'), function(button) { |
||||
form.addEventListener('click', function(event) { |
form.addEventListener('click', function(event) { |
||||
shouldAllowAlert = (event.target.value === 'cancel'); |
shouldAllowAlert = (event.target.value === 'cancel'); |
||||
}); |
}); |
||||
}); |
}); |
||||
}); |
}); |
||||
|
|
||||
Array.prototype.forEach.call(document.querySelectorAll('.check-box-field .other input'), function(input) { |
Array.prototype.forEach.call(document.querySelectorAll('.check-box-field .other input'), function(input) { |
||||
var checkbox = document.getElementById(input.parentElement.parentElement.attributes.for.value); |
var checkbox = document.getElementById(input.parentElement.parentElement.attributes.for.value); |
||||
input.addEventListener('keyup', function(event) { |
input.addEventListener('keyup', function(event) { |
||||
if (event.target.value) { |
if (event.target.value) { |
||||
checkbox.checked = true; |
checkbox.checked = true; |
||||
} |
} |
||||
}); |
}); |
||||
input.addEventListener('click', function(event) { |
input.addEventListener('click', function(event) { |
||||
checkbox.checked = true; |
checkbox.checked = true; |
||||
}); |
}); |
||||
var setRequired = function() { |
var setRequired = function() { |
||||
if (checkbox.checked) { |
if (checkbox.checked) { |
||||
input.setAttribute('required', 'required'); |
input.setAttribute('required', 'required'); |
||||
} else { |
} else { |
||||
input.removeAttribute('required'); |
input.removeAttribute('required'); |
||||
} |
} |
||||
}; |
}; |
||||
Array.prototype.forEach.call(document.querySelectorAll('.check-box-field input'), function(_input) { |
Array.prototype.forEach.call(document.querySelectorAll('.check-box-field input'), function(_input) { |
||||
_input.addEventListener('change', function(event) { setRequired(); }); |
_input.addEventListener('change', function(event) { setRequired(); }); |
||||
}); |
}); |
||||
}); |
}); |
||||
|
|
||||
Array.prototype.forEach.call(document.querySelectorAll('[data-toggles]'), function(checkbox) { |
Array.prototype.forEach.call(document.querySelectorAll('[data-toggles]'), function(checkbox) { |
||||
var toggles = document.getElementById(checkbox.dataset.toggles); |
var toggles = document.getElementById(checkbox.dataset.toggles); |
||||
toggles.classList.add('toggleable'); |
toggles.classList.add('toggleable'); |
||||
var form = checkbox.parentNode; |
var form = checkbox.parentNode; |
||||
while (form && form.nodeName != 'FORM') { |
while (form && form.nodeName != 'FORM') { |
||||
form = form.parentNode; |
form = form.parentNode; |
||||
} |
} |
||||
var toggle = function() { |
var toggle = function() { |
||||
toggles.classList[checkbox.checked ? 'add' : 'remove']('open'); |
toggles.classList[checkbox.checked ? 'add' : 'remove']('open'); |
||||
if (form) { |
if (form) { |
||||
if (checkbox.checked) { |
if (checkbox.checked) { |
||||
form.removeAttribute('novalidate'); |
form.removeAttribute('novalidate'); |
||||
} else { |
} else { |
||||
form.setAttribute('novalidate', 'novalidate'); |
form.setAttribute('novalidate', 'novalidate'); |
||||
} |
} |
||||
} |
} |
||||
}; |
}; |
||||
toggle(); |
toggle(); |
||||
checkbox.addEventListener('change', function(event) { toggle(); }); |
checkbox.addEventListener('change', function(event) { toggle(); }); |
||||
}); |
}); |
||||
|
|
||||
|
Array.prototype.forEach.call(document.querySelectorAll('fieldset.translator'), function(translator) { |
||||
|
Array.prototype.forEach.call(translator.querySelectorAll('.locale-select a'), function(selector) { |
||||
|
selector.addEventListener('click', function(event) { |
||||
|
event.preventDefault(); |
||||
|
var locale = event.target.parentElement.getAttribute('data-locale'); |
||||
|
Array.prototype.forEach.call(translator.querySelectorAll('.locale-select li'), function(_selector) { |
||||
|
_selector.className = _selector.getAttribute('data-locale') == locale ? 'selected' : ''; |
||||
|
}); |
||||
|
Array.prototype.forEach.call(translator.querySelectorAll('.text-editors li'), function(editor) { |
||||
|
editor.className = editor.getAttribute('data-locale') == locale ? 'selected' : ''; |
||||
|
}); |
||||
|
}); |
||||
|
}); |
||||
|
}); |
||||
})(); |
})(); |
||||
|
@ -0,0 +1,31 @@ |
|||||
|
(function() { |
||||
|
document.addEventListener('DOMContentLoaded', function() { |
||||
|
var fields = document.getElementsByClassName('file-field'); |
||||
|
for (var i = 0; i < fields.length; i++) { |
||||
|
var field = fields[i]; |
||||
|
var input = field.getElementsByTagName('input')[0]; |
||||
|
var image = field.getElementsByTagName('img')[0]; |
||||
|
var state = field.getElementsByClassName('file-field-name')[0]; |
||||
|
|
||||
|
input.onchange = function() { |
||||
|
state.className = 'file-field-name selected'; |
||||
|
state.innerHTML = this.value.split(/[\/\\]/).reverse()[0]; |
||||
|
var uploadButton = this.form.querySelector('[value="upload"]'); |
||||
|
if (uploadButton) { |
||||
|
uploadButton.setAttribute('data-enabled', '1'); |
||||
|
} |
||||
|
|
||||
|
if (this.files && this.files[0] && typeof FileReader !== "undefined") { |
||||
|
var reader = new FileReader(); |
||||
|
|
||||
|
reader.onload = function (e) { |
||||
|
image.className = 'changed'; |
||||
|
image.src = e.target.result; |
||||
|
}; |
||||
|
|
||||
|
reader.readAsDataURL(this.files[0]); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, false); |
||||
|
})(); |
@ -0,0 +1,117 @@ |
|||||
|
(function() { |
||||
|
function loadMap() { |
||||
|
var projection = d3.geo.mercator(); |
||||
|
var path = d3.geo.path().projection(projection); |
||||
|
var tooltip = document.getElementById('tooltip'); |
||||
|
|
||||
|
var initialScale = 3.5; |
||||
|
var initialPosition = [-100, -175]; |
||||
|
|
||||
|
var zoom = d3.behavior.zoom() |
||||
|
.scaleExtent([1, 20]) |
||||
|
.scale(initialScale).translate(initialPosition) |
||||
|
.on("zoom", function() { |
||||
|
setZoom(d3.event.translate, d3.event.scale); |
||||
|
}); |
||||
|
|
||||
|
function setZoom(translate, scale) { |
||||
|
container.attr("transform", "translate(" + translate + ") scale(" + scale + ")").attr('data-scale', scale); |
||||
|
} |
||||
|
|
||||
|
var container = d3.select('#map').call(zoom).insert('g', ':first-child').attr('class', 'map'); |
||||
|
|
||||
|
setZoom(initialPosition, initialScale); |
||||
|
|
||||
|
container.append("path") |
||||
|
.datum(d3.geo.graticule()) |
||||
|
.attr("class", "graticule") |
||||
|
.attr("d", path); |
||||
|
|
||||
|
d3.selection.prototype.moveToFront = function() { |
||||
|
return this.each(function(){ |
||||
|
this.parentNode.appendChild(this); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
d3.json('/assets/world-110m.json', function(error, world) { |
||||
|
if (error) { |
||||
|
throw error; |
||||
|
} |
||||
|
|
||||
|
container.selectAll('path') |
||||
|
.data(topojson.feature(world, world.objects.countries).features) |
||||
|
.enter() |
||||
|
.append('path') |
||||
|
.attr('d', path) |
||||
|
.attr('class', 'country'); |
||||
|
|
||||
|
var year = (new Date()).getFullYear(); |
||||
|
var conferences = document.querySelectorAll('#conferences .conference'); |
||||
|
var conference_path = [] |
||||
|
|
||||
|
for (var i = 0; i < conferences.length; i++) { |
||||
|
var d = conferences[i]; |
||||
|
if (d.getAttribute('data-t') === 'annual') { |
||||
|
var coords = projection([d.getAttribute('data-o'), d.getAttribute('data-a')]); |
||||
|
if (conference_path.length) { |
||||
|
conference_path[conference_path.length - 1].x2 = coords[0]; |
||||
|
conference_path[conference_path.length - 1].y2 = coords[1]; |
||||
|
} |
||||
|
conference_path.push({ |
||||
|
x1: coords[0], |
||||
|
y1: coords[1] |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
container.append('defs').html('<filter id="svg-gooey-filter"><feGaussianBlur in="SourceGraphic" stdDeviation="3" result="blur"></feGaussianBlur><feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -7" result="svg-gooey-filter"></feColorMatrix><feComposite in="SourceGraphic" in2="svg-gooey-filter" operator="atop"></feComposite></filter>') |
||||
|
|
||||
|
var regionalConferences = container.append('g').attr('filter', 'url(#svg-gooey-filter)').attr('class', 'cities regional-conferences'); |
||||
|
var annualConferences = container.append('g').attr('filter', 'url(#svg-gooey-filter)').attr('class', 'cities annual-conferences'); |
||||
|
|
||||
|
function mouseover(e) { |
||||
|
c = document.getElementById('conference-' + event.target.getAttribute('data-c')); |
||||
|
tooltip.innerHTML = '<h3>' + c.querySelector('.title').innerHTML + '</h3>' + |
||||
|
'<div class="conference-details">' + c.querySelector('.conference-details').innerHTML + '</div>'; |
||||
|
tooltip.className = 'open'; |
||||
|
} |
||||
|
|
||||
|
function mouseout(e) { |
||||
|
tooltip.className = ''; |
||||
|
} |
||||
|
|
||||
|
function click(e) { |
||||
|
l = document.querySelector('#conference-' + event.target.getAttribute('data-c') + ' .conference-link'); |
||||
|
window.location.href = l.getAttribute('href'); |
||||
|
} |
||||
|
|
||||
|
for (var i = conferences.length - 1; i >= 0; i--) { |
||||
|
var c = conferences[i]; |
||||
|
var type = c.getAttribute('data-t'); |
||||
|
var coords = projection([c.getAttribute('data-o'), c.getAttribute('data-a')]); |
||||
|
|
||||
|
(type === 'annual' ? annualConferences : regionalConferences) |
||||
|
.append('circle') |
||||
|
.attr('class', 'city type-' + type) |
||||
|
.attr('data-c', c.id.replace(/^conference\-/, '')) |
||||
|
.attr('cx', function(d) { return coords[0]; }) |
||||
|
.attr('cy', function(d) { return coords[1]; }) |
||||
|
.attr('r', Math.max(3, |
||||
|
(15 - ( |
||||
|
(year - parseInt(c.getAttribute('data-y'))) * 2.5)) * 1.125) |
||||
|
) |
||||
|
.on('mouseover', mouseover) |
||||
|
.on('mouseout', mouseout) |
||||
|
.on('click', click); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
d3.select("#map").attr('class', 'loaded'); |
||||
|
} |
||||
|
|
||||
|
document.onreadystatechange = function () { |
||||
|
if (document.readyState == 'complete') { |
||||
|
loadMap(); |
||||
|
} |
||||
|
}; |
||||
|
})(); |
@ -0,0 +1,26 @@ |
|||||
|
(function() { |
||||
|
function find_user(email, f) { |
||||
|
var request = new XMLHttpRequest(); |
||||
|
request.open('POST', '/user/find', true); |
||||
|
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8'); |
||||
|
request.setRequestHeader('X-CSRF-Token', encodeURI(document.querySelector('meta[name="csrf-token"]').getAttribute('content'))); |
||||
|
request.send('e=' + encodeURI(email)); |
||||
|
request.onreadystatechange = function() { |
||||
|
if (request.readyState == 4) { |
||||
|
if (request.status == 200) { |
||||
|
f(JSON.parse(request.responseText)); |
||||
|
} else { |
||||
|
f({error: request.status}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
document.addEventListener('DOMContentLoaded', function() { |
||||
|
var fields = document.getElementsByClassName('user-field'); |
||||
|
for (var i = 0; i < fields.length; i++) { |
||||
|
var field = fields[i]; |
||||
|
var input = field.getElementsByTagName('input')[0]; |
||||
|
var name = field.getElementsByClassName('user-name')[0]; |
||||
|
} |
||||
|
}, false); |
||||
|
})(); |
@ -0,0 +1,36 @@ |
|||||
|
require 'geocoder/calculations' |
||||
|
|
||||
|
class AdminController < ApplicationController |
||||
|
def new |
||||
|
return do_404 unless logged_in? && current_user.administrator? |
||||
|
@this_conference = Conference.new |
||||
|
@page_title = 'articles.conferences.headings.new' |
||||
|
end |
||||
|
|
||||
|
def edit |
||||
|
return do_404 unless logged_in? && current_user.administrator? |
||||
|
@this_conference = Conference.find_by!(slug: params[:slug]) |
||||
|
@page_title = 'articles.conferences.headings.edit' |
||||
|
render 'new' |
||||
|
end |
||||
|
|
||||
|
def save |
||||
|
conference = params[:id].present? ? Conference.find_by!(id: params[:id]) : Conference.new |
||||
|
|
||||
|
if params[:button] == 'save' |
||||
|
city = City.search(params[:city]) |
||||
|
conference.city_id = city.id |
||||
|
conference.conferencetype = params[:type] |
||||
|
conference.year = params[:year].to_i |
||||
|
conference.is_public = params[:is_public].present? |
||||
|
conference.is_featured = params[:is_featured].present? |
||||
|
conference.make_slug(true) |
||||
|
conference.save! |
||||
|
elsif params[:button] == 'delete' |
||||
|
conference.destroy |
||||
|
return redirect_to conferences_url |
||||
|
end |
||||
|
|
||||
|
redirect_to conference_url(conference.slug) |
||||
|
end |
||||
|
end |
@ -0,0 +1,355 @@ |
|||||
|
|
||||
|
class WorkshopsController < ApplicationController |
||||
|
def workshops |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
@workshops = Workshop.where(:conference_id => @this_conference.id) |
||||
|
@my_workshops = Workshop.joins(:workshop_facilitators).where(:workshop_facilitators => {:user_id => current_user.id}, :conference_id => @this_conference.id) |
||||
|
render 'workshops/index' |
||||
|
end |
||||
|
|
||||
|
def view_workshop |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
@workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id) |
||||
|
return do_404 unless @workshop |
||||
|
|
||||
|
@translations_available_for_editing = [] |
||||
|
I18n.backend.enabled_locales.each do |locale| |
||||
|
@translations_available_for_editing << locale if @workshop.can_translate?(current_user, locale) |
||||
|
end |
||||
|
@page_title = 'page_titles.conferences.View_Workshop' |
||||
|
@register_template = :workshops |
||||
|
|
||||
|
render 'workshops/show' |
||||
|
end |
||||
|
|
||||
|
def create_workshop |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
@workshop = Workshop.new |
||||
|
@languages = [I18n.locale.to_sym] |
||||
|
@needs = [] |
||||
|
@page_title = 'page_titles.conferences.Create_Workshop' |
||||
|
@register_template = :workshops |
||||
|
render 'workshops/new' |
||||
|
end |
||||
|
|
||||
|
def translate_workshop |
||||
|
@is_translating = true |
||||
|
@translation = params[:locale] |
||||
|
@page_title = 'page_titles.conferences.Translate_Workshop' |
||||
|
@page_title_vars = { language: view_context.language_name(@translation) } |
||||
|
@register_template = :workshops |
||||
|
|
||||
|
edit_workshop |
||||
|
end |
||||
|
|
||||
|
def edit_workshop |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
@workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id) |
||||
|
|
||||
|
return do_404 unless @workshop.present? |
||||
|
|
||||
|
@page_title ||= 'page_titles.conferences.Edit_Workshop' |
||||
|
|
||||
|
@can_edit = @workshop.can_edit?(current_user) |
||||
|
|
||||
|
@is_translating ||= false |
||||
|
if @is_translating |
||||
|
return do_404 if @translation.to_s == @workshop.locale.to_s || !I18n.backend.enabled_locales.include?(@translation.to_s) |
||||
|
return do_403 unless @workshop.can_translate?(current_user, @translation) |
||||
|
|
||||
|
@title = @workshop._title(@translation) |
||||
|
@info = @workshop._info(@translation) |
||||
|
else |
||||
|
return do_403 unless @can_edit |
||||
|
|
||||
|
@title = @workshop.title |
||||
|
@info = @workshop.info |
||||
|
end |
||||
|
|
||||
|
@needs = JSON.parse(@workshop.needs || '[]').map &:to_sym |
||||
|
@languages = JSON.parse(@workshop.languages || '[]').map &:to_sym |
||||
|
@space = @workshop.space.to_sym if @workshop.space |
||||
|
@theme = @workshop.theme.to_sym if @workshop.theme |
||||
|
@notes = @workshop.notes |
||||
|
@register_template = :workshops |
||||
|
|
||||
|
render 'workshops/new' |
||||
|
end |
||||
|
|
||||
|
def delete_workshop |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
@workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id) |
||||
|
|
||||
|
return do_404 unless @workshop.present? |
||||
|
return do_403 unless @workshop.can_delete?(current_user) |
||||
|
|
||||
|
if request.post? |
||||
|
if params[:button] == 'confirm' |
||||
|
if @workshop |
||||
|
@workshop.workshop_facilitators.destroy_all |
||||
|
@workshop.destroy |
||||
|
end |
||||
|
|
||||
|
return redirect_to register_step_path(@this_conference.slug, 'workshops') |
||||
|
end |
||||
|
return redirect_to view_workshop_url(@this_conference.slug, @workshop.id) |
||||
|
end |
||||
|
@register_template = :workshops |
||||
|
|
||||
|
render 'workshops/delete' |
||||
|
end |
||||
|
|
||||
|
def save_workshop |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
|
||||
|
if params[:button].to_sym != :save |
||||
|
if params[:workshop_id].present? |
||||
|
return redirect_to view_workshop_url(@this_conference.slug, params[:workshop_id]) |
||||
|
end |
||||
|
return redirect_to register_step_path(@this_conference.slug, 'workshops') |
||||
|
end |
||||
|
|
||||
|
if params[:workshop_id].present? |
||||
|
workshop = Workshop.find(params[:workshop_id]) |
||||
|
return do_404 unless workshop.present? |
||||
|
can_edit = workshop.can_edit?(current_user) |
||||
|
else |
||||
|
workshop = Workshop.new(:conference_id => @this_conference.id) |
||||
|
workshop.workshop_facilitators = [WorkshopFacilitator.new(:user_id => current_user.id, :role => :creator)] |
||||
|
can_edit = true |
||||
|
end |
||||
|
|
||||
|
title = params[:title] |
||||
|
info = params[:info].gsub(/^\s*(.*?)\s*$/, '\1') |
||||
|
|
||||
|
if params[:translation].present? && workshop.can_translate?(current_user, params[:translation]) |
||||
|
old_title = workshop._title(params[:translation]) |
||||
|
old_info = workshop._info(params[:translation]) |
||||
|
|
||||
|
do_save = false |
||||
|
|
||||
|
unless title == old_title |
||||
|
workshop.set_column_for_locale(:title, params[:translation], title, current_user.id) |
||||
|
do_save = true |
||||
|
end |
||||
|
unless info == old_info |
||||
|
workshop.set_column_for_locale(:info, params[:translation], info, current_user.id) |
||||
|
do_save = true |
||||
|
end |
||||
|
|
||||
|
# only save if the text has changed, if we want to make sure only to update the translator id if necessary |
||||
|
workshop.save_translations if do_save |
||||
|
elsif can_edit |
||||
|
workshop.title = title |
||||
|
workshop.info = info |
||||
|
workshop.languages = (params[:languages] || {}).keys.to_json |
||||
|
workshop.needs = (params[:needs] || {}).keys.to_json |
||||
|
workshop.theme = params[:theme] == 'other' ? params[:other_theme] : params[:theme] |
||||
|
workshop.space = params[:space] |
||||
|
workshop.notes = params[:notes] |
||||
|
workshop.needs_facilitators = params[:needs_facilitators].present? |
||||
|
workshop.save |
||||
|
|
||||
|
# Rouge nil facilitators have been know to be created, just destroy them here now |
||||
|
WorkshopFacilitator.where(:user_id => nil).destroy_all |
||||
|
else |
||||
|
return do_403 |
||||
|
end |
||||
|
|
||||
|
redirect_to view_workshop_url(@this_conference.slug, workshop.id) |
||||
|
end |
||||
|
|
||||
|
def toggle_workshop_interest |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id) |
||||
|
return do_404 unless workshop |
||||
|
|
||||
|
# save the current state |
||||
|
interested = workshop.interested? current_user |
||||
|
# remove all associated fields |
||||
|
WorkshopInterest.delete_all(:workshop_id => workshop.id, :user_id => current_user.id) |
||||
|
|
||||
|
# creat the new interest row if we weren't interested before |
||||
|
WorkshopInterest.create(:workshop_id => workshop.id, :user_id => current_user.id) unless interested |
||||
|
|
||||
|
if request.xhr? |
||||
|
render json: [ |
||||
|
{ |
||||
|
selector: '.interest-button', |
||||
|
html: view_context.interest_button(workshop) |
||||
|
}, |
||||
|
{ |
||||
|
selector: '.interest-text', |
||||
|
html: view_context.interest_text(workshop) |
||||
|
} |
||||
|
] |
||||
|
else |
||||
|
# go back to the workshop |
||||
|
redirect_to view_workshop_url(@this_conference.slug, workshop.id) |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
def facilitate_workshop |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
@workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id) |
||||
|
return do_404 unless @workshop |
||||
|
return do_403 if @workshop.facilitator?(current_user) || !current_user |
||||
|
|
||||
|
@register_template = :workshops |
||||
|
render 'workshops/facilitate' |
||||
|
end |
||||
|
|
||||
|
def facilitate_request |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id) |
||||
|
return do_404 unless workshop |
||||
|
return do_403 if workshop.facilitator?(current_user) || !current_user |
||||
|
|
||||
|
# create the request by making the user a facilitator but making their role 'requested' |
||||
|
WorkshopFacilitator.create(user_id: current_user.id, workshop_id: workshop.id, role: :requested) |
||||
|
|
||||
|
UserMailer.send_mail :workshop_facilitator_request do |
||||
|
{ |
||||
|
:args => [ workshop, current_user, params[:message] ] |
||||
|
} |
||||
|
end |
||||
|
|
||||
|
redirect_to sent_facilitate_workshop_url(@this_conference.slug, workshop.id) |
||||
|
end |
||||
|
|
||||
|
def sent_facilitate_request |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
@workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id) |
||||
|
return do_404 unless @workshop |
||||
|
return do_403 unless @workshop.requested_collaborator?(current_user) |
||||
|
|
||||
|
@register_template = :workshops |
||||
|
render 'workshops/facilitate_request_sent' |
||||
|
end |
||||
|
|
||||
|
def approve_facilitate_request |
||||
|
return do_403 unless logged_in? |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id) |
||||
|
return do_404 unless workshop.present? |
||||
|
|
||||
|
user_id = params[:user_id].to_i |
||||
|
action = params[:approve_or_deny].to_sym |
||||
|
user = User.find(user_id) |
||||
|
case action |
||||
|
when :approve |
||||
|
if workshop.active_facilitator?(current_user) && workshop.requested_collaborator?(User.find(user_id)) |
||||
|
f = WorkshopFacilitator.find_by_workshop_id_and_user_id( |
||||
|
workshop.id, user_id) |
||||
|
f.role = :collaborator |
||||
|
f.save |
||||
|
UserMailer.send_mail :workshop_facilitator_request_approved, user.locale do |
||||
|
[ workshop, user ] |
||||
|
end |
||||
|
return redirect_to view_workshop_url(@this_conference.slug, workshop.id) |
||||
|
end |
||||
|
when :deny |
||||
|
if workshop.active_facilitator?(current_user) && workshop.requested_collaborator?(User.find(user_id)) |
||||
|
WorkshopFacilitator.delete_all( |
||||
|
:workshop_id => workshop.id, |
||||
|
:user_id => user_id) |
||||
|
UserMailer.send_mail :workshop_facilitator_request_denied, user.locale do |
||||
|
[ workshop, user ] |
||||
|
end |
||||
|
return redirect_to view_workshop_url(@this_conference.slug, workshop.id) |
||||
|
end |
||||
|
when :remove |
||||
|
if workshop.can_remove?(current_user, user) |
||||
|
WorkshopFacilitator.delete_all( |
||||
|
:workshop_id => workshop.id, |
||||
|
:user_id => user_id) |
||||
|
return redirect_to view_workshop_url(@this_conference.slug, workshop.id) |
||||
|
end |
||||
|
when :switch_ownership |
||||
|
if workshop.creator?(current_user) |
||||
|
f = WorkshopFacilitator.find_by_workshop_id_and_user_id( |
||||
|
workshop.id, current_user.id) |
||||
|
f.role = :collaborator |
||||
|
f.save |
||||
|
f = WorkshopFacilitator.find_by_workshop_id_and_user_id( |
||||
|
workshop.id, user_id) |
||||
|
f.role = :creator |
||||
|
f.save |
||||
|
return redirect_to view_workshop_url(@this_conference.slug, workshop.id) |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
return do_403 |
||||
|
end |
||||
|
|
||||
|
def add_workshop_facilitator |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
|
||||
|
user = User.find_by_email(params[:email]) |
||||
|
|
||||
|
# create the user if they don't exist and send them a link to register |
||||
|
unless user |
||||
|
user = User.create(email: params[:email]) |
||||
|
generate_confirmation(user, register_path(@this_conference.slug)) |
||||
|
end |
||||
|
|
||||
|
workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id) |
||||
|
|
||||
|
return do_404 unless workshop && current_user |
||||
|
|
||||
|
unless workshop.facilitator?(user) |
||||
|
WorkshopFacilitator.create(user_id: user.id, workshop_id: workshop.id, role: :collaborator) |
||||
|
|
||||
|
UserMailer.send_mail :workshop_facilitator_request_approved, user.locale do |
||||
|
[ workshop, user ] |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
return redirect_to view_workshop_url(@this_conference.slug, params[:workshop_id]) |
||||
|
end |
||||
|
|
||||
|
def add_comment |
||||
|
set_conference |
||||
|
set_conference_registration! |
||||
|
workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id) |
||||
|
|
||||
|
return do_404 unless workshop && current_user |
||||
|
|
||||
|
if params[:button] == 'reply' |
||||
|
comment = Comment.find_by!(id: params[:comment_id].to_i, model_type: :workshops, model_id: workshop.id) |
||||
|
new_comment = comment.add_comment(current_user, params[:reply]) |
||||
|
|
||||
|
unless comment.user.id == current_user.id |
||||
|
UserMailer.send_mail :workshop_comment, comment.user.locale do |
||||
|
[ workshop, new_comment, comment.user ] |
||||
|
end |
||||
|
end |
||||
|
elsif params[:button] = 'add_comment' |
||||
|
new_comment = workshop.add_comment(current_user, params[:comment]) |
||||
|
|
||||
|
workshop.active_facilitators.each do | u | |
||||
|
unless u.id == current_user.id |
||||
|
UserMailer.send_mail :workshop_comment, u.locale do |
||||
|
[ workshop, new_comment, u ] |
||||
|
end |
||||
|
end |
||||
|
end |
||||
|
else |
||||
|
return do_404 |
||||
|
end |
||||
|
|
||||
|
return redirect_to view_workshop_url(@this_conference.slug, workshop.id, anchor: "comment-#{new_comment.id}") |
||||
|
end |
||||
|
end |
@ -1,180 +1,180 @@ |
|||||
require 'diffy' |
require 'diffy' |
||||
|
|
||||
class UserMailer < ActionMailer::Base |
class UserMailer < ActionMailer::Base |
||||
add_template_helper(ApplicationHelper) |
add_template_helper(ApplicationHelper) |
||||
include LinguaFrancaHelper |
include LinguaFrancaHelper |
||||
|
|
||||
before_filter :set_host |
before_filter :set_host |
||||
|
|
||||
default from: "Bike!Bike! <noreply@bikebike.org>" |
default from: "Bike!Bike! <noreply@bikebike.org>" |
||||
|
|
||||
def email_confirmation(confirmation) |
def email_confirmation(confirmation) |
||||
@confirmation = EmailConfirmation.find(confirmation) if confirmation.present? |
@confirmation = EmailConfirmation.find(confirmation) if confirmation.present? |
||||
I18n.locale = @confirmation.user.locale if @confirmation.user.locale.present? |
I18n.locale = @confirmation.user.locale if @confirmation.user.locale.present? |
||||
@subject = _'email.subject.confirm_email','Please confirm your email address' |
@subject = _'email.subject.confirm_email','Please confirm your email address' |
||||
mail to: @confirmation.user.named_email, subject: @subject |
mail to: @confirmation.user.named_email, subject: @subject |
||||
end |
end |
||||
|
|
||||
def registration_confirmation(registration) |
def registration_confirmation(registration) |
||||
@registration = ConferenceRegistration.find(registration) if registration.present? |
@registration = ConferenceRegistration.find(registration) if registration.present? |
||||
@conference = @registration.conference |
@conference = @registration.conference |
||||
@user = @registration.user |
@user = @registration.user |
||||
I18n.locale = @user.locale if @user.locale.present? |
I18n.locale = @user.locale if @user.locale.present? |
||||
@subject = @conference.registration_status.to_sym == :pre ? |
@subject = @conference.registration_status.to_sym == :pre ? |
||||
_( |
_( |
||||
'email.subject.pre_registration_confirmed', |
'email.subject.pre_registration_confirmed', |
||||
"Thank you for pre-registering for #{@conference.title}", |
"Thank you for pre-registering for #{@conference.title}", |
||||
:vars => {:conference_title => @conference.title} |
:vars => {:conference_title => @conference.title} |
||||
) : _( |
) : _( |
||||
'email.subject.registration_confirmed', |
'email.subject.registration_confirmed', |
||||
"Thank you for registering for #{@conference.title}", |
"Thank you for registering for #{@conference.title}", |
||||
:vars => {:conference_title => @conference.title} |
:vars => {:conference_title => @conference.title} |
||||
) |
) |
||||
mail to: @user.named_email, subject: @subject |
mail to: @user.named_email, subject: @subject |
||||
end |
end |
||||
|
|
||||
def broadcast(host, subject, content, user, conference) |
def broadcast(host, subject, content, user, conference) |
||||
@host = host |
@host = host |
||||
@content = content |
@content = content |
||||
@banner = nil |
@banner = nil |
||||
@conference = Conference.find(conference) if conference.present? |
@conference = Conference.find(conference) if conference.present? |
||||
@user = User.find(user) if user.present? |
@user = User.find(user) if user.present? |
||||
@subject = "[#{@conference ? @conference.title : 'Bike!Bike!'}] #{subject}" |
@subject = "[#{@conference ? @conference.title : 'Bike!Bike!'}] #{subject}" |
||||
if @user && @user.named_email |
if @user && @user.named_email |
||||
mail to: @user.named_email, subject: @subject |
mail to: @user.named_email, subject: @subject |
||||
end |
end |
||||
end |
end |
||||
|
|
||||
def workshop_facilitator_request(workshop, requester, message) |
def workshop_facilitator_request(workshop, requester, message) |
||||
@workshop = Workshop.find(workshop) if workshop.present? |
@workshop = Workshop.find(workshop) if workshop.present? |
||||
@requester = User.find(requester) if requester.present? |
@requester = User.find(requester) if requester.present? |
||||
addresses = [] |
addresses = [] |
||||
I18n.locale = @workshop.active_facilitators.first.locale if @workshop.active_facilitators.first.locale.present? |
I18n.locale = @workshop.active_facilitators.first.locale if @workshop.active_facilitators.first.locale.present? |
||||
@workshop.active_facilitators.each do |f| |
@workshop.active_facilitators.each do |f| |
||||
addresses << f.named_email |
addresses << f.named_email |
||||
end |
end |
||||
@message = message |
@message = message |
||||
@conference = Conference.find(@workshop.conference_id) |
@conference = Conference.find(@workshop.conference_id) |
||||
@subject = _('email.subject.workshop_facilitator_request', |
@subject = _('email.subject.workshop_facilitator_request', |
||||
"Request to facilitate #{@workshop.title} from #{@requester.name}", |
"Request to facilitate #{@workshop.title} from #{@requester.name}", |
||||
:vars => {:workshop_title => @workshop.title, :requester_name => @requester.firstname}) |
:vars => {:workshop_title => @workshop.title, :requester_name => @requester.firstname}) |
||||
mail to: addresses, reply_to: addresses + [@requester.named_email], subject: @subject |
mail to: addresses, reply_to: addresses + [@requester.named_email], subject: @subject |
||||
end |
end |
||||
|
|
||||
def workshop_facilitator_request_approved(workshop, user) |
def workshop_facilitator_request_approved(workshop, user) |
||||
@workshop = Workshop.find(workshop) if workshop.present? |
@workshop = Workshop.find(workshop) if workshop.present? |
||||
@conference = Conference.find(@workshop.conference_id) |
@conference = Conference.find(@workshop.conference_id) |
||||
@user = User.find(user) if user.present? |
@user = User.find(user) if user.present? |
||||
I18n.locale = @user.locale if @user.locale.present? |
I18n.locale = @user.locale if @user.locale.present? |
||||
@subject = (_'email.subject.workshop_request_approved', |
@subject = (_'email.subject.workshop_request_approved', |
||||
"You have been added as a facilitator of #{@workshop.title}", |
"You have been added as a facilitator of #{@workshop.title}", |
||||
:vars => {:workshop_title => @workshop.title}) |
:vars => {:workshop_title => @workshop.title}) |
||||
mail to: @user.named_email, subject: @subject |
mail to: @user.named_email, subject: @subject |
||||
end |
end |
||||
|
|
||||
def workshop_facilitator_request_denied(workshop, user) |
def workshop_facilitator_request_denied(workshop, user) |
||||
@workshop = Workshop.find(workshop) if workshop.present? |
@workshop = Workshop.find(workshop) if workshop.present? |
||||
@conference = @workshop.conference |
@conference = @workshop.conference |
||||
@user = User.find(user) if user.present? |
@user = User.find(user) if user.present? |
||||
I18n.locale = @user.locale if @user.present? && @user.locale.present? |
I18n.locale = @user.locale if @user.present? && @user.locale.present? |
||||
@subject = (_'email.subject.workshop_request_denied', |
@subject = (_'email.subject.workshop_request_denied', |
||||
"Your request to facilitate #{@workshop.title} has been denied", |
"Your request to facilitate #{@workshop.title} has been denied", |
||||
:vars => {:workshop_title => @workshop.title}) |
:vars => {:workshop_title => @workshop.title}) |
||||
mail to: @user.named_email, subject: @subject |
mail to: @user.named_email, subject: @subject |
||||
end |
end |
||||
|
|
||||
def workshop_translated(workshop, data, locale, user, translator) |
def workshop_translated(workshop, data, locale, user, translator) |
||||
@workshop = Workshop.find(workshop) if workshop.present? |
@workshop = Workshop.find(workshop) if workshop.present? |
||||
@data = data |
@data = data |
||||
@locale = locale |
@locale = locale |
||||
@locale_name = language_name(locale) |
@locale_name = language_name(locale) |
||||
@user = User.find(user) if user.present? |
@user = User.find(user) if user.present? |
||||
I18n.locale = @user.locale if @user.present? && @user.locale.present? |
I18n.locale = @user.locale if @user.present? && @user.locale.present? |
||||
@translator = User.find(translator) if translator.present? |
@translator = User.find(translator) if translator.present? |
||||
@subject = (_'email.subject.workshop_translated', |
@subject = (_'email.subject.workshop_translated', |
||||
"The #{@locale_name} translation for #{@workshop.title} has been modified", |
"The #{@locale_name} translation for #{@workshop.title} has been modified", |
||||
vars: {language: @language_name, workshop_title: @workshop.title}) |
vars: {language: @language_name, workshop_title: @workshop.title}) |
||||
|
|
||||
@wrapper_id = :full_width |
@wrapper_id = :full_width |
||||
|
|
||||
mail to: @user.named_email, subject: @subject |
mail to: @user.named_email, subject: @subject |
||||
end |
end |
||||
|
|
||||
def workshop_original_content_changed(workshop, data, user, translator) |
def workshop_original_content_changed(workshop, data, user, translator) |
||||
@workshop = Workshop.find(workshop) if workshop.present? |
@workshop = Workshop.find(workshop) if workshop.present? |
||||
@data = data |
@data = data |
||||
@user = User.find(user) if user.present? |
@user = User.find(user) if user.present? |
||||
I18n.locale = @user.locale if @user.present? && @user.locale.present? |
I18n.locale = @user.locale if @user.present? && @user.locale.present? |
||||
@translator = User.find(translator) if translator.present? |
@translator = User.find(translator) if translator.present? |
||||
@subject = (_'email.subject.workshop_original_content_changed', |
@subject = (_'email.subject.workshop_original_content_changed', |
||||
"Original content for #{@workshop.title} has been modified", |
"Original content for #{@workshop.title} has been modified", |
||||
vars: {workshop_title: @workshop.title}) |
vars: {workshop_title: @workshop.title}) |
||||
@data.each do |field, values| |
@data.each do |field, values| |
||||
diff = Diffy::Diff.new(values[:old], values[:new]) |
diff = Diffy::Diff.new(values[:old], values[:new]) |
||||
@data[field][:diff] = { |
@data[field][:diff] = { |
||||
text: diff.to_s(:text), |
text: diff.to_s(:text), |
||||
html: diff.to_s(:html) |
html: diff.to_s(:html) |
||||
} |
} |
||||
end |
end |
||||
|
|
||||
@wrapper_id = :full_width |
@wrapper_id = :full_width |
||||
|
|
||||
mail to: @user.named_email, subject: @subject |
mail to: @user.named_email, subject: @subject |
||||
end |
end |
||||
|
|
||||
def workshop_comment(workshop, comment, user) |
def workshop_comment(workshop, comment, user) |
||||
@workshop = Workshop.find(workshop) if workshop.present? |
@workshop = Workshop.find(workshop) if workshop.present? |
||||
@comment = Comment.find(comment) if comment.present? |
@comment = Comment.find(comment) if comment.present? |
||||
@user = User.find(user) if user.present? |
@user = User.find(user) if user.present? |
||||
I18n.locale = @user.locale if @user.present? && @user.locale.present? |
I18n.locale = @user.locale if @user.present? && @user.locale.present? |
||||
|
|
||||
if @comment.reply? |
if @comment.reply? |
||||
@subject = (_'email.subject.workshop_comment.reply', vars: { user_name: @comment.user.name }) |
@subject = (_'email.subject.workshop_comment.reply', vars: { user_name: @comment.user.name }) |
||||
else |
else |
||||
@subject = (_'email.subject.workshop_comment.comment', vars: { user_name: @comment.user.name, workshop_title: @workshop.title }) |
@subject = (_'email.subject.workshop_comment.comment', vars: { user_name: @comment.user.name, workshop_title: @workshop.title }) |
||||
end |
end |
||||
|
|
||||
mail to: @user.named_email, subject: @subject |
mail to: @user.named_email, subject: @subject |
||||
end |
end |
||||
|
|
||||
def error_report(subject, message, report, exception, request, params, user, time = nil) |
def error_report(subject, message, report, exception, request, params, user, time = nil) |
||||
@subject = subject |
@subject = subject |
||||
@message = message |
@message = message |
||||
@report = report |
@report = report |
||||
@exception = exception |
@exception = exception |
||||
@request = request |
@request = request |
||||
@params = params |
@params = params |
||||
@time = time |
@time = time |
||||
@user = User.find(user) if user.present? |
@user = User.find(user) if user.present? |
||||
mail to: 'goodgodwin@hotmail.com', subject: @subject |
mail to: 'goodgodwin@hotmail.com', subject: @subject |
||||
end |
end |
||||
|
|
||||
def contact(from, subject, message, email_list) |
def contact(from, subject, message, email_list) |
||||
@message = message |
@message = message |
||||
@subject = subject |
@subject = subject |
||||
@from = from.is_a?(Integer) ? User.find(from) : from |
@from = from.is_a?(Integer) ? User.find(from) : from |
||||
|
|
||||
mail to: email_list.join(', '), subject: @subject, reply_to: @from.is_a?(User) ? @from.named_email : @from |
mail to: email_list.join(', '), subject: @subject, reply_to: @from.is_a?(User) ? @from.named_email : @from |
||||
end |
end |
||||
|
|
||||
def contact_details(from, subject, message, request, params) |
def contact_details(from, subject, message, request, params) |
||||
@message = message |
@message = message |
||||
@subject = "Details for: \"#{subject}\"" |
@subject = "Details for: \"#{subject}\"" |
||||
@from = from.is_a?(Integer) ? User.find(from) : from |
@from = from.is_a?(Integer) ? User.find(from) : from |
||||
@request = request |
@request = request |
||||
@params = params |
@params = params |
||||
|
|
||||
mail to: 'goodgodwin@hotmail.com', subject: @subject |
mail to: 'goodgodwin@hotmail.com', subject: @subject |
||||
end |
end |
||||
|
|
||||
private |
private |
||||
def set_host(*args) |
def set_host(*args) |
||||
if Rails.env.production? |
if Rails.env.production? |
||||
@host = "https://#{I18n.locale.to_s}.bikebike.org" |
@host = "https://#{I18n.locale.to_s}.bikebike.org" |
||||
elsif Rails.env.preview? |
elsif Rails.env.preview? |
||||
@host = "https://preview-#{I18n.locale.to_s}.bikebike.org" |
@host = "https://preview-#{I18n.locale.to_s}.bikebike.org" |
||||
else |
else |
||||
@host = UserMailer.default_url_options[:host] |
@host = UserMailer.default_url_options[:host] |
||||
end |
end |
||||
end |
end |
||||
end |
end |
||||
|
@ -0,0 +1,77 @@ |
|||||
|
require 'geocoder' |
||||
|
require 'geocoder/railtie' |
||||
|
require 'geocoder/calculations' |
||||
|
|
||||
|
Geocoder::Railtie.insert |
||||
|
|
||||
|
class City < ActiveRecord::Base |
||||
|
geocoded_by :address |
||||
|
translates :city |
||||
|
|
||||
|
reverse_geocoded_by :latitude, :longitude, :address => :full_address |
||||
|
after_validation :geocode, if: ->(obj){ obj.country_changed? or obj.territory_changed? or obj.city_changed? or obj.latitude.blank? or obj.longitude.blank? } |
||||
|
|
||||
|
def address |
||||
|
([city!, territory, country] - [nil, '']).join(', ') |
||||
|
end |
||||
|
|
||||
|
def get_translation(locale) |
||||
|
location = Geocoder.search(address, language: locale.to_s).first |
||||
|
|
||||
|
location.data['address_components'].each do | component | |
||||
|
if component['types'].first == 'locality' |
||||
|
return component['short_name'] |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
return nil |
||||
|
end |
||||
|
|
||||
|
def translate_city(locale) |
||||
|
translation = get_translation(locale) |
||||
|
set_column_for_locale(:city, locale, translation) |
||||
|
save! |
||||
|
|
||||
|
return translation |
||||
|
end |
||||
|
|
||||
|
def self.search(str) |
||||
|
cache = CityCache.search(str) |
||||
|
|
||||
|
# return the city if this search is in our cache |
||||
|
return cache.city if cache.present? |
||||
|
|
||||
|
# look up the city in the geocoder |
||||
|
location = Geocoder.search(str, language: 'en').first |
||||
|
|
||||
|
# see if the city is already present in our database |
||||
|
city = City.find_by_place_id(location.data['place_id']) |
||||
|
|
||||
|
# return the city if we found it in the db already |
||||
|
return city if city.present? |
||||
|
|
||||
|
# otherwise build a new city |
||||
|
component_alises = { |
||||
|
'locality' => :city, |
||||
|
'administrative_area_level_1' => :territory, |
||||
|
'country' => :country |
||||
|
} |
||||
|
city_data = { |
||||
|
locale: :en, |
||||
|
latitude: location.data['geometry']['location']['lat'], |
||||
|
longitude: location.data['geometry']['location']['lng'], |
||||
|
place_id: location.data['place_id'] |
||||
|
} |
||||
|
location.data['address_components'].each do | component | |
||||
|
property = component_alises[component['types'].first] |
||||
|
city_data[property] = component['short_name'] if property.present? |
||||
|
end |
||||
|
|
||||
|
# save the new city |
||||
|
city = City.new(city_data) |
||||
|
city.save! |
||||
|
|
||||
|
# and return it |
||||
|
return city |
||||
|
end |
||||
|
end |
@ -0,0 +1,9 @@ |
|||||
|
class CityCache < ActiveRecord::Base |
||||
|
self.table_name = :city_cache |
||||
|
|
||||
|
belongs_to :city |
||||
|
|
||||
|
def self.search(str) |
||||
|
CityCache.find_by_search(str.downcase) |
||||
|
end |
||||
|
end |
@ -1,71 +1,136 @@ |
|||||
class Conference < ActiveRecord::Base |
class Conference < ActiveRecord::Base |
||||
translates :info, :title, :payment_message |
translates :info, :title, :payment_message |
||||
|
|
||||
mount_uploader :cover, CoverUploader |
mount_uploader :cover, CoverUploader |
||||
mount_uploader :poster, PosterUploader |
mount_uploader :poster, PosterUploader |
||||
|
|
||||
belongs_to :conference_type |
belongs_to :conference_type |
||||
|
belongs_to :city |
||||
has_many :conference_host_organizations, :dependent => :destroy |
|
||||
has_many :organizations, :through => :conference_host_organizations |
has_many :conference_host_organizations, dependent: :destroy |
||||
has_many :event_locations |
has_many :organizations, through: :conference_host_organizations |
||||
|
has_many :conference_administrators, dependent: :destroy |
||||
#has_many :conference_registration_form_fields, :order => 'position ASC', :dependent => :destroy#, :class_name => '::ConferenceRegistrationFormField' |
has_many :administrators, through: :conference_administrators, source: :user |
||||
#has_many :registration_form_fields, :through => :conference_registration_form_fields |
has_many :event_locations |
||||
|
|
||||
has_many :workshops |
has_many :workshops |
||||
|
|
||||
accepts_nested_attributes_for :conference_host_organizations, :reject_if => proc {|u| u[:organization_id].blank?}, :allow_destroy => true |
accepts_nested_attributes_for :conference_host_organizations, reject_if: proc {|u| u[:organization_id].blank?}, allow_destroy: true |
||||
|
|
||||
def to_param |
before_create :make_slug |
||||
slug |
|
||||
end |
def to_param |
||||
|
slug |
||||
def host?(user) |
end |
||||
return false unless user.present? |
|
||||
organizations.each do |o| |
def host_organization?(org) |
||||
return true if o.host?(user) |
return false unless org.present? |
||||
end |
org_id = org.is_a?(Organization) ? org.id : org |
||||
return false |
|
||||
end |
organizations.each do |o| |
||||
|
return true if o.id = org_id |
||||
def url(action = :show) |
end |
||||
path(action) |
|
||||
end |
return false |
||||
|
end |
||||
def path(action = :show) |
|
||||
action = action.to_sym |
def host?(user) |
||||
'/conferences/' + conference_type.slug + '/' + slug + (action == :show ? '' : '/' + action.to_s) |
if user.present? |
||||
end |
return true if user.administrator? |
||||
|
|
||||
def location |
conference_administrators.each do |u| |
||||
organizations.first.location |
return true if user.id == u.id |
||||
end |
end |
||||
|
|
||||
def registered?(user) |
organizations.each do |o| |
||||
registration = ConferenceRegistration.find_by(:user_id => user.id, :conference_id => id) |
return true if o.host?(user) |
||||
return registration ? registration.is_attending : false |
end |
||||
end |
end |
||||
|
return false |
||||
def registration_exists?(user) |
end |
||||
ConferenceRegistration.find_by(:user_id => user.id, :conference_id => id).present? |
|
||||
end |
def url(action = :show) |
||||
|
path(action) |
||||
def registration_open |
end |
||||
registration_status == :open |
|
||||
end |
def path(action = :show) |
||||
|
action = action.to_sym |
||||
def registration_status |
'/conferences/' + conference_type.slug + '/' + slug + (action == :show ? '' : '/' + action.to_s) |
||||
s = read_attribute(:registration_status) |
end |
||||
s.present? ? s.to_sym : nil |
|
||||
end |
def location |
||||
|
return nil unless organizations.present? |
||||
def registration_status=(new_registration_status) |
organizations.first.location |
||||
write_attribute :registration_status, new_registration_status.to_s |
end |
||||
end |
|
||||
|
def registered?(user) |
||||
def self.default_payment_amounts |
registration = ConferenceRegistration.find_by(:user_id => user.id, :conference_id => id) |
||||
[25, 50, 100] |
return registration ? registration.is_attending : false |
||||
end |
end |
||||
|
|
||||
|
def registration_exists?(user) |
||||
|
ConferenceRegistration.find_by(:user_id => user.id, :conference_id => id).present? |
||||
|
end |
||||
|
|
||||
|
def registration_open |
||||
|
registration_status == :open |
||||
|
end |
||||
|
|
||||
|
def registration_status |
||||
|
s = read_attribute(:registration_status) |
||||
|
s.present? ? s.to_sym : nil |
||||
|
end |
||||
|
|
||||
|
def registration_status=(new_registration_status) |
||||
|
write_attribute :registration_status, new_registration_status.to_s |
||||
|
end |
||||
|
|
||||
|
def make_slug(reset = false) |
||||
|
if reset |
||||
|
self.slug = nil |
||||
|
end |
||||
|
|
||||
|
self.slug ||= Conference.generate_slug( |
||||
|
conferencetype || :annual, |
||||
|
conference_year, |
||||
|
city_name.gsub(/\s/, '') |
||||
|
) |
||||
|
end |
||||
|
|
||||
|
def city_name |
||||
|
return city.city if city.present? |
||||
|
return location.present? ? location.city : nil |
||||
|
end |
||||
|
|
||||
|
def conference_year |
||||
|
self.year || (end_date.present? ? end_date.year : nil) |
||||
|
end |
||||
|
|
||||
|
def over? |
||||
|
return false unless end_date.present? |
||||
|
return end_date < DateTime.now |
||||
|
end |
||||
|
|
||||
|
def self.default_payment_amounts |
||||
|
[25, 50, 100] |
||||
|
end |
||||
|
|
||||
|
def self.conference_types |
||||
|
{ |
||||
|
annual: '%{city}%{year}', |
||||
|
n: 'North%{year}', |
||||
|
s: 'South%{year}', |
||||
|
e: 'East%{year}', |
||||
|
w: 'West%{year}', |
||||
|
ne: 'Northeast%{year}', |
||||
|
nw: 'Northwest%{year}', |
||||
|
se: 'Southeast%{year}', |
||||
|
sw: 'Southwest%{year}' |
||||
|
} |
||||
|
end |
||||
|
|
||||
|
def self.generate_slug(type, year, city) |
||||
|
Conference.conference_types[(type || :annual).to_sym].gsub('%{city}', city).gsub('%{year}', year.to_s) |
||||
|
end |
||||
|
|
||||
end |
end |
||||
|
@ -0,0 +1,4 @@ |
|||||
|
class ConferenceAdministrator < ActiveRecord::Base |
||||
|
belongs_to :user |
||||
|
belongs_to :conference |
||||
|
end |
@ -1,58 +1,58 @@ |
|||||
class ConferenceRegistration < ActiveRecord::Base |
class ConferenceRegistration < ActiveRecord::Base |
||||
belongs_to :conference |
belongs_to :conference |
||||
belongs_to :user |
belongs_to :user |
||||
has_many :conference_registration_responses |
has_many :conference_registration_responses |
||||
|
|
||||
AttendingOptions = [:yes, :no] |
AttendingOptions = [:yes, :no] |
||||
|
|
||||
def languages |
def languages |
||||
user.languages |
user.languages |
||||
end |
end |
||||
|
|
||||
def self.all_housing_options |
def self.all_housing_options |
||||
[:none, :tent, :house] |
[:none, :tent, :house] |
||||
end |
end |
||||
|
|
||||
def self.all_spaces |
def self.all_spaces |
||||
[:bed_space, :floor_space, :tent_space] |
[:bed_space, :floor_space, :tent_space] |
||||
end |
end |
||||
|
|
||||
def self.all_bike_options |
def self.all_bike_options |
||||
[:yes, :no] |
[:yes, :no] |
||||
end |
end |
||||
|
|
||||
def self.all_food_options |
def self.all_food_options |
||||
[:meat, :vegetarian, :vegan] |
[:meat, :vegetarian, :vegan] |
||||
end |
end |
||||
|
|
||||
def self.all_considerations |
def self.all_considerations |
||||
[:vegan, :smoking, :pets, :quiet] |
[:vegan, :smoking, :pets, :quiet] |
||||
end |
end |
||||
|
|
||||
def status(was = false) |
def status(was = false) |
||||
return :unregistered if user.firstname.blank? || self.send(was ? :city_was : :city).blank? |
return :unregistered if user.nil? || user.firstname.blank? || self.send(was ? :city_was : :city).blank? |
||||
return :registered if self.send(was ? :housing_was : :housing).present? || (self.send(was ? :can_provide_housing_was : :can_provide_housing) && (self.send(was ? :housing_data_was : :housing_data) || {})['availability'].present?) |
return :registered if self.send(was ? :housing_was : :housing).present? || (self.send(was ? :can_provide_housing_was : :can_provide_housing) && (self.send(was ? :housing_data_was : :housing_data) || {})['availability'].present?) |
||||
return :preregistered |
return :preregistered |
||||
end |
end |
||||
|
|
||||
around_update :check_status |
around_update :check_status |
||||
|
|
||||
def check_status |
def check_status |
||||
yield |
yield |
||||
|
|
||||
old_status = status(true) |
old_status = status(true) |
||||
new_status = status |
new_status = status |
||||
|
|
||||
if old_status.present? && old_status != new_status |
if old_status.present? && old_status != new_status |
||||
if (conference.registration_status == :pre && new_status == :preregistered) || |
if (conference.registration_status == :pre && new_status == :preregistered) || |
||||
(conference.registration_status == :open && new_status == :registered) |
(conference.registration_status == :open && new_status == :registered) |
||||
|
|
||||
UserMailer.send_mail :registration_confirmation do |
UserMailer.send_mail :registration_confirmation do |
||||
{ |
{ |
||||
:args => self |
:args => self |
||||
} |
} |
||||
end |
end |
||||
end |
end |
||||
end |
end |
||||
end |
end |
||||
end |
end |
||||
|
@ -1,20 +1,20 @@ |
|||||
class Event < ActiveRecord::Base |
class Event < ActiveRecord::Base |
||||
translates :info, :title |
translates :info, :title |
||||
|
|
||||
belongs_to :conference |
belongs_to :conference |
||||
belongs_to :event_location |
belongs_to :event_location |
||||
|
|
||||
def conference_day |
def conference_day |
||||
return nil unless start_time.present? && end_time.present? |
return nil unless start_time.present? && end_time.present? |
||||
|
|
||||
start_day = conference.start_date.change(hour: 0, minute: 0, second: 0) |
start_day = conference.start_date.change(hour: 0, minute: 0, second: 0) |
||||
w_start_day = start_time.change(hour: 0, minute: 0, second: 0) |
w_start_day = start_time.change(hour: 0, minute: 0, second: 0) |
||||
return (((w_start_day - start_day) / 86400) + 1).to_i |
return (((w_start_day - start_day) / 86400) + 1).to_i |
||||
end |
end |
||||
|
|
||||
def duration |
def duration |
||||
return nil unless start_time.present? && end_time.present? |
return nil unless start_time.present? && end_time.present? |
||||
((end_time - start_time) / 60).to_i |
((end_time - start_time) / 60).to_i |
||||
end |
end |
||||
|
|
||||
end |
end |
||||
|
@ -1,6 +1,6 @@ |
|||||
class LocationsOrganization < ActiveRecord::Base |
class LocationsOrganization < ActiveRecord::Base |
||||
belongs_to :location |
belongs_to :location |
||||
belongs_to :organization |
belongs_to :organization |
||||
|
|
||||
self.primary_key = :location_id |
self.primary_key = :location_id |
||||
end |
end |
||||
|
@ -1,71 +1,77 @@ |
|||||
class Organization < ActiveRecord::Base |
class Organization < ActiveRecord::Base |
||||
mount_uploader :logo, LogoUploader |
mount_uploader :logo, LogoUploader |
||||
mount_uploader :avatar, AvatarUploader |
mount_uploader :avatar, AvatarUploader |
||||
mount_uploader :cover, CoverUploader |
mount_uploader :cover, CoverUploader |
||||
|
|
||||
has_many :locations_organization |
has_many :locations_organization |
||||
has_many :locations, :through => :locations_organization |
has_many :locations, through: :locations_organization |
||||
|
|
||||
has_many :user_organization_relationships, :dependent => :destroy |
has_many :user_organization_relationships, dependent: :destroy |
||||
has_many :users, :through => :user_organization_relationships |
has_many :users, through: :user_organization_relationships |
||||
|
|
||||
accepts_nested_attributes_for :locations, :reject_if => proc {|l| l[id].blank?} |
accepts_nested_attributes_for :locations, :reject_if => proc {|l| l[id].blank?} |
||||
accepts_nested_attributes_for :user_organization_relationships, :reject_if => proc {|u| u[:user_id].blank?}, :allow_destroy => true |
accepts_nested_attributes_for :user_organization_relationships, :reject_if => proc {|u| u[:user_id].blank?}, :allow_destroy => true |
||||
before_create :make_slug |
before_create :make_slug |
||||
|
|
||||
def location |
def location |
||||
locations.first |
locations.first |
||||
end |
end |
||||
|
|
||||
def longitude |
def longitude |
||||
location.longitude |
location.longitude |
||||
end |
end |
||||
|
|
||||
def latitude |
def latitude |
||||
location.latitude |
location.latitude |
||||
end |
end |
||||
|
|
||||
def to_param |
def to_param |
||||
slug |
slug |
||||
end |
end |
||||
|
|
||||
def host?(user) |
def host?(user) |
||||
return false unless user.present? |
return false unless user.present? |
||||
return true if user.administrator? |
return true if user.administrator? |
||||
|
|
||||
users.each do |u| |
users.each do |u| |
||||
return true if u.id == user.id |
return true if u.id == user.id |
||||
end |
end |
||||
return false |
return false |
||||
end |
end |
||||
|
|
||||
def generate_slug(name, location = nil) |
def generate_slug(name, location = nil) |
||||
s = name.gsub(/[^a-z1-9]+/i, '-').chomp('-').gsub(/\-([A-Z])/, '\1') |
s = name.gsub(/[^a-z1-9]+/i, '-').chomp('-').gsub(/\-([A-Z])/, '\1') |
||||
if Organization.find_by(:slug => s).present? && !location.nil? |
if Organization.find_by(:slug => s).present? && !location.nil? |
||||
if location.city.present? |
if location.city.present? |
||||
s += '-' + location.city |
s += '-' + location.city |
||||
end |
end |
||||
if Organization.find_by(:slug => s).present? && location.territory.present? |
if Organization.find_by(:slug => s).present? && location.territory.present? |
||||
s += '-' + location.territory |
s += '-' + location.territory |
||||
end |
end |
||||
if Organization.find_by(:slug => s).present? |
if Organization.find_by(:slug => s).present? |
||||
s += '-' + location.country |
s += '-' + location.country |
||||
end |
end |
||||
end |
end |
||||
attempt = 1 |
attempt = 1 |
||||
ss = s |
ss = s |
||||
|
|
||||
while Organization.find_by(:slug => s) |
while Organization.find_by(:slug => s) |
||||
attempt += 1 |
attempt += 1 |
||||
s = ss + '-' + attempt.to_s |
s = ss + '-' + attempt.to_s |
||||
end |
end |
||||
s |
s |
||||
end |
end |
||||
|
|
||||
private |
def self.find_by_city(city) |
||||
def make_slug |
Organization.joins(:locations).where(locations: { |
||||
if !self.slug |
city_id: city.is_a?(City) ? city.id : city |
||||
self.slug = generate_slug(self.name, self.locations && self.locations[0]) |
}) |
||||
end |
end |
||||
end |
|
||||
|
private |
||||
|
def make_slug |
||||
|
if !self.slug |
||||
|
self.slug = generate_slug(self.name, self.locations && self.locations[0]) |
||||
|
end |
||||
|
end |
||||
end |
end |
||||
|
@ -1,62 +1,67 @@ |
|||||
class User < ActiveRecord::Base |
class User < ActiveRecord::Base |
||||
authenticates_with_sorcery! do |config| |
authenticates_with_sorcery! do |config| |
||||
config.authentications_class = Authentication |
config.authentications_class = Authentication |
||||
end |
end |
||||
|
|
||||
validates :email, uniqueness: true |
validates :email, uniqueness: true |
||||
|
|
||||
mount_uploader :avatar, AvatarUploader |
mount_uploader :avatar, AvatarUploader |
||||
|
|
||||
has_many :user_organization_relationships |
has_many :user_organization_relationships |
||||
has_many :organizations, through: :user_organization_relationships |
has_many :organizations, through: :user_organization_relationships |
||||
has_many :authentications, :dependent => :destroy |
has_many :conferences, through: :conference_administrators |
||||
accepts_nested_attributes_for :authentications |
has_many :authentications, :dependent => :destroy |
||||
|
accepts_nested_attributes_for :authentications |
||||
|
|
||||
before_update do |user| |
before_update do |user| |
||||
user.locale ||= I18n.locale |
user.locale ||= I18n.locale |
||||
end |
end |
||||
|
|
||||
before_save do |user| |
before_save do |user| |
||||
user.locale ||= I18n.locale |
user.locale ||= I18n.locale |
||||
end |
end |
||||
|
|
||||
def can_translate?(to_locale = nil, from_locale = nil) |
def can_translate?(to_locale = nil, from_locale = nil) |
||||
is_translator unless to_locale.present? |
is_translator unless to_locale.present? |
||||
|
|
||||
from_locale = I18n.locale unless from_locale.present? |
from_locale = I18n.locale unless from_locale.present? |
||||
return languages.present? && |
return languages.present? && |
||||
to_locale.to_s != from_locale.to_s && |
to_locale.to_s != from_locale.to_s && |
||||
languages.include?(to_locale.to_s) && |
languages.include?(to_locale.to_s) && |
||||
languages.include?(from_locale.to_s) |
languages.include?(from_locale.to_s) |
||||
end |
end |
||||
|
|
||||
def name |
def name |
||||
firstname || username || email |
firstname || username || email |
||||
end |
end |
||||
|
|
||||
def named_email |
def named_email |
||||
name = firstname || username |
name = firstname || username |
||||
return email unless name |
return email unless name |
||||
return "#{name} <#{email}>" |
return "#{name} <#{email}>" |
||||
end |
end |
||||
|
|
||||
def administrator? |
def administrator? |
||||
role == 'administrator' |
role == 'administrator' |
||||
end |
end |
||||
|
|
||||
def self.AVAILABLE_LANGUAGES |
def self.AVAILABLE_LANGUAGES |
||||
[:en, :es, :fr, :ar] |
[:en, :es, :fr, :ar] |
||||
end |
end |
||||
|
|
||||
def self.get(email) |
def self.get(email) |
||||
user = where(email: email).first |
user = where(email: email).first |
||||
|
|
||||
unless user |
unless user |
||||
user = new(email: email) |
user = new(email: email) |
||||
user.save! |
user.save! |
||||
end |
end |
||||
|
|
||||
|
return user |
||||
|
end |
||||
|
|
||||
return user |
def self.find_user(email) |
||||
end |
User.where('lower(email) = ?', email.downcase).first |
||||
|
end |
||||
|
|
||||
end |
end |
||||
|
@ -1,11 +1,11 @@ |
|||||
class UserOrganizationRelationship < ActiveRecord::Base |
class UserOrganizationRelationship < ActiveRecord::Base |
||||
belongs_to :user |
belongs_to :user |
||||
belongs_to :organization |
belongs_to :organization |
||||
|
|
||||
Administrator = 'administrator' |
Administrator = 'administrator' |
||||
Member = 'member' |
Member = 'member' |
||||
|
|
||||
DefaultRelationship = Member |
DefaultRelationship = Member |
||||
|
|
||||
AllRelationships = [Administrator, Member] |
AllRelationships = [Administrator, Member] |
||||
end |
end |
||||
|
@ -0,0 +1,24 @@ |
|||||
|
- body_class 'banner-bottom' |
||||
|
= render :partial => 'application/header', :locals => {:page_group => :administration, :page_key => 'Administration', :image_file => 'admin.jpg'} |
||||
|
|
||||
|
%article |
||||
|
= row do |
||||
|
= form_tag save_conference_path, class: 'composition' do |
||||
|
= columns(medium: 12) do |
||||
|
%h2=_@page_title, :t |
||||
|
= hidden_field_tag :id, @this_conference.id if @this_conference.id.present? |
||||
|
|
||||
|
= columns(medium: 12) do |
||||
|
= textfield :city, location(@this_conference.city), required: true, big: true |
||||
|
= columns(medium: 12, class: 'flex-column') do |
||||
|
= selectfield :type, @this_conference.conferencetype, Conference.conference_types.keys.map { |k| [(_"forms.options.conferences.types.#{k}"), k]}, required: true, stretch: true |
||||
|
= numberfield :year, @this_conference.conference_year || Date.today.year, required: true |
||||
|
= columns(medium: 6) do |
||||
|
= checkbox :is_public, @this_conference.is_public != false, 'forms.labels.generic.is_public' |
||||
|
= columns(medium: 6) do |
||||
|
= checkbox :is_featured, @this_conference.is_featured != false, 'forms.labels.generic.is_featured' |
||||
|
= columns(medium: 12) do |
||||
|
.actions.next-prev |
||||
|
= button_tag :save, value: :save |
||||
|
- if @this_conference.id.present? |
||||
|
= button_with_confirmation :delete, value: :delete, class: 'delete' |
@ -1,20 +1,20 @@ |
|||||
- content_for :banner do |
- content_for :banner do |
||||
- image = image_path(image_file || 'empty-racks.jpg') |
- image = image_path(image_file || 'empty-racks.jpg') |
||||
- style = nil |
- style = nil |
||||
- cover = nil |
- cover = nil |
||||
- figure = nil |
- figure = nil |
||||
- if capable_of(:css_mixblendmode) |
- if capable_of(:css_mixblendmode) |
||||
- cover = "<div class=\"cover\" style=\"background-image: url(#{image})\"></div>" |
- cover = "<div class=\"cover\" style=\"background-image: url(#{image})\"></div>" |
||||
- else |
- else |
||||
- style = "background-image: url(#{image})" |
- style = "background-image: url(#{image})" |
||||
#header-title.short{style: style} |
#header-title.short{style: style} |
||||
= (render banner_image, {:image => image}) if defined?(banner_image) == "local-variable" |
= (render banner_image, {:image => image}) if defined?(banner_image) == "local-variable" |
||||
= cover.html_safe if cover |
= cover.html_safe if cover |
||||
- if @page_title.present? || defined?(page_group) |
- if @page_title.present? || defined?(page_group) |
||||
- content_for :title do |
- content_for :title do |
||||
=@page_title.present? ? I18n.t(@page_title, @page_title_vars) : I18n.t("page_titles.#{page_group.to_s}.#{page_key.to_s}") |
= I18n.t(@page_title || "page_titles.#{page_group.to_s}.#{page_key.to_s}", @page_title_vars) |
||||
= row do |
= row do |
||||
= columns do |
= columns do |
||||
%h1=_(@main_title || "page_titles.#{page_group.to_s}.#{page_key.to_s}", :t, @main_title_vars) |
%h1=_(@main_title || "page_titles.#{page_group.to_s}.#{page_key.to_s}", :t, @main_title_vars || (@page_title_vars.present? && @page_title.blank? ? { vars: @page_title_vars } : nil)) |
||||
- content_for :og_image do |
- content_for :og_image do |
||||
= image |
= image |
||||
|
@ -1,17 +1,5 @@ |
|||||
- this_is_the_front_page |
- content_for :og_image do |
||||
- if @conference |
= @conference.poster.full.url || image_path('default_poster.jpg') |
||||
= render 'conferences/header' |
- if @conferences |
||||
%article |
- @conferences.each do | conference | |
||||
= row do |
= render 'conferences/conference', conference: conference, links: [ :read_more, :register ] |
||||
= columns(medium: 10, push: {medium: 1}) do |
|
||||
%h2=_!@conference.title |
|
||||
= richtext @conference.info |
|
||||
- if @conference.registration_status == :open |
|
||||
- if @conference.workshop_schedule_published |
|
||||
- add_inline_script :home_schedule |
|
||||
%h3=_'articles.workshops.headings.Schedule' |
|
||||
= render 'conferences/admin/schedule' |
|
||||
- else |
|
||||
%h3=_'articles.workshops.headings.Proposed_Workshops' |
|
||||
%p=_'articles.workshops.paragraphs.Proposed_Workshops' |
|
||||
= render 'workshops/workshop_previews', :workshops => (@conference.workshops.sort { |a, b| a.title.downcase <=> b.title.downcase }) |
|
||||
|
@ -1,25 +1,25 @@ |
|||||
= render :partial => 'application/header', :locals => {:image_file => @banner_image || 'grafitti.jpg'} |
= render :partial => 'application/header', :locals => {:image_file => @banner_image || 'grafitti.jpg'} |
||||
%article |
%article |
||||
= row do |
= row do |
||||
= columns do |
= columns do |
||||
- if logged_in? |
- if logged_in? |
||||
%h2=_'articles.user_settings.headings.Your_Account' |
%h2=_'articles.user_settings.headings.Your_Account' |
||||
- if @conference.present? && (@conference.registration_status == :pre || @conference.registration_status == :open) |
- if @conference.present? && (@conference.registration_status == :pre || @conference.registration_status == :open) |
||||
%p=_'articles.user_settings.paragraphs.conference_registration', :t |
%p=_'articles.user_settings.paragraphs.conference_registration', :t |
||||
= link_to (_'actions.conference.edit_registration'), register_path(@conference.slug), class: :button |
= link_to (_'actions.conference.edit_registration'), register_path(@conference.slug), class: :button |
||||
- if @conferences.present? |
- if @conferences.present? |
||||
%h3=_'articles.user_settings.headings.Your_Conferences' |
%h3=_'articles.user_settings.headings.Your_Conferences' |
||||
.link-dump |
.link-dump |
||||
- @conferences.each do | conference | |
- @conferences.each do | conference | |
||||
= link_to (_!conference.title), administration_step_path(conference.slug, :edit), class: :button |
= link_to (_!conference.title), administration_step_path(conference.slug, :edit), class: :button |
||||
|
|
||||
= form_tag update_settings_path do |
= form_tag update_settings_path do |
||||
= textfield :name, current_user.name, required: true, heading: 'articles.conference_registration.headings.name', big: true |
= textfield :name, current_user.name, required: true, heading: 'articles.conference_registration.headings.name', big: true |
||||
= checkboxes :languages, User.AVAILABLE_LANGUAGES, current_user.languages || [I18n.locale], 'languages', heading: 'articles.conference_registration.headings.languages' |
= checkboxes :languages, User.AVAILABLE_LANGUAGES, current_user.languages || [I18n.locale], 'languages', heading: 'articles.conference_registration.headings.languages' |
||||
= radiobuttons :preferred_language, I18n.backend.enabled_locales, current_user.locale || I18n.locale, 'languages', heading: 'articles.conference_registration.headings.preferred_language' |
= radiobuttons :preferred_language, I18n.backend.enabled_locales, current_user.locale || I18n.locale, 'languages', heading: 'articles.conference_registration.headings.preferred_language' |
||||
= checkbox :email_subscribe, current_user.is_subscribed != false, 'articles.user_settings.email_subscribe', heading: 'articles.user_settings.headings.email_subscribe', help: 'articles.user_settings.paragraphs.email_subscribe', inline: true, right_help: true |
= checkbox :email_subscribe, current_user.is_subscribed != false, 'articles.user_settings.email_subscribe', heading: 'articles.user_settings.headings.email_subscribe', help: 'articles.user_settings.paragraphs.email_subscribe', inline: true, right_help: true |
||||
.actions |
.actions |
||||
= button_tag :save, value: :save |
= button_tag :save, value: :save |
||||
- else |
- else |
||||
%h2=_'forms.actions.generic.login' |
%h2=_'forms.actions.generic.login' |
||||
= render 'login' |
= render 'login' |
@ -0,0 +1,41 @@ |
|||||
|
= columns(large: 8, push: { large: 2}) do |
||||
|
%h3=_'articles.admin.info.headings.Host_Organizations' |
||||
|
%p=_'articles.admin.info.descriptions.Host_Organizations', vars: { city_name: @this_conference.city.city } |
||||
|
= admin_update_form do |
||||
|
= checkboxes :organizations, (@organizations.map { |org| [org.name, org.id] }), @this_conference.organizations.map(&:id), 'test.test', vertical: true, big: true |
||||
|
.actions.right.small |
||||
|
= button_tag :save, value: :set_organizations |
||||
|
- @this_conference.organizations.each do | organization | |
||||
|
%h4=organization.name |
||||
|
- if organization.users.present? |
||||
|
.details.org-members |
||||
|
- organization.users.each do | user | |
||||
|
= raw_data_set(:h5, user.name) do |
||||
|
= user.email |
||||
|
- unless user.id == current_user.id && !current_user.administrator? |
||||
|
= admin_update_form class: [:inline, :right] do |
||||
|
= hidden_field_tag :user_id, user.id |
||||
|
= hidden_field_tag :org_id, organization.id |
||||
|
= button_tag :remove_member, value: :remove_org_member, class: [:small, :delete] |
||||
|
= admin_update_form class: 'mini-flex-form' do |
||||
|
= hidden_field_tag :org_id, organization.id |
||||
|
= emailfield :email, nil, required: true |
||||
|
= button_tag :add_member, value: :add_org_member, class: :small |
||||
|
|
||||
|
%h3=_'articles.admin.info.headings.External_Administrators' |
||||
|
%p=_'articles.admin.info.descriptions.External_Administrators' |
||||
|
- if @this_conference.administrators.present? |
||||
|
.details.org-members |
||||
|
- @this_conference.administrators.each do | user | |
||||
|
= raw_data_set(:h5, user.name) do |
||||
|
= user.email |
||||
|
- unless user.id == current_user.id && !current_user.administrator? |
||||
|
= admin_update_form class: [:inline, :right] do |
||||
|
= hidden_field_tag :user_id, user.id |
||||
|
= button_tag :remove_member, value: :remove_administrator, class: [:small, :delete] |
||||
|
= admin_update_form class: 'mini-flex-form' do |
||||
|
= userfield :email, nil, required: true |
||||
|
-#= emailfield :email, nil, required: true |
||||
|
= button_tag :add_member, value: :add_administrator, class: :small |
||||
|
= columns(large: 2) do |
||||
|
|
@ -0,0 +1,23 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
= admin_update_form do |
||||
|
- if @broadcast_step == :preview || @broadcast_step == :test |
||||
|
= hidden_field_tag :subject, @subject |
||||
|
= hidden_field_tag :body, @body |
||||
|
= hidden_field_tag :send_to, @send_to |
||||
|
- if @broadcast_step == :preview |
||||
|
%p= _'articles.conference_registration.paragraphs.admin.broadcast.test', vars: { send_to_count: "<strong>#{(@send_to_count || 0)}</strong>".html_safe } |
||||
|
- else |
||||
|
.warning-info.make-room= _'articles.conference_registration.paragraphs.admin.broadcast.preview', vars: { send_to_count: "<strong>#{(@send_to_count || 0)}</strong>".html_safe } |
||||
|
.test-preview |
||||
|
%h3=@subject |
||||
|
= richtext @body, 4 |
||||
|
.actions.right |
||||
|
= button_tag :test, value: :test, class: :secondary if @broadcast_step == :preview |
||||
|
= button_with_confirmation :send, (_'modals.admin.broadcast.confirm', vars: { number: "<strong>#{(@send_to_count || 0)}</strong>".html_safe }), value: :send, class: :delete if @broadcast_step == :test |
||||
|
= button_tag :edit, value: :edit |
||||
|
- else |
||||
|
= selectfield :send_to, nil, broadcast_options, full: true |
||||
|
= textfield :subject, @subject, required: true, big: true |
||||
|
= textarea :body, @body, lang: @this_conference.locale, edit_on: :focus |
||||
|
.actions.right |
||||
|
= button_tag :preview, value: :preview |
@ -0,0 +1,17 @@ |
|||||
|
= admin_update_form do |
||||
|
= row do |
||||
|
= columns(medium: 6, push: { medium: 1 }) do |
||||
|
= fieldset :start_date, inline: true, inline_label: true do |
||||
|
= month_select @start_month, name: :start_month, label: false |
||||
|
= month_day_select @start_day, name: :start_day, label: false |
||||
|
|
||||
|
= row do |
||||
|
= columns(medium: 6, push: { medium: 1 }) do |
||||
|
= fieldset :end_date, inline: true, inline_label: true do |
||||
|
= month_select @end_month, name: :end_month, label: false |
||||
|
= month_day_select @end_day, name: :end_day, label: false |
||||
|
|
||||
|
= row do |
||||
|
= columns(medium: 6, push: { medium: 1 }) do |
||||
|
.actions |
||||
|
= button_tag :save, value: :save |
@ -0,0 +1,5 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
= admin_update_form do |
||||
|
= translate_textarea :info, @this_conference, label: 'articles.conference_registration.headings.admin.edit.info', help: 'articles.conference_registration.paragraphs.admin.edit.info', edit_on: :focus |
||||
|
.actions.right |
||||
|
= button_tag :save, value: :save |
@ -0,0 +1,41 @@ |
|||||
|
- if @this_conference.event_locations.blank? |
||||
|
= columns(medium: 12) do |
||||
|
.warning-info=_'articles.admin.events.no_locations_warning' |
||||
|
- else |
||||
|
= columns(medium: 12) do |
||||
|
- if @events.present? && @event.id.blank? |
||||
|
%table.events.admin-edit |
||||
|
%tr |
||||
|
%th=_'forms.labels.generic.title' |
||||
|
%th=_'forms.labels.generic.event_location' |
||||
|
%th=_'forms.labels.generic.day' |
||||
|
%th=_'forms.labels.generic.time' |
||||
|
%th=_'forms.labels.generic.time_span' |
||||
|
%th.form |
||||
|
- @events.each do | event | |
||||
|
%tr |
||||
|
%th=event.title |
||||
|
%td=_!(event.event_location.present? ? event.event_location.title : '') |
||||
|
%td=date(event.start_time.to_date, :weekday) |
||||
|
%td=time(event.start_time, :short) |
||||
|
%td=hours(event.start_time, event.end_time) |
||||
|
%td.form |
||||
|
= admin_update_form do |
||||
|
= hidden_field_tag :id, event.id |
||||
|
= link_to (_'forms.actions.generic.edit'), edit_event_path(@this_conference, event.id), class: [:button, :small, :modify] |
||||
|
= button_with_confirmation :delete, (_'modals.admin.generic.delete.confirm', :p, vars: { title: event.title }), value: :delete, class: [:delete, :small] |
||||
|
|
||||
|
= columns(medium: 12) do |
||||
|
%h3=_"articles.admin.locations.headings.#{@event.id.present? ? 'edit' : 'add'}_event", :t |
||||
|
|
||||
|
= admin_update_form do |
||||
|
= hidden_field_tag :id, @event.id if @event.id.present? |
||||
|
.flex-inputs |
||||
|
= location_select @event.event_location_id, small: true, stretch: true |
||||
|
= day_select @day, small: true, format: :weekday |
||||
|
= hour_select @time, small: true |
||||
|
= length_select @length, small: true |
||||
|
= translate_fields @event, { title: { type: :textfield, big: true, label: 'forms.labels.generic.title' }, info: { type: :textarea, label: 'forms.labels.generic.info', edit_on: :focus } } |
||||
|
.actions.next-prev |
||||
|
= button_tag :save, value: :save |
||||
|
= button_tag :cancel, value: :cancel, class: :subdued, formnovalidate: true if @event.id.present? |
@ -0,0 +1,11 @@ |
|||||
|
.guests-housed |
||||
|
%h5 Guests Housed: |
||||
|
.data="#{@guests_housed} / #{@guests.size}" |
||||
|
|
||||
|
%table.hosts.admin-edit |
||||
|
- @hosts.each do | id, registration | |
||||
|
%tr.host |
||||
|
%th |
||||
|
.name=registration.user.name |
||||
|
.address=registration.housing_data['address'] |
||||
|
%td.inner-table{colspan: 2}=host_guests_table(registration) |
@ -0,0 +1,10 @@ |
|||||
|
- add_inline_script :housing |
||||
|
= columns(medium: 12) do |
||||
|
= admin_update_form id: 'housing-table-form' do |
||||
|
#housing-table= render partial: 'hosts_table' |
||||
|
#guest-selector |
||||
|
= admin_update_form class: 'guest-dlg', id: 'guest-list-table' do |
||||
|
%h3 Select a Guest |
||||
|
#table |
||||
|
.actions |
||||
|
= link_to (_'links.download.Excel'), administration_step_path(@this_conference.slug, @admin_step, :format => :xlsx), class: [:button, :download] |
@ -0,0 +1,42 @@ |
|||||
|
- unless @location.present? |
||||
|
- if @locations.present? |
||||
|
= columns(medium: 12) do |
||||
|
%table.locations.admin-edit |
||||
|
%tr |
||||
|
%th=_'forms.labels.generic.title' |
||||
|
%th=_'forms.labels.generic.address' |
||||
|
%th=_'articles.workshops.headings.space' |
||||
|
%th=_'articles.admin.locations.headings.amenities' |
||||
|
%th.form |
||||
|
- @locations.each do | location | |
||||
|
%tr |
||||
|
%th=_!(location.title || '') |
||||
|
%td=location_link location |
||||
|
%td=location.space.present? ? (_"workshop.options.space.#{location.space}") : '' |
||||
|
%td |
||||
|
- amenities = location.amenities.present? ? JSON.parse(location.amenities) : [] |
||||
|
=_!(amenities.collect { |amenity| _"workshop.options.needs.#{amenity}" }).join(', ') |
||||
|
%td.form |
||||
|
= admin_update_form do |
||||
|
= hidden_field_tag :id, location.id |
||||
|
= link_to (_'forms.actions.generic.edit'), edit_location_path(@this_conference, location.id), class: [:button, :small, :modify] |
||||
|
= button_with_confirmation :delete, (_'modals.admin.generic.delete.confirm', :p, vars: { title: location.title }), value: :delete, class: [:delete, :small] |
||||
|
= admin_update_form do |
||||
|
= columns(medium: 12) do |
||||
|
%h5=_"articles.admin.locations.headings.#{@location.present? ? 'edit' : 'add'}_location", :t |
||||
|
= hidden_field_tag :id, @location.id if @location.present? |
||||
|
= textfield :title, @location.present? ? @location.title : nil, required: true, big: true, help: 'articles.admin.locations.paragraphs.title' |
||||
|
.flex-column.address-form |
||||
|
= textfield :address, @location.present? ? @location.address : nil, required: true, help: 'articles.admin.locations.paragraphs.address', stretch: true |
||||
|
.city=location(@this_conference.city) |
||||
|
= columns(medium: 6) do |
||||
|
= radiobuttons :space, EventLocation.all_spaces, @space, 'workshop.options.space', vertical: true, heading: 'articles.workshops.headings.space', required: true, help: 'articles.admin.locations.paragraphs.space' |
||||
|
= columns(medium: 6) do |
||||
|
= checkboxes :needs, EventLocation.all_amenities, @amenities || [], 'workshop.options.needs', vertical: true, heading: 'articles.admin.locations.headings.amenities', help: 'articles.admin.locations.paragraphs.amenities' |
||||
|
= columns(medium: 12) do |
||||
|
.actions.next-prev |
||||
|
- if @location.present? |
||||
|
= button_tag :save, value: :save |
||||
|
= button_tag :cancel, value: :cancel, class: :subdued, formnovalidate: true |
||||
|
- else |
||||
|
= button_tag :create, value: :create |
@ -0,0 +1,35 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
- if @this_conference.event_locations.present? |
||||
|
- if @this_conference.meals.present? |
||||
|
%table.meals.admin-edit |
||||
|
%tr |
||||
|
%th=_'forms.labels.generic.title' |
||||
|
%th=_'forms.labels.generic.info' |
||||
|
%th=_'forms.labels.generic.event_location' |
||||
|
%th=_'forms.labels.generic.day' |
||||
|
%th=_'forms.labels.generic.time' |
||||
|
%th.form |
||||
|
- @meals.each do | time, meal | |
||||
|
%tr |
||||
|
%th |
||||
|
=_!(meal['title'] || '') |
||||
|
%td=_!(meal['info'] || '') |
||||
|
%td=_!location_name(meal['location'].to_i) |
||||
|
%td=date(meal['day'], :weekday) |
||||
|
%td=time(meal['time'].to_f) |
||||
|
%td.form |
||||
|
= admin_update_form do |
||||
|
= hidden_field_tag :meal, time |
||||
|
= button_tag :delete, value: :delete, class: [:small, :delete] |
||||
|
= admin_update_form do |
||||
|
%h3=_'articles.admin.locations.headings.add_meal', :t |
||||
|
.flex-inputs |
||||
|
= location_select nil, small: true, stretch: true |
||||
|
= day_select nil, small: true, format: :weekday |
||||
|
= hour_select nil, small: true |
||||
|
= textfield :title, nil, required: true, big: true, help: 'articles.admin.locations.paragraphs.meal_title' |
||||
|
= textfield :info, nil, help: 'articles.admin.locations.paragraphs.meal_info' |
||||
|
.actions.next-prev |
||||
|
= button_tag :add_meal, value: :add_meal |
||||
|
- else |
||||
|
.warning-info=_'articles.admin.meals.no_locations_warning' |
@ -0,0 +1,6 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
= form_tag administration_update_path(@this_conference.slug, @admin_step) do |
||||
|
= translate_textarea :payment_message, @this_conference, default: 'articles.conference_registration.paragraphs.Payment', help: 'articles.conference_registration.paragraphs.admin.payment.message', edit_on: :focus, short: true |
||||
|
|
||||
|
.actions.right |
||||
|
= button_tag :save, value: :save |
@ -0,0 +1,8 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
= form_tag administration_update_path(@this_conference.slug, @admin_step) do |
||||
|
= emailfield :paypal_email_address, @this_conference.paypal_email_address || @this_conference.email_address || (@this_conference.organizations.present? && @this_conference.organizations.first.present? ? @this_conference.organizations.first.email_address : nil) |
||||
|
= textfield :paypal_username, @this_conference.paypal_username |
||||
|
= passwordfield :paypal_password, @this_conference.paypal_password |
||||
|
= textfield :paypal_signature, @this_conference.paypal_signature |
||||
|
.actions.right |
||||
|
= button_tag :save, value: :save |
@ -0,0 +1,5 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
= form_tag administration_update_path(@this_conference.slug, :poster), multipart: true do |
||||
|
= filefield :poster, @this_conference.poster, required: true, label: false, preview: true |
||||
|
.actions.left |
||||
|
= button_tag :upload, value: :upload, id: 'upload-file' |
@ -0,0 +1,2 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
TO COME |
@ -0,0 +1,8 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
= form_tag administration_update_path(@this_conference.slug, @admin_step) do |
||||
|
- if @this_conference.workshop_schedule_published |
||||
|
%p=_'articles.conference_registration.paragraphs.admin.schedule.published', :p |
||||
|
.actions= button_tag :un_publish, value: :publish, class: :delete |
||||
|
- else |
||||
|
%p=_'articles.conference_registration.paragraphs.admin.schedule.un_published', :p |
||||
|
.actions= button_tag :publish, value: :publish |
@ -0,0 +1,5 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
= form_tag administration_update_path(@this_conference.slug, @admin_step) do |
||||
|
= selectfield :registration_status, @this_conference.registration_status || 'closed', registration_status_options_list, inline_label: true |
||||
|
.actions.left |
||||
|
= button_tag :save, value: :save |
@ -0,0 +1,17 @@ |
|||||
|
- add_inline_script :registrations |
||||
|
= columns(medium: 12) do |
||||
|
.goes-fullscreen#registrations-table |
||||
|
.flex-column |
||||
|
= searchfield :search, nil, big: true, stretch: true |
||||
|
%a.button{data: { expands: 'registrations-table' }}='expand' |
||||
|
%a.button.delete{data: { contracts: 'registrations-table' }}='close' |
||||
|
%a.button.modify{data: { 'opens-modal': 'new-registration' }}='+' |
||||
|
.table-scroller |
||||
|
= html_table @excel_data, registrations_table_options |
||||
|
= admin_update_form id: 'new-registration', class: 'modal-edit' do |
||||
|
.modal-edit-overlay{data: { 'closes-modal': 'new-registration' }} |
||||
|
.modal-edit-content |
||||
|
= html_edit_table @excel_data, registrations_edit_table_options |
||||
|
.actions.right |
||||
|
%a.button.subdued{data: { 'closes-modal': 'new-registration' }}='Cancel' |
||||
|
= button_tag :save, value: :save, class: :modify |
@ -0,0 +1,85 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
- conference = @this_conference || @conference |
||||
|
- if conference.event_locations.blank? && @entire_page |
||||
|
.warning-info=_'articles.admin.schedule.no_locations_warning' |
||||
|
- else |
||||
|
- add_inline_script :schedule if @entire_page |
||||
|
#schedule-preview |
||||
|
- @schedule.each do | day, data | |
||||
|
%h4=date(day, :weekday) |
||||
|
%table.schedule{class: [data[:locations].present? ? 'has-locations' : 'no-locations', "locations-#{data[:num_locations]}"]} |
||||
|
- if data[:locations].present? && data[:locations].values.first != :add |
||||
|
%thead |
||||
|
%tr |
||||
|
%th.corner |
||||
|
- data[:locations].each do | id, location | |
||||
|
%th=location.is_a?(Symbol) ? '' : location.title |
||||
|
%tbody |
||||
|
- data[:times].each do | time, time_data | |
||||
|
%tr |
||||
|
- rowspan = (time_data[:length] * 2).to_i |
||||
|
%th=time(time) |
||||
|
- if time_data[:type] == :workshop |
||||
|
- data[:locations].each do | id, location | |
||||
|
- if time_data[:item][:workshops][id].present? |
||||
|
- workshop = time_data[:item][:workshops][id][:workshop] |
||||
|
- status = time_data[:item][:workshops][id][:status] |
||||
|
- else |
||||
|
- workshop = status = nil |
||||
|
%td{class: [time_data[:type], workshop.present? ? :filled : :open], rowspan: rowspan, data: workshop.present? ? nil : { block: time_data[:item][:block], day: day, location: id }} |
||||
|
- if workshop.present? && workshop.event_location.present? |
||||
|
= link_to view_workshop_path(@conference.slug, workshop.id), class: 'event-detail-link' do |
||||
|
.details |
||||
|
.title=workshop.title |
||||
|
%template.event-details{data: { href: view_workshop_path(@conference.slug, workshop.id) }} |
||||
|
%h1.title=workshop.title |
||||
|
%p.address |
||||
|
= workshop.event_location.title + _!(': ') |
||||
|
= location_link workshop.event_location |
||||
|
.workshop-description= richtext workshop.info, 1 |
||||
|
- if @can_edit |
||||
|
= form_tag administration_update_path(conference.slug, @admin_step), class: 'deschedule-workshop' do |
||||
|
.status |
||||
|
.conflict-score |
||||
|
%span.title Conflicts: |
||||
|
%span.value="#{status[:conflict_score]} / #{workshop.interested.size}" |
||||
|
- if status[:errors].present? |
||||
|
.errors |
||||
|
- status[:errors].each do | error | |
||||
|
.error=_"errors.messages.schedule.#{error[:name].to_s}", vars: error[:i18nVars] |
||||
|
= hidden_field_tag :id, workshop.id |
||||
|
= button_tag :deschedule, value: :deschedule_workshop, class: [:delete, :small] |
||||
|
- elsif @can_edit |
||||
|
.title="Block #{time_data[:item][:block] + 1}" |
||||
|
- elsif time_data[:type] != :nil |
||||
|
%td{class: time_data[:type], rowspan: rowspan, colspan: data[:locations].present? ? data[:locations].size : 1} |
||||
|
- case time_data[:type] |
||||
|
- when :meal |
||||
|
- location = EventLocation.where(id: time_data[:item]['location'].to_i).first |
||||
|
- if location.present? |
||||
|
%a.event-detail-link |
||||
|
.details |
||||
|
.title= time_data[:item]['title'] |
||||
|
.location= location.title |
||||
|
%template.event-details |
||||
|
%h1.title=time_data[:item]['title'] |
||||
|
%p.address |
||||
|
= location.title + _!(': ') |
||||
|
= location_link location |
||||
|
- when :event |
||||
|
- if time_data[:item].event_location.present? |
||||
|
%a.event-detail-link |
||||
|
.details |
||||
|
.title= time_data[:item][:title] |
||||
|
.location= time_data[:item].event_location.title |
||||
|
%template.event-details |
||||
|
%h1.title=time_data[:item][:title] |
||||
|
%p.address |
||||
|
= time_data[:item].event_location.title + _!(': ') |
||||
|
= location_link time_data[:item].event_location |
||||
|
= richtext time_data[:item][:info], 1 |
||||
|
- if @entire_page |
||||
|
#workshop-selector |
||||
|
= form_tag administration_update_path(@this_conference.slug, @admin_step), class: 'workshop-dlg', id: 'workshop-table-form' do |
||||
|
%h3 Select a Workshop |
||||
|
#table |
@ -0,0 +1,46 @@ |
|||||
|
= hidden_field_tag :host, host.id |
||||
|
.host-field |
||||
|
%h4.inline=_'forms.labels.generic.name' |
||||
|
%span.plain-value= host.user.name |
||||
|
.host-field |
||||
|
%h4.inline=_'articles.conference_registration.headings.host.availability' |
||||
|
%span.plain-value= host.housing_data['availability'].present? && host.housing_data['availability'][1].present? ? date_span(host.housing_data['availability'][0].to_date, host.housing_data['availability'][1].to_date) : '' |
||||
|
- if host.housing_data['considerations'].present? |
||||
|
.host-field |
||||
|
%h4.inline=_'articles.conference_registration.headings.host.considerations' |
||||
|
%span.plain-value= (host.housing_data['considerations'].map { | consideration | _"articles.conference_registration.host.considerations.#{consideration}" }).join(', ') |
||||
|
- if sanitize(host.housing_data['notes'], tags: []).present? |
||||
|
.host-field |
||||
|
%h4=_'articles.conference_registration.headings.host.notes' |
||||
|
%blockquote= host.housing_data['notes'].html_safe |
||||
|
%table.guests.admin-edit |
||||
|
%tr |
||||
|
%th.corner |
||||
|
%th=_'forms.labels.generic.city' |
||||
|
%th=_'forms.labels.generic.housing' |
||||
|
%th=_'articles.admin.housing.headings.arrival_departure' |
||||
|
%th=_'articles.conference_registration.headings.companion' |
||||
|
%th=_'forms.labels.generic.food' |
||||
|
%th=_'forms.labels.generic.allergies' |
||||
|
%th=_'forms.labels.generic.other' |
||||
|
- @guests.each do | id, registration | |
||||
|
%tr.selectable{class: get_housing_match(host, registration, space).to_s.gsub('_', '-'), data: {host: host.id, guest: id, space: space}} |
||||
|
%th=registration.user.name |
||||
|
%td=registration.city |
||||
|
%td=registration.housing.present? ? (_"articles.conference_registration.questions.housing.#{registration.housing}") : '' |
||||
|
%td=date_span(registration.arrival.to_date, registration.departure.to_date) |
||||
|
- companion = companion(registration) |
||||
|
%td=companion.present? ? (companion.is_a?(User) ? companion.named_email : (_"articles.conference_registration.terms.registration_status.#{companion}")) : '' |
||||
|
%td=registration.food.present? ? (_"articles.conference_registration.questions.food.#{registration.food}") : '' |
||||
|
%td=registration.allergies |
||||
|
%td |
||||
|
.p=registration.other |
||||
|
|
||||
|
.legend |
||||
|
%h4 Legend |
||||
|
%ul |
||||
|
%li.good-match Good Match |
||||
|
%li.bad-match Poor Match |
||||
|
%li.selected-space Also in this space |
||||
|
%li.other-space Also with this host |
||||
|
%li.other-host Already hosted |
@ -0,0 +1,21 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
.details |
||||
|
= data_set(:h3, 'articles.admin.stats.headings.completed_registrations') do |
||||
|
= (@completed_registrations || 0).to_s |
||||
|
= data_set(:h3, 'articles.admin.stats.headings.incomplete_registrations') do |
||||
|
= ((@registration_count - @completed_registrations) || 0).to_s |
||||
|
= data_set(:h3, 'articles.admin.stats.headings.bikes') do |
||||
|
= (@completed_registrations || 0) > 0 ? "#{@bikes} (#{number_to_percentage(@bikes / @completed_registrations.to_f * 100.0)})" : "0" |
||||
|
= data_set(:h3, 'articles.admin.stats.headings.food.meat') do |
||||
|
= (@food[:all] || 0) > 0 ? "#{@food[:meat]} (#{number_to_percentage(@food[:meat] / @food[:all].to_f * 100.0)})" : "0" |
||||
|
= data_set(:h3, 'articles.admin.stats.headings.food.vegetarian') do |
||||
|
= (@food[:all] || 0) > 0 ? "#{@food[:vegetarian]} (#{number_to_percentage(@food[:vegetarian] / @food[:all].to_f * 100.0)})" : "0" |
||||
|
= data_set(:h3, 'articles.admin.stats.headings.food.vegan') do |
||||
|
= (@food[:all] || 0) > 0 ? "#{@food[:vegan]} (#{number_to_percentage(@food[:vegan] / @food[:all].to_f * 100.0)})" : "0" |
||||
|
= data_set(:h3, 'articles.admin.stats.headings.donation_count') do |
||||
|
= (@completed_registrations || 0) > 0 ? "#{@donation_count} (#{number_to_percentage(@donation_count / @completed_registrations.to_f * 100.0)})" : "0" |
||||
|
= data_set(:h3, 'articles.admin.stats.headings.donation_total') do |
||||
|
= "$#{@donations || 0.00}" |
||||
|
.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] |
@ -0,0 +1,8 @@ |
|||||
|
= columns(medium: 12) do |
||||
|
= form_tag administration_update_path(@this_conference.slug, @admin_step) do |
||||
|
= fieldset :payment_amounts, label: false do |
||||
|
- payment_amounts = @this_conference.payment_amounts.present? ? @this_conference.payment_amounts : Conference.default_payment_amounts |
||||
|
- for i in 1..5 do |
||||
|
= numberfield "payment_amounts[#{i - 1}]", payment_amounts[i - 1], step: 0.01, min: 0.00, label: false |
||||
|
.actions.right |
||||
|
= button_tag :save, value: :save |