Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

Commit

Permalink
WIP #241 Fix chat room URL, request params etc
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshtrivedi committed Apr 3, 2021
1 parent 82b9c37 commit 39f09fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions app/controllers/user_levels_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ class UserLevelsController < InheritedResources::Base
end

def update
user_level = UserLevel.find(params[:user_level_id])
user_level = UserLevel.find(params[:id])
if params[:commit] == "Submit Work"
user_level.answer = params[:answer]
user_level.submit!
elsif params[:commit] == "Accept" && user_level.course.taught_by?(current_user)
user_level.feedback = params[:feedback]
user_level.feedback = params[:user_level][:feedback]
user_level.accept!
elsif params[:commit] == "Reject" && user_level.course.taught_by?(current_user)
user_level.feedback = params[:feedback]
user_level.feedback = params[:user_level][:feedback]
user_level.reject!
elsif params[:commit] == "Save feedback" && user_level.course.taught_by?(current_user)
user_level.feedback = params[:user_level][:feedback]
user_level.save!
end
redirect_to course_level_path(@user_level.course, @user_level.level)
redirect_to course_level_path(user_level.course, user_level.level)
end

def destroy
Expand Down
4 changes: 3 additions & 1 deletion app/views/courses/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@
</div>

<% if @student %>
<% if @current_user_level.feedback.present? %>
<p class="bg-yellow-200 border-2 border-yellow-500 text-yellow-800 p-4 mt-2 rounded-md">
<img class="inline-block h-10 w-10 rounded-full ring-2 ring-white mr-2" src="<%= @course.user.image_url %>" alt="">
<%= @current_user_level.feedback %>
</p>
<% end %>
<%= simple_form_for(@current_user_level, builder: SimpleForm::Tailwind::FormBuilder, url: course_level_user_level_path(@current_user_level.course, @current_user_level.level,@current_user_level)) do |f| %>
<div class="mt-8 form-inputs space-y-6">
<%= f.input :answer, label: @current_user_level.level.answer_prompt, as: @current_user_level.level.answer_type, required: true, wrapper: :tailwind_string_input %>
Expand Down Expand Up @@ -104,7 +106,7 @@
</div>
<div class="relative w-full h-64 sm:h-72 md:h-96 lg:absolute lg:inset-y-0 lg:right-0 lg:w-1/2 lg:h-full">
<% if User.rocketchat_integration_enabled? %>
<iframe width='100%;' height='100%' src="https://chat.learnawesome.org/channel/<%= @shown_level.rocketchat_channel_name %>?layout=embedded" frameborder="0"></iframe>
<iframe width='100%;' height='100%' src="https://chat.learnawesome.org/group/<%= @shown_level.rocketchat_channel_name %>?layout=embedded" frameborder="0"></iframe>
<% end %>
</div>
</main>

0 comments on commit 39f09fe

Please sign in to comment.