Skip to content

Commit

Permalink
feat: Show floating feedback button for gold-msi
Browse files Browse the repository at this point in the history
  • Loading branch information
drikusroor committed Dec 28, 2023
1 parent 9f6f7bb commit bc4b8fe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
16 changes: 13 additions & 3 deletions backend/experiment/rules/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,20 @@ def __init__(self):
def feedback_info(self):
feedback_body = render_to_string('feedback/user_feedback.html', {'email': self.contact_email})
return {
# Header above the feedback form
'header': _("Do you have any remarks or questions?"),

# Button text
'button': _("Submit"),

# Body of the feedback form, can be HTML. Shown under the button
'contact_body': feedback_body,
'thank_you': _("We appreciate your feedback!")

# Thank you message after submitting feedback
'thank_you': _("We appreciate your feedback!"),

# Show a floating button on the right side of the screen to open the feedback form
'show_float_button': False,
}

def calculate_score(self, result, data):
Expand Down Expand Up @@ -112,7 +122,7 @@ def get_single_question(self, session, randomize=False):
feedback_form=Form([question], is_skippable=question.is_skippable))
except StopIteration:
return None

def get_questionnaire(self, session, randomize=False, cutoff_index=None):
''' Get a list of questions to be asked in succession '''

Expand All @@ -127,7 +137,7 @@ def get_questionnaire(self, session, randomize=False, cutoff_index=None):
feedback_form=Form([question], is_skippable=question.is_skippable)
))
return trials

def social_media_info(self, experiment, score):
current_url = "{}/{}".format(settings.RELOAD_PARTICIPANT_TARGET,
experiment.slug
Expand Down
5 changes: 5 additions & 0 deletions backend/experiment/rules/gold_msi.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ def next_round(self, session, request_session=None):
return questions
else:
return final_action_with_optional_button(session, '', request_session)

def feedback_info(self):
info = super().feedback_info()
info['show_float_button'] = True
return info

0 comments on commit bc4b8fe

Please sign in to comment.