Merge commit '7c55f6fb8850ef426978dd422fa782358f9ec2fe' into ldap

Conflicts:
	config/environments/development.rb
This commit is contained in:
Matt Fu 2012-03-01 10:13:49 +08:00
commit 7f05f21930
63 changed files with 1358 additions and 985 deletions

View File

@ -22,7 +22,7 @@ gem 'rubyzip'
gem 'sinatra' gem 'sinatra'
gem 'sprockets' gem 'sprockets'
gem 'tinymce-rails' gem 'tinymce-rails'
# gem 'therubyracer' gem 'therubyracer'

View File

@ -84,6 +84,7 @@ GEM
railties (~> 3.0) railties (~> 3.0)
thor (~> 0.14) thor (~> 0.14)
json (1.6.5) json (1.6.5)
libv8 (3.3.10.4)
linecache19 (0.5.12) linecache19 (0.5.12)
ruby_core_source (>= 0.1.4) ruby_core_source (>= 0.1.4)
mail (2.3.0) mail (2.3.0)
@ -182,6 +183,8 @@ GEM
rack (~> 1.0) rack (~> 1.0)
tilt (~> 1.1, != 1.3.0) tilt (~> 1.1, != 1.3.0)
subexec (0.2.1) subexec (0.2.1)
therubyracer (0.9.9)
libv8 (~> 3.3.10)
thor (0.14.6) thor (0.14.6)
tilt (1.3.3) tilt (1.3.3)
tinymce-rails (3.4.8) tinymce-rails (3.4.8)
@ -239,6 +242,7 @@ DEPENDENCIES
sinatra sinatra
spork spork
sprockets sprockets
therubyracer
tinymce-rails tinymce-rails
uglifier uglifier
watchr watchr

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -70,8 +70,28 @@ $(document).ready(function(){
}); });
$(window).resize(function(){ $(window).resize(function(){
resize(); resize();
$('#main-sidebar').css("height", viewportheight-40); var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2;
$('#main-sidebar .viewport').css("height", viewportheight-40); $('#main-sidebar').css("height", viewportheight-30);
$('#main-sidebar .viewport').css("height", viewportheight-30);
$('.post-title').css("width", viewportwidth-495); $('.post-title').css("width", viewportwidth-495);
$('#main-sidebar').tinyscrollbar({ size:(viewportheight-44)}); $('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
mainTablePosition()
});
/*main-table position*/
function mainTablePosition() {
var $height = $('#main-wrap > .subnav').height()
var $table = $('#main-wrap > .table')
//alert ($table.height())
$table.stop().animate({marginTop:$height},500)
//$table.css({marginTop : $height})
}
$(window).scroll(function () {
//var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-1;
//var $subnavWidth = parseInt($('#main-wrap > .subnav').css("width"));
var $winLeft = $(window).scrollLeft()
$(".table-label").css({left:$winLeft*-1} );
//$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} );
//$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} );
//console.log($mainWrapMarginLeft+($winLeft*-1)+5);
}); });

View File

@ -2642,8 +2642,8 @@ button.btn.small, input[type="submit"].btn.small {
color: #333333; color: #333333;
} }
.pagination { .pagination {
height: 36px; height: 36px;
margin: 18px 0; margin: 18px 0;
} }
.pagination ul { .pagination ul {
display: inline-block; display: inline-block;
@ -2663,7 +2663,8 @@ button.btn.small, input[type="submit"].btn.small {
.pagination li { .pagination li {
display: inline; display: inline;
} }
.pagination a {
.pagination .page{
float: left; float: left;
padding: 0 14px; padding: 0 14px;
line-height: 34px; line-height: 34px;
@ -2671,6 +2672,28 @@ button.btn.small, input[type="submit"].btn.small {
border: 1px solid #ddd; border: 1px solid #ddd;
border-left-width: 0; border-left-width: 0;
} }
.pagination a {
float: left;
}
.pagination .next{
float: left;
padding: 0 14px;
line-height: 34px;
text-decoration: none;
border: 1px solid #ddd;
border-left-width: 0;
}
.pagination .last{
float: left;
padding: 0 14px;
line-height: 34px;
text-decoration: none;
border: 1px solid #ddd;
border-left-width: 0;
}
.pagination .current{
border-left-width: 1px;
}
.pagination a:hover, .pagination .active a { .pagination a:hover, .pagination .active a {
background-color: #f5f5f5; background-color: #f5f5f5;
} }

View File

@ -1,10 +1,10 @@
@font-face{ @font-face{
font-family: 'WebSymbolsRegular'; font-family: 'WebSymbolsRegular';
src: url(<%= asset_path 'fonts/websymbols-regular-webfont.eot' %>); src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>);
src: url(<%= asset_path 'fonts/websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'), src: url(<%= asset_path 'websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'),
url(<%= asset_path 'fonts/websymbols-regular-webfont.woff' %>) format('woff'), url(<%= asset_path 'websymbols-regular-webfont.woff' %>) format('woff'),
url(<%= asset_path 'fonts/websymbols-regular-webfont.ttf' %>) format('truetype'), url(<%= asset_path 'websymbols-regular-webfont.ttf' %>) format('truetype'),
url(<%= asset_path 'fonts/websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg'); url(<%= asset_path 'websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg');
} }
.login-logo { .login-logo {
text-indent: -9999px; text-indent: -9999px;
@ -30,6 +30,15 @@
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset;
background-image: -moz-linear-gradient(top, #5282A6, #133757);
background-image: -ms-linear-gradient(top, #5282A6, #133757);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5282A6), to(#133757));
background-image: -webkit-linear-gradient(top, #5282A6, #133757);
background-image: -o-linear-gradient(top, #5282A6, #133757);
background-image: linear-gradient(top, #5282A6, #133757);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5282A6', endColorstr='#133757', GradientType=0);
/*
background-image: -moz-linear-gradient(top, #545b60, #191a1c); background-image: -moz-linear-gradient(top, #545b60, #191a1c);
background-image: -ms-linear-gradient(top, #545b60, #191a1c); background-image: -ms-linear-gradient(top, #545b60, #191a1c);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c)); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c));
@ -37,6 +46,7 @@
background-image: -o-linear-gradient(top, #545b60, #191a1c); background-image: -o-linear-gradient(top, #545b60, #191a1c);
background-image: linear-gradient(top, #545b60, #191a1c); background-image: linear-gradient(top, #545b60, #191a1c);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#545b60', endColorstr='#191a1c', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#545b60', endColorstr='#191a1c', GradientType=0);
*/
} }
#orbit-bar .navbar-search { #orbit-bar .navbar-search {
float: none; float: none;
@ -65,7 +75,8 @@
width:100%; width:100%;
} }
#orbit-bar .orbit-logo .brand { #orbit-bar .orbit-logo .brand {
background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px; /* background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px; */
background: url(<%= asset_path 'nccu_logo.png' %>) no-repeat 6px 0px;
text-indent:-9999px; text-indent:-9999px;
padding: 5px 20px 4px; padding: 5px 20px 4px;
} }
@ -78,6 +89,9 @@
#orbit-bar .orbit-logo .dropdown-menu { #orbit-bar .orbit-logo .dropdown-menu {
left: -15px; left: -15px;
} }
#orbit-bar .nav > li {
height: 28px;
}
#orbit-bar .nav > li > a:hover { #orbit-bar .nav > li > a:hover {
background-color: rgba(0,157,220,1); background-color: rgba(0,157,220,1);
} }
@ -121,7 +135,6 @@
} }
#orbit-bar .nav span.member-name { #orbit-bar .nav span.member-name {
display: inline-block; display: inline-block;
float: right;
line-height: 22px; line-height: 22px;
padding: 0 10px; padding: 0 10px;
} }
@ -212,7 +225,7 @@
padding-right: 4px; padding-right: 4px;
border-right: 1px solid rgba(0,0,0,.2); border-right: 1px solid rgba(0,0,0,.2);
position:fixed; position:fixed;
top: 42px; top: 32px;
z-index: 88; z-index: 88;
} }
#main-sidebar .nav { #main-sidebar .nav {
@ -250,7 +263,7 @@
#main-wrap { #main-wrap {
background-color: #FFF; background-color: #FFF;
margin-left:160px; margin-left:160px;
padding-top: 42px; padding-top: 32px;
padding-bottom: 18px; padding-bottom: 18px;
position: relative; position: relative;
min-height: 100%; min-height: 100%;

