Noosfero/noosfero

View on GitHub
app/views/enterprise_registration/index.html.erb

Summary

Maintainability
Test Coverage
<%= error_messages_for 'create_enterprise' %>

<h1><%= _('Enterprise registration') %></h1>


<% if @validation == :region && @regions.empty? %>
  <div class='atention'>
    <%= _('There are no validators to validate the registration of this new enterprise. Contact your administrator for instructions.') %>
  </div>

  <%= button_bar do %>
    <%= button :back, _('Go back'), { :profile => current_user.person.identifier, :action=>"enterprises", :controller=>"profile" }%>
  <% end %>
<% else %>
  <div class='atention'>
    <%= _('To register a new enterprise, fill in the form and hit the Register button. Then the enterprise will be submitted for evaluation at the validation entitiy of your choice (within your state) and when the enterprise is aproved you will be able to activate its profile.')  %>
  </div>

  <%= required_fields_message %>

  <%= labelled_form_for :create_enterprise do |f| %>
    <%= required f.text_field 'name', :onchange => "updateUrlField(this, 'create_enterprise_identifier')", :size => 40 %>
    <%= required labelled_form_field(_('Address'), content_tag('code', top_url + "/" + text_field(:create_enterprise, 'identifier', :size => 26))) %>
    <%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => :create_enterprise, :profile => @create_enterprise } %>
    <%= required labelled_form_field(_('Region'), f.select('region_id', @regions)) if @validation == :region %>

    <% if @validation == :admin %>
      <%= hidden_field_tag  'create_enterprise[target_id]', environment.id %>
    <% end %>

    <% @plugins.dispatch(:enterprise_registration_hidden_fields).each do |field| %>
      <% field.each do |key, value| %>
        <%= f.hidden_field(key, :value => value) %>
      <% end %>
    <% end %>

    <%= template_options(:enterprises, 'create_enterprise')%>

    <%= render :partial => 'shared/profile_kinds', :locals => {:form_field => 'create_enterprise'} %>

    <%= button_bar do %>
      <%= submit_button(:next, _('Next'), :cancel => {:profile => current_user.person.identifier,
            :action=>"enterprises", :controller=>"profile"}) %>
    <% end %>
  <% end %>
<% end %>