Exp with object_auth
This commit is contained in:
1 parent
6b2aeadde6
commit
3bcd7ea349
17 files changed
+161
-10
No files matched your search
+1
-1
@@ -105,7 +105,7 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
|
||||
end
|
||||
|
||||
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_bulletins_url, :notice => t('bulletin.update_bulletin_success')) }
|
||||
format.js { render 'toggle_enable' }
|
||||
|
||||
+29
@@ -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
|
||||
@@ -4,7 +4,7 @@ class Bulletin
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
|
||||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
class BulletinCategory
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitCoreLib::ObjectAuthable
|
||||
|
||||
ObjectAuthTitlesOptions = %W{preview fact_check}
|
||||
|
||||
# include Mongoid::MultiParameterAttributes
|
||||
|
||||
PAYMENT_TYPES = [ "List", "Picture" ]
|
||||
|
||||
+6
@@ -6,6 +6,12 @@
|
||||
<% end %>
|
||||
<td><%= bulletin_category.display %></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.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 %>
|
||||
|
||||
+1
-1
@@ -36,4 +36,4 @@
|
||||
</thead>
|
||||
<tbody class="sort-holder">
|
||||
<%= render :partial => 'bulletin', :collection => @bulletins %>
|
||||
</tbody>
|
||||
</tbody>
|
||||
Vendored
-1
@@ -6,4 +6,3 @@
|
||||
<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' %>
|
||||
</div>
|
||||
|
||||
+15
@@ -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>
|
||||
+51
@@ -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
-1
@@ -2,6 +2,7 @@ Rails.application.routes.draw do
|
||||
namespace :panel do
|
||||
namespace :announcement do
|
||||
namespace :back_end do
|
||||
resources :fact_checks
|
||||
root :to => "bulletins#index"
|
||||
resources :bulletins
|
||||
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
|
||||
@@ -21,4 +22,4 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user