build dictionary_vocabs back_end
This commit is contained in:
parent
a7e1819e69
commit
b51e10eb9d
|
@ -14,8 +14,18 @@ class Panel::Dictionary::BackEnd::DictionaryVocabsController < OrbitBackendContr
|
|||
@vocabs = DictionaryVocab.all
|
||||
end
|
||||
|
||||
def show
|
||||
@vocab = DictionaryVocab.find(params[:id])
|
||||
# @comment = @market_item.comments.build
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @vocab }
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@vocab = DictionaryVocab.new
|
||||
# @categories = get_categories_for_index("MarketItemCategory")
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
|
@ -23,8 +33,40 @@ class Panel::Dictionary::BackEnd::DictionaryVocabsController < OrbitBackendContr
|
|||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
def create
|
||||
@vocab = DictionaryVocab.new(params[:dictionary_vocab])
|
||||
@vocab.create_user_id = current_user.id
|
||||
@vocab.update_user_id = current_user.id
|
||||
# @categories = get_categories_for_index("MarketItemCategory")
|
||||
|
||||
if @vocab.save
|
||||
flash[:success] = "Success!"
|
||||
redirect_to :action => :index
|
||||
else
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@vocab = DictionaryVocab.find(params[:id])
|
||||
@categories = DictionaryVocabCategory.all
|
||||
end
|
||||
|
||||
def update
|
||||
@vocab = DictionaryVocab.find(params[:id])
|
||||
@vocab.update_attributes(params[:dictionary_vocab])
|
||||
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
def destroy
|
||||
@vocab = DictionaryVocab.find(params[:id])
|
||||
@vocab.destroy
|
||||
# @market_item.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_dictionary_back_end_dictionary_vocabs_url) }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,17 @@
|
|||
<br />
|
||||
<div class="offset1">
|
||||
<h4><%= t :category, :scope => :dictionary %></h4>
|
||||
<%= f.collection_select :dictionary_vocab_category_id, @categories, :id, :title %>
|
||||
</div>
|
||||
<div class="offset1">
|
||||
<h4><%= t :word, :scope => :dictionary %></h4>
|
||||
<%= f.text_field :title %>
|
||||
</div>
|
||||
<div class="offset1">
|
||||
<h4><%= t :definition, :scope => :dictionary %></h4>
|
||||
<%= f.text_area :price %>
|
||||
</div>
|
||||
<br />
|
||||
<div class="offset1">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary'%>
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
<%= form_for @vocab, url: panel_dictionary_back_end_dictionary_vocab_path(@vocab) do |f| %>
|
||||
<%= render 'form', f: f %>
|
||||
<% end %>
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
<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"><%= 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>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<% if @vocab.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<div class="alert alert-error">
|
||||
此表單包含了 <%= @vocab.errors.count.to_s + "個錯誤" %>.
|
||||
</div>
|
||||
<ul>
|
||||
<% @vocab.errors.full_messages.each do |msg| %>
|
||||
<li>* <%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= form_for @vocab, url: panel_dictionary_back_end_dictionary_vocabs_path do |f| %>
|
||||
<%= render 'form', f: f %>
|
||||
<% end %>s
|
|
@ -8,4 +8,13 @@ en:
|
|||
frontend:
|
||||
archive: Archive Front-end
|
||||
widget:
|
||||
index: Archive Widget
|
||||
index: Archive Widget
|
||||
|
||||
en:
|
||||
|
||||
dictionary:
|
||||
dictionary: Dictionary
|
||||
category: Category
|
||||
word: Word
|
||||
definition: Definition
|
||||
time: Time
|
|
@ -18,3 +18,7 @@ zh_tw:
|
|||
|
||||
dictionary:
|
||||
dictionary: 字彙辭典
|
||||
category: 類別
|
||||
word: 字彙
|
||||
definition: 定義
|
||||
time: 時間
|
||||
|
|
|
@ -55,9 +55,9 @@ module Dictionary
|
|||
head_link_path "panel_dictionary_back_end_dictionary_vocabs_path"
|
||||
|
||||
context_link 'all',
|
||||
:link_path=>"panel_archive_back_end_archive_files_path" ,
|
||||
:link_path=>"panel_dictionary_back_end_dictionary_vocabs_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{:archive_files=>:index},
|
||||
:active_for_action=>{:dictionary_vocabs=>:index},
|
||||
:available_for => [:all]
|
||||
|
||||
context_link 'add',
|
||||
|
|
Loading…
Reference in New Issue