siddick/siddick

View on GitHub
app/views/profiles/show.html.erb

Summary

Maintainability
Test Coverage
<%= simple_form_for(current_user, :as => :user, :url => profile_path, :html => { :method => :put }) do |f| %>
  <%= f.input :name %>
  <%= f.input :email %>
  <%= f.input :description, :as => :text, :input_html => { :rows => 3, :class => "input-xlarge" } %>

  <div class="control-group">
    <div class="controls">
    <% current_user.auth_providers.each do |auth| %>
      <p>
        <%= image_tag provider_image(auth.provider) %> <%= auth.info.nickname %>
        <% if AuthProvider::AutoPublish[auth.provider.to_sym].present? %>
          <% if auth.auto_publish %>
            <%= link_to "Remove auto-publish", profile_auth_provider_path(auth, :auto_publish => false ), :method => :put %>
          <% else %>
            <%= link_to "Add auto-publish", profile_auth_provider_path(auth, :auto_publish => true ), :method => :put %>
          <% end%>
        <% end%>
        <% if current_user.auth_providers.size > 1 %>
          <%= link_to "Remove", profile_auth_provider_path(auth), :method => "delete", "data-confirm" => "Are you sure?" %>
        <% end %>
      </p>
    <% end %>
    </div>
  </div>

  <div class="form-actions">
      <%= f.submit "Update", :class => "btn btn-primary", :disable_with => "Updating.." %>
      <%= link_to "Cancel", profile_path, :class => "btn" %>
  </div>
<% end %>