Commit graph

11 commits

Author SHA1 Message Date
Philip How
3ceb9a178a
Allow some badges to be awarded multiple times (#20876)
* Add migration, update badgeachievements model and admin view to set flag on badges

* Show multiple badges on profile

* update factory

* badge model validation

* safe navigation to badge?

* add null: false to migratrion
2024-04-23 16:33:43 -04:00
yheuhtozr
ef290a5120
controllers/admin i18n (#17085)
* admin controllers i18n

* remove ja.yml

* fix for spec

* fix for spec 2

* Apply suggestions from code review

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Update config/locales/controllers/admin/fr.yml

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-04-26 09:40:09 -06:00
Andy Zhao
ebbbcee41a
[15-min-fix] Remove badge slug field b/c auto-gen by title (#13649)
* Make explicit that badge slug is auto generated

* Remove slug from new form

* Remove unused disabled form field

* Remove link and Crayonsify form

* Add badge's path
2021-05-05 13:49:43 -04:00
Ridhwana
cf5207564f
RFC#50-P5 Prepares the admin restructure to be tested (#13114)
* feat: make the sidebar more dynamic

* refactor: use the action in the same controller instead of the whole path

* feat: remove hardcoded routes

* feat: move routes into file

* feat: use rails 6 draw for the admin routes

* add a helper method

* oops: fix super

* feat: add the hacky helper methods :( )

* WIP: created different path helpers for the new routes and point the old helpers to the new ones if the FF is toggled

* feat: update the module

* chore: add new paths

* feat: change link_to's use paths instead

* feat: feedback_messages to scoped admin route

* chore: update the feature flag urls helpers

* feat: feedback_messages issue

* chore: remove all the workarounds

* chore: rubucop

* fix: oops remove helper

* chore: comment out the tests that touch the tabbed navbar which is affected by the rails application needing to be reloaded

* feat: ensure that we chcek if the db table exists
2021-04-15 14:53:46 +02:00
Anna Buianova
40b989ca62
Configure badge credits by admins (#13145)
* Added credits_awarded to /admin/badges forms

* Award credits only if badge has them

* Removed information about credits and listings in the new badge email when not needed

* Specs for number of credits awarded for badges

* Added missing newline

* Fix typo

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Improve new_badge_email.text.erb

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Fixed number of credits in notification

* Added specs for number of credits in notifications

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2021-03-30 10:58:48 +03:00
Julianna Tetreault
24a3b50d4a
Add the Ability to Remove Badge Achievements From Users (#9896) [deploy]
* Moves badge_achievement-related code from /admin/bagdes to /admin/badge_achievements
  - Adds an Admin::BadgeAchievements::Controller
  - Moves #award and #award_badges to Admin::BadgeAchievements::Controller
  - Removes #award and #award_badges from Admin::Badges::Controller
  - Moves award.html.erb from /admin/badges to /admin/badge_achievements
  - Removes badge_achievement routes from /admin/badges
  - Adds a redirect for /admin/badges/badge_achievements to routes.rb
  - Cleans up and refactors code in controllers, views, and routes

* Add more actions to Admin::BadgeAchievements::Controller and matching routes
  - Adds an #index and #destory action to the BadgeAchievements::Controller
  - Adds destroy to the badge_achievements routes
  - Adjusts redirects for badge_achievements in routes.rb
  - Removes dead code from the index view for Badges
  - Refactors the existing code in the index view for BadgeAchievements

* Adds an /admin/badge_achievements_spec and cleans up the /admin/badges_spec
  - Removes the badge_achievement-related tests from badges_spec.rb
  - Adds an additional test around deleting badge_achievements

* Add pagination to badge_achievements index view

* Adds badge_achievements to Admin menu items and add comment to routes.rb
  -Add badge_achievements to the Admin nav bar
  -Add a comment regarding redirects for badge_achievements

* Resolve JS console stacktrace notices and change wording on deletion buttons

* Add a Back to Badge Achievements button to the badge award form

* Adjust styling to fix failing /admin/badges_spec.rb

* Uses SQL paging to optimize scalibility and adds search functionality to index.html.erb
  - Use SQL paging in Admin::BadgeAchievements::Controller in #index and #award
  - Add a search by user ID to Badge Achievements index view
  - Add a limit of 15 badges to be shown on the Badge Achievement index view
  - Add a User ID column to the Badge Achievement index view

* Add Award Badge button back to Badge Achievement index.html.erb

* Change @badge to be more explicit and reword warning around badge deletion

* Adds award badge button back, rewords success message, and adjusts SQL paging
2020-08-25 11:14:47 -06:00
Julianna Tetreault
f02c60fa8e
Use .errors_as_sentece in Admin::Badges::Controller (#9772) [deploy] 2020-08-13 14:50:35 -06:00
Julianna Tetreault
c18b0f1ba1
Manage Badges in /admin/badges (#9721) [deploy]
* Add CRUD actions for badge management to Internal::Badges::Controller

* Update sytling of badges index view in index.html.erb
  -Uses a table to display all badges
  -Links to the badge edit page from the badge title
  -Displays a badges slug, title, and badge_image
  -Adds an Award Badge button to the index view

* Adds an edit view, edit.html.erb, for badges
  -Gives the ability to edit a badge title and/or slug
  -Adds an Update Badge button to the left of the view
  -Adds a Back to All Badges button to the right of the view
  -Displays the badge image in the edit form

* Adjusts the path names in #award_badges in Internal::Badges::Controller

* Adds CRUD actions to the Internal::Badges::Controller and needed routes

* Add a description field to the edit.html.erb for badge management

* Add #award to Internal::Badges::Controller with matching view and routes
  -Adds an #award method that sets @badge for #award_badges
  -Adds an award.html.erb view for awarding badges
  -Adds an award path for awarding badges
  -Removes unnecessary code from controller, routes, and views

* Adds image upload functionality to the edit view for badges

* Ensure that usernames are downcased when awarding badges
  -Chains downcase to usernames in #award_badges in
   Internal::Badges::Controller

* Move badge-related views from old Internal folder to the correct Admin folder

Change routes and paths from /internal to /admin

* Refactor badge_params in Admin::Badges::Controller

* Add additional tests around awarding and updating badges in /admin/badge_achievements

* Add a create view to /admin/badges
  -Adds new and create actions to Admin::Badges::Controller
  -Adds a create view for creating badges at new.html.erb
  -Adds a Create Badge button to the index view
  -Moves the Award Badges button to the bottom of the index view

* Add a test around creating badges and clean up existing specs in badges_spec.rb

Adjust path in admin_awards_badges_spec.rb to be correct path

* Adjust routes from /badges/award_badges to /badges/badge_achievements/award_badges

Update paths in admin/badge-related specs

* Adjust paths in badges_spec.rb to be admin_badge_achievements_award_badges_path

* Adjust button styling for Award Badge

* Adjust paths back to /admin/badges in badges_spec.rb

* Add clarification around usernames when awarding badges

* Mark test in black_box_spec.rb as pending due to Travis failure

* Change wording used around usernames and @ symbols in award.html.erb
2020-08-13 08:54:51 -06:00
Josh Puetz
1c566e0ec4
[deploy] Move /internal to `/admin (#9639)
* First draft - all the big changes

* Changing some more references to 'internal'

* Relocate internal request tests to admin

* Relocate internal system tests to admin

* Fix trailing space

* Test fix

* Move queries from internal to admin

* Docs updates

* Rename internal stimuls controllers to admin (plus docs)

* Rename admin layout

* Fix routing after rebase

* Fixes for latest added admin interfaces

* Serviceworker ignore paths
2020-08-07 10:36:26 -04:00
Josh Puetz
cda18d0aa4
[deploy] Move Admin interface paths (#9576)
* Move administrate to /resource_admin

* Test fixes

* Update docs
2020-08-03 08:49:23 -04:00
Ben Halpern
f073eb5754
Add badges and org cta (#324)
* Make org proof a required field

* Fix color picker and other minor org adjustments

* Add MVP of org add'l sidebar

* Add proof to org factory

* Fix org create action and fix tests

* Add new org fields to admin panel & lint

* Add proof to org edit for backward compatibility

* Add org info to edit preview

* Move preview edit notice to inside article div

* MVP of badge "final" steps

* Add info to user sidebar and clean up badge commit

* Modify sidebar for data

* Add organization decorator

* Add conditional so only users have new swipe nav, not orgs

* Add cloudinary prefix to badges

* Disallow duplicate badges
2018-05-17 18:22:37 -04:00