Skip to content

Commit

Permalink
Show prefs on assign popup
Browse files Browse the repository at this point in the history
  • Loading branch information
abartov committed Nov 18, 2024
1 parent 7814dca commit 98afb79
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
include ThinkingSphinx::Scopes
class User < ActiveRecord::Base
PROP_VOL_PREFERENCES = 21 # TODO: horrible hardcoding to production DB value, until we refactor this

acts_as_authentic do |c|
c.perishable_token_valid_for = 2.weeks
c.transition_from_crypto_providers = [Authlogic::CryptoProviders::Sha512]
Expand Down Expand Up @@ -112,6 +114,10 @@ def email_recipient
# "#{name.gsub('"','')} <#{addr}>"
end

def volunteer_preferences
@volunteer_preferences ||= get_volunteer_preferences
end

def disabled?
!disabled_at.blank?
end
Expand Down Expand Up @@ -190,4 +196,10 @@ def welcome_on_volunteering
def handle_volunteer_kind
self.volunteer_kind_id = nil if is_volunteer_changed? && !is_volunteer?
end

def get_volunteer_preferences
return '' if self.id.nil?
prefs = volunteer_properties.where(property_id: PROP_VOL_PREFERENCES)
return prefs.present? ? prefs.first.custom_value : ''
end
end
4 changes: 4 additions & 0 deletions app/views/tasks/_unassigned_index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
%span{style: 'background-color: yellow'}= @assignee.teams.pluck(:name).join('; ')
- else
%p= t('teams.none')
- prefs = @assignee.volunteer_preferences
- if prefs.present?
%strong= t(:volunteer_prefs)+': '
%span{style: 'background-color: blanchedalmond'}= prefs
= form_tag(tasks_path, params.merge(:method => :get, :remote => true)) do
= label_tag :kind, _("Kind")
= select_tag :kind, options_for_select([""] + task_kinds_for_select(:name), params[:kind] || 'הקלדה')
Expand Down
3 changes: 2 additions & 1 deletion config/locales/he.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ he:
team_mass_message: הודעה לחברי צוות %{team} בפרויקט בן־יהודה
loading: הנתונים נטענים...
'yes': כן
'no': לא
'no': לא
volunteer_prefs: העדפות התנדבות

0 comments on commit 98afb79

Please sign in to comment.