View File

@ -21,7 +21,10 @@ class Admin::AppAuthsController < ApplicationController
def create def create
app_auth = AppAuth.find_or_create_by(module_app_id: params[:module_app_id]) app_auth = AppAuth.find_or_create_by(module_app_id: params[:module_app_id])
params[:new].each do |item| auth_all = params[:auth_all] || false
app_auth.update_attribute(:all,auth_all)
new_array = params[:new] || []
new_array.each do |item|
field = item[0] field = item[0]
field_value = item[1] field_value = item[1]
if field_value!='' if field_value!=''
@ -66,6 +69,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

View File

@ -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])
@ -97,7 +101,7 @@ class Admin::ModuleAppsController < ApplicationController
end end
#user is not permited to do that #user is not permited to do that
flash[:notice] = t('admin.app_auth.operation_not_permitted') flash[:notice] = t('admin.app_auth.operation_not_permitted')
redirect_to :action => "edit" # [TODO] maybe need to redirect to some other page render :nothing => true, :status => 403
end end
@ -109,7 +113,7 @@ class Admin::ModuleAppsController < ApplicationController
end end
#user is not permited to do that #user is not permited to do that
flash[:notice] = t('admin.app_auth.operation_not_permitted') flash[:notice] = t('admin.app_auth.operation_not_permitted')
redirect_to :action => "edit" # [TODO] maybe need to redirect to some other page render :nothing => true, :status => 403
end end
end end

View File

@ -1,8 +1,12 @@
class Admin::ObjectAuthsController < ApplicationController class Admin::ObjectAuthsController < ApplicationController
include OrbitCoreLib::PermissionUnility
layout "admin" layout "admin"
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :check_if_user_can_do_object_auth
# before_filter :is_admin? ,:only => :index # before_filter :is_admin? ,:only => :index
def index def index
# if current_user.admin? # if current_user.admin?
@object_auths = ObjectAuth.all @object_auths = ObjectAuth.all
@ -14,6 +18,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 }
@ -22,13 +27,21 @@ class Admin::ObjectAuthsController < ApplicationController
def create def create
obj = eval(params[:object_auth][:type]).find params[:object_auth][:obj_id] obj = eval(params[:object_auth][:type]).find params[:object_auth][:obj_id]
@object_auth=obj.object_auths.create :title=> params[:object_auth][:title] @object_auth=obj.object_auths.build :title=> params[:object_auth][:title]
redirect_to edit_admin_object_auth_path(@object_auth) if @object_auth.save
redirect_to edit_admin_object_auth_path(@object_auth)
else
flash[:error] = t('admin.object.a_object_must_have_only_one_object_auth_profile_for_each_action')
redirect_to (:back)
end
end end
def create_role def create_role
object_auth = ObjectAuth.find(params[:id]) object_auth = ObjectAuth.find(params[:id])
params[:new].each do |item| auth_all = params[:auth_all] || false
object_auth.update_attribute(:all,auth_all)
new_array = params[:new] || []
new_array.each do |item|
field = item[0] field = item[0]
field_value = item[1] field_value = item[1]
if field_value!='' if field_value!=''
@ -70,6 +83,10 @@ class Admin::ObjectAuthsController < ApplicationController
@object_auth = ObjectAuth.find(params[:id]) @object_auth = ObjectAuth.find(params[:id])
end end
private
def check_if_user_can_do_object_auth
unless check_permission(:manager)
render :nothing => true, :status => 403
end
end
end end

View File

@ -1,3 +0,0 @@
class ObitFrontendController< ObitFrontendComponentController
end

View File

@ -1,3 +0,0 @@
class ObitWidgetController< ObitFrontendComponentController
end

View File

@ -0,0 +1,23 @@
class OrbitBackendController< ApplicationController
before_filter :authenticate_user!
before_filter :setup_vars
# before_filter {|c| c.front_end_available(@app_title)}
before_filter :check_user_can_use,:except => [:public]
include OrbitCoreLib::PermissionUnility
layout 'admin'
def setup_vars
@app_title = request.fullpath.split('/')[2]
@module_app = ModuleApp.first(conditions: {:key => @app_title} )
end
private
def check_user_can_use
unless check_permission
redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
end
end
end

View File

@ -1,4 +1,4 @@
class ObitFrontendComponentController< ApplicationController class OrbitFrontendComponentController< ApplicationController
before_filter :setup_vars before_filter :setup_vars
before_filter {|c| c.front_end_available(@app_title)} before_filter {|c| c.front_end_available(@app_title)}
layout 'module_widget' layout 'module_widget'

View File

@ -0,0 +1,3 @@
class OrbitFrontendController< OrbitFrontendComponentController
end

View File

@ -0,0 +1,3 @@
class ObitWidgetController< OrbitFrontendComponentController
end

View File

@ -3,4 +3,9 @@ module Admin::AppAuthHelper
link_to t(:enable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch' link_to t(:enable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch'
link_to t(:disable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch' link_to t(:disable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch'
end end
def if_permitted_to(user,role)
end
end end

View File

@ -5,4 +5,17 @@ module AdminHelper
link_to('/' , admin_items_path) + ( @parent_items.map{ |i| link_to(i.name, admin_items_path(:parent_id=>i.id) ) } << @parent_item.name ).join("/").html_safe link_to('/' , admin_items_path) + ( @parent_items.map{ |i| link_to(i.name, admin_items_path(:parent_id=>i.id) ) } << @parent_item.name ).join("/").html_safe
end end
# Check if the current_user is manager in current module app
def is_manager?
@module_app.is_manager?(current_user) || is_admin?
end
# Check if the current_user is sub manager in current module app
def is_sub_manager?
@module_app.is_sub_manager?(current_user)|| is_admin?
end
def is_admin?
current_user.admin?
end
end end

View File

@ -2,4 +2,5 @@ class AppAuth < PrototypeAuth
belongs_to :module_app belongs_to :module_app
end end

View File

@ -1,6 +1,7 @@
class ModuleApp class ModuleApp
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include OrbitCoreLib::ObjectTokenUnility
field :key field :key
field :title field :title
@ -26,6 +27,14 @@ class ModuleApp
before_save :set_key before_save :set_key
def is_manager?(user)
managing_users.include?(user)
end
def is_sub_manager?(user)
sub_managing_users.include?(user) || is_manager?(user)
end
def managing_users def managing_users
self.managers.collect{ |t| t.user } self.managers.collect{ |t| t.user }
end end
@ -74,4 +83,5 @@ class ModuleApp
self.key = self.title.underscore if self.title self.key = self.title.underscore if self.title
end end
end end

View File

@ -1,5 +1,6 @@
class ObjectAuth < PrototypeAuth class ObjectAuth < PrototypeAuth
include OrbitCoreLib::ObjectTokenUnility
validates_uniqueness_of :obj_authable_type,:scope => :title #{ |c| }
belongs_to :obj_authable, polymorphic: true belongs_to :obj_authable, polymorphic: true
# > - Something.find_with_auth(query) # > - Something.find_with_auth(query)
# > - or Something.find(query).auth # > - or Something.find(query).auth

View File

@ -4,7 +4,6 @@ class PrototypeAuth
# after_save :update_block_list,:update_privilage_list # after_save :update_block_list,:update_privilage_list
field :title field :title
field :token
field :all ,type: Boolean,default: false field :all ,type: Boolean,default: false
belongs_to :users belongs_to :users
@ -12,11 +11,12 @@ class PrototypeAuth
has_and_belongs_to_many :blocked_users, :inverse_of => nil, :class_name => "User" has_and_belongs_to_many :blocked_users, :inverse_of => nil, :class_name => "User"
has_and_belongs_to_many :privilege_users, :inverse_of => nil, :class_name => "User" has_and_belongs_to_many :privilege_users, :inverse_of => nil, :class_name => "User"
has_and_belongs_to_many :roles has_and_belongs_to_many :roles
has_and_belongs_to_many :sub_roles has_and_belongs_to_many :sub_roles
attr_protected :roles,:sub_roles,:privilege_users,:blocked_users,:users attr_protected :roles,:sub_roles,:privilege_users,:blocked_users
def add_role role def add_role role
add_operation(:roles,role) add_operation(:roles,role)
@ -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,11 +83,10 @@ 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
end end

View File

@ -0,0 +1 @@
<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %>

View File

@ -1,3 +1,10 @@
<div id="open_for_all_user">
<h1>All User</h1>
<%= form_tag(submit_url) do %>
<%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag 'Add Role' %><br/>
<% end %>
</div>
<div id="user_role_management"> <div id="user_role_management">
<h1>User Role</h1> <h1>User Role</h1>
<%= form_tag(submit_url) do %> <%= form_tag(submit_url) do %>
@ -10,7 +17,6 @@
<%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %> <%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %>
<%= submit_tag 'Add BlockedList' %><br/> <%= submit_tag 'Add BlockedList' %><br/>
<% end %> <% end %>
<ul>Roles </ul>
<% unless auth.nil? %> <% unless auth.nil? %>
<% auth.roles.each do |role| %> <% auth.roles.each do |role| %>
<li> <%= role.key %> Build in:<%= role.built_in ? 'Yes' : 'No' %> <li> <%= role.key %> Build in:<%= role.built_in ? 'Yes' : 'No' %>

View File

@ -1 +0,0 @@
<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {}, {:rel => admin_module_apps_path } %>

View File

@ -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(',') %>

View File

@ -11,4 +11,4 @@
<%= render :partial => "admin/components/user_role_management", :locals => { <%= render :partial => "admin/components/user_role_management", :locals => {
:object => @object_auth.auth_obj ,:auth=>@object_auth,:submit_url=>create_role_admin_object_auth_path(@object_auth),:ploy_route_ary=>['remove',:admin,@object_auth] } %> :object => @object_auth.auth_obj ,:auth=>@object_auth,:submit_url=>create_role_admin_object_auth_path(@object_auth),:ploy_route_ary=>['remove',:admin,@object_auth] } %>
<%= link_to 'Back to object',eval(@object_auth.obj_authable.class.to_s+"::AfterObjectAuthUrl") %>

View File

@ -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] %>

View File

@ -26,10 +26,10 @@
</ul> </ul>
</li> </li>
<% if user_signed_in? %> <% if user_signed_in? %>
<li class="dropdown active clear"> <li class="dropdown active">
<a class="orbit-bar-account" href="#" data-toggle="dropdown"> <a class="orbit-bar-account" href="#" data-toggle="dropdown">
<!-- <img src="images/menber-pic.png" /> --> <img class="member-img" src="/assets/menber-pic.png" />
<%= image_tag current_user.avatar.thumb.url, :class => 'member-img' %> <%#= image_tag current_user.avatar.thumb.url, :class => 'member-img' %>
<span class="member-name"><%= current_user.name %></span> <span class="member-name"><%= current_user.name %></span>
</a> </a>
<ul class="dropdown-menu account-menu"> <ul class="dropdown-menu account-menu">
@ -45,7 +45,7 @@
<%= t(:desktop) %> <%= t(:desktop) %>
</a> </a>
</li> </li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-out') + t(:logout), destroy_user_session_path %></li> <li><%= link_to content_tag(:i, nil, :class => 'icons-out') + ' ' + t(:logout), destroy_user_session_path %></li>
<li class="divider"></li> <li class="divider"></li>
<li> <li>
@ -95,7 +95,7 @@
<% end %> <% end %>
</ul> </ul>
<form class="navbar-search span6" action=""> <form class="navbar-search span6" action="">
<input class="search-query span4" type="text" placeholder="Search NCCU"> <input class="search-query span4" type="text" placeholder="<%= t(:search_nccu) %>">
</form> </form>
</div> </div>
</div> </div>

View File

@ -13,7 +13,7 @@
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers('users') do -%> <%= content_tag :li, :class => active_for_controllers('users') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), panel_web_resource_back_end_web_links_path %> <%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers(nil) do -%> <%= content_tag :li, :class => active_for_controllers(nil) do -%>
@ -25,7 +25,7 @@
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers(nil) do -%> <%= content_tag :li, :class => active_for_controllers(nil) do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), nil %> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers(nil) do -%> <%= content_tag :li, :class => active_for_controllers(nil) do -%>

