external_integration_keys.mustache 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <%
  2. # Copyright (C) 2014 - present Instructure, Inc.
  3. #
  4. # This file is part of Canvas.
  5. #
  6. # Canvas is free software: you can redistribute it and/or modify it under
  7. # the terms of the GNU Affero General Public License as published by the Free
  8. # Software Foundation, version 3 of the License.
  9. #
  10. # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
  11. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License along
  16. # with this program. If not, see <http://www.gnu.org/licenses/>.
  17. %>
  18. <%
  19. @external_integration_keys ||= {}
  20. external_integration_keys = @external_integration_keys.select { |key_type, key| key.grants_any_right?(@current_user, :read, :write) }
  21. %>
  22. <% unless external_integration_keys.empty? %>
  23. <fieldset id="external_integration_keys">
  24. <h2 class="screenreader-only">{{#t}}External Integration Keys{{/t}}</h2>
  25. <legend>{{#t}}External Integration Keys{{/t}}</legend>
  26. <% external_integration_keys.each do |key_type, key| %>
  27. <%= f.fields_for :external_integration_keys do |external_integration_key| %>
  28. <div>
  29. <%= external_integration_key.label key_type, "#{ExternalIntegrationKey.label_for(key_type)}:" %>
  30. <% if key.grants_right?(@current_user, :write) %>
  31. <%= external_integration_key.text_field key_type, value: key.key_value %>
  32. <% else %>
  33. <span><%= key.key_value %></span>
  34. <% end %>
  35. </div>
  36. <% end %>
  37. <% end %>
  38. </fieldset>
  39. <% end %>