fix announcement links & files

This commit is contained in:
unknown 2012-03-16 16:49:25 +08:00
commit a755eb184b
84 changed files with 2009 additions and 1672 deletions

View File

@ -1,6 +1,8 @@
source 'http://rubygems.org'
gem 'rails', '>=3.1.0', '<3.2.0'
gem "brakeman"
gem 'bson_ext'
gem 'carrierwave'
gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
@ -13,6 +15,7 @@ gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
gem 'mini_magick'
gem 'mongoid'
gem "mongo_session_store-rails3"
gem 'radius'
gem 'rake'
gem 'ruby-debug19'
@ -20,7 +23,7 @@ gem 'rubyzip'
gem 'sinatra'
gem 'sprockets'
gem 'tinymce-rails'
# gem 'therubyracer'
#gem 'therubyracer'
# Gems used only for assets and not required
# in production environments by default.

View File

@ -10,48 +10,55 @@ GIT
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.1.3)
actionpack (= 3.1.3)
actionmailer (3.1.4)
actionpack (= 3.1.4)
mail (~> 2.3.0)
actionpack (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
actionpack (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.5)
rack (~> 1.3.6)
rack-cache (~> 1.1)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.3)
activemodel (3.1.3)
activesupport (= 3.1.3)
activemodel (3.1.4)
activesupport (= 3.1.4)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
arel (~> 2.2.1)
activerecord (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
arel (~> 2.2.3)
tzinfo (~> 0.3.29)
activeresource (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
activesupport (3.1.3)
activeresource (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
activesupport (3.1.4)
multi_json (~> 1.0)
archive-tar-minitar (0.5.2)
arel (2.2.1)
bcrypt-ruby (3.0.1)
arel (2.2.3)
bcrypt-ruby (3.0.1-x86-mingw32)
bson (1.5.2)
bson_ext (1.5.2)
bson (= 1.5.2)
brakeman (1.5.1)
activesupport
erubis (~> 2.6)
haml (~> 3.0)
i18n
ruby2ruby (~> 1.2)
ruport (~> 1.6)
sass (~> 3.0)
bson (1.6.1)
bson_ext (1.6.1)
bson (~> 1.6.1)
builder (3.0.0)
carrierwave (0.5.8)
activesupport (~> 3.0)
carrierwave-mongoid (0.1.3)
carrierwave (>= 0.5.6)
mongoid (~> 2.1)
chronic (0.6.6)
chronic (0.6.7)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
@ -59,26 +66,32 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
color (1.4.1)
columnize (0.3.6)
database_cleaner (0.7.1)
delorean (1.2.0)
chronic
devise (1.5.3)
devise (2.0.4)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.1)
railties (~> 3.1)
warden (~> 1.1.1)
diff-lcs (1.1.3)
erubis (2.7.0)
exception_notification (2.5.2)
actionmailer (>= 3.0.4)
execjs (1.3.0)
multi_json (~> 1.0)
factory_girl (2.5.0)
activesupport
factory_girl_rails (1.6.0)
factory_girl (~> 2.5.0)
factory_girl (2.6.3)
activesupport (>= 2.3.9)
factory_girl_rails (1.7.0)
factory_girl (~> 2.6.0)
railties (>= 3.0.0)
fastercsv (1.5.4)
haml (3.1.4)
hike (1.2.1)
hoe (2.16.1)
rake (~> 0.8)
i18n (0.6.0)
jquery-rails (1.0.19)
railties (~> 3.0)
@ -86,24 +99,30 @@ GEM
json (1.6.5)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
mail (2.3.0)
mail (2.3.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
mini_magick (3.4)
subexec (~> 0.2.1)
mongo (1.5.2)
bson (= 1.5.2)
mongoid (2.4.2)
mongo (1.6.1)
bson (~> 1.6.1)
mongo_session_store-rails3 (3.0.5)
actionpack (>= 3.0)
mongo
mongoid (2.4.6)
activemodel (~> 3.1)
mongo (~> 1.3)
tzinfo (~> 0.3.22)
multi_json (1.0.4)
multi_json (1.1.0)
orm_adapter (0.0.6)
pdf-writer (1.1.8)
color (>= 1.4.0)
transaction-simple (~> 1.3)
polyglot (0.3.3)
rack (1.3.6)
rack-cache (1.1)
rack-cache (1.2)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
@ -113,18 +132,18 @@ GEM
rack
rack-test (0.6.1)
rack (>= 1.0)
radius (0.7.1)
rails (3.1.3)
actionmailer (= 3.1.3)
actionpack (= 3.1.3)
activerecord (= 3.1.3)
activeresource (= 3.1.3)
activesupport (= 3.1.3)
radius (0.7.3)
rails (3.1.4)
actionmailer (= 3.1.4)
actionpack (= 3.1.4)
activerecord (= 3.1.4)
activeresource (= 3.1.4)
activesupport (= 3.1.4)
bundler (~> 1.0)
railties (= 3.1.3)
railties (3.1.3)
actionpack (= 3.1.3)
activesupport (= 3.1.3)
railties (= 3.1.4)
railties (3.1.4)
actionpack (= 3.1.4)
activesupport (= 3.1.4)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@ -153,25 +172,33 @@ GEM
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
ruby2ruby (1.3.1)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.5)
sass (3.1.12)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
rubyzip (0.9.6.1)
ruport (1.6.3)
fastercsv
pdf-writer (= 1.1.8)
sass (3.1.15)
sass-rails (3.1.5)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass (~> 3.1.10)
tilt (~> 1.3.2)
sexp_processor (3.1.0)
shoulda-matchers (1.0.0)
simplecov (0.5.4)
multi_json (~> 1.0.3)
simplecov (0.6.1)
multi_json (~> 1.0)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
spork (0.9.0)
spork (0.9.0-x86-mingw32)
win32-process
sprockets (2.0.3)
@ -183,30 +210,32 @@ GEM
tilt (1.3.3)
tinymce-rails (3.4.8)
railties (>= 3.1)
transaction-simple (1.4.0)
hoe (>= 1.1.7)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.31)
uglifier (1.2.2)
tzinfo (0.3.32)
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
warden (1.1.0)
warden (1.1.1)
rack (>= 1.0)
watchr (0.7)
win32-api (1.4.8-x86-mingw32)
win32-process (0.6.5)
windows-pr (>= 1.1.2)
windows-api (0.4.0)
windows-api (0.4.1)
win32-api (>= 1.4.5)
windows-pr (1.2.1)
win32-api (>= 1.4.5)
windows-api (>= 0.3.0)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
brakeman
bson_ext
carrierwave
carrierwave-mongoid
@ -220,6 +249,7 @@ DEPENDENCIES
jquery-rails
kaminari!
mini_magick
mongo_session_store-rails3
mongoid
radius
rails (>= 3.1.0, < 3.2.0)

View File

@ -5,4 +5,4 @@ require File.expand_path('../config/application', __FILE__)
require 'rake/dsl_definition'
require 'rake'
PrototypeR4::Application.load_tasks
Orbit::Application.load_tasks

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -9,13 +9,6 @@ function resize() {
}
}
$(document).ready(function(){
$(document).on('click', '.language-menu li', function(){
$(this).each(function(i){
$(this).siblings().removeClass('active')
$(this).addClass('active')
})
return false;
});
$(document).on('click', '.orbit-bar-member', function(){
$(this).hasClass('open') ? $(this).removeClass('open') : $(this).addClass('open');
$('.bar-login .dropdown-menu').toggle();
@ -59,12 +52,15 @@ $(document).ready(function(){
/*tinyscrollbar&windows-Size*/
resize();
$('#main-sidebar').css("height", viewportheight-40);
$('#main-sidebar .viewport').css("height", viewportheight-40);
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2;
$('#main-sidebar').css("height", viewportheight-30);
$('#main-sidebar .viewport').css("height", viewportheight-30);
$('.post-title').css("width", viewportwidth-495);
$('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
$('#main-sidebar').tinyscrollbar();
$('.detal-list').tinyscrollbar();
$('#main-sidebar').tinyscrollbar({size:(viewportheight-44)});
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
mainTablePosition()
/*isotope*/
var $container = $('#isotope');

View File

@ -2663,7 +2663,8 @@ button.btn.small, input[type="submit"].btn.small {
.pagination li {
display: inline;
}
.pagination a {
.pagination .page{
float: left;
padding: 0 14px;
line-height: 34px;
@ -2671,6 +2672,28 @@ button.btn.small, input[type="submit"].btn.small {
border: 1px solid #ddd;
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 {
background-color: #f5f5f5;
}

View File

@ -145,6 +145,7 @@ body{
background-color: #101010;
bottom: 0;
color: #FFFFFF;
display:none;
font-size: 11px;
padding: 10px;
position: fixed;

View File

@ -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;
-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;
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: -ms-linear-gradient(top, #545b60, #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: linear-gradient(top, #545b60, #191a1c);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#545b60', endColorstr='#191a1c', GradientType=0);
*/
}
#orbit-bar .navbar-search {
float: none;
@ -65,7 +75,8 @@
width:100%;
}
#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;
padding: 5px 20px 4px;
}

View File

@ -21,7 +21,10 @@ class Admin::AppAuthsController < ApplicationController
def create
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_value = item[1]
if field_value!=''
@ -66,6 +69,8 @@ class Admin::AppAuthsController < ApplicationController
@module_app = ModuleApp.find(params[:id])
end
def show
@module_app = ModuleApp.find(params[:id])
end
end

View File

@ -21,6 +21,10 @@ class Admin::ModuleAppsController < ApplicationController
@module_app = ModuleApp.find(params[:id])
end
def show
@module_app = ModuleApp.find(params[:id])
end
def update
@module_app = ModuleApp.find(params[:id])
@ -97,7 +101,7 @@ class Admin::ModuleAppsController < ApplicationController
end
#user is not permited to do that
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
@ -109,7 +113,7 @@ class Admin::ModuleAppsController < ApplicationController
end
#user is not permited to do that
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

View File

@ -1,8 +1,12 @@
class Admin::ObjectAuthsController < ApplicationController
include OrbitCoreLib::PermissionUnility
layout "admin"
before_filter :authenticate_user!
before_filter :check_if_user_can_do_object_auth
# before_filter :is_admin? ,:only => :index
def index
# if current_user.admin?
@object_auths = ObjectAuth.all
@ -14,6 +18,7 @@ class Admin::ObjectAuthsController < ApplicationController
def new
obj = eval(params[:type]).find params[:obj_id]
@object_auth=obj.object_auths.build
@object_auth_title_option = eval(params[:type]+"::ObjectAuthTitlesOptions")
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @post }
@ -22,13 +27,21 @@ class Admin::ObjectAuthsController < ApplicationController
def create
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]
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
def create_role
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_value = item[1]
if field_value!=''
@ -70,6 +83,10 @@ class Admin::ObjectAuthsController < ApplicationController
@object_auth = ObjectAuth.find(params[:id])
end
private
def check_if_user_can_do_object_auth
unless check_permission(:manager)
render :nothing => true, :status => 403
end
end
end

View File

@ -0,0 +1,8 @@
class SessionsController < Devise::SessionsController
def create
super
reset_session
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,24 @@
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
include AdminHelper
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,7 +1,7 @@
class ObitFrontendComponentController< ApplicationController
class OrbitFrontendComponentController< ApplicationController
before_filter :setup_vars
before_filter {|c| c.front_end_available(@app_title)}
layout 'module_widget'
layout :false
def setup_vars
@app_title = request.fullpath.split('/')[2]

View File

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

View File

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

View File

@ -30,8 +30,12 @@ class PagesController < ApplicationController
end
def index_from_link
if params[:page]
redirect_to "/#{@item.full_name}?page=#{params[:page]}"
else
redirect_to "/#{@item.full_name}"
end
end
def show_from_link
redirect_to "/#{@item.full_name}?id=#{params[:id]}"

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(: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
def if_permitted_to(user,role)
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
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

View File

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

View File

@ -1,6 +1,7 @@
class ModuleApp
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectTokenUnility
field :key
field :title
@ -26,6 +27,14 @@ class ModuleApp
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
self.managers.collect{ |t| t.user }
end
@ -74,4 +83,5 @@ class ModuleApp
self.key = self.title.underscore if self.title
end
end

View File

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

View File

@ -4,7 +4,6 @@ class PrototypeAuth
# after_save :update_block_list,:update_privilage_list
field :title
field :token
field :all ,type: Boolean,default: false
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 :privilege_users, :inverse_of => nil, :class_name => "User"
has_and_belongs_to_many :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
add_operation(:roles,role)
@ -68,7 +68,7 @@ class PrototypeAuth
end
end
def auth_users
def auth_users_before_block_list
if self.all?
User.all.entries
else
@ -83,11 +83,10 @@ class PrototypeAuth
end
end
def auth_users_after_block_list
auth_users - self.blocked_users
def auth_users
auth_users_before_block_list - self.blocked_users
end
# protected
end

12
app/models/session.rb Normal file
View File

@ -0,0 +1,12 @@
class Session
include Mongoid::Document
include Mongoid::Timestamps
def self.sweep(time = 1.hour)
if time.is_a?(String)
time = time.split.inject { |count, unit| count.to_i.send(unit) }
end
delete_all "updated_at < '#{time.ago.to_s(:db)}' OR created_at < '#{2.days.ago.to_s(:db)}'"
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">
<h1>User Role</h1>
<%= form_tag(submit_url) do %>
@ -10,7 +17,6 @@
<%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %>
<%= submit_tag 'Add BlockedList' %><br/>
<% end %>
<ul>Roles </ul>
<% unless auth.nil? %>
<% auth.roles.each do |role| %>
<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 => {
: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>
<%= form_for @object_auth, :url => admin_object_auths_path do |f| %>
<%= 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 :type, :value => params[:type] %>

View File

@ -26,10 +26,10 @@
</ul>
</li>
<% if user_signed_in? %>
<li class="dropdown active clear">
<li class="dropdown active">
<a class="orbit-bar-account" href="#" data-toggle="dropdown">
<!-- <img src="images/menber-pic.png" /> -->
<%= image_tag current_user.avatar.thumb.url, :class => 'member-img' %>
<img class="member-img" src="/assets/menber-pic.png" />
<%#= image_tag current_user.avatar.thumb.url, :class => 'member-img' %>
<span class="member-name"><%= current_user.name %></span>
</a>
<ul class="dropdown-menu account-menu">
@ -45,7 +45,7 @@
<%= t(:desktop) %>
</a>
</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>
@ -95,7 +95,7 @@
<% end %>
</ul>
<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>
</div>
</div>

View File

@ -9,6 +9,7 @@
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
<%= content_tag :li, link_to(t('admin.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %>
<%= content_tag :li, link_to(t('admin.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('tags', 'index') %>
<% end -%>
<% end -%>

View File

@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run PrototypeR4::Application
run Orbit::Application

View File

@ -13,12 +13,13 @@ require 'sprockets/railtie'
# or test environments.
Bundler.require *Rails.groups(:assets) if defined?(Bundler)
module PrototypeR4
module Orbit
class Application < Rails::Application
# Add directories for plugins
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/built_in_modules)
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/downloaded_modules)
config.paths.app.views << "app/views/devise"
# Settings in config/environments/* take precedence over those specified here.
@ -47,7 +48,7 @@ module PrototypeR4
# 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.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).
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

View File

@ -4,4 +4,4 @@ require 'yaml'
YAML::ENGINE.yamler = 'syck'
# Initialize the rails application
PrototypeR4::Application.initialize!
Orbit::Application.initialize!

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.configure do
Orbit::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
@ -24,21 +24,21 @@ PrototypeR4::Application.configure do
config.action_dispatch.best_standards_support = :builtin
config.middleware.use ExceptionNotifier,
:email_prefix => "[R4_error]",
:sender_address => %{"notifier" <redmine@rulingcom.com>},
:exception_recipients => %w{chris@rulingcom.com}
# config.middleware.use ExceptionNotifier,
# :email_prefix => "[R4_error]",
# :sender_address => %{"notifier" <redmine@rulingcom.com>},
# :exception_recipients => %w{chris@rulingcom.com}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:tls => true,
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => '587',
:domain => "smtp.gmail.com",
:authentication => "plain",
:user_name => "redmine@rulingcom.com",
:password => "rulingredmine" }
# config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = {
# :tls => true,
# :enable_starttls_auto => true,
# :address => "smtp.gmail.com",
# :port => '587',
# :domain => "smtp.gmail.com",
# :authentication => "plain",
# :user_name => "redmine@rulingcom.com",
# :password => "rulingredmine" }
end

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.configure do
Orbit::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.configure do
Orbit::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's

View File

@ -4,4 +4,4 @@
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
PrototypeR4::Application.config.secret_token = 'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07'
Orbit::Application.config.secret_token = 'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07'

View File

@ -4,4 +4,4 @@
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
PrototypeR4::Application.config.secret_token = 'b8d78ecaf3086ebfc1ba42e912acba60d85cf3d789d933e117770e1a045a12911f121ff012a234982abb446c8b8c768052eea4bf8b2d5d336be821e2c25d8cdb'
Orbit::Application.config.secret_token = 'b8d78ecaf3086ebfc1ba42e912acba60d85cf3d789d933e117770e1a045a12911f121ff012a234982abb446c8b8c768052eea4bf8b2d5d336be821e2c25d8cdb'

View File

@ -1,8 +1,3 @@
# Be sure to restart your server when you modify this file.
PrototypeR4::Application.config.session_store :cookie_store, :key => '_prototype_R4_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# PrototypeR4::Application.config.session_store :active_record_store
Orbit::Application.config.session_store :mongoid_store

View File

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

View File

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

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.routes.draw do
Orbit::Application.routes.draw do
devise_for :users

View File

@ -31,4 +31,44 @@ module OrbitCoreLib
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

View File

@ -100,7 +100,7 @@ module ParserBackEnd
ret = ''
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}?inner=true&page_id=#{page.id}"
ret << "&bulletin_category_id=#{page.category}" if page[:category]
ret << "&category_id=#{page.category}" if page[:category]
ret << "'></div>"
else
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }

View File

@ -62,6 +62,7 @@ module ParserFrontEnd
c.define_tag 'stylesheets' do |tag|
res = ''
res << "<link href='/assets/bootstrap.css.erb' rel='stylesheet' type='text/css'/>"
res << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css'/>"
res << "<link href='/assets/style.css.erb' rel='stylesheet' type='text/css'/>"
res << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />" if page.design.reset_css
res << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' /> " if page.design.default_css
@ -81,7 +82,7 @@ module ParserFrontEnd
res << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>"
res << "<script type='text/javascript' src='/assets/event.js'></script>"
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
res
end
@ -127,7 +128,7 @@ module ParserFrontEnd
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
ret << "/#{id}" if id
ret << "?inner=true&page_id=#{page.id}"
ret << "&bulletin_category_id=#{page.category}" if page[:category]
ret << "&category_id=#{page.category}" if page[:category]
ret << "'></div>"
else
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil

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",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 )
bulletin_2 = Bulletin.create(:title => "C1P2",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 )
bulletin_3 = Bulletin.create(:title => "C2P1",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 )
bulletin_4 = Bulletin.create(:title => "C2P2",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 )
bulletin_5 = Bulletin.create(:title => "C3P1",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 )
bulletin_6 = Bulletin.create(:title => "C3P2",:status => nil,:subtitle => "",:text => "value",:post_date => 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[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.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
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 }
userfirstname_list_ct = %w{ 一一 二二 三三 四四 五五 六六 七七 }

View File

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

View File

@ -1,5 +1,4 @@
class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
layout 'new_admin'
before_filter :authenticate_user!
@ -15,7 +14,7 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
# @bulletins = Bulletin.search(params[:search], params[:category_id])
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.limit(1).desc("postdate")
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
@bulletin_categories = BulletinCategory.all
respond_to do |format|
@ -137,7 +136,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' }
@ -177,7 +176,17 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
protected
def get_categorys(id = nil)
@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
end
def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
end
def get_tags

View File

@ -0,0 +1,76 @@
class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController
before_filter :authenticate_user!
include AdminHelper
# layout 'admin'
layout 'new_admin'
def setting
@bulletin_categorys = BulletinCategory.all
if params.has_key?(:category_id)
first_category = BulletinCategory.find params[:category_id]
if params[:commit] == 'Update'
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
preload_object_auth_ary = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check')
preload_object_auth = preload_object_auth_ary.first
preload_object_auth.privilege_users = privilege_users
preload_object_auth.save!
end
else
first_category = @bulletin_categorys.first
end
preload_object_auth = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check')
@users_array = preload_object_auth.first.privilege_users rescue []
respond_to do |format|
format.html
format.js
end
end
def update_setting
end
# def index
# get_categorys(params[:bulletin_category_id])
#
# @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
# @bulletin_categories = BulletinCategory.all
#
# module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
# @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
#
# respond_to do |format|
# format.html # index.html.erb
# format.js
# format.xml { render :xml => @bulletins }
# end
# end
#
# def new
#
# end
#
# def create
#
# end
#
# def update
#
# end
#
# def edit
#
# end
#
# def destroy
#
# end
protected
def get_categorys(id = nil)
@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
end
end

View File

@ -1,4 +1,4 @@
class Panel::Announcement::FrontEnd::BulletinsController < ObitWidgetController
class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
def initialize
super
@ -11,13 +11,15 @@ class Panel::Announcement::FrontEnd::BulletinsController < ObitWidgetController
def index
date_now = Time.now
if params[:bulletin_category_id]
@bulletins = Bulletin.where(:bulletin_category_id => params[:bulletin_category_id]).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)
if params[:category_id]
@bulletins = Bulletin.where(:bulletin_category_id => params[:category_id]).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)
else
@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
get_categorys
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
end
def show

View File

@ -1,4 +1,4 @@
class Panel::Announcement::Widget::BulletinsController < ObitWidgetController
class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
def initialize
super
@ -28,6 +28,7 @@ class Panel::Announcement::Widget::BulletinsController < ObitWidgetController
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(5) rescue nil
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
render :layout => 'module_widget'
end
def reload_bulletins

View File

@ -19,6 +19,9 @@ class Bulletin
field :is_top, :type => Boolean, :default => false
field :is_hot, :type => Boolean, :default => false
field :is_hidden, :type => Boolean, :default => false
field :is_checked, :type => Boolean, :default => false
field :not_checked_reason
field :public, :type => Boolean, :default => true

View File

@ -3,6 +3,10 @@
class BulletinCategory
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCoreLib::ObjectAuthable
ObjectAuthTitlesOptions = %W{submit_new fact_check}
AfterObjectAuthUrl = '/panel/announcement/back_end/bulletin_categorys'
# include Mongoid::MultiParameterAttributes
PAYMENT_TYPES = [ "List", "Picture" ]
@ -14,4 +18,8 @@ class BulletinCategory
has_many :bulletins
def self.from_id(id)
BulletinCategory.find(id) rescue nil
end
end

View File

@ -1,35 +0,0 @@
<% # encoding: utf-8 %>
<div class="field">
<%= f.label :key %><br />
<%= f.text_field :key %>
</div>
<div class="field">
<%= f.label :name %><br />
<%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= f.text_field locale, :style => "width:130px" %>
<% end %>
<% end %>
</div>
<div class="field">
<%= f.label :display %> <br />
<%#= f.select :display, BulletinCategory::PAYMENT_TYPES, :prompt => 'Select a display method' %>
<%= f.radio_button :display, "List" %>List
<%#= f.label :display, 'list', :value => '1', :checked => @a %>
<%= f.radio_button :display, "Picture" %>Picture
<%#= f.label :display, 'picture', :value => '2', :checked => @b %>
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
</div>
<div class="actions">
<%= f.submit %>
</div>

View File

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

View File

@ -24,11 +24,12 @@
</ul>
</li>
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
<li><%= link_to t('bulletin.fact_check'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %>
</ul>
</div>
</td>
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] %></td>
<td><%= link_to bulletin.title[I18n.locale], panel_announcement_back_end_bulletin_path(bulletin) %></td>
<td><%= link_to bulletin.title[I18n.locale], panel_announcement_back_end_bulletin_path(bulletin) rescue ''%></td>
<td><%= bulletin.postdate %></td>
<td><%= (bulletin.deadline) ? bulletin.deadline : t('bulletin.no_deadline') %></td>
<td>
@ -36,7 +37,7 @@
<span class="label label-tags"><%= tag[I18n.locale] %></span>
<% end %>
</td>
<td><%= User.from_id(bulletin.update_user_id).name %></td>
<td><%= User.from_id(bulletin.update_user_id).name rescue ''%></td>
</tr>
<%= render :partial => 'quick_edit', :locals => {:bulletin => bulletin} %>

View File

@ -1,6 +1,25 @@
<% # encoding: utf-8 %>
<%= f.error_messages %>
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<div class="field">
<%= label :fact_check_stat, t('announcement.bulletin.fact_check_stat') %>
<%= f.radio_button :is_checked, true%>
<%= label :is_checked_true, t('announcement.bulletin.fact_check_pass') %>
<%= f.radio_button :is_checked, false, (@bulletin.is_checked.nil?? {:checked => true} : {}) %>
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass') %>
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass_reason') %>
<%= f.text_field :not_checked_reason %>
</div>
<div class="field">
<%= f.label :image, t('announcement.image') %><br />
<%= f.file_field :image %>
<% if @bulletin.image.file %>
<%= check_box_tag 'bulletin[image_del]' %>
<%= t('announcement.刪除已上傳檔案') %>
<% end %>
</div>
<!--Widget start-->
@ -194,49 +213,6 @@
</div>
<div class="main-wiget">
<div id="widget-link" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="Add a reference link" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-link icons-white"></i>Link</h3>
<div class="widget-content">
<table class="table table-condensed">
<thead>
<tr>
<th>Chinese</th>
<th>English</th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<a class="btn btn-primary btn-small" href="#modal-link" data-toggle="modal"><i class="icon-plus icon-white"></i> ADD/新增</a>
</td>
</tr>
</tfoot>
<tbody>
<%#= render :partial => 'bulletin_link2', :collection => @bulletin.bulletin_links %>
<% @bulletin.bulletin_links.each_with_index do |bulletin_link2, i| %>
<%= f.fields_for :bulletin_links, bulletin_link2 do |f| %>
<%= render :partial => 'bulletin_link2', :object => bulletin_link2, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
<div id="bulletin_link_qe"><%#= render :partial => "bulletin_link_qe" %></div>
</div>
</div>
<div class="main-wiget">
<div id="widget-file" class="widget-box">
<div class="widget-action clear">

View File

@ -3,11 +3,11 @@
<td colspan="8">
<legend><%= t(:quick_edit) %> - <span class='qe_title'></span>Basic / Picture / Tags / Link / File</legend>
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_path(bulletin), :html => {:class => 'form-horizontal'} do |f| %>
<%= render :partial => "quick_edit_basic", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_picture", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_tags", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_links", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_files", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_basic", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_picture", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_tags", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_links", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_files", :locals => { :f => f, :bulletin => bulletin } %>
<div class="form-actions">
<%= f.submit t(:submit), :class => 'btn btn-primary' %>
<%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %>

View File

@ -2,7 +2,6 @@
<table id="bulettin_sort_list" class="table main-list">
<%= render 'bulletins' %>
</table>
<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>

View File

@ -1,4 +1,3 @@
<%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% 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 />
<p id="notice"><%= flash_messages %></p>
<br />
<br />
<ul>
<li>

View File

@ -2,7 +2,11 @@
<%= 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">
@ -25,5 +29,5 @@
</table>
<%= paginate @bulletins %>
<%= paginate @bulletins, :params => {:inner => 'false'} %>

View File

@ -1,6 +1,6 @@
<% @web_links.each do |web_link| %>
<li>
<a><%= web_link.name[I18n.locale] %></a>
<%= link_to web_link.name[I18n.locale], web_link.url %>
</li>
<% end %>

View File

@ -35,6 +35,12 @@ en:
list_lower: " list"
title: Title
postdate: Postdate
fact_check: Fact Check
fact_check_setting: Fact Check Setting
fact_check_stat: Fact Check Status
fact_check_not_pass: 'Not Pass'
fact_check_not_pass_reason: 'Reason'
fact_check_pass: 'Pass'
# admin:
# action: Action
# add_language: Add language

View File

@ -30,6 +30,13 @@ zh_tw:
list_lower: 列表
title: 標題
postdate: 張貼日期
fact_check: 公告審核
fact_check_setting: 審核設定
fact_check_stat: 審核狀況
fact_check_not_pass: '不通過'
fact_check_pass: '通過'
fact_check_not_pass_reason: '不通過原因'
# admin:
# action: 行動
# add_language: 新增語言

View File

@ -2,6 +2,10 @@ Rails.application.routes.draw do
namespace :panel do
namespace :announcement do
namespace :back_end do
match 'public' => "announcements#public",:as => :public
match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting
match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting
root :to => "bulletins#index"
resources :bulletins do
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
@ -10,11 +14,9 @@ Rails.application.routes.draw do
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
end
resources :bulletin_links
resources :tags
end
namespace :front_end do
root :to => "bulletins#index"
resources :bulletins
end
namespace :widget 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
@post = Post.find(params[:post_id])
@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.xml
def index

View File

@ -1,4 +1,4 @@
class Panel::NewBlog::Widget::PostsController < ObitWidgetController
class Panel::NewBlog::Widget::PostsController < OrbitWidgetController
# GET /posts
# GET /posts.xml
def index

View File

@ -3,7 +3,7 @@
# # Add a load path for this specific Engine
# # config.autoload_paths << File.expand_path("../lib/some/path", __FILE__)
# put "ABC"
# PrototypeR4::Application::Orbit_Apps << "NewBlog"
# Orbit::Application::Orbit_Apps << "NewBlog"
#
# # initializer "my_engine.add_middleware" do |app|
# # app.middleware.use MyEngine::Middleware
@ -15,4 +15,4 @@ module NewBlog
VERSION = "0.0.1"
MOUDLEAPP_TITLE = "NewBlog"
end
# PrototypeR4::Application::Orbit_Apps << "NewBlog"
# Orbit::Application::Orbit_Apps << "NewBlog"

View File

@ -1,4 +1,4 @@
class Panel::PageContent::FrontEnd::PageContextsController < ObitWidgetController
class Panel::PageContent::FrontEnd::PageContextsController < OrbitWidgetController
def initialize
super

View File

@ -1,4 +1,4 @@
class Panel::WebResource::FrontEnd::WebLinksController < ObitWidgetController
class Panel::WebResource::FrontEnd::WebLinksController < OrbitWidgetController
def initialize
super

View File

@ -1,4 +1,4 @@
class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController
def initialize
super
@ -14,7 +14,7 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
# @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
@ -24,7 +24,7 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
end
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