% if User.current.allowed_to?(:subscribe_to_project, @project) %> <% unless defined? @subscriber %> <% @subscriber = ProjectSubscriber.find_by_project_id_and_user_id(@project.id, User.current.id) %> <% end %> <% unless defined? @count %> <% @count = ProjectSubscriber.where(:project_id => @project).count %> <% end %>
<%= h(@message) %>
<% else %> <% if defined? remote_form_for %> <% form = remote_form_for(:subscriber, :url => { :controller => 'subscriptions', :action => 'subscribe', :id => @project }, :method => :post, :html => { :id => 'subscription-form' }) do %> <%= render(:partial => 'subscribe/checkboxes', :locals => { :project => @project, :subscriber => @subscriber }) %><%= submit_tag(@subscriber && !@subscriber.new_record? ? l(:button_update) : l(:label_subscribe), :class => 'small') %> <%= toggle_link(l(:button_cancel), 'subscription-form') %>
<% end %> <% else %> <% form = form_for(:subscriber, :url => { :controller => 'subscriptions', :action => 'subscribe', :id => @project }, :method => :post, :remote => true, :html => { :id => 'subscription-form' }) do %> <%= render(:partial => 'subscribe/checkboxes', :locals => { :project => @project, :subscriber => @subscriber }) %><%= submit_tag(@subscriber && !@subscriber.new_record? ? l(:button_update) : l(:label_subscribe), :class => 'small') %> <%= toggle_link(l(:button_cancel), 'subscription-form') %>
<% end %> <% end %> <%= form if Rails::VERSION::MAJOR >= 3 %> <% end %> <% end %>