This commit is contained in:
Nemo 2017-02-01 20:47:57 +00:00 committed by GitHub
commit a82f33fc0e
8 changed files with 21 additions and 4 deletions

View file

@ -176,7 +176,7 @@ module Admin
private private
def conference_params def conference_params
params.require(:conference).permit(:title, :short_title, :description, :timezone, params.require(:conference).permit(:title, :short_title, :description, :timezone, :domain,
:start_date, :end_date, :rooms_attributes, :tracks_attributes, :start_date, :end_date, :rooms_attributes, :tracks_attributes,
:tickets_attributes, :event_types_attributes, :tickets_attributes, :event_types_attributes,
:picture, :picture_cache, :questions_attributes, :picture, :picture_cache, :questions_attributes,

View file

@ -37,7 +37,8 @@ class ApplicationController < ActionController::Base
end end
def get_conferences def get_conferences
@conferences =Conference.all domain = request.host
@conferences = Conference.get_conferences_to_list(domain, 0)
end end
def current_ability def current_ability

View file

@ -5,7 +5,8 @@ class ConferencesController < ApplicationController
load_resource :program, through: :conference, singleton: true, except: :index load_resource :program, through: :conference, singleton: true, except: :index
def index def index
@current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc) domain = request.host
@current = Conference.get_conferences_to_list domain
@antiquated = @conferences - @current @antiquated = @conferences - @current
end end

View file

@ -499,6 +499,10 @@ class Conference < ActiveRecord::Base
result - active_conferences result - active_conferences
end end
def self.get_conferences_to_list(domain, end_date = Date.current)
return Conference.where('end_date >= ? AND (domain = ? OR domain IS NULL)', end_date, domain).reorder(start_date: :asc)
end
## ##
# A list with the three event states submitted, confirmed, unconfirmed with corresponding colors # A list with the three event states submitted, confirmed, unconfirmed with corresponding colors
# #

View file

@ -9,6 +9,7 @@
= semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f| = semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f|
= f.input :title, :hint => "The full title of the conference, e.g. 'openSUSE Conference 2014'" = f.input :title, :hint => "The full title of the conference, e.g. 'openSUSE Conference 2014'"
= f.input :short_title, :hint => "A short title, e.g. 'oSC14', to be used in URLs" = f.input :short_title, :hint => "A short title, e.g. 'oSC14', to be used in URLs"
= f.input :domain, hint: "Optional domain on which the conference will be visible. This only affects the conference listings."
= f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } } = f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } }
= f.input :color, :hint => "The color will be used eg for the dashboard.", :input_html => {:size => 6, :type => "color"} = f.input :color, :hint => "The color will be used eg for the dashboard.", :input_html => {:size => 6, :type => "color"}
= f.label 'Conference Logo' = f.label 'Conference Logo'

View file

@ -6,6 +6,7 @@
input_html: { required: 'required' } input_html: { required: 'required' }
= f.input :short_title, hint: "A short and unique handle for your conference, using only lower-case letters, numbers and underscores. This will be used to identify your conference in URLs etc. Example: 'froscon2011'", = f.input :short_title, hint: "A short and unique handle for your conference, using only lower-case letters, numbers and underscores. This will be used to identify your conference in URLs etc. Example: 'froscon2011'",
input_html: { required: 'required' } input_html: { required: 'required' }
= f.input :domain, hint: "Optional domain on which the conference will be visible. This only affects the conference listings."
= f.inputs 'Scheduling' do = f.inputs 'Scheduling' do
= f.input :timezone, as: :time_zone, default: Time.zone.name, hint: 'Please select in what time zone your conference will take place.' = f.input :timezone, as: :time_zone, default: Time.zone.name, hint: 'Please select in what time zone your conference will take place.'
= f.input :start_date, as: :string, input_html: { id: 'conference-start-datepicker', required: 'required' } = f.input :start_date, as: :string, input_html: { id: 'conference-start-datepicker', required: 'required' }

View file

@ -0,0 +1,6 @@
class AddDomainToConferences < ActiveRecord::Migration
def change
add_column :conferences, :domain, :string
add_index :conferences, [:domain]
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160815140302) do ActiveRecord::Schema.define(version: 20170201193336) do
create_table "ahoy_events", force: :cascade do |t| create_table "ahoy_events", force: :cascade do |t|
t.uuid "visit_id", limit: 16 t.uuid "visit_id", limit: 16
@ -98,8 +98,11 @@ ActiveRecord::Schema.define(version: 20160815140302) do
t.text "description" t.text "description"
t.integer "registration_limit", default: 0 t.integer "registration_limit", default: 0
t.string "picture" t.string "picture"
t.string "domain"
end end
add_index "conferences", ["domain"], name: "index_conferences_on_domain"
create_table "conferences_questions", id: false, force: :cascade do |t| create_table "conferences_questions", id: false, force: :cascade do |t|
t.integer "conference_id" t.integer "conference_id"
t.integer "question_id" t.integer "question_id"