Loading config/install/helpfulness.settings.yml +6 −2 Original line number Diff line number Diff line helpfulness_yes_allow_comment: 1 helpfulness_yes_title: 'Thanks. Any other comments?' helpfulness_yes_description: 'We appreciate the feedback.' helpfulness_yes_comment_required: 0 helpfulness_yes_comment_required_message: 'Comment is required.' helpfulness_no_allow_comment: 1 helpfulness_no_title: 'Sorry to hear that. Please tell me more!' helpfulness_no_description: 'Please include your email if you want us to follow up with you.' helpfulness_comment_required: 0 helpfulness_comment_required_message: 'Comment is required.' helpfulness_no_comment_required: 1 helpfulness_no_comment_required_message: 'Comment is required.' helpfulness_notification_email: '' helpfulness_notification_subject: 'Helpfulness feedback message' helpfulness_notification_message_prefix: 'You have received new helpfulness feedback.' Loading config/schema/helpfulness.schema.yml +12 −0 Original line number Diff line number Diff line Loading @@ -6,10 +6,22 @@ helpfulness.settings: type: string helpfulness_no_title: type: string helpfulness_yes_allow_comment: type: boolean helpfulness_no_allow_comment: type: boolean helpfulness_yes_description: type: string helpfulness_no_description: type: string helpfulness_yes_comment_required: type: boolean helpfulness_no_comment_required: type: boolean helpfulness_yes_comment_required_message: type: string helpfulness_no_comment_required_message: type: string helpfulness_report_option_display_username: type: integer helpfulness_report_option_display_helpfulness: Loading css/helpfulness.module.css +5 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,11 @@ display: none; } .form-item-helpfulness-comments { .form-item-helpfulness-comments-no { display: none; } .form-item-helpfulness-comments-yes { display: none; } Loading helpfulness.install +19 −0 Original line number Diff line number Diff line Loading @@ -78,3 +78,22 @@ function helpfulness_schema() { return $schema; } /** * Update schema config to separate required options for Yes and No. */ function helpfulness_update_9201() { $config_factory = \Drupal::configFactory(); $config = $config_factory->getEditable('helpfulness.settings'); $comment_required = $config->get('helpfulness_comment_required'); $comment_required_message = $config->get('helpfulness_comment_required_message'); $config->set('helpfulness_yes_comment_required', $comment_required) ->set('helpfulness_no_comment_required', $comment_required) ->set('helpfulness_yes_allow_comment', TRUE) ->set('helpfulness_no_allow_comment', TRUE) ->set('helpfulness_yes_comment_required_message', $comment_required_message) ->set('helpfulness_no_comment_required_message', $comment_required_message) ->clear('helpfulness_comment_required') ->clear('helpfulness_comment_required_message') ->save(TRUE); } js/helpfulness.js +8 −2 Original line number Diff line number Diff line Loading @@ -8,15 +8,18 @@ $(document).ready(function () { var selected = $("input[type='radio'][name='helpfulness_rating']:checked"); if (selected.length > 0) { $('.form-item-helpfulness-comments').css('display', 'block'); $('.helpfulness_submit_button').css('display', 'block'); if (selected.val() === '1') { $('.form-item-helpfulness-comments-yes').show(); $('.form-item-helpfulness-comments-no').hide(); $('.helpfulness_no_title').css('display', 'none'); $('.helpfulness_yes_title').css('display', 'block'); $('.helpfulness_no_description').css('display', 'none'); $('.helpfulness_yes_description').css('display', 'block'); } else { $('.form-item-helpfulness-comments-no').show(); $('.form-item-helpfulness-comments-yes').hide(); $('.helpfulness_yes_title').css('display', 'none'); $('.helpfulness_no_title').css('display', 'block'); $('.helpfulness_yes_description').css('display', 'none'); Loading @@ -26,15 +29,18 @@ $('input:radio[name=helpfulness_rating]').change(function () { var value = $(this).val(); $('.form-item-helpfulness-comments').show(); $('.helpfulness_submit_button').show(); if (value === '1') { $('.form-item-helpfulness-comments-yes').show(); $('.form-item-helpfulness-comments-no').hide(); $('.helpfulness_no_title').hide(); $('.helpfulness_no_description').hide(); $('.helpfulness_yes_title').show(); $('.helpfulness_yes_description').show(); } else { $('.form-item-helpfulness-comments-no').show(); $('.form-item-helpfulness-comments-yes').hide(); $('.helpfulness_yes_title').hide(); $('.helpfulness_yes_description').hide(); $('.helpfulness_no_title').show(); Loading Loading
config/install/helpfulness.settings.yml +6 −2 Original line number Diff line number Diff line helpfulness_yes_allow_comment: 1 helpfulness_yes_title: 'Thanks. Any other comments?' helpfulness_yes_description: 'We appreciate the feedback.' helpfulness_yes_comment_required: 0 helpfulness_yes_comment_required_message: 'Comment is required.' helpfulness_no_allow_comment: 1 helpfulness_no_title: 'Sorry to hear that. Please tell me more!' helpfulness_no_description: 'Please include your email if you want us to follow up with you.' helpfulness_comment_required: 0 helpfulness_comment_required_message: 'Comment is required.' helpfulness_no_comment_required: 1 helpfulness_no_comment_required_message: 'Comment is required.' helpfulness_notification_email: '' helpfulness_notification_subject: 'Helpfulness feedback message' helpfulness_notification_message_prefix: 'You have received new helpfulness feedback.' Loading
config/schema/helpfulness.schema.yml +12 −0 Original line number Diff line number Diff line Loading @@ -6,10 +6,22 @@ helpfulness.settings: type: string helpfulness_no_title: type: string helpfulness_yes_allow_comment: type: boolean helpfulness_no_allow_comment: type: boolean helpfulness_yes_description: type: string helpfulness_no_description: type: string helpfulness_yes_comment_required: type: boolean helpfulness_no_comment_required: type: boolean helpfulness_yes_comment_required_message: type: string helpfulness_no_comment_required_message: type: string helpfulness_report_option_display_username: type: integer helpfulness_report_option_display_helpfulness: Loading
css/helpfulness.module.css +5 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,11 @@ display: none; } .form-item-helpfulness-comments { .form-item-helpfulness-comments-no { display: none; } .form-item-helpfulness-comments-yes { display: none; } Loading
helpfulness.install +19 −0 Original line number Diff line number Diff line Loading @@ -78,3 +78,22 @@ function helpfulness_schema() { return $schema; } /** * Update schema config to separate required options for Yes and No. */ function helpfulness_update_9201() { $config_factory = \Drupal::configFactory(); $config = $config_factory->getEditable('helpfulness.settings'); $comment_required = $config->get('helpfulness_comment_required'); $comment_required_message = $config->get('helpfulness_comment_required_message'); $config->set('helpfulness_yes_comment_required', $comment_required) ->set('helpfulness_no_comment_required', $comment_required) ->set('helpfulness_yes_allow_comment', TRUE) ->set('helpfulness_no_allow_comment', TRUE) ->set('helpfulness_yes_comment_required_message', $comment_required_message) ->set('helpfulness_no_comment_required_message', $comment_required_message) ->clear('helpfulness_comment_required') ->clear('helpfulness_comment_required_message') ->save(TRUE); }
js/helpfulness.js +8 −2 Original line number Diff line number Diff line Loading @@ -8,15 +8,18 @@ $(document).ready(function () { var selected = $("input[type='radio'][name='helpfulness_rating']:checked"); if (selected.length > 0) { $('.form-item-helpfulness-comments').css('display', 'block'); $('.helpfulness_submit_button').css('display', 'block'); if (selected.val() === '1') { $('.form-item-helpfulness-comments-yes').show(); $('.form-item-helpfulness-comments-no').hide(); $('.helpfulness_no_title').css('display', 'none'); $('.helpfulness_yes_title').css('display', 'block'); $('.helpfulness_no_description').css('display', 'none'); $('.helpfulness_yes_description').css('display', 'block'); } else { $('.form-item-helpfulness-comments-no').show(); $('.form-item-helpfulness-comments-yes').hide(); $('.helpfulness_yes_title').css('display', 'none'); $('.helpfulness_no_title').css('display', 'block'); $('.helpfulness_yes_description').css('display', 'none'); Loading @@ -26,15 +29,18 @@ $('input:radio[name=helpfulness_rating]').change(function () { var value = $(this).val(); $('.form-item-helpfulness-comments').show(); $('.helpfulness_submit_button').show(); if (value === '1') { $('.form-item-helpfulness-comments-yes').show(); $('.form-item-helpfulness-comments-no').hide(); $('.helpfulness_no_title').hide(); $('.helpfulness_no_description').hide(); $('.helpfulness_yes_title').show(); $('.helpfulness_yes_description').show(); } else { $('.form-item-helpfulness-comments-no').show(); $('.form-item-helpfulness-comments-yes').hide(); $('.helpfulness_yes_title').hide(); $('.helpfulness_yes_description').hide(); $('.helpfulness_no_title').show(); Loading