Skip to content
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

Draft and published mode for Moments and Strategies #10

Closed
julianguyen opened this issue Feb 15, 2015 · 11 comments

Comments

7 participants
@julianguyen
Copy link
Member

commented Feb 15, 2015

Saving as a draft does not publish the trigger/strategy to the user's allies. On the other had, publishing does.

@julianguyen

This comment has been minimized.

Copy link
Member Author

commented Oct 2, 2016

How's this going @damiong28?

@damiong28

This comment has been minimized.

Copy link
Collaborator

commented Oct 4, 2016

Still working on it!

@julianguyen

This comment has been minimized.

Copy link
Member Author

commented Oct 30, 2016

How's this going @damiong28? :)

@julianguyen julianguyen changed the title Draft and published mode for triggers and strategies Draft and published mode for Moments and Strategies Mar 10, 2017

@cartothemax

This comment has been minimized.

Copy link
Collaborator

commented May 18, 2017

@damiong28 would it be alright if I picked up this issue? Thanks!

@jnamster

This comment has been minimized.

@julianguyen julianguyen moved this from TODO to In Progress in New Features Aug 7, 2017

@julianguyen julianguyen moved this from In Progress to TODO in New Features Aug 7, 2017

@alvarocasadoc alvarocasadoc self-assigned this Oct 5, 2017

@alvarocasadoc

This comment has been minimized.

Copy link
Collaborator

commented Oct 6, 2017

I've been working a bit on this. Here's what I think could work well and some suggestions and notes about it's implementation:

Expected behaviour

Adding/editing a moment/strategy

  • When a user adds a moment/strategy he/she can click on one of these submit buttons
    publishing buttons
  • If the user selects Publish the moment/strategy will become available as it is done now.
  • If the user selects Save as draft only he/she will be able to view its info.
  • When a user edits a moment/strategy she/he can decide wether to publish it or keep it as a draft even if it was already published.
    publishing buttons 2

Displaying moments/strategies

  • Every user can view all his/hers moments/strategies.
  • When a moment/strategy is saved as draft a small badge is displayed next to the created/edited info in the index:
    draft badge
  • This badge is also displayed when a moment/strategy is displayed via show.
  • When a user visits other user's profile he won't be able to view his/hers moments/stories that are saved as drafts.

Current implementation

  • Added a published_at field to the Moment/Strategy models and DB schema.
  • Modified moment/strategy forms to include multiple submit buttons.
  • Modified moment/strategy controllers to respond to the different submit buttons commit types (publish/save as draft/unpublish).
  • Modified get_stories in application_controller.rb to filter other users' stories (only displaying those that are already published).

