forked from hmlON/room538
-
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.
- Loading branch information
Showing
6 changed files
with
43 additions
and
24 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,21 @@ | ||
class ActivitiesController < ApplicationController | ||
before_action :authenticate_user! | ||
before_action :require_room_presence | ||
|
||
def create | ||
activity = Activity.new(activity_params) | ||
if activity.save | ||
redirect_to dashboard_path, notice: "Good job, #{current_user.name}, for \"#{activity.name}\"!" | ||
else | ||
redirect_to dashboard_path, alert: activity.errors.full_messages.join(', ') | ||
end | ||
end | ||
|
||
private | ||
|
||
def activity_params | ||
params.require(:activity) | ||
.permit(:room_activity_id) | ||
.merge(user_id: current_user.id) | ||
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
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,7 +1,6 @@ | ||
= form_tag(submit_done_action_path, method: :post, class: 'text-center') do | ||
.form-group | ||
= collection_select :user_action, :id, | ||
current_user.user_actions, :id, :name, | ||
{ prompt: 'What have you done today?', disabled: false }, | ||
{ class: 'custom-select', required: true } | ||
= submit_tag 'Submit', class: 'btn btn-primary' | ||
= simple_form_for Activity.new do |f| | ||
.card.text-center | ||
.card-block | ||
h5.text-center What have you done today? | ||
= f.input :room_activity_id, collection: @room.room_activities, prompt: '-', label: false | ||
= f.submit 'Submit', class: 'btn btn-primary' |
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