View File

@ -47,7 +47,7 @@ module PrototypeR4
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de # config.i18n.default_locale = :de
config.i18n.default_locale = :en config.i18n.default_locale = :zh_tw
# JavaScript files you want as :defaults (application.js is always included). # JavaScript files you want as :defaults (application.js is always included).
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails) # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

View File

@ -28,7 +28,7 @@ PrototypeR4::Application.configure do
# :email_prefix => "[R4_error]", # :email_prefix => "[R4_error]",
# :sender_address => %{"notifier" <redmine@rulingcom.com>}, # :sender_address => %{"notifier" <redmine@rulingcom.com>},
# :exception_recipients => %w{chris@rulingcom.com} # :exception_recipients => %w{chris@rulingcom.com}
#
# config.action_mailer.delivery_method = :smtp # config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = { # config.action_mailer.smtp_settings = {
# :tls => true, # :tls => true,

View File

@ -32,6 +32,7 @@ en:
password: Password password: Password
register: Register register: Register
remember_me: Remember me remember_me: Remember me
search_nccu: Search NCCU
show: Show show: Show
submit: Submit submit: Submit
sure?: Are you sure? sure?: Are you sure?

View File

@ -17,7 +17,7 @@ zh_tw:
edit: 編輯 edit: 編輯
email: 電子郵件 email: 電子郵件
enable: 啟用 enable: 啟用
forget_password: 忘記密碼? forgot_password: 忘記密碼?
help: 協助 help: 協助
hide: 隱藏 hide: 隱藏
homepage: 首頁 homepage: 首頁
@ -25,10 +25,11 @@ zh_tw:
logout: 登出 logout: 登出
no_: "No" no_: "No"
nothing: nothing:
or_lower: or_lower:
password: 密碼 password: 密碼
register: 註冊 register: 註冊
remember_me: 記住我 remember_me: 記住我
search_nccu: 搜尋政大
show: 顯示 show: 顯示
submit: 送出 submit: 送出
sure?: 您肯定嗎? sure?: 您肯定嗎?

