Merge pull request #154 from ChrisBr/new_admin_rb
Moves conference show #action to #edit action
This commit is contained in:
commit
d52678e348
9 changed files with 80 additions and 42 deletions
|
|
@ -30,16 +30,24 @@ class Admin::ConferenceController < ApplicationController
|
|||
@conference = Conference.find_by(short_title: params[:id])
|
||||
short_title = @conference.short_title
|
||||
if @conference.update_attributes(params[:conference])
|
||||
redirect_to(admin_conference_path(id: @conference.short_title),
|
||||
redirect_to(edit_admin_conference_path(id: @conference.short_title),
|
||||
notice: 'Conference was successfully updated.')
|
||||
else
|
||||
redirect_to(admin_conference_path(id: short_title),
|
||||
redirect_to(edit_admin_conference_path(id: short_title),
|
||||
alert: 'Updating conference failed. ' \
|
||||
"#{@conference.errors.full_messages.join('. ')}.")
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@conference = Conference.find_by(short_title: params[:id])
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render json: @conference.to_json }
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@conferences = Conference.all
|
||||
@conference = Conference.find_by(short_title: params[:id])
|
||||
respond_to do |format|
|
||||
|
|
|
|||
28
app/views/admin/conference/edit.html.haml
Normal file
28
app/views/admin/conference/edit.html.haml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f|
|
||||
= f.input :title, :hint => "The full name of the conference, such as 'OpenSUSE Conference 2013'"
|
||||
= f.input :short_title, :hint => "A short title, such as 'osc2013', to be used in URLs"
|
||||
= f.input :social_tag, :hint => "The hashtag you'll use on Twitter and Google+. Don't include the '#' sign!'"
|
||||
= f.input :contact_email, :hint => "Contact email address for your conference. Will be used as reply-to address in emails sent out by the system."
|
||||
|
||||
= f.inputs :name => "Scheduling" do
|
||||
= f.input :timezone, :as => :time_zone, :hint => "The conference time zone"
|
||||
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
|
||||
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
|
||||
= f.input :registration_start_date, :as => :string, :input_html => { :id => "conference-reg-start-datepicker", :readonly => "readonly" }
|
||||
= f.input :registration_end_date, :as => :string, :input_html => { :id => "conference-reg-end-datepicker", :readonly => "readonly" }
|
||||
|
||||
= f.inputs :name => "Media" do
|
||||
- if !@conference.logo.blank?
|
||||
= image_tag @conference.logo(:thumb)
|
||||
= f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page."
|
||||
= f.input :media_type, :as => :select, :label => "Conference Promo Media Type", :class=>"form-control", :collection => Conference.media_types.values, :include_blank => false, :hint => "This media-item will be used to represent this conference at various places in OSEM."
|
||||
= f.input :media_id, :label => "Conference Promo Media ID", :as => :string
|
||||
%p{:class => "help-block media-type", :id => "youtube-help"} Go to your YouTube video, click on "share" and copy everything behind http://youtu.be/"
|
||||
%p{:class => "help-block media-type", :id => "slideshare-help", :style => "display:none"} Go to your SlideShare, click on "share" -> "embed" and copy the id
|
||||
%p{:class => "help-block media-type", :id => "flickr-help", :style => "display:none"} Go to your flickr image, click on "Grab the link" -> "Show short url" and copy everything behind https://flic.kr/p/
|
||||
%p{:class => "help-block media-type", :id => "vimeo-help", :style => "display:none"} Go to your vimeo video, click on "share" and copy everything behind http://vimeo.com/
|
||||
%p{:class => "help-block media-type", :id => "speakerdeck-help", :style => "display:none"} Go to your SpeakerDeck, click on "share" -> "embed" and copy the data-id
|
||||
%p{:class => "help-block media-type", :id => "instagram-help", :style => "display:none"} Go to your Instagram photo page and copy everything behind instagram.com/p/ (without trailing /# hash symbol)
|
||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
%ul
|
||||
- @conferences.each do |conference|
|
||||
%li= link_to conference.title, admin_conference_path(conference.short_title)
|
||||
.row
|
||||
%h1 Global Dashboard
|
||||
%hr
|
||||
.row
|
||||
%ul
|
||||
- @conferences.each do |conference|
|
||||
%li= link_to conference.title, admin_conference_path(conference.short_title)
|
||||
|
|
|
|||
|
|
@ -1,28 +1,3 @@
|
|||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f|
|
||||
= f.input :title, :hint => "The full name of the conference, such as 'OpenSUSE Conference 2013'"
|
||||
= f.input :short_title, :hint => "A short title, such as 'osc2013', to be used in URLs"
|
||||
= f.input :social_tag, :hint => "The hashtag you'll use on Twitter and Google+. Don't include the '#' sign!'"
|
||||
= f.input :contact_email, :hint => "Contact email address for your conference. Will be used as reply-to address in emails sent out by the system."
|
||||
|
||||
= f.inputs :name => "Scheduling" do
|
||||
= f.input :timezone, :as => :time_zone, :hint => "The conference time zone"
|
||||
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
|
||||
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
|
||||
= f.input :registration_start_date, :as => :string, :input_html => { :id => "conference-reg-start-datepicker", :readonly => "readonly" }
|
||||
= f.input :registration_end_date, :as => :string, :input_html => { :id => "conference-reg-end-datepicker", :readonly => "readonly" }
|
||||
|
||||
= f.inputs :name => "Media" do
|
||||
- if !@conference.logo.blank?
|
||||
= image_tag @conference.logo(:thumb)
|
||||
= f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page."
|
||||
= f.input :media_type, :as => :select, :label => "Conference Promo Media Type", :class=>"form-control", :collection => Conference.media_types.values, :include_blank => false, :hint => "This media-item will be used to represent this conference at various places in OSEM."
|
||||
= f.input :media_id, :label => "Conference Promo Media ID", :as => :string
|
||||
%p{:class => "help-block media-type", :id => "youtube-help"} Go to your YouTube video, click on "share" and copy everything behind http://youtu.be/"
|
||||
%p{:class => "help-block media-type", :id => "slideshare-help", :style => "display:none"} Go to your SlideShare, click on "share" -> "embed" and copy the id
|
||||
%p{:class => "help-block media-type", :id => "flickr-help", :style => "display:none"} Go to your flickr image, click on "Grab the link" -> "Show short url" and copy everything behind https://flic.kr/p/
|
||||
%p{:class => "help-block media-type", :id => "vimeo-help", :style => "display:none"} Go to your vimeo video, click on "share" and copy everything behind http://vimeo.com/
|
||||
%p{:class => "help-block media-type", :id => "speakerdeck-help", :style => "display:none"} Go to your SpeakerDeck, click on "share" -> "embed" and copy the data-id
|
||||
%p{:class => "help-block media-type", :id => "instagram-help", :style => "display:none"} Go to your Instagram photo page and copy everything behind instagram.com/p/ (without trailing /# hash symbol)
|
||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||
%h1 Dashboard for #{@conference.title}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%ul.nav.nav-stacked.mySidebar
|
||||
%ul.nav.nav-stacked.nav-pills.mySidebar
|
||||
.btn-group
|
||||
%button{type:'button', class:'btn btn-default btn-link dropdown-toggle', 'data-toggle'=>'dropdown'}
|
||||
%span.glyphicon.glyphicon-home
|
||||
|
|
@ -37,8 +37,8 @@
|
|||
%a
|
||||
%span.glyphicon.glyphicon-wrench
|
||||
Settings
|
||||
%li{:class=> active_nav_li(admin_conference_path(@conference.short_title))}
|
||||
= link_to(admin_conference_path(@conference.short_title)) do
|
||||
%li{:class=> active_nav_li(edit_admin_conference_path(@conference.short_title))}
|
||||
= link_to(edit_admin_conference_path(@conference.short_title)) do
|
||||
%span.glyphicon.glyphicon-cog
|
||||
Conference
|
||||
%li{:class=> "#{active_nav_li(admin_conference_venue_info_path(@conference.short_title))} myAccordion"}
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
%span.glyphicon.glyphicon-calendar
|
||||
Venue
|
||||
%span.small.glyphicon.glyphicon-chevron-right
|
||||
%ul.nav.nav-stacked.small.collapse.subNav
|
||||
%ul.nav.nav-stacked.nav-pills.small.collapse.subNav
|
||||
%li{:class=> active_nav_li(admin_conference_rooms_path(@conference.short_title))}
|
||||
= link_to 'Rooms', admin_conference_rooms_path(@conference.short_title)
|
||||
%li{:class=> active_nav_li(admin_conference_emails_path(@conference.short_title))}
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
%span.glyphicon.glyphicon-comment
|
||||
Call for papers
|
||||
%span.small.glyphicon.glyphicon-chevron-right
|
||||
%ul.nav.nav-stacked.small.collapse.subNav
|
||||
%ul.nav.nav-stacked.nav-pills.small.collapse.subNav
|
||||
%li{:class=> active_nav_li(admin_conference_tracks_path(@conference.short_title))}
|
||||
= link_to 'Tracks', admin_conference_tracks_path(@conference.short_title)
|
||||
%li{:class=> active_nav_li(admin_conference_eventtypes_path(@conference.short_title))}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ describe Admin::ConferenceController do
|
|||
patch :update, id: conference.short_title, conference:
|
||||
attributes_for(:conference, title: 'Example Con')
|
||||
conference.reload
|
||||
expect(response).to redirect_to admin_conference_path(
|
||||
expect(response).to redirect_to edit_admin_conference_path(
|
||||
conference.short_title)
|
||||
end
|
||||
end
|
||||
|
|
@ -61,7 +61,7 @@ describe Admin::ConferenceController do
|
|||
|
||||
expect(flash[:alert]).
|
||||
to eq("Updating conference failed. Short title can't be blank.")
|
||||
expect(response).to redirect_to admin_conference_path(
|
||||
expect(response).to redirect_to edit_admin_conference_path(
|
||||
conference.short_title)
|
||||
end
|
||||
end
|
||||
|
|
@ -120,6 +120,18 @@ describe Admin::ConferenceController do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'GET #edit' do
|
||||
it 'assigns the requested conference to conference' do
|
||||
get :show, id: conference.short_title
|
||||
expect(assigns(:conference)).to eq conference
|
||||
end
|
||||
|
||||
it 'renders the show template' do
|
||||
get :show, id: conference.short_title
|
||||
expect(response).to render_template :show
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'assigns the requested conference to conference' do
|
||||
get :show, id: conference.short_title
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ feature Conference do
|
|||
expected_count = Conference.count
|
||||
sign_in create(user)
|
||||
|
||||
visit admin_conference_path(conference.short_title)
|
||||
visit edit_admin_conference_path(conference.short_title)
|
||||
fill_in 'conference_title', with: 'New Con'
|
||||
fill_in 'conference_short_title', with: 'NewCon'
|
||||
fill_in 'conference_social_tag', with: 'NewCon'
|
||||
|
|
|
|||
12
spec/views/admin/conference/edit.html.haml_spec.rb
Normal file
12
spec/views/admin/conference/edit.html.haml_spec.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'admin/conference/edit' do
|
||||
|
||||
it 'renders conference details which are editable' do
|
||||
@conference = create(:conference, title: 'OpenSUSE')
|
||||
assign :conference, @conference
|
||||
render template: 'admin/conference/edit.html.haml'
|
||||
expect(rendered).to include('OpenSUSE')
|
||||
expect(rendered).to include("#{@conference.contact_email}")
|
||||
end
|
||||
end
|
||||
|
|
@ -2,11 +2,10 @@ require 'spec_helper'
|
|||
|
||||
describe 'admin/conference/show' do
|
||||
|
||||
it 'renders conference details which are editable' do
|
||||
it 'renders conference dashboard' do
|
||||
@conference = create(:conference, title: 'OpenSUSE')
|
||||
assign :conference, @conference
|
||||
render
|
||||
expect(rendered).to include('OpenSUSE')
|
||||
expect(rendered).to include("#{@conference.contact_email}")
|
||||
expect(rendered).to include("Dashboard for #{@conference.title}")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue