-
-
Notifications
You must be signed in to change notification settings - Fork 71
Allow ability descriptions to be edited #2031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4b9593d
added scaffolding for editing abilities (global admin only for now)
Oaphi 11e8378
more scaffolding for editing abilities
Oaphi e0eed36
fixed duplication of set_ability in AbilitiesController#show
Oaphi f1415aa
minor rubocop fix
Oaphi 8db0056
working ability edit implementation
Oaphi 0f0d111
added ability update success flash
Oaphi 4e2d24f
sensitive abilities-related actions should require authentication
Oaphi 1a1a03c
added tests for abilities controller's update action
Oaphi 7c68e32
Merge branch 'develop' into 0valt/abilities-edit
Oaphi ac149b3
allowed moderators to edit ability descriptions
Oaphi f5c4d27
apparently, the schema hasn't been updated after the latest changes
Oaphi 2201add
made User#can_push_to_network? generic
Oaphi 539d970
implemented network push for ability updates
Oaphi 5f069e4
minor rubocop fix
Oaphi c52793a
added test for ability update network push
Oaphi b4209ab
ability edit form should account for ability descriptions being optional
Oaphi 3c789a2
added presence validation for ability names
Oaphi b05f3d7
technically allowed ability names to be updated as well (no UI for now)
Oaphi 7d7986b
added test for rejecting invalid ability updates
Oaphi 99bb891
improved invalid ability updates test coverage
Oaphi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,49 @@ | ||
| <%= render 'posts/markdown_script' %> | ||
| <%= render 'posts/image_upload' %> | ||
|
|
||
| <% if @ability.errors.any? %> | ||
| <div class="notice is-danger"> | ||
| There were some errors while saving this ability: | ||
|
|
||
| <ul> | ||
| <% @ability.errors.full_messages.each do |msg| %> | ||
| <li><%= msg %></li> | ||
| <% end %> | ||
| </ul> | ||
| </div> | ||
| <% end %> | ||
|
|
||
| <%= form_for @ability, url: submit_path do |f| %> | ||
| <%= render 'shared/body_field', | ||
| f: f, | ||
| field_name: :description, | ||
| field_label: t('abilities.body_label'), | ||
| post: @ability, | ||
| cur_length: @ability.description&.length, | ||
| min_length: 15, | ||
| max_length: 30_000 %> | ||
| <div class="post-preview"></div> | ||
|
|
||
|
|
||
| <% if current_user&.can_push_to_network?(@ability) %> | ||
| <div class="form-group"> | ||
| <div class="checkbox-setting"> | ||
| <div class="checkbox-setting--desc"> | ||
| <%= label_tag :network_push, 'Push to network', class: 'form-element' %> | ||
| <span class="form-caption">Copy to all communities (where the ability has not been edited)?</span> | ||
| </div> | ||
| <div class="checkbox-setting--value"> | ||
| <%= check_box_tag :network_push, true, false, class: 'form-checkbox-element' %> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <% end %> | ||
|
|
||
| <%= f.submit 'Save', class: 'button is-filled' %> | ||
| <%= link_to t('g.cancel').titlecase, | ||
| ability_path(id: @ability.internal_id), | ||
| class: 'button is-muted is-outlined is-danger js-cancel-edit', | ||
| data: { | ||
| question_body: t('abilities.unsaved_changes_confirmation') | ||
| } %> | ||
| <% end %> |
This file contains hidden or 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,14 @@ | ||
| <%# | ||
| "Instance variables: | ||
| @ability : Ability to edit | ||
| "%> | ||
|
|
||
| <% | ||
| title = "Edit ability \"#{@ability.name}\"" | ||
| %> | ||
|
|
||
| <% content_for :title, title %> | ||
|
|
||
| <h1><%= title %></h1> | ||
|
|
||
| <%= render 'form', submit_path: update_ability_path(id: @ability.internal_id) %> |
This file contains hidden or 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 hidden or 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,10 @@ | ||
| en: | ||
| abilities: | ||
| #_form.html.erb | ||
| body_label: > | ||
| Description | ||
| unsaved_changes_confirmation: > | ||
| Any unsaved changes will be lost. Are you sure? | ||
| success: | ||
| update_generic: > | ||
| Ability successfully updated. |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently, we forgot to update the schema in the recent updates - adding a comment here to avoid confusion