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 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' devise_for :users, path: 'management'

View File

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

View File

@ -5,7 +5,7 @@
<% if content_for? :title %> <% if content_for? :title %>
<%= yield :title %> | <%= yield :title %> |
<% end %> <% end %>
<%= @current_conference.try :title %> <%= current_conference.try :title %>
</title> </title>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"> <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" %> <%= 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 .form_inputs
h2.entry-title = t :speaker_profile h2.entry-title = t :personal_profile
= f.error_notification = f.error_notification
= f.simple_fields_for :speaker_profile do |ff| = f.simple_fields_for :personal_profile do |ff|
= ff.input :picture, as: :image_preview, input_html: {preview_version: :thumb}, required: true = ff.input :picture, as: :file, required: true
= ff.input :first_name, autofocus: true = ff.input :first_name, autofocus: true
= ff.input :last_name = ff.input :last_name
= ff.input :public_email = ff.input :public_email
= ff.input :organisation = ff.input :organisation
= ff.input :github = ff.input :github
= ff.input :twitter = 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 = ff.input :biography
.form-inputs .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 p = t :what_we_ask
ul ul
= render partial: 'track', collection: @current_conference.tracks = render partial: 'track', collection: current_conference.tracks
p = t :license_notice p = t :license_notice
- if @current_conference.call_for_participation.in_progress? - if current_conference.call_for_participation.in_progress?
.centered.large .centered.large
= render partial: 'event_type', collection: @current_conference.event_types = render partial: 'event_type', collection: current_conference.event_types