Skip to content

Commit

Permalink
Merge pull request #2307 from sparc-request/sj-associated_users_other…
Browse files Browse the repository at this point in the history
…_role

SJ - Adding "other" role details to users table
  • Loading branch information
Stuart-Johnson committed Apr 22, 2020
2 parents c899d3c + 7f88fc5 commit 0247fd0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
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

0 comments on commit 0247fd0

Please sign in to comment.