MiraitSystems/enju_trunk

View on GitHub
app/views/my_accounts/edit.html.erb

Summary

Maintainability
Test Coverage
<div id="content_detail" class="ui-corner-all">
<h1 class="title"><%= t('page.edit_user_profile', :login_name => @user.username) -%></h1>
<div id="content_list">
<%= render 'page/required_field' %>
<%= simple_form_for(@user, :url => my_account_path) do |f| -%>
  <%= f.error_messages -%>
  <%= render :partial => 'my_accounts/edit_credential', :locals => {:f => f, :user => @user} -%>
  <div class="actions" style="clear: both">
    <%= f.submit %>
  </div>
  <div style="clear: both" class="table">
    <div class="row">
      <div><%= f.label :keyword_list -%></div>
      <div><%= f.text_area :keyword_list, :class => 'resource_textarea' -%></div>
    </div>
    <div class="row">
      <div><%= f.label t('user.reset_checkout_icalendar_url') -%></div>
      <div id="feed_token">
        <%- if @user.checkout_icalendar_token -%>
          <%= link_to checkouts_url(:icalendar_token => @user.checkout_icalendar_token, :format => :ics), checkouts_url(:icalendar_token => @user.checkout_icalendar_token, :format => :ics) -%>
          <%= f.hidden_field :checkout_icalendar_token -%>
        <%- end -%>
        <input onclick="$.ajax({data:'authenticity_token=' + encodeURIComponent('<%= form_authenticity_token %>'), success:function(request){$('#feed_token').html(request);}, type:'get', url:'<%= edit_user_path(@user, :mode => 'feed_token') %>'});" type="button" value="<%= t('page.reset') %>" />
        <input onclick="$.ajax({data:'authenticity_token=' + encodeURIComponent('<%= form_authenticity_token %>'), success:function(request){$('#feed_token').html(request);}, type:'get', url:'<%= edit_user_path(@user, :disable => true, :mode => 'feed_token') %>'});" type="button" value="<%= t('page.delete') %>" />
      </div>
    </div>
    <div class="actions">
      <%= f.submit %>
    </div>
<%- end -%>
</div>
</div>
</div>

<div id="submenu" class="ui-corner-all">
  <ul>
    <%- if current_user.has_role?('Librarian') -%>
      <li><%= link_to t('page.listing', :model => t('activerecord.models.user')), users_path -%></li>
    <%- end -%>
    <li><%= link_to t('activerecord.attributes.user.show_user'), @user -%></li>
    <%- if current_user.has_role?('Librarian') -%>
      <%- unless current_user == @user -%>
        <li><%= link_to t('page.destroy'), @user, :confirm => t('page.are_you_sure'), :method => :delete -%></li>
      <%- end -%>
    <%- end -%>
  </ul>
</div>