MiraitSystems/enju_trunk

View on GitHub
app/views/page/_index.html.erb

Summary

Maintainability
Test Coverage
<script type="text/javascript">
<!--
<% if user_signed_in? && current_user.has_role?('Librarian') -%>
$(document).FunctionKeys(
{
 F2:function(obj,s,c,a){document.location = '<%= new_basket_path%>';}
,F3:function(obj,s,c,a){document.location = '<%= checkins_path %>';}
<% if defined? EnjuTrunkOrder %>
  ,F4:function(obj,s,c,a){document.location = '<%= order_lists_path %>';}
<% end %>
});
<% end %>
// -->
</script>
<div id='column_wide_wrapper'>
<div id='column_wide'>
<% if SystemConfiguration.get('view.top_query_detail') %>
  <div class="portlet" id="search" style="width:915px">
    <h2 class="title">
      <% if user_signed_in? %>
        <%= t('page.user_title', :login_name => current_user.try(:agent).try(:full_name)) -%>
      <% else %>
        <%= t('page.catalog_search') -%>
      <% end %>
    </h2>
    <div id="user_search_form">
      <% if current_user %>
        <% unless current_user.own_password %>
          <div style="color: red;"><b><%= simple_format(t('activerecord.errors.messages.user.auto_generated_password')) %></b></div>
        <% end %>
      <% end %>
      <p id="notice"><%= notice %></p>
      <%= render 'page/search_form_detail' -%>
    </div>
  </div>
<% else %>
<div class="column" id="col1">
  <div class="portlet" id="search">
    <h2 class="title">
      <% if user_signed_in? %>
        <%= t('page.user_title', :login_name => current_user.try(:agent).try(:full_name)) -%>
      <% else %>
        <%= t('page.catalog_search') -%>
      <% end %>
    </h2>
    <div id="user_search_form">
      <% if current_user %>
        <% unless current_user.own_password %>
          <div style="color: red;"><b><%= simple_format(t('activerecord.errors.messages.user.auto_generated_password')) %></b></div>
        <% end %>
      <% end %>
      <p id="notice"><%= notice %></p>
      <%= render 'page/search_form' -%>

      <% if defined?(EnjuTrunkTheme) %>
        <br />
        <br />
        <p><b><%= t('page.theme.hot_topic') %> : </b></p>
        <div>
          <% unless @themes.blank? %>
            <% @themes.each do |theme| %>
              <%= link_to theme.name, manifestations_path(:theme_id => theme.id) %>
            <% end %>
          <% end %>
        </div>
        <p><b><%= link_to t('page.theme.theme_list'), themes_path %></b></p>
      <% end %>

      <% if defined?(EnjuBookmark) %>
        <% if user_signed_in? %>
          <h4 style="display: inline"><%= link_to t('activerecord.models.bookmark'), user_bookmarks_path(current_user) %></h4>
        <% end %>
      <% end %>
    </div>
  </div>
  <div class="portlet" id="easy_tools">
    <h3 class="title"><%= t('page.books_information') -%></h3>
    <div id="easy_tools_box">
      <%= render 'page/easy_tools' -%>
    </div>
  </div>
</div>


<% if SystemConfiguration.get('view.pick_up') && defined?(EnjuBookmark) && SystemConfiguration.get('view.tag_cloud') %>
<div class="column" id="col2">
  <% if SystemConfiguration.get('view.pick_up') %>
  <div class="portlet" id="pickup">
    <h3 class="title"><%= t('manifestation.pickup') -%></h3>
    <div id="picked_up_box">
      <%= render 'manifestations/pickup', :manifestation => @manifestation -%>
    </div>
  </div>
  <% end %>

  <% if defined?(EnjuBookmark) && SystemConfiguration.get('view.tag_cloud') %>
    <div class="portlet" id="tag_cloud">
      <h3 class="title">
        <% if user_signed_in? %>
          <%= t('tag.my_tag') -%>
        <% else %>
          <%= t('tag.popular_tag') -%>
        <% end %>
      </h3>
      <div id="tag_cloud_box">
        <%= render 'bookmarks/tag_cloud', :tags => @tags -%>
        <%- if can? :index, Tag -%>
          <p>(<%= link_to t('page.listing', :model => t('activerecord.models.tag')), tags_path -%>)</p>
        <%- end -%>
      </div>
    </div>
  <% end %>
      <h4 style="display: inline"><%= link_to t('page.new_resource'), manifestations_path(:mode => 'recent') -%></h4>
</div>
<% end %>

<% if defined?(EnjuEvent) && SystemConfiguration.get('view.events') %>
  <div class="column" id="col3">
  <% if user_signed_in? && !current_user.has_role?('Librarian') -%>
    <div class="portlet" id="my_basket">
      <h3 class="title"><%= t('basket.my_status') -%></h3>
      <div id="my_basket_box">
        <%= render 'page/my_basket' -%>
      </div>
    </div>
  <%- end -%>
    <div class="portlet" id="events">
      <h3 class="title"><%= t('activerecord.models.event') -%></h3>
      <div id="tag_cloud_box">
        <div class="bigger_font">
          <% @events.each do |event| %>
            <dl>
              <dt>
                <%= event.library.display_name.localize %><br/ >
                <%= l(event.start_at, :format => :only_date) %> - <%= l(event.end_at, :format => :only_date) %>
              </dt>
              <strong>
                <dd><%= event.display_name.localize %></dd>
              </strong>
            </dl>
            <br />
          <% end %>
        </div>
        <% if @events.size > 0 %>
          <div class="bigger_font"><%= link_to t('page.listing', :model => t('activerecord.models.event')), events_path %></div>
        <% end %>
        <div class="bigger_font"><%= link_to t('activerecord.models.event_calendar'), calendar_path %></div>
      </div>
    </div>
  </div>
<% end %>
<% end %>
</div>
</div>