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

SJ - Adding "other" role details to users table #2307

Merged
merged 1 commit into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/helpers/associated_users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

module AssociatedUsersHelper

def role_formatter(pr)
role_text = PermissibleValue.get_value('user_role', pr.role)
if pr.role == "other"
"#{role_text}-#{pr.role_other}"
else
role_text
end
end

def new_authorized_user_button(opts={})
unless in_dashboard? && !opts[:permission]
url = in_dashboard? ? new_dashboard_associated_user_path(protocol_id: opts[:protocol_id]) : new_associated_user_path(srid: opts[:srid])
Expand Down
2 changes: 1 addition & 1 deletion app/views/associated_users/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
json.(@protocol_roles) do |pr|
json.name "#{pr.identity.full_name} #{(pr.identity_id == @protocol.requester_id) ? '(Requester)' : ''}"
json.role PermissibleValue.get_value('user_role', pr.role)
json.role role_formatter(pr)
json.email pr.identity.email
json.phone format_phone(pr.identity.phone)
json.project_rights PermissibleValue.get_value('proxy_right', pr.project_rights)
Expand Down
2 changes: 1 addition & 1 deletion app/views/dashboard/associated_users/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
json.(@protocol_roles) do |pr|
json.name "#{pr.identity.full_name} #{(pr.identity_id == @protocol.requester_id) ? '(Requester)' : ''}"
json.role PermissibleValue.get_value('user_role', pr.role)
json.role role_formatter(pr)
json.email pr.identity.email
json.phone format_phone(pr.identity.phone)
json.project_rights PermissibleValue.get_value('proxy_right', pr.project_rights)
Expand Down