add ability to disable site profile

This commit is contained in:
Kyle Drake 2017-06-14 13:58:58 -07:00
parent 31c7b7637a
commit 83756af770
4 changed files with 13 additions and 4 deletions

View file

@ -51,7 +51,8 @@ post '/settings/:username/profile' do
require_ownership_for_settings
@site.update(
profile_comments_enabled: params[:site][:profile_comments_enabled]
profile_comments_enabled: params[:site][:profile_comments_enabled],
profile_enabled: params[:site][:profile_enabled]
)
flash[:success] = 'Profile settings changed.'
redirect "/settings/#{@site.username}#profile"

View file

@ -11,6 +11,8 @@ get '/site/:username/?' do |username|
redirect '/' if site.is_education
redirect site.uri unless site.profile_enabled
@title = site.title
@page = params[:page]

View file

@ -26,7 +26,7 @@
<li class="active"><a href="#profile" data-toggle="tab">Profile</a></li>
<!-- <li><a href="#domain" data-toggle="tab">Domain Name</a></li> -->
<li><a href="#custom_domain" data-toggle="tab">Custom Domain</a></li>
<li><a href="#username" data-toggle="tab">Change Site (User) Name</a></li>
<li><a href="#username" data-toggle="tab">Change Site Name</a></li>
<li><a href="#tipping" data-toggle="tab">Tipping</a></li>
<li><a href="#api_key" data-toggle="tab">API Key</a></li>

View file

@ -6,9 +6,15 @@
<input name="site[profile_comments_enabled]" type="hidden" value="true">
<input name="site[profile_comments_enabled]" type="checkbox" value="false"
<% if @site.profile_comments_enabled == false %>checked<% end %>
> Turn off profile comments
> Disable Site Profile Comments
</p>
<p>
<input name="site[profile_enabled]" type="hidden" value="true">
<input name="site[profile_enabled]" type="checkbox" value="false"
<% if @site.profile_enabled == false %>checked<% end %>
> Disable Site Profile
</p>
<input class="btn-Action" type="submit" value="Update Site Profile Settings">
</form>
</div>
</div>