View File

@ -31,4 +31,44 @@ module OrbitCoreLib
end end
end end
module ObjectTokenUnility
def self.included(base)
base.instance_eval("field :s_token")
base.instance_eval("after_create :generate_token")
end
def token
return self.s_token
end
protected
def generate_token
self.s_token = ActiveSupport::SecureRandom.hex(16)
self.save!
end
end
module PermissionUnility
private
def check_permission(type = :use)
permission_grant = current_user.admin?? true : false
module_app = @module_app.nil?? find_module_app_by_token(params[:token]) : @module_app
unless permission_grant
permission_grant = case type
when :use
users_ary = module_app.app_auth.auth_users rescue nil
users_ary = [] if users_ary.nil?
(users_ary.include?(current_user) || module_app.is_manager?(current_user) || module_app.is_sub_manager?(current_user))
when :manager
module_app.is_manager?(current_user)
when :sub_manager
module_app.is_manager?(current_user) || module_app.is_sub_manager?(current_user)
end
end
permission_grant
end
def find_module_app_by_token(token)
ModuleApp.first(conditions: {s_token: token})
end
end
end end

View File

@ -81,7 +81,7 @@ module ParserFrontEnd
res << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>" res << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>"
res << "<script type='text/javascript' src='/assets/event.js'></script>" res << "<script type='text/javascript' src='/assets/event.js'></script>"
page.design.javascripts.each do |js| page.design.javascripts.each do |js|
res << "<script type='text/javascript' src='#{js.file.url}'></script>" # res << "<script type='text/javascript' src='#{js.file.url}'></script>"
end end
res res
end end

22
lib/tasks/anc_tasks.rake Normal file
View File

@ -0,0 +1,22 @@
# encoding: utf-8
namespace :anc do
task :build => :environment do
bulletin_category_1 = BulletinCategory.create(:key => "C1ChrisCheckANDPreivew",:display => "List" )
bulletin_category_1.create_i18n_variable(:en => "ChrisCheckANDPreivew", :zh_tw => 'ChrisCheckANDPreivew')
bulletin_category_2 = BulletinCategory.create(:key => "C2MattCheckANDPreivew",:display => "List" )
bulletin_category_2.create_i18n_variable(:en => "MattCheckANDPreivew", :zh_tw => 'MattCheckANDPreivew')
bulletin_category_3 = BulletinCategory.create(:key => "C3MattCheckChrisPreview",:display => "List" )
bulletin_category_3.create_i18n_variable(:en => "MattCheckChrisPreview", :zh_tw => 'MattCheckChrisPreview')
bulletin_1 = Bulletin.create(:title => "C1P1",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 )
bulletin_2 = Bulletin.create(:title => "C1P2",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 )
bulletin_3 = Bulletin.create(:title => "C2P1",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 )
bulletin_4 = Bulletin.create(:title => "C2P2",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 )
bulletin_5 = Bulletin.create(:title => "C3P1",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 )
bulletin_6 = Bulletin.create(:title => "C3P2",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 )
end
end

View File

