Category authorization
This commit is contained in:
parent
1086037b2b
commit
31ee2d2be2
|
@ -0,0 +1,15 @@
|
|||
module Panel::Dictionary::BackEnd::DictionaryVocabCategorysHelper
|
||||
include ActionView::Helpers::UrlHelper
|
||||
|
||||
|
||||
def show_anc_cate_permission_link(dictionary_vocab_category)
|
||||
type = 'submit'
|
||||
oa = dictionary_vocab_category.get_object_auth_by_title(type)
|
||||
if oa.nil?
|
||||
dictionary_vocab_category.object_auths.new(title: type ).save
|
||||
oa = dictionary_vocab_category.get_object_auth_by_title(type)
|
||||
end
|
||||
link_to t(:category_auth),admin_object_auth_ob_auth_path(oa)
|
||||
end
|
||||
|
||||
end
|
|
@ -5,10 +5,10 @@ class DictionaryVocabCategory
|
|||
include OrbitCoreLib::ObjectAuthable
|
||||
include OrbitCoreLib::ObjectDisable
|
||||
include Sunspot::Mongo
|
||||
# include Mongoid::MultiParameterAttributes
|
||||
# APP_NAME = 'Archive'
|
||||
# ObjectAuthTitlesOptions = %W{submit_new fact_check}
|
||||
# AfterObjectAuthUrl = '/panel/archive/back_end/archive_file_categorys'
|
||||
include Mongoid::MultiParameterAttributes
|
||||
APP_NAME = 'Dictionary'
|
||||
ObjectAuthTitlesOptions = %W{submit_new fact_check}
|
||||
AfterObjectAuthUrl = '/panel/dictionary/back_end/dictionary_vocab_categorys'
|
||||
|
||||
field :disable, type: Boolean, :default => false
|
||||
field :display
|
||||
|
@ -36,7 +36,7 @@ class DictionaryVocabCategory
|
|||
end
|
||||
|
||||
def self.from_id(id)
|
||||
ArchiveFileCategory.find(id) rescue nil
|
||||
DictionaryVocabCategory.find(id) rescue nil
|
||||
end
|
||||
|
||||
end
|
|
@ -5,9 +5,10 @@
|
|||
<ul class="nav nav-pills hide">
|
||||
<% if is_admin?%>
|
||||
<li><%= link_to t(:edit), edit_panel_dictionary_back_end_dictionary_vocab_category_path(dictionary_vocab_category), :remote => true %></li>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%if is_manager? || is_admin? %>
|
||||
<li><%= show_anc_cate_permission_link(dictionary_vocab_category) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
<%= form_for(@dictionary_vocab_category, :remote => true, :url => @url) do |f| %>
|
||||
|
||||
<h2><%= (@dictionary_vocab_category.new_record? ? 'Add' : 'Edit') %></h2>
|
||||
<h2><%= (@dictionary_vocab_category.new_record? ? t(:new, scope: :dictionary) : t(:edit, scope: :dictionary)) %></h2>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.label :key %>
|
||||
<%= f.label t(:key, scope: :dictionary) %>
|
||||
<%= f.text_field :key %>
|
||||
</div>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<%= label_tag "name-#{locale}", "#{t(:name)} - #{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class =>' input-xxlarge', :value => (@dictionary_vocab_category.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<table id="dictionary_vocab_categorys" class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1-2"><%= t('dictionary_vocab_category.key') %></th>
|
||||
<th class="span1-2"><%= t(:key, scope: :dictionary) %></th>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<th class="span1-2"><%= I18nVariable.first(:conditions => { :key => locale })[I18n.locale] %></th>
|
||||
<% end %>
|
||||
|
|
|
@ -21,3 +21,4 @@ en:
|
|||
definition: Definition
|
||||
time: Created time
|
||||
ago: ago
|
||||
|
||||
|
|
|
@ -25,3 +25,6 @@ zh_tw:
|
|||
definition: 定義
|
||||
time: 建立時間
|
||||
ago: 前
|
||||
new: 新增
|
||||
edit: 修改
|
||||
key: 索引值
|
||||
|
|
Loading…
Reference in New Issue