mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Show supporter level ticket URL on the registration page
This commit is contained in:
parent
973913b3bf
commit
5d3864d7da
2 changed files with 24 additions and 1 deletions
14
app/helpers/registration_helper.rb
Normal file
14
app/helpers/registration_helper.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
module RegistrationHelper
|
||||||
|
def generate_supporter_level_js(conference)
|
||||||
|
str = ""
|
||||||
|
conference.supporter_levels.map do |t|
|
||||||
|
next if t.url.empty?
|
||||||
|
|
||||||
|
str += "if ($('#registration_supporter_registration_attributes_supporter_level_id option:selected').text() == '#{t.title}') {\n"
|
||||||
|
str += "console.log('#{t.title}');\n"
|
||||||
|
str += "str = 'If you have a confirmation or registration code, enter it here. Otherwise, you can purchase a <i>#{t.title}</i> ticket <a href=\"#{t.url}\" target=_new>here</a>, if you need to.';\n"
|
||||||
|
str += "}\n\n"
|
||||||
|
end.join("\n")
|
||||||
|
str
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -27,10 +27,19 @@
|
||||||
- if @conference.use_supporter_levels?
|
- if @conference.use_supporter_levels?
|
||||||
= f.semantic_fields_for :supporter_registration do |reg|
|
= f.semantic_fields_for :supporter_registration do |reg|
|
||||||
= reg.input :supporter_level, :as => :select, :collection => @conference.supporter_levels
|
= reg.input :supporter_level, :as => :select, :collection => @conference.supporter_levels
|
||||||
= reg.input :code, :hint => "If you have a confirmation or registration code, enter it here."
|
= reg.input :code, :label => "Confirmation or registration code (if applicable)"
|
||||||
|
%span#supporter-link.help-block
|
||||||
- if @registered
|
- if @registered
|
||||||
= f.action :submit, :button_html => { :value => "Update Registration", :class => "btn btn-primary" }
|
= f.action :submit, :button_html => { :value => "Update Registration", :class => "btn btn-primary" }
|
||||||
= link_to "Unregister", register_conference_path(@conference.short_title),:method => :delete, :class => "btn btn-danger",
|
= link_to "Unregister", register_conference_path(@conference.short_title),:method => :delete, :class => "btn btn-danger",
|
||||||
:confirm => "Are you sure you want to unregister?"
|
:confirm => "Are you sure you want to unregister?"
|
||||||
- else
|
- else
|
||||||
= f.action :submit, :button_html => { :value => "Register", :class => "btn btn-primary" }
|
= f.action :submit, :button_html => { :value => "Register", :class => "btn btn-primary" }
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$("#registration_supporter_registration_attributes_supporter_level_id").change(function () {
|
||||||
|
var str = "";
|
||||||
|
#{generate_supporter_level_js @conference}
|
||||||
|
$("#supporter-link").html(str);
|
||||||
|
})
|
||||||
|
.trigger('change');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue