Changed views and routes
used sigular resource for routes added destroy action in custom domains made instructions in 'edit/new' and 'show' visually similar added new action and view for custom domain
This commit is contained in:
parent
0494f022d2
commit
7317fc1f9f
10 changed files with 100 additions and 79 deletions
|
|
@ -22,7 +22,7 @@ linters:
|
||||||
- "app/views/admin/comments/_posted_comments.html.haml"
|
- "app/views/admin/comments/_posted_comments.html.haml"
|
||||||
- "app/views/admin/comments/_unread_comments.html.haml"
|
- "app/views/admin/comments/_unread_comments.html.haml"
|
||||||
- "app/views/admin/commercials/index.html.haml"
|
- "app/views/admin/commercials/index.html.haml"
|
||||||
- "app/views/admin/conference_domains/edit.haml"
|
- "app/views/admin/conference_domains/_form.haml"
|
||||||
- "app/views/admin/conference_domains/show.haml"
|
- "app/views/admin/conference_domains/show.haml"
|
||||||
- "app/views/admin/conferences/_campaigns.html.haml"
|
- "app/views/admin/conferences/_campaigns.html.haml"
|
||||||
- "app/views/admin/conferences/_doughnut_chart.html.haml"
|
- "app/views/admin/conferences/_doughnut_chart.html.haml"
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,43 @@
|
||||||
module Admin
|
module Admin
|
||||||
class ConferenceDomainsController < Admin::BaseController
|
class ConferenceDomainsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_resource :conference, find_by: :short_title
|
||||||
|
|
||||||
|
def new
|
||||||
|
# To only allow organizers, organization admin and site administrators
|
||||||
|
authorize! :update, @conference
|
||||||
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
# To only allow organizers, organization admin and site administrators
|
# To only allow organizers, organization admin and site administrators
|
||||||
authorize! :update, @conference
|
authorize! :update, @conference
|
||||||
redirect_to admin_conference_conference_domains_edit_path(@conference.short_title) unless @conference.custom_domain.present?
|
redirect_to new_admin_conference_domain_path(@conference.short_title) unless @conference.custom_domain.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
authorize! :edit, @conference
|
authorize! :update, @conference
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
authorize! :update, @conference
|
authorize! :update, @conference
|
||||||
@conference.assign_attributes(conference_params)
|
@conference.assign_attributes(conference_params)
|
||||||
if @conference.save
|
if @conference.save
|
||||||
redirect_to admin_conference_conference_domain_path(@conference.short_title),
|
redirect_to admin_conference_domain_path(@conference.short_title),
|
||||||
notice: 'Attached new domain name to conference. This does not mean that the new domain should work. Please make sure you follow step 3 to point your domain to this hosted version'
|
notice: 'Attached new domain name to conference. This does not mean that the new domain should work. Please make sure you follow step 3 to point your domain to this hosted version'
|
||||||
else
|
else
|
||||||
redirect_to admin_conference_conference_domains_edit_path(@conference.short_title),
|
redirect_to edit_admin_conference_domain_path(@conference.short_title),
|
||||||
notice: 'Failed to add the new domain as custom domain to the conference'
|
error: 'Failed to add the new domain as custom domain to the conference'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
authorize! :update, @conference
|
||||||
|
@conference.custom_domain = nil
|
||||||
|
if @conference.save
|
||||||
|
redirect_to new_admin_conference_domain_path(@conference.short_title),
|
||||||
|
notice: 'Custom domain successfully removed from conference'
|
||||||
|
else
|
||||||
|
redirect_to admin_conference_domain_path(@conference.short_title),
|
||||||
|
error: 'Failed o remove custom domain from the conference'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
41
app/views/admin/conference_domains/_form.haml
Normal file
41
app/views/admin/conference_domains/_form.haml
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%h1
|
||||||
|
Custom Domain
|
||||||
|
%p.text-muted
|
||||||
|
Point your own domain to #{conference.title}
|
||||||
|
%hr
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%h2
|
||||||
|
Step 1:
|
||||||
|
%strong
|
||||||
|
Unfortunately, we can't do this for you and you have to perform this step with the help your domain registrar!
|
||||||
|
%p
|
||||||
|
Pick a domain you want to host your conference on from a domain registrar or register it with a domain registrar.
|
||||||
|
%h2
|
||||||
|
Step 2:
|
||||||
|
%p
|
||||||
|
Enter your existing domain in the field below to point the domain to your conference splashpage.
|
||||||
|
= semantic_form_for(conference, url: admin_conference_domain_path(conference.short_title)) do |f|
|
||||||
|
= f.input :custom_domain, label: false
|
||||||
|
= f.action :submit, button_html: { class: 'btn btn-primary', value: 'Attach this domain' }
|
||||||
|
%h2
|
||||||
|
Step 3:
|
||||||
|
%strong
|
||||||
|
Unfortunately, we can't do this for you and you have to perform this step with the help your domain registrar!
|
||||||
|
%p
|
||||||
|
The last step is adding a CNAME record in your registrar’s DNS Settings. Different registrars have different ways of adding a CNAME record. The following guides would help you setup a CNAME record depending upon the registrar of your domain. If it doesn’t, you probably should get in touch with your domain registrar and ask him how to register a CNAME record in their platform.
|
||||||
|
%ul
|
||||||
|
%li
|
||||||
|
= link_to 'GoDaddy', 'https://in.godaddy.com/help/add-a-cname-record-19236'
|
||||||
|
%li
|
||||||
|
= link_to 'Namecheap', 'https://www.namecheap.com/support/knowledgebase/article.aspx/9646/2237/how-can-i-set-up-a-cname-record-for-my-domain'
|
||||||
|
%li
|
||||||
|
= link_to 'BlueHost', 'https://my.bluehost.com/cgi/help/cname#creating_a_cname'
|
||||||
|
%li
|
||||||
|
= link_to '12-reg.co.uk', 'https://www.123-reg.co.uk/support/answers/Domains/Domain-Configuration/how-do-i-set-up-a-cname-record-on-my-domain-name-1198/'
|
||||||
|
%li
|
||||||
|
= link_to '1&1', 'https://help.1and1.com/domains-c36931/manage-domains-c79822/dns-c37586/enter-a-cname-for-your-subdomain-a643600.html'
|
||||||
|
.well.well-lg
|
||||||
|
It might take upto 24-48 hours depending upon your registrar to update your DNS Settings.
|
||||||
|
|
@ -1,41 +1 @@
|
||||||
.row
|
= render 'form', conference: @conference
|
||||||
.col-md-12
|
|
||||||
%h1
|
|
||||||
Custom Domain
|
|
||||||
%p.text-muted
|
|
||||||
Point your own domain to #{@conference.title}
|
|
||||||
%hr
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
%h2
|
|
||||||
Step 1:
|
|
||||||
%strong
|
|
||||||
Unfortunately, we can't do this for you and you have to perform this step with the help your domain registrar!
|
|
||||||
%p
|
|
||||||
Pick a domain you want to host your conference on from a domain registrar or register it with a domain registrar.
|
|
||||||
%h2
|
|
||||||
Step 2:
|
|
||||||
%p
|
|
||||||
Enter your existing domain in the field below to point the domain to your conference splashpage.
|
|
||||||
= semantic_form_for(@conference, url: admin_conference_conference_domain_path(@conference.short_title)) do |f|
|
|
||||||
= f.input :custom_domain, label: false
|
|
||||||
= f.action :submit, button_html: { class: 'btn btn-primary', value: 'Attach this domain' }
|
|
||||||
%h2
|
|
||||||
Step 3:
|
|
||||||
%strong
|
|
||||||
Unfortunately, we can't do this for you and you have to perform this step with the help your domain registrar!
|
|
||||||
%p
|
|
||||||
The last step is adding a CNAME record in your registrar’s DNS Settings. Different registrars have different ways of adding a CNAME record. The following guides would help you setup a CNAME record depending upon the registrar of your domain. If it doesn’t, you probably should get in touch with your domain registrar and ask him how to register a CNAME record in their platform.
|
|
||||||
%ul
|
|
||||||
%li
|
|
||||||
= link_to 'GoDaddy', 'https://in.godaddy.com/help/add-a-cname-record-19236'
|
|
||||||
%li
|
|
||||||
= link_to 'Namecheap', 'https://www.namecheap.com/support/knowledgebase/article.aspx/9646/2237/how-can-i-set-up-a-cname-record-for-my-domain'
|
|
||||||
%li
|
|
||||||
= link_to 'BlueHost', 'https://my.bluehost.com/cgi/help/cname#creating_a_cname'
|
|
||||||
%li
|
|
||||||
= link_to '12-reg.co.uk', 'https://www.123-reg.co.uk/support/answers/Domains/Domain-Configuration/how-do-i-set-up-a-cname-record-on-my-domain-name-1198/'
|
|
||||||
%li
|
|
||||||
= link_to '1&1', 'https://help.1and1.com/domains-c36931/manage-domains-c79822/dns-c37586/enter-a-cname-for-your-subdomain-a643600.html'
|
|
||||||
.well.well-lg
|
|
||||||
It might take upto 24-48 hours depending upon your registrar to update your DNS Settings.
|
|
||||||
|
|
|
||||||
1
app/views/admin/conference_domains/new.haml
Normal file
1
app/views/admin/conference_domains/new.haml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
= render 'form', conference: @conference
|
||||||
|
|
@ -31,9 +31,9 @@
|
||||||
feature disabled
|
feature disabled
|
||||||
%td
|
%td
|
||||||
.btn-group
|
.btn-group
|
||||||
= link_to 'Edit', admin_conference_conference_domains_edit_path(@conference.short_title),
|
= link_to 'Edit', edit_admin_conference_domain_path(@conference.short_title),
|
||||||
method: :get, class: 'btn btn-primary'
|
method: :get, class: 'btn btn-primary'
|
||||||
= link_to 'Delete', admin_conference_path(@conference.short_title),
|
= link_to 'Delete', admin_conference_domain_path(@conference.short_title),
|
||||||
method: :delete, class: 'btn btn-danger'
|
method: :delete, class: 'btn btn-danger'
|
||||||
.row
|
.row
|
||||||
.col-md-9.text-right
|
.col-md-9.text-right
|
||||||
|
|
@ -66,25 +66,30 @@
|
||||||
%i
|
%i
|
||||||
three
|
three
|
||||||
steps:
|
steps:
|
||||||
%ol
|
%h2
|
||||||
|
Step 1:
|
||||||
|
%strong
|
||||||
|
Unfortunately, we can't do this for you and you have to perform this step with the help your domain registrar!
|
||||||
|
%p
|
||||||
|
Pick a domain you want to host your conference on from a domain registrar or register it with a domain registrar.
|
||||||
|
%h2
|
||||||
|
Step 2:
|
||||||
|
%p
|
||||||
|
Attach your existing domain to your conference by adding it in the new/edit domain name page of your conference. That domain name will point to the splashpage of your conference after completion of all steps.
|
||||||
|
%h2
|
||||||
|
Step 3:
|
||||||
|
%strong
|
||||||
|
Unfortunately, we can't do this for you and you have to perform this step with the help your domain registrar!
|
||||||
|
%p
|
||||||
|
The last step is adding a CNAME record in your registrar’s DNS Settings. Different registrars have different ways of adding a CNAME record. The following guides would help you setup a CNAME record depending upon the registrar of your domain. If it doesn’t, you probably should get in touch with your domain registrar and ask him how to register a CNAME record in their platform.
|
||||||
|
%ul
|
||||||
%li
|
%li
|
||||||
Pick a domain you want to host your conference on from a domain registrar or register it with a domain registrar.
|
= link_to 'GoDaddy', 'https://in.godaddy.com/help/add-a-cname-record-19236'
|
||||||
%li
|
%li
|
||||||
Add your own domain name to OSEM
|
= link_to 'Namecheap', 'https://www.namecheap.com/support/knowledgebase/article.aspx/9646/2237/how-can-i-set-up-a-cname-record-for-my-domain'
|
||||||
= link_to 'here', admin_conference_conference_domains_edit_path(@conference.short_title)
|
|
||||||
%li
|
%li
|
||||||
The last step is adding a CNAME record in your registrar’s DNS Settings.
|
= link_to 'BlueHost', 'https://my.bluehost.com/cgi/help/cname#creating_a_cname'
|
||||||
Different registrars have different ways of adding a CNAME record.
|
%li
|
||||||
The following guides would help you setup a CNAME record depending upon the registrar of your domain.
|
= link_to '12-reg.co.uk', 'https://www.123-reg.co.uk/support/answers/Domains/Domain-Configuration/how-do-i-set-up-a-cname-record-on-my-domain-name-1198/'
|
||||||
If it doesn’t, you probably should get in touch with your domain registrar and ask him how to register a CNAME record in their platform.
|
%li
|
||||||
%ul
|
= link_to '1&1', 'https://help.1and1.com/domains-c36931/manage-domains-c79822/dns-c37586/enter-a-cname-for-your-subdomain-a643600.html'
|
||||||
%li
|
|
||||||
= link_to 'GoDaddy', 'https://in.godaddy.com/help/add-a-cname-record-19236'
|
|
||||||
%li
|
|
||||||
= link_to 'Namecheap', 'https://www.namecheap.com/support/knowledgebase/article.aspx/9646/2237/how-can-i-set-up-a-cname-record-for-my-domain'
|
|
||||||
%li
|
|
||||||
= link_to 'BlueHost', 'https://my.bluehost.com/cgi/help/cname#creating_a_cname'
|
|
||||||
%li
|
|
||||||
= link_to '12-reg.co.uk', 'https://www.123-reg.co.uk/support/answers/Domains/Domain-Configuration/how-do-i-set-up-a-cname-record-on-my-domain-name-1198/'
|
|
||||||
%li
|
|
||||||
= link_to '1&1', 'https://help.1and1.com/domains-c36931/manage-domains-c79822/dns-c37586/enter-a-cname-for-your-subdomain-a643600.html'
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
Dashboard
|
Dashboard
|
||||||
- if can? :edit, @conference
|
- if can? :edit, @conference
|
||||||
%li
|
%li
|
||||||
= link_to(admin_conference_conference_domain_path(@conference.short_title)) do
|
= link_to(admin_conference_domain_path(@conference.short_title)) do
|
||||||
%span.fa.fa-link
|
%span.fa.fa-link
|
||||||
Custom domain
|
Custom domain
|
||||||
- if can? :show, @conference
|
- if can? :show, @conference
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,7 @@ Osem::Application.routes.draw do
|
||||||
end
|
end
|
||||||
resources :comments, only: [:index]
|
resources :comments, only: [:index]
|
||||||
resources :conferences do
|
resources :conferences do
|
||||||
get 'conference_domains/edit' => 'conference_domains#edit'
|
resource :domain, controller: 'conference_domains'
|
||||||
get 'conference_domain' => 'conference_domains#show'
|
|
||||||
patch 'conference_domain' => 'conference_domains#update'
|
|
||||||
|
|
||||||
resource :contact, except: [:index, :new, :create, :show, :destroy]
|
resource :contact, except: [:index, :new, :create, :show, :destroy]
|
||||||
resources :schedules, only: [:index, :create, :show, :update, :destroy]
|
resources :schedules, only: [:index, :create, :show, :update, :destroy]
|
||||||
resources :event_schedules, only: [:create, :update, :destroy]
|
resources :event_schedules, only: [:create, :update, :destroy]
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ describe Admin::ConferenceDomainsController do
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
it 'redirects to edit if custom domain is not present' do
|
it 'redirects to edit if custom domain is not present' do
|
||||||
get :show, conference_id: conference.short_title
|
get :show, conference_id: conference.short_title
|
||||||
expect(response).to redirect_to(admin_conference_conference_domains_edit_path)
|
expect(response).to redirect_to(edit_admin_conference_domain_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'renders correct template if custom domain is present' do
|
it 'renders correct template if custom domain is present' do
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ feature Conference do
|
||||||
|
|
||||||
shared_examples 'successfully adds, update or show custom domain' do
|
shared_examples 'successfully adds, update or show custom domain' do
|
||||||
scenario 'adds or update custom domain of a conference', feature: true, js: true do
|
scenario 'adds or update custom domain of a conference', feature: true, js: true do
|
||||||
visit admin_conference_conference_domains_edit_path(conference.short_title)
|
visit edit_admin_conference_domain_path(conference.short_title)
|
||||||
|
|
||||||
fill_in 'conference_custom_domain', with: 'newdomain.conf'
|
fill_in 'conference_custom_domain', with: 'newdomain.conf'
|
||||||
click_button 'Attach this domain'
|
click_button 'Attach this domain'
|
||||||
|
|
@ -25,7 +25,7 @@ feature Conference do
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'show custom domain of a conference', feature: true, js: true do
|
scenario 'show custom domain of a conference', feature: true, js: true do
|
||||||
visit admin_conference_conference_domain_path(conference.short_title)
|
visit admin_conference_domain_path(conference.short_title)
|
||||||
|
|
||||||
expect(page).to have_text('mydomain.conf')
|
expect(page).to have_text('mydomain.conf')
|
||||||
end
|
end
|
||||||
|
|
@ -33,13 +33,13 @@ feature Conference do
|
||||||
|
|
||||||
shared_examples 'does not add, update or show custom domain' do
|
shared_examples 'does not add, update or show custom domain' do
|
||||||
scenario 'does not add or update custom domain', feature: true, js: true do
|
scenario 'does not add or update custom domain', feature: true, js: true do
|
||||||
visit admin_conference_conference_domains_edit_path(conference.short_title)
|
visit edit_admin_conference_domain_path(conference.short_title)
|
||||||
|
|
||||||
expect(flash).to eq 'You are not authorized to access this page.'
|
expect(flash).to eq 'You are not authorized to access this page.'
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'does not show custom domain of a conference', feature: true, js: true do
|
scenario 'does not show custom domain of a conference', feature: true, js: true do
|
||||||
visit admin_conference_conference_domain_path(conference.short_title)
|
visit admin_conference_domain_path(conference.short_title)
|
||||||
|
|
||||||
expect(flash).to eq 'You are not authorized to access this page.'
|
expect(flash).to eq 'You are not authorized to access this page.'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue