-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from nestauk/add-barebones-texting
Add barebones texting
- Loading branch information
Showing
83 changed files
with
1,901 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
TWILIO_ACCOUNT_SID='aaaaa' | ||
TWILIO_AUTH_TOKEN='bbbbb' | ||
CALLBACK_URL='' | ||
TWILIO_PHONE_NUMBER="+447111111111" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
class ApplicationController < ActionController::Base | ||
if Rails.env == "production" | ||
before_action :authenticate | ||
def after_sign_up_path_for(user) | ||
dashboard_users_path | ||
end | ||
|
||
def authenticate | ||
authenticate_or_request_with_http_basic do |username, password| | ||
username == ENV["USERNAME"] && password == ENV["PASSWORD"] | ||
end | ||
|
||
def after_sign_in_path_for(user) | ||
dashboard_users_path | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
class ContentsController < ApplicationController | ||
before_action :authenticate_admin! | ||
|
||
def new | ||
@group = Group.find_by(id: params[:group_id]) | ||
@content = @group.contents.new | ||
end | ||
|
||
def create | ||
@group = Group.find_by(id: params[:group_id]) | ||
@content = @group.contents.new(content_params) | ||
|
||
if @content.save | ||
redirect_to group_path(@content.group), notice: "Content for message was successfully created" | ||
else | ||
render :new, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
def edit | ||
@content = Content.find(params[:id]) | ||
end | ||
|
||
def update | ||
@content = Content.find(params[:id]) | ||
|
||
if @content.update(content_params) | ||
redirect_to group_path(@content.group), notice: "Content updated!" | ||
else | ||
render :edit, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
def update_position | ||
@content = Content.find(params[:id]) | ||
@content.update(position: params[:position]) | ||
head :no_content | ||
end | ||
|
||
private | ||
|
||
def content_params | ||
params.require(:content).permit(:body, :link, :position) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
class GroupsController < ApplicationController | ||
before_action :authenticate_admin! | ||
|
||
def index | ||
@groups = Group.order(:age_in_months) | ||
end | ||
|
||
def show | ||
@group = Group.find_by(id: params[:id]) | ||
end | ||
|
||
def new | ||
@group = Group.new | ||
end | ||
|
||
def create | ||
@group = Group.new(group_params) | ||
|
||
if @group.save | ||
redirect_to groups_path, notice: "Content group successfully created" | ||
else | ||
render :new, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
def edit | ||
@group = Group.find(params[:id]) | ||
end | ||
|
||
def update | ||
@group = Group.find(params[:id]) | ||
|
||
if @group.update(group_params) | ||
redirect_to groups_path, notice: "Content group updated" | ||
else | ||
render :edit, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
private | ||
|
||
def group_params | ||
params.require(:group).permit(:name, :age_in_months) | ||
end | ||
end |
Oops, something went wrong.