First version for App and Object auth.Taking Announcement as experiment

This commit is contained in:
Matthew Kaito Juyuan Fu committed 2012-02-15 18:20:44 +08:00
1 parent 17caa7cb1b
commit 5640e07733
31 files changed
+161 -52

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
{
"title": "Announcement",
"title": "announcement",
"version": "0.1",
"organization": "Rulingcom",
"author": "RD dep",
@@ -1,11 +1,12 @@
class Panel::Announcement::BackEnd::AnnouncementsController < ApplicationController
layout 'admin'
def index
class Panel::Announcement::BackEnd::AnnouncementsController < OrbitBackendController
def public
render :text => "This is an public_page need to be build"
end
def index
end
# GET /announcements/1
# GET /announcements/1.xml
def show
@@ -76,4 +77,6 @@ class Panel::Announcement::BackEnd::AnnouncementsController < ApplicationControl
format.xml { head :ok }
end
end
end
@@ -1,7 +1,5 @@
class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationController
layout 'admin'
class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController
def index
@bulletin_categorys = BulletinCategory.all
@bulletin_category = BulletinCategory.new(:display => 'List')
@@ -1,9 +1,6 @@
class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
layout 'admin'
before_filter :authenticate_user!
before_filter :is_admin?
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
#before_filter :is_admin?
def index
# @bulletins = Bulletin.all
@@ -1,9 +1,10 @@
class Panel::Announcement::BackEnd::FactChecksController < ApplicationController
class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController
before_filter :authenticate_user!
layout 'admin'
def index
@bulletin_categorys_preview = BulletinCategory.authed_for_user(current_user,'preview')
@bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'check')
@bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'fact_check')
end
def new
@@ -6,7 +6,7 @@ class BulletinCategory
include OrbitCoreLib::ObjectAuthable
ObjectAuthTitlesOptions = %W{preview fact_check}
AfterObjectAuthUrl = '/panel/announcement/back_end/bulletin_categorys'
# include Mongoid::MultiParameterAttributes
PAYMENT_TYPES = [ "List", "Picture" ]
@@ -5,13 +5,15 @@
<td><%= bulletin_category.i18n_variable[locale] rescue nil %></td>
<% 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>
<% if is_manager? %>
<td>
<%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,@module_app) %> <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>
<% end %>
<%= 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 %>
@@ -7,9 +7,8 @@
<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>
<li><%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path if is_manager?%></li>
<li><%= link_to t('bulletin.my_announcement_fact_check'), panel_announcement_back_end_fact_checks_path if is_sub_manager?%></li>
</ul>
<% end -%>
@@ -42,10 +42,14 @@
<br />
<h1><%= t('bulletin.list_announcement') %></h1>
<div id="preview_block">
<h1>Preview</h1>
<%= render :partial => "list_table", :collection => @bulletin_categorys_preview,:as => :bulletin_category%>
</div>
===================================================================================================================
<div id="check_block">
<h1>Check Please</h1>
<%= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%>
</div>
<br />
+2 -1
View File
@@ -3,6 +3,7 @@ Rails.application.routes.draw do
namespace :panel do
namespace :announcement do
namespace :back_end do
match 'public' => "announcements#public",:as => :public
resources :fact_checks
root :to => "bulletins#index"
resources :bulletins
@@ -14,7 +15,7 @@ Rails.application.routes.draw do
root :to => "bulletins#index"
resources :bulletins
end
namespace :widget do
namespace :widget do
root :to => "bulletins#index"
end
end
@@ -1,4 +0,0 @@
# desc "Explaining what the task does"
# task :announcement do
# # Task goes here
# end
@@ -1,4 +1,4 @@
class Panel::NewBlog::FrontEnd::CommentsController < ObitFrontendController
class Panel::NewBlog::FrontEnd::CommentsController < OrbitFrontendController
def create
@post = Post.find(params[:post_id])
@comment = @post.comments.create!(params[:comment])
@@ -1,4 +1,4 @@
class Panel::NewBlog::FrontEnd::PostsController < ObitFrontendController
class Panel::NewBlog::FrontEnd::PostsController < OrbitFrontendController
# GET /posts
# GET /posts.xml
def index