From 17caa7cb1ba400cb1ca6c9eea59afe68d0198bc5 Mon Sep 17 00:00:00 2001 From: Matthew Kaito Juyuan Fu Date: Mon, 13 Feb 2012 17:33:48 +0800 Subject: [PATCH 01/24] Exp with object_auth --- app/controllers/admin/app_auths_controller.rb | 4 +- .../admin/module_apps_controller.rb | 4 ++ .../admin/object_auths_controller.rb | 1 + app/models/prototype_auth.rb | 6 +-- .../admin/attributes/_app_selector.html.erb | 1 + app/views/admin/module_apps/show.html.erb | 37 ++++++++++++++ app/views/admin/object_auths/new.html.erb | 3 +- .../back_end/bulletins_controller.rb | 2 +- .../back_end/fact_checks_controller.rb | 29 +++++++++++ .../announcement/app/models/bulletin.rb | 1 + .../app/models/bulletin_category.rb | 4 ++ .../_bulletin_category.html.erb | 6 +++ .../back_end/bulletins/_bulletins.html.erb | 15 +++++- .../back_end/bulletins/index.html.erb | 2 + .../back_end/fact_checks/_list_table.html.erb | 15 ++++++ .../back_end/fact_checks/index.html.erb | 51 +++++++++++++++++++ .../announcement/config/routes.rb | 1 + 17 files changed, 174 insertions(+), 8 deletions(-) create mode 100644 app/views/admin/attributes/_app_selector.html.erb create mode 100644 app/views/admin/module_apps/show.html.erb create mode 100644 vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb diff --git a/app/controllers/admin/app_auths_controller.rb b/app/controllers/admin/app_auths_controller.rb index cb3340fd..56d0ae23 100644 --- a/app/controllers/admin/app_auths_controller.rb +++ b/app/controllers/admin/app_auths_controller.rb @@ -66,6 +66,8 @@ class Admin::AppAuthsController < ApplicationController @module_app = ModuleApp.find(params[:id]) end - + def show + @module_app = ModuleApp.find(params[:id]) + end end \ No newline at end of file diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb index 56c2523f..a350c28b 100644 --- a/app/controllers/admin/module_apps_controller.rb +++ b/app/controllers/admin/module_apps_controller.rb @@ -20,6 +20,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]) diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index ce404e53..3bff4374 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -14,6 +14,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 } diff --git a/app/models/prototype_auth.rb b/app/models/prototype_auth.rb index 734268c4..893f402b 100644 --- a/app/models/prototype_auth.rb +++ b/app/models/prototype_auth.rb @@ -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,8 +83,8 @@ 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 diff --git a/app/views/admin/attributes/_app_selector.html.erb b/app/views/admin/attributes/_app_selector.html.erb new file mode 100644 index 00000000..c20a3885 --- /dev/null +++ b/app/views/admin/attributes/_app_selector.html.erb @@ -0,0 +1 @@ +<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %> diff --git a/app/views/admin/module_apps/show.html.erb b/app/views/admin/module_apps/show.html.erb new file mode 100644 index 00000000..27cfbc1a --- /dev/null +++ b/app/views/admin/module_apps/show.html.erb @@ -0,0 +1,37 @@ +



+<%=@module_app.key %>
+<%=@module_app.title %>
+<%=@module_app.version %>
+<%=@module_app.organization %>
+<%=@module_app.author %>
+<%=@module_app.intro %>
+<%=@module_app.update_info %>
+<%=@module_app.create_date %>
+<%=@module_app.enable_frontend%>
+<%=@module_app.app_pages%>
+<%=@module_app.widgets%>
+ +Mangers: + + + +SubManagers: +
+ <% @module_app.sub_managers.each do |manager|%> + <%= manager.user.name %> + <%end%> +
+
+ +All User?:<%= @module_app.app_auth.all %>
+Blocked Users:<%= @module_app.app_auth.blocked_users.collect{|t| t.name} %>
+Privilege Users:<%= @module_app.app_auth.privilege_users.collect{|t| t.name}%>
+User Roles:<%= @module_app.app_auth.roles.collect{|t| t.key} %>
+User Sub Roles:<%= @module_app.app_auth.sub_roles.collect{|t| t.key} %>
+ +Available users after calculation: +<%= @module_app.app_auth.auth_users.collect{|user| user.name}.join(',') %> diff --git a/app/views/admin/object_auths/new.html.erb b/app/views/admin/object_auths/new.html.erb index 25fd6fd5..b5b381fb 100644 --- a/app/views/admin/object_auths/new.html.erb +++ b/app/views/admin/object_auths/new.html.erb @@ -12,7 +12,8 @@

<%= t('object_auth.new_object_auth') %>

