ncbo/bioportal_web_ui

View on GitHub
app/views/ontologies/_licensed_ontology.html.erb

Summary

Maintainability
Test Coverage
<div style="padding: 1em;">
  <h2>This ontology is licensed by the owner</h2>
  <% ontology_authors = @ontology.contactName.nil? || @ontology.contactName.empty? ? "the owners" : @ontology.contactName%>
    <%if session[:user].nil?%>
      <p>If you already have a license then please <%=sanitize("<a href='/login?redirect=#{request.url}'>log in</a>")%>.</p>
    <%else%>
      <!-- Handle when a user is logged in -->
      <script type="text/javascript">
        jQuery(document).ready(
          function(){
            jQuery("#submit_license").click(submitLicense);
          }
        );

        var submitLicense = function(e){
          if (jQuery("#ontologylicensetext").val().length < 2) {
            jQuery("#submit_license_error").html("Please enter complete text into the license compliance field");
            jQuery("#submit_license_error").show();
            return false;
          }
        }
      </script>
      In order to access this ontology, you will need to comply with the following license conditions provided by the ontology owner:<br/><br/>
      <%=@ontology.licenseInformation%>

      <br/>

      <%= form_tag "/users/submit_license" do %>
        <%= hidden_field_tag :ontologylicense, @ontology.ontologyId%>
        <%= text_area_tag :ontologylicensetext, "", :rows => 7, :style => "width: 500px;"%><br/>
        <br/>
        Please contact <%= ontology_authors%> at <a href="mailto:<%= @ontology.contactEmail%>"><%= @ontology.contactEmail%></a> if you have questions regarding the license.<br/>
        <br/>
        <%= submit_tag "Submit", :id => "submit_license" %>&nbsp;<span id="submit_license_error" style="color: red;"><%=flash[:error] unless flash[:error].nil?%></span><br/>
      <%end%>
    <%end%>
</div>