-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 questions and comments to profile cards #6472
Conversation
Now that I've uploaded all of this I think I may calculated the wrong numbers and links. I did the numbers for how many that particular author has written under that category.... for example, "user" wrote 2 questions under the topic "bugs." Or is that supposed to be just the total number of questions under "bugs" for all users? |
Wow, this is looking really awesome. A few requests if it's OK!
I think that, given that we see these types of cards in other places around the site, it's worth keeping Also, where do the links for comments lead to? Is there a view for comments by user by topic yet? I know we'd planned this but didn't think it existed yet! |
@@ -1,41 +1,46 @@ | |||
|
|||
<div class="card-view"> | |||
<div class="card-view profile-card"> |
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.
Oh wow so this separate template existed but you've made it match the standard topic card! Awesome!
@@ -225,6 +225,7 @@ | |||
get 'dashboard' => 'home#dashboard' | |||
get 'comments' => 'comment#index' | |||
get 'profile/comments/:id' => 'users#comments' | |||
get 'profile/comments/:id/tag/:tagname' => 'users#comments_by_tagname' |
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.
oh my gosh!!!! amazing.
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.
Wow, this is looking really awesome. A few requests if it's OK!
- could we keep the card background all white?
- can we make the words lower case, like
2 questions
?- What about, for compactness, just
1 note | 4 questions | 2 comments by @author
?I think that, given that we see these types of cards in other places around the site, it's worth keeping
by @author
in this view, just to make it clear that it's a little different here.Also, where do the links for comments lead to? Is there a view for comments by user by topic yet? I know we'd planned this but didn't think it existed yet!
I'll make those changes!
@@ -475,4 +475,13 @@ def render_body | |||
end | |||
body | |||
end | |||
|
|||
def self.find_by_tag_and_author(tagname, userid) |
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.
Woohoo!!!! 🎉
I wonder if we could write a simple unit test for this great method??? Amazing work!
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.
Yes, sure!
app/models/node.rb
Outdated
@@ -877,6 +877,42 @@ def self.questions | |||
.group('node.nid') | |||
end | |||
|
|||
# finds nodes by tag name, user id, and optional node type | |||
def self.find_by_tag_and_author(tagname, user_id, type = 'note') |
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.
Interesting -- very cool! @cesswairimu and I are looking here and I thought we already had a way to do this... maybe? In the controller for https://publiclab.org/tag/water-quality/author/mimiss ? Just wondering where this new code is being used, and if it is possibly redundant with that route? Thanks for helping me understand, this is a big awesome PR!
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.
I didn't see anything that matched, but I'll take a look at that page and see what it uses!
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.
So yes, there is similar logic in TagController#show_for_author, but the variables are passed in via the URL. I'll have to figure out how to refactor my code to use this.
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.
So the issue with this is that I can pull the logic out into a separate function to use in TagController#show_for_author but the problem is that this function doesn't just generate one list of notes, it creates one for notes, questions, answered questions, wikis and nodes. Several of these lists are referenced in other view templates... basically trying to clean it up breaks a bunch of other things.
My only concern with the UI is that the |
@publiclab/reviewers I'm done with this, unless someone else has suggested changes. :) |
This is looking awesome. Fantastic job! I'm wondering if we should try to get the grey zone to not go outside the boundary of the card, as in this snapshot: Would that be hard to adjust? And perhaps the white stripe below could be eliminated as well? Alternatively we could eliminate the grey tone if these changes are very hard to make. But i like how it highlights this content, so just wondering if it's a hard change to make? |
Regarding the | - i think it's OK as it is. It's not perfect but I think the extra division is helpful. |
Oh wow, my monitor didn't even show that light shade. I adjusted my monitor and removed the grey - it is default in Bootstrap, apparently. It should be a white background now! |
Awesome! Great work! Merging this now, fantastic!!! |
Congrats on merging your first pull request! 🙌🎉⚡️ Help others take their first stepNow that you've merged your first pull request, you're the perfect person to help someone else out with this challenging first step. 🙌 Try looking at this list of `first-timers-only` issues, and see if someone else is waiting for feedback, or even stuck! 😕 People often get stuck at the same steps, so you might be able to help someone get unstuck, or help lead them to some documentation that'd help. Reach out and be encouraging and friendly! 😄 🎉 Read about how to help support another newcomer here, or find other ways to offer mutual support here. |
Yes, congratulations!!!! |
* add # notes, questions, comments to user profile * fix codeclimate errors * display correct node type at top of tag/author page * fix /profile/comments/ to show by username * add route for comments by tagname, link added in profile * add styling to profile page cards * refactored Node.find_by_tag_and_author to use Node.questions * change display of note/question/comment links * add unit test for Comment.find_by_tag_and_author * add unit test for Node.find_by_tag_and_author * add assert for questions type in test find by name and user id * remove light grey footer background
* new navbar but should mostly be in a feature * Changed the hyperlink text in Login/Signup Model (#6364) * Changed the hyperlink text in Login/Signup Model Issue Number #6360 * Updated Hyperlink Text * Updated Text in HyperLink * Update _nodes.html.erb * Functional Tests for Ordering aphabetically (#6371) * test ordering of tags * test that wikis are ordered alphabetically based on title * Fix failing test on wiki test * Change 'Read More' blog link to button (#6537) * OpenGraph for Twitter * Update _new_question.html.erb * Add questions and comments to profile cards (#6472) * add # notes, questions, comments to user profile * fix codeclimate errors * display correct node type at top of tag/author page * fix /profile/comments/ to show by username * add route for comments by tagname, link added in profile * add styling to profile page cards * refactored Node.find_by_tag_and_author to use Node.questions * change display of note/question/comment links * add unit test for Comment.find_by_tag_and_author * add unit test for Node.find_by_tag_and_author * add assert for questions type in test find by name and user id * remove light grey footer background * Removed style-breaking classes from table (#6374) * Update 503.html - replace http with https (#6562) * Update 502.html - replace http with https (#6561) * Update 500.html - replace http with https (#6560) * Update 422.html - replace http with https (#6559) * Update 404.html - replace http with https (#6558) * Update index.html - replace http with https (#6557) * change the function named t(...) to translation(...) (#6580) * Flow: Button to post marker + Popup working for multiple maps (#6591) * init * LEL pointed to different branch * popups working * removed forked leaflet * button working great * CSS changes of button * CSS changed to orignal bootstrap button * Updated the user.rb file to bootstrap italic (#6535) * Update README.md file (#6510) Added link to first-timers-only issue template. * Fix comment spelling error (#6521) * Fix icon color on btn-outline-secondary buttons #6518 (#6520) * Bump chart.js from 2.8.0 to 2.9.1 (#6567) Bumps [chart.js](https://github.com/chartjs/Chart.js) from 2.8.0 to 2.9.1. - [Release notes](https://github.com/chartjs/Chart.js/releases) - [Commits](chartjs/Chart.js@v2.8.0...v2.9.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Changed from function t to translation (#6609) Issue resolved: Change function t to translation in dashboard/_node_comment #6600 * Update _edit.html.erb (#6583) * Update _comments.html.erb (#6585) I changed the function named t(....) to be named as translations(...). * Update user.rb (#6587) * Change function t to translation in dashboard/_node_wiki (#6607) * Update_function t to translation in comments/_form (#6608) * wiki/methods: Change t to translation in (#6564) Changes the function name from t to translation in wiki/methods Fixes #6540 * t(....) named as translations(...) on lines 25, 30, 35 and 38 (#6552) * t(....) named as translations(...) on lines 25, 30, 35 and 38 * fix type translations to translation * Change function t to translations in comments/_edit * Revert "Change function t to translations in comments/_edit" This reverts commit e858b75. * changed t function name (#6546) * changed t function name * name fix * change funcion t to translations in users/spamaway (#6545) * change funcion t to translations in users/spamaway * fix typo * Change function t to translations in comments/comments #6538 (#6543) * Change function t to translations Change function t to translations in comments/comments * Change translations to translation * Update _node_meta.html.erb (#6606) Changing method "t" to "translation" * Fix follow button bug on tags (#6576) * Fix bug on issue #6570 * Persist data * Add co-authored posts to profile.html.erb (#6418) * Add co-authored posts to profile.html.erb * Update profile.html.erb * Adjustments to tag graph labeling * Update stats.html.erb * Change function to to translation #6603 (#6659) Change function t to translation in dashboard/_node_question #6603 #6603 * Refresh button (#6507) * added tooltip for refresh button * changes * new changes1 * #6539 Updated t to translations. (#6544) * Updated t to translations. * Updated translations to translation. Error in issue description. * Changed t to translation in _node_moderate (#6695) * some translations adjustments * Add more tests for Node (for note and wiki page titles) (#6366) * Add more tests for Node * Prevent titles that are empty, blank or too short * Update functional tests * Add Redis installation to readme (#6398) * Fix recent questions on shadow page (#6342) * Add package.json, package-lock and test.sqlite-journal to gitingore #6384 (#6385) * Make "choose one" link in comment forms appear underlined (#6401) * Underline "choose one" link Make "choose one" link in comment forms appear underlined #6399 * Add a CSS class to underline text * Add !important to underline CSS class * Fix rubocop errors in app/api & app/channels (#6425) * Fix rubocop errors in app/api & app/channels * Fix rubocop guardclause offenses * Add tag link to show question (#6430) * simple fix for link * not sure what that file was * removed redundant comment count being showed in blog section (#6746) * Update t() function to translation() (#6729) #6728 * Add redis installations for linux (#6751) * Bump rake from 12.3.3 to 13.0.1 (#6764) Bumps [rake](https://github.com/ruby/rake) from 12.3.3 to 13.0.1. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](ruby/rake@v12.3.3...v13.0.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Update _comments.html.erb (#6766) * Update _comments.html.erb Changed the t() to translation() in line 4, 18 and 21. * Update _comments.html.erb Changed the two translation() back to t() on line 18. * Full screen button added in inline maps, Multiple maps in Wiki page works now. (#6699) * full screen added * working on wiki page * code refactoring * console logs removed * inline map layers are ON by default now * version bump of LEL to add new Layers * api changed tagslocation init * api taglocations changed * popup content changed * PL.editor shows map if lat,lon passed in URL. (#6788) * pl-editor shows map * indentation * yarn.lock added for PL.editor * safe traverse syntax used * map API using common global variable. (#6802) * done * removed console logs * [Security] Bump https-proxy-agent from 2.2.1 to 2.2.4 (#6803) Bumps [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) from 2.2.1 to 2.2.4. **This update includes security fixes.** - [Release notes](https://github.com/TooTallNate/node-https-proxy-agent/releases) - [Commits](TooTallNate/proxy-agents@2.2.1...2.2.4) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Update _thumbnail.html.erb to make it consistent with new card display (#6581) * Update _thumbnail.html.erb * Update style.css * Update node_shared_test.rb * Update _thumbnail.html.erb * Update _notes.html.erb * Update _notes.html.erb * Update _notes.html.erb * added ApplicationController.helpers.logged_in_as * Update _notes.html.erb * self.current_user in application_helper.rb * Update application_helper.rb * switch to "@current_user && ['admin','moderator'].includes?(@current_user.role)" * PL.editor shows map if lat,lon passed in URL. (#6788) * pl-editor shows map * indentation * yarn.lock added for PL.editor * safe traverse syntax used * handle nils * Update _notes.html.erb * new navbar but should mostly be in a feature * some translations adjustments * final navbar * fixes for collapse menu * fixes for collapse menu 2 * rest of menus
* new navbar but should mostly be in a feature * Changed the hyperlink text in Login/Signup Model (publiclab#6364) * Changed the hyperlink text in Login/Signup Model Issue Number publiclab#6360 * Updated Hyperlink Text * Updated Text in HyperLink * Update _nodes.html.erb * Functional Tests for Ordering aphabetically (publiclab#6371) * test ordering of tags * test that wikis are ordered alphabetically based on title * Fix failing test on wiki test * Change 'Read More' blog link to button (publiclab#6537) * OpenGraph for Twitter * Update _new_question.html.erb * Add questions and comments to profile cards (publiclab#6472) * add # notes, questions, comments to user profile * fix codeclimate errors * display correct node type at top of tag/author page * fix /profile/comments/ to show by username * add route for comments by tagname, link added in profile * add styling to profile page cards * refactored Node.find_by_tag_and_author to use Node.questions * change display of note/question/comment links * add unit test for Comment.find_by_tag_and_author * add unit test for Node.find_by_tag_and_author * add assert for questions type in test find by name and user id * remove light grey footer background * Removed style-breaking classes from table (publiclab#6374) * Update 503.html - replace http with https (publiclab#6562) * Update 502.html - replace http with https (publiclab#6561) * Update 500.html - replace http with https (publiclab#6560) * Update 422.html - replace http with https (publiclab#6559) * Update 404.html - replace http with https (publiclab#6558) * Update index.html - replace http with https (publiclab#6557) * change the function named t(...) to translation(...) (publiclab#6580) * Flow: Button to post marker + Popup working for multiple maps (publiclab#6591) * init * LEL pointed to different branch * popups working * removed forked leaflet * button working great * CSS changes of button * CSS changed to orignal bootstrap button * Updated the user.rb file to bootstrap italic (publiclab#6535) * Update README.md file (publiclab#6510) Added link to first-timers-only issue template. * Fix comment spelling error (publiclab#6521) * Fix icon color on btn-outline-secondary buttons publiclab#6518 (publiclab#6520) * Bump chart.js from 2.8.0 to 2.9.1 (publiclab#6567) Bumps [chart.js](https://github.com/chartjs/Chart.js) from 2.8.0 to 2.9.1. - [Release notes](https://github.com/chartjs/Chart.js/releases) - [Commits](chartjs/Chart.js@v2.8.0...v2.9.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Changed from function t to translation (publiclab#6609) Issue resolved: Change function t to translation in dashboard/_node_comment publiclab#6600 * Update _edit.html.erb (publiclab#6583) * Update _comments.html.erb (publiclab#6585) I changed the function named t(....) to be named as translations(...). * Update user.rb (publiclab#6587) * Change function t to translation in dashboard/_node_wiki (publiclab#6607) * Update_function t to translation in comments/_form (publiclab#6608) * wiki/methods: Change t to translation in (publiclab#6564) Changes the function name from t to translation in wiki/methods Fixes publiclab#6540 * t(....) named as translations(...) on lines 25, 30, 35 and 38 (publiclab#6552) * t(....) named as translations(...) on lines 25, 30, 35 and 38 * fix type translations to translation * Change function t to translations in comments/_edit * Revert "Change function t to translations in comments/_edit" This reverts commit e858b75. * changed t function name (publiclab#6546) * changed t function name * name fix * change funcion t to translations in users/spamaway (publiclab#6545) * change funcion t to translations in users/spamaway * fix typo * Change function t to translations in comments/comments publiclab#6538 (publiclab#6543) * Change function t to translations Change function t to translations in comments/comments * Change translations to translation * Update _node_meta.html.erb (publiclab#6606) Changing method "t" to "translation" * Fix follow button bug on tags (publiclab#6576) * Fix bug on issue publiclab#6570 * Persist data * Add co-authored posts to profile.html.erb (publiclab#6418) * Add co-authored posts to profile.html.erb * Update profile.html.erb * Adjustments to tag graph labeling * Update stats.html.erb * Change function to to translation publiclab#6603 (publiclab#6659) Change function t to translation in dashboard/_node_question publiclab#6603 publiclab#6603 * Refresh button (publiclab#6507) * added tooltip for refresh button * changes * new changes1 * publiclab#6539 Updated t to translations. (publiclab#6544) * Updated t to translations. * Updated translations to translation. Error in issue description. * Changed t to translation in _node_moderate (publiclab#6695) * some translations adjustments * Add more tests for Node (for note and wiki page titles) (publiclab#6366) * Add more tests for Node * Prevent titles that are empty, blank or too short * Update functional tests * Add Redis installation to readme (publiclab#6398) * Fix recent questions on shadow page (publiclab#6342) * Add package.json, package-lock and test.sqlite-journal to gitingore publiclab#6384 (publiclab#6385) * Make "choose one" link in comment forms appear underlined (publiclab#6401) * Underline "choose one" link Make "choose one" link in comment forms appear underlined publiclab#6399 * Add a CSS class to underline text * Add !important to underline CSS class * Fix rubocop errors in app/api & app/channels (publiclab#6425) * Fix rubocop errors in app/api & app/channels * Fix rubocop guardclause offenses * Add tag link to show question (publiclab#6430) * simple fix for link * not sure what that file was * removed redundant comment count being showed in blog section (publiclab#6746) * Update t() function to translation() (publiclab#6729) publiclab#6728 * Add redis installations for linux (publiclab#6751) * Bump rake from 12.3.3 to 13.0.1 (publiclab#6764) Bumps [rake](https://github.com/ruby/rake) from 12.3.3 to 13.0.1. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](ruby/rake@v12.3.3...v13.0.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Update _comments.html.erb (publiclab#6766) * Update _comments.html.erb Changed the t() to translation() in line 4, 18 and 21. * Update _comments.html.erb Changed the two translation() back to t() on line 18. * Full screen button added in inline maps, Multiple maps in Wiki page works now. (publiclab#6699) * full screen added * working on wiki page * code refactoring * console logs removed * inline map layers are ON by default now * version bump of LEL to add new Layers * api changed tagslocation init * api taglocations changed * popup content changed * PL.editor shows map if lat,lon passed in URL. (publiclab#6788) * pl-editor shows map * indentation * yarn.lock added for PL.editor * safe traverse syntax used * map API using common global variable. (publiclab#6802) * done * removed console logs * [Security] Bump https-proxy-agent from 2.2.1 to 2.2.4 (publiclab#6803) Bumps [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) from 2.2.1 to 2.2.4. **This update includes security fixes.** - [Release notes](https://github.com/TooTallNate/node-https-proxy-agent/releases) - [Commits](TooTallNate/proxy-agents@2.2.1...2.2.4) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Update _thumbnail.html.erb to make it consistent with new card display (publiclab#6581) * Update _thumbnail.html.erb * Update style.css * Update node_shared_test.rb * Update _thumbnail.html.erb * Update _notes.html.erb * Update _notes.html.erb * Update _notes.html.erb * added ApplicationController.helpers.logged_in_as * Update _notes.html.erb * self.current_user in application_helper.rb * Update application_helper.rb * switch to "@current_user && ['admin','moderator'].includes?(@current_user.role)" * PL.editor shows map if lat,lon passed in URL. (publiclab#6788) * pl-editor shows map * indentation * yarn.lock added for PL.editor * safe traverse syntax used * handle nils * Update _notes.html.erb * new navbar but should mostly be in a feature * some translations adjustments * final navbar * fixes for collapse menu * fixes for collapse menu 2 * rest of menus
Fixes #6390 (<=== Add issue number here)
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
rake test
@publiclab/reviewers
for help, in a comment belowIf tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
Thanks!