OSDN Git Service

t#32471:add profiles
[pettanr/pettanr.git] / app / views / system / filer.html.erb
index a29d8a2..60d6650 100644 (file)
@@ -1,147 +1 @@
-<% model_name = model.to_s.underscore %>
-<% path_name = model.to_s.tableize %>
-<% filer_configurations = configurations['filers'][model.to_s.underscore] || {} %>
-<% symbol = filer_configurations['symbol'] || {} %>
-<% symbol_type = symbol['type'] || 'src' %>
-<% caption = filer_configurations['caption'] || {} %>
-<% caption_type = caption['type'] || 'column' %>
-<% summary = filer_configurations['summary'] || {} %>
-<% summary_type = summary['type'] || 'none' %>
-<% edit = filer_configurations['edit'] || {} %>
-<% edit_type = edit['type'] || 'default' %>
-<ul class="filer">
-  <li id="" class="filer-head filer-head-<%= model.to_s.underscore -%>">
-    <div id="" class="filer-head-symbol">
-      symbol
-    </div>
-    <% unless caption_type == 'none' %>
-      <div id="" class="filer-head-caption">
-        caption
-      </div>
-    <% end %>
-    <% unless summary_type == 'none' %>
-      <div id="" class="filer-head-summary">
-        summary
-      </div>
-    <% end %>
-    <div id="" class="filer-head-icon">
-      icon
-    </div>
-    <div id="" class="filer-head-date">
-      date
-    </div>
-    <% unless edit_type == 'none' %>
-      <div id="" class="filer-head-edit">
-        edit
-      </div>
-    <% end %>
-  </li>
-  <% items.each do |item| %>
-    <li id="" class="filer-item filer-item-<%= model.to_s.underscore -%>">
-      <div id="" class="filer-item-symbol">
-        <% link = symbol['link'] || {'type' => 'action', 'name' => 'show'} %>
-        <% path = case link['type'] %>
-        <% when 'action' %>
-          <% case link['name'] %>
-          <% when 'show' %>
-            <% polymorphic_path(item) %>
-          <% else %>
-            <% polymorphic_path(item, :action => link['name']) %>
-          <% end %>
-        <% when 'none' %>
-          <% '' %>
-        <% when 'url_column' %>
-          <% item.__send__(link['name']).to_s %>
-        <% else %>
-          <% '' %>
-        <% end %>
-        <% str = case symbol_type %>
-        <% when 'image' %>
-          <% tag(:img, :src => symbol['name'], :width => 64, :height => 64) %>
-        <% when 'picture' %>
-          <% tag(:img, item.__send__(symbol['name'])) %>
-        <% when 'template' %>
-          <%= render path_name + '/' + symbol['name'], :item => item %>
-          <% nil %>
-        <% else %>
-          <% 'no.png' %>
-        <% end %>
-        <% unless str.blank? %>
-          <%= link_to_unless path.blank?, str, path %>
-        <% end %>
-      </div>
-      <% unless caption_type == 'none' %>
-        <div id="" class="filer-item-caption">
-          <% link = caption['link'] || {'type' => 'action', 'name' => 'show'} %>
-          <% path = case link['type'] %>
-          <% when 'action' %>
-            <% case link['name'] %>
-            <% when 'show' %>
-              <% polymorphic_path(item) %>
-            <% else %>
-              <% polymorphic_path(item, :action => link['name']) %>
-            <% end %>
-          <% when 'none' %>
-            <% '' %>
-          <% when 'url_column' %>
-            <% item.__send__(link['name']).to_s %>
-          <% else %>
-            <% polymorphic_path(item) %>
-          <% end %>
-          <% str = case caption_type %>
-          <% when 'column' %>
-            <% item.attributes[caption['name']] %>
-          <% when 'method' %>
-            <% item.__send__(caption['name']).to_s %>
-          <% else %>
-            <% 'no caption' %>
-          <% end %>
-          <% str = 'no caption' if str.blank? %>
-          <% unless str.blank? %>
-            <%= link_to_unless path.blank?, str, path %>
-          <% end %>
-        </div>
-      <% end %>
-      <% unless summary_type == 'none' %>
-        <div id="" class="filer-item-summary">
-          <% case summary_type %>
-          <% when 'template' %>
-            <%= render path_name + '/' + summary['name'], :item => item %>
-          <% else %>
-            <% 'no config' %>
-          <% end %>
-        </div>
-      <% end %>
-      <div id="" class="filer-item-icon">
-        <%= link_to icon_tag(item.class.to_s, :object => item, :size => 64), polymorphic_path(item, :format => :prof) %>
-      </div>
-      <div id="" class="filer-item-date">
-        <%= distance_of_time_in_words_to_now item.updated_at %>
-      </div>
-      <% unless edit_type == 'none' %>
-        <div id="" class="filer-item-edit">
-          <% case edit_type %>
-          <% when 'default' %>
-            <% if item.own? roles %>
-              <%= link_to tag(:img, :src => asset_path('edit.png'), :width => 32, :height => 32), polymorphic_path(item, :action => :edit) %>
-              <%= link_to tag(:img, :src => asset_path('remove.png'), :width => 32, :height => 32), item, confirm: 'Are you sure?', :method => :delete %>
-            <% end %>
-          <% when 'account' %>
-            <% if item.own? roles %>
-              <%= link_to tag(:img, :src => asset_path('edit.png'), :width => 32, :height => 32), '/home/configure' %>
-            <% end %>
-         <% when 'template' %>
-            <%= render path_name + '/' + edit['name'], :item => item %>
-         <% else %>
-            <% 'no config' %>
-          <% end %>
-        </div>
-      <% end %>
-    </li>
-  <% end %>
-</ul>
-<div class="row_break">
-</div>
-<% if pager %>
-  <%= paginate(pager) %>
-<% end %>
+<%= render 'system/filer', {:items => items, :model => model, :roles => roles, :pager => pager} %>