@ -126,6 +126,12 @@ namespace :dev do
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[0].id, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' ) AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[0].id, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' )
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[1].id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' ) AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[1].id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
user = User.create( :email => 'manager@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => false, :role_id => r_2.id, :sub_role_ids => [sr_2_1.id ] )
AttributeValue.create( :user_id => user.id, :attribute_field_id => i_1.attribute_fields[0].id, :key => 'first_name', :en => 'Manager', :zh_tw => '管理員' )
AttributeValue.create( :user_id => user.id, :attribute_field_id => i_1.attribute_fields[1].id, :key => 'last_name', :en => 'Chen', :zh_tw => '陳' )
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[0].id, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' )
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[1].id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
ad_banner = AdBanner.new(:title => 'banner_1',:post_date => Date.today,:context=> "context",:ad_fx=>'zoom',:direct_to_after_click=>true) ad_banner = AdBanner.new(:title => 'banner_1',:post_date => Date.today,:context=> "context",:ad_fx=>'zoom',:direct_to_after_click=>true)
ad_banner.ad_images.build(:time_to_next=>2,:picture_intro=>'Banner1',:out_link=>'http://www.rulingcom.com/main.php',:file => File.open("#{Rails.root}/lib/ad_banner/ad_banner1.jpg",:link_open=>'new_window')) ad_banner.ad_images.build(:time_to_next=>2,:picture_intro=>'Banner1',:out_link=>'http://www.rulingcom.com/main.php',:file => File.open("#{Rails.root}/lib/ad_banner/ad_banner1.jpg",:link_open=>'new_window'))

View File

@ -5,7 +5,7 @@ namespace :user do
User.all(conditions: {email: /nor/}).destroy_all User.all(conditions: {email: /nor/}).destroy_all
username_list = %w{nor1 nor2 nor3 nor4 nor5 nor6 nor7} username_list = %w{nor1 nor2 nor3 nor4 nor5 nor6 nor7}
userfirstname_list_en = %w{ One Two Thre For Fiv Six Sen } userfirstname_list_en = %w{ UserOne UserTwo Thre For Fiv Six Sen }
userlastname_list_en = %w{ Aa Bb Cc Dd Ee Ff Gg } userlastname_list_en = %w{ Aa Bb Cc Dd Ee Ff Gg }
userfirstname_list_ct = %w{ 一一 二二 三三 四四 五五 六六 七七 } userfirstname_list_ct = %w{ 一一 二二 三三 四四 五五 六六 七七 }

View File

@ -1,5 +1,5 @@
{ {
"title": "Announcement", "title": "announcement",
"version": "0.1", "version": "0.1",
"organization": "Rulingcom", "organization": "Rulingcom",
"author": "RD dep", "author": "RD dep",

View File

@ -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' }
@ -145,7 +145,13 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
protected protected
def get_categorys(id = nil) def get_categorys(id = nil)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true)) @bulletin_categorys = []
if(is_manager? || is_admin?)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
elsif is_sub_manager?
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
end
<<<<<<< HEAD
end end
def get_sorted_bulletins def get_sorted_bulletins
@ -190,6 +196,8 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
a.flatten! a.flatten!
a.uniq a.uniq
end end
=======
>>>>>>> 26cd6951dba43b1f6eaf5056160309c5c77a8716
end end

View File

@ -0,0 +1,38 @@
class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController
before_filter :authenticate_user!
include AdminHelper
layout 'admin'
def index
@bulletin_categorys_submit_new = []
@bulletin_categorys_check =[]
if is_admin? || is_manager?
#@bulletin_categorys_submit_new = BulletinCategory.all
@bulletin_categorys_check = BulletinCategory.all
# elsif is_sub_manager?
# @bulletin_categorys_submit_new = BulletinCategory.authed_for_user(current_user,'submit_new')
# @bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'fact_check')
end
end
def new
end
def create
end
def update
end
def edit
end
def destroy
end
end

View File

@ -17,7 +17,9 @@ class Panel::Announcement::FrontEnd::BulletinsController < ObitWidgetController
@bulletins = Bulletin.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) @bulletins = Bulletin.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10)
end end
get_categorys get_categorys
@current_category = BulletinCategory.from_id(params[:bulletin_category_id]) rescue nil
end end
def show def show

View File

@ -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{submit_new fact_check}
AfterObjectAuthUrl = '/panel/announcement/back_end/bulletin_categorys'
# include Mongoid::MultiParameterAttributes # include Mongoid::MultiParameterAttributes
PAYMENT_TYPES = [ "List", "Picture" ] PAYMENT_TYPES = [ "List", "Picture" ]
@ -14,4 +18,8 @@ class BulletinCategory
has_many :bulletins has_many :bulletins
def self.from_id(id)
BulletinCategory.find(id) rescue nil
end
end end

View File

@ -5,7 +5,15 @@
<td><%= bulletin_category.i18n_variable[locale] rescue nil %></td> <td><%= bulletin_category.i18n_variable[locale] rescue nil %></td>
<% end %> <% end %>
<td><%= bulletin_category.display %></td> <td><%= bulletin_category.display %></td>
<td> <% if is_manager? %>
<td>
<%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,:token => @module_app.token) %> <br/ >
<% bulletin_category.object_auths.each do |obj_auth| %>
<%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth,:token => @module_app.token) %><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.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 %>

View File

@ -1,22 +1,17 @@
<% content_for :secondary do %> <% content_for :secondary do %>
<br /> <%= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<br />
<br />
<br />
<br />
<ul class="list">
<li><%#= link_to t('bulletin_category.new_announcement_class'), new_panel_announcement_back_end_bulletin_category_path, :class => 'seclink1' %></li>
</ul>
<% end -%> <% end -%>
<%= flash_messages %> <%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<h1><%= t('bulletin_category.list_announcement_class') %></h1> <h1><%= t('bulletin_category.list_announcement_class') %></h1>
<br />
<br />
<br />
<br />
<br />
<table id="bulletin_categorys"> <table id="bulletin_categorys">
<tr> <tr>
<th><%= t('bulletin_category.key') %></th> <th><%= t('bulletin_category.key') %></th>

