add back_end index

This commit is contained in:
thomaschen 2013-08-22 15:46:02 +08:00 committed by chris
parent 14b19d814f
commit a7e1819e69
3 changed files with 47 additions and 0 deletions

View File

@ -9,6 +9,10 @@ class Panel::Dictionary::BackEnd::DictionaryVocabsController < OrbitBackendContr
before_filter :only => [ :new,:edit,:update,:create] do |controller|
controller.get_categorys('DictionaryVocabCategory')
end
def index
@vocabs = DictionaryVocab.all
end
def new
@vocab = DictionaryVocab.new
@ -18,4 +22,9 @@ class Panel::Dictionary::BackEnd::DictionaryVocabsController < OrbitBackendContr
format.xml { render xml: @vocab}
end
end
def edit
end
end

View File

@ -0,0 +1,38 @@
<div class="row">
<div class="span8 offset1">
<% flash.each do |key, value| %>
<div class="alert alert-<%= key %>"><%= value %></div>
<% end %>
<table class="table table-striped">
<thead>
<tr>
<th class="span2"><%= t :Category, :scope => :dictionary %></th>
<th class="span2"><%= t :Word, :scope => :dictionary %></th>
<th class="span2"><%= t :Definition, :scope => :dictionary %></th>
<th class="span2"><%= t :Time, :scope => :dictionary %></th>
<th class="span2"></th>
</tr>
</thead>
<tbody>
<% @vocabs.each do |vocab| %>
<tr>
<td><%= vocab.dictionary_vocab_category.title %></td>
<td><%= link_to truncate(vocab.word,length: 25), panel_dictionary_back_end_dictionary_vocab_path(vocab) %></td>
<td><%= truncate(vocab.definition,length: 50) %></td>
<td><% if vocab.created_at > Time.now.beginning_of_day %>
<%="#{time_ago_in_words(vocab.created_at)}"%>
<%=t :ago,:scope => :dictionary%>
<% else %>
<%= vocab.created_at.strftime("%Y/%m/%d") %>
<% end %></td>
<td><%= link_to t(:edit), edit_panel_dictionary_back_end_dictionary_vocab_path(vocab) %> |
<%= link_to t(:delete), panel_dictionary_back_end_dictionary_vocab_path(vocab), method: :delete , :data => { :confirm => 'Are you sure?'} %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>