OpenFest: Make use of the current_conference helper

This commit is contained in:
Petko Bordjukov 2015-07-20 02:08:20 +03:00 committed by Andrew Radev
parent c4db0ff920
commit 5d5a5a1cbf
5 changed files with 15 additions and 20 deletions

View File

@ -1,5 +1,5 @@
Rails.application.routes.draw do
mount OpenFest::Engine, at: '/', constraints: {subdomain: 'cfp'}
mount OpenFest::Engine, at: '/', constraints: {subdomain: 'cfp'}, conference_id: 1
devise_for :users, path: 'management'

View File

@ -1,12 +1,7 @@
module OpenFest
class ApplicationController < ActionController::Base
before_action :set_current_conference
include ::CurrentConferenceAssigning
private
#TODO: Make this display a nice 404 message when the conference is not found
def set_current_conference
@current_conference ||= Conference.find(1)
end
before_filter :require_current_conference!
end
end

View File

@ -5,7 +5,7 @@
<% if content_for? :title %>
<%= yield :title %> |
<% end %>
<%= @current_conference.try :title %>
<%= current_conference.try :title %>
</title>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<%= stylesheet_link_tag "open_fest/application", media: "all" %>

View File

@ -1,18 +1,18 @@
- content_for(:title) { ":: #{t :edit_speaker_profile}" }
- content_for(:title) { t :edit_speaker_profile }
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, multipart: true }) do |f|
= simple_form_for(resource, wrapper: :default, as: resource_name, url: registration_path(resource_name), html: { method: :put, multipart: true }) do |f|
.form_inputs
h2.entry-title = t :speaker_profile
h2.entry-title = t :personal_profile
= f.error_notification
= f.simple_fields_for :speaker_profile do |ff|
= ff.input :picture, as: :image_preview, input_html: {preview_version: :thumb}, required: true
= f.simple_fields_for :personal_profile do |ff|
= ff.input :picture, as: :file, required: true
= ff.input :first_name, autofocus: true
= ff.input :last_name
= ff.input :public_email
= ff.input :organisation
= ff.input :github
= ff.input :twitter
= ff.input :mobile_phone, input_html: {value: resource.speaker_profile.mobile_phone.try(:phony_formatted, format: :international)}
= ff.input :mobile_phone, input_html: {value: resource.personal_profile(current_conference).mobile_phone.try(:phony_formatted, format: :international)}
= ff.input :biography
.form-inputs

View File

@ -1,14 +1,14 @@
h1.entry-title = t :home_title, conference: @current_conference.title
h1.entry-title = t :home_title, conference: current_conference.title
= simple_format @current_conference.description
= simple_format current_conference.description
p = t :what_we_ask
ul
= render partial: 'track', collection: @current_conference.tracks
= render partial: 'track', collection: current_conference.tracks
p = t :license_notice
- if @current_conference.call_for_participation.in_progress?
- if current_conference.call_for_participation.in_progress?
.centered.large
= render partial: 'event_type', collection: @current_conference.event_types
= render partial: 'event_type', collection: current_conference.event_types