Next

  • Make sure that a user can't access another user's stories if they are not published (we don't want only filter them in the view). This could be implemented in hide_page? in application_controller.rb.
  • Writing the required model, controller and feature tests.
  • Update application_controller_spec to test the get_stories and hide_page? methods.

Questions and suggestions

  • Should the stats on a user's profile page stop considering draft moments/strategies? This means no moment/strategy nor dependent associations (moods/categories/strategies) should be counted.
  • Is there any other desired behavior that should be implemented?
  • Is there anything that should be changed in the described implementation?
  • Any UX notes are appreciated!
@julianguyen

This comment has been minimized.

Copy link
Member Author

commented Oct 7, 2017

Wow @alvarocasadoc this is looking fantastic, really great attention to detail 💯

I like the different states you put on the button. If it helps you keep organized, feel free to create separate issues for each of the different tasks you have to do and put them all into a project.

Along with When a user visits other user's profile he won't be able to view his/hers moments/stories that are saved as drafts. which is a great idea, I think a user should be able to view their own profile with draft posts.

Great questions:

  • Yeah that stats should just include published posts.
  • I think we can have the same draft indicator you have in the story card in the post itself beside the Created: section.

Anyone else feel free to chime in!

Thanks a million for this, I'm excited to see this feature finally roll out!

@nshki

This comment has been minimized.

Copy link
Member

commented Oct 7, 2017

This is awesome @alvarocasadoc! Only feedback I have at the moment is in regards to the UI controlling publish/draft state.

What if we utilize a checkbox of sorts that makes it visually clear what state a moment/strategy will be in once the form is submitted rather than having multiple buttons that send different params back to the server? So, for example:

publish-draft

This way, the user only has to think about one submit button, and it will be clear to them whether or not the moment/strategy will be published or be saved as a draft on submit.

@alvarocasadoc

This comment has been minimized.

Copy link
Collaborator

commented Oct 8, 2017

I think that's a great idea! What about something like this?

demo

@alvarocasadoc

This comment has been minimized.

Copy link
Collaborator

commented Oct 8, 2017

This is what a user can see in his/her own profile:
ownprofile

And this is what another user can see when he/she visits his ally profile:
othersprofile

@nshki

This comment has been minimized.

Copy link
Member

commented Oct 8, 2017

Looking good! 💯

Will be revisiting design with #691 but I think what you have is great prior to the redesign!

julianguyen added a commit that referenced this issue Oct 24, 2017

Added draft/published functionality - Closes(issue #10) (#704)
* Add clarification to run yarn before rspec (#674)

* Update press page, cleanup search box CSS, hide moments graph on mobile

* Add Team ifPairElseUnknown's blog posts to Press page

* CSS fix on search boxes

* Hide unresponsive moments graph on mobile

* refact: move remove's responsibility to model instead from controller

* solve issue #57 (#678)

* Fix bug in shared form view (closes #625) (#677)

* Fix bug in shared form view

* Edit form view for brevity

* Remove package-lock.json

* Add to Resources page

* refact: move tests from allies controler to allyship models

* Add GET #show meeting_controller_spec

* refact: static code analysis

* feat: add new test to check if an allyship was destroyed successfully

* Add medications controller tests (#681)

* Add tests for index and new routes

* Add test for show route

* Split README.md Into Multiple Files [Hacktoberfest] (#680)

* Split README.md into multiple files

* Tweak README.md

* Fix tiny typo

* Removed Donate and License Links

* Another tiny fix 🙄

* test

* Added Links to Files in README.md

* Fix Typo

* Totally the last type fix

* Moved Contributer Blurb to README.md for Prominance

* Update README.md

* Update README.md

* Update DESIGN.md

* Update INSTALLATION.md

* Update INSTALLATION.md

* Update README.md

* Update TESTING.md

* Update WORKFLOW.md

* Update DESIGN.md

* Update INSTALLATION.md

* Fix broken links in README

* Fix heading bugs in README

* refact: create new private functions into allyship models

* Add delete_comment specs for meetings_controller

* feat: add a test to check if viewers (between users) were deleted after an allyship is destroyed

* Add specs for new for meetings_controller

* Add edit specs for meetings_controller

* Added full-screen modal CKEditor on mobile web (closes #538) (#684)

* Basic solution to the #538

* Removed redundant bit of code (issue #538)

* Fixed issues for the PR#684 and added feature tests for the modal editor

* Now this test resizes the window after being executed to a desktop resolution to prevent future conflicts with other tests

* Fixed ModalEditorSpec.js error when running jasmine:ci

* Refactored modal_editor.js to stick to ESLint's guidelines

* file added: ChangeLog.md (closes #651) (#670)

* file added: ChangeLog.md (closes #651)

* improved text formatting and layout

I went with bullets because I wanted indentation, but also
planning ahead (for times where there would be more than
one item underneath a date, or when multiple items might be
used for describing a new feature.

* applied @julianguyen 's instructions

* Added draft/published functionality to moments/strategies

* Added draft stories filtering functionality

* fix: broken links in README.md (#692)

* Moved docs into documentation folder (#694)

As discussed in Slack, docs have been moved out of root for repo cleanliness and standardization.

* Updated hidden_page? in application_controller.rb to filter draft moments/strategies

* Modified most_focus on application_controller.rb to filter drafts so they are not counted in the stats of other users' profiles

* Add ability to debug with foreman (thanks to @SophieRoseMcDonald @jnamster) (#698)

* Fix puma.rb bug on production

* Added model tests for draft/published feature

* Added model tests for draft/published feature

* Modified application_controller_spec.rb to test draft/published functionality

* Refactored moments/strategies form to include a switch for the draft/published feature

* Added temporary translations to locale files for draft/published feature

* Added feature tests for draft moments

* Added feature test for draft strategies

* Fixed _form partial for strategies

* Added ptbr translations for draft/published feature (thanks to @localhostpedro for helping with the translation)

* Pull request how to issue 649 (#689)

* fixed merge conflict in WORKFLOW.md during rebase

* [#649] - added instructions for pull request and syncing to WORKFLOW.md

* [#649] in Workflow.md create a link to a wiki for how to create a pull request and syncing

* [#649] removed HOW TO: from title and added space between upstream(ifme).

* Added sv translation for draft/publish feature (thanks to @alexiamcdonald)

* change the contributors route to contribute, change helper functions and all function calls. (#701)

change locales keys from contributor to contribute and reflect all locale yml file key calls from view files.
change the respec test to reflect the change of route from contributors to contribute

* Added a migration for setting every post's updated_at field as default value for its publication date

* Fixed typos

* Updated tag_usage to filter drafts

* Updated some code styling elements in moment/strategy and application controllers

* Updated moments and strategies controllers to make quick created posts published by default

* Updated some code styling elements in moment/strategy and application controllers

* Updated some code styling elements in application controllers

* fix link to CONTRIBUTING doc

* Add Translations documentation link to README

* fix link to contribution page

* Adding myself as a contributor. (#695)

* Adding myself as a contributor.

* fixes json syntax error

* accept any version of ruby 2.3 in the Gemfile (#710)

according the heroku docs it's recommended to accept a wider range of ruby versions in the gemfile https://devcenter.heroku.com/articles/ruby-versions

This will help people avoid errors because their ruby version is a slight mismatch

* Persisting browser locale after sign in #703

* Using guard clause

* move conditional to other private method

* Annotate models (#706)

* updates docker file to install yarn and node (#711)

* Switched all double quotes to sinlge quotes (#722)

* Update contributors.json (#727)

* Add 1 resource and 1 tag  (#731)

* Add internalization for teachers tag (issue 486).

* Add new service to resource page

* Add contributor.

* Fixing test for persisting locale after sign in (#732)

Added some expects that wait for elements to appear before moving on. I suspect the page hasn't finished loading when the next step in the test starts to immediately run.

* Fixed input styling on mobile medications page (Fixes #713) (#725)

* Styled children of .form_container to use flexbox

* Removed margin-right from select in mobile

* Removed unused CSS rules from mobile

* Converted tabs to spaces

* Refactored some html and css for a cleaner code

* Refactored css and html to make draft switch responsive by using flexbox

* Refactored controller for a DRY friendlier solution

* Refactored controller for a DRY friendlier solution

* Added empty keys for draft strings for NL translations

* Update nl.yml with draft translations

The title says it all really. Muchos gracias!

@julianguyen julianguyen moved this from TODO to Completed in New Features Oct 24, 2017

aSquare14 pushed a commit to aSquare14/ifme that referenced this issue Aug 28, 2018

Merge pull request ifmeorg#10 from aSquare14/RSpec
Tests For Report Model and a few minor fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.