View File

@ -1,15 +1,15 @@
<br />
<br />
<br />
<br />
<% content_for :secondary do %> <% content_for :secondary do %>
<ul class="list"> <%= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<li><%= link_to t('bulletin_category.index'), panel_announcement_back_end_bulletin_categorys_path, :class => 'seclink2' %></li>
</ul>
<% end -%> <% end -%>
<%= flash_messages %> <%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<h1><%= t('bulletin_category.new_announcement_class') %></h1> <h1><%= t('bulletin_category.new_announcement_class') %></h1>
<%= form_for @bulletin_category, :url => panel_announcement_back_end_bulletin_categorys_path do |f| %> <%= form_for @bulletin_category, :url => panel_announcement_back_end_bulletin_categorys_path do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %> <%= render :partial => 'form', :locals => {:f => f} %>

View File

@ -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>

View File

@ -1,4 +1,3 @@
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path do |f| %> <%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %> <%= render :partial => 'form', :locals => {:f => f} %>
<% end %> <% end %>

View File

@ -1,10 +1,14 @@
<% # encoding: utf-8 %> <% content_for :secondary do %>
<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<% end -%>
<%= flash_messages %>
<br /> <br />
<br /> <br />
<br /> <br />
<br />
<p id="notice"><%= flash_messages %></p> <br />
<ul> <ul>
<li> <li>

View File

@ -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>

View File

@ -0,0 +1,40 @@
<% content_for :secondary do %>
<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<% 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>
<div id="check_block">
<h1>Check Please</h1>
<%= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%>
</div>
<br />

View File

@ -2,7 +2,11 @@
<%= flash_messages %> <%= flash_messages %>
<h1 class="h1"><%= t('announcement.list_announcement') %></h1> <% if @current_category %>
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + t('announcement.bulletin.list_lower') %></h1>
<% else %>
<h1 class="h1"><%= t('announcement.list_announcement') %></h1>
<% end %>
<table class="table table-bordered"> <table class="table table-bordered">

View File

@ -11,7 +11,7 @@
<li> <li>
<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div> <div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div>
<h3 class="h3 news_title"><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %></h3> <h3 class="h3 news_title"><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %></h3>
<p class="news_wrap"><%= post.subtitle[I18n.locale] %></p> <p class="news_wrap"><%= post.subtitle[I18n.locale].html_safe %></p>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@ -32,6 +32,7 @@ en:
list_announcement: List Announcement list_announcement: List Announcement
bulletin: bulletin:
category: Category category: Category
list_lower: " list"
title: Title title: Title
postdate: Postdate postdate: Postdate
# admin: # admin:

View File

@ -27,6 +27,7 @@ zh_tw:
list_announcement: 公告列表 list_announcement: 公告列表
bulletin: bulletin:
category: 分類 category: 分類
list_lower: 列表
title: 標題 title: 標題
postdate: 張貼日期 postdate: 張貼日期
# admin: # admin:

View File

@ -2,6 +2,9 @@ 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
match 'public' => "announcements#public",:as => :public
resources :fact_checks
match 'list_mine' => "announcements#list_mine"
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

View File

@ -1,4 +0,0 @@
# desc "Explaining what the task does"
# task :announcement do
# # Task goes here
# end

View File

@ -1,4 +1,4 @@
class Panel::NewBlog::FrontEnd::CommentsController < ObitFrontendController class Panel::NewBlog::FrontEnd::CommentsController < OrbitFrontendController
def create def create
@post = Post.find(params[:post_id]) @post = Post.find(params[:post_id])
@comment = @post.comments.create!(params[:comment]) @comment = @post.comments.create!(params[:comment])

View File

@ -1,4 +1,4 @@
class Panel::NewBlog::FrontEnd::PostsController < ObitFrontendController class Panel::NewBlog::FrontEnd::PostsController < OrbitFrontendController
# GET /posts # GET /posts
# GET /posts.xml # GET /posts.xml
def index def index

View File

@ -14,7 +14,7 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
# @web_link = WebLink.where( :is_hidden => false ).desc(:is_top, :name).first # @web_link = WebLink.where( :is_hidden => false ).desc(:is_top, :name).first
@web_links = WebLink.widget_datas.page(params[:page]).per(9) @web_links = WebLink.widget_datas.page(params[:page]).per(5)
# get_categorys # get_categorys
@ -24,7 +24,7 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
end end
def reload_web_links def reload_web_links
@web_links = WebLink.widget_datas.page(params[:page]).per(9) @web_links = WebLink.widget_datas.page(params[:page]).per(5)
end end