-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add draft flag to activities #4998
Merged
Merged
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
5a45932
Add draft flag to DB (and config?)
jorg-vr 08a6d41
Add draft mode to edit screen
jorg-vr 685ed5d
Update access rights for draft activities
jorg-vr 8be1451
Do not email draft errors
jorg-vr 64b2d96
Fix don't sent email function
jorg-vr 4c4d4c3
Allow editing draft in the policy
jorg-vr 2f570b8
Show draft images on home page
jorg-vr adb0e50
Visualise draft modus for lists
jorg-vr a4307f5
Filter activities by draft flag
jorg-vr 8535338
Add draft warning to the top of the page
jorg-vr 71c5747
Fix server file
jorg-vr 0c56209
Fix existing tests
jorg-vr ea8a8ef
Fix linting
jorg-vr fb6cbae
Add page access tests
jorg-vr 4e0fceb
Update app/views/pages/_user_card.html.erb
jorg-vr 7b8bfaa
Update config/locales/views/activities/nl.yml
jorg-vr 2e9dfbf
Mark as draft during repository reprocess
jorg-vr 15736e2
Update translation from ontwerp to concept
jorg-vr d34e984
Revert "Mark as draft during repository reprocess"
jorg-vr 5cf0f25
Always update draft flag
jorg-vr a8647ac
Apply suggestions from code review
jorg-vr 0d493d2
Concept => ongepubliceerd
jorg-vr 29deee3
Merge branch 'main' into feat/add-draft-flag
jorg-vr 925b65a
Add links to doc
jorg-vr 3a39a7a
Undo unwanted annotations
jorg-vr 4817cf4
Merge branch 'main' into feat/add-draft-flag
jorg-vr 9a4499c
Apply feedback to simplify pr
jorg-vr 242f61a
Do not allow reset to draft
jorg-vr 7fc6a26
Fix tests
jorg-vr 87a0c7d
Update icon layout in lists
jorg-vr 4f601a9
Restore always showing col
jorg-vr 715f25c
Reset code to original
jorg-vr 587056b
Add some draft activities in the seed
jorg-vr bd08828
Add draft notice to all pages
jorg-vr a17cb6a
Move validation to policy
jorg-vr 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 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 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -4,7 +4,7 @@ def resolve | |
if user&.zeus? | ||
scope.all | ||
else | ||
scope.where(access: :public, status: :ok).or(scope.where(repository: user&.repositories)) | ||
scope.where(access: :public, status: :ok, draft: false).or(scope.where(repository: user&.repositories)) | ||
end | ||
end | ||
end | ||
|
@@ -75,7 +75,7 @@ def read? | |
|
||
def permitted_attributes | ||
if update? | ||
%i[access name_nl name_en] | ||
%i[access name_nl name_en draft] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could also check here that |
||
else | ||
[] | ||
end | ||
|
This file contains 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 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 @@ | ||
<% if @activity.draft? %> | ||
<div class="alert alert-warning"> | ||
<i class="mdi mdi-file-document-edit-outline"></i> | ||
<%= t "activities.show.alert_draft_html" %> | ||
<% if policy(@activity).edit? %> | ||
<% edit_path = @series.present? ? | ||
course_series_activity_path(@series&.course, @series, @activity, {activity: {draft: false}}) : | ||
activity_path(@activity, {activity: {draft: false}}) | ||
%> | ||
<%= link_to t("activities.show.alert_draft_edit"), edit_path, method: :put %> | ||
|
||
<% end %> | ||
</div> | ||
<% end %> |
This file contains 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 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 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 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 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 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 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 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 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 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 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 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,5 @@ | ||
class AddDraftToActivities < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :activities, :draft, :boolean, default: false | ||
end | ||
end |
This file contains 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,5 @@ | ||
class MakeDraftDefaultTrue < ActiveRecord::Migration[7.1] | ||
def change | ||
change_column_default :activities, :draft, from: false, to: true | ||
end | ||
end |
This file contains 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 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.
what does this do?
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.
if not
draft_was
, validate ifdraft
is in the list of possible values, with the only possible value beingfalse
draft_was
is the previous value ofdraft
so if the previous value of
draft
wasfalse
, only allowfalse
as new valueThere 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.
You could argument that this check should be in the controller instead of the model, but not a strong opinion so ok for me.