Darep/Beatstream

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

Summary

Maintainability
Test Coverage
<div class="modal settings">

    <h2>Settings</h2>
    <p class="subheader">&ldquo;Set the settings&rdquo;</p>

    <%= form_for @user, :url => { :action => 'save' }, :method => 'post' do |f| %>

        <% @user.errors.full_messages.each do |msg| %>
            <p><%= msg %></p>
        <% end %>

        <fieldset>
            <%= f.label :username %>
            <div class="field">
                <%= f.text_field :username %>
            </div>

            <%= f.label :email %>
            <div class="field">
                <%= f.text_field :email %>
            </div>
        </fieldset>

        <fieldset>
            <label>Last.fm</label>
            <div class="field">
                <% if @user.lastfm_session_key == nil %>
                    <a href="http://www.last.fm/api/auth/?api_key=<%= Rockstar.lastfm_api_key %>&amp;cb=<%= url_for :action => 'lastfm_callback', :only_path => false %>" target="_blank" class="button connect-lastfm">Connect Last.fm</a>
                <% else %>
                    <p class="lastfm-logged-in">Logged in</p>
                    <%= link_to "Remove", { :action => 'lastfm_disconnect' }, :class => 'button disconnect-lastfm' %>
                <% end %>
            </div>
        </fieldset>

        <fieldset>
            <label>MP3 Library</label>
            <div class="field">
                <%= link_to "Search for new MP3s", songs_refresh_path, :class => 'button reindex-mp3s' %>
            </div>
        </fieldset>

        <div class="actions">
            <%= submit_tag %>
            <a href="/" class="close">Cancel</a>
        </div>
    <% end %>

</div>