| @@ -22,7 +22,7 @@ discard block | ||
| 22 | 22 |          $this->authorize('click-button'); | 
| 23 | 23 | |
| 24 | 24 | $buttonClick = ButtonClick::create([ | 
| 25 | - 'clicked_by' => $authentication->getUser()->id() | |
| 25 | + 'clicked_by' => $authentication->getUser()->id() | |
| 26 | 26 | ]); | 
| 27 | 27 | |
| 28 | 28 | event(new ButtonSubmitted($buttonClick)); | 
| @@ -48,7 +48,7 @@ discard block | ||
| 48 | 48 |              return Response::create('', Response::HTTP_NO_CONTENT); | 
| 49 | 49 |          } else { | 
| 50 | 50 | throw ValidationException::withMessages([ | 
| 51 | - 'button' => ['Could not delete the button click'] | |
| 51 | + 'button' => ['Could not delete the button click'] | |
| 52 | 52 | ]); | 
| 53 | 53 | } | 
| 54 | 54 | } | 
| @@ -21,8 +21,8 @@ | ||
| 21 | 21 | */ | 
| 22 | 22 | public function getAppendedAttributes(): array | 
| 23 | 23 |      { | 
| 24 | - return [ | |
| 25 | - 'apiKey' => $this->apiKey | |
| 26 | - ]; | |
| 24 | + return [ | |
| 25 | + 'apiKey' => $this->apiKey | |
| 26 | + ]; | |
| 27 | 27 | } | 
| 28 | 28 | } | 
| @@ -21,46 +21,46 @@ discard block | ||
| 21 | 21 |  { | 
| 22 | 22 | |
| 23 | 23 | protected $permissions = [ | 
| 24 | - 'view-page' => [ | |
| 24 | + 'view-page' => [ | |
| 25 | 25 | 'name' => 'View Participant Page', | 
| 26 | 26 | 'description' => 'View the main page of the module.', | 
| 27 | 27 | 'admin' => false | 
| 28 | - ], | |
| 29 | - 'click-button' => [ | |
| 28 | + ], | |
| 29 | + 'click-button' => [ | |
| 30 | 30 | 'name' => 'Click Submit Button', | 
| 31 | 31 | 'description' => 'Can click the submit button', | 
| 32 | 32 | 'admin' => false | 
| 33 | - ], | |
| 34 | - 'delete-button-click' => [ | |
| 33 | + ], | |
| 34 | + 'delete-button-click' => [ | |
| 35 | 35 | 'name' => 'Unsubmit Submit Button', | 
| 36 | 36 | 'description' => 'Can unsubmit the page once already submitted', | 
| 37 | 37 | 'admin' => false | 
| 38 | - ], | |
| 39 | - 'admin.view-page' => [ | |
| 38 | + ], | |
| 39 | + 'admin.view-page' => [ | |
| 40 | 40 | 'name' => 'View Admin Page', | 
| 41 | 41 | 'description' => 'View the administrator page of the module.', | 
| 42 | 42 | 'admin' => true | 
| 43 | - ], | |
| 44 | - 'admin.page-view.index' => [ | |
| 43 | + ], | |
| 44 | + 'admin.page-view.index' => [ | |
| 45 | 45 | 'name' => 'View page views', | 
| 46 | 46 | 'description' => 'View all page views for the module.', | 
| 47 | 47 | 'admin' => true | 
| 48 | - ] | |
| 48 | + ] | |
| 49 | 49 | ]; | 
| 50 | 50 | |
| 51 | 51 | protected $events = [ | 
| 52 | - PageViewed::class => [ | |
| 52 | + PageViewed::class => [ | |
| 53 | 53 | 'name' => 'A static page has been viewed', | 
| 54 | 54 | 'description' => 'A static page module has been viewed by a participant of the module.' | 
| 55 | - ], | |
| 56 | - ButtonSubmitted::class => [ | |
| 55 | + ], | |
| 56 | + ButtonSubmitted::class => [ | |
| 57 | 57 | 'name' => 'The button has been submitted', | 
| 58 | 58 | 'description' => 'The button on a static page has been pressed by a participant' | 
| 59 | - ], | |
| 60 | - ButtonUnsubmitted::class => [ | |
| 59 | + ], | |
| 60 | + ButtonUnsubmitted::class => [ | |
| 61 | 61 | 'name' => 'The button has been unsubmitted', | 
| 62 | 62 | 'description' => 'The button on a static page has been unsubmitted by a participant' | 
| 63 | - ] | |
| 63 | + ] | |
| 64 | 64 | ]; | 
| 65 | 65 | |
| 66 | 66 | protected $commands = [ | 
| @@ -94,7 +94,7 @@ discard block | ||
| 94 | 94 |          Route::bind('static_page_button_click', function($id) { | 
| 95 | 95 | $buttonClick = ButtonClick::findOrFail((int) $id); | 
| 96 | 96 | if( | 
| 97 | -              request()->route('module_instance_slug') | |
| 97 | +                request()->route('module_instance_slug') | |
| 98 | 98 |                && (int) $buttonClick->module_instance_id === request()->route('module_instance_slug')->id()) { | 
| 99 | 99 | return $buttonClick; | 
| 100 | 100 | } | 
| @@ -114,21 +114,21 @@ discard block | ||
| 114 | 114 | public function settings(): Form | 
| 115 | 115 |      { | 
| 116 | 116 | return \FormSchema\Generator\Form::make()->withGroup( | 
| 117 | -          Group::make('Layout')->withField( | |
| 117 | +            Group::make('Layout')->withField( | |
| 118 | 118 |              Field::input('title')->inputType('text')->label('Title') | 
| 119 | -              ->hint('The title of the page')->help('This will appear at the top of the page and in the browser tab.') | |
| 120 | - )->withField( | |
| 119 | +                ->hint('The title of the page')->help('This will appear at the top of the page and in the browser tab.') | |
| 120 | + )->withField( | |
| 121 | 121 |              Field::input('subtitle')->inputType('text')->label('Subtitle') | 
| 122 | -              ->hint('The subtitle of the page')->help('This will appear below the title. You can use this to give more information about the page.') | |
| 123 | - )->withField( | |
| 122 | +                ->hint('The subtitle of the page')->help('This will appear below the title. You can use this to give more information about the page.') | |
| 123 | + )->withField( | |
| 124 | 124 |              Field::make(HtmlField::class, 'html')->label('Page Content') | 
| 125 | -              ->apiKey(config('static-page.tinymce.apiKey')) | |
| 126 | -              ->hint('The content of the page')->help('This is the main content of the page.') | |
| 127 | - ) | |
| 125 | +                ->apiKey(config('static-page.tinymce.apiKey')) | |
| 126 | +                ->hint('The content of the page')->help('This is the main content of the page.') | |
| 127 | + ) | |
| 128 | 128 | )->withGroup( | 
| 129 | -          Group::make('Button')->withField( | |
| 129 | +            Group::make('Button')->withField( | |
| 130 | 130 |              Field::input('button_text')->inputType('text')->label('Button Text')->hint('Text to show on the button') | 
| 131 | - ) | |
| 131 | + ) | |
| 132 | 132 | )->getSchema(); | 
| 133 | 133 | } | 
| 134 | 134 | } | 
| @@ -38,50 +38,50 @@ discard block | ||
| 38 | 38 | public static function getFieldMetaData(): array | 
| 39 | 39 |      { | 
| 40 | 40 | return [ | 
| 41 | - 'user_id' => [ | |
| 41 | + 'user_id' => [ | |
| 42 | 42 | 'label' => 'User ID', | 
| 43 | 43 | 'helptext' => 'The ID of the user' | 
| 44 | - ], | |
| 45 | - 'user_email' => [ | |
| 44 | + ], | |
| 45 | + 'user_email' => [ | |
| 46 | 46 | 'label' => 'Email Address', | 
| 47 | 47 | 'helptext' => 'Email Address of the user. May be empty.' | 
| 48 | - ], | |
| 49 | - 'user_first_name' => [ | |
| 48 | + ], | |
| 49 | + 'user_first_name' => [ | |
| 50 | 50 | 'label' => 'First Name', | 
| 51 | 51 | 'helptext' => 'First Name of the user. May be empty.' | 
| 52 | - ], | |
| 53 | - 'user_last_name' => [ | |
| 52 | + ], | |
| 53 | + 'user_last_name' => [ | |
| 54 | 54 | 'label' => 'Last Name', | 
| 55 | 55 | 'helptext' => 'Last Name of the user. May be empty.' | 
| 56 | - ], | |
| 57 | - 'user_preferred_name' => [ | |
| 56 | + ], | |
| 57 | + 'user_preferred_name' => [ | |
| 58 | 58 | 'label' => 'Preferred Name', | 
| 59 | 59 | 'helptext' => 'Preferred Name of the user. May be empty.' | 
| 60 | - ], | |
| 61 | - 'module_instance_id' => [ | |
| 60 | + ], | |
| 61 | + 'module_instance_id' => [ | |
| 62 | 62 | 'label' => 'Module Instance ID', | 
| 63 | 63 | 'helptext' => 'ID of the module instance viewed' | 
| 64 | - ], | |
| 65 | - 'module_instance_name' => [ | |
| 64 | + ], | |
| 65 | + 'module_instance_name' => [ | |
| 66 | 66 | 'label' => 'Module Instance Name', | 
| 67 | 67 | 'helptext' => 'Name of the module instance viewed.' | 
| 68 | - ], | |
| 69 | - 'activity_instance_id' => [ | |
| 68 | + ], | |
| 69 | + 'activity_instance_id' => [ | |
| 70 | 70 | 'label' => 'Activity Instance ID', | 
| 71 | 71 | 'helptext' => 'The id of the activity instance viewed.' | 
| 72 | - ], | |
| 73 | - 'activity_instance_name' => [ | |
| 72 | + ], | |
| 73 | + 'activity_instance_name' => [ | |
| 74 | 74 | 'label' => 'Activity Instance Name', | 
| 75 | 75 | 'helptext' => 'The name of the activity instance viewed.' | 
| 76 | - ], | |
| 77 | - 'clicked_at' => [ | |
| 76 | + ], | |
| 77 | + 'clicked_at' => [ | |
| 78 | 78 | 'label' => 'Button Clicked At', | 
| 79 | 79 | 'helptext' => 'The date and time the button was clicked at' | 
| 80 | - ], | |
| 81 | - 'unsubmitted_at' => [ | |
| 80 | + ], | |
| 81 | + 'unsubmitted_at' => [ | |
| 82 | 82 | 'label' => 'Button Unsubmitted At', | 
| 83 | 83 | 'helptext' => 'The date and time the button was unsubmitted at' | 
| 84 | - ], | |
| 84 | + ], | |
| 85 | 85 | ]; | 
| 86 | 86 | } | 
| 87 | 87 | |
| @@ -102,17 +102,17 @@ discard block | ||
| 102 | 102 | $moduleInstance = app(ModuleInstanceRepository::class)->getById($this->buttonClick->module_instance_id); | 
| 103 | 103 | $activityInstance = app(ActivityInstanceRepository::class)->getById($this->buttonClick->activity_instance_id); | 
| 104 | 104 | return [ | 
| 105 | - 'user_id' => $this->buttonClick->user->id(), | |
| 106 | - 'user_email' => $this->buttonClick->user->data()->email(), | |
| 107 | - 'user_first_name' => $this->buttonClick->user->data()->firstName(), | |
| 108 | - 'user_last_name' => $this->buttonClick->user->data()->lastName(), | |
| 109 | - 'user_preferred_name' => $this->buttonClick->user->data()->preferredName(), | |
| 110 | -          'clicked_at' => $this->buttonClick->created_at->format('Y-m-d H:i:s'), | |
| 111 | -          'unsubmitted_at' => $this->buttonClick->deleted_at->format('Y-m-d H:i:s'), | |
| 112 | - 'module_instance_id' => $moduleInstance->id, | |
| 113 | - 'module_instance_name' => $moduleInstance->name, | |
| 114 | - 'activity_instance_id' => $activityInstance->id, | |
| 115 | - 'activity_instance_name' => $activityInstance->name, | |
| 105 | + 'user_id' => $this->buttonClick->user->id(), | |
| 106 | + 'user_email' => $this->buttonClick->user->data()->email(), | |
| 107 | + 'user_first_name' => $this->buttonClick->user->data()->firstName(), | |
| 108 | + 'user_last_name' => $this->buttonClick->user->data()->lastName(), | |
| 109 | + 'user_preferred_name' => $this->buttonClick->user->data()->preferredName(), | |
| 110 | +            'clicked_at' => $this->buttonClick->created_at->format('Y-m-d H:i:s'), | |
| 111 | +            'unsubmitted_at' => $this->buttonClick->deleted_at->format('Y-m-d H:i:s'), | |
| 112 | + 'module_instance_id' => $moduleInstance->id, | |
| 113 | + 'module_instance_name' => $moduleInstance->name, | |
| 114 | + 'activity_instance_id' => $activityInstance->id, | |
| 115 | + 'activity_instance_name' => $activityInstance->name, | |
| 116 | 116 | ]; | 
| 117 | 117 | } | 
| 118 | 118 | } | 
| @@ -38,46 +38,46 @@ discard block | ||
| 38 | 38 | public static function getFieldMetaData(): array | 
| 39 | 39 |      { | 
| 40 | 40 | return [ | 
| 41 | - 'user_id' => [ | |
| 41 | + 'user_id' => [ | |
| 42 | 42 | 'label' => 'User ID', | 
| 43 | 43 | 'helptext' => 'The ID of the user' | 
| 44 | - ], | |
| 45 | - 'user_email' => [ | |
| 44 | + ], | |
| 45 | + 'user_email' => [ | |
| 46 | 46 | 'label' => 'Email Address', | 
| 47 | 47 | 'helptext' => 'Email Address of the user. May be empty.' | 
| 48 | - ], | |
| 49 | - 'user_first_name' => [ | |
| 48 | + ], | |
| 49 | + 'user_first_name' => [ | |
| 50 | 50 | 'label' => 'First Name', | 
| 51 | 51 | 'helptext' => 'First Name of the user. May be empty.' | 
| 52 | - ], | |
| 53 | - 'user_last_name' => [ | |
| 52 | + ], | |
| 53 | + 'user_last_name' => [ | |
| 54 | 54 | 'label' => 'Last Name', | 
| 55 | 55 | 'helptext' => 'Last Name of the user. May be empty.' | 
| 56 | - ], | |
| 57 | - 'user_preferred_name' => [ | |
| 56 | + ], | |
| 57 | + 'user_preferred_name' => [ | |
| 58 | 58 | 'label' => 'Preferred Name', | 
| 59 | 59 | 'helptext' => 'Preferred Name of the user. May be empty.' | 
| 60 | - ], | |
| 61 | - 'module_instance_id' => [ | |
| 60 | + ], | |
| 61 | + 'module_instance_id' => [ | |
| 62 | 62 | 'label' => 'Module Instance ID', | 
| 63 | 63 | 'helptext' => 'ID of the module instance viewed' | 
| 64 | - ], | |
| 65 | - 'module_instance_name' => [ | |
| 64 | + ], | |
| 65 | + 'module_instance_name' => [ | |
| 66 | 66 | 'label' => 'Module Instance Name', | 
| 67 | 67 | 'helptext' => 'Name of the module instance viewed.' | 
| 68 | - ], | |
| 69 | - 'activity_instance_id' => [ | |
| 68 | + ], | |
| 69 | + 'activity_instance_id' => [ | |
| 70 | 70 | 'label' => 'Activity Instance ID', | 
| 71 | 71 | 'helptext' => 'The id of the activity instance viewed.' | 
| 72 | - ], | |
| 73 | - 'activity_instance_name' => [ | |
| 72 | + ], | |
| 73 | + 'activity_instance_name' => [ | |
| 74 | 74 | 'label' => 'Activity Instance Name', | 
| 75 | 75 | 'helptext' => 'The name of the activity instance viewed.' | 
| 76 | - ], | |
| 77 | - 'clicked_at' => [ | |
| 76 | + ], | |
| 77 | + 'clicked_at' => [ | |
| 78 | 78 | 'label' => 'Button Clicked At', | 
| 79 | 79 | 'helptext' => 'The date and time the button was clicked at' | 
| 80 | - ], | |
| 80 | + ], | |
| 81 | 81 | ]; | 
| 82 | 82 | } | 
| 83 | 83 | |
| @@ -98,16 +98,16 @@ discard block | ||
| 98 | 98 | $moduleInstance = app(ModuleInstanceRepository::class)->getById($this->buttonClick->module_instance_id); | 
| 99 | 99 | $activityInstance = app(ActivityInstanceRepository::class)->getById($this->buttonClick->activity_instance_id); | 
| 100 | 100 | return [ | 
| 101 | - 'user_id' => $this->buttonClick->user->id(), | |
| 102 | - 'user_email' => $this->buttonClick->user->data()->email(), | |
| 103 | - 'user_first_name' => $this->buttonClick->user->data()->firstName(), | |
| 104 | - 'user_last_name' => $this->buttonClick->user->data()->lastName(), | |
| 105 | - 'user_preferred_name' => $this->buttonClick->user->data()->preferredName(), | |
| 106 | -          'clicked_at' => $this->buttonClick->created_at->format('Y-m-d H:i:s'), | |
| 107 | - 'module_instance_id' => $moduleInstance->id, | |
| 108 | - 'module_instance_name' => $moduleInstance->name, | |
| 109 | - 'activity_instance_id' => $activityInstance->id, | |
| 110 | - 'activity_instance_name' => $activityInstance->name, | |
| 101 | + 'user_id' => $this->buttonClick->user->id(), | |
| 102 | + 'user_email' => $this->buttonClick->user->data()->email(), | |
| 103 | + 'user_first_name' => $this->buttonClick->user->data()->firstName(), | |
| 104 | + 'user_last_name' => $this->buttonClick->user->data()->lastName(), | |
| 105 | + 'user_preferred_name' => $this->buttonClick->user->data()->preferredName(), | |
| 106 | +            'clicked_at' => $this->buttonClick->created_at->format('Y-m-d H:i:s'), | |
| 107 | + 'module_instance_id' => $moduleInstance->id, | |
| 108 | + 'module_instance_name' => $moduleInstance->name, | |
| 109 | + 'activity_instance_id' => $activityInstance->id, | |
| 110 | + 'activity_instance_name' => $activityInstance->name, | |
| 111 | 111 | ]; | 
| 112 | 112 | } | 
| 113 | 113 | } | 
| @@ -4,6 +4,6 @@ | ||
| 4 | 4 | |
| 5 | 5 |  Route::namespace('Api\Participant')->group(function() { | 
| 6 | 6 |      Route::apiResource('click', 'ButtonController') | 
| 7 | - ->only(['index', 'store', 'destroy']) | |
| 8 | - ->parameters(['click' => 'static_page_button_click']); | |
| 7 | + ->only(['index', 'store', 'destroy']) | |
| 8 | + ->parameters(['click' => 'static_page_button_click']); | |
| 9 | 9 | }); |