Exp with object_auth
This commit is contained in:
parent
6b2aeadde6
commit
3bcd7ea349
|
@ -66,6 +66,8 @@ class Admin::AppAuthsController < ApplicationController
|
||||||
@module_app = ModuleApp.find(params[:id])
|
@module_app = ModuleApp.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@module_app = ModuleApp.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -21,6 +21,10 @@ class Admin::ModuleAppsController < ApplicationController
|
||||||
@module_app = ModuleApp.find(params[:id])
|
@module_app = ModuleApp.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@module_app = ModuleApp.find(params[:id])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@module_app = ModuleApp.find(params[:id])
|
@module_app = ModuleApp.find(params[:id])
|
||||||
|
|
|
@ -14,6 +14,7 @@ class Admin::ObjectAuthsController < ApplicationController
|
||||||
def new
|
def new
|
||||||
obj = eval(params[:type]).find params[:obj_id]
|
obj = eval(params[:type]).find params[:obj_id]
|
||||||
@object_auth=obj.object_auths.build
|
@object_auth=obj.object_auths.build
|
||||||
|
@object_auth_title_option = eval(params[:type]+"::ObjectAuthTitlesOptions")
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # new.html.erb
|
format.html # new.html.erb
|
||||||
format.xml { render :xml => @post }
|
format.xml { render :xml => @post }
|
||||||
|
|
|
@ -68,7 +68,7 @@ class PrototypeAuth
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def auth_users
|
def auth_users_before_block_list
|
||||||
if self.all?
|
if self.all?
|
||||||
User.all.entries
|
User.all.entries
|
||||||
else
|
else
|
||||||
|
@ -83,8 +83,8 @@ class PrototypeAuth
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def auth_users_after_block_list
|
def auth_users
|
||||||
auth_users - self.blocked_users
|
auth_users_before_block_list - self.blocked_users
|
||||||
end
|
end
|
||||||
|
|
||||||
# protected
|
# protected
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<br /><br /><br /><br />
|
||||||
|
<%=@module_app.key %><br />
|
||||||
|
<%=@module_app.title %><br />
|
||||||
|
<%=@module_app.version %><br />
|
||||||
|
<%=@module_app.organization %><br />
|
||||||
|
<%=@module_app.author %><br />
|
||||||
|
<%=@module_app.intro %><br />
|
||||||
|
<%=@module_app.update_info %><br />
|
||||||
|
<%=@module_app.create_date %><br />
|
||||||
|
<%=@module_app.enable_frontend%><br />
|
||||||
|
<%=@module_app.app_pages%><br />
|
||||||
|
<%=@module_app.widgets%><br />
|
||||||
|
|
||||||
|
Mangers:
|
||||||
|
<ul>
|
||||||
|
<% @module_app.managers.each do |manager|%>
|
||||||
|
<li><%= manager.user.name %></li>
|
||||||
|
<%end%>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
SubManagers:
|
||||||
|
<div>
|
||||||
|
<% @module_app.sub_managers.each do |manager|%>
|
||||||
|
<%= manager.user.name %>
|
||||||
|
<%end%>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
All User?:<%= @module_app.app_auth.all %><br />
|
||||||
|
Blocked Users:<%= @module_app.app_auth.blocked_users.collect{|t| t.name} %><br />
|
||||||
|
Privilege Users:<%= @module_app.app_auth.privilege_users.collect{|t| t.name}%><br />
|
||||||
|
User Roles:<%= @module_app.app_auth.roles.collect{|t| t.key} %><br />
|
||||||
|
User Sub Roles:<%= @module_app.app_auth.sub_roles.collect{|t| t.key} %><br />
|
||||||
|
|
||||||
|
Available users after calculation:
|
||||||
|
<%= @module_app.app_auth.auth_users.collect{|user| user.name}.join(',') %>
|
|
@ -12,7 +12,8 @@
|
||||||
<h1><%= t('object_auth.new_object_auth') %></h1>
|
<h1><%= t('object_auth.new_object_auth') %></h1>
|
||||||
<%= form_for @object_auth, :url => admin_object_auths_path do |f| %>
|
<%= form_for @object_auth, :url => admin_object_auths_path do |f| %>
|
||||||
<%= f.label :title %>
|
<%= f.label :title %>
|
||||||
<%= f.text_field :title, :class => 'text' %>
|
<%= f.select :title,@object_auth_title_option %>
|
||||||
|
|
||||||
<%= f.hidden_field :obj_id, :value => params[:obj_id] %>
|
<%= f.hidden_field :obj_id, :value => params[:obj_id] %>
|
||||||
<%= f.hidden_field :type, :value => params[:type] %>
|
<%= f.hidden_field :type, :value => params[:type] %>
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @bulletin.update_attributes(params[:bulletin])
|
if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save
|
||||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) }
|
# format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) }
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) }
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) }
|
||||||
format.js { render 'toggle_enable' }
|
format.js { render 'toggle_enable' }
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
class Panel::Announcement::BackEnd::FactChecksController < ApplicationController
|
||||||
|
layout 'admin'
|
||||||
|
|
||||||
|
def index
|
||||||
|
@bulletin_categorys_preview = BulletinCategory.authed_for_user(current_user,'preview')
|
||||||
|
@bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'check')
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -3,6 +3,10 @@
|
||||||
class BulletinCategory
|
class BulletinCategory
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
include OrbitCoreLib::ObjectAuthable
|
||||||
|
|
||||||
|
ObjectAuthTitlesOptions = %W{preview fact_check}
|
||||||
|
|
||||||
# include Mongoid::MultiParameterAttributes
|
# include Mongoid::MultiParameterAttributes
|
||||||
|
|
||||||
PAYMENT_TYPES = [ "List", "Picture" ]
|
PAYMENT_TYPES = [ "List", "Picture" ]
|
||||||
|
|
|
@ -6,6 +6,12 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<td><%= bulletin_category.display %></td>
|
<td><%= bulletin_category.display %></td>
|
||||||
<td>
|
<td>
|
||||||
|
<%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category) %> <br/ >
|
||||||
|
<% bulletin_category.object_auths.each do |obj_auth| %>
|
||||||
|
<%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth) %><br />
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
<%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> |
|
<%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> |
|
||||||
<%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> |
|
<%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> |
|
||||||
<%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %>
|
<%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %>
|
||||||
|
|
|
@ -6,4 +6,3 @@
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<h1><%= bulletin_category.key %></h1>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th><%= t('bulletin.status') %></th>
|
||||||
|
<th><%= t('bulletin.category') %></th>
|
||||||
|
<th><%= t('bulletin.title') %></th>
|
||||||
|
<th><%= t('bulletin.postdate') %></th>
|
||||||
|
<th><%= t('bulletin.deadline') %></th>
|
||||||
|
<th><%= t('bulletin.action') %></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% bulletin_category.bulletins.each do |post| %>
|
||||||
|
<%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:fact_check_allow=>true} %>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
|
@ -0,0 +1,51 @@
|
||||||
|
<% content_for :secondary do %>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<ul class="list">
|
||||||
|
<li><%= link_to t('bulletin.new_announcement'), new_panel_announcement_back_end_bulletin_path %></li>
|
||||||
|
<li><%= link_to t('bulletin.announcement_list'), panel_announcement_back_end_bulletins_path %></li>
|
||||||
|
<li><%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path %></li>
|
||||||
|
<li><%= link_to t('bulletin.my_announcement_fact_check'), panel_announcement_back_end_fact_checks_path %></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
<%= flash_messages %>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<fieldset><legend><%= t('bulletin.search') %></legend>
|
||||||
|
|
||||||
|
<%= form_for :bulletin, :action => 'search', :method => 'get', :url => panel_announcement_back_end_bulletins_path do |f| %>
|
||||||
|
|
||||||
|
<%#= f.select :bulletin_category_id, @bulletin_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('bulletin.select') }%>
|
||||||
|
|
||||||
|
Category <%#= select_tag "category_id", options_for_select(@bulletin_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('bulletin.select') %>
|
||||||
|
|
||||||
|
KeyWord <%#= text_field_tag :search, params[:search], :id => 'search_field' %>
|
||||||
|
|
||||||
|
<%= submit_tag "Search", :name => nil %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<h1><%= t('bulletin.list_announcement') %></h1>
|
||||||
|
|
||||||
|
<%= render :partial => "list_table", :collection => @bulletin_categorys_preview,:as => :bulletin_category%>
|
||||||
|
|
||||||
|
<%= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
|
@ -2,6 +2,7 @@ Rails.application.routes.draw do
|
||||||
namespace :panel do
|
namespace :panel do
|
||||||
namespace :announcement do
|
namespace :announcement do
|
||||||
namespace :back_end do
|
namespace :back_end do
|
||||||
|
resources :fact_checks
|
||||||
root :to => "bulletins#index"
|
root :to => "bulletins#index"
|
||||||
resources :bulletins
|
resources :bulletins
|
||||||
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
|
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
|
||||||
|
|
Loading…
Reference in New Issue