<%= 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] %> diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index c28e7e54..02135d66 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -99,7 +99,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' } diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb new file mode 100644 index 00000000..ef7e1943 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb @@ -0,0 +1,29 @@ +class Panel::Announcement::BackEnd::FactChecksController < ApplicationController + layout 'admin' + + def index + @bulletin_categorys_preview = BulletinCategory.authed_for_user(current_user,'preview') + @bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'check') + end + + def new + + end + + def create + + end + + def update + + end + + def edit + + end + + def destroy + + end + +end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 4b621faf..6246f50c 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -7,6 +7,7 @@ class Bulletin # field :category_id, :type => Integer field :title + field :status , :type=> Boolean # has_one :title_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy # has_one :subtitle_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy # has_one :text_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb index f5da3ad7..152a6b57 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb @@ -3,6 +3,10 @@ class BulletinCategory include Mongoid::Document include Mongoid::Timestamps + include OrbitCoreLib::ObjectAuthable + + ObjectAuthTitlesOptions = %W{preview fact_check} + # include Mongoid::MultiParameterAttributes PAYMENT_TYPES = [ "List", "Picture" ] diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb index 57998770..2e0e7ddf 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb @@ -6,6 +6,12 @@ <% end %> <%= bulletin_category.display %> + <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category) %>
+ <% bulletin_category.object_auths.each do |obj_auth| %> + <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth) %>
+ <% end %> + + <%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> | <%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> | <%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb index f94cac5b..e7f17709 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb @@ -1,12 +1,23 @@ - + <% if (fact_check_allow rescue false) %> + <%#= link_to("#{post?? 'Check': 'Checked'}",panel_announcement_back_end_bulletin_path ) %> + <% attribute_type = "post" %> + <% attribute = post %> + <%= link_to t(:ClickToCheck), panel_announcement_back_end_bulletin_path(attribute, :authenticity_token => form_authenticity_token, :bulletin => {:status => true}), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.status ? 'none' : ''}", :class => 'switch' %> + <%= link_to t(:ClickToUnCheck), panel_announcement_back_end_bulletin_path(attribute, :authenticity_token => form_authenticity_token, :bulletin => {:status => false}), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.status ? '' : 'none'}", :class => 'switch' %> + + <% end %> + + <%= post.bulletin_category.i18n_variable[I18n.locale] %> <%#= link_to post.title, panel_announcement_front_end_bulletin_path(post) %> <%= link_to post.title, panel_announcement_back_end_bulletin_path(post) %> <%= post.postdate %> - <%= (post.deadline) ? post.deadline : t('bulletin.no_deadline') %> + + <%= (post.deadline) ? post.deadline : t('bulletin.no_deadline') %> + <%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(post) %> | diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index 3de0b1c2..59f126a0 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -8,6 +8,8 @@
  • <%= link_to t('bulletin.new_announcement'), new_panel_announcement_back_end_bulletin_path %>
  • <%= link_to t('bulletin.announcement_list'), panel_announcement_back_end_bulletins_path %>
  • <%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path %>
  • +
  • <%= link_to t('bulletin.my_announcement_fact_check'), panel_announcement_back_end_fact_checks_path %>
  • + <% end -%> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb new file mode 100644 index 00000000..59bac03a --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb @@ -0,0 +1,15 @@ +

    <%= bulletin_category.key %>

    + + + + + + + + + + +<% bulletin_category.bulletins.each do |post| %> + <%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:fact_check_allow=>true} %> +<% end %> +
    <%= t('bulletin.status') %><%= t('bulletin.category') %><%= t('bulletin.title') %><%= t('bulletin.postdate') %><%= t('bulletin.deadline') %><%= t('bulletin.action') %>
    \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb new file mode 100644 index 00000000..65ebeb28 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb @@ -0,0 +1,51 @@ +<% content_for :secondary do %> +
    +
    +
    +
    +
    + +<% end -%> + +<%= flash_messages %> + +
    +
    +
    +
    +
    + +
    <%= t('bulletin.search') %> + + <%= 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 %> + + +
    + +
    +
    + +

    <%= t('bulletin.list_announcement') %>

    + + <%= render :partial => "list_table", :collection => @bulletin_categorys_preview,:as => :bulletin_category%> + + <%= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%> + +
    + diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index 05554bab..88bc3ae2 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -3,6 +3,7 @@ Rails.application.routes.draw do namespace :panel do namespace :announcement do namespace :back_end do + resources :fact_checks root :to => "bulletins#index" resources :bulletins resources :bulletin_categorys, :controller => 'bulletin_categorys' do From 5640e07733834099d76c5a89def137f8ea2de451 Mon Sep 17 00:00:00 2001 From: Matthew Kaito Juyuan Fu Date: Wed, 15 Feb 2012 18:20:44 +0800 Subject: [PATCH 02/24] First version for App and Object auth.Taking Announcement as experiment --- .../admin/object_auths_controller.rb | 12 ++++++++-- app/controllers/obit_frontend_controller.rb | 3 --- app/controllers/obit_widget_controller.rb | 3 --- app/controllers/orbit_backend_controller.rb | 24 +++++++++++++++++++ ...=> orbit_frontend_component_controller.rb} | 2 +- app/controllers/orbit_frontend_controller.rb | 3 +++ app/controllers/orbit_widget_controller.rb | 3 +++ app/helpers/admin/app_auth_helper.rb | 5 ++++ app/helpers/admin_helper.rb | 13 ++++++++++ app/models/app_auth.rb | 1 + app/models/module_app.rb | 8 +++++++ app/models/prototype_auth.rb | 2 +- .../admin/module_apps/_app_selector.html.erb | 1 - app/views/admin/object_auths/edit.html.erb | 2 +- config/routes.rb | 2 +- lib/orbit_core_lib.rb | 22 +++++++++++++++++ lib/tasks/anc_tasks.rake | 22 +++++++++++++++++ lib/tasks/dev.rake | 6 +++++ .../announcement/announcement.json | 2 +- .../back_end/announcements_controller.rb | 13 ++++++---- .../back_end/bulletin_categorys_controller.rb | 6 ++--- .../back_end/bulletins_controller.rb | 9 +++---- .../back_end/fact_checks_controller.rb | 5 ++-- .../app/models/bulletin_category.rb | 2 +- .../_bulletin_category.html.erb | 16 +++++++------ .../back_end/bulletins/index.html.erb | 5 ++-- .../back_end/fact_checks/index.html.erb | 10 +++++--- .../announcement/config/routes.rb | 3 ++- .../lib/tasks/announcement_tasks.rake | 4 ---- .../new_blog/front_end/comments_controller.rb | 2 +- .../new_blog/front_end/posts_controller.rb | 2 +- 31 files changed, 161 insertions(+), 52 deletions(-) delete mode 100644 app/controllers/obit_frontend_controller.rb delete mode 100644 app/controllers/obit_widget_controller.rb create mode 100644 app/controllers/orbit_backend_controller.rb rename app/controllers/{obit_frontend_component_controller.rb => orbit_frontend_component_controller.rb} (73%) create mode 100644 app/controllers/orbit_frontend_controller.rb create mode 100644 app/controllers/orbit_widget_controller.rb delete mode 100644 app/views/admin/module_apps/_app_selector.html.erb create mode 100644 lib/tasks/anc_tasks.rake delete mode 100644 vendor/built_in_modules/announcement/lib/tasks/announcement_tasks.rake diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index 3bff4374..573409b6 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -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 @@ -70,7 +74,11 @@ class Admin::ObjectAuthsController < ApplicationController def edit @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 \ No newline at end of file diff --git a/app/controllers/obit_frontend_controller.rb b/app/controllers/obit_frontend_controller.rb deleted file mode 100644 index fb42ac78..00000000 --- a/app/controllers/obit_frontend_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ObitFrontendController< ObitFrontendComponentController - -end \ No newline at end of file diff --git a/app/controllers/obit_widget_controller.rb b/app/controllers/obit_widget_controller.rb deleted file mode 100644 index e0a9746d..00000000 --- a/app/controllers/obit_widget_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ObitWidgetController< ObitFrontendComponentController - -end \ No newline at end of file diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb new file mode 100644 index 00000000..49505c8f --- /dev/null +++ b/app/controllers/orbit_backend_controller.rb @@ -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 + + 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 \ No newline at end of file diff --git a/app/controllers/obit_frontend_component_controller.rb b/app/controllers/orbit_frontend_component_controller.rb similarity index 73% rename from app/controllers/obit_frontend_component_controller.rb rename to app/controllers/orbit_frontend_component_controller.rb index 06bb06a5..0650c16f 100644 --- a/app/controllers/obit_frontend_component_controller.rb +++ b/app/controllers/orbit_frontend_component_controller.rb @@ -1,4 +1,4 @@ -class ObitFrontendComponentController< ApplicationController +class OrbitFrontendComponentController< ApplicationController before_filter :setup_vars before_filter {|c| c.front_end_available(@app_title)} layout 'production' diff --git a/app/controllers/orbit_frontend_controller.rb b/app/controllers/orbit_frontend_controller.rb new file mode 100644 index 00000000..e1be8167 --- /dev/null +++ b/app/controllers/orbit_frontend_controller.rb @@ -0,0 +1,3 @@ +class OrbitFrontendController< OrbitFrontendComponentController + +end \ No newline at end of file diff --git a/app/controllers/orbit_widget_controller.rb b/app/controllers/orbit_widget_controller.rb new file mode 100644 index 00000000..c2be4691 --- /dev/null +++ b/app/controllers/orbit_widget_controller.rb @@ -0,0 +1,3 @@ +class ObitWidgetController< OrbitFrontendComponentController + +end \ No newline at end of file diff --git a/app/helpers/admin/app_auth_helper.rb b/app/helpers/admin/app_auth_helper.rb index fe63a2a6..1a022e94 100644 --- a/app/helpers/admin/app_auth_helper.rb +++ b/app/helpers/admin/app_auth_helper.rb @@ -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 \ No newline at end of file diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 6ae3a213..021687da 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -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 \ No newline at end of file diff --git a/app/models/app_auth.rb b/app/models/app_auth.rb index 5a3de60c..94af40bb 100644 --- a/app/models/app_auth.rb +++ b/app/models/app_auth.rb @@ -2,4 +2,5 @@ class AppAuth < PrototypeAuth belongs_to :module_app + end \ No newline at end of file diff --git a/app/models/module_app.rb b/app/models/module_app.rb index d98ea206..6a678460 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -22,6 +22,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 diff --git a/app/models/prototype_auth.rb b/app/models/prototype_auth.rb index 893f402b..6b22a1b3 100644 --- a/app/models/prototype_auth.rb +++ b/app/models/prototype_auth.rb @@ -16,7 +16,7 @@ class PrototypeAuth 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) diff --git a/app/views/admin/module_apps/_app_selector.html.erb b/app/views/admin/module_apps/_app_selector.html.erb deleted file mode 100644 index c20a3885..00000000 --- a/app/views/admin/module_apps/_app_selector.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %> diff --git a/app/views/admin/object_auths/edit.html.erb b/app/views/admin/object_auths/edit.html.erb index 67fb026e..fc824a64 100644 --- a/app/views/admin/object_auths/edit.html.erb +++ b/app/views/admin/object_auths/edit.html.erb @@ -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") %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 9b653d7f..0d01eccb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,7 +14,7 @@ PrototypeR4::Application.routes.draw do resources :app_auths resources :object_auths do collection do - match 'new/:type/:obj_id',:action => 'new',:via => "get",:as => :init + match 'new/:type/:obj_id/:module_app_id',:action => 'new',:via => "get",:as => :init end member do match ':id/create_role',:action => 'create_role',:via => "post",:as => :create_role diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb index bf1d66a3..2520e04c 100644 --- a/lib/orbit_core_lib.rb +++ b/lib/orbit_core_lib.rb @@ -31,4 +31,26 @@ module OrbitCoreLib end end + + module PermissionUnility + private + def check_permission(type = :use) + permission_grant = current_user.admin?? true : false + module_app = @module_app.nil?? ModuleApp.find(params[:module_app_id]) : @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 + + end end diff --git a/lib/tasks/anc_tasks.rake b/lib/tasks/anc_tasks.rake new file mode 100644 index 00000000..3145d119 --- /dev/null +++ b/lib/tasks/anc_tasks.rake @@ -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 \ No newline at end of file diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index e6eabe1b..f1d1d78e 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -125,6 +125,12 @@ namespace :dev do AttributeValue.create( :user_id => user.id, :attribute_field_id => i_1.attribute_fields[1].id, :key => 'last_name', :en => 'Fu', :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 => '計算機科學' ) + + 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) diff --git a/vendor/built_in_modules/announcement/announcement.json b/vendor/built_in_modules/announcement/announcement.json index 9ad6951e..13e7e62c 100644 --- a/vendor/built_in_modules/announcement/announcement.json +++ b/vendor/built_in_modules/announcement/announcement.json @@ -1,5 +1,5 @@ { - "title": "Announcement", + "title": "announcement", "version": "0.1", "organization": "Rulingcom", "author": "RD dep", diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/announcements_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/announcements_controller.rb index 8f88da9a..8faf23f6 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/announcements_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/announcements_controller.rb @@ -1,11 +1,12 @@ -class Panel::Announcement::BackEnd::AnnouncementsController < ApplicationController - - layout 'admin' - - def index +class Panel::Announcement::BackEnd::AnnouncementsController < OrbitBackendController + def public + render :text => "This is an public_page need to be build" end + def index + + end # GET /announcements/1 # GET /announcements/1.xml def show @@ -76,4 +77,6 @@ class Panel::Announcement::BackEnd::AnnouncementsController < ApplicationControl format.xml { head :ok } end end + + end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb index 3bb7d54b..a9d26eb9 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb @@ -1,7 +1,5 @@ -class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationController - - layout 'admin' - +class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController + def index @bulletin_categorys = BulletinCategory.all @bulletin_category = BulletinCategory.new(:display => 'List') diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index 02135d66..2731ee39 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -1,9 +1,6 @@ -class Panel::Announcement::BackEnd::BulletinsController < ApplicationController - - layout 'admin' - - before_filter :authenticate_user! - before_filter :is_admin? +class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController + + #before_filter :is_admin? def index # @bulletins = Bulletin.all diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb index ef7e1943..1ef3b300 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb @@ -1,9 +1,10 @@ -class Panel::Announcement::BackEnd::FactChecksController < ApplicationController +class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController + before_filter :authenticate_user! layout 'admin' def index @bulletin_categorys_preview = BulletinCategory.authed_for_user(current_user,'preview') - @bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'check') + @bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'fact_check') end def new diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb index 152a6b57..1a086ebf 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb @@ -6,7 +6,7 @@ class BulletinCategory include OrbitCoreLib::ObjectAuthable ObjectAuthTitlesOptions = %W{preview fact_check} - + AfterObjectAuthUrl = '/panel/announcement/back_end/bulletin_categorys' # include Mongoid::MultiParameterAttributes PAYMENT_TYPES = [ "List", "Picture" ] diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb index 2e0e7ddf..2cd097ed 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb @@ -5,13 +5,15 @@ <%= bulletin_category.i18n_variable[locale] rescue nil %> <% end %> <%= bulletin_category.display %> - - <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category) %>
    - <% bulletin_category.object_auths.each do |obj_auth| %> - <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth) %>
    - <% end %> - - + <% if is_manager? %> + + <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,@module_app) %>
    + <% bulletin_category.object_auths.each do |obj_auth| %> + <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth) %>
    + <% end %> + + + <% end %> <%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> | <%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> | <%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index 59f126a0..72891095 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -7,9 +7,8 @@ <% end -%> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb index 65ebeb28..0f42ed4b 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb @@ -42,10 +42,14 @@

    <%= t('bulletin.list_announcement') %>

    - +
    +

    Preview

    <%= render :partial => "list_table", :collection => @bulletin_categorys_preview,:as => :bulletin_category%> - +
    +=================================================================================================================== +
    +

    Check Please

    <%= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%> - +

    diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index 88bc3ae2..f0fd89d6 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -3,6 +3,7 @@ Rails.application.routes.draw do namespace :panel do namespace :announcement do namespace :back_end do + match 'public' => "announcements#public",:as => :public resources :fact_checks root :to => "bulletins#index" resources :bulletins @@ -14,7 +15,7 @@ Rails.application.routes.draw do root :to => "bulletins#index" resources :bulletins end - namespace :widget do + namespace :widget do root :to => "bulletins#index" end end diff --git a/vendor/built_in_modules/announcement/lib/tasks/announcement_tasks.rake b/vendor/built_in_modules/announcement/lib/tasks/announcement_tasks.rake deleted file mode 100644 index f097b1fa..00000000 --- a/vendor/built_in_modules/announcement/lib/tasks/announcement_tasks.rake +++ /dev/null @@ -1,4 +0,0 @@ -# desc "Explaining what the task does" -# task :announcement do -# # Task goes here -# end diff --git a/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/comments_controller.rb b/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/comments_controller.rb index 769f4665..9bb61778 100644 --- a/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/comments_controller.rb +++ b/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/comments_controller.rb @@ -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]) diff --git a/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/posts_controller.rb b/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/posts_controller.rb index 1aeb34b2..48b0c1c5 100644 --- a/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/posts_controller.rb +++ b/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/posts_controller.rb @@ -1,4 +1,4 @@ -class Panel::NewBlog::FrontEnd::PostsController < ObitFrontendController +class Panel::NewBlog::FrontEnd::PostsController < OrbitFrontendController # GET /posts # GET /posts.xml def index From d2689bc59c05a464626543fd8183a65e997337c2 Mon Sep 17 00:00:00 2001 From: Matthew Kaito Juyuan Fu Date: Thu, 16 Feb 2012 13:57:28 +0800 Subject: [PATCH 03/24] fix bugs with token --- app/controllers/orbit_backend_controller.rb | 1 - app/models/module_app.rb | 4 ++- app/models/object_auth.rb | 2 +- app/models/prototype_auth.rb | 5 ++-- .../components/_user_role_management.html.erb | 3 +- config/environments/development.rb | 30 +++++++++---------- config/routes.rb | 2 +- lib/orbit_core_lib.rb | 22 ++++++++++++-- .../_bulletin_category.html.erb | 4 +-- 9 files changed, 46 insertions(+), 27 deletions(-) diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index 49505c8f..d3639ebe 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -10,7 +10,6 @@ class OrbitBackendController< ApplicationController def setup_vars @app_title = request.fullpath.split('/')[2] @module_app = ModuleApp.first(conditions: {:key => @app_title} ) - end private diff --git a/app/models/module_app.rb b/app/models/module_app.rb index 6a678460..b1b1237c 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -1,6 +1,7 @@ class ModuleApp include Mongoid::Document include Mongoid::Timestamps + include OrbitCoreLib::ObjectTokenUnility field :key field :title @@ -14,7 +15,7 @@ class ModuleApp field :app_pages ,type: Array field :widgets ,type: Array - + has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app @@ -77,5 +78,6 @@ class ModuleApp def set_key self.key = self.title.underscore if self.title end + end diff --git a/app/models/object_auth.rb b/app/models/object_auth.rb index dab7acc7..f67f9984 100644 --- a/app/models/object_auth.rb +++ b/app/models/object_auth.rb @@ -1,5 +1,5 @@ class ObjectAuth < PrototypeAuth - + include OrbitCoreLib::ObjectTokenUnility belongs_to :obj_authable, polymorphic: true # > - Something.find_with_auth(query) # > - or Something.find(query).auth diff --git a/app/models/prototype_auth.rb b/app/models/prototype_auth.rb index 6b22a1b3..666bc7a8 100644 --- a/app/models/prototype_auth.rb +++ b/app/models/prototype_auth.rb @@ -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,12 +11,13 @@ 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 + + def add_role role add_operation(:roles,role) end @@ -87,7 +87,6 @@ class PrototypeAuth auth_users_before_block_list - self.blocked_users end - # protected end \ No newline at end of file diff --git a/app/views/admin/components/_user_role_management.html.erb b/app/views/admin/components/_user_role_management.html.erb index 59307351..ed7c3476 100644 --- a/app/views/admin/components/_user_role_management.html.erb +++ b/app/views/admin/components/_user_role_management.html.erb @@ -1,5 +1,7 @@

    User Role

    + All User + <%= form_tag(submit_url) do %> <%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %> <%= submit_tag 'Add Role' %>
    @@ -10,7 +12,6 @@ <%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %> <%= submit_tag 'Add BlockedList' %>
    <% end %> -
      Roles
    <% unless auth.nil? %> <% auth.roles.each do |role| %>
  • <%= role.key %> Build in:<%= role.built_in ? 'Yes' : 'No' %> diff --git a/config/environments/development.rb b/config/environments/development.rb index d1b671e5..549fc11e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -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" }, - :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.middleware.use ExceptionNotifier, + # :email_prefix => "[R4_error]", + # :sender_address => %{"notifier" }, + # :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" } end diff --git a/config/routes.rb b/config/routes.rb index 0d01eccb..9b653d7f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,7 +14,7 @@ PrototypeR4::Application.routes.draw do resources :app_auths resources :object_auths do collection do - match 'new/:type/:obj_id/:module_app_id',:action => 'new',:via => "get",:as => :init + match 'new/:type/:obj_id',:action => 'new',:via => "get",:as => :init end member do match ':id/create_role',:action => 'create_role',:via => "post",:as => :create_role diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb index 2520e04c..561fceba 100644 --- a/lib/orbit_core_lib.rb +++ b/lib/orbit_core_lib.rb @@ -31,12 +31,28 @@ 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?? ModuleApp.find(params[:module_app_id]) : @module_app + module_app = @module_app.nil?? find_module_app_by_token(params[:token]) : @module_app unless permission_grant permission_grant = case type when :use @@ -51,6 +67,8 @@ module OrbitCoreLib end permission_grant end - + def find_module_app_by_token(token) + ModuleApp.first(conditions: {s_token: token}) + end end end diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb index 2cd097ed..e834ec60 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb @@ -7,9 +7,9 @@ <%= bulletin_category.display %> <% if is_manager? %> - <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,@module_app) %>
    + <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,:token => @module_app.token) %>
    <% bulletin_category.object_auths.each do |obj_auth| %> - <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth) %>
    + <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth,:token => @module_app.token) %>
    <% end %> From 9305c2045cd28f69330a31d207a0e61f8db8053b Mon Sep 17 00:00:00 2001 From: Matthew Kaito Juyuan Fu Date: Thu, 16 Feb 2012 14:59:26 +0800 Subject: [PATCH 04/24] add "all_user" for app&object auth --- app/controllers/admin/app_auths_controller.rb | 5 ++++- app/controllers/admin/object_auths_controller.rb | 5 ++++- .../admin/components/_user_role_management.html.erb | 9 +++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/app_auths_controller.rb b/app/controllers/admin/app_auths_controller.rb index 56d0ae23..9e980e53 100644 --- a/app/controllers/admin/app_auths_controller.rb +++ b/app/controllers/admin/app_auths_controller.rb @@ -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!='' diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index 573409b6..a7a8dc41 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -33,7 +33,10 @@ class Admin::ObjectAuthsController < ApplicationController 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!='' diff --git a/app/views/admin/components/_user_role_management.html.erb b/app/views/admin/components/_user_role_management.html.erb index ed7c3476..99cd72d7 100644 --- a/app/views/admin/components/_user_role_management.html.erb +++ b/app/views/admin/components/_user_role_management.html.erb @@ -1,7 +1,12 @@ +
    +

    All User

    + <%= form_tag(submit_url) do %> + <%= check_box_tag 'auth_all',true,auth.all %><%= submit_tag 'Add Role' %>
    + <% end %> +
    +

    User Role

    - All User - <%= form_tag(submit_url) do %> <%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %> <%= submit_tag 'Add Role' %>
    From 26cd6951dba43b1f6eaf5056160309c5c77a8716 Mon Sep 17 00:00:00 2001 From: Matt Fu Date: Fri, 17 Feb 2012 17:50:23 +0800 Subject: [PATCH 05/24] change view and action for announcement ,Lin checked. Also add validation for object_auth make sure for each object,the object will be unique for each action. --- .../admin/module_apps_controller.rb | 4 ++-- .../admin/object_auths_controller.rb | 9 ++++++-- app/models/object_auth.rb | 1 + .../components/_user_role_management.html.erb | 2 +- lib/tasks/user.rake | 2 +- .../back_end/announcements_controller.rb | 4 ++-- .../back_end/bulletins_controller.rb | 9 ++++++-- .../back_end/fact_checks_controller.rb | 12 +++++++++-- .../app/models/bulletin_category.rb | 2 +- .../bulletin_categorys/index.html.erb | 21 +++++++------------ .../back_end/bulletin_categorys/new.html.erb | 16 +++++++------- .../back_end/bulletins/edit.html.erb | 15 ++++++++----- .../back_end/bulletins/index.html.erb | 12 +---------- .../back_end/bulletins/new.html.erb | 15 +++++++------ .../back_end/bulletins/show.html.erb | 10 ++++++--- .../back_end/fact_checks/index.html.erb | 19 ++--------------- .../announcement/config/routes.rb | 1 + 17 files changed, 76 insertions(+), 78 deletions(-) diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb index a350c28b..2386a1d1 100644 --- a/app/controllers/admin/module_apps_controller.rb +++ b/app/controllers/admin/module_apps_controller.rb @@ -100,7 +100,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 @@ -112,7 +112,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 \ No newline at end of file diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index a7a8dc41..58219acf 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -27,8 +27,13 @@ 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] - redirect_to edit_admin_object_auth_path(@object_auth) + @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 diff --git a/app/models/object_auth.rb b/app/models/object_auth.rb index f67f9984..8932bb76 100644 --- a/app/models/object_auth.rb +++ b/app/models/object_auth.rb @@ -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 diff --git a/app/views/admin/components/_user_role_management.html.erb b/app/views/admin/components/_user_role_management.html.erb index 99cd72d7..cd9ca8ae 100644 --- a/app/views/admin/components/_user_role_management.html.erb +++ b/app/views/admin/components/_user_role_management.html.erb @@ -1,7 +1,7 @@

    All User

    <%= form_tag(submit_url) do %> - <%= check_box_tag 'auth_all',true,auth.all %><%= submit_tag 'Add Role' %>
    + <%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag 'Add Role' %>
    <% end %>
    diff --git a/lib/tasks/user.rake b/lib/tasks/user.rake index 31ed7c24..5189ee14 100644 --- a/lib/tasks/user.rake +++ b/lib/tasks/user.rake @@ -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{ 一一 二二 三三 四四 五五 六六 七七 } diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/announcements_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/announcements_controller.rb index 8faf23f6..f7f51b4d 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/announcements_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/announcements_controller.rb @@ -4,8 +4,8 @@ class Panel::Announcement::BackEnd::AnnouncementsController < OrbitBackendContro render :text => "This is an public_page need to be build" end - def index - + def list_mine + @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') end # GET /announcements/1 # GET /announcements/1.xml diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index 2731ee39..6880f8e6 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -1,5 +1,5 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController - + include AdminHelper #before_filter :is_admin? def index @@ -136,7 +136,12 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController protected 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 end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb index 1ef3b300..dd471958 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb @@ -1,10 +1,18 @@ class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController before_filter :authenticate_user! + include AdminHelper layout 'admin' def index - @bulletin_categorys_preview = BulletinCategory.authed_for_user(current_user,'preview') - @bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'fact_check') + @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 diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb index 1a086ebf..ee2767f5 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb @@ -5,7 +5,7 @@ class BulletinCategory include Mongoid::Timestamps include OrbitCoreLib::ObjectAuthable - ObjectAuthTitlesOptions = %W{preview fact_check} + ObjectAuthTitlesOptions = %W{submit_new fact_check} AfterObjectAuthUrl = '/panel/announcement/back_end/bulletin_categorys' # include Mongoid::MultiParameterAttributes diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb index 87a2993c..87b30a04 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb @@ -1,22 +1,17 @@ <% content_for :secondary do %> -
    -
    -
    -
    -
    -
      -
    • <%#= link_to t('bulletin_category.new_announcement_class'), new_panel_announcement_back_end_bulletin_category_path, :class => 'seclink1' %>
    • -
    +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> <% end -%> <%= flash_messages %> +
    +
    +
    +
    +
    +

    <%= t('bulletin_category.list_announcement_class') %>

    -
    -
    -
    -
    -
    + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.html.erb index 5f8d064b..296afb09 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.html.erb @@ -1,15 +1,15 @@ -
    -
    -
    -
    - <% content_for :secondary do %> -
      -
    • <%= link_to t('bulletin_category.index'), panel_announcement_back_end_bulletin_categorys_path, :class => 'seclink2' %>
    • -
    +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> <% end -%> <%= flash_messages %> + +
    +
    +
    +
    +
    +

    <%= t('bulletin_category.new_announcement_class') %>

    <%= form_for @bulletin_category, :url => panel_announcement_back_end_bulletin_categorys_path do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb index 1bdd8063..9350d0fb 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb @@ -1,9 +1,14 @@ -
    -
    -
    -
    +<% content_for :secondary do %> +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> +<% end -%> -

    <%= t('announcement.editing_announcement') %>

    +<%= flash_messages %> + +
    +
    +
    +
    +
    <%= form_for @bulletin, :url => panel_announcement_back_end_bulletin_path(@bulletin) do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index 72891095..dd88f5c0 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -1,15 +1,5 @@ <% content_for :secondary do %> -
    -
    -
    -
    -
    -
      -
    • <%= link_to t('bulletin.new_announcement'), new_panel_announcement_back_end_bulletin_path %>
    • -
    • <%= link_to t('bulletin.announcement_list'), panel_announcement_back_end_bulletins_path %>
    • -
    • <%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path if is_manager?%>
    • -
    • <%= link_to t('bulletin.my_announcement_fact_check'), panel_announcement_back_end_fact_checks_path if is_sub_manager?%>
    • -
    +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> <% end -%> <%= flash_messages %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb index e23ecfba..d200bb66 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb @@ -1,15 +1,14 @@ -
    -
    -
    -
    - <% content_for :secondary do %> -
      -
    • <%= link_to t('bulletin.index'), panel_announcement_back_end_bulletins_path, :class => 'seclink2' %>
    • -
    +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> <% end -%> <%= flash_messages %> + +
    +
    +
    +
    +

    <%= t('bulletin.new_announcement') %>

    <%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb index c3ba2c09..5aff4bbd 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb @@ -1,10 +1,14 @@ -<% # encoding: utf-8 %> +<% content_for :secondary do %> +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> +<% end -%> + +<%= flash_messages %>


    - -

    <%= flash_messages %>

    +
    +
    • diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb index 0f42ed4b..6f878b06 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb @@ -1,16 +1,5 @@ <% content_for :secondary do %> -
      -
      -
      -
      -
      -
        -
      • <%= link_to t('bulletin.new_announcement'), new_panel_announcement_back_end_bulletin_path %>
      • -
      • <%= link_to t('bulletin.announcement_list'), panel_announcement_back_end_bulletins_path %>
      • -
      • <%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path %>
      • -
      • <%= link_to t('bulletin.my_announcement_fact_check'), panel_announcement_back_end_fact_checks_path %>
      • - -
      +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> <% end -%> <%= flash_messages %> @@ -42,11 +31,7 @@

      <%= t('bulletin.list_announcement') %>

      -
      -

      Preview

      - <%= render :partial => "list_table", :collection => @bulletin_categorys_preview,:as => :bulletin_category%> -
      -=================================================================================================================== +

      Check Please

      <%= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%> diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index f0fd89d6..a7b23ff0 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -5,6 +5,7 @@ Rails.application.routes.draw do namespace :back_end do match 'public' => "announcements#public",:as => :public resources :fact_checks + match 'list_mine' => "announcements#list_mine" root :to => "bulletins#index" resources :bulletins resources :bulletin_categorys, :controller => 'bulletin_categorys' do From 6b2aeadde6e98a1d3d8ed70a040b5b3bf8ca178e Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 29 Feb 2012 16:01:50 +0800 Subject: [PATCH 06/24] Changes for nccu --- Gemfile | 2 +- Gemfile.lock | 4 + app/assets/images/nccu_logo.png | Bin 0 -> 1964 bytes app/assets/javascripts/orbit-1.0.js | 201 +- app/assets/stylesheets/bootstrap.css.erb | 29 +- app/assets/stylesheets/style.css.erb | 1647 +++++++++-------- app/views/layouts/_orbit_bar.html.erb | 10 +- app/views/layouts/_side_bar.html.erb | 4 +- config/application.rb | 2 +- config/environments/development.rb | 28 +- config/locales/en.yml | 1 + config/locales/zh_tw.yml | 5 +- lib/parsers/parser_front_end.rb | 2 +- .../front_end/bulletins_controller.rb | 4 +- .../app/models/bulletin_category.rb | 4 + .../front_end/bulletins/index.html.erb | 6 +- .../widget/bulletins/index.html.erb | 2 +- .../widget/web_links_controller.rb | 4 +- 18 files changed, 999 insertions(+), 956 deletions(-) create mode 100644 app/assets/images/nccu_logo.png diff --git a/Gemfile b/Gemfile index 9eca9186..eb1f5434 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,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. diff --git a/Gemfile.lock b/Gemfile.lock index 18f66fbf..8889b1d5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,6 +84,7 @@ GEM railties (~> 3.0) thor (~> 0.14) json (1.6.5) + libv8 (3.3.10.4) linecache19 (0.5.12) ruby_core_source (>= 0.1.4) mail (2.3.0) @@ -179,6 +180,8 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.1) + therubyracer (0.9.9) + libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) tinymce-rails (3.4.8) @@ -234,6 +237,7 @@ DEPENDENCIES sinatra spork sprockets + therubyracer tinymce-rails uglifier watchr diff --git a/app/assets/images/nccu_logo.png b/app/assets/images/nccu_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..68b9a72f669226970e3634612793a79e99a2625f GIT binary patch literal 1964 zcmaJ?Yg7|w8Xh%;7zL#Cpn%9QNL!F3lf)2+iGYMi&>&*u5^Eus2}Hi&2NX$lyQ(MG@;T4Uw$C5g8ie#=3DkxvTf5JCYOb&05fZxllBb@}Ale9VNv z_YfjM2>nr1lr#(s#Bc=UGGMw2_J%=k7K6oE%H#38KsL;RnJ}BlV$)eXK8MYRVerEP zk=byyh952xf5=7dgit&|==n@$a&j^wnZv;FI3~;2*VnAUX46Ro-H?J33L_mgxJ@aD z5Q7TW>Ip4|f@Vd95=$b45LxLTE$H+gWl_V2Ya%aG^>;q98C_hGB_Qw-^?W5ttz!(}RKQxL~9f zRb$D9_h_kf5a#)^ zcmY#f5vEGgAt*7$RsYFlPs=qML8m7(ix6D91yPG}Ob5Pin6I6-mLT!8dLOvz>1%+Fxp2|0JT?GW*g zn)>?sqP3@9y?WJ{JU=4$@qw>*%(b%e_})He1uc^q6BFZith}_P+$~C_(VQCe?;jb7 z@Vno0iSO7XnlXczU)D+Cc=sh|AI(imtUa=$=bxTS~k;pHNJ->OAI>SM_s18@w&F+0PX;1g^ zqC`eU-Wp%DPt*E3m6ItJEpRQdGOdJ*dOb}|gIB+?ZC%@#31}m_+UK-6XZ`C=F76Uidew{ERe z7u@n}G5B;V1a;4JV#Z9`>$Fur`FvkLR$N@XBckSU-T}=?*9+F^1d$6af9xjy;>o+{ zj0I%?{7qU~lKQ1h;$GTDxtzuYMsz=Hmk*j?c-)>jORPO``Sj`25LDeIvcAlGEC12U z_TKq<(bv>j|Gp7KHRWt?Jmc(q^6h`3s;n*ykB*L>NNxUdp5V&o?fx+{^d1%qemQ>p zDK$9YvwfInde0=ARhwqAoD_SP*Vu$e()ZRucF#B3=32<+#yUqoy|Aa-XPewxq1^h= zGz7>#O9<(5rezeytzS|27LdhSEpl-gJ&>0-TwuWQyGKJxd)wu$t*xGi4=Fw6p8Fzc zf{7)(UDqyJfiDB;+VETX85UvL11O4i0OHJFZTpGg%J#&6o{6}7L;B!a;)rQ(Zd*@& z$)}Xw%2ONtoPc|8-c%gBGkl5d;lAPg!n(gNx7C~4Lh1Vvnt*Dy)ibYab!HNLdJ zJ*8-51)OEe8lG?2cz>0PY1Jo45kZ0;-IeY10){ - windH=document.clientHeight; - windW=document.clientWidht; - } -} -$(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(); - return false; - }); - - $(document).click(function() { - $('.orbit-bar-member').removeClass("open"); - $('.bar-login .dropdown-menu').hide(); - }); - - $(document).on('click', '.bar-login .dropdown-menu', function(e) { - e.stopPropagation(); - $('.bar-login .dropdown-menu').show(); - }); - - $('.tip').tooltip({ - placement: "left" - }); - - $(document).on('click', '.privacy', function() { - switch ($(this).val()) { - case 'true': - $(this).parents('.controls').children('.select-role').slideUp(300); - break; - case 'false': - $(this).parents('.controls').children('.select-role').slideDown(300); - break; - } - }); - - $(document).on('click', '.toggle-tr-edit', function() { - $(this).parents('tr').next('.qe-block').removeClass('hide'); - $(this).parents('tr').next('.qe-block').find('.qe-edit-div').addClass('hide'); - $(this).parents('tr').next('.qe-block').find('#qe-' + $(this).attr('rel')).toggleClass('hide'); - }); - - $(document).on('click', '.sort-header > .sort', function() { - $.getScript($(this).attr('rel')); - }); - - /*tinyscrollbar&windows-Size*/ - resize(); - $('#main-sidebar').css("height", viewportheight-40); - $('#main-sidebar .viewport').css("height", viewportheight-40); - $('.post-title').css("width", viewportwidth-495); - $('#main-sidebar').tinyscrollbar(); - $('.detal-list').tinyscrollbar(); - $('#main-sidebar').tinyscrollbar({size:(viewportheight-44)}); - - /*isotope*/ - var $container = $('#isotope'); - $container.isotope({ - itemSelector : '.item', - layoutMode : 'masonry', - }); - - -}); -$(window).resize(function(){ - resize(); - 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({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); -}); +var viewportwidth, + viewportheight; +function resize() { + viewportheight=$(window).height(); + viewportwidth=$(window).width(); + if(window.navigator.userAgent.indexOf("MSIE")>0){ + windH=document.clientHeight; + windW=document.clientWidht; + } +} +$(document).ready(function(){ + $(document).on('click', '.orbit-bar-member', function(){ + $(this).hasClass('open') ? $(this).removeClass('open') : $(this).addClass('open'); + $('.bar-login .dropdown-menu').toggle(); + return false; + }); + + $(document).click(function() { + $('.orbit-bar-member').removeClass("open"); + $('.bar-login .dropdown-menu').hide(); + }); + + $(document).on('click', '.bar-login .dropdown-menu', function(e) { + e.stopPropagation(); + $('.bar-login .dropdown-menu').show(); + }); + + $('.tip').tooltip({ + placement: "left" + }); + + $(document).on('click', '.privacy', function() { + switch ($(this).val()) { + case 'true': + $(this).parents('.controls').children('.select-role').slideUp(300); + break; + case 'false': + $(this).parents('.controls').children('.select-role').slideDown(300); + break; + } + }); + + $(document).on('click', '.toggle-tr-edit', function() { + $(this).parents('tr').next('.qe-block').removeClass('hide'); + $(this).parents('tr').next('.qe-block').find('.qe-edit-div').addClass('hide'); + $(this).parents('tr').next('.qe-block').find('#qe-' + $(this).attr('rel')).toggleClass('hide'); + }); + + $(document).on('click', '.sort-header > .sort', function() { + $.getScript($(this).attr('rel')); + }); + + /*tinyscrollbar&windows-Size*/ + resize(); + $('#main-sidebar').css("height", viewportheight-40); + $('#main-sidebar .viewport').css("height", viewportheight-40); + $('.post-title').css("width", viewportwidth-495); + $('#main-sidebar').tinyscrollbar(); + $('.detal-list').tinyscrollbar(); + $('#main-sidebar').tinyscrollbar({size:(viewportheight-44)}); + + /*isotope*/ + var $container = $('#isotope'); + $container.isotope({ + itemSelector : '.item', + layoutMode : 'masonry', + }); + + +}); +$(window).resize(function(){ + resize(); + 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({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); +}); diff --git a/app/assets/stylesheets/bootstrap.css.erb b/app/assets/stylesheets/bootstrap.css.erb index 9ad62e96..ee2ae5a4 100644 --- a/app/assets/stylesheets/bootstrap.css.erb +++ b/app/assets/stylesheets/bootstrap.css.erb @@ -2642,8 +2642,8 @@ button.btn.small, input[type="submit"].btn.small { color: #333333; } .pagination { - height: 36px; - margin: 18px 0; + height: 36px; + margin: 18px 0; } .pagination ul { display: inline-block; @@ -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; } diff --git a/app/assets/stylesheets/style.css.erb b/app/assets/stylesheets/style.css.erb index 912df36a..beae5a8e 100644 --- a/app/assets/stylesheets/style.css.erb +++ b/app/assets/stylesheets/style.css.erb @@ -1,819 +1,830 @@ -@font-face{ - font-family: 'WebSymbolsRegular'; - src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>); - src: url(<%= asset_path 'websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'), - url(<%= asset_path 'websymbols-regular-webfont.woff' %>) format('woff'), - url(<%= asset_path 'websymbols-regular-webfont.ttf' %>) format('truetype'), - url(<%= asset_path 'websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg'); -} -.login-logo { - text-indent: -9999px; - background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 40px; - padding-top: 40px; - height: 160px; -} -#orbit-bar { - margin-bottom: 0; - position:fixed; - width:100%; - z-index: 99; - top: 0; - left: 0; -} -#orbit-bar .navbar-inner { - height: 28px; - -moz-border-radius: 0px; - -webkit-border-radius: 0px; - border-radius: 0px; - padding-top: 2px; - padding-bottom: 1px; - -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, #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-linear-gradient(top, #545b60, #191a1c); - 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; - margin: 0 auto; - text-align: center; -} -#orbit-bar .nav.pull-right { - margin-right: -20px; -} -#orbit-bar .search-query { - background-image: url(<%= asset_path 'main-search.png' %>); - background-repeat: no-repeat; - background-position: 5px 6px; - padding-left: 25px; - /*background-color: rgba(255, 255, 255, 0.8); - color: #333; - text-shadow: 0px 1px 0px #FFF;*/ - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) inset, 0 1px 0 rgba(255, 255, 255, 0.15); -} -#orbit-bar .search-query:focus { - /*background-color: rgba(255, 255, 255, 0.9); - text-shadow: 0px 1px 0px #FFF;*/ - background-position: 6px 7px; -} -#orbit-bar .container { - width:100%; -} -#orbit-bar .orbit-logo .brand { - background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px; - text-indent:-9999px; - padding: 5px 20px 4px; -} -#orbit-bar .orbit-logo .brand:hover { - background-color: rgba(0,157,220,1); -} -#orbit-bar .orbit-logo.open .brand { - background-color: rgba(0,157,220,1); -} -#orbit-bar .orbit-logo .dropdown-menu { - left: -15px; -} -#orbit-bar .nav > li { - height: 28px; -} -#orbit-bar .nav > li > a:hover { - background-color: rgba(0,157,220,1); -} -#orbit-bar .nav > li > a { - background-image: url(<%= asset_path 'orbit-bar.png' %>); - background-repeat:no-repeat; - display: inline-block; - width: 16px; - height: 16px; - text-indent: -9999px; - padding:6px; -} -#orbit-bar .nav > li > a.orbit-bar-home { - background-position: -10px -10px; -} -#orbit-bar .nav > li > a.orbit-bar-desktop { - background-position: -100px -4px; -} -#orbit-bar .nav > li > a.orbit-bar-member { - background-position: -4px -37px; -} -#orbit-bar .nav > li > a.orbit-bar-member { - background-position: -10px -43px; -} -#orbit-bar .nav > li > a.orbit-bar-language { - background-position: -42px -42px; -} -.language-menu .active { - color: #ffffff; - text-decoration: none; - background-color: #0088cc; -} -#orbit-bar .nav > li > a.orbit-bar-account { - background-image: none; - height: 22px; - padding: 3px; - text-indent: inherit; - min-width: 110px; - width: auto !important; - text-align: left; -} -#orbit-bar .nav span.member-name { - display: inline-block; - line-height: 22px; - padding: 0 10px; -} -#orbit-bar .nav img.member-img { - display: inline-block; - float: left; - max-width: 22px; -} -#orbit-bar .account-menu { - right: 5px; -} -#orbit-bar .bar-login { - -} -#orbit-bar .bar-login .open, #orbit-bar .open .orbit-bar-account { - background-color: #009DDC; -} -#orbit-bar .bar-login .dropdown-menu { - padding: 0 0 10px; - max-width: 260px; -} -#orbit-bar .bar-login .dropdown-menu .log { - margin: 10px 15px 0; - list-style: none outside none; -} -#orbit-bar .bar-login .dropdown-menu .log .title { - background: url(<%= asset_path 'sign-in-logo2.png' %>) no-repeat center center; - height: 70px; -} -#orbit-bar .bar-login .dropdown-menu .log form { - margin: 0 0 8px; -} -#orbit-bar .bar-login .dropdown-menu .log input { - display: inline-block; - margin: 0; -} -#orbit-bar .bar-login .dropdown-menu .log .span2 { - width: 183px; -} -#orbit-bar .bar-login .dropdown-menu .log .forgot { - margin-bottom: 20px; - padding: 3px 0 0; - float: right; - display: inline-block; - color: #0088CC; -} -#orbit-bar .bar-login .dropdown-menu .log .input-prepend { - margin-top: 20px; -} -#orbit-bar .bar-login .dropdown-menu .log .remember { - margin-top: 5px; -} -#orbit-bar .bar-login .dropdown-menu .log .forgot:hover { - padding: 3px 0 0; - float: right; - display: inline-block; - color: #005580; - text-decoration: underline; - background-color: transparent; -} -#orbit-bar .bar-login .dropdown-menu .log .btn { - width: 220px; -} -#orbit-bar .bar-login .dropdown-menu .log .divider { - position:relative; - overflow: inherit; - margin: 20px 0; -} -#orbit-bar .bar-login .dropdown-menu .log .divider span { - position: absolute; - width: 20px; - height: 20px; - background-color: #FFF; - color: #666; - top: -9px; - left: 100px; - font-size:16px; - text-align: center; -} -#orbit-bar .bar-login .dropdown-menu .register { - color: #FFFFFF; - margin: 0 15px; - width: 188px; -} -#main-sidebar { - background: url(<%= asset_path 'background.jpg' %>) repeat left top; - width: 155px; - padding-right: 4px; - border-right: 1px solid rgba(0,0,0,.2); - position:fixed; - top: 32px; - z-index: 88; -} -#main-sidebar .nav { - padding-top: 5px; -} -#main-sidebar .nav > li.active > a [class^="icons-"] { - background-image: url(<%= asset_path 'icons_pack_white.png' %>); -} -#main-sidebar .nav > li > .nav { - margin-left: -14px; - margin-bottom: 5px; - width: 155px; - padding: 0; - background-color: #FFF; - /*border-radius: 0px 0px 8px 0px; - -webkit-border-radius: 0px 0px 8px 0px; - -moz-border-radius: 0px 0px 8px 0px;*/ - box-shadow: 0px 2px 1px rgba(0,0,0,0.1); - -moz-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); - -webkit-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); -} -#main-sidebar .nav > li > .nav > li > a { - margin-left: 0; - padding-left: 19px; - color: #999; -} -#main-sidebar .nav > li > .nav > li > a:hover { - color: #000; - background-color: #d7eeff; -} -#main-sidebar .nav > li > .nav > li.active > a { - background-color: #b7b7b7; - color: #fff; -} -#main-wrap { - background-color: #FFF; - margin-left:160px; - padding-top: 32px; - padding-bottom: 18px; - position: relative; - min-height: 100%; -} -#main-wrap > .form-actions { - background-color: #FFF; - text-align: center; - padding: 17px 20px 0; - margin: 0; - border-top: none; -} -#main-wrap .subnav { - height: auto; - min-height: 36px; -} -#main-wrap .pagination { - margin: 18px 0 0; - text-align: center; -} -.main-list .route-group td { - border: none; -} -#main-wrap .route-group .breadcrumb { - background-image: none; - border-radius: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-width: 0 0 1px 0; - box-shadow: none; - -webkit-box-shadow: none; - -moz-box-shadow: none; - margin-bottom: 0px; - padding: 7px 8px 5px; -} -#main-wrap .breadcrumb li { - font-size: 12px; - color: #999; -} -#sub-wiget { - clear: right; - float: right; - padding-right: 10px; - padding-top: 8px; - position: relative; - margin-bottom: 13px; - width: 304px; -} -.main-wiget .widget-box { - margin: 5px 0; - width: 100%; -} -#poststuff .form-actions { - background-color: transparent; - text-align: right; - padding-left: 10px; - padding-right: 10px; - margin-bottom: 0; - clear: both; -} -#poststuff form { - margin-bottom: 0; -} -#post-body { - float: left; - clear: left; - width: 100%; - margin-right: -340px; -} -#post-body .title input[type=text] { - margin-bottom: 0; - width: 100%; - height: 30px; -} -#post-body .btn-group { - margin-left: 5px; -} -#post-body .well { - margin: 0; - border-radius: 0px; - -moz-border-radius: 0px; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - border-top: none; -} -#post-body .editor { - background-color: #333333; - height: 20px; - margin: 8px 0; - width: 100%; -} -#post-body-content { - margin-right: 320px; - padding: 8px 0 8px 6px; -} -.filter .accordion-heading > a:hover { - text-decoration: none; -} -.filter .accordion-group { - border-bottom: none; - border-top: none; - border-left: 1px solid rgba(0,0,0,0.07); - border-right: none; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; - margin-bottom: -1px; - position: relative; - left: 0; - top: 0; -} -.filter .accordion-group:last-child { - border-right: 1px solid rgba(0,0,0,0.07); -} -.filter .accordion-heading .accordion-toggle { - padding: 9px 15px; -} -.accordion-group .accordion-toggle .caret { - border-top-color: #0088CC; - margin-top: 6px; -} -.filter .active { - background-color: #0088CC; -} -.filter .active a { - color: #FFF; -} -.filters { - background-color: rgba(0,0,0,0.075); - -webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); - -moz-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); - box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); -} -.filters > div { - background-color: #dadada; -} -.filters .btn { - margin-bottom: 5px; -} -.filters .accordion-inner { - border-top: none; - padding: 9px 15px 4px; -} -.filters .filter-clear { - padding: 5px 5px 0; - border-top: 1px solid rgba(0,0,0,0.1); - text-align: right; - margin: 0 5px; - -webkit-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); - -moz-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); - box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); -} -.filters .in { - /*border-bottom: 1px solid rgba(0,0,0,0.07)*/ -} -.sign-in { - width: 360px; - margin: 0 auto 70px; - background-color: #FFF; - -moz-border-radius: 0 0 5px 5px; - -webkit-border-radius: 0 0 5px 5px; - border-radius: 0 0 5px 5px; - -moz-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - -webkit-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - border-width: 0px 1px 1px 1px; - border-style: none solid solid solid; - border-color: transparent #c6c6c6 #c6c6c6 #c6c6c6; -} -#signin-header { - width: 340px; - margin: 30px auto 0; - line-height: 25px; - padding: 5px 10px; - border-width: 1px 1px 0px 1px; - border-style: solid solid none solid; - border-color: #c6c6c6 #c6c6c6 transparent #c6c6c6; - background-color: #006dcc; - background-image: -moz-linear-gradient(top, #dadada, #c0c0c0); - background-image: -ms-linear-gradient(top, #dadada, #c0c0c0); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#dadada), to(#c0c0c0)); - background-image: -webkit-linear-gradient(top, #dadada, #c0c0c0); - background-image: -o-linear-gradient(top, #dadada, #c0c0c0); - background-image: linear-gradient(top, #dadada, #c0c0c0); - -moz-border-radius: 5px 5px 0px 0px ; - -webkit-border-radius: 5px 5px 0px 0px; - border-radius: 5px 5px 0px 0px; - -moz-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); - -webkit-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); - box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); -} -#signin-header h3 { - color: #848484; - text-shadow: 0 1px 0 #e9e9e9; -} -#sign-footer { - width: 100%; - position:fixed; - bottom: 0; - height: 40px; - background-color: #dadada; - color: #7a7a7a; - box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); - -webkit-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); -} -#sign-footer p { - line-height: 40px; - padding: 0 10px; - text-align: right; -} -.sign-in .control-group label { - text-align: left; - width: auto; - font-size: 15px; -} -.sign-in .forgot { - padding-top: 5px; -} -.sign-in .content { - padding: 10px; -} -.sign-in .form-actions { - padding: 17px 10px 18px; - margin: 0; - -moz-border-radius: 0px 0px 5px 5px; - -webkit-border-radius: 0px 0px 5px 5px; - border-radius: 0px 0px 5px 5px; -} -.sign-in form { - margin: 0; -} -.sign-in .control-group .help-inline { - display:none; -} -.sign-in .error .help-inline { - display:inline-block; -} -.web-symbol:after { - font-family: 'WebSymbolsRegular'; - content: "{"; - margin-left: 2px; - margin-top: 8px; -} -.active .web-symbol:after { - content: "}"; -} -/*icons*/ -.the-icons i:after { - content: attr(class); - display: block; - font-style: normal; - margin-left: 20px; - width: 140px; -} -.the-icons i { - display: block; - margin-bottom: 5px; -} -[class^="text-"] { - font-size: 15px !important; -} -.text-blue { - color: #0088CC !important; -} -.text-red { - color: #CC3300 !important; -} -.text-yellow { - color: #ffcc00 !important; -} -.text-orange { - color: #f7941d !important; -} -.text-purple { - color: #a864a8 !important; -} -.text-palm { - color: #a67c52 !important; -} -.text-green { - color: #39b54a !important; -} -[class^="icons-"] { - display: inline-block; - width: 16px; - height: 16px; - vertical-align: text-top; - background-image: url(<%= asset_path 'icons_pack.png' %>); - background-position: 16px 16px; - background-repeat: no-repeat; - *margin-right: .3em; - margin-right:10px; -} -[class^="icons-"]:last-child { - *margin-left: 0; -} -.icons-white { - background-image: url(<%= asset_path 'icons_pack_white.png' %>); -} -/*1*/ -.icons-pencil { - background-position: 0 0; -} -.icons-brush { - background-position: -32px 0; -} -.icons-pen { - background-position: -64px 0; -} -.icons-brush-large { - background-position: -128px 0; -} -.icons-pen-small { - background-position: -96px 0; -} -.icons-bucket { - background-position: -160px 0; -} -.icons-eye { - background-position: -192px 0; -} -.icons-ban { - background-position: -224px 0; -} -.icons-trash { - background-position: -256px 0; -} -.icons-zoom { - background-position: -288px 0; -} -.icons-zoom-out { - background-position: -320px 0; -} -.icons-zoom-in { - background-position: -352px 0; -} -.icons-magic { - background-position: -384px 0; -} -.icons-aim { - background-position: -416px 0; -} -/*2*/ -.icons-flag { - background-position: 0 -32px; -} -.icons-paperclip { - background-position: -32px -32px; -} -.icons-share { - background-position: -64px -32px; -} -.icons-link { - background-position: -96px -32px; -} -.icons-tag { - background-position: -128px -32px; -} -.icons-lock { - background-position: -160px -32px; -} -.icons-unlock { - background-position: -192px -32px; -} -/*3*/ -.icons-content { - background-position: -160px -66px; -} -.icons-announcement { - background-position: -576px -64px; -} -/*4*/ -.icons-contact { - background-position: 0 -96px; -} -.icons-roll { - background-position: -32px -96px; -} -.icons-member { - background-position: -288px -96px; -} -.icons-member-user { - background-position: -64px -96px; -} -.icons-member-admin { - background-position: -96px -96px; -} -.icons-member-manager{ - background-position: -128px -96px; -} -.icons-member-plus{ - background-position: -160px -96px; -} -.icons-member-minus{ - background-position: -192px -96px; -} -.icons-member-blockade{ - background-position: -224px -96px; -} -.icons-carte { - background-position: -256px -96px; -} -.icons-building { - background-position: -320px -96px; -} -.icons-calendar { - background-position: -352px -96px; -} -.icons-calendars { - background-position: -384px -96px; -} -.icons-out { - background-position: -416px -96px; -} -.icons-desktop { - background-position: -448px -96px; -} -/*5*/ -.icons-page-blank { - background-position: 0px -128px; -} -.icons-page { - background-position: -32px -128px; -} -.icons-page-copy { - background-position: -64px -128px; -} -.icons- { - background-position: -0px -128px; -} -/*6*/ -.icons-globe { - background-position: -96px -160px; -} -.icons-structure { - background-position: -352px -160px; -} -/*7*/ -.icons-purchase { - background-position: -64px -192px; -} -/*8*/ -.icons-dashboard { - background-position: 0 -224px; -} -.icons-cog { - background-position: -32px -224px; -} -.icons-cogs { - background-position: -64px -224px; -} -.icons-tool { - background-position: -96px -224px; -} -.icons-screwdriver { - background-position: -128px -224px; -} -.icons-wrench { - background-position: -160px -224px; -} -.icons-toolbox { - background-position: -192px -224px; -} -.icons-switch { - background-position: -224px -224px; -} -.icons-valve { - background-position: -256px -224px; -} -/*9*/ -.icons-picture { - background-position: -256px -256px; -} -.icons-asset { - background-position: -384px -256px; -} -.icons-asset-upload { - background-position: -448px -256px; -} -.icons-asset-download { - background-position: -416px -256px; -} -/*10*/ -.icons- { - background-position: -0px -288px; -} -/*11*/ -.icons-pie { - background-position: 0px -320px; -} -.icons-histogram { - background-position: -32px -320px; -} -.icons-window { - background-position: -64px -320px; -} -.icons-window-line{ - background-position: -96px -320px; -} -.icons-window-command{ - background-position: -128px -320px; -} -.icons-window-list{ - background-position: -160px -320px; -} -.icons-window-block{ - background-position: -192px -320px; -} -.icons-terminal{ - background-position: -224px -320px; -} -/*12*/ -.icons-star-thin { - background-position: -416px -352px; -} -.icons- { - background-position: -0px -352px; -} -/*13*/ -.icons- { - background-position: -0px -384px; -} -/*14*/ -.icons- { - background-position: -0px -416px; -} -/*15*/ -.icons- { - background-position: -0px -448px; -} -/*16*/ -.icons- { - background-position: -0px -480px; -} -/*17*/ -.icons- { - background-position: -0px -512px; -} -/*18*/ -.icons-help { - background-position: -160px -544px; -} -.icons- { - background-position: -0px -544px; -} -/*19*/ -.icons-plus-cube { - background-position: -192px -576px; -} -.icons-plus { - background-position: -288px -576px; -} -.icons-power { - background-position: -0px -608px; -} -/*20*/ -.icons- { - background-position: -0px -608px; -} -/*21*/ -.icons- { - background-position: -0px -640px; +@font-face{ + font-family: 'WebSymbolsRegular'; + src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>); + src: url(<%= asset_path 'websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'), + url(<%= asset_path 'websymbols-regular-webfont.woff' %>) format('woff'), + url(<%= asset_path 'websymbols-regular-webfont.ttf' %>) format('truetype'), + url(<%= asset_path 'websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg'); +} +.login-logo { + text-indent: -9999px; + background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 40px; + padding-top: 40px; + height: 160px; +} +#orbit-bar { + margin-bottom: 0; + position:fixed; + width:100%; + z-index: 99; + top: 0; + left: 0; +} +#orbit-bar .navbar-inner { + height: 28px; + -moz-border-radius: 0px; + -webkit-border-radius: 0px; + border-radius: 0px; + padding-top: 2px; + padding-bottom: 1px; + -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)); + background-image: -webkit-linear-gradient(top, #545b60, #191a1c); + 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; + margin: 0 auto; + text-align: center; +} +#orbit-bar .nav.pull-right { + margin-right: -20px; +} +#orbit-bar .search-query { + background-image: url(<%= asset_path 'main-search.png' %>); + background-repeat: no-repeat; + background-position: 5px 6px; + padding-left: 25px; + /*background-color: rgba(255, 255, 255, 0.8); + color: #333; + text-shadow: 0px 1px 0px #FFF;*/ + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) inset, 0 1px 0 rgba(255, 255, 255, 0.15); +} +#orbit-bar .search-query:focus { + /*background-color: rgba(255, 255, 255, 0.9); + text-shadow: 0px 1px 0px #FFF;*/ + background-position: 6px 7px; +} +#orbit-bar .container { + width:100%; +} +#orbit-bar .orbit-logo .brand { + /* 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; +} +#orbit-bar .orbit-logo .brand:hover { + background-color: rgba(0,157,220,1); +} +#orbit-bar .orbit-logo.open .brand { + background-color: rgba(0,157,220,1); +} +#orbit-bar .orbit-logo .dropdown-menu { + left: -15px; +} +#orbit-bar .nav > li { + height: 28px; +} +#orbit-bar .nav > li > a:hover { + background-color: rgba(0,157,220,1); +} +#orbit-bar .nav > li > a { + background-image: url(<%= asset_path 'orbit-bar.png' %>); + background-repeat:no-repeat; + display: inline-block; + width: 16px; + height: 16px; + text-indent: -9999px; + padding:6px; +} +#orbit-bar .nav > li > a.orbit-bar-home { + background-position: -10px -10px; +} +#orbit-bar .nav > li > a.orbit-bar-desktop { + background-position: -100px -4px; +} +#orbit-bar .nav > li > a.orbit-bar-member { + background-position: -4px -37px; +} +#orbit-bar .nav > li > a.orbit-bar-member { + background-position: -10px -43px; +} +#orbit-bar .nav > li > a.orbit-bar-language { + background-position: -42px -42px; +} +.language-menu .active { + color: #ffffff; + text-decoration: none; + background-color: #0088cc; +} +#orbit-bar .nav > li > a.orbit-bar-account { + background-image: none; + height: 22px; + padding: 3px; + text-indent: inherit; + min-width: 110px; + width: auto !important; + text-align: left; +} +#orbit-bar .nav span.member-name { + display: inline-block; + line-height: 22px; + padding: 0 10px; +} +#orbit-bar .nav img.member-img { + display: inline-block; + float: left; + max-width: 22px; +} +#orbit-bar .account-menu { + right: 5px; +} +#orbit-bar .bar-login { + +} +#orbit-bar .bar-login .open, #orbit-bar .open .orbit-bar-account { + background-color: #009DDC; +} +#orbit-bar .bar-login .dropdown-menu { + padding: 0 0 10px; + max-width: 260px; +} +#orbit-bar .bar-login .dropdown-menu .log { + margin: 10px 15px 0; + list-style: none outside none; +} +#orbit-bar .bar-login .dropdown-menu .log .title { + background: url(<%= asset_path 'sign-in-logo2.png' %>) no-repeat center center; + height: 70px; +} +#orbit-bar .bar-login .dropdown-menu .log form { + margin: 0 0 8px; +} +#orbit-bar .bar-login .dropdown-menu .log input { + display: inline-block; + margin: 0; +} +#orbit-bar .bar-login .dropdown-menu .log .span2 { + width: 183px; +} +#orbit-bar .bar-login .dropdown-menu .log .forgot { + margin-bottom: 20px; + padding: 3px 0 0; + float: right; + display: inline-block; + color: #0088CC; +} +#orbit-bar .bar-login .dropdown-menu .log .input-prepend { + margin-top: 20px; +} +#orbit-bar .bar-login .dropdown-menu .log .remember { + margin-top: 5px; +} +#orbit-bar .bar-login .dropdown-menu .log .forgot:hover { + padding: 3px 0 0; + float: right; + display: inline-block; + color: #005580; + text-decoration: underline; + background-color: transparent; +} +#orbit-bar .bar-login .dropdown-menu .log .btn { + width: 220px; +} +#orbit-bar .bar-login .dropdown-menu .log .divider { + position:relative; + overflow: inherit; + margin: 20px 0; +} +#orbit-bar .bar-login .dropdown-menu .log .divider span { + position: absolute; + width: 20px; + height: 20px; + background-color: #FFF; + color: #666; + top: -9px; + left: 100px; + font-size:16px; + text-align: center; +} +#orbit-bar .bar-login .dropdown-menu .register { + color: #FFFFFF; + margin: 0 15px; + width: 188px; +} +#main-sidebar { + background: url(<%= asset_path 'background.jpg' %>) repeat left top; + width: 155px; + padding-right: 4px; + border-right: 1px solid rgba(0,0,0,.2); + position:fixed; + top: 32px; + z-index: 88; +} +#main-sidebar .nav { + padding-top: 5px; +} +#main-sidebar .nav > li.active > a [class^="icons-"] { + background-image: url(<%= asset_path 'icons_pack_white.png' %>); +} +#main-sidebar .nav > li > .nav { + margin-left: -14px; + margin-bottom: 5px; + width: 155px; + padding: 0; + background-color: #FFF; + /*border-radius: 0px 0px 8px 0px; + -webkit-border-radius: 0px 0px 8px 0px; + -moz-border-radius: 0px 0px 8px 0px;*/ + box-shadow: 0px 2px 1px rgba(0,0,0,0.1); + -moz-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); + -webkit-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); +} +#main-sidebar .nav > li > .nav > li > a { + margin-left: 0; + padding-left: 19px; + color: #999; +} +#main-sidebar .nav > li > .nav > li > a:hover { + color: #000; + background-color: #d7eeff; +} +#main-sidebar .nav > li > .nav > li.active > a { + background-color: #b7b7b7; + color: #fff; +} +#main-wrap { + background-color: #FFF; + margin-left:160px; + padding-top: 32px; + padding-bottom: 18px; + position: relative; + min-height: 100%; +} +#main-wrap > .form-actions { + background-color: #FFF; + text-align: center; + padding: 17px 20px 0; + margin: 0; + border-top: none; +} +#main-wrap .subnav { + height: auto; + min-height: 36px; +} +#main-wrap .pagination { + margin: 18px 0 0; + text-align: center; +} +.main-list .route-group td { + border: none; +} +#main-wrap .route-group .breadcrumb { + background-image: none; + border-radius: 0; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-width: 0 0 1px 0; + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + margin-bottom: 0px; + padding: 7px 8px 5px; +} +#main-wrap .breadcrumb li { + font-size: 12px; + color: #999; +} +#sub-wiget { + clear: right; + float: right; + padding-right: 10px; + padding-top: 8px; + position: relative; + margin-bottom: 13px; + width: 304px; +} +.main-wiget .widget-box { + margin: 5px 0; + width: 100%; +} +#poststuff .form-actions { + background-color: transparent; + text-align: right; + padding-left: 10px; + padding-right: 10px; + margin-bottom: 0; + clear: both; +} +#poststuff form { + margin-bottom: 0; +} +#post-body { + float: left; + clear: left; + width: 100%; + margin-right: -340px; +} +#post-body .title input[type=text] { + margin-bottom: 0; + width: 100%; + height: 30px; +} +#post-body .btn-group { + margin-left: 5px; +} +#post-body .well { + margin: 0; + border-radius: 0px; + -moz-border-radius: 0px; + box-shadow: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + border-top: none; +} +#post-body .editor { + background-color: #333333; + height: 20px; + margin: 8px 0; + width: 100%; +} +#post-body-content { + margin-right: 320px; + padding: 8px 0 8px 6px; +} +.filter .accordion-heading > a:hover { + text-decoration: none; +} +.filter .accordion-group { + border-bottom: none; + border-top: none; + border-left: 1px solid rgba(0,0,0,0.07); + border-right: none; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; + margin-bottom: -1px; + position: relative; + left: 0; + top: 0; +} +.filter .accordion-group:last-child { + border-right: 1px solid rgba(0,0,0,0.07); +} +.filter .accordion-heading .accordion-toggle { + padding: 9px 15px; +} +.accordion-group .accordion-toggle .caret { + border-top-color: #0088CC; + margin-top: 6px; +} +.filter .active { + background-color: #0088CC; +} +.filter .active a { + color: #FFF; +} +.filters { + background-color: rgba(0,0,0,0.075); + -webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); + -moz-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); + box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); +} +.filters > div { + background-color: #dadada; +} +.filters .btn { + margin-bottom: 5px; +} +.filters .accordion-inner { + border-top: none; + padding: 9px 15px 4px; +} +.filters .filter-clear { + padding: 5px 5px 0; + border-top: 1px solid rgba(0,0,0,0.1); + text-align: right; + margin: 0 5px; + -webkit-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); + -moz-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); + box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); +} +.filters .in { + /*border-bottom: 1px solid rgba(0,0,0,0.07)*/ +} +.sign-in { + width: 360px; + margin: 0 auto 70px; + background-color: #FFF; + -moz-border-radius: 0 0 5px 5px; + -webkit-border-radius: 0 0 5px 5px; + border-radius: 0 0 5px 5px; + -moz-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + -webkit-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + border-width: 0px 1px 1px 1px; + border-style: none solid solid solid; + border-color: transparent #c6c6c6 #c6c6c6 #c6c6c6; +} +#signin-header { + width: 340px; + margin: 30px auto 0; + line-height: 25px; + padding: 5px 10px; + border-width: 1px 1px 0px 1px; + border-style: solid solid none solid; + border-color: #c6c6c6 #c6c6c6 transparent #c6c6c6; + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #dadada, #c0c0c0); + background-image: -ms-linear-gradient(top, #dadada, #c0c0c0); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#dadada), to(#c0c0c0)); + background-image: -webkit-linear-gradient(top, #dadada, #c0c0c0); + background-image: -o-linear-gradient(top, #dadada, #c0c0c0); + background-image: linear-gradient(top, #dadada, #c0c0c0); + -moz-border-radius: 5px 5px 0px 0px ; + -webkit-border-radius: 5px 5px 0px 0px; + border-radius: 5px 5px 0px 0px; + -moz-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); + -webkit-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); + box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); +} +#signin-header h3 { + color: #848484; + text-shadow: 0 1px 0 #e9e9e9; +} +#sign-footer { + width: 100%; + position:fixed; + bottom: 0; + height: 40px; + background-color: #dadada; + color: #7a7a7a; + box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); + -webkit-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); +} +#sign-footer p { + line-height: 40px; + padding: 0 10px; + text-align: right; +} +.sign-in .control-group label { + text-align: left; + width: auto; + font-size: 15px; +} +.sign-in .forgot { + padding-top: 5px; +} +.sign-in .content { + padding: 10px; +} +.sign-in .form-actions { + padding: 17px 10px 18px; + margin: 0; + -moz-border-radius: 0px 0px 5px 5px; + -webkit-border-radius: 0px 0px 5px 5px; + border-radius: 0px 0px 5px 5px; +} +.sign-in form { + margin: 0; +} +.sign-in .control-group .help-inline { + display:none; +} +.sign-in .error .help-inline { + display:inline-block; +} +.web-symbol:after { + font-family: 'WebSymbolsRegular'; + content: "{"; + margin-left: 2px; + margin-top: 8px; +} +.active .web-symbol:after { + content: "}"; +} +/*icons*/ +.the-icons i:after { + content: attr(class); + display: block; + font-style: normal; + margin-left: 20px; + width: 140px; +} +.the-icons i { + display: block; + margin-bottom: 5px; +} +[class^="text-"] { + font-size: 15px !important; +} +.text-blue { + color: #0088CC !important; +} +.text-red { + color: #CC3300 !important; +} +.text-yellow { + color: #ffcc00 !important; +} +.text-orange { + color: #f7941d !important; +} +.text-purple { + color: #a864a8 !important; +} +.text-palm { + color: #a67c52 !important; +} +.text-green { + color: #39b54a !important; +} +[class^="icons-"] { + display: inline-block; + width: 16px; + height: 16px; + vertical-align: text-top; + background-image: url(<%= asset_path 'icons_pack.png' %>); + background-position: 16px 16px; + background-repeat: no-repeat; + *margin-right: .3em; + margin-right:10px; +} +[class^="icons-"]:last-child { + *margin-left: 0; +} +.icons-white { + background-image: url(<%= asset_path 'icons_pack_white.png' %>); +} +/*1*/ +.icons-pencil { + background-position: 0 0; +} +.icons-brush { + background-position: -32px 0; +} +.icons-pen { + background-position: -64px 0; +} +.icons-brush-large { + background-position: -128px 0; +} +.icons-pen-small { + background-position: -96px 0; +} +.icons-bucket { + background-position: -160px 0; +} +.icons-eye { + background-position: -192px 0; +} +.icons-ban { + background-position: -224px 0; +} +.icons-trash { + background-position: -256px 0; +} +.icons-zoom { + background-position: -288px 0; +} +.icons-zoom-out { + background-position: -320px 0; +} +.icons-zoom-in { + background-position: -352px 0; +} +.icons-magic { + background-position: -384px 0; +} +.icons-aim { + background-position: -416px 0; +} +/*2*/ +.icons-flag { + background-position: 0 -32px; +} +.icons-paperclip { + background-position: -32px -32px; +} +.icons-share { + background-position: -64px -32px; +} +.icons-link { + background-position: -96px -32px; +} +.icons-tag { + background-position: -128px -32px; +} +.icons-lock { + background-position: -160px -32px; +} +.icons-unlock { + background-position: -192px -32px; +} +/*3*/ +.icons-content { + background-position: -160px -66px; +} +.icons-announcement { + background-position: -576px -64px; +} +/*4*/ +.icons-contact { + background-position: 0 -96px; +} +.icons-roll { + background-position: -32px -96px; +} +.icons-member { + background-position: -288px -96px; +} +.icons-member-user { + background-position: -64px -96px; +} +.icons-member-admin { + background-position: -96px -96px; +} +.icons-member-manager{ + background-position: -128px -96px; +} +.icons-member-plus{ + background-position: -160px -96px; +} +.icons-member-minus{ + background-position: -192px -96px; +} +.icons-member-blockade{ + background-position: -224px -96px; +} +.icons-carte { + background-position: -256px -96px; +} +.icons-building { + background-position: -320px -96px; +} +.icons-calendar { + background-position: -352px -96px; +} +.icons-calendars { + background-position: -384px -96px; +} +.icons-out { + background-position: -416px -96px; +} +.icons-desktop { + background-position: -448px -96px; +} +/*5*/ +.icons-page-blank { + background-position: 0px -128px; +} +.icons-page { + background-position: -32px -128px; +} +.icons-page-copy { + background-position: -64px -128px; +} +.icons- { + background-position: -0px -128px; +} +/*6*/ +.icons-globe { + background-position: -96px -160px; +} +.icons-structure { + background-position: -352px -160px; +} +/*7*/ +.icons-purchase { + background-position: -64px -192px; +} +/*8*/ +.icons-dashboard { + background-position: 0 -224px; +} +.icons-cog { + background-position: -32px -224px; +} +.icons-cogs { + background-position: -64px -224px; +} +.icons-tool { + background-position: -96px -224px; +} +.icons-screwdriver { + background-position: -128px -224px; +} +.icons-wrench { + background-position: -160px -224px; +} +.icons-toolbox { + background-position: -192px -224px; +} +.icons-switch { + background-position: -224px -224px; +} +.icons-valve { + background-position: -256px -224px; +} +/*9*/ +.icons-picture { + background-position: -256px -256px; +} +.icons-asset { + background-position: -384px -256px; +} +.icons-asset-upload { + background-position: -448px -256px; +} +.icons-asset-download { + background-position: -416px -256px; +} +/*10*/ +.icons- { + background-position: -0px -288px; +} +/*11*/ +.icons-pie { + background-position: 0px -320px; +} +.icons-histogram { + background-position: -32px -320px; +} +.icons-window { + background-position: -64px -320px; +} +.icons-window-line{ + background-position: -96px -320px; +} +.icons-window-command{ + background-position: -128px -320px; +} +.icons-window-list{ + background-position: -160px -320px; +} +.icons-window-block{ + background-position: -192px -320px; +} +.icons-terminal{ + background-position: -224px -320px; +} +/*12*/ +.icons-star-thin { + background-position: -416px -352px; +} +.icons- { + background-position: -0px -352px; +} +/*13*/ +.icons- { + background-position: -0px -384px; +} +/*14*/ +.icons- { + background-position: -0px -416px; +} +/*15*/ +.icons- { + background-position: -0px -448px; +} +/*16*/ +.icons- { + background-position: -0px -480px; +} +/*17*/ +.icons- { + background-position: -0px -512px; +} +/*18*/ +.icons-help { + background-position: -160px -544px; +} +.icons- { + background-position: -0px -544px; +} +/*19*/ +.icons-plus-cube { + background-position: -192px -576px; +} +.icons-plus { + background-position: -288px -576px; +} +.icons-power { + background-position: -0px -608px; +} +/*20*/ +.icons- { + background-position: -0px -608px; +} +/*21*/ +.icons- { + background-position: -0px -640px; } \ No newline at end of file diff --git a/app/views/layouts/_orbit_bar.html.erb b/app/views/layouts/_orbit_bar.html.erb index c2ba7fbd..e9a91f48 100644 --- a/app/views/layouts/_orbit_bar.html.erb +++ b/app/views/layouts/_orbit_bar.html.erb @@ -26,10 +26,10 @@
    <% if user_signed_in? %> -
    <%= t('bulletin_category.key') %>
    diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb index e3ba9d48..33166165 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb @@ -11,7 +11,7 @@
  • <%= image_tag(post.image.url, :size => "290x130") if post.image.file %>

    <%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>

    -

    <%= post.subtitle[I18n.locale] %>

    +

    <%= post.subtitle[I18n.locale].html_safe %>

  • <% end %> diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb index 66b74799..bbe4a8d9 100644 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb +++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb @@ -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 From 3bcd7ea349c814b64e401fb0868ec31ed2788aa9 Mon Sep 17 00:00:00 2001 From: Matthew Kaito Juyuan Fu Date: Mon, 13 Feb 2012 17:33:48 +0800 Subject: [PATCH 07/24] Exp with object_auth --- app/controllers/admin/app_auths_controller.rb | 4 +- .../admin/module_apps_controller.rb | 4 ++ .../admin/object_auths_controller.rb | 1 + app/models/prototype_auth.rb | 6 +-- .../admin/attributes/_app_selector.html.erb | 1 + app/views/admin/module_apps/show.html.erb | 37 ++++++++++++++ app/views/admin/object_auths/new.html.erb | 3 +- .../back_end/bulletins_controller.rb | 2 +- .../back_end/fact_checks_controller.rb | 29 +++++++++++ .../announcement/app/models/bulletin.rb | 2 +- .../app/models/bulletin_category.rb | 4 ++ .../_bulletin_category.html.erb | 6 +++ .../back_end/bulletins/_bulletins.html.erb | 2 +- .../back_end/bulletins/index.html.erb | 1 - .../back_end/fact_checks/_list_table.html.erb | 15 ++++++ .../back_end/fact_checks/index.html.erb | 51 +++++++++++++++++++ .../announcement/config/routes.rb | 3 +- 17 files changed, 161 insertions(+), 10 deletions(-) create mode 100644 app/views/admin/attributes/_app_selector.html.erb create mode 100644 app/views/admin/module_apps/show.html.erb create mode 100644 vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb diff --git a/app/controllers/admin/app_auths_controller.rb b/app/controllers/admin/app_auths_controller.rb index cb3340fd..56d0ae23 100644 --- a/app/controllers/admin/app_auths_controller.rb +++ b/app/controllers/admin/app_auths_controller.rb @@ -66,6 +66,8 @@ class Admin::AppAuthsController < ApplicationController @module_app = ModuleApp.find(params[:id]) end - + def show + @module_app = ModuleApp.find(params[:id]) + end end \ No newline at end of file diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb index e80d4023..440f8100 100644 --- a/app/controllers/admin/module_apps_controller.rb +++ b/app/controllers/admin/module_apps_controller.rb @@ -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]) diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index ce404e53..3bff4374 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -14,6 +14,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 } diff --git a/app/models/prototype_auth.rb b/app/models/prototype_auth.rb index 734268c4..893f402b 100644 --- a/app/models/prototype_auth.rb +++ b/app/models/prototype_auth.rb @@ -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,8 +83,8 @@ 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 diff --git a/app/views/admin/attributes/_app_selector.html.erb b/app/views/admin/attributes/_app_selector.html.erb new file mode 100644 index 00000000..c20a3885 --- /dev/null +++ b/app/views/admin/attributes/_app_selector.html.erb @@ -0,0 +1 @@ +<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %> diff --git a/app/views/admin/module_apps/show.html.erb b/app/views/admin/module_apps/show.html.erb new file mode 100644 index 00000000..27cfbc1a --- /dev/null +++ b/app/views/admin/module_apps/show.html.erb @@ -0,0 +1,37 @@ +



    +<%=@module_app.key %>
    +<%=@module_app.title %>
    +<%=@module_app.version %>
    +<%=@module_app.organization %>
    +<%=@module_app.author %>
    +<%=@module_app.intro %>
    +<%=@module_app.update_info %>
    +<%=@module_app.create_date %>
    +<%=@module_app.enable_frontend%>
    +<%=@module_app.app_pages%>
    +<%=@module_app.widgets%>
    + +Mangers: +
      + <% @module_app.managers.each do |manager|%> +
    • <%= manager.user.name %>
    • + <%end%> +
    + + +SubManagers: +
    + <% @module_app.sub_managers.each do |manager|%> + <%= manager.user.name %> + <%end%> +
    +
    + +All User?:<%= @module_app.app_auth.all %>
    +Blocked Users:<%= @module_app.app_auth.blocked_users.collect{|t| t.name} %>
    +Privilege Users:<%= @module_app.app_auth.privilege_users.collect{|t| t.name}%>
    +User Roles:<%= @module_app.app_auth.roles.collect{|t| t.key} %>
    +User Sub Roles:<%= @module_app.app_auth.sub_roles.collect{|t| t.key} %>
    + +Available users after calculation: +<%= @module_app.app_auth.auth_users.collect{|user| user.name}.join(',') %> diff --git a/app/views/admin/object_auths/new.html.erb b/app/views/admin/object_auths/new.html.erb index 25fd6fd5..b5b381fb 100644 --- a/app/views/admin/object_auths/new.html.erb +++ b/app/views/admin/object_auths/new.html.erb @@ -12,7 +12,8 @@

    <%= t('object_auth.new_object_auth') %>

    <%= 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] %> diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index 48b9ac88..6f4c1b7b 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -105,7 +105,7 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController end respond_to do |format| - if @bulletin.update_attributes(params[:bulletin]) + if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) } format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) } format.js { render 'toggle_enable' } diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb new file mode 100644 index 00000000..ef7e1943 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb @@ -0,0 +1,29 @@ +class Panel::Announcement::BackEnd::FactChecksController < ApplicationController + layout 'admin' + + def index + @bulletin_categorys_preview = BulletinCategory.authed_for_user(current_user,'preview') + @bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'check') + end + + def new + + end + + def create + + end + + def update + + end + + def edit + + end + + def destroy + + end + +end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 7c258f23..188142ea 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -4,7 +4,7 @@ class Bulletin include Mongoid::Document include Mongoid::Timestamps include Mongoid::MultiParameterAttributes - + has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb index 0161847d..4e3dd186 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb @@ -3,6 +3,10 @@ class BulletinCategory include Mongoid::Document include Mongoid::Timestamps + include OrbitCoreLib::ObjectAuthable + + ObjectAuthTitlesOptions = %W{preview fact_check} + # include Mongoid::MultiParameterAttributes PAYMENT_TYPES = [ "List", "Picture" ] diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb index 57998770..2e0e7ddf 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb @@ -6,6 +6,12 @@ <% end %>
    + <%= render :partial => 'bulletin', :collection => @bulletins %> - \ No newline at end of file + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index d37d2134..fd2b29b5 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -6,4 +6,3 @@
    <%= 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' %>
    - diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb new file mode 100644 index 00000000..59bac03a --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb @@ -0,0 +1,15 @@ +

    <%= bulletin_category.key %>

    +
    <%= bulletin_category.display %> + <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category) %>
    + <% bulletin_category.object_auths.each do |obj_auth| %> + <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth) %>
    + <% end %> +
    <%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> | <%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> | <%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb index 9fec31f3..bbe383bc 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletins.html.erb @@ -36,4 +36,4 @@
    + + + + + + + + + +<% bulletin_category.bulletins.each do |post| %> + <%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:fact_check_allow=>true} %> +<% end %> +
    <%= t('bulletin.status') %><%= t('bulletin.category') %><%= t('bulletin.title') %><%= t('bulletin.postdate') %><%= t('bulletin.deadline') %><%= t('bulletin.action') %>
    \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb new file mode 100644 index 00000000..65ebeb28 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb @@ -0,0 +1,51 @@ +<% content_for :secondary do %> +
    +
    +
    +
    +
    +
      +
    • <%= link_to t('bulletin.new_announcement'), new_panel_announcement_back_end_bulletin_path %>
    • +
    • <%= link_to t('bulletin.announcement_list'), panel_announcement_back_end_bulletins_path %>
    • +
    • <%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path %>
    • +
    • <%= link_to t('bulletin.my_announcement_fact_check'), panel_announcement_back_end_fact_checks_path %>
    • + +
    +<% end -%> + +<%= flash_messages %> + +
    +
    +
    +
    +
    + +
    <%= t('bulletin.search') %> + + <%= 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 %> + + +
    + +
    +
    + +

    <%= t('bulletin.list_announcement') %>

    + + <%= render :partial => "list_table", :collection => @bulletin_categorys_preview,:as => :bulletin_category%> + + <%= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%> + +
    + diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index c3a60f74..cc877749 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -2,6 +2,7 @@ Rails.application.routes.draw do namespace :panel do namespace :announcement do namespace :back_end do + resources :fact_checks root :to => "bulletins#index" resources :bulletins resources :bulletin_categorys, :controller => 'bulletin_categorys' do @@ -21,4 +22,4 @@ Rails.application.routes.draw do end end end -end \ No newline at end of file +end From cc550c57459bdb3efcddc402096a1101a40d35a3 Mon Sep 17 00:00:00 2001 From: Matthew Kaito Juyuan Fu Date: Wed, 15 Feb 2012 18:20:44 +0800 Subject: [PATCH 08/24] First version for App and Object auth.Taking Announcement as experiment --- .../admin/object_auths_controller.rb | 12 ++++++++-- app/controllers/obit_frontend_controller.rb | 3 --- app/controllers/obit_widget_controller.rb | 3 --- app/controllers/orbit_backend_controller.rb | 24 +++++++++++++++++++ ...=> orbit_frontend_component_controller.rb} | 2 +- app/controllers/orbit_frontend_controller.rb | 3 +++ app/controllers/orbit_widget_controller.rb | 3 +++ app/helpers/admin/app_auth_helper.rb | 5 ++++ app/helpers/admin_helper.rb | 13 ++++++++++ app/models/app_auth.rb | 1 + app/models/module_app.rb | 8 +++++++ app/models/prototype_auth.rb | 2 +- .../admin/module_apps/_app_selector.html.erb | 1 - app/views/admin/object_auths/edit.html.erb | 2 +- config/routes.rb | 2 +- lib/orbit_core_lib.rb | 22 +++++++++++++++++ lib/tasks/anc_tasks.rake | 22 +++++++++++++++++ lib/tasks/dev.rake | 6 +++++ .../announcement/announcement.json | 2 +- .../back_end/fact_checks_controller.rb | 5 ++-- .../app/models/bulletin_category.rb | 2 +- .../_bulletin_category.html.erb | 16 +++++++------ .../back_end/bulletins/index.html.erb | 2 +- .../back_end/fact_checks/index.html.erb | 10 +++++--- .../announcement/config/routes.rb | 1 + .../lib/tasks/announcement_tasks.rake | 4 ---- .../new_blog/front_end/comments_controller.rb | 2 +- .../new_blog/front_end/posts_controller.rb | 2 +- 28 files changed, 146 insertions(+), 34 deletions(-) delete mode 100644 app/controllers/obit_frontend_controller.rb delete mode 100644 app/controllers/obit_widget_controller.rb create mode 100644 app/controllers/orbit_backend_controller.rb rename app/controllers/{obit_frontend_component_controller.rb => orbit_frontend_component_controller.rb} (74%) create mode 100644 app/controllers/orbit_frontend_controller.rb create mode 100644 app/controllers/orbit_widget_controller.rb delete mode 100644 app/views/admin/module_apps/_app_selector.html.erb create mode 100644 lib/tasks/anc_tasks.rake delete mode 100644 vendor/built_in_modules/announcement/lib/tasks/announcement_tasks.rake diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index 3bff4374..573409b6 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -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 @@ -70,7 +74,11 @@ class Admin::ObjectAuthsController < ApplicationController def edit @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 \ No newline at end of file diff --git a/app/controllers/obit_frontend_controller.rb b/app/controllers/obit_frontend_controller.rb deleted file mode 100644 index fb42ac78..00000000 --- a/app/controllers/obit_frontend_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ObitFrontendController< ObitFrontendComponentController - -end \ No newline at end of file diff --git a/app/controllers/obit_widget_controller.rb b/app/controllers/obit_widget_controller.rb deleted file mode 100644 index e0a9746d..00000000 --- a/app/controllers/obit_widget_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ObitWidgetController< ObitFrontendComponentController - -end \ No newline at end of file diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb new file mode 100644 index 00000000..49505c8f --- /dev/null +++ b/app/controllers/orbit_backend_controller.rb @@ -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 + + 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 \ No newline at end of file diff --git a/app/controllers/obit_frontend_component_controller.rb b/app/controllers/orbit_frontend_component_controller.rb similarity index 74% rename from app/controllers/obit_frontend_component_controller.rb rename to app/controllers/orbit_frontend_component_controller.rb index d0be3a25..12695040 100644 --- a/app/controllers/obit_frontend_component_controller.rb +++ b/app/controllers/orbit_frontend_component_controller.rb @@ -1,4 +1,4 @@ -class ObitFrontendComponentController< ApplicationController +class OrbitFrontendComponentController< ApplicationController before_filter :setup_vars before_filter {|c| c.front_end_available(@app_title)} layout 'module_widget' diff --git a/app/controllers/orbit_frontend_controller.rb b/app/controllers/orbit_frontend_controller.rb new file mode 100644 index 00000000..e1be8167 --- /dev/null +++ b/app/controllers/orbit_frontend_controller.rb @@ -0,0 +1,3 @@ +class OrbitFrontendController< OrbitFrontendComponentController + +end \ No newline at end of file diff --git a/app/controllers/orbit_widget_controller.rb b/app/controllers/orbit_widget_controller.rb new file mode 100644 index 00000000..c2be4691 --- /dev/null +++ b/app/controllers/orbit_widget_controller.rb @@ -0,0 +1,3 @@ +class ObitWidgetController< OrbitFrontendComponentController + +end \ No newline at end of file diff --git a/app/helpers/admin/app_auth_helper.rb b/app/helpers/admin/app_auth_helper.rb index fe63a2a6..1a022e94 100644 --- a/app/helpers/admin/app_auth_helper.rb +++ b/app/helpers/admin/app_auth_helper.rb @@ -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 \ No newline at end of file diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 6ae3a213..021687da 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -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 \ No newline at end of file diff --git a/app/models/app_auth.rb b/app/models/app_auth.rb index 5a3de60c..94af40bb 100644 --- a/app/models/app_auth.rb +++ b/app/models/app_auth.rb @@ -2,4 +2,5 @@ class AppAuth < PrototypeAuth belongs_to :module_app + end \ No newline at end of file diff --git a/app/models/module_app.rb b/app/models/module_app.rb index 5d885cd1..7e5e23fd 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -26,6 +26,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 diff --git a/app/models/prototype_auth.rb b/app/models/prototype_auth.rb index 893f402b..6b22a1b3 100644 --- a/app/models/prototype_auth.rb +++ b/app/models/prototype_auth.rb @@ -16,7 +16,7 @@ class PrototypeAuth 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) diff --git a/app/views/admin/module_apps/_app_selector.html.erb b/app/views/admin/module_apps/_app_selector.html.erb deleted file mode 100644 index ae3b2e47..00000000 --- a/app/views/admin/module_apps/_app_selector.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {}, {:rel => admin_module_apps_path } %> diff --git a/app/views/admin/object_auths/edit.html.erb b/app/views/admin/object_auths/edit.html.erb index 67fb026e..fc824a64 100644 --- a/app/views/admin/object_auths/edit.html.erb +++ b/app/views/admin/object_auths/edit.html.erb @@ -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") %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index cd3921f0..ba5acb0a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,7 +16,7 @@ PrototypeR4::Application.routes.draw do resources :app_auths resources :object_auths do collection do - match 'new/:type/:obj_id',:action => 'new',:via => "get",:as => :init + match 'new/:type/:obj_id/:module_app_id',:action => 'new',:via => "get",:as => :init end member do match ':id/create_role',:action => 'create_role',:via => "post",:as => :create_role diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb index bf1d66a3..2520e04c 100644 --- a/lib/orbit_core_lib.rb +++ b/lib/orbit_core_lib.rb @@ -31,4 +31,26 @@ module OrbitCoreLib end end + + module PermissionUnility + private + def check_permission(type = :use) + permission_grant = current_user.admin?? true : false + module_app = @module_app.nil?? ModuleApp.find(params[:module_app_id]) : @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 + + end end diff --git a/lib/tasks/anc_tasks.rake b/lib/tasks/anc_tasks.rake new file mode 100644 index 00000000..3145d119 --- /dev/null +++ b/lib/tasks/anc_tasks.rake @@ -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 \ No newline at end of file diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index ee344743..70776ed9 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -125,6 +125,12 @@ namespace :dev do AttributeValue.create( :user_id => user.id, :attribute_field_id => i_1.attribute_fields[1].id, :key => 'last_name', :en => 'Fu', :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 => '計算機科學' ) + + 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) diff --git a/vendor/built_in_modules/announcement/announcement.json b/vendor/built_in_modules/announcement/announcement.json index 0751a0e7..b23ec572 100644 --- a/vendor/built_in_modules/announcement/announcement.json +++ b/vendor/built_in_modules/announcement/announcement.json @@ -1,5 +1,5 @@ { - "title": "Announcement", + "title": "announcement", "version": "0.1", "organization": "Rulingcom", "author": "RD dep", diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb index ef7e1943..1ef3b300 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb @@ -1,9 +1,10 @@ -class Panel::Announcement::BackEnd::FactChecksController < ApplicationController +class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController + before_filter :authenticate_user! layout 'admin' def index @bulletin_categorys_preview = BulletinCategory.authed_for_user(current_user,'preview') - @bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'check') + @bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'fact_check') end def new diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb index 4e3dd186..d86b17ad 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb @@ -6,7 +6,7 @@ class BulletinCategory include OrbitCoreLib::ObjectAuthable ObjectAuthTitlesOptions = %W{preview fact_check} - + AfterObjectAuthUrl = '/panel/announcement/back_end/bulletin_categorys' # include Mongoid::MultiParameterAttributes PAYMENT_TYPES = [ "List", "Picture" ] diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb index 2e0e7ddf..2cd097ed 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb @@ -5,13 +5,15 @@ <%= bulletin_category.i18n_variable[locale] rescue nil %> <% end %> <%= bulletin_category.display %> - - <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category) %>
    - <% bulletin_category.object_auths.each do |obj_auth| %> - <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth) %>
    - <% end %> - - + <% if is_manager? %> + + <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,@module_app) %>
    + <% bulletin_category.object_auths.each do |obj_auth| %> + <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth) %>
    + <% end %> + + + <% end %> <%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> | <%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> | <%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index fd2b29b5..26e8926c 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -1,4 +1,4 @@ -<%= render 'filter' %> +]<%= render 'filter' %> <%= render 'bulletins' %>
    diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb index 65ebeb28..0f42ed4b 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb @@ -42,10 +42,14 @@

    <%= t('bulletin.list_announcement') %>

    - +
    +

    Preview

    <%= render :partial => "list_table", :collection => @bulletin_categorys_preview,:as => :bulletin_category%> - +
    +=================================================================================================================== +
    +

    Check Please

    <%= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%> - +

    diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index cc877749..b707437e 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -2,6 +2,7 @@ Rails.application.routes.draw do namespace :panel do namespace :announcement do namespace :back_end do + match 'public' => "announcements#public",:as => :public resources :fact_checks root :to => "bulletins#index" resources :bulletins diff --git a/vendor/built_in_modules/announcement/lib/tasks/announcement_tasks.rake b/vendor/built_in_modules/announcement/lib/tasks/announcement_tasks.rake deleted file mode 100644 index f097b1fa..00000000 --- a/vendor/built_in_modules/announcement/lib/tasks/announcement_tasks.rake +++ /dev/null @@ -1,4 +0,0 @@ -# desc "Explaining what the task does" -# task :announcement do -# # Task goes here -# end diff --git a/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/comments_controller.rb b/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/comments_controller.rb index 769f4665..9bb61778 100644 --- a/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/comments_controller.rb +++ b/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/comments_controller.rb @@ -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]) diff --git a/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/posts_controller.rb b/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/posts_controller.rb index 1aeb34b2..48b0c1c5 100644 --- a/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/posts_controller.rb +++ b/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/front_end/posts_controller.rb @@ -1,4 +1,4 @@ -class Panel::NewBlog::FrontEnd::PostsController < ObitFrontendController +class Panel::NewBlog::FrontEnd::PostsController < OrbitFrontendController # GET /posts # GET /posts.xml def index From 2e58c63ff7d787eac3f92c10033fd3d63b5d690c Mon Sep 17 00:00:00 2001 From: Matthew Kaito Juyuan Fu Date: Thu, 16 Feb 2012 13:57:28 +0800 Subject: [PATCH 09/24] fix bugs with token --- app/controllers/orbit_backend_controller.rb | 1 - app/models/module_app.rb | 4 +++- app/models/object_auth.rb | 2 +- app/models/prototype_auth.rb | 5 ++--- .../components/_user_role_management.html.erb | 3 ++- config/routes.rb | 2 +- lib/orbit_core_lib.rb | 22 +++++++++++++++++-- .../_bulletin_category.html.erb | 4 ++-- 8 files changed, 31 insertions(+), 12 deletions(-) diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index 49505c8f..d3639ebe 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -10,7 +10,6 @@ class OrbitBackendController< ApplicationController def setup_vars @app_title = request.fullpath.split('/')[2] @module_app = ModuleApp.first(conditions: {:key => @app_title} ) - end private diff --git a/app/models/module_app.rb b/app/models/module_app.rb index 7e5e23fd..7ad4ac1d 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -1,6 +1,7 @@ class ModuleApp include Mongoid::Document include Mongoid::Timestamps + include OrbitCoreLib::ObjectTokenUnility field :key field :title @@ -14,7 +15,7 @@ class ModuleApp field :app_pages ,type: Array field :widgets ,type: Array - + has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app @@ -81,5 +82,6 @@ class ModuleApp def set_key self.key = self.title.underscore if self.title end + end diff --git a/app/models/object_auth.rb b/app/models/object_auth.rb index dab7acc7..f67f9984 100644 --- a/app/models/object_auth.rb +++ b/app/models/object_auth.rb @@ -1,5 +1,5 @@ class ObjectAuth < PrototypeAuth - + include OrbitCoreLib::ObjectTokenUnility belongs_to :obj_authable, polymorphic: true # > - Something.find_with_auth(query) # > - or Something.find(query).auth diff --git a/app/models/prototype_auth.rb b/app/models/prototype_auth.rb index 6b22a1b3..666bc7a8 100644 --- a/app/models/prototype_auth.rb +++ b/app/models/prototype_auth.rb @@ -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,12 +11,13 @@ 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 + + def add_role role add_operation(:roles,role) end @@ -87,7 +87,6 @@ class PrototypeAuth auth_users_before_block_list - self.blocked_users end - # protected end \ No newline at end of file diff --git a/app/views/admin/components/_user_role_management.html.erb b/app/views/admin/components/_user_role_management.html.erb index 59307351..ed7c3476 100644 --- a/app/views/admin/components/_user_role_management.html.erb +++ b/app/views/admin/components/_user_role_management.html.erb @@ -1,5 +1,7 @@

    User Role

    + All User + <%= form_tag(submit_url) do %> <%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %> <%= submit_tag 'Add Role' %>
    @@ -10,7 +12,6 @@ <%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %> <%= submit_tag 'Add BlockedList' %>
    <% end %> -
      Roles
    <% unless auth.nil? %> <% auth.roles.each do |role| %>
  • <%= role.key %> Build in:<%= role.built_in ? 'Yes' : 'No' %> diff --git a/config/routes.rb b/config/routes.rb index ba5acb0a..cd3921f0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,7 +16,7 @@ PrototypeR4::Application.routes.draw do resources :app_auths resources :object_auths do collection do - match 'new/:type/:obj_id/:module_app_id',:action => 'new',:via => "get",:as => :init + match 'new/:type/:obj_id',:action => 'new',:via => "get",:as => :init end member do match ':id/create_role',:action => 'create_role',:via => "post",:as => :create_role diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb index 2520e04c..561fceba 100644 --- a/lib/orbit_core_lib.rb +++ b/lib/orbit_core_lib.rb @@ -31,12 +31,28 @@ 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?? ModuleApp.find(params[:module_app_id]) : @module_app + module_app = @module_app.nil?? find_module_app_by_token(params[:token]) : @module_app unless permission_grant permission_grant = case type when :use @@ -51,6 +67,8 @@ module OrbitCoreLib end permission_grant end - + def find_module_app_by_token(token) + ModuleApp.first(conditions: {s_token: token}) + end end end diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb index 2cd097ed..e834ec60 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb @@ -7,9 +7,9 @@ <%= bulletin_category.display %> <% if is_manager? %> - <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,@module_app) %>
    + <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,:token => @module_app.token) %>
    <% bulletin_category.object_auths.each do |obj_auth| %> - <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth) %>
    + <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth,:token => @module_app.token) %>
    <% end %> From 8932615f0599f254ffde33ede5d39e1e2958708f Mon Sep 17 00:00:00 2001 From: Matthew Kaito Juyuan Fu Date: Thu, 16 Feb 2012 14:59:26 +0800 Subject: [PATCH 10/24] add "all_user" for app&object auth --- app/controllers/admin/app_auths_controller.rb | 5 ++++- app/controllers/admin/object_auths_controller.rb | 5 ++++- .../admin/components/_user_role_management.html.erb | 9 +++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/app_auths_controller.rb b/app/controllers/admin/app_auths_controller.rb index 56d0ae23..9e980e53 100644 --- a/app/controllers/admin/app_auths_controller.rb +++ b/app/controllers/admin/app_auths_controller.rb @@ -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!='' diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index 573409b6..a7a8dc41 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -33,7 +33,10 @@ class Admin::ObjectAuthsController < ApplicationController 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!='' diff --git a/app/views/admin/components/_user_role_management.html.erb b/app/views/admin/components/_user_role_management.html.erb index ed7c3476..99cd72d7 100644 --- a/app/views/admin/components/_user_role_management.html.erb +++ b/app/views/admin/components/_user_role_management.html.erb @@ -1,7 +1,12 @@ +
    +

    All User

    + <%= form_tag(submit_url) do %> + <%= check_box_tag 'auth_all',true,auth.all %><%= submit_tag 'Add Role' %>
    + <% end %> +
    +

    User Role

    - All User - <%= form_tag(submit_url) do %> <%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %> <%= submit_tag 'Add Role' %>
    From cceb785a8ddbe2f608d45f3c11a44283ad3cef43 Mon Sep 17 00:00:00 2001 From: Matt Fu Date: Fri, 17 Feb 2012 17:50:23 +0800 Subject: [PATCH 11/24] change view and action for announcement ,Lin checked. Also add validation for object_auth make sure for each object,the object will be unique for each action. --- .../admin/module_apps_controller.rb | 4 ++-- .../admin/object_auths_controller.rb | 9 ++++++-- app/models/object_auth.rb | 1 + .../components/_user_role_management.html.erb | 2 +- lib/tasks/user.rake | 2 +- .../back_end/bulletins_controller.rb | 7 ++++++- .../back_end/fact_checks_controller.rb | 12 +++++++++-- .../app/models/bulletin_category.rb | 2 +- .../bulletin_categorys/index.html.erb | 21 +++++++------------ .../back_end/bulletin_categorys/new.html.erb | 16 +++++++------- .../back_end/bulletins/edit.html.erb | 2 +- .../back_end/bulletins/index.html.erb | 2 +- .../back_end/bulletins/new.html.erb | 3 +-- .../back_end/bulletins/show.html.erb | 10 ++++++--- .../back_end/fact_checks/index.html.erb | 19 ++--------------- .../announcement/config/routes.rb | 1 + 16 files changed, 58 insertions(+), 55 deletions(-) diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb index 440f8100..13075a42 100644 --- a/app/controllers/admin/module_apps_controller.rb +++ b/app/controllers/admin/module_apps_controller.rb @@ -101,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 @@ -113,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 \ No newline at end of file diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index a7a8dc41..58219acf 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -27,8 +27,13 @@ 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] - redirect_to edit_admin_object_auth_path(@object_auth) + @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 diff --git a/app/models/object_auth.rb b/app/models/object_auth.rb index f67f9984..8932bb76 100644 --- a/app/models/object_auth.rb +++ b/app/models/object_auth.rb @@ -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 diff --git a/app/views/admin/components/_user_role_management.html.erb b/app/views/admin/components/_user_role_management.html.erb index 99cd72d7..cd9ca8ae 100644 --- a/app/views/admin/components/_user_role_management.html.erb +++ b/app/views/admin/components/_user_role_management.html.erb @@ -1,7 +1,7 @@

    All User

    <%= form_tag(submit_url) do %> - <%= check_box_tag 'auth_all',true,auth.all %><%= submit_tag 'Add Role' %>
    + <%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag 'Add Role' %>
    <% end %>
    diff --git a/lib/tasks/user.rake b/lib/tasks/user.rake index 31ed7c24..5189ee14 100644 --- a/lib/tasks/user.rake +++ b/lib/tasks/user.rake @@ -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{ 一一 二二 三三 四四 五五 六六 七七 } diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index 6f4c1b7b..53cc5f3d 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -145,7 +145,12 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController protected 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 end def get_sorted_bulletins diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb index 1ef3b300..dd471958 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb @@ -1,10 +1,18 @@ class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController before_filter :authenticate_user! + include AdminHelper layout 'admin' def index - @bulletin_categorys_preview = BulletinCategory.authed_for_user(current_user,'preview') - @bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'fact_check') + @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 diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb index d86b17ad..7daaf6db 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb @@ -5,7 +5,7 @@ class BulletinCategory include Mongoid::Timestamps include OrbitCoreLib::ObjectAuthable - ObjectAuthTitlesOptions = %W{preview fact_check} + ObjectAuthTitlesOptions = %W{submit_new fact_check} AfterObjectAuthUrl = '/panel/announcement/back_end/bulletin_categorys' # include Mongoid::MultiParameterAttributes diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb index 87a2993c..87b30a04 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb @@ -1,22 +1,17 @@ <% content_for :secondary do %> -
    -
    -
    -
    -
    -
      -
    • <%#= link_to t('bulletin_category.new_announcement_class'), new_panel_announcement_back_end_bulletin_category_path, :class => 'seclink1' %>
    • -
    +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> <% end -%> <%= flash_messages %> +
    +
    +
    +
    +
    +

    <%= t('bulletin_category.list_announcement_class') %>

    -
    -
    -
    -
    -
    + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.html.erb index 5f8d064b..296afb09 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/new.html.erb @@ -1,15 +1,15 @@ -
    -
    -
    -
    - <% content_for :secondary do %> -
      -
    • <%= link_to t('bulletin_category.index'), panel_announcement_back_end_bulletin_categorys_path, :class => 'seclink2' %>
    • -
    +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> <% end -%> <%= flash_messages %> + +
    +
    +
    +
    +
    +

    <%= t('bulletin_category.new_announcement_class') %>

    <%= form_for @bulletin_category, :url => panel_announcement_back_end_bulletin_categorys_path do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb index 345a60a9..56cfd258 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/edit.html.erb @@ -4,4 +4,4 @@ <%= render :partial => 'form', :locals => {:f => f} %> <% end %> -<%= link_back %> \ No newline at end of file +<%= link_back %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index 26e8926c..fd2b29b5 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -1,4 +1,4 @@ -]<%= render 'filter' %> +<%= render 'filter' %>
    <%= t('bulletin_category.key') %>
    <%= render 'bulletins' %>
    diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb index ab0191ab..74e1291a 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/new.html.erb @@ -1,6 +1,5 @@ - <%= form_for @bulletin, :url => panel_announcement_back_end_bulletins_path do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> <% end %> -<%= link_back %> \ No newline at end of file +<%= link_back %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb index f02d9156..7b886e77 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb @@ -1,10 +1,14 @@ -<% # encoding: utf-8 %> +<% content_for :secondary do %> +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> +<% end -%> + +<%= flash_messages %>


    - -

    <%= flash_messages %>

    +
    +
    • diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb index 0f42ed4b..6f878b06 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb @@ -1,16 +1,5 @@ <% content_for :secondary do %> -
      -
      -
      -
      -
      -
        -
      • <%= link_to t('bulletin.new_announcement'), new_panel_announcement_back_end_bulletin_path %>
      • -
      • <%= link_to t('bulletin.announcement_list'), panel_announcement_back_end_bulletins_path %>
      • -
      • <%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path %>
      • -
      • <%= link_to t('bulletin.my_announcement_fact_check'), panel_announcement_back_end_fact_checks_path %>
      • - -
      +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> <% end -%> <%= flash_messages %> @@ -42,11 +31,7 @@

      <%= t('bulletin.list_announcement') %>

      -
      -

      Preview

      - <%= render :partial => "list_table", :collection => @bulletin_categorys_preview,:as => :bulletin_category%> -
      -=================================================================================================================== +

      Check Please

      <%= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%> diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index b707437e..78425f33 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -4,6 +4,7 @@ Rails.application.routes.draw do namespace :back_end do match 'public' => "announcements#public",:as => :public resources :fact_checks + match 'list_mine' => "announcements#list_mine" root :to => "bulletins#index" resources :bulletins resources :bulletin_categorys, :controller => 'bulletin_categorys' do From ebf3a2eae451ec7e38fcfd1e21533322f90999f3 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 1 Mar 2012 10:57:13 +0800 Subject: [PATCH 12/24] Fix extra loaded js: the widgets only need to render layout when they need js. --- app/controllers/obit_frontend_component_controller.rb | 2 +- .../panel/announcement/widget/bulletins_controller.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/obit_frontend_component_controller.rb b/app/controllers/obit_frontend_component_controller.rb index d0be3a25..2c44b60c 100644 --- a/app/controllers/obit_frontend_component_controller.rb +++ b/app/controllers/obit_frontend_component_controller.rb @@ -1,7 +1,7 @@ class ObitFrontendComponentController< 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] diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb index 6695156a..333f88e7 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb @@ -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 From 9ae140204f62bae987fddd1fb3eb393e1880bd89 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 1 Mar 2012 10:58:31 +0800 Subject: [PATCH 13/24] Fix announcement pagination in front-end --- app/controllers/pages_controller.rb | 6 +++++- lib/parsers/parser_back_end.rb | 2 +- lib/parsers/parser_front_end.rb | 2 +- .../panel/announcement/front_end/bulletins_controller.rb | 6 +++--- .../panel/announcement/front_end/bulletins/index.html.erb | 4 ++-- vendor/built_in_modules/announcement/config/routes.rb | 1 - 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index aa66238d..8ea35391 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -30,7 +30,11 @@ class PagesController < ApplicationController end def index_from_link - redirect_to "/#{@item.full_name}" + if params[:page] + redirect_to "/#{@item.full_name}?page=#{params[:page]}" + else + redirect_to "/#{@item.full_name}" + end end def show_from_link diff --git a/lib/parsers/parser_back_end.rb b/lib/parsers/parser_back_end.rb index dea65b6a..37c22ed1 100644 --- a/lib/parsers/parser_back_end.rb +++ b/lib/parsers/parser_back_end.rb @@ -100,7 +100,7 @@ module ParserBackEnd ret = '' if (tag.attributes["main"] == "true" && !page.module_app.nil?) ret << "
      " else part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index 305596ed..17468e54 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -127,7 +127,7 @@ module ParserFrontEnd ret << "
      " else part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index b71a4609..e840d65f 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -11,15 +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[:bulletin_category_id]) rescue nil + @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil end def show diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb index d4335e9a..086794b9 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb @@ -28,6 +28,6 @@ <% end %> - -<%= paginate @bulletins %> + +<%= paginate @bulletins, :params => {:inner => 'false'} %> diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index c3a60f74..a604da85 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -10,7 +10,6 @@ Rails.application.routes.draw do resources :tags end namespace :front_end do - root :to => "bulletins#index" resources :bulletins end namespace :widget do From 826a5a5f20f158237dc49b36e3692183111f31d5 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 1 Mar 2012 14:12:47 +0800 Subject: [PATCH 14/24] Fix link in widget --- .../panel/announcement/widget/bulletins/_web_links.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb index 3a6982dc..2b65417d 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb @@ -1,6 +1,6 @@ <% @web_links.each do |web_link| %>
    • - <%= web_link.name[I18n.locale] %> + <%= link_to web_link.name[I18n.locale], web_link.url %>
    • <% end %> From 900855724c4e06984b3291fe4bdae46399f94b24 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 7 Mar 2012 11:37:00 +0800 Subject: [PATCH 15/24] Add bootstrap-orbit.css in front-end --- lib/parsers/parser_front_end.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index 17468e54..99353cc1 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -62,6 +62,7 @@ module ParserFrontEnd c.define_tag 'stylesheets' do |tag| res = '' res << "" + res << "" res << "" res << "" if page.design.reset_css res << " " if page.design.default_css From 0b1f83c042edae823005eb22f0cf9e677d78d01a Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 1 Mar 2012 10:57:13 +0800 Subject: [PATCH 16/24] Fix extra loaded js: the widgets only need to render layout when they need js. --- app/controllers/orbit_frontend_component_controller.rb | 2 +- .../panel/announcement/widget/bulletins_controller.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/orbit_frontend_component_controller.rb b/app/controllers/orbit_frontend_component_controller.rb index 12695040..185dbce6 100644 --- a/app/controllers/orbit_frontend_component_controller.rb +++ b/app/controllers/orbit_frontend_component_controller.rb @@ -1,7 +1,7 @@ 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] diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb index 6695156a..333f88e7 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb @@ -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 From 4dd9b7ffa43b873db2cdba66163dceb0b24f14f4 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 1 Mar 2012 10:58:31 +0800 Subject: [PATCH 17/24] Fix announcement pagination in front-end --- app/controllers/pages_controller.rb | 6 +++++- lib/parsers/parser_back_end.rb | 2 +- lib/parsers/parser_front_end.rb | 2 +- .../panel/announcement/front_end/bulletins_controller.rb | 6 +++--- .../panel/announcement/front_end/bulletins/index.html.erb | 4 ++-- vendor/built_in_modules/announcement/config/routes.rb | 1 - 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index aa66238d..8ea35391 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -30,7 +30,11 @@ class PagesController < ApplicationController end def index_from_link - redirect_to "/#{@item.full_name}" + if params[:page] + redirect_to "/#{@item.full_name}?page=#{params[:page]}" + else + redirect_to "/#{@item.full_name}" + end end def show_from_link diff --git a/lib/parsers/parser_back_end.rb b/lib/parsers/parser_back_end.rb index dea65b6a..37c22ed1 100644 --- a/lib/parsers/parser_back_end.rb +++ b/lib/parsers/parser_back_end.rb @@ -100,7 +100,7 @@ module ParserBackEnd ret = '' if (tag.attributes["main"] == "true" && !page.module_app.nil?) ret << "
      " else part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index 305596ed..17468e54 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -127,7 +127,7 @@ module ParserFrontEnd ret << "
      " else part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index b71a4609..e840d65f 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -11,15 +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[:bulletin_category_id]) rescue nil + @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil end def show diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb index d4335e9a..086794b9 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb @@ -28,6 +28,6 @@ <% end %> - -<%= paginate @bulletins %> + +<%= paginate @bulletins, :params => {:inner => 'false'} %> diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index 78425f33..cb39d253 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -13,7 +13,6 @@ Rails.application.routes.draw do resources :tags end namespace :front_end do - root :to => "bulletins#index" resources :bulletins end namespace :widget do From 79c8b3861b3e92aef8493da22858aa7b340429e9 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 1 Mar 2012 14:12:47 +0800 Subject: [PATCH 18/24] Fix link in widget --- .../panel/announcement/widget/bulletins/_web_links.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb index 3a6982dc..2b65417d 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb @@ -1,6 +1,6 @@ <% @web_links.each do |web_link| %>
    • - <%= web_link.name[I18n.locale] %> + <%= link_to web_link.name[I18n.locale], web_link.url %>
    • <% end %> From 3e22c6e61b79bf379deca7fff08190ee083cdf54 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 7 Mar 2012 11:37:00 +0800 Subject: [PATCH 19/24] Add bootstrap-orbit.css in front-end --- lib/parsers/parser_front_end.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index 17468e54..99353cc1 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -62,6 +62,7 @@ module ParserFrontEnd c.define_tag 'stylesheets' do |tag| res = '' res << "" + res << "" res << "" res << "" if page.design.reset_css res << " " if page.design.default_css From 13b6892f873e625aeff2ce7b640b2a2d9ee4d586 Mon Sep 17 00:00:00 2001 From: Matt Fu Date: Fri, 16 Mar 2012 11:09:44 +0800 Subject: [PATCH 20/24] code for new fact check --- app/controllers/orbit_backend_controller.rb | 1 + app/views/layouts/_side_bar.html.erb | 1 + lib/tasks/anc_tasks.rake | 12 +-- .../back_end/bulletins_controller.rb | 7 +- .../back_end/fact_checks_controller.rb | 92 +++++++++++++------ .../announcement/app/models/bulletin.rb | 3 + .../back_end/bulletins/_bulletin.html.erb | 5 +- .../back_end/bulletins/_form.html.erb | 13 ++- .../back_end/bulletins/_quick_edit.html.erb | 10 +- .../back_end/bulletins/index.html.erb | 1 - .../back_end/fact_checks/_list_table.html.erb | 15 --- .../back_end/fact_checks/index.html.erb | 40 -------- .../announcement/config/locales/en.yml | 6 ++ .../announcement/config/locales/zh_tw.yml | 7 ++ .../announcement/config/routes.rb | 5 +- 15 files changed, 114 insertions(+), 104 deletions(-) delete mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb delete mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index d3639ebe..b52384c6 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -4,6 +4,7 @@ class OrbitBackendController< ApplicationController # before_filter {|c| c.front_end_available(@app_title)} before_filter :check_user_can_use,:except => [:public] include OrbitCoreLib::PermissionUnility + include AdminHelper layout 'admin' diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 33e41597..d287e46c 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -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 -%> diff --git a/lib/tasks/anc_tasks.rake b/lib/tasks/anc_tasks.rake index 3145d119..cd534b93 100644 --- a/lib/tasks/anc_tasks.rake +++ b/lib/tasks/anc_tasks.rake @@ -11,12 +11,12 @@ namespace :anc do 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 ) + 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 \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index dcd3de04..e8eb6149 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -1,5 +1,4 @@ -class Panel::Announcement::BackEnd::BulletinsController < ApplicationController - +class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController layout 'new_admin' before_filter :authenticate_user! @@ -151,7 +150,6 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController elsif is_sub_manager? @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') end -<<<<<<< HEAD end def get_sorted_bulletins @@ -196,8 +194,7 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController a.flatten! a.uniq end -======= ->>>>>>> 26cd6951dba43b1f6eaf5056160309c5c77a8716 + end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb index dd471958..c47e91fb 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/fact_checks_controller.rb @@ -1,38 +1,76 @@ class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController before_filter :authenticate_user! include AdminHelper - layout 'admin' + # layout 'admin' + layout 'new_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') + 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 new + def update_setting end - - def create - + # 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 - - def update - - end - - def edit - - end - - def destroy - - end - end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 188142ea..e68e2c97 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -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 diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb index 3f6f50e1..e12af233 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb @@ -24,11 +24,12 @@
  • +
  • <%= link_to t('bulletin.fact_check'), edit_panel_announcement_back_end_bulletin_path(bulletin) %>
  • <%#= #TODO add ancher so user can quick access into that part %>
    <%= bulletin.bulletin_category.i18n_variable[I18n.locale] %> - <%= link_to bulletin.title[I18n.locale], panel_announcement_back_end_bulletin_path(bulletin) %> + <%= link_to bulletin.title[I18n.locale], panel_announcement_back_end_bulletin_path(bulletin) rescue ''%> <%= bulletin.postdate %> <%= (bulletin.deadline) ? bulletin.deadline : t('bulletin.no_deadline') %> @@ -36,7 +37,7 @@ <%= tag[I18n.locale] %> <% end %> - <%= User.from_id(bulletin.update_user_id).name %> + <%= User.from_id(bulletin.update_user_id).name rescue ''%> <%= render :partial => 'quick_edit', :locals => {:bulletin => bulletin} %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 751a5f12..2236b5ed 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -2,7 +2,16 @@ <%= f.error_messages %> <%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> - +
    + <%= 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 %> +
    <%= f.label :image, t('announcement.image') %>
    <%= f.file_field :image %> @@ -523,6 +532,8 @@
    --> + + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb index 91726d88..96e8237c 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit.html.erb @@ -3,11 +3,11 @@ <%= t(:quick_edit) %> - Basic / Picture / Tags / Link / File <%= 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 } %>
    <%= f.submit t(:submit), :class => 'btn btn-primary' %> <%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index fd2b29b5..c833297a 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -2,7 +2,6 @@ <%= render 'bulletins' %>
    -
    <%= 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' %>
    diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb deleted file mode 100644 index 59bac03a..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_list_table.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -

    <%= bulletin_category.key %>

    - - - - - - - - - - -<% bulletin_category.bulletins.each do |post| %> - <%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:fact_check_allow=>true} %> -<% end %> -
    <%= t('bulletin.status') %><%= t('bulletin.category') %><%= t('bulletin.title') %><%= t('bulletin.postdate') %><%= t('bulletin.deadline') %><%= t('bulletin.action') %>
    \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb deleted file mode 100644 index 6f878b06..00000000 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/index.html.erb +++ /dev/null @@ -1,40 +0,0 @@ -<% content_for :secondary do %> -<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> -<% end -%> - -<%= flash_messages %> - -
    -
    -
    -
    -
    - -
    <%= t('bulletin.search') %> - - <%= 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 %> - - -
    - -
    -
    - -

    <%= t('bulletin.list_announcement') %>

    - -
    -

    Check Please

    - <%= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%> -
    -
    - diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml index 1f544b28..6143b177 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -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 diff --git a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml index a9da545b..e2dfd957 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -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: 新增語言 diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index cb39d253..f6f30b31 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -3,8 +3,9 @@ Rails.application.routes.draw do namespace :announcement do namespace :back_end do match 'public' => "announcements#public",:as => :public - resources :fact_checks - match 'list_mine' => "announcements#list_mine" + 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 resources :bulletin_categorys, :controller => 'bulletin_categorys' do From b6d49df1453c8c3c0f6b0a080c2b0f3805030bac Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Fri, 16 Mar 2012 11:20:16 +0800 Subject: [PATCH 21/24] Change Obit to Orbit --- app/controllers/orbit_widget_controller.rb | 2 +- .../panel/announcement/back_end/bulletins_controller.rb | 1 - .../panel/announcement/front_end/bulletins_controller.rb | 2 +- .../panel/announcement/widget/bulletins_controller.rb | 2 +- .../app/controllers/panel/new_blog/widget/posts_controller.rb | 2 +- .../panel/page_content/front_end/page_contexts_controller.rb | 2 +- .../panel/web_resource/front_end/web_links_controller.rb | 2 +- .../panel/web_resource/widget/web_links_controller.rb | 2 +- 8 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/controllers/orbit_widget_controller.rb b/app/controllers/orbit_widget_controller.rb index c2be4691..47e24fe0 100644 --- a/app/controllers/orbit_widget_controller.rb +++ b/app/controllers/orbit_widget_controller.rb @@ -1,3 +1,3 @@ -class ObitWidgetController< OrbitFrontendComponentController +class OrbitWidgetController< OrbitFrontendComponentController end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index e8eb6149..c6eb0180 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -194,7 +194,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController a.flatten! a.uniq end - end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index e840d65f..ff3cbdc9 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -1,4 +1,4 @@ -class Panel::Announcement::FrontEnd::BulletinsController < ObitWidgetController +class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController def initialize super diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb index 333f88e7..60aad3d9 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb @@ -1,4 +1,4 @@ -class Panel::Announcement::Widget::BulletinsController < ObitWidgetController +class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController def initialize super diff --git a/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/widget/posts_controller.rb b/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/widget/posts_controller.rb index dab532ee..73098dda 100644 --- a/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/widget/posts_controller.rb +++ b/vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/widget/posts_controller.rb @@ -1,4 +1,4 @@ -class Panel::NewBlog::Widget::PostsController < ObitWidgetController +class Panel::NewBlog::Widget::PostsController < OrbitWidgetController # GET /posts # GET /posts.xml def index diff --git a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb index 8b750dcc..5b46866b 100644 --- a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb +++ b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb @@ -1,4 +1,4 @@ -class Panel::PageContent::FrontEnd::PageContextsController < ObitWidgetController +class Panel::PageContent::FrontEnd::PageContextsController < OrbitWidgetController def initialize super diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/front_end/web_links_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/front_end/web_links_controller.rb index c230140d..54374ed3 100644 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/front_end/web_links_controller.rb +++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/front_end/web_links_controller.rb @@ -1,4 +1,4 @@ -class Panel::WebResource::FrontEnd::WebLinksController < ObitWidgetController +class Panel::WebResource::FrontEnd::WebLinksController < OrbitWidgetController def initialize super diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb index bbe4a8d9..750897ae 100644 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb +++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb @@ -1,4 +1,4 @@ -class Panel::WebResource::Widget::WebLinksController < ObitWidgetController +class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController def initialize super From 6f6e84b0157e301f117bcd28aa867b1ef4eec96a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Mar 2012 20:05:03 +0800 Subject: [PATCH 22/24] fix dashboard & announcement --- app/assets/javascripts/bulletin_form.js.erb | 3 +- app/views/layouts/_side_bar.html.erb | 14 +- .../back_end/bulletins_controller.rb | 51 ++- .../announcement/app/models/bulletin.rb | 26 +- .../announcement/app/models/bulletin_file.rb | 22 +- .../announcement/app/models/bulletin_link.rb | 8 +- .../_bulletin_category.html.erb | 40 ++- .../bulletin_categorys/_form.html.erb | 54 +-- .../bulletin_categorys/_quick_edit.html.erb | 13 + .../_quick_edit_qe.html.erb | 28 ++ .../bulletin_categorys/index.html.erb | 41 +-- .../bulletins/_bulletin_file.html.erb | 16 +- .../bulletins/_bulletin_link.html - ƻs.erb | 27 ++ .../bulletins/_bulletin_link.html.erb | 10 +- .../bulletins/_bulletin_link2.html - ƻs.erb | 16 + .../bulletins/_bulletin_link2.html.erb | 17 + .../bulletins/_bulletin_link_qe.html.erb | 41 +++ .../back_end/bulletins/_form.html.erb | 322 +++++++++++++----- .../bulletins/_quick_edit_links.html.erb | 34 +- .../bulletins/_quick_edit_picture.html.erb | 13 +- .../back_end/bulletins/index.html - ƻs.erb | 9 + .../back_end/bulletins/link_quick_edit.js.erb | 2 + .../back_end/bulletins/show.html.erb | 10 +- .../announcement/config/routes.rb | 5 +- .../back_end/page_contexts/_form.html.erb | 51 +-- .../page_contexts/_page_context.html.erb | 22 +- .../page_contexts/_view_page_context.html.erb | 23 +- .../back_end/page_contexts/edit.html.erb | 10 +- .../back_end/page_contexts/index.html.erb | 42 +-- .../back_end/page_contexts/view.html.erb | 41 +-- .../back_end/web_link_categorys_controller.rb | 2 +- .../back_end/web_links_controller.rb | 2 +- .../web_link_categorys/_form.html.erb | 38 ++- .../_web_link_category.html.erb | 26 +- .../web_link_categorys/index.html.erb | 46 +-- .../back_end/web_links/_form.html.erb | 145 +++++--- .../back_end/web_links/_web_links.html.erb | 17 +- .../back_end/web_links/index.html.erb | 59 +--- 38 files changed, 849 insertions(+), 497 deletions(-) create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html - ƻs.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html - ƻs.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html - ƻs.erb create mode 100644 vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_edit.js.erb diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index 5002cfae..17f86060 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -1,4 +1,4 @@ -$('.bulletin_urls_block a.delete').live('click', function(){ +$('.bulletin_links_block a.delete').live('click', function(){ $(this).parents('.list_item').remove(); }); @@ -9,4 +9,5 @@ $('.bulletin_files_block a.delete').live('click', function(){ $('.action a.remove_existing_record').live('click', function(){ $(this).next('.should_destroy').attr('value', 1); $("#bulletin_" + $(this).prev().attr('value')).hide(); + $("tr#bulletin_" + $(this).prev().attr('value')).hide(); }); \ No newline at end of file diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index d287e46c..44f448fd 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -17,17 +17,25 @@ <%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %> <% end -%> -<%= content_tag :li, :class => active_for_controllers(nil) do -%> +<%= content_tag :li, :class => active_for_controllers('page_contexts') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), panel_page_content_back_end_page_contexts_path %> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('page_contexts')) do -%> + <%= content_tag :li, link_to(t('admin.all_articles'), panel_page_content_back_end_page_contexts_path), :class => active_for_action('page_context', 'index') %> + <% end -%> <% end -%> <%= content_tag :li, :class => active_for_controllers('designs') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %> <% end -%> -<%= content_tag :li, :class => active_for_controllers(nil) do -%> +<%= content_tag :li, :class => active_for_controllers('web_links', 'tags', 'web_link_categorys') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %> -<% end -%> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', 'tags', 'web_link_categorys')) do -%> + <%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %> + <%= content_tag :li, link_to(t('admin.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %> + <%= content_tag :li, link_to(t('admin.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %> + <%= content_tag :li, link_to(t('admin.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('tags', 'index') %> + <% end -%> <%= content_tag :li, :class => active_for_controllers(nil) do -%> <%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), nil %> diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index c6eb0180..8b86a7a4 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -8,6 +8,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # @bulletins = Bulletin.all # @bulletins = Bulletin.desc("postdate desc") get_categorys(params[:bulletin_category_id]) + get_tags # @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id] @@ -15,9 +16,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]]) @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 @@ -30,6 +28,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # GET /bulletins/1.xml def show @bulletin = Bulletin.find(params[:id]) + get_tags # get_categorys # @bulletin_categorys = BulletinCategory.where("_id" => params[:id]) @@ -50,11 +49,14 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # GET /bulletins/new.xml def new @bulletin = Bulletin.new + + @link_url = panel_announcement_back_end_bulletins_path # @bulletin.bulletin_files.build # @bulletin.bulletin_files.new get_categorys + get_tags respond_to do |format| format.html # new.html.erb @@ -66,7 +68,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController def edit @bulletin = Bulletin.find(params[:id]) # @summary_variable = @bulletin.summary_variable + + @link_url = panel_announcement_back_end_bulletin_path(@bulletin) + get_categorys + get_tags end # POST /bulletins @@ -89,6 +95,32 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController end end + def link_quick_add + # debugger + + @bulletin = Bulletin.find(params[:bulletin_id]) + + @link_url = panel_announcement_back_end_bulletins_path + + respond_to do |format| + format.js + end + + end + + def link_quick_edit + # debugger + + @bulletin = Bulletin.find(params[:bulletin_id]) + + @link_url = panel_announcement_back_end_bulletin_path(@bulletin) + + respond_to do |format| + format.js + end + + end + # PUT /bulletins/1 # PUT /bulletins/1.xml def update @@ -97,11 +129,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @bulletin.update_user_id = current_user.id # @bulletin.image.clear if params[:bulletin][:image_del] == '1' - if params[:bulletin][:image_del] == '1' - @bulletin.remove_image! + # if params[:bulletin][:image_del] == '1' + # @bulletin.remove_image! # @bulletin.image_del = nil - params[:bulletin][:image_del] = nil - end + # params[:bulletin][:image_del] = nil + # end respond_to do |format| if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save @@ -151,6 +183,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @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_sorted_bulletins bulletins = Bulletin.all diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index e68e2c97..d1b7f3c5 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -29,10 +29,11 @@ class Bulletin belongs_to :bulletin_category - embeds_many :bulletin_links, :cascade_callbacks => true - embeds_many :bulletin_files, :cascade_callbacks => true + # embeds_many :bulletin_links, :cascade_callbacks => true + # embeds_many :bulletin_files, :cascade_callbacks => true - # has_many :bulletin_files, :autosave => true, :dependent => :destroy + has_many :bulletin_links, :autosave => true, :dependent => :destroy + has_many :bulletin_files, :autosave => true, :dependent => :destroy accepts_nested_attributes_for :bulletin_files, :allow_destroy => true accepts_nested_attributes_for :bulletin_links, :allow_destroy => true @@ -41,6 +42,9 @@ class Bulletin before_save :set_key + after_save :save_bulletin_links + after_save :save_bulletin_files + def self.search( search = nil, category_id = nil ) @@ -97,6 +101,22 @@ class Bulletin self.is_hidden end + def save_bulletin_links + self.bulletin_links.each do |t| + if t.should_destroy + t.destroy + end + end + end + + def save_bulletin_files + self.bulletin_files.each do |t| + if t.should_destroy + t.destroy + end + end + end + def title @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb index 28062d40..05894515 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb @@ -5,13 +5,27 @@ class BulletinFile mount_uploader :file, AssetUploader - field :filetitle - field :description + # field :filetitle + # field :description + has_one :filetitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + has_one :description, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy # field :to_save, :type => Boolean field :should_destroy, :type => Boolean - # belongs_to :bulletin - embedded_in :bulletin + belongs_to :bulletin + # embedded_in :bulletin + + + protected + + def set_key + if filetitle.new_record? + filetitle.key = 'filetitle' + end + if description.new_record? + description.key = 'description' + end + end end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_link.rb b/vendor/built_in_modules/announcement/app/models/bulletin_link.rb index a999d45d..30363182 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_link.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_link.rb @@ -4,10 +4,12 @@ class BulletinLink include Mongoid::Timestamps field :url - field :name + # field :name + + has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy field :should_destroy, :type => Boolean - embedded_in :bulletin - + # embedded_in :bulletin + belongs_to :bulletin end diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb index e834ec60..9c95881a 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb @@ -1,21 +1,25 @@ - - <%= bulletin_category.key %> - <% @site_valid_locales.each do |locale| %> - <%= bulletin_category.i18n_variable[locale] rescue nil %> - <% end %> - <%= bulletin_category.display %> - <% if is_manager? %> + - <%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,:token => @module_app.token) %>
    - <% bulletin_category.object_auths.each do |obj_auth| %> - <%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth,:token => @module_app.token) %>
    - <% end %> + <%= bulletin_category.key %> +
    + +
    - - <% end %> - <%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> | - <%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> | - <%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %> - - \ No newline at end of file + <% @site_valid_locales.each do |locale| %> + <%= bulletin_category.i18n_variable[locale] rescue nil %> + <% end %> + <%= bulletin_category.display %> + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb index d7bfac7b..1ce7f629 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_form.html.erb @@ -1,36 +1,36 @@ <% # encoding: utf-8 %> <%= form_for(@bulletin_category, :remote => true, :url => @url) do |f| %> -<%#= form_for(@bulletin_category, :remote => true, :url => panel_announcement_back_end_bulletin_category_path(@bulletin_category)) do |f| %> -
    - <%= f.label :key %>
    - <%= f.text_field :key %> -
    - -
    - <%= f.label :name %>
    - <%= 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 %> -
    - -
    - <%= f.label :display %>
    - <%#= f.select :display, BulletinCategory::PAYMENT_TYPES, :prompt => 'Select a display method' %> +

    <%= (@bulletin_category.new_record? ? 'Add' : 'Edit') %>

    - <%= 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 %> -
    顯示方式是設定在前台頁面時,資訊所呈現的樣式 -
    +
    + <%= f.label :key %> + <%= f.text_field :key %> +
    + +
    + <%= 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| %> +
    + <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> +
    + <%= f.text_field locale, :class => 'input-xxlarge' %> +
    +
    + <% end %> + <% end %> +
    + +
    + <%= f.label :display %> + <%= f.radio_button :display, "List" %>List + <%= f.radio_button :display, "Picture" %>Picture +
    顯示方式是設定在前台頁面時,資訊所呈現的樣式 +
    -
    - <%= f.submit %> +
    + <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
    <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit.html.erb new file mode 100644 index 00000000..14a72951 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit.html.erb @@ -0,0 +1,13 @@ + + + + <%= t(:quick_edit) %> + <%= form_for bulletin_category, :url => panel_announcement_back_end_bulletin_category_path(bulletin_category), :html => {:class => 'form-horizontal'} do |f| %> + <%= render :partial => "quick_edit_qe", :locals => { :f => f, :bulletin_category => bulletin_category } %> +
    + <%= f.submit t(:submit), :class => 'btn btn-primary' %> + <%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %> +
    + <% end %> + + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb new file mode 100644 index 00000000..cb32d861 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb @@ -0,0 +1,28 @@ +<% # encoding: utf-8 %> + +
    + +
    + <%= f.label :key %> + <%= f.text_field :key %> +
    +
    + <%= f.fields_for :i18n_variable, bulletin_category.i18n_variable do |f| %> + <% @site_valid_locales.each do |locale| %> +
    + <%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> +
    + <%= f.text_field locale, :class => 'input-xxlarge' %> +
    +
    + <% end %> + <% end %> +
    + +
    + <%= f.label :display %> + <%= f.radio_button :display, "List" %>List + <%= f.radio_button :display, "Picture" %>Picture +
    顯示方式是設定在前台頁面時,資訊所呈現的樣式 +
    +
    diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb index 87b30a04..0a6e7f83 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb @@ -1,38 +1,23 @@ -<% content_for :secondary do %> -<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> -<% end -%> <%= flash_messages %> -
    -
    -
    -
    -
    + + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + + -

    <%= t('bulletin_category.list_announcement_class') %>

    - -
    <%= t('bulletin_category.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %><%= t('bulletin_category.display') %>
    - - - <% @site_valid_locales.each do |locale| %> - - <% end %> - - - - -<%# @bulletin_categorys.each do |post| %> <%= render :partial => 'bulletin_category', :collection => @bulletin_categorys %> -<%# end %> + +
    <%= t('bulletin_category.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %><%= t('bulletin_category.display') %><%= t('bulletin.action') %>
    -
    -
    -
    -
    - -

    Add New

    <%= render :partial => "form" %>
    diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb index 86785ee0..6da49ceb 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file.html.erb @@ -6,10 +6,22 @@ <%= f.file_field :file %> <%= f.label :file_title %> - <%= f.text_field :filetitle %> + <%#= f.text_field :filetitle %> + <%= f.fields_for :filetitle, (bulletin_file.new_record? ? bulletin_file.build_filetitle : bulletin_file.filetitle ) do |f| %> + <% @site_valid_locales.each do |locale| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale %> + <% end %> + <% end %> <%= f.label :file_description %> - <%= f.text_field :description %> + <%#= f.text_field :description %> + <%= f.fields_for :description, (bulletin_file.new_record? ? bulletin_file.build_description : bulletin_file.description ) do |f| %> + <% @site_valid_locales.each do |locale| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale %> + <% end %> + <% end %> <% if bulletin_file.new_record? %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html - ƻs.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html - ƻs.erb new file mode 100644 index 00000000..33d1ba1e --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html - ƻs.erb @@ -0,0 +1,27 @@ + +
    " class='list_item'> +
    + + <%= f.label :link_url %> + <%= f.text_field :url %> + + <%= f.label :link_name %> + <%#= f.text_field :name %> + <%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.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 %> + + + <% if bulletin_link.new_record? %> + <%= t(:delete) %> + <% else %> + <%= f.hidden_field :id %> + <%= t(:delete) %> + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + <% end %> + +
    +
    diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb index 44c7ab75..e0077384 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link.html.erb @@ -1,12 +1,18 @@ -
    " class='list_item'> +
    " class='list_item'>
    <%= f.label :link_url %> <%= f.text_field :url %> <%= f.label :link_name %> - <%= f.text_field :name %> + <%#= f.text_field :name %> + <%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.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 %> <% if bulletin_link.new_record? %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html - ƻs.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html - ƻs.erb new file mode 100644 index 00000000..c44b5c92 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html - ƻs.erb @@ -0,0 +1,16 @@ + + "> + <%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %> + <%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %> + + + <%= f.hidden_field :id %> + + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + + + + + + + \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html.erb new file mode 100644 index 00000000..a3bc5243 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link2.html.erb @@ -0,0 +1,17 @@ + + "> + <%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %> + <%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %> + + + + <%= f.hidden_field :id %> + + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + + + + + + + \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb new file mode 100644 index 00000000..7208f73c --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb @@ -0,0 +1,41 @@ +<% # encoding: utf-8 %> + + <%= form_for(@bulletin.bulletin_links, :remote => true, :url => @link_url) do |f| %> + + + + <% end %> + + + \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 2236b5ed..35137b4f 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -20,108 +20,246 @@ <%= t('announcement.刪除已上傳檔案') %> <% end %>
    + + + +
    + +
    +
    + +
    +

    Picture

    +
    +
    + +
    + + +
    + +
    + <% if @bulletin.image.file %> + <%= f.check_box :remove_image %> + <%= t('announcement.刪除已上傳檔案') %> + <% end %> +
    +
    +
    +
    -
    - <%= f.label :title %> - <%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %> - <% @site_valid_locales.each do |locale| %> - - <%= I18nVariable.from_locale(locale) %> - <%= f.text_field locale %> - - <% end %> - <% end %> -
    - -
    - <%= f.label :subtitle %> - <%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %> - <% @site_valid_locales.each do |locale| %> - - <%= I18nVariable.from_locale(locale) %> - <%= f.text_area locale, :rows => 10, :cols => 40 %> - - <% end %> - <% end %> -
    +
    +
    + +
    +

    Date

    +
    +
    + +
    + <%= f.date_select :postdate, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'input-small'} %> +
    +
    +
    + +
    + <%= f.date_select :deadline, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'input-small'} %> +
    +
    +
    +
    + +
    +
    + +
    +

    Status

    +
    +
    + <%= f.check_box :is_top %><%= t('top') %> + <%= f.check_box :is_hot %><%= t('hot') %> + <%= f.check_box :is_hidden %><%= t('hide') %> +
    +
    +
    -
    - <%= f.label :text %> - <%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %> - <% @site_valid_locales.each do |locale| %> - - <%= I18nVariable.from_locale(locale) %> - <%= f.text_area locale, :rows => 10, :cols => 40 %> - - <% end %> - <% end %> +
    +
    + +
    +

    Tags

    +
    + <% @tags.each do |tag| %> + <%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id)%> + <%= tag[I18n.locale] %> + <% end %> +
    +
    +
    -
    - <%= f.label :postdate %>
    - <%= f.date_select :postdate, :order => [:year, :month, :day], :use_month_numbers => true %> - <%#= date_select("bulletin", "postdate", :use_month_numbers => true) %> -
    -
    - <%= f.label :deadline %>
    - <%= f.date_select :deadline, :use_month_numbers => true, :prompt => { :day => 'Select day', :month => 'Select month', :year => 'Select year'} %> - <%#= f.date_select :deadline, :order => [:year, :month, :day],:default => 1.years.from_now, :use_month_numbers => true %> -
    - -
    - <%#= f.label :url %>
    - <%#= f.text_field :url, :size => 60 %> -
    - - - + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html - ƻs.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html - ƻs.erb new file mode 100644 index 00000000..d37d2134 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html - ƻs.erb @@ -0,0 +1,9 @@ +<%= render 'filter' %> + + <%= render 'bulletins' %> +
    + +
    + <%= 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' %> +
    + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_edit.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_edit.js.erb new file mode 100644 index 00000000..cbe5e3c7 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/link_quick_edit.js.erb @@ -0,0 +1,2 @@ +//$.each($(".quick_edit"),function(obj){ $(this).remove(); }); +$("#<%= "bulletin_#{bulletin_link2.id}" %>").append("<%= j render "bulletin_link_qe" %>"); diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb index 7b886e77..5a33b86a 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb @@ -21,7 +21,7 @@
  • <%= t('announcement.title') %> - <%= @bulletin.title %> + <%= @bulletin.title[I18n.locale] %>
  • <%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %> @@ -29,23 +29,23 @@
  • <%= t('announcement.subtitle') %> - <%= @bulletin.subtitle %> + <%= @bulletin.subtitle[I18n.locale].html_safe %>
  • <%= t('announcement.text') %> - <%= @bulletin.text %> + <%= @bulletin.text[I18n.locale].html_safe %>
  • <%= t('announcement.link') %> <% @bulletin.bulletin_links.each do | blink | %> - <%= link_to blink.name, blink.url, :target => '_blank' %> + <%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %> <% end %>
  • <%= t('announcement.file') %> <% @bulletin.bulletin_files.each do | bfile | %> - <%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %> + <%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description[I18n.locale]} if bfile.file.file %> <% end %>
  • diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index f6f30b31..61056e49 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -7,7 +7,10 @@ Rails.application.routes.draw do match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting root :to => "bulletins#index" - resources :bulletins + resources :bulletins do + match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add + match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit + end resources :bulletin_categorys, :controller => 'bulletin_categorys' do match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit end diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb index e5c7fc45..4ca568a9 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb @@ -1,31 +1,32 @@ <% # encoding: utf-8 %> - <%= f.error_messages %> - <%#= debugger %> - -
    - <%= f.label :name %> - <%= @page_context.page.i18n_variable[I18n.locale] %> -
    +<%= f.error_messages %> -
    - <%= f.label :context %> - <%= f.fields_for :context, (@page_context.new_record? ? @page_context.build_context : @page_context.context ) do |f| %> - <% @site_valid_locales.each do |locale| %> - - <%= I18nVariable.from_locale(locale) %> - <%= f.text_area locale, :rows => 10, :cols => 40 %> - - <% end %> - <% end %> -
    - -
    -
    - -
    - <%= f.submit %> -
    +
    + +
    + <%= f.label :name %> + <%= @page_context.page.i18n_variable[I18n.locale] %> +
    + +
    + <%= f.label :context %> + <%= f.fields_for :context, (@page_context.new_record? ? @page_context.build_context : @page_context.context ) do |f| %> + <% @site_valid_locales.each do |locale| %> + + <%= I18nVariable.from_locale(locale) %> + <%= f.text_area locale, :style=>"width:100%" %> + + <% end %> + <% end %> +
    + + +
    + <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %> +
    + +
    <% content_for :page_specific_javascript do %> diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb index c1d86fe1..08db9b2d 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb @@ -1,10 +1,14 @@ - - <%= page_context.page.i18n_variable[I18n.locale] %> - <%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %> - <%= page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %> - <%= User.find(page_context.create_user_id).name %> - - <%= link_to t('page_context.edit'), edit_panel_page_content_back_end_page_context_path(page_context) %> - - + + + <%= page_context.page.i18n_variable[I18n.locale] %> +
    + +
    + + <%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %> + <%= page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %> + <%= User.find(page_context.create_user_id).name %> + \ No newline at end of file diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb index db23a280..7035a700 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb @@ -1,10 +1,15 @@ - - <%= view_page_context.page.i18n_variable[I18n.locale] %> - <%= view_page_context.version %> - <%= view_page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %> - <%= User.find(view_page_context.create_user_id).name %> - - <%= link_to t('view_page_context.show'), panel_page_content_back_end_page_context_path(view_page_context) %> - - + + + + <%= view_page_context.page.i18n_variable[I18n.locale] %> +
    + +
    + + <%= view_page_context.version %> + <%= view_page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %> + <%= User.find(view_page_context.create_user_id).name %> + \ No newline at end of file diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/edit.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/edit.html.erb index 18bb0ce5..86f2398c 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/edit.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/edit.html.erb @@ -1,7 +1,3 @@ -
    -
    -
    -

    <%= t('page_content.editing_page_content') %>

    @@ -9,8 +5,4 @@ <%= render :partial => 'form', :locals => {:f => f} %> <% end %> -<%= link_back %> -
    -
    -
    -
    \ No newline at end of file +<%#= link_back %> \ No newline at end of file diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/index.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/index.html.erb index a1566881..3227dcd4 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/index.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/index.html.erb @@ -1,36 +1,20 @@ -<% content_for :secondary do %> -
    -
    -
    -
    -
    -
      -
    • <%= link_to t('page_context.page_content_list'), panel_page_content_back_end_page_contexts_path %>
    • -
    -<% end -%> <%= flash_messages %> -
    -
    -
    -
    -
    - -

    <%= t('page_context.list_page_content') %>

    - - - - - - - - - +
    <%= t('page_context.name') %><%= t('page_context.version') %><%= t('page_context.update_time') %><%= t('page_context.last_modified') %><%= t('page_context.action') %>
    + + + + + + + + + - <%= render :partial => 'page_context', :collection => @page_contexts %> + <%= render :partial => 'page_context', :collection => @page_contexts %> -
    <%= t('page_context.name') %><%= t('page_context.version') %><%= t('page_context.update_time') %><%= t('page_context.last_modified') %>
    + + -
    diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/view.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/view.html.erb index c5a9871a..d88df80e 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/view.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/view.html.erb @@ -1,36 +1,19 @@ -<% content_for :secondary do %> -
    -
    -
    -
    -
    -
      -
    • <%= link_to t('page_context.page_content_list'), panel_page_content_back_end_page_contexts_path %>
    • -
    -<% end -%> <%= flash_messages %> -
    -
    -
    -
    -
    - -

    <%= t('page_context.list_page_content') %>

    - - - - - - - - - +
    <%= t('page_context.name') %><%= t('page_context.version') %><%= t('page_context.update_time') %><%= t('page_context.last_modified') %><%= t('page_context.action') %>
    + + + + + + + + + <%= render :partial => 'view_page_context', :collection => @page_contexts %> -
    <%= t('page_context.name') %><%= t('page_context.version') %><%= t('page_context.update_time') %><%= t('page_context.last_modified') %>
    - -
    + + diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_link_categorys_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_link_categorys_controller.rb index 3db38add..0ba3236a 100644 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_link_categorys_controller.rb +++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_link_categorys_controller.rb @@ -1,6 +1,6 @@ class Panel::WebResource::BackEnd::WebLinkCategorysController < ApplicationController - layout 'admin' + layout 'new_admin' def index @web_link_categorys = WebLinkCategory.all diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb index f1ec7485..dfe09ce5 100644 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb +++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb @@ -1,7 +1,7 @@ class Panel::WebResource::BackEnd::WebLinksController < ApplicationController - layout 'admin' + layout 'new_admin' before_filter :authenticate_user! before_filter :is_admin? diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_form.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_form.html.erb index 7eb698ea..2e0f61ff 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_form.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_form.html.erb @@ -1,25 +1,29 @@ <% # encoding: utf-8 %> <%= form_for(@web_link_category, :remote => true, :url => @url) do |f| %> -<%#= form_for(@web_link_category, :remote => true, :url => panel_web_resource_back_end_web_link_category_path(@web_link_category)) do |f| %> -
    - <%= f.label :key %>
    - <%= f.text_field :key %> -
    +

    <%= (@web_link_category.new_record? ? 'Add' : 'Edit') %>

    + +
    + <%= f.label :key %> + <%= f.text_field :key %> +
    + +
    + <%= f.fields_for :i18n_variable, (@web_link_category.new_record? ? @web_link_category.build_i18n_variable : @web_link_category.i18n_variable) do |f| %> + <% @site_valid_locales.each do |locale| %> +
    + <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> +
    + <%= f.text_field locale, :class => 'input-xxlarge' %> +
    +
    + <% end %> + <% end %> +
    -
    - <%= f.label :name %>
    - <%= f.fields_for :i18n_variable, (@web_link_category.new_record? ? @web_link_category.build_i18n_variable : @web_link_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 %> -
    - -
    - <%= f.submit %> +
    + <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
    <% end %> diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb index d6e27e8d..3f6a1a71 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb @@ -1,12 +1,16 @@ - - <%= web_link_category.key %> - <% @site_valid_locales.each do |locale| %> - <%= web_link_category.i18n_variable[locale] rescue nil %> - <% end %> - - <%= link_to t('web_link_category.edit'), edit_panel_web_resource_back_end_web_link_category_path(web_link_category), :remote => true %> | - <%= link_to t('web_link_category.quick_edit'), panel_web_resource_back_end_web_link_category_quick_edit_path(web_link_category), :remote => true %> | - <%= link_to t('web_link_category.delete'), panel_web_resource_back_end_web_link_category_path(web_link_category), :confirm => t('sure?'), :method => :delete, :remote => true %> - - \ No newline at end of file + + + + <%= web_link_category.key %> +
    + +
    + + <% @site_valid_locales.each do |locale| %> + <%= web_link_category.i18n_variable[locale] rescue nil %> + <% end %> + \ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/index.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/index.html.erb index 45842451..762da9e7 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/index.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/index.html.erb @@ -1,43 +1,23 @@ -<% content_for :secondary do %> -
    -
    -
    -
    -
    -
      -
    • <%#= link_to t('web_link_category.new_web_resource_class'), new_panel_web_resource_back_end_web_link_category_path, :class => 'seclink1' %>
    • -
    -<% end -%> + <%= flash_messages %> -

    <%= t('web_link_category.list_web_resource_class') %>

    -
    -
    -
    -
    -
    - - - - <% @site_valid_locales.each do |locale| %> - - <% end %> - - + + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + -<%# @web_link_categorys.each do |post| %> <%= render :partial => 'web_link_category', :collection => @web_link_categorys %> -<%# end %> + + -
    -
    -
    -
    - -

    Add New

    <%= render :partial => "form" %>
    - diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb index ce17555a..2abdf4a0 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb @@ -1,62 +1,101 @@ <% # encoding: utf-8 %> <%= f.error_messages %> - <%#= debugger %> - -
    - <%= f.label :category %>
    - <%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %> -
    - -
    - <%= f.label :name %> - <%= f.fields_for :name, (@web_link.new_record? ? @web_link.build_name : @web_link.name ) do |f| %> - <% @site_valid_locales.each do |locale| %> - - <%= I18nVariable.from_locale(locale) %> - <%= f.text_field locale %> - - <% end %> - <% end %> -
    - -
    - <%= f.label :url %>
    - <%= f.text_field :url, :size => 60 %> -
    -
    - <%= f.label :describe %> - <%= f.fields_for :context, (@web_link.new_record? ? @web_link.build_context : @web_link.context ) do |f| %> - <% @site_valid_locales.each do |locale| %> - - <%= I18nVariable.from_locale(locale) %> - <%= f.text_area locale, :rows => 10, :cols => 40 %> - - <% end %> - <% end %> -
    + + +
    + +
    +
    + +
    +

    Status

    +
    +
    + <%= f.check_box :is_top %><%= t('top') %> + <%= f.check_box :is_hot %><%= t('hot') %> + <%= f.check_box :is_hidden %><%= t('hide') %> +
    +
    +
    + +
    +
    + +
    +

    Tags

    +
    + <% @tags.each do |tag| %> + <%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%> + <%= tag[I18n.locale] %> + <% end %> +
    +
    -
    - <%= f.label :status %>
    - <%= f.check_box :is_top %><%= t('top') %> - <%= f.check_box :is_hot %><%= t('hot') %> - <%= f.check_box :is_hidden %><%= t('hidden') %> -
    - -
    - <%= f.label :tags %>
    - <% @tags.each do |tag| %> - <%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%> - <%= tag[I18n.locale] %> - <% end %> -
    - -
    -
    +
    -
    - <%= f.submit %> + + + +
    +
    + + <%= f.label :category %> + <%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %> + + + +
    + <%= f.label :name %> + <%= f.fields_for :name, (@web_link.new_record? ? @web_link.build_name : @web_link.name ) do |f| %> + <% @site_valid_locales.each do |locale| %> + + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title' %> + + <% end %> + <% end %> +
    + +
    + <%= f.label :url %> + <%= f.text_field :url %> +
    + +
    + <%= f.label :describe %> + <%= f.fields_for :context, (@web_link.new_record? ? @web_link.build_context : @web_link.context ) do |f| %> + <% @site_valid_locales.each do |locale| %> + + <%= I18nVariable.from_locale(locale) %> + <%= f.text_area locale, :style=>"width:100%" %> + + <% end %> + <% end %> +
    + +
    + + + + +
    + <%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
    \ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_web_links.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_web_links.html.erb index d87b59d8..c58f15e4 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_web_links.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_web_links.html.erb @@ -1,5 +1,5 @@ - + <% if post.is_top? %> <%= t(:top) %> @@ -10,6 +10,12 @@ <% if post.is_hidden? %> <%= t(:hidden) %> <% end %> +
    + +
    <%= post.web_link_category.i18n_variable[I18n.locale] %> @@ -20,12 +26,5 @@ <%= tag[I18n.locale] %> <% end %> - - <%= link_to t('web_link.edit'), edit_panel_web_resource_back_end_web_link_path(post) %> | - - <%= link_to t(:set_top), eval("panel_web_resource_back_end_web_link_path(post, :authenticity_token => form_authenticity_token, :web_link => {:is_top => true})"), :remote => true, :method => :put, :id => "disable_#{post.id}", :style => "display:#{post.is_top? ? 'none' : ''}", :class => 'switch' %> - <%= link_to t(:cancel_top), eval("panel_web_resource_back_end_web_link_path(post, :authenticity_token => form_authenticity_token, :web_link => {:is_top => false})"), :remote => true, :method => :put, :id => "enable_#{post.id}", :style => "display:#{post.is_top? ? '' : 'none'}", :class => 'switch' %> - - | <%= link_to t('web_link.delete'), panel_web_resource_back_end_web_link_path(post), :confirm => t('sure?'), :method => :delete, :remote => true %> - + diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb index 82afe4ea..301c1bbe 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb @@ -1,52 +1,21 @@ -<% content_for :secondary do %> -
    -
    -
    -
    -
    -
      -
    • <%= link_to t('web_link.new_link'), new_panel_web_resource_back_end_web_link_path %>
    • -
    • <%= link_to t('web_link.link_list'), panel_web_resource_back_end_web_links_path %>
    • -
    • <%= link_to t('web_link.new_link_class'), panel_web_resource_back_end_web_link_categorys_path %>
    • -
    -<% end -%> <%= flash_messages %> -
    -
    -
    -
    -
    - - <%= form_for :web_link, :action => 'search', :method => 'get', :url => panel_web_resource_back_end_web_links_path do |f| %> - - <%#= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('web_link.select') }%> - - Category <%= select_tag "category_id", options_for_select(@web_link_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('web_link.select') %> - - <%= submit_tag "OK", :name => nil %> - - <% end %> - -
    -
    - -

    <%= t('web_link.list_link') %>

    - - - - - - - - - +
    <%= t('web_link.status') %><%= t('web_link.category') %><%= t('web_link.name') %><%= t('web_link.tags') %><%= t('web_link.action') %>
    + + + + + + + + + <% @web_links.each do |post| %> <%= render :partial => 'web_links', :locals => {:post => post} %> - <% end %> -
    <%= t('web_link.status') %><%= t('web_link.category') %><%= t('web_link.name') %><%= t('web_link.tags') %>
    - -
    + <% end %> + + + From f4fda08e865b1672d5bb4284e32cafdce527f014 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Mon, 5 Mar 2012 16:19:08 +0800 Subject: [PATCH 23/24] Replace PrototypeR4 by Orbit. Move session into mongoid_store. Reset session when sing_in. --- Gemfile | 3 ++ Gemfile.lock | 32 +++++++++++++++++++ Rakefile | 2 +- app/controllers/admin/sessions_controller.rb | 8 +++++ app/models/session.rb | 12 +++++++ config.ru | 2 +- config/application.rb | 3 +- config/environment.rb | 2 +- config/environments/development.rb | 2 +- config/environments/production.rb | 2 +- config/environments/test.rb | 2 +- .../cookie_verification_secret.rb | 2 +- config/initializers/secret_token.rb | 2 +- config/initializers/session_store.rb | 7 +--- config/routes.rb | 2 +- .../config/initializers/app_config.rb | 4 +-- 16 files changed, 69 insertions(+), 18 deletions(-) create mode 100644 app/controllers/admin/sessions_controller.rb create mode 100644 app/models/session.rb diff --git a/Gemfile b/Gemfile index eb1f5434..cd8c36f9 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 8889b1d5..b1ab1679 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,6 +42,14 @@ GEM arel (2.2.1) bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1-x86-mingw32) + brakeman (1.5.0) + activesupport + erubis (~> 2.6) + haml (~> 3.0) + i18n + ruby2ruby (~> 1.2) + ruport (~> 1.6) + sass (~> 3.0) bson (1.5.2) bson_ext (1.5.2) bson (= 1.5.2) @@ -59,6 +67,7 @@ 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) @@ -78,7 +87,11 @@ GEM factory_girl_rails (1.6.0) factory_girl (~> 2.5.0) railties (>= 3.0.0) + fastercsv (1.5.4) + haml (3.1.4) hike (1.2.1) + hoe (2.15.0) + rake (~> 0.8) i18n (0.6.0) jquery-rails (1.0.19) railties (~> 3.0) @@ -96,12 +109,18 @@ GEM subexec (~> 0.2.1) mongo (1.5.2) bson (= 1.5.2) + mongo_session_store-rails3 (3.0.5) + actionpack (>= 3.0) + mongo mongoid (2.4.2) activemodel (~> 3.1) mongo (~> 1.3) tzinfo (~> 0.3.22) multi_json (1.0.4) 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) @@ -154,15 +173,24 @@ 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) + ruby_parser (2.3.1) + sexp_processor (~> 3.0) rubyzip (0.9.5) + ruport (1.6.3) + fastercsv + pdf-writer (= 1.1.8) sass (3.1.12) 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) @@ -186,6 +214,8 @@ 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) @@ -210,6 +240,7 @@ PLATFORMS x86-mingw32 DEPENDENCIES + brakeman bson_ext carrierwave carrierwave-mongoid @@ -223,6 +254,7 @@ DEPENDENCIES jquery-rails kaminari! mini_magick + mongo_session_store-rails3 mongoid radius rails (>= 3.1.0, < 3.2.0) diff --git a/Rakefile b/Rakefile index 2036d04c..9a495de7 100644 --- a/Rakefile +++ b/Rakefile @@ -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 diff --git a/app/controllers/admin/sessions_controller.rb b/app/controllers/admin/sessions_controller.rb new file mode 100644 index 00000000..00649580 --- /dev/null +++ b/app/controllers/admin/sessions_controller.rb @@ -0,0 +1,8 @@ +class SessionsController < Devise::SessionsController + + def create + super + reset_session + end + +end \ No newline at end of file diff --git a/app/models/session.rb b/app/models/session.rb new file mode 100644 index 00000000..3c6deb54 --- /dev/null +++ b/app/models/session.rb @@ -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 \ No newline at end of file diff --git a/config.ru b/config.ru index 20d6bd1f..6a593e4a 100644 --- a/config.ru +++ b/config.ru @@ -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 diff --git a/config/application.rb b/config/application.rb index 50b9f4a7..d1243133 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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. diff --git a/config/environment.rb b/config/environment.rb index efd38a40..3538bc87 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -4,4 +4,4 @@ require 'yaml' YAML::ENGINE.yamler = 'syck' # Initialize the rails application -PrototypeR4::Application.initialize! +Orbit::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index c2b4c930..1dbff032 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -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 diff --git a/config/environments/production.rb b/config/environments/production.rb index f52ead13..001ff2c6 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -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. diff --git a/config/environments/test.rb b/config/environments/test.rb index 6d22bb12..e55cc24b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -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 diff --git a/config/initializers/cookie_verification_secret.rb b/config/initializers/cookie_verification_secret.rb index 5a8601a7..694e666d 100644 --- a/config/initializers/cookie_verification_secret.rb +++ b/config/initializers/cookie_verification_secret.rb @@ -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' diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index 67abf723..ae9a444a 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -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' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index e6387adb..b1a4a2c1 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -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 diff --git a/config/routes.rb b/config/routes.rb index cd3921f0..112d96e1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -PrototypeR4::Application.routes.draw do +Orbit::Application.routes.draw do devise_for :users diff --git a/vendor/built_in_modules/new_blog/config/initializers/app_config.rb b/vendor/built_in_modules/new_blog/config/initializers/app_config.rb index c098b837..0e9f56e7 100644 --- a/vendor/built_in_modules/new_blog/config/initializers/app_config.rb +++ b/vendor/built_in_modules/new_blog/config/initializers/app_config.rb @@ -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" \ No newline at end of file +# Orbit::Application::Orbit_Apps << "NewBlog" \ No newline at end of file From 29ec36130e660318f8fbc86208e5952011413aac Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Fri, 16 Mar 2012 15:06:45 +0800 Subject: [PATCH 24/24] css and js changes --- app/assets/javascripts/orbit-1.0.js | 9 +- app/assets/stylesheets/site_items.css.erb | 963 +++++++++++----------- 2 files changed, 488 insertions(+), 484 deletions(-) diff --git a/app/assets/javascripts/orbit-1.0.js b/app/assets/javascripts/orbit-1.0.js index efb7042e..f8daaecd 100644 --- a/app/assets/javascripts/orbit-1.0.js +++ b/app/assets/javascripts/orbit-1.0.js @@ -52,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'); diff --git a/app/assets/stylesheets/site_items.css.erb b/app/assets/stylesheets/site_items.css.erb index 38b0a185..4e23bd4c 100644 --- a/app/assets/stylesheets/site_items.css.erb +++ b/app/assets/stylesheets/site_items.css.erb @@ -1,482 +1,483 @@ -html, body{ - height: 100%; - margin: 0; - padding: 0; -} -html{ - background: url(<%= asset_path "body.jpg" %>) no-repeat fixed 0 0 transparent; - background-size: cover; -} - -body{ - color: #000000; - font-family: Helvetica, '微軟正黑體'; -} -#back_banner_link{ - background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #787e82), color-stop(0.05, #61676c), color-stop(1, #292c2d) ); - background:-moz-linear-gradient( center top -90deg, #787e82 0%, #61676c 5%, #292c2d 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#61676c', endColorstr='#292c2d'); - -moz-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); - -webkit-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); - box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); - border-top: 1px solid #474a4c; - border-bottom: 1px solid #1d2020; - height: 41px; - width: 100%; - behavior: url(<%= asset_path "PIE.htc" %>); -} -.hmenu{ - float: right; - height: 41px; -} -#back_orbit{ - background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #70787d), color-stop(1, #3b4043) ); - background:-moz-linear-gradient( center top -90deg, #70787d 0%, #3b4043 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#70787d', endColorstr='#3b4043'); - -webkit-border-radius: 0px 0px 5px 5px; - -moz-border-radius: 0px 0px 5px 5px; - border-radius: 0px 0px 5px 5px; - -moz-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); - -webkit-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); - box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); - cursor: pointer; - float: left; - height: 43px; - margin-left: 10px; - width: 41px; - behavior: url(<%= asset_path "PIE.htc" %>); -} -#back_orbit span{ - text-indent: -9999px; - background: url(<%= asset_path "bar_orbit.png" %>) no-repeat scroll 0 0 transparent; - display: block; - height: 43px; - width: 100%; -} -#back_orbit:hover{ - background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #fefefe), color-stop(1, #e4e4e4) ); - background:-moz-linear-gradient( center top -90deg, #fefefe 0%, #e4e4e4 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fefefe', endColorstr='#e4e4e4'); - -webkit-border-radius: 0px; - -moz-border-radius: 0px; - border-radius: 0px; -} -#back_orbit:hover span{ - background-position: 0 -44px; -} -#back_orbit:hover #orblist{ - display:block; -} -#orblist{ - background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #e4e4e4), color-stop(1, #FFFFFF) ); - background:-moz-linear-gradient( center top -90deg, #e4e4e4 0%, #FFFFFF 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e4e4e4', endColorstr='#FFFFFF'); - -webkit-border-radius: 0px 3px 3px 3px; - -moz-border-radius: 0px 3px 3px 3px; - border-radius: 0px 3px 3px 3px; - -webkit-box-shadow: 0 3px 3px #000000; - -moz-box-shadow: 0 3px 3px #000000; - box-shadow: 0 3px 3px #000000; - display: none; - margin: 0; - padding: 10px; - position: absolute; - top: 43px; - width: 130px; -} -#orblist li{ - border-bottom:1px solid #aaa; - list-style:none; -} -.orblink{ - color: #333333; - display: block; - font: 12px/100% arial,sans-serif; - padding: 5px; - text-decoration: none; -} -.orblink:hover{ - background:#eee; - color:#333; -} -#log_out{ - -moz-box-shadow:inset 1px 0px 0px 0px #73777b; - -webkit-box-shadow:inset 1px 0px 0px 0px #73777b; - box-shadow:inset 1px 0px 0px 0px #73777b; - border-right:1px solid #41474c; - border-left:1px solid #41474c; - float:right; - width:41px; - height:41px; -} -#log_out:hover{ - background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #01afde), color-stop(1, #007ec6) ); - background:-moz-linear-gradient( center top -90deg, #01afde 0%, #007ec6 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#01afde', endColorstr='#007ec6'); -} -#log_out a{ - background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right 0 transparent; - display: block; - height: 41px; - text-indent: -9999px; - width: 41px; -} -#log_out a:hover{ - background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right bottom transparent !important; -} -.lang{ - color: #FFFFFF; - float: right; - font-size: 15px; - line-height: 40px; - margin-right: 10px; -} -.lang a{ - color:#fff; - text-decoration:none; -} -.lang a:hover{ - text-decoration:underline; -} -#back_content{ - height: 100%; -} -#back_footer{ - background-color: #101010; - bottom: 0; - color: #FFFFFF; - font-size: 11px; - padding: 10px; - position: fixed; - width: 100%; - left: 0; - box-shadow: 0 -3px 4px #000; -} -.items_setup{ - padding:42px 0 0 0; -} -#back_sidebar .items_setup .list li{ - padding: 6px 0 7px 5px; -} -#back_sidebar .items_setup .list li a{ - display: inline; - font-size: 0.9em; - padding: 0; -} -#back_sidebar .items_setup .list li a span{ - background:none; - padding:0; - text-shadow:none; -} -.main { - background: none repeat scroll 0 0 #FFFFFF; - height: 100%; - margin-left: 220px; - padding: 0 40px; - position: relative; -} -.main_list { - padding-top: 70px; -} -.main_list ul { - clear:both; -} -#porfile { - padding-top: 100px; -} -/*add_buttom*/ -.button_bar { - float: right; - -moz-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; - -webkit-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; - box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; - background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #4f4f4f), color-stop(1, #000000) ); - background:-moz-linear-gradient( center top, #4f4f4f 5%, #000000 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4f4f4f', endColorstr='#000000'); - background-color:#4f4f4f; - -moz-border-radius:5px; - -webkit-border-radius:5px; - border-radius:5px; - display:inline-block; - padding:0; - margin:10px 0 60px; -} -.button_bar a { - text-decoration:none; - text-shadow:0px -1px 0px #000000; - font-size:12px; - color:#EDEDED; - border-right:1px solid #555; - -moz-box-shadow:1px 0px 0px black; - -webkit-box-shadow:1px 0px 0px black; - box-shadow:1px 0px 0px black; - padding: 6px 10px 4px; - display: inline-block; - float: left; -} -.button_bar a:active { - padding: 7px 10px 3px !important; - text-shadow:0px 1px 0px #000000; - background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #000000), color-stop(1, #4f4f4f) ); - background:-moz-linear-gradient( center top, #000000 5%, #4f4f4f 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#4f4f4f'); -} -.button_bar a:last-child { - border-right:none; - -moz-box-shadow:none; - -webkit-box-shadow:none; - box-shadow:none; - -moz-border-radius:0px 5px 5px 0px; - -webkit-border-radius:0px 5px 5px 0px; - border-radius:0px 5px 5px 0px; -} -.button_bar a:first-child { - -moz-border-radius:5px 0px 0px 5px; - -webkit-border-radius:5px 0px 0px 5px; - border-radius:5px 0px 0px 5px; -} -.button_bar a.new { - padding: 5px 10px; - -moz-border-radius:5px; - -webkit-border-radius:5px; - border-radius:5px; -} -.button_bar a:hover { - color:#FFFFFF; -} -.up { - margin:10px 0; -} -#person { - left: 245px; - position: fixed; - text-align: center; - top: 75px; - width: 140px; - background-color:#FFF; - padding:15px; - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - -moz-box-shadow: 0px 0px 4px #180902; /* Firefox */ - -webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */ - box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */ -} -#file { - display:none; -} -#person img { -} -.user_mail { - border: medium none; - border:1px solid #DDDDDD; - color: #666666; - font-size: 12px; - width: 140px; -} -#person label { - display: block; - margin: 15px 0 0; -} -#person label input { -} -#person label #user_admin { - float:right; - margin: 0; -} -#person label span { - text-align:left; - font-size:11px; - color:#888; - display:block; -} -#person select { - border: 1px solid #DDDDDD; - padding: 0; - width: 140px; -} -#porfile .users{ - margin-left: 180px; -} -.roles_block { - background: url(<%= asset_path "75.png" %>) repeat left top; - min-width:710px; - margin-bottom:50px; - position:relative; - padding-bottom: 20px; - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - -moz-box-shadow: 0px 0px 4px #180902; /* Firefox */ - -webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */ - box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */ -} -.roles_block h2 { - color: #FFFFFF; - font-weight: normal; - margin: 0; - padding: 0; - position: absolute; - text-shadow: 0 3px 2px #000000; - top: -30px; -} -.main hr { - height:8px; - border:none; - margin:0; - border-radius: 5px 5px 0px 0px; - -moz-border-radius: 5px 5px 0px 0px; - -webkit-border-radius: 5px 5px 0px 0px; - border-bottom:1px solid #000; -} -.main2{ - padding:70px 0 0; -} -#basic_block hr { - background-color: #666666; -} -#teacher_block hr { - background-color: #0071A9; -} -#student_block hr { - background-color: #AF0045; -} -.info_input { - padding:10px 20px; -} -.info_input table { - color:#fff; - width:100%; - font-size:14px; -} -.info_input table td { - padding:5px 10px 5px 0; - width: 10%; -} -.info_input .list_head { - background:url(<%= asset_path "line.png" %>) left bottom repeat-x; -} -.info_input .list_head td { -} -.info_input .list_item { - color:#AEAEAE; -} -.info_input .add { - display:block; - padding-left:22px; - font-size:12px; - line-height:21px; - height:19px; - background:url(<%= asset_path "icon.png" %>) no-repeat -59px 0; - margin-top: 10px; - color: #DDDDDD; -} - -.main table { - width:100%; -} -.main td { - padding-left:20px; - color:#fff; - font-size:14px; - line-height:40px; -} -.main tr.have td{ - background: url(<%= asset_path "75.png" %>) repeat left top; -} -.main tr.have td:first-child{ - border-radius: 5px 0 0 5px; - -moz-border-radius: 5px 0 0 5px; - -webkit-border-radius: 5px 0 0 5px; -} -.main tr.have td:last-child{ - border-radius: 0 5px 5px 0; - -moz-border-radius: 0 5px 5px 0; - -webkit-border-radius: 0 5px 5px 0; -} -.main thead td { - line-height:40px; - font-size:16px; - text-shadow: 0px 1px 1px #3e2914; -} -.main thead td.action { - width:140px; -} -.main tbody td.roles { - background-image: url(<%= asset_path "roles_type.jpg" %>); - background-repeat: repeat-x; -} -.main tbody td.teacher { - background-position: 0 -54px; -} -.main tbody td.student { - background-position: 0 -5px; -} -.main tbody td.action a { - background-image: url(<%= asset_path "icon.png" %>); - display: inline-block; - height: 19px; - margin-right: 10px; - top: 8px; - text-indent: -9999px; - width: 19px; - position: relative; -} -.main tbody td.action a.show { - background-position: left top; -} -.main tbody td.action a.show:hover { - background-position: left -19px; -} -.main tbody td.action a.edit { - background-position: -19px top; -} -.main tbody td.action a.edit:hover { - background-position: -19px -19px; -} -.main tbody td.action a.delete { - background-position: -38px top; -} -.main tbody td.action a.delete:hover { - background-position: -38px -19px; -} -.main tbody td.action a.switch { - background: url(<%= asset_path "switch.png" %>) no-repeat left 3px; - width: 40px; -} -.main tbody tr.disable td.action a.switch { - background-position:left bottom; -} -.main tbody td.action a.delete:hover { - background-position: -38px -19px; -} -.main tbody tr.have { -} -.main tbody tr.disable { - opacity: 0.7; -} -.main tbody tr { - background:none; - height:15px; -} -h1{ - margin:0 0 20px; -} -p{ - margin:0 0 10px; -} - -#back_sidebar .items_setup .list li{ - background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top; - border:none; - padding: 0 0 0 5px; -} -#back_sidebar .items_setup .list li a{ - line-height:31px; -} -#back_sidebar .items_setup .list li:hover{ - background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top; - border:none; -} -#back_sidebar .items_setup ul .list { +html, body{ + height: 100%; + margin: 0; + padding: 0; +} +html{ + background: url(<%= asset_path "body.jpg" %>) no-repeat fixed 0 0 transparent; + background-size: cover; +} + +body{ + color: #000000; + font-family: Helvetica, '微軟正黑體'; +} +#back_banner_link{ + background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #787e82), color-stop(0.05, #61676c), color-stop(1, #292c2d) ); + background:-moz-linear-gradient( center top -90deg, #787e82 0%, #61676c 5%, #292c2d 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#61676c', endColorstr='#292c2d'); + -moz-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); + -webkit-box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); + box-shadow: 0px 1px 5px 0px rgba(0,0,0,.7); + border-top: 1px solid #474a4c; + border-bottom: 1px solid #1d2020; + height: 41px; + width: 100%; + behavior: url(<%= asset_path "PIE.htc" %>); +} +.hmenu{ + float: right; + height: 41px; +} +#back_orbit{ + background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #70787d), color-stop(1, #3b4043) ); + background:-moz-linear-gradient( center top -90deg, #70787d 0%, #3b4043 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#70787d', endColorstr='#3b4043'); + -webkit-border-radius: 0px 0px 5px 5px; + -moz-border-radius: 0px 0px 5px 5px; + border-radius: 0px 0px 5px 5px; + -moz-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); + -webkit-box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); + box-shadow: 0px 1px 1px 0px rgba(0,0,0,.7); + cursor: pointer; + float: left; + height: 43px; + margin-left: 10px; + width: 41px; + behavior: url(<%= asset_path "PIE.htc" %>); +} +#back_orbit span{ + text-indent: -9999px; + background: url(<%= asset_path "bar_orbit.png" %>) no-repeat scroll 0 0 transparent; + display: block; + height: 43px; + width: 100%; +} +#back_orbit:hover{ + background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #fefefe), color-stop(1, #e4e4e4) ); + background:-moz-linear-gradient( center top -90deg, #fefefe 0%, #e4e4e4 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fefefe', endColorstr='#e4e4e4'); + -webkit-border-radius: 0px; + -moz-border-radius: 0px; + border-radius: 0px; +} +#back_orbit:hover span{ + background-position: 0 -44px; +} +#back_orbit:hover #orblist{ + display:block; +} +#orblist{ + background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #e4e4e4), color-stop(1, #FFFFFF) ); + background:-moz-linear-gradient( center top -90deg, #e4e4e4 0%, #FFFFFF 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e4e4e4', endColorstr='#FFFFFF'); + -webkit-border-radius: 0px 3px 3px 3px; + -moz-border-radius: 0px 3px 3px 3px; + border-radius: 0px 3px 3px 3px; + -webkit-box-shadow: 0 3px 3px #000000; + -moz-box-shadow: 0 3px 3px #000000; + box-shadow: 0 3px 3px #000000; + display: none; + margin: 0; + padding: 10px; + position: absolute; + top: 43px; + width: 130px; +} +#orblist li{ + border-bottom:1px solid #aaa; + list-style:none; +} +.orblink{ + color: #333333; + display: block; + font: 12px/100% arial,sans-serif; + padding: 5px; + text-decoration: none; +} +.orblink:hover{ + background:#eee; + color:#333; +} +#log_out{ + -moz-box-shadow:inset 1px 0px 0px 0px #73777b; + -webkit-box-shadow:inset 1px 0px 0px 0px #73777b; + box-shadow:inset 1px 0px 0px 0px #73777b; + border-right:1px solid #41474c; + border-left:1px solid #41474c; + float:right; + width:41px; + height:41px; +} +#log_out:hover{ + background:-webkit-gradient( linear, left top, left bottom, color-stop(0, #01afde), color-stop(1, #007ec6) ); + background:-moz-linear-gradient( center top -90deg, #01afde 0%, #007ec6 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#01afde', endColorstr='#007ec6'); +} +#log_out a{ + background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right 0 transparent; + display: block; + height: 41px; + text-indent: -9999px; + width: 41px; +} +#log_out a:hover{ + background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right bottom transparent !important; +} +.lang{ + color: #FFFFFF; + float: right; + font-size: 15px; + line-height: 40px; + margin-right: 10px; +} +.lang a{ + color:#fff; + text-decoration:none; +} +.lang a:hover{ + text-decoration:underline; +} +#back_content{ + height: 100%; +} +#back_footer{ + background-color: #101010; + bottom: 0; + color: #FFFFFF; + display:none; + font-size: 11px; + padding: 10px; + position: fixed; + width: 100%; + left: 0; + box-shadow: 0 -3px 4px #000; +} +.items_setup{ + padding:42px 0 0 0; +} +#back_sidebar .items_setup .list li{ + padding: 6px 0 7px 5px; +} +#back_sidebar .items_setup .list li a{ + display: inline; + font-size: 0.9em; + padding: 0; +} +#back_sidebar .items_setup .list li a span{ + background:none; + padding:0; + text-shadow:none; +} +.main { + background: none repeat scroll 0 0 #FFFFFF; + height: 100%; + margin-left: 220px; + padding: 0 40px; + position: relative; +} +.main_list { + padding-top: 70px; +} +.main_list ul { + clear:both; +} +#porfile { + padding-top: 100px; +} +/*add_buttom*/ +.button_bar { + float: right; + -moz-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; + -webkit-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; + box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black; + background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #4f4f4f), color-stop(1, #000000) ); + background:-moz-linear-gradient( center top, #4f4f4f 5%, #000000 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4f4f4f', endColorstr='#000000'); + background-color:#4f4f4f; + -moz-border-radius:5px; + -webkit-border-radius:5px; + border-radius:5px; + display:inline-block; + padding:0; + margin:10px 0 60px; +} +.button_bar a { + text-decoration:none; + text-shadow:0px -1px 0px #000000; + font-size:12px; + color:#EDEDED; + border-right:1px solid #555; + -moz-box-shadow:1px 0px 0px black; + -webkit-box-shadow:1px 0px 0px black; + box-shadow:1px 0px 0px black; + padding: 6px 10px 4px; + display: inline-block; + float: left; +} +.button_bar a:active { + padding: 7px 10px 3px !important; + text-shadow:0px 1px 0px #000000; + background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #000000), color-stop(1, #4f4f4f) ); + background:-moz-linear-gradient( center top, #000000 5%, #4f4f4f 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#4f4f4f'); +} +.button_bar a:last-child { + border-right:none; + -moz-box-shadow:none; + -webkit-box-shadow:none; + box-shadow:none; + -moz-border-radius:0px 5px 5px 0px; + -webkit-border-radius:0px 5px 5px 0px; + border-radius:0px 5px 5px 0px; +} +.button_bar a:first-child { + -moz-border-radius:5px 0px 0px 5px; + -webkit-border-radius:5px 0px 0px 5px; + border-radius:5px 0px 0px 5px; +} +.button_bar a.new { + padding: 5px 10px; + -moz-border-radius:5px; + -webkit-border-radius:5px; + border-radius:5px; +} +.button_bar a:hover { + color:#FFFFFF; +} +.up { + margin:10px 0; +} +#person { + left: 245px; + position: fixed; + text-align: center; + top: 75px; + width: 140px; + background-color:#FFF; + padding:15px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + -moz-box-shadow: 0px 0px 4px #180902; /* Firefox */ + -webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */ + box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */ +} +#file { + display:none; +} +#person img { +} +.user_mail { + border: medium none; + border:1px solid #DDDDDD; + color: #666666; + font-size: 12px; + width: 140px; +} +#person label { + display: block; + margin: 15px 0 0; +} +#person label input { +} +#person label #user_admin { + float:right; + margin: 0; +} +#person label span { + text-align:left; + font-size:11px; + color:#888; + display:block; +} +#person select { + border: 1px solid #DDDDDD; + padding: 0; + width: 140px; +} +#porfile .users{ + margin-left: 180px; +} +.roles_block { + background: url(<%= asset_path "75.png" %>) repeat left top; + min-width:710px; + margin-bottom:50px; + position:relative; + padding-bottom: 20px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + -moz-box-shadow: 0px 0px 4px #180902; /* Firefox */ + -webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */ + box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */ +} +.roles_block h2 { + color: #FFFFFF; + font-weight: normal; + margin: 0; + padding: 0; + position: absolute; + text-shadow: 0 3px 2px #000000; + top: -30px; +} +.main hr { + height:8px; + border:none; + margin:0; + border-radius: 5px 5px 0px 0px; + -moz-border-radius: 5px 5px 0px 0px; + -webkit-border-radius: 5px 5px 0px 0px; + border-bottom:1px solid #000; +} +.main2{ + padding:70px 0 0; +} +#basic_block hr { + background-color: #666666; +} +#teacher_block hr { + background-color: #0071A9; +} +#student_block hr { + background-color: #AF0045; +} +.info_input { + padding:10px 20px; +} +.info_input table { + color:#fff; + width:100%; + font-size:14px; +} +.info_input table td { + padding:5px 10px 5px 0; + width: 10%; +} +.info_input .list_head { + background:url(<%= asset_path "line.png" %>) left bottom repeat-x; +} +.info_input .list_head td { +} +.info_input .list_item { + color:#AEAEAE; +} +.info_input .add { + display:block; + padding-left:22px; + font-size:12px; + line-height:21px; + height:19px; + background:url(<%= asset_path "icon.png" %>) no-repeat -59px 0; + margin-top: 10px; + color: #DDDDDD; +} + +.main table { + width:100%; +} +.main td { + padding-left:20px; + color:#fff; + font-size:14px; + line-height:40px; +} +.main tr.have td{ + background: url(<%= asset_path "75.png" %>) repeat left top; +} +.main tr.have td:first-child{ + border-radius: 5px 0 0 5px; + -moz-border-radius: 5px 0 0 5px; + -webkit-border-radius: 5px 0 0 5px; +} +.main tr.have td:last-child{ + border-radius: 0 5px 5px 0; + -moz-border-radius: 0 5px 5px 0; + -webkit-border-radius: 0 5px 5px 0; +} +.main thead td { + line-height:40px; + font-size:16px; + text-shadow: 0px 1px 1px #3e2914; +} +.main thead td.action { + width:140px; +} +.main tbody td.roles { + background-image: url(<%= asset_path "roles_type.jpg" %>); + background-repeat: repeat-x; +} +.main tbody td.teacher { + background-position: 0 -54px; +} +.main tbody td.student { + background-position: 0 -5px; +} +.main tbody td.action a { + background-image: url(<%= asset_path "icon.png" %>); + display: inline-block; + height: 19px; + margin-right: 10px; + top: 8px; + text-indent: -9999px; + width: 19px; + position: relative; +} +.main tbody td.action a.show { + background-position: left top; +} +.main tbody td.action a.show:hover { + background-position: left -19px; +} +.main tbody td.action a.edit { + background-position: -19px top; +} +.main tbody td.action a.edit:hover { + background-position: -19px -19px; +} +.main tbody td.action a.delete { + background-position: -38px top; +} +.main tbody td.action a.delete:hover { + background-position: -38px -19px; +} +.main tbody td.action a.switch { + background: url(<%= asset_path "switch.png" %>) no-repeat left 3px; + width: 40px; +} +.main tbody tr.disable td.action a.switch { + background-position:left bottom; +} +.main tbody td.action a.delete:hover { + background-position: -38px -19px; +} +.main tbody tr.have { +} +.main tbody tr.disable { + opacity: 0.7; +} +.main tbody tr { + background:none; + height:15px; +} +h1{ + margin:0 0 20px; +} +p{ + margin:0 0 10px; +} + +#back_sidebar .items_setup .list li{ + background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top; + border:none; + padding: 0 0 0 5px; +} +#back_sidebar .items_setup .list li a{ + line-height:31px; +} +#back_sidebar .items_setup .list li:hover{ + background:url(<%= asset_path "sidebar_li2.jpg" %>) repeat left top; + border:none; +} +#back_sidebar .items_setup ul .list { } \ No newline at end of file