docbrown/app/controllers/admin/welcome_controller.rb
Ben Halpern 6c71369df5
[deploy] Add community_name to site config (#9864)
* Add community_name to site config

* Fix a spec

* Remove SiteConfig from constants

* Change subjects to method

* Fix subjects method

* Fix linting
2020-08-19 14:54:40 -04:00

36 lines
939 B
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module Admin
class WelcomeController < Admin::ApplicationController
layout "admin"
def index
@daily_threads = Article.where("title LIKE 'Welcome Thread - %'")
end
def create
welcome_thread = Article.create(
body_markdown: welcome_thread_content,
user: User.dev_account,
)
redirect_to "#{URI.parse(welcome_thread.path).path}/edit"
end
private
def welcome_thread_content
<<~HEREDOC
---
title: Welcome Thread - v0
published: false
description: Introduce yourself to the community!
tags: welcome
---
Hey there! Welcome to #{SiteConfig.community_name}!
![WELCOME TO THE INTERNET](https://slack-imgs.com/?c=1&url=http%3A%2F%2Fmedia0.giphy.com%2Fmedia%2FzhbrTTpmSCYog%2Fgiphy-downsized.gif)
Leave a comment below to introduce yourself to the community!
HEREDOC
end
end
end