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::ObjectAuthable
|
||||||
include OrbitCoreLib::ObjectDisable
|
include OrbitCoreLib::ObjectDisable
|
||||||
include Sunspot::Mongo
|
include Sunspot::Mongo
|
||||||
# include Mongoid::MultiParameterAttributes
|
include Mongoid::MultiParameterAttributes
|
||||||
# APP_NAME = 'Archive'
|
APP_NAME = 'Dictionary'
|
||||||
# ObjectAuthTitlesOptions = %W{submit_new fact_check}
|
ObjectAuthTitlesOptions = %W{submit_new fact_check}
|
||||||
# AfterObjectAuthUrl = '/panel/archive/back_end/archive_file_categorys'
|
AfterObjectAuthUrl = '/panel/dictionary/back_end/dictionary_vocab_categorys'
|
||||||
|
|
||||||
field :disable, type: Boolean, :default => false
|
field :disable, type: Boolean, :default => false
|
||||||
field :display
|
field :display
|
||||||
|
@ -36,7 +36,7 @@ class DictionaryVocabCategory
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.from_id(id)
|
def self.from_id(id)
|
||||||
ArchiveFileCategory.find(id) rescue nil
|
DictionaryVocabCategory.find(id) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -5,9 +5,10 @@
|
||||||
<ul class="nav nav-pills hide">
|
<ul class="nav nav-pills hide">
|
||||||
<% if is_admin?%>
|
<% if is_admin?%>
|
||||||
<li><%= link_to t(:edit), edit_panel_dictionary_back_end_dictionary_vocab_category_path(dictionary_vocab_category), :remote => true %></li>
|
<li><%= link_to t(:edit), edit_panel_dictionary_back_end_dictionary_vocab_category_path(dictionary_vocab_category), :remote => true %></li>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%if is_manager? || is_admin? %>
|
||||||
|
<li><%= show_anc_cate_permission_link(dictionary_vocab_category) %></li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
<%= form_for(@dictionary_vocab_category, :remote => true, :url => @url) do |f| %>
|
<%= 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">
|
<div id="widget-title">
|
||||||
<%= f.label :key %>
|
<%= f.label t(:key, scope: :dictionary) %>
|
||||||
<%= f.text_field :key %>
|
<%= f.text_field :key %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<div class="control-group">
|
<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">
|
<div class="controls">
|
||||||
<%= f.text_field locale, :class =>' input-xxlarge', :value => (@dictionary_vocab_category.title_translations[locale] rescue nil) %>
|
<%= f.text_field locale, :class =>' input-xxlarge', :value => (@dictionary_vocab_category.title_translations[locale] rescue nil) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
<table id="dictionary_vocab_categorys" class="table main-list">
|
<table id="dictionary_vocab_categorys" class="table main-list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<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| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
<th class="span1-2"><%= I18nVariable.first(:conditions => { :key => locale })[I18n.locale] %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
@ -21,3 +21,4 @@ en:
|
||||||
definition: Definition
|
definition: Definition
|
||||||
time: Created time
|
time: Created time
|
||||||
ago: ago
|
ago: ago
|
||||||
|
|
||||||
|
|
|
@ -25,3 +25,6 @@ zh_tw:
|
||||||
definition: 定義
|
definition: 定義
|
||||||
time: 建立時間
|
time: 建立時間
|
||||||
ago: 前
|
ago: 前
|
||||||
|
new: 新增
|
||||||
|
edit: 修改
|
||||||
|
key: 索引值
|
||||||
|
|
Loading…
Reference in New Issue