From c6894be962a27dec205fcbc12c4a537f7e1d0581 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Tue, 20 Nov 2012 15:56:52 +0800 Subject: [PATCH 1/7] first version of confined sidebar render --- .../object_auths_new_interface_controller.rb | 8 +- .../admin/users_new_interface_controller.rb | 2 +- app/models/user/attribute_value.rb | 2 +- app/views/layouts/_side_bar.html.erb | 3 +- app/views/layouts/_side_bar_content.html.erb | 109 +------------ app/views/layouts/new_admin.html.erb | 1 + config/mongoid.yml | 2 +- lib/orbit_app.rb | 5 +- lib/orbit_app/helper/context_link_renderer.rb | 12 ++ lib/orbit_app/helper/renderer.rb | 62 +++++++ lib/orbit_app/helper/side_bar_renderer.rb | 43 +++++ lib/orbit_app/module/backend_side_bar.rb | 17 -- lib/orbit_app/module/registration.rb | 8 +- lib/orbit_app/module/side_bar.rb | 151 ++++++++++++++++++ lib/orbit_app/plugin/registration.rb | 15 +- lib/orbit_app/summary.rb | 2 +- .../back_end/bulletin_categorys_controller.rb | 7 +- vendor/built_in_modules/announcement/init.rb | 62 ++++--- 18 files changed, 353 insertions(+), 158 deletions(-) create mode 100644 lib/orbit_app/helper/context_link_renderer.rb create mode 100644 lib/orbit_app/helper/renderer.rb create mode 100644 lib/orbit_app/helper/side_bar_renderer.rb delete mode 100644 lib/orbit_app/module/backend_side_bar.rb create mode 100644 lib/orbit_app/module/side_bar.rb diff --git a/app/controllers/admin/object_auths_new_interface_controller.rb b/app/controllers/admin/object_auths_new_interface_controller.rb index 973f4215c..7e0763ff4 100644 --- a/app/controllers/admin/object_auths_new_interface_controller.rb +++ b/app/controllers/admin/object_auths_new_interface_controller.rb @@ -1,10 +1,13 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController include OrbitCoreLib::PermissionUnility before_filter :force_order - + + def set_module_app + @module_app = ModuleApp.where(:title=>'Announcement').first + end + def setting - @sys_users = User.all(conditions: {admin: false}).includes(:avatar) @ob_auth = ObjectAuth.find params[:object_auth_id] @options_from_collection_for_select_ob_auth = @ob_auth.siblings.collect{|oa| [oa.auth_obj.pp_object,oa.id] } @@ -60,6 +63,7 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController def force_order authenticate_user! + set_module_app check_if_user_can_do_object_auth end diff --git a/app/controllers/admin/users_new_interface_controller.rb b/app/controllers/admin/users_new_interface_controller.rb index 01f44016c..8302e4d71 100644 --- a/app/controllers/admin/users_new_interface_controller.rb +++ b/app/controllers/admin/users_new_interface_controller.rb @@ -26,7 +26,7 @@ class Admin::UsersNewInterfaceController < ApplicationController def show @user = User.find(params[:id]) - @plugins = OrbitApp::Module::Registration.all + @plugins = OrbitApp::Plugin::Registration.all @profile_data = [] @teacher_data = [] diff --git a/app/models/user/attribute_value.rb b/app/models/user/attribute_value.rb index e335451a8..f39957965 100644 --- a/app/models/user/attribute_value.rb +++ b/app/models/user/attribute_value.rb @@ -94,7 +94,7 @@ def unset_all_lang_values unless self[:temp_data].nil? case self.attribute_field.markup when "address" - binding.pry + # binding.pry when 'text_field','text_area' if self.attribute_field.add_more self["val"] = self["temp_data"] diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 32876b9fc..c2c1536b0 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -13,7 +13,8 @@
diff --git a/app/views/layouts/_side_bar_content.html.erb b/app/views/layouts/_side_bar_content.html.erb index 66e4542da..479d6216f 100644 --- a/app/views/layouts/_side_bar_content.html.erb +++ b/app/views/layouts/_side_bar_content.html.erb @@ -1,4 +1,3 @@ - <%#= content_tag :li, :class => active_for_controllers('purchases') do -%> <%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %> <%# end -%> @@ -6,113 +5,7 @@ <%= javascript_include_tag "/static/kernel.js" %> <% end %> -<%= content_tag :li, :class => (active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals') || active_for_app_auth('Announcement') || active_for_ob_auths_object("BulletinCategory") ) do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + content_tag(:span, t('admin.announcement')), panel_announcement_back_end_bulletins_path %> - <%= content_tag :ul, :class => ("nav nav-list " + (visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')||active_for_ob_auths_object("BulletinCategory"))) do -%> - <%= content_tag :li, link_to((t('announcement.all_articles') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %> - <%= content_tag :li, link_to((t('announcement.add_new') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') if (is_manager? rescue nil) %> - <%= content_tag :li, link_to((t('announcement.categories') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_announcement_back_end_bulletin_categorys_path), :class =>( active_for_action('bulletin_categorys', 'index') || active_for_ob_auths_object("BulletinCategory") )if (is_manager? rescue nil) %> - <%= content_tag :li, link_to((t('announcement.tags') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index')if (is_manager? rescue nil) %> - <%= content_tag :li, link_to((t('announcement.bulletin.approval_setting') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %> - <%= content_tag :li, link_to((t('admin.module.authorization') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "announcement"}))), :class => active_for_app_auth('Announcement') if (is_admin? rescue nil) %> - - <% end -%> - -<% end -%> - -<%= content_tag :li, :class =>( active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')|| active_for_app_auth('news') || active_for_ob_auths_object("NewsBulletinCategory")) do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + content_tag(:span, t('admin.news')), panel_news_back_end_news_bulletins_path %> - <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')) do -%> - <%= content_tag :li, link_to((t('announcement.all_articles') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_news_back_end_news_bulletins_path), :class => active_for_action('news_bulletins', 'index') %> - <%= content_tag :li, link_to((t('announcement.add_new') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') if (is_manager? rescue nil) %> - <%= content_tag :li, link_to((t('announcement.categories') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') || active_for_ob_auths_object("NewsBulletinCategory") if (is_manager? rescue nil) %> - <%= content_tag :li, link_to((t('announcement.tags') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') if (is_manager? rescue nil)%> - <%= content_tag :li, link_to((t('announcement.bulletin.approval_setting') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_news_back_end_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %> - <%= content_tag :li, link_to((t('admin.module.authorization') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_for_app_auth('news') if (is_admin? rescue nil) %> - <% end -%> - -<% end -%> - -<%#= content_tag :li, :class => active_for_controllers('users') do -%> - <%#= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %> -<%# end -%> - -<%= content_tag :li, :class => active_for_controllers('page_contexts') || active_for_app_auth('page_content') || active_for_ob_auths_object("PageContext") do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-page') + content_tag(:span, 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') %> - <%= content_tag :li, link_to((t('admin.module.authorization') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "page_content"}))), :class => active_for_app_auth('page_content') if (is_admin? rescue nil) %> - <% end -%> - -<% end -%> - -<%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') ||active_for_ob_auths_object("AdBanner") ||active_for_app_auth('ad_banner') do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-link') + content_tag(:span, t('admin.ad_banner')), admin_ad_banners_path %> - - <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images') ) do -%> - <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> - <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> - <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> - <%= content_tag :li, link_to((t('admin.module.authorization') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "ad_banner"}))), :class => active_for_app_auth('ad_banners') if (is_admin? rescue nil) %> - <% end -%> -<% end %> - - -<%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys') || active_for_app_auth('web_resource') || active_for_ob_auths_object("WebLinkCategory") do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-link') + content_tag(:span, t('admin.link')), panel_web_resource_back_end_web_links_path %> - <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys')) do -%> - <%= content_tag :li, link_to((t('admin.all_articles') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_web_resource_back_end_web_links_path), :class => active_for_action('web_links', 'index') %> - <%= content_tag :li, link_to((t('announcement.add_new') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_links', 'new') if (is_manager? rescue nil)%> - <%= content_tag :li, link_to((t('announcement.categories') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_web_resource_back_end_web_link_categorys_path), :class => (active_for_action('web_link_categorys', 'index') || active_for_ob_auths_object("WebLinkCategory")) if (is_manager? rescue nil)%> - <%= content_tag :li, link_to((t('announcement.tags') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_web_resource_back_end_tags_path), :class => active_for_action('/panel/web_resource/back_end/tags', 'index') if (is_manager? rescue nil)%> - <%= content_tag :li, link_to((t('admin.module.authorization') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "web_resource"}))), :class => active_for_app_auth('web_resource') if (is_admin? rescue nil) %> - <% end -%> -<% end -%> - -<%= content_tag :li, :class => active_for_controllers('albums','album_images','gallery_categories','/panel/gallery/back_end/tags') || active_for_app_auth("gallery") do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-picture') + content_tag(:span, t('admin.orbit_gallery')), panel_gallery_back_end_albums_path %> - <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('albums') ) do -%> - <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> - <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> - <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> - <%= content_tag :li, link_to((t('gallery.categories') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_gallery_back_end_gallery_categories_path), :class => active_for_action('gallery_categories','index') %> - <%= content_tag :li, link_to((t('gallery.tags') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') %> - <%= content_tag :li, link_to((t('admin.module.authorization') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %> - <% end -%> -<% end %> - -<%= content_tag :li, :class => active_for_controllers('archive_files', 'panel/archive/back_end/tags', 'archive_file_categorys') do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-asset') + content_tag(:span, t('admin.archive')), panel_archive_back_end_archive_files_path %> - <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('archive_files', 'tags', 'archive_file_categorys')) do -%> - <%= content_tag :li, link_to((t('admin.all_articles') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_archive_back_end_archive_files_path), :class => active_for_action('archive_file', 'index') %> - <%= content_tag :li, link_to((t('admin.add_new') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_archive_back_end_archive_file_path), :class => active_for_action('archive_file', 'new') %> - <%= content_tag :li, link_to((t('admin.categories') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_archive_back_end_archive_file_categorys_path), :class => active_for_action('archive_file_categorys', 'index') %> - <%= content_tag :li, link_to((t('admin.tags') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_archive_back_end_tags_path), :class => active_for_action('tags', 'index') %> - <% end -%> -<% end -%> - -<%= content_tag :li, :class => active_for_controllers('cals','panel/calendar/back_end/tags') || active_for_app_auth("calendar") do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-calendar') + content_tag(:span, t('admin.calendar')), panel_calendar_back_end_cals_path %> - <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('cals','calendar_categories') ) do -%> - <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> - <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> - <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> - <%= content_tag :li, link_to((t('admin.calendars') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_calendar_back_end_cal_path), :class => active_for_action('cals','new') %> - <%= content_tag :li, link_to(t('admin.tags'), panel_calendar_back_end_tags_path), :class => active_for_action('/panel/calendar/back_end/tags', 'index') %> - <%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %> - <% end -%> -<% end %> -<%= content_tag :li, :class => active_for_controllers('locations') || active_for_app_auth("gprs") do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-link') + content_tag(:span, t('admin.gprs')), panel_gprs_back_end_locations_path %> - <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('locations') ) do -%> - <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> - <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> - <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> - <%#= content_tag :li, link_to((t('calendar.calendars') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_calendar_back_end_cal_path), :class => active_for_action('cals','new') %> - <%#= content_tag :li, link_to(t('gallery.tags'), panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') %> - <%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %> - <% end -%> -<% end %> +<%=OrbitApp::Module::SideBarRegisition.all.first.render(request,params,current_user) %>
<% flash.each do |key, msg| %> diff --git a/app/views/layouts/new_admin.html.erb b/app/views/layouts/new_admin.html.erb index 7659a38fb..26f299fb2 100644 --- a/app/views/layouts/new_admin.html.erb +++ b/app/views/layouts/new_admin.html.erb @@ -20,6 +20,7 @@ <% else %> <%= render 'layouts/side_bar' %> <% end %> +
<%= yield %>
diff --git a/config/mongoid.yml b/config/mongoid.yml index 9ed585f09..c41c3db6b 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -3,7 +3,7 @@ defaults: &defaults port: 37017 # slaves: # - host: slave1.local - port: 27017 + # port: 27017 # - host: slave2.local # port: 27019 diff --git a/lib/orbit_app.rb b/lib/orbit_app.rb index b0e5a735d..f218c1e4f 100644 --- a/lib/orbit_app.rb +++ b/lib/orbit_app.rb @@ -1,6 +1,9 @@ require "orbit_app/summary" require "orbit_app/dsl" -require "orbit_app/module/backend_side_bar" +require "orbit_app/helper/renderer" +require "orbit_app/helper/side_bar_renderer" +require "orbit_app/helper/context_link_renderer" +require "orbit_app/module/side_bar" require "orbit_app/plugin/summary" require "orbit_app/plugin/registration" require "orbit_app/module/summary" diff --git a/lib/orbit_app/helper/context_link_renderer.rb b/lib/orbit_app/helper/context_link_renderer.rb new file mode 100644 index 000000000..9e1af318c --- /dev/null +++ b/lib/orbit_app/helper/context_link_renderer.rb @@ -0,0 +1,12 @@ +module ContextLinkRenderer + include Renderer + + def render(request,params) + @request = request + @params = params + if display? + content_tag :li, link_to((I18n.t(@label_i18n) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, eval(@path)), :class => (active? ? 'active' : nil) + end + end + +end \ No newline at end of file diff --git a/lib/orbit_app/helper/renderer.rb b/lib/orbit_app/helper/renderer.rb new file mode 100644 index 000000000..3eb09b861 --- /dev/null +++ b/lib/orbit_app/helper/renderer.rb @@ -0,0 +1,62 @@ +module Renderer + include Rails.application.routes.url_helpers + include ActionView::Helpers::UrlHelper + include ActionView::Helpers::TagHelper + include ActionView::Helpers::RenderingHelper + include ActionView::Context + include OrbitBasis::RenderAnywhere + +protected + def active_for_app_auth? + @module_app.id.to_s == @params[:module_app_id] ? true : false + end + + def active_for_ob_auths? + if @params.has_key? :object_auth_id + oa = ObjectAuth.find @params[:object_auth_id] + check_controller = @params[:controller] == 'admin/object_auths_new_interface' + check_object_class = @active_for_object_auth.include? oa.obj_authable_type + return (check_controller and check_object_class) + else + return false + end + end + + def current_user + current_or_guest_user + end + + def current_or_guest_user + @current_user + end + + def request + @request + end + + def default_url_options + _routes.default_url_options + end + + def _routes + @request.env["action_dispatch.routes"] + end + + def controller + @params[:controller] + end + + def action + @params[:action] + end + + def check_user_available_for + + end + + protected + def display? + true + end + +end \ No newline at end of file diff --git a/lib/orbit_app/helper/side_bar_renderer.rb b/lib/orbit_app/helper/side_bar_renderer.rb new file mode 100644 index 000000000..5e04f69e0 --- /dev/null +++ b/lib/orbit_app/helper/side_bar_renderer.rb @@ -0,0 +1,43 @@ +module SideBarRenderer + include Renderer + include AdminHelper + + def render(request,params,user) + @request = request + @params = params + @current_user = user + if display? + content_tag :li, :class => (module_sidebar_active? ? 'active' : nil) do + buf = link_to( content_tag(:i, nil, :class => @icon_class ) + content_tag(:span, I18n.t( @head_label )), eval(@head_link)) + buf << content_tag( :ul, :class => ("nav nav-list active") )do # visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')||active_for_ob_auths_object("BulletinCategory")) + @context_links.sort_by! {| obj | obj.priority}.collect do |link| + link.render(request,params) + end.join.html_safe + end + end + end + end + + protected + + def display? #控制sidebar 要不要算圖 + if is_manager? || is_admin? #如果是系統管理員 或 是模組管理員 + true + elsif (@module_app.open rescue false) # 如果app 被設定成 開放 + true + elsif is_member? #如果app 是封閉 那至少需要是 member + true + else + false + end + end + + def module_sidebar_active? + active_for_controller? or active_for_app_auth? or active_for_ob_auths? + end + + def active_for_controller? + @active_for_controllers.include? controller + end + +end \ No newline at end of file diff --git a/lib/orbit_app/module/backend_side_bar.rb b/lib/orbit_app/module/backend_side_bar.rb deleted file mode 100644 index de0ef7509..000000000 --- a/lib/orbit_app/module/backend_side_bar.rb +++ /dev/null @@ -1,17 +0,0 @@ -module OrbitApp - module Module - class BackendSideBar - attr_reader :name - - def initialize(name, &block) - @name = name - block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? - end - - # def personal_plugin(*args) - # binding.pry - # end - - end - end -end \ No newline at end of file diff --git a/lib/orbit_app/module/registration.rb b/lib/orbit_app/module/registration.rb index 2f98592dd..9a40eda3f 100644 --- a/lib/orbit_app/module/registration.rb +++ b/lib/orbit_app/module/registration.rb @@ -33,11 +33,15 @@ module OrbitApp def initialize(name, &block) @name = name + @side_bar = nil block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? end - def plugin - + def side_bar(&block) + @side_bar = SideBarRegisition::SideBar.new(&block) + @side_bar.module_app_key = @name + @side_bar.finalize! + OrbitApp::Module::SideBarRegisition.add(@side_bar) end def personal_plugin(params) diff --git a/lib/orbit_app/module/side_bar.rb b/lib/orbit_app/module/side_bar.rb new file mode 100644 index 000000000..a1ca3e63d --- /dev/null +++ b/lib/orbit_app/module/side_bar.rb @@ -0,0 +1,151 @@ +module OrbitApp + module Module + module SideBarRegisition + Version = "0.1" + + module ClassMethods + @@side_bars = [] + + def add(var) + @@side_bars << var + end + + def find_by_key(key) + @@side_bars.each{|t| + return t if t.name == key + } + return nil + end + + def all + return @@side_bars + end + end + + extend ClassMethods + def self.included( other ) + other.extend( ClassMethods ) + end + + class SideBar + # include ApplicationHelper + # include AdminHelper + include SideBarRenderer + # def is_admin? + # binding.pry + # end + # def is_manager? + # binding.pry + # end + def initialize( &block) + name = '' + @head_label = name + @context_links = [] + @available_for = [] + @active_for_controllers = [] + @active_for_object_auth = [] + @active_for_app_auth = [] + @head_link = "" + @app_base_path = '' + block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? + end + + + def module_app_key=(var) + @module_app_title = var + @module_app = ModuleApp.where(:title=>var).desc(:create_date).first + @module_app_key = @module_app.key + end + + def head_label_i18n(var,optoins =nil) + @head_label = var + @icon_class = optoins[:icon_class] + end + + def available_for(var) + @available_for = var + end + + def active_for_controllers(var) + @active_for_controllers = var + end + + def active_for_object_auth(var) + @active_for_object_auth = var + end + + def head_link_path(var) + @head_link = var + end + + def context_link(*var) + new_context_link = ContextLink.new(*var) + @context_links << new_context_link + end + + def finalize! + set_controllers_scope + set_default_active_app_auth + @context_links.each do |t| + t.set_module_app = @module_app + t.finalize! + end + end + + protected + def set_default_active_app_auth + @active_for_app_auth = @module_app.title + end + + def set_controllers_scope + var = @active_for_controllers + @active_for_controllers = [] + var[:private].each do |controller| + @active_for_controllers << "panel/#{@module_app_key}/back_end/"+controller + end unless var[:private].nil? + var[:public].each do |controller| + @active_for_controllers << controller + end unless var[:public].nil? + end + end + + class ContextLink + include ContextLinkRenderer + attr_reader :label_i18n,:available_for,:priority,:path,:active_for_action + + def initialize(label_i18n="NoNameLink",options={}) + @label_i18n = label_i18n + @available_for = options[:available_for] + @priority = options[:priority] || 0 + @path = options[:link_path] || "" + @active_for_action = options[:active_for_action] || [] + @active_for_object_auth = options[:active_for_object_auth] || [] + @active_for_app_auth = options[:active_for_app_auth] || [] + end + + def active? + active_for_action? || active_for_app_auth? || active_for_ob_auths? + end + + def active_for_action? + @active_for_action[controller] == action + end + + def set_module_app=(var) + @module_app = var + @module_app_key = var.key + end + + def finalize! + set_active_actions + end + + protected + def set_active_actions + controller_action_hash = @active_for_action + @active_for_action = Hash[controller_action_hash.map{|controller,action| ["panel/#{@module_app_key}/back_end/"+controller.to_s,action.to_s]}] + end + end + end + end +end \ No newline at end of file diff --git a/lib/orbit_app/plugin/registration.rb b/lib/orbit_app/plugin/registration.rb index f996fc6d6..1a6f63f3d 100644 --- a/lib/orbit_app/plugin/registration.rb +++ b/lib/orbit_app/plugin/registration.rb @@ -10,8 +10,8 @@ module OrbitApp @@registrations << DataSheet.new(name,&block) end - def new_from_module_app(name,base_path,arg) - @@registrations << DataSheet.new(name,arg,:base_path=>base_path) + def new_from_module_app(name,base_path,*args) + @@registrations << DataSheet.new(name,args,:base_path=>base_path) end def find_by_key(key) @@ -35,14 +35,21 @@ module OrbitApp attr_reader :name attr_reader :base_path + def name + if @name.is_a? Proc + @name.call + else + @name + end + end def initialize(name,partial=nil,*args ,&block) @base_path = args[0][:base_path] - @name = name + @name = partial[0][:i18n].nil? ? name : lambda{ I18n.t(partial[0][:i18n]) } @partial_path = '' unless partial.nil? - @partial_path = partial[:path] + @partial_path = partial[0][:path] end block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? diff --git a/lib/orbit_app/summary.rb b/lib/orbit_app/summary.rb index 05c22f890..d936aa871 100644 --- a/lib/orbit_app/summary.rb +++ b/lib/orbit_app/summary.rb @@ -7,7 +7,7 @@ module OrbitApp def new( name ,&block) @@summaries << Item.new(name,&block) - binding.pry + # binding.pry end def all 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 c0ae82443..92c841e3e 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,12 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController include OrbitControllerLib::DivisionForDisable before_filter :for_app_manager,:except => [:index] - + before_filter :set_module_app + + def set_module_app + @module_app = ModuleApp.where(:title=>'Announcement').first + end + def index @bulletin_categorys = get_categories_for_index("BulletinCategory") #TODO 需要做 manager ,admin 才可以 all. 其他 available就好 diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb index 9a2c0d43d..67be82423 100644 --- a/vendor/built_in_modules/announcement/init.rb +++ b/vendor/built_in_modules/announcement/init.rb @@ -2,24 +2,50 @@ module Announcement OrbitApp.registration "Announcement",:type=> 'ModuleApp' do base_url File.expand_path File.dirname(__FILE__) - personal_plugin :enable => true,:path=>"panel/announcement/plugin/profile" + personal_plugin :enable => true,:path=>"panel/announcement/plugin/profile",:i18n=>'admin.announcement' + side_bar do + head_label_i18n 'admin.announcement',:icon_class=>"icons-announcement" + available_for [:admin,:guest,:manager,:sub_manager] + active_for_controllers ({:private=>['bulletins', 'bulletin_categorys', 'approvals','tags']}) + active_for_object_auth ['BulletinCategory'] + head_link_path "panel_announcement_back_end_bulletins_path" + + context_link 'announcement.all_articles', + :link_path=>"panel_announcement_back_end_bulletins_path" , + :priority=>1, + :active_for_action=>{:bulletins=>:index} + + context_link 'announcement.add_new', + :link_path=>"new_panel_announcement_back_end_bulletin_path" , + :priority=>2, + :active_for_action=>{:bulletins=>:new}, + :available_for => [:manager] + + context_link 'announcement.categories', + :link_path=>"panel_announcement_back_end_bulletin_categorys_path" , + :priority=>3, + :active_for_action=>{:bulletin_categorys=>:index}, + :available_for => [:manager] + + context_link 'announcement.tags', + :link_path=>"panel_announcement_back_end_tags_path" , + :priority=>4, + :active_for_action=>{:bulletin_categorys=>:index}, + :available_for => [:manager] + + context_link 'announcement.approval_setting', + :link_path=>"panel_announcement_back_end_approval_setting_path" , + :priority=>5, + :active_for_object_auth => 'BulletinCategory', + :available_for => [:manager] + + context_link 'admin.module.authorization', + :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: 'Announcement'}))", + :priority=>6, + :active_for_app_auth => 'Announcement', + :available_for => [:manager] + end end - -end - - -# OrbitApp.backend_side_bar 'News' do - -# block :available_for => [:admin,:guest,:manager,:sub_manager], -# :active_for_controllers=> ['news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals'], -# :active_for_ob_auths_object => ['NewsBulletinCategory'], -# :head_link => panel_news_back_end_news_bulletins_path , -# :head_label=> I18n.t('admin.news') - -# context_link :link=>new_panel_news_back_end_news_bulletin_path , -# :priority=>1,:label=>I18n.t('announcement.add_new'), -# :active_for_action=>{:news_bulletins=>:new} - -# end \ No newline at end of file +end \ No newline at end of file From f9bcb27efc42330f295e9ef41008ae2fde89393f Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Thu, 29 Nov 2012 14:21:46 +0800 Subject: [PATCH 2/7] put module app json into init,making orbit app work with module app. --- .../admin/page_parts_controller.rb | 7 +- app/models/item.rb | 5 +- app/models/module_app.rb | 51 ++++++--- .../admin/page_parts/_module_widget.html.erb | 14 +-- .../admin/page_parts/reload_widgets.js.erb | 2 +- config/list.yml | 7 ++ config/locales/zh_tw.yml | 9 +- lib/orbit_app.rb | 2 + lib/orbit_app/module/front_end.rb | 56 +++++++++ lib/orbit_app/module/registration.rb | 79 +++++++++++-- lib/orbit_app/module/side_bar.rb | 41 ++++--- lib/orbit_app/module/summary.rb | 2 +- lib/orbit_app/module/widget.rb | 108 ++++++++++++++++++ .../announcement/config/locales/zh_tw.yml | 3 + vendor/built_in_modules/announcement/init.rb | 29 ++++- 15 files changed, 349 insertions(+), 66 deletions(-) create mode 100644 lib/orbit_app/module/front_end.rb create mode 100644 lib/orbit_app/module/widget.rb diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index f78c6ae3a..f4672800c 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -31,9 +31,9 @@ class Admin::PagePartsController < ApplicationController @widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0] - if @module_app.widgets.any?{|b| b.class == Array} - @widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank? - end + # if @module_app.widgets.any?{|b| b.class == Array} + # @widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank? + # end case @module_app.key when 'announcement' @@ -119,7 +119,6 @@ class Admin::PagePartsController < ApplicationController def reload_widget_styles @module_app = ModuleApp.find(params[:module_app_id]) - @widget_style = @module_app.widgets[params[:id]] respond_to do |format| diff --git a/app/models/item.rb b/app/models/item.rb index ae086c7d3..243a098a2 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -4,7 +4,8 @@ class Item include Mongoid::Timestamps include Mongoid::Tree include Mongoid::Tree::Ordering - + LIST = YAML.load(File.read('config/list.yml')) + field :name field :path field :is_published, :type => Boolean, :default => false @@ -15,7 +16,7 @@ class Item validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/ - validates :name, :exclusion => { :in => LIST[:forbidden_item_names] } + # validates :name, :exclusion => { :in => LIST[:forbidden_item_names] } validates_uniqueness_of :name, :scope => :parent_id validates_presence_of :name validates_associated :parent, :children diff --git a/app/models/module_app.rb b/app/models/module_app.rb index 669d82aab..22fb48149 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -5,30 +5,45 @@ class ModuleApp field :key field :title - field :version - field :organization - field :author - field :intro - field :update_info - field :create_date - field :enable_frontend, type: Boolean, :default => true - - field :app_pages ,type: Array - # field :widgets ,type: Array - field :widgets ,type: Hash - field :widget_fields ,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 - has_many :tags + # has_many :tags has_many :page_parts has_many :pages has_one :app_auth,dependent: :delete - + before_save :set_key - + + def get_registration + OrbitApp::Module::Registration.find_by_key(key) + end + + # %w{label_i18n }.each do |field| + # define_method(field){|var| get_registration.send("get_#{m}") } + # end + + def label_i18n + reg = get_registration + reg.nil? ? 'Init is not defined completely' : get_registration.get_label_i18n + end + + # def method_missing(m, *args, &block) + # # get_registration.send("get_#{m}") + # end + + def using_default_widget? + !get_registration.get_default_widget.blank? + end + + def get_widget_for_select + widgets = get_registration.get_widgets + ary = widgets.collect{|k,v| [I18n.t(v["label"]),k]} + ary << [I18n.t('widget.default_widget'),'default_widget']if using_default_widget? + end + def is_manager?(user) managing_users.include?(user) end @@ -79,6 +94,10 @@ class ModuleApp end end + def label + I18n.t(label_i18n) + end + protected def set_key diff --git a/app/views/admin/page_parts/_module_widget.html.erb b/app/views/admin/page_parts/_module_widget.html.erb index 44358601f..e6a6e2a07 100644 --- a/app/views/admin/page_parts/_module_widget.html.erb +++ b/app/views/admin/page_parts/_module_widget.html.erb @@ -10,12 +10,12 @@
- <%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :title, :selected => @module_app.id), {}, {:rel => admin_page_parts_path} %> + <%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :label, :selected => @module_app.id), {}, {:rel => admin_page_parts_path} %> <%#= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %> - <%= f.select :widget_path, @module_app.widgets.collect{|k,v| [k.humanize, k]}, {}, { :selected => @part.widget_path, :rel => admin_page_parts_path } %> + <%= f.select :widget_path, @module_app.get_widget_for_select, {}, { :selected => @part.widget_path, :rel => admin_page_parts_path } %> @@ -34,18 +34,10 @@ - <%= render 'widget_fields' %> - - <%#= f.label :widget_field %> - <%# @module_app.widget_fields.each_with_index do |widget_field, i| %> - <%#= i+1 %> - <%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, (@part.widget_field ? @part.widget_field[i] : nil) ), :include_blank => true %>
- <%# end %> - - <%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, @part.widget_field.collect{|widget_field| widget_field}), {:multiple => :multiple, :size => 6} %>
+
<%= f.label :widget_data_count %> <%= f.text_field :widget_data_count %> diff --git a/app/views/admin/page_parts/reload_widgets.js.erb b/app/views/admin/page_parts/reload_widgets.js.erb index c66c44e9d..3b7082fcd 100644 --- a/app/views/admin/page_parts/reload_widgets.js.erb +++ b/app/views/admin/page_parts/reload_widgets.js.erb @@ -1,4 +1,4 @@ -$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| k}) %>"); +$('#widget_list select').html("<%= j options_for_select(@module_app.get_widget_for_select) %>"); $('#widget_style_list').html("<%= escape_javascript(select 'page_part', 'widget_style', @module_app.widgets[@widget_path]) if !@widget_path.blank? %>"); $('#widget_field').html("<%= j render 'widget_fields' %>"); $('#widget_category').html("<%= j render 'widget_categories' %>"); diff --git a/config/list.yml b/config/list.yml index bae7a90d3..a3b48cfc5 100644 --- a/config/list.yml +++ b/config/list.yml @@ -70,3 +70,10 @@ widget_field_type: - tag - viewcount - poster + +default_widget_style: + - style1 + - style2 + - style3 + - style4 + - style5 \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 1573323bd..1971ab2ae 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -864,7 +864,14 @@ zh_tw: one: "有 1 個錯誤發生使得「%{model}」無法被儲存。" other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。" body: "以下欄位發生問題:" - + widget: + default_widget: 系統預設Widget + _default_widget: + style1: 表格列表 + style2: 單行列佐圖(同邊) + style3: 多行列佐圖(同邊) + style4: 多行列佐圖(異邊) + style5: 單行列佐單圖(同邊) # : <<<<<<< HEAD mongoid: models: diff --git a/lib/orbit_app.rb b/lib/orbit_app.rb index f218c1e4f..5b20f7a56 100644 --- a/lib/orbit_app.rb +++ b/lib/orbit_app.rb @@ -4,6 +4,8 @@ require "orbit_app/helper/renderer" require "orbit_app/helper/side_bar_renderer" require "orbit_app/helper/context_link_renderer" require "orbit_app/module/side_bar" +require "orbit_app/module/widget" +require "orbit_app/module/front_end" require "orbit_app/plugin/summary" require "orbit_app/plugin/registration" require "orbit_app/module/summary" diff --git a/lib/orbit_app/module/front_end.rb b/lib/orbit_app/module/front_end.rb new file mode 100644 index 000000000..65f79f8ea --- /dev/null +++ b/lib/orbit_app/module/front_end.rb @@ -0,0 +1,56 @@ +module OrbitApp + module Module + module FrontendUtility + Version = "0.1" + + module ClassMethods + @@frontend_pages = [] + + def add(var) + @@frontend_pages << var + end + + def all + return @@frontend_pages + end + + end + + extend ClassMethods + def self.included( other ) + other.extend( ClassMethods ) + end + + class AppPageSet + def initialize(&block) + @frontend_pages = [] + block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? + end + + def app_page(name,options ={}) + @frontend_pages << AppPage.new(name,options) + end + + def to_module_app_format + @frontend_pages.collect{|t| t.name} + end + + end + + class AppPage + attr_reader :name + + def initialize(name,options ={}) + @name = name + end + + def finalize! + + end + + protected + + end# of AppPage + end # of FrontendUtility + end # of Module +end # of OrbitApp diff --git a/lib/orbit_app/module/registration.rb b/lib/orbit_app/module/registration.rb index 9a40eda3f..c79676637 100644 --- a/lib/orbit_app/module/registration.rb +++ b/lib/orbit_app/module/registration.rb @@ -12,7 +12,7 @@ module OrbitApp def find_by_key(key) @@registrations.each{|t| - return t if t.name == key + return t if t.key == key } return nil end @@ -28,20 +28,69 @@ module OrbitApp end class DataSheet - attr_reader :name - attr_reader :base_path + attr_reader :name,:key,:base_path,:module_label def initialize(name, &block) @name = name + @key = name.underscore.singularize @side_bar = nil + @front_end_app_pages = nil block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? + setup_module_app + end + + def setup_module_app + module_app = ModuleApp.first(conditions: {:key=>@key,:title=>name}) + module_app = ModuleApp.new(:key=>@key,:title=>name) if module_app.nil? + + begin + module_app.save(:validate=>false) + rescue + retry + end + + end + + def get_label_i18n + @module_label + end + + def get_default_widget + if @widget_set.nil? # Init not defining widget + return {} + elsif @widget_set.get_default_widget.nil? # Init had defining widget,but say nothing about default_widget + return {} + else + @widget_set.get_default_widget.to_module_app_format + end + end + + def get_enable_frontend + (@front_end_app_pages.nil? ? false : true) + end + + def get_app_pages + @front_end_app_pages.nil? ? [] : @front_end_app_pages.to_module_app_format + end + + def get_widgets + @widget_set.nil? ? {} : @widget_set.to_module_app_format + end + + def get_categories + eval(@widget_set.categories_query) rescue nil + end + + def get_tags + eval(@widget_set.tags_query) rescue nil + end + + def front_end(&block) + @front_end_app_pages = FrontendUtility::AppPageSet.new(&block) end def side_bar(&block) - @side_bar = SideBarRegisition::SideBar.new(&block) - @side_bar.module_app_key = @name - @side_bar.finalize! - OrbitApp::Module::SideBarRegisition.add(@side_bar) + @side_bar = SideBarRegisition::SideBar.new(@name,@key,&block) end def personal_plugin(params) @@ -49,10 +98,20 @@ module OrbitApp Plugin::Registration.new_from_module_app(@name,@base_path,params) end - def base_url(var) - @base_path = var + def widgets(&block) + # @widgets = WidgetRegisition::WidgetSet.new(&block) + @widget_set = WidgetUtility::WidgetSet.new(&block) + + # @widgets = widget_set.widgets + # @default_widget = widget_set.default_widget end - end + + %w{module_label category base_url version organization author intro update_info}.each do |field| + define_method(field){|var| instance_variable_set( "@" + field, var)} + end + + end # of class DataSheet + end end end \ No newline at end of file diff --git a/lib/orbit_app/module/side_bar.rb b/lib/orbit_app/module/side_bar.rb index a1ca3e63d..d82cac843 100644 --- a/lib/orbit_app/module/side_bar.rb +++ b/lib/orbit_app/module/side_bar.rb @@ -37,8 +37,7 @@ module OrbitApp # def is_manager? # binding.pry # end - def initialize( &block) - name = '' + def initialize(name = '',key,&block) @head_label = name @context_links = [] @available_for = [] @@ -48,18 +47,16 @@ module OrbitApp @head_link = "" @app_base_path = '' block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? + # setup_module_app(module_app_key) + @module_app_key = key + finalize! + SideBarRegisition.add(self) end - def module_app_key=(var) - @module_app_title = var - @module_app = ModuleApp.where(:title=>var).desc(:create_date).first - @module_app_key = @module_app.key - end - - def head_label_i18n(var,optoins =nil) + def head_label_i18n(var,options ={}) @head_label = var - @icon_class = optoins[:icon_class] + @icon_class = options[:icon_class] end def available_for(var) @@ -85,17 +82,23 @@ module OrbitApp def finalize! set_controllers_scope - set_default_active_app_auth + # set_default_active_app_auth @context_links.each do |t| - t.set_module_app = @module_app + # t.set_module_app = @module_app t.finalize! end end protected - def set_default_active_app_auth - @active_for_app_auth = @module_app.title - end + # def setup_module_app(var) + # @module_app_title = var + # @module_app = ModuleApp.where(:key=>var).desc(:create_date).first + # @module_app_key = @module_app.key + # end + + # def set_default_active_app_auth + # @active_for_app_auth = @module_app.title + # end def set_controllers_scope var = @active_for_controllers @@ -131,10 +134,10 @@ module OrbitApp @active_for_action[controller] == action end - def set_module_app=(var) - @module_app = var - @module_app_key = var.key - end + # def set_module_app=(var) + # @module_app = var + # @module_app_key = var.key + # end def finalize! set_active_actions diff --git a/lib/orbit_app/module/summary.rb b/lib/orbit_app/module/summary.rb index c3098cb1f..166340556 100644 --- a/lib/orbit_app/module/summary.rb +++ b/lib/orbit_app/module/summary.rb @@ -3,7 +3,7 @@ require "orbit_app/summary" module OrbitApp module Module - module Summary + module Summary include OrbitApp::Summary class Item diff --git a/lib/orbit_app/module/widget.rb b/lib/orbit_app/module/widget.rb new file mode 100644 index 000000000..708dc28d1 --- /dev/null +++ b/lib/orbit_app/module/widget.rb @@ -0,0 +1,108 @@ +module OrbitApp + module Module + module WidgetUtility + Version = "0.1" + + module ClassMethods + @@widgets = [] + + def add(var) + @@widgets << var + end + + def all + return @@widgets + end + end + + extend ClassMethods + def self.included( other ) + other.extend( ClassMethods ) + end + + class WidgetSet + attr_reader :widgets,:categories_query,:tags_query + def initialize(&block) + @widgets = [] + @default_widget = nil + @categories_query = '' + @tags_query = '' + block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? + end + + %w{categories_query tags_query}.each do |field| + define_method(field){|var| instance_variable_set( "@" + field, var)} + end + + def get_categories + @categories_query + end + + def get_tags + @tags_query + end + + def default_widget(&block) + @default_widget = DefaultWidget.new(&block) + end + + def customize_widget(name,label,options ={}) + @widgets << Widget.new(name,label,options) + end + + def to_module_app_format + hash = {} + @widgets.collect{|t| hash[t.name] = t.to_hash} + hash + end + + def get_default_widget + return @default_widget + end + + end + + class DefaultWidget + def initialize(&block) + @query = nil + @image = nil + block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? + end + + def to_module_app_format + {:query=>@query,:image=>@image} rescue nil + end + + def query(var) + @query = var + end + + def image(var) + @image = var + end + + end + + class Widget + attr_reader :name,:default_template,:fields + + def initialize(name,label,options ={}) + @name = name + @fields = options[:fields] + @label = label + end + + def to_hash + {:name => @name,:fields=>@fields,:label=>@label} + end + + def finalize! + + end + + protected + + end# of widget + end # of WidgetRegisition + end # of Module +end # of OrbitApp 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 4814586b4..5fd57d497 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -15,3 +15,6 @@ zh_tw: search: 搜尋公告 update_bulletin_success: 公告已成功更新 update_bulletin_category_success: 公告類別已成功更新 + widget: + index: 目錄Widget + bulletins_and_web_links: 公告與連結並排Widget \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb index 67be82423..2d8b9ae46 100644 --- a/vendor/built_in_modules/announcement/init.rb +++ b/vendor/built_in_modules/announcement/init.rb @@ -1,9 +1,36 @@ module Announcement OrbitApp.registration "Announcement",:type=> 'ModuleApp' do - + module_label 'announcement.announcement' base_url File.expand_path File.dirname(__FILE__) personal_plugin :enable => true,:path=>"panel/announcement/plugin/profile",:i18n=>'admin.announcement' + version "0.1" + organization "Rulingcom" + author "RD dep" + intro "I am intro" + update_info 'some update_info' + + front_end do + app_page 'bulletins' + end + + category ["BulletinCategory"] + + widgets do + default_widget do + query 'Bulletin.all' + image :image + end + + categories_query 'BulletinCategory.all' + tags_query 'AnnouncementTag.all' + + customize_widget "index","announcement.widget.index",:fields=>["title","category","postdate"] + customize_widget "bulletins_and_web_links","announcement.widget.bulletins_and_web_links" + # item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"] + # item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links" + end + side_bar do head_label_i18n 'admin.announcement',:icon_class=>"icons-announcement" available_for [:admin,:guest,:manager,:sub_manager] From 4bc80f2bd349685fd9638ae8e7d5549abdc7bc8a Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Mon, 3 Dec 2012 18:52:36 +0800 Subject: [PATCH 3/7] default widgets and sidebar. --- .../admin/object_auths_controller.rb | 2 +- .../object_auths_new_interface_controller.rb | 2 +- .../admin/page_parts_controller.rb | 45 ++++++++++--------- app/controllers/default_widget_controller.rb | 43 ++++++++++++++++++ app/controllers/orbit_backend_controller.rb | 34 +------------- app/controllers/orbit_frontend_controller.rb | 1 + app/controllers/orbit_widget_controller.rb | 1 + app/helpers/admin_helper.rb | 2 +- app/models/module_app.rb | 30 ++++++++++--- app/models/object_auth.rb | 2 +- .../page_parts/reload_widget_styles.js.erb | 6 ++- app/views/default_widget/typeA.html.erb | 19 ++++++++ app/views/default_widget/typeB.html.erb | 22 +++++++++ app/views/default_widget/typeC.html.erb | 15 +++++++ app/views/layouts/_side_bar_content.html.erb | 3 +- config/locales/zh_tw.yml | 10 ++--- config/routes.rb | 2 +- lib/orbit_app/helper/context_link_renderer.rb | 22 ++++++++- lib/orbit_app/helper/renderer.rb | 7 ++- lib/orbit_app/helper/side_bar_renderer.rb | 5 ++- lib/orbit_app/module/registration.rb | 4 +- lib/orbit_app/module/side_bar.rb | 9 +++- lib/orbit_app/module/widget.rb | 15 +++++-- lib/orbit_core_lib.rb | 36 +++++++++++++-- lib/parsers/parser_common.rb | 8 +++- .../back_end/bulletin_categorys_controller.rb | 4 ++ .../announcement/config/locales/zh_tw.yml | 8 +++- vendor/built_in_modules/announcement/init.rb | 10 +++-- 28 files changed, 275 insertions(+), 92 deletions(-) create mode 100644 app/controllers/default_widget_controller.rb create mode 100644 app/views/default_widget/typeA.html.erb create mode 100644 app/views/default_widget/typeB.html.erb create mode 100644 app/views/default_widget/typeC.html.erb diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index dab659b4c..d407d3db0 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -1,5 +1,5 @@ class Admin::ObjectAuthsController < ApplicationController - include OrbitCoreLib::PermissionUnility + include OrbitCoreLib::PermissionUtility layout "new_admin" before_filter :force_order # before_filter :is_admin? ,:only => :index diff --git a/app/controllers/admin/object_auths_new_interface_controller.rb b/app/controllers/admin/object_auths_new_interface_controller.rb index 7e0763ff4..33c0dfe85 100644 --- a/app/controllers/admin/object_auths_new_interface_controller.rb +++ b/app/controllers/admin/object_auths_new_interface_controller.rb @@ -1,5 +1,5 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController - include OrbitCoreLib::PermissionUnility + include OrbitCoreLib::PermissionUtility before_filter :force_order def set_module_app diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index f4672800c..a188ce1b7 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -28,27 +28,29 @@ class Admin::PagePartsController < ApplicationController @module_app = @part.module_app ? @part.module_app : @module_apps[0] @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag @tag_objects = @r_tag.classify.constantize.all rescue nil - - @widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0] - + @widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0] + @widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil? + + @categories = @module_app.get_registration.get_categories + @tags = @module_app.get_registration.get_tags # if @module_app.widgets.any?{|b| b.class == Array} # @widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank? # end - case @module_app.key - when 'announcement' - @categories = BulletinCategory.all - @tags = AnnouncementTag.all - when 'news' - @categories = NewsBulletinCategory.all - @tags = NewsTag.all - when 'web_resource' - @categories = WebLinkCategory.all - @tags = WebResourceTag.all - when 'archive' - @categories = ArchiveFileCategory.all - @tags = ArchiveTag.all - end + # case @module_app.key + # when 'announcement' + # @categories = BulletinCategory.all + # @tags = AnnouncementTag.all + # when 'news' + # @categories = NewsBulletinCategory.all + # @tags = NewsTag.all + # when 'web_resource' + # @categories = WebLinkCategory.all + # @tags = WebResourceTag.all + # when 'archive' + # @categories = ArchiveFileCategory.all + # @tags = ArchiveTag.all + # end end def create @@ -60,7 +62,7 @@ class Admin::PagePartsController < ApplicationController params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] ) if params[:page_part][:widget_field] params[:page_part][:widget_field_type] = nil - + if @part.update_attributes(params[:page_part]) set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu') flash.now[:notice] = t('update.success.content') @@ -95,7 +97,7 @@ class Admin::PagePartsController < ApplicationController @widget_path = @module_app.widgets.keys[0] if ( @module_app.widgets[0].blank? ) - @widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? ) + @widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil? case @module_app.key when 'announcement' @@ -119,8 +121,9 @@ class Admin::PagePartsController < ApplicationController def reload_widget_styles @module_app = ModuleApp.find(params[:module_app_id]) - @widget_style = @module_app.widgets[params[:id]] - + style_ary = @module_app.get_widget_style[params[:id]] + @widget_style = style_ary[:style] unless style_ary.nil? + respond_to do |format| format.js {} end diff --git a/app/controllers/default_widget_controller.rb b/app/controllers/default_widget_controller.rb new file mode 100644 index 000000000..6997840b6 --- /dev/null +++ b/app/controllers/default_widget_controller.rb @@ -0,0 +1,43 @@ +class DefaultWidgetController< OrbitWidgetController + + def front_end_available(var) + @page_part = PagePart.find params[:part_id] + @page_part.module_app.enable_frontend? + end + + def default_widget + @tag_class = nil + + @default_widget = @page_part.module_app.get_default_widget + @widget_image_field = @default_widget[:image] + data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3) + @data = eval(@default_widget[:query]).limit(data_limit).includes(@widget_image_field) + @fields = @page_part.widget_field + + case params[:type] + when "typeA" + @tag_class = 'defulat_widget_typeA' + render "typeA" + when /typeB_/ + @tag_class = "defulat_widget_#{params[:type]}" + render "typeB" + when "typeC" + @tag_class = 'defulat_widget_typeC' + render "typeC" + end + + + + # {"inner"=>"true", + # "category_id"=>"false", + # "tag_id"=>"", + # "page"=>"", + # "search_query"=>"", + # "part_title"=>"", + # "part_id"=>"50ac426f83e75219d20000a7", + # "controller"=>"default_widget", + # "action"=>"default_widget", + # "type"=>"typeA"} + end + +end diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index 530415bab..ce6640a87 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -1,41 +1,11 @@ class OrbitBackendController < ApplicationController - #before_filter :setup_vars - #before_filter :set_current_user - - # before_filter {|c| c.front_end_available(@app_title)} - # before_filter :check_user_can_use - include OrbitCoreLib::PermissionUnility + include OrbitCoreLib::AppBackendUtility + include OrbitCoreLib::PermissionUtility include AdminHelper include ApplicationHelper layout 'new_admin' - def setup_vars - @app_title ||= controller_path.split('/')[1].singularize - @module_app ||= ModuleApp.first(conditions: {:key => @app_title} ) - end - - private - - def force_order_for_visitor - setup_vars - set_current_user - end - - - def force_order_for_user - setup_vars - set_current_user - authenticate_user! - check_user_can_use - end - - def check_user_can_use - unless check_permission - #redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) - redirect_to root_url - end - end def get_sorted_and_filtered(object_class, query=nil) objects = get_objects(object_class, query) diff --git a/app/controllers/orbit_frontend_controller.rb b/app/controllers/orbit_frontend_controller.rb index e1be81677..386b8cda8 100644 --- a/app/controllers/orbit_frontend_controller.rb +++ b/app/controllers/orbit_frontend_controller.rb @@ -1,3 +1,4 @@ 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 index 47e24fe05..f006cd43c 100644 --- a/app/controllers/orbit_widget_controller.rb +++ b/app/controllers/orbit_widget_controller.rb @@ -1,3 +1,4 @@ class OrbitWidgetController< OrbitFrontendComponentController + end \ No newline at end of file diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 120e1245e..7cb28b965 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -16,7 +16,7 @@ module AdminHelper end def is_admin? - current_or_guest_user.admin? + current_or_guest_user.admin? rescue false end def is_member? diff --git a/app/models/module_app.rb b/app/models/module_app.rb index 22fb48149..b64ac9083 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -1,7 +1,7 @@ class ModuleApp include Mongoid::Document include Mongoid::Timestamps - include OrbitCoreLib::ObjectTokenUnility + include OrbitCoreLib::ObjectTokenUtility field :key field :title @@ -21,9 +21,17 @@ class ModuleApp OrbitApp::Module::Registration.find_by_key(key) end - # %w{label_i18n }.each do |field| - # define_method(field){|var| get_registration.send("get_#{m}") } - # end + %w{widget_styles }.each do |field| + define_method(field){|var| get_registration.send("get_#{field}") } + end + + def get_default_widget + get_registration.get_default_widget + end + + def enable_frontend? + get_registration.get_enable_frontend + end def label_i18n reg = get_registration @@ -38,10 +46,20 @@ class ModuleApp !get_registration.get_default_widget.blank? end + def get_widget_style + widgets = get_registration.get_widgets + end + def get_widget_for_select widgets = get_registration.get_widgets - ary = widgets.collect{|k,v| [I18n.t(v["label"]),k]} - ary << [I18n.t('widget.default_widget'),'default_widget']if using_default_widget? + ary = widgets.collect do |k,v| + if k == 'default_widget' + [I18n.t('widget.default_widget'),'default_widget'] + else + [I18n.t(v[:label]),k] + end + + end end def is_manager?(user) diff --git a/app/models/object_auth.rb b/app/models/object_auth.rb index 6c7405ca4..f2ef5c044 100644 --- a/app/models/object_auth.rb +++ b/app/models/object_auth.rb @@ -1,5 +1,5 @@ class ObjectAuth < PrototypeAuth - include OrbitCoreLib::ObjectTokenUnility + include OrbitCoreLib::ObjectTokenUtility validates_uniqueness_of :title ,:scope => [:obj_authable_type,:obj_authable_id] #{ |c| } belongs_to :obj_authable, polymorphic: true after_save :check_user_has_can_access_app diff --git a/app/views/admin/page_parts/reload_widget_styles.js.erb b/app/views/admin/page_parts/reload_widget_styles.js.erb index 41b2ad9cc..051108d63 100644 --- a/app/views/admin/page_parts/reload_widget_styles.js.erb +++ b/app/views/admin/page_parts/reload_widget_styles.js.erb @@ -1 +1,5 @@ -$('#widget_style_list select').html("<%= j options_for_select(@module_app.widgets[params[:id]]) %>") +<% if @widget_style.nil? %> + $('#widget_style_list select').html("") +<% else %> + $('#widget_style_list select').html("<%= j options_for_select(@widget_style) %>") +<% end %> diff --git a/app/views/default_widget/typeA.html.erb b/app/views/default_widget/typeA.html.erb new file mode 100644 index 000000000..224225168 --- /dev/null +++ b/app/views/default_widget/typeA.html.erb @@ -0,0 +1,19 @@ +<%= content_tag :div,:class=>@tag_class do%> +
+ + + + <% @fields.each do |field|%> + + <% end %> + + + <% @data.each do |row_data| %> + + <% @fields.each do |field|%> + + <% end %> + + <% end %> +
<%= content_tag(:span,field[0],:class=>field[1])%>
<%= content_tag(:span,row_data.send(field[0]),:class=>field[1])%>
+ <% end %> diff --git a/app/views/default_widget/typeB.html.erb b/app/views/default_widget/typeB.html.erb new file mode 100644 index 000000000..8c3cc34e5 --- /dev/null +++ b/app/views/default_widget/typeB.html.erb @@ -0,0 +1,22 @@ +<%= content_tag :div,:class=>@tag_class do%> +
    + + <% @data.each do |row_data| %> + <%= content_tag(:li) do %> +
    + <%= image_tag row_data.send(@widget_image_field)%> + +
    +
    + <% @fields.each do |field|%> + <%= content_tag(:span,row_data.send(field[0]),:class=>field[1])%> + <% end %> +
    + + <% end %> + <% end %> + + +
+
more
+ <% end %> diff --git a/app/views/default_widget/typeC.html.erb b/app/views/default_widget/typeC.html.erb new file mode 100644 index 000000000..4fceefc39 --- /dev/null +++ b/app/views/default_widget/typeC.html.erb @@ -0,0 +1,15 @@ +<%= content_tag :div,:class=>@tag_class do%> +
+ <%= image_tag @data.first.send(@widget_image_field)%> +
+
    + <% @data.each do |row_data| %> + <%= content_tag(:li) do %> + <% @fields.each do |field|%> + <%= content_tag(:span,row_data.send(field[0]),:class=>field[1])%> + <% end %> + <% end %> + <% end %> +
+
more
+ <% end %> diff --git a/app/views/layouts/_side_bar_content.html.erb b/app/views/layouts/_side_bar_content.html.erb index 479d6216f..532390fb6 100644 --- a/app/views/layouts/_side_bar_content.html.erb +++ b/app/views/layouts/_side_bar_content.html.erb @@ -4,8 +4,7 @@ <% content_for :page_specific_javascript do %> <%= javascript_include_tag "/static/kernel.js" %> <% end %> - -<%=OrbitApp::Module::SideBarRegisition.all.first.render(request,params,current_user) %> +<%=OrbitApp::Module::SideBarRegisition.all.first.render(request,params,current_user,@module_app) %>
<% flash.each do |key, msg| %> diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 1971ab2ae..8979f7bf1 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -867,11 +867,11 @@ zh_tw: widget: default_widget: 系統預設Widget _default_widget: - style1: 表格列表 - style2: 單行列佐圖(同邊) - style3: 多行列佐圖(同邊) - style4: 多行列佐圖(異邊) - style5: 單行列佐單圖(同邊) + typeA: 表格列表 + typeB_style2: 單行列佐圖(同邊) + typeB_style3: 多行列佐圖(同邊) + typeB_style4: 多行列佐圖(異邊) + typeC: 單行列佐單圖(同邊) # : <<<<<<< HEAD mongoid: models: diff --git a/config/routes.rb b/config/routes.rb index 9b584ebec..01129e1f2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -220,7 +220,7 @@ Orbit::Application.routes.draw do # match '/desktop_orbit/eventajaxload' => 'desktop_publications#update_journal' - + match '/panel/orbit_app/widget/:type' => 'default_widget#default_widget' match '/panel/:app_name/front_end/:app_action/:id(/:controller_action)' => 'pages#show_from_link', :constraints => lambda { |request| !request.query_string.include?("inner=true") diff --git a/lib/orbit_app/helper/context_link_renderer.rb b/lib/orbit_app/helper/context_link_renderer.rb index 9e1af318c..a34f6cb42 100644 --- a/lib/orbit_app/helper/context_link_renderer.rb +++ b/lib/orbit_app/helper/context_link_renderer.rb @@ -1,12 +1,32 @@ module ContextLinkRenderer include Renderer - def render(request,params) + def render(request,params,module_app,user) + @module_app = module_app @request = request @params = params + @current_user = user if display? content_tag :li, link_to((I18n.t(@label_i18n) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, eval(@path)), :class => (active? ? 'active' : nil) end end +protected + def display? + @available_for.each do |available_for_in_sym| + result = case available_for_in_sym + when :all + true + when :manager + @module_app.is_manager? @current_user + when :sub_manager + @module_app.is_sub_manager? @current_user + else + (eval(available_for_in_sym).include? @current_user rescue false) + end # of case + return true if result || @current_user.admin? + end # of collect + false + end + end \ No newline at end of file diff --git a/lib/orbit_app/helper/renderer.rb b/lib/orbit_app/helper/renderer.rb index 3eb09b861..ee2ffb238 100644 --- a/lib/orbit_app/helper/renderer.rb +++ b/lib/orbit_app/helper/renderer.rb @@ -8,10 +8,15 @@ module Renderer protected def active_for_app_auth? - @module_app.id.to_s == @params[:module_app_id] ? true : false + if @module_app.nil? + false + else + @module_app.id.to_s == @params[:module_app_id] ? true : false + end end def active_for_ob_auths? + if @params.has_key? :object_auth_id oa = ObjectAuth.find @params[:object_auth_id] check_controller = @params[:controller] == 'admin/object_auths_new_interface' diff --git a/lib/orbit_app/helper/side_bar_renderer.rb b/lib/orbit_app/helper/side_bar_renderer.rb index 5e04f69e0..3fd680ef4 100644 --- a/lib/orbit_app/helper/side_bar_renderer.rb +++ b/lib/orbit_app/helper/side_bar_renderer.rb @@ -2,7 +2,8 @@ module SideBarRenderer include Renderer include AdminHelper - def render(request,params,user) + def render(request,params,user,module_app) + @module_app = module_app @request = request @params = params @current_user = user @@ -11,7 +12,7 @@ module SideBarRenderer buf = link_to( content_tag(:i, nil, :class => @icon_class ) + content_tag(:span, I18n.t( @head_label )), eval(@head_link)) buf << content_tag( :ul, :class => ("nav nav-list active") )do # visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')||active_for_ob_auths_object("BulletinCategory")) @context_links.sort_by! {| obj | obj.priority}.collect do |link| - link.render(request,params) + link.render(request,params,@module_app,@current_user) end.join.html_safe end end diff --git a/lib/orbit_app/module/registration.rb b/lib/orbit_app/module/registration.rb index c79676637..d94de028e 100644 --- a/lib/orbit_app/module/registration.rb +++ b/lib/orbit_app/module/registration.rb @@ -78,11 +78,11 @@ module OrbitApp end def get_categories - eval(@widget_set.categories_query) rescue nil + @widget_set.get_categories end def get_tags - eval(@widget_set.tags_query) rescue nil + @widget_set.get_tags end def front_end(&block) diff --git a/lib/orbit_app/module/side_bar.rb b/lib/orbit_app/module/side_bar.rb index d82cac843..7d733bfa3 100644 --- a/lib/orbit_app/module/side_bar.rb +++ b/lib/orbit_app/module/side_bar.rb @@ -46,9 +46,9 @@ module OrbitApp @active_for_app_auth = [] @head_link = "" @app_base_path = '' + @module_app_key = key block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? # setup_module_app(module_app_key) - @module_app_key = key finalize! SideBarRegisition.add(self) end @@ -76,6 +76,7 @@ module OrbitApp end def context_link(*var) + var[1].merge!(:module_app_key=>@module_app_key) unless @module_app_key.nil? new_context_link = ContextLink.new(*var) @context_links << new_context_link end @@ -124,10 +125,14 @@ module OrbitApp @active_for_action = options[:active_for_action] || [] @active_for_object_auth = options[:active_for_object_auth] || [] @active_for_app_auth = options[:active_for_app_auth] || [] + @module_app_key = options[:module_app_key] end def active? - active_for_action? || active_for_app_auth? || active_for_ob_auths? + for_action = @active_for_action.blank? ? false : active_for_action? + for_app_auth = @active_for_app_auth.blank? ? false : active_for_app_auth? + for_ob_auth = @active_for_object_auth.blank? ? false : active_for_ob_auths? + for_action || for_app_auth || for_ob_auth end def active_for_action? diff --git a/lib/orbit_app/module/widget.rb b/lib/orbit_app/module/widget.rb index 708dc28d1..5c6932bdf 100644 --- a/lib/orbit_app/module/widget.rb +++ b/lib/orbit_app/module/widget.rb @@ -35,11 +35,11 @@ module OrbitApp end def get_categories - @categories_query + eval(@categories_query) rescue nil end def get_tags - @tags_query + eval(@tags_query) rescue nil end def default_widget(&block) @@ -53,6 +53,7 @@ module OrbitApp def to_module_app_format hash = {} @widgets.collect{|t| hash[t.name] = t.to_hash} + hash["default_widget"]= DefaultWidget.get_interface_args unless @default_widget.blank? hash end @@ -63,12 +64,19 @@ module OrbitApp end class DefaultWidget + STYLE = ["typeA","typeB_style2","typeB_style3","typeB_style4","typeC"] + def initialize(&block) @query = nil @image = nil block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? end + def self.get_interface_args + #will need to work with design + {:name=>"default_widget",:field=>nil,:label=>'label',:style=>STYLE} + end + def to_module_app_format {:query=>@query,:image=>@image} rescue nil end @@ -90,10 +98,11 @@ module OrbitApp @name = name @fields = options[:fields] @label = label + @style= options[:style] end def to_hash - {:name => @name,:fields=>@fields,:label=>@label} + {:name => @name,:fields=>@fields,:label=>@label,:style=>@style} end def finalize! diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb index 3abeedddc..5be4de3bf 100644 --- a/lib/orbit_core_lib.rb +++ b/lib/orbit_core_lib.rb @@ -81,7 +81,7 @@ module OrbitCoreLib end query1 = auth_object_space.any_in({sub_role_ids: sub_role_ids_ary}).excludes(blocked_user_ids: user.id) - query2 = auth_object_space.any_of({all: true},{privilege_user_ids: user.id},{role_ids: user.role.id}).excludes(blocked_user_ids: user.id) + query2 = auth_object_space.any_of({all: true},{privilege_user_ids: user.id},{role_ids: user.role_ids}).excludes(blocked_user_ids: user.id) result = (query1 + query2).uniq result.collect{|t| t.obj_authable}.delete_if{|val| val==nil} end @@ -128,7 +128,7 @@ module OrbitCoreLib end end - module ObjectTokenUnility + module ObjectTokenUtility def self.included(base) base.instance_eval("field :s_token") base.instance_eval("after_create :generate_token") @@ -145,7 +145,7 @@ module OrbitCoreLib end end - module PermissionUnility + module PermissionUtility private def check_permission(type = :use) permission_grant = current_or_guest_user.admin?? true : false @@ -168,4 +168,34 @@ module OrbitCoreLib ModuleApp.first(conditions: {s_token: token}) end end + + module AppBackendUtility + def setup_vars + @app_title ||= controller_path.split('/')[1].singularize + @module_app ||= ModuleApp.first(conditions: {:key => @app_title} ) + end + + private + + def force_order_for_visitor + setup_vars + set_current_user + end + + + def force_order_for_user + setup_vars + set_current_user + authenticate_user! + check_user_can_use + end + + def check_user_can_use + unless check_permission + #redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) + redirect_to root_url + end + end + end + end diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index 047f72e63..0c18bf0be 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -215,7 +215,13 @@ module ParserCommon when 'text' ret << part.content rescue '' when 'module_widget' - url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" + url = case part.widget_path + when 'default_widget' + "/panel/orbit_app/widget/#{part.widget_style}?inner=true" + else + "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" + end + options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&part_id=#{part.id}" ret << "
" when 'public_r_tag' 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 7b5abb1f8..f1fd138cf 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 @@ -3,6 +3,10 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo before_filter :for_app_manager,:except => [:index,:get_categorys_json,:get_bulletins_json] + before_filter :force_order_for_visitor,:only=>[:index,:get_categorys_json,:get_bulletins_json] + before_filter :force_order_for_user,:except => [:index,:get_categorys_json,:get_bulletins_json] + before_filter :for_app_sub_manager,:except => [:index,:get_categorys_json,:get_bulletins_json] + def index @bulletin_categorys = get_categories_for_index("BulletinCategory") #TODO 需要做 manager ,admin 才可以 all. 其他 available就好 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 5fd57d497..ada03b993 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -17,4 +17,10 @@ zh_tw: update_bulletin_category_success: 公告類別已成功更新 widget: index: 目錄Widget - bulletins_and_web_links: 公告與連結並排Widget \ No newline at end of file + bulletins_and_web_links: 公告與連結並排Widget + #init don't merge + all_articles: 全部公告 + add_new: 新增 + categories: 分類 + approval_setting: 審核權限 + tags: 標籤 \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb index 2d8b9ae46..69da05cec 100644 --- a/vendor/built_in_modules/announcement/init.rb +++ b/vendor/built_in_modules/announcement/init.rb @@ -25,7 +25,7 @@ module Announcement categories_query 'BulletinCategory.all' tags_query 'AnnouncementTag.all' - customize_widget "index","announcement.widget.index",:fields=>["title","category","postdate"] + customize_widget "index","announcement.widget.index",:fields=>["title","category","postdate"],:style=>["cu_style_1","cu_style_2","cu_style_3","cu_style_4","cu_style_5"] customize_widget "bulletins_and_web_links","announcement.widget.bulletins_and_web_links" # item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"] # item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links" @@ -42,13 +42,14 @@ module Announcement context_link 'announcement.all_articles', :link_path=>"panel_announcement_back_end_bulletins_path" , :priority=>1, - :active_for_action=>{:bulletins=>:index} + :active_for_action=>{:bulletins=>:index}, + :available_for => [:all] context_link 'announcement.add_new', :link_path=>"new_panel_announcement_back_end_bulletin_path" , :priority=>2, :active_for_action=>{:bulletins=>:new}, - :available_for => [:manager] + :available_for => [:sub_manager] context_link 'announcement.categories', :link_path=>"panel_announcement_back_end_bulletin_categorys_path" , @@ -59,12 +60,13 @@ module Announcement context_link 'announcement.tags', :link_path=>"panel_announcement_back_end_tags_path" , :priority=>4, - :active_for_action=>{:bulletin_categorys=>:index}, + # :active_for_action=>{:bulletin_categorys=>:index}, :available_for => [:manager] context_link 'announcement.approval_setting', :link_path=>"panel_announcement_back_end_approval_setting_path" , :priority=>5, + :active_for_action=>{:approvals=>:setting}, :active_for_object_auth => 'BulletinCategory', :available_for => [:manager] From 99f28a0cba8f1ed52a8b6f5b6bb36972c9663123 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 5 Dec 2012 18:35:58 +0800 Subject: [PATCH 4/7] sidebar rewrited --- app/views/layouts/_side_bar_content.html.erb | 5 +- lib/orbit_app/helper/context_link_renderer.rb | 11 +-- lib/orbit_app/helper/side_bar_renderer.rb | 9 +-- lib/orbit_app/module/registration.rb | 8 ++- lib/orbit_app/module/side_bar.rb | 17 ++++- vendor/built_in_modules/ad_banner/init.rb | 49 ++++++++++++++ vendor/built_in_modules/announcement/init.rb | 4 +- vendor/built_in_modules/archive/init.rb | 62 +++++++++++++++++ vendor/built_in_modules/calendar/init.rb | 34 ++++++++++ vendor/built_in_modules/gallery/init.rb | 59 ++++++++++++++++ vendor/built_in_modules/gprs/init.rb | 43 ++++++++++++ .../miss_module/config/locales/zh_tw.yml | 10 +++ vendor/built_in_modules/page_content/init.rb | 33 +++++++++ vendor/built_in_modules/web_resource/init.rb | 67 +++++++++++++++++++ 14 files changed, 395 insertions(+), 16 deletions(-) create mode 100644 vendor/built_in_modules/ad_banner/init.rb create mode 100644 vendor/built_in_modules/archive/init.rb create mode 100644 vendor/built_in_modules/calendar/init.rb create mode 100644 vendor/built_in_modules/gallery/init.rb create mode 100644 vendor/built_in_modules/gprs/init.rb create mode 100644 vendor/built_in_modules/miss_module/config/locales/zh_tw.yml create mode 100644 vendor/built_in_modules/page_content/init.rb create mode 100644 vendor/built_in_modules/web_resource/init.rb diff --git a/app/views/layouts/_side_bar_content.html.erb b/app/views/layouts/_side_bar_content.html.erb index 61129656a..b05d65f6e 100644 --- a/app/views/layouts/_side_bar_content.html.erb +++ b/app/views/layouts/_side_bar_content.html.erb @@ -4,7 +4,10 @@ <% content_for :page_specific_javascript do %> <%= javascript_include_tag "/static/kernel.js" %> <% end %> -<%=OrbitApp::Module::SideBarRegisition.all.first.render(request,params,current_user,@module_app) %> + +<%OrbitApp::Module::SideBarRegisition.all.each do |t| %> + <%= t.render(request,params,current_user,@module_app) %> +<% end %>
<% flash.each do |key, msg| %> diff --git a/lib/orbit_app/helper/context_link_renderer.rb b/lib/orbit_app/helper/context_link_renderer.rb index a34f6cb42..d4014faeb 100644 --- a/lib/orbit_app/helper/context_link_renderer.rb +++ b/lib/orbit_app/helper/context_link_renderer.rb @@ -1,11 +1,12 @@ module ContextLinkRenderer include Renderer - def render(request,params,module_app,user) - @module_app = module_app + def render(request,params,current_module_app,current_user,belong_module_app) + @current_module_app = current_module_app + @belong_module_app = belong_module_app @request = request @params = params - @current_user = user + @current_user = current_user if display? content_tag :li, link_to((I18n.t(@label_i18n) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, eval(@path)), :class => (active? ? 'active' : nil) end @@ -18,9 +19,9 @@ protected when :all true when :manager - @module_app.is_manager? @current_user + @belong_module_app.is_manager? @current_user when :sub_manager - @module_app.is_sub_manager? @current_user + @belong_module_app.is_sub_manager? @current_user else (eval(available_for_in_sym).include? @current_user rescue false) end # of case diff --git a/lib/orbit_app/helper/side_bar_renderer.rb b/lib/orbit_app/helper/side_bar_renderer.rb index 3fd680ef4..ba6f7c7de 100644 --- a/lib/orbit_app/helper/side_bar_renderer.rb +++ b/lib/orbit_app/helper/side_bar_renderer.rb @@ -2,8 +2,9 @@ module SideBarRenderer include Renderer include AdminHelper - def render(request,params,user,module_app) - @module_app = module_app + def render(request,params,user,current_module_app) + @belong_module_app = get_module_app + @current_module_app = current_module_app @request = request @params = params @current_user = user @@ -12,7 +13,7 @@ module SideBarRenderer buf = link_to( content_tag(:i, nil, :class => @icon_class ) + content_tag(:span, I18n.t( @head_label )), eval(@head_link)) buf << content_tag( :ul, :class => ("nav nav-list active") )do # visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')||active_for_ob_auths_object("BulletinCategory")) @context_links.sort_by! {| obj | obj.priority}.collect do |link| - link.render(request,params,@module_app,@current_user) + link.render(request,params,@current_module_app,@current_user,@belong_module_app) end.join.html_safe end end @@ -24,7 +25,7 @@ module SideBarRenderer def display? #控制sidebar 要不要算圖 if is_manager? || is_admin? #如果是系統管理員 或 是模組管理員 true - elsif (@module_app.open rescue false) # 如果app 被設定成 開放 + elsif (@current_module_app.open rescue false) # 如果app 被設定成 開放 true elsif is_member? #如果app 是封閉 那至少需要是 member true diff --git a/lib/orbit_app/module/registration.rb b/lib/orbit_app/module/registration.rb index d94de028e..4c64f6298 100644 --- a/lib/orbit_app/module/registration.rb +++ b/lib/orbit_app/module/registration.rb @@ -39,8 +39,12 @@ module OrbitApp setup_module_app end + def get_module_app + ModuleApp.first(conditions: {:key=>@key,:title=>name}) + end + def setup_module_app - module_app = ModuleApp.first(conditions: {:key=>@key,:title=>name}) + module_app = get_module_app module_app = ModuleApp.new(:key=>@key,:title=>name) if module_app.nil? begin @@ -90,7 +94,7 @@ module OrbitApp end def side_bar(&block) - @side_bar = SideBarRegisition::SideBar.new(@name,@key,&block) + @side_bar = SideBarRegisition::SideBar.new(@name,@key,method(:get_module_app),&block) end def personal_plugin(params) diff --git a/lib/orbit_app/module/side_bar.rb b/lib/orbit_app/module/side_bar.rb index 7d733bfa3..050df87a3 100644 --- a/lib/orbit_app/module/side_bar.rb +++ b/lib/orbit_app/module/side_bar.rb @@ -17,6 +17,10 @@ module OrbitApp return nil end + def render_all(request,params,user,current_module_app) + @@side_bars.collect{|t| t.render(request,params,user,current_module_app)}.join.html_safe + end + def all return @@side_bars end @@ -37,7 +41,7 @@ module OrbitApp # def is_manager? # binding.pry # end - def initialize(name = '',key,&block) + def initialize(name = '',key,get_module_app,&block) @head_label = name @context_links = [] @available_for = [] @@ -47,12 +51,16 @@ module OrbitApp @head_link = "" @app_base_path = '' @module_app_key = key + @get_module_app = get_module_app block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? # setup_module_app(module_app_key) finalize! SideBarRegisition.add(self) end + def get_module_app + @get_module_app.call + end def head_label_i18n(var,options ={}) @head_label = var @@ -76,7 +84,7 @@ module OrbitApp end def context_link(*var) - var[1].merge!(:module_app_key=>@module_app_key) unless @module_app_key.nil? + var[1].merge!({:module_app_key=>@module_app_key,:get_module_app=>@get_module_app}) unless @module_app_key.nil? new_context_link = ContextLink.new(*var) @context_links << new_context_link end @@ -126,6 +134,11 @@ module OrbitApp @active_for_object_auth = options[:active_for_object_auth] || [] @active_for_app_auth = options[:active_for_app_auth] || [] @module_app_key = options[:module_app_key] + @get_module_app = options[:get_module_app] + end + + def get_module_app + @get_module_app.call end def active? diff --git a/vendor/built_in_modules/ad_banner/init.rb b/vendor/built_in_modules/ad_banner/init.rb new file mode 100644 index 000000000..6776ee0a8 --- /dev/null +++ b/vendor/built_in_modules/ad_banner/init.rb @@ -0,0 +1,49 @@ +module AdBanner + OrbitApp.registration "AdBanner",:type=> 'ModuleApp' do + module_label 'ad_banner.ad_banner' + base_url File.expand_path File.dirname(__FILE__) + # personal_plugin :enable => true,:path=>"panel/ad_banner/plugin/profile",:i18n=>'admin.ad_banner' + + version "0.1" + organization "Rulingcom" + author "RD dep" + intro "I am intro" + update_info 'some update_info' + + # front_end do + # app_page 'bulletins' + # end + + # category ["BulletinCategory"] + + # widgets do + # # default_widget do + # # query 'Bulletin.all' + # # image :image + # # end + + # # categories_query 'BulletinCategory.all' + # # tags_query 'AdBannerTag.all' + + # # customize_widget "index","ad_banner.widget.index",:fields=>["title","category","postdate"],:style=>["cu_style_1","cu_style_2","cu_style_3","cu_style_4","cu_style_5"] + # # customize_widget "bulletins_and_web_links","ad_banner.widget.bulletins_and_web_links" + + # # item "index","ad_banner.widget.index",:default_template=>true,:fields=>["title","category","postdate"] + # # item "bulletins_and_web_links","ad_banner.widget.bulletins_and_web_links" + # end + + side_bar do + head_label_i18n 'admin.ad_banner',:icon_class=>"icons-landscape" + available_for [:admin,:guest,:manager,:sub_manager] + active_for_controllers ({:private=>['ad_banners', 'ad_images']}) + + head_link_path "admin_ad_banners_path" + + context_link 'module_authorization', + :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: 'ad_banner'}))", + :priority=>6, + :active_for_app_auth => 'ad_banners', + :available_for => [:admin] + end + end +end diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb index a15242d34..225b9bae2 100644 --- a/vendor/built_in_modules/announcement/init.rb +++ b/vendor/built_in_modules/announcement/init.rb @@ -32,7 +32,7 @@ module Announcement end side_bar do - head_label_i18n 'admin.announcement',:icon_class=>"icons-announcement" + head_label_i18n 'admin.announcement',:icon_class=>"icons-megaphone" available_for [:admin,:guest,:manager,:sub_manager] active_for_controllers ({:private=>['bulletins', 'bulletin_categorys', 'approvals','tags']}) active_for_object_auth ['BulletinCategory'] @@ -74,7 +74,7 @@ module Announcement :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: 'Announcement'}))", :priority=>6, :active_for_app_auth => 'Announcement', - :available_for => [:manager] + :available_for => [:admin] end end end diff --git a/vendor/built_in_modules/archive/init.rb b/vendor/built_in_modules/archive/init.rb new file mode 100644 index 000000000..565b2cdf9 --- /dev/null +++ b/vendor/built_in_modules/archive/init.rb @@ -0,0 +1,62 @@ +module Archive + OrbitApp.registration "Archive",:type=> 'ModuleApp' do + module_label 'miss_module_i18n.archive' + base_url File.expand_path File.dirname(__FILE__) + personal_plugin :enable => true,:path=>"panel/archive/plugin/profile",:i18n=>'admin.archive' + + version "0.1" + organization "Rulingcom" + author "RD dep" + intro "I am intro" + update_info 'some update_info' + + front_end do + app_page 'archive_files' + end + + widgets do + # default_widget do + # query 'Bulletin.all' + # image :image + # end + + # categories_query 'BulletinCategory.all' + # tags_query 'ArchiveTag.all' + customize_widget "archive_files","archive.widget.archive_files",:style=>[] + end + + side_bar do + head_label_i18n 'miss_module_i18n.archive',:icon_class=>"icons-archive" + available_for [:admin,:guest,:manager,:sub_manager] + active_for_controllers ({:private=>['archive_file_categorys'],:public=>['panel/archive/back_end/tags']}) + active_for_object_auth ['BulletinCategory'] + + head_link_path "panel_archive_back_end_archive_files_path" + + context_link 'miss_module_i18n._archive.all', + :link_path=>"panel_archive_back_end_archive_files_path" , + :priority=>1, + :active_for_action=>{:archive_file=>:index}, + :available_for => [:all] + + context_link 'add', + :link_path=>"new_panel_archive_back_end_archive_file_path" , + :priority=>2, + :active_for_action=>{:archive_file=>:new}, + :available_for => [:admin] + + context_link 'categories', + :link_path=>"panel_archive_back_end_archive_file_categorys_path" , + :priority=>3, + :active_for_action=>{:archive_file_categorys=>:index}, + :available_for => [:manager] + + context_link 'tags', + :link_path=>"panel_archive_back_end_tags_path" , + :priority=>4, + # :active_for_action=>{:bulletin_categorys=>:index}, + :available_for => [:admin] + + end + end +end diff --git a/vendor/built_in_modules/calendar/init.rb b/vendor/built_in_modules/calendar/init.rb new file mode 100644 index 000000000..fc318e6c2 --- /dev/null +++ b/vendor/built_in_modules/calendar/init.rb @@ -0,0 +1,34 @@ +module Calendar + OrbitApp.registration "Calendar",:type=> 'ModuleApp' do + module_label 'miss_module_i18n.calendar' + base_url File.expand_path File.dirname(__FILE__) + # personal_plugin :enable => true,:path=>"panel/calendar/plugin/profile",:i18n=>'admin.calendar' + + version "0.1" + organization "Rulingcom" + author "RD dep" + intro "I am intro" + update_info 'some update_info' + + side_bar do + head_label_i18n 'miss_module_i18n.calendar',:icon_class=>"icons-calendar" + available_for [:admin,:guest,:manager,:sub_manager] + active_for_controllers ({:private=>['cals','calendar_categories'],:public=>['panel/calendar/back_end/tags']}) + + + head_link_path "panel_calendar_back_end_cals_path" + + context_link 'calendar.calendars', + :link_path=>"new_panel_calendar_back_end_cal_path" , + :priority=>1, + :active_for_action=>{:cals=>:new}, + :available_for => [:manager] + + context_link 'tags', + :link_path=>"panel_calendar_back_end_tags_path" , + :priority=>4, + # :active_for_action=>{:bulletin_categorys=>:index}, + :available_for => [:manager] + end + end +end diff --git a/vendor/built_in_modules/gallery/init.rb b/vendor/built_in_modules/gallery/init.rb new file mode 100644 index 000000000..e7db1e811 --- /dev/null +++ b/vendor/built_in_modules/gallery/init.rb @@ -0,0 +1,59 @@ +module Gallery + OrbitApp.registration "Gallery",:type=> 'ModuleApp' do + module_label 'miss_module_i18n.gallery' + base_url File.expand_path File.dirname(__FILE__) + # personal_plugin :enable => true,:path=>"panel/gallery/plugin/profile",:i18n=>'admin.gallery' + + version "0.1" + organization "Rulingcom" + author "Visual dep" + intro "A simple and amazing gallery" + update_info 'some update_info' + + front_end do + app_page 'albums' + end + + category ["gallery_categories"] + + widgets do + # default_widget do + # query 'Bulletin.all' + # image :image + # end + + categories_query 'GalleryCategory.all' + # tags_query 'GalleryTag.all' + + customize_widget "albums","gallery.widget.albums",:fields=>[],:style=>[] + + end + + side_bar do + head_label_i18n 'miss_module_i18n.gallery',:icon_class=>"icons-pictures" + available_for [:admin,:guest,:manager,:sub_manager] + active_for_controllers ({:private=>['albums','album_images','gallery_categories','/panel/gallery/back_end/tags']}) + active_for_object_auth ['BulletinCategory'] + + head_link_path "panel_gallery_back_end_albums_path" + + context_link 'gallery.categories', + :link_path=>"panel_gallery_back_end_gallery_categories_path" , + :priority=>3, + :active_for_action=>{:gallery_categories=>:index}, + :available_for => [:manager] + + context_link 'tags', + :link_path=>"panel_gallery_back_end_tags_path" , + :priority=>4, + # :active_for_action=>{:bulletin_categorys=>:index}, + :available_for => [:manager] + + context_link 'module_authorization', + :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: 'gallery'}))", + :priority=>6, + :active_for_app_auth => 'gallery', + :available_for => [:admin] + end + end +end diff --git a/vendor/built_in_modules/gprs/init.rb b/vendor/built_in_modules/gprs/init.rb new file mode 100644 index 000000000..99de7772e --- /dev/null +++ b/vendor/built_in_modules/gprs/init.rb @@ -0,0 +1,43 @@ +module Location + OrbitApp.registration "Location",:type=> 'ModuleApp' do + module_label 'miss_module_i18n.location' + base_url File.expand_path File.dirname(__FILE__) + # personal_plugin :enable => true,:path=>"panel/location/plugin/profile",:i18n=>'admin.location' + + # version "0.1" + # organization "Rulingcom" + # author "RD dep" + # intro "I am intro" + # update_info 'some update_info' + + # front_end do + # app_page 'bulletins' + # end + + # category ["BulletinCategory"] + + # widgets do + # default_widget do + # query 'Bulletin.all' + # image :image + # end + + # categories_query 'BulletinCategory.all' + # tags_query 'LocationTag.all' + + # customize_widget "index","location.widget.index",:fields=>["title","category","postdate"],:style=>["cu_style_1","cu_style_2","cu_style_3","cu_style_4","cu_style_5"] + # customize_widget "bulletins_and_web_links","location.widget.bulletins_and_web_links" + # # item "index","location.widget.index",:default_template=>true,:fields=>["title","category","postdate"] + # # item "bulletins_and_web_links","location.widget.bulletins_and_web_links" + # end + + side_bar do + head_label_i18n 'miss_module_i18n.location',:icon_class=>"icons-location" + available_for [:admin,:guest,:manager,:sub_manager] + active_for_controllers ({:private=>['locations']}) + + head_link_path "panel_gprs_back_end_locations_path" + + end + end +end diff --git a/vendor/built_in_modules/miss_module/config/locales/zh_tw.yml b/vendor/built_in_modules/miss_module/config/locales/zh_tw.yml new file mode 100644 index 000000000..b91058c48 --- /dev/null +++ b/vendor/built_in_modules/miss_module/config/locales/zh_tw.yml @@ -0,0 +1,10 @@ +zh_tw: + + miss_module_i18n: + archive: 檔案室 + _archive: + all: 全部檔案 + calendar: 日曆模組 + calendars: 日曆 + gallery: 相簿 + location: Location diff --git a/vendor/built_in_modules/page_content/init.rb b/vendor/built_in_modules/page_content/init.rb new file mode 100644 index 000000000..2bf8a2f77 --- /dev/null +++ b/vendor/built_in_modules/page_content/init.rb @@ -0,0 +1,33 @@ +module PageContent + + OrbitApp.registration "PageContent",:type=> 'ModuleApp' do + module_label 'page' + base_url File.expand_path File.dirname(__FILE__) + # personal_plugin :enable => true,:path=>"panel/announcement/plugin/profile",:i18n=>'admin.announcement' + + version "0.1" + organization "Rulingcom" + author "RD dep" + intro "I am intro" + update_info 'some update_info' + + front_end do + app_page 'page_contexts' + end + + side_bar do + head_label_i18n 'page',:icon_class=>"icons-page" + available_for [:admin,:guest,:manager,:sub_manager] + active_for_controllers ({:private=>['page_contexts']}) + active_for_object_auth ['PageContext'] + + head_link_path "panel_page_content_back_end_page_contexts_path" + + context_link 'module_authorization', + :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: 'page_content'}))", + :priority=>1, + :active_for_app_auth => 'PageContext', + :available_for => [:admin] + end + end +end diff --git a/vendor/built_in_modules/web_resource/init.rb b/vendor/built_in_modules/web_resource/init.rb new file mode 100644 index 000000000..c581506b2 --- /dev/null +++ b/vendor/built_in_modules/web_resource/init.rb @@ -0,0 +1,67 @@ +module WebResource + OrbitApp.registration "WebResource",:type=> 'ModuleApp' do + module_label 'link' + base_url File.expand_path File.dirname(__FILE__) + # personal_plugin :enable => true,:path=>"panel/web_resource/plugin/profile",:i18n=>'admin.web_resource' + + version "0.1" + organization "Rulingcom" + author "RD dep" + intro "I am intro" + update_info 'some update_info' + + category ["WebLinkCategory"] + + widgets do + # default_widget do + # query 'Bulletin.all' + # image :image + # end + + categories_query 'BulletinCategory.all' + tags_query 'WebResourceTag.all' + + customize_widget "home_list","web_resource.widget.home_list" + + end + + side_bar do + head_label_i18n 'link',:icon_class=>"icons-link" + available_for [:admin,:guest,:manager,:sub_manager] + active_for_controllers ({:private=>['web_links', 'web_link_categorys']}) + active_for_object_auth ['WebLinkCategory'] + + head_link_path "panel_web_resource_back_end_web_links_path" + + context_link 'list_', + :link_path=>"panel_web_resource_back_end_web_links_path" , + :priority=>1, + :active_for_action=>{:bulletins=>:index}, + :available_for => [:all] + + context_link 'link', + :link_path=>"new_panel_web_resource_back_end_web_link_path" , + :priority=>2, + :active_for_action=>{:bulletins=>:new}, + :available_for => [:sub_manager] + + context_link 'categories', + :link_path=>"panel_web_resource_back_end_web_link_categorys_path" , + :priority=>3, + :active_for_action=>{:bulletin_categorys=>:index}, + :available_for => [:manager] + + context_link 'tags', + :link_path=>"panel_web_resource_back_end_tags_path" , + :priority=>4, + # :active_for_action=>{:bulletin_categorys=>:index}, + :available_for => [:manager] + + context_link 'module_authorization', + :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: 'web_resource'}))", + :priority=>6, + :active_for_app_auth => 'web_resource', + :available_for => [:admin] + end + end +end From e07fb7d434d3338ac070de9a9d63298bc7e75cb2 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 7 Dec 2012 12:36:25 +0800 Subject: [PATCH 5/7] Remove GPRS --- app/uploaders/gprs_uploader.rb | 61 --------------- vendor/built_in_modules/gprs/.gitignore | 6 -- vendor/built_in_modules/gprs/Gemfile | 17 ---- vendor/built_in_modules/gprs/MIT-LICENSE | 20 ----- vendor/built_in_modules/gprs/README.rdoc | 3 - vendor/built_in_modules/gprs/Rakefile | 39 ---------- .../gprs/app/assets/images/gprs/.gitkeep | 0 .../gprs/app/assets/javascripts/gprs/.gitkeep | 0 .../panel/gprs/back_end/locations.js | 2 - .../gprs/app/assets/stylesheets/gprs/.gitkeep | 0 .../panel/gprs/back_end/locations.css | 4 - .../gprs/app/controllers/.gitkeep | 0 .../gprs/back_end/locations_controller.rb | 77 ------------------- .../gprs/app/helpers/.gitkeep | 0 .../panel/gprs/back_end/locations_helper.rb | 2 - .../gprs/app/mailers/.gitkeep | 0 .../built_in_modules/gprs/app/models/.gitkeep | 0 .../gprs/app/models/location.rb | 11 --- .../built_in_modules/gprs/app/views/.gitkeep | 0 .../gprs/back_end/locations/_form.html.erb | 30 -------- .../gprs/back_end/locations/edit.html.erb | 4 - .../gprs/back_end/locations/index.html.erb | 34 -------- .../gprs/back_end/locations/new.html.erb | 3 - .../gprs/back_end/locations/show.html.erb | 0 vendor/built_in_modules/gprs/config/routes.rb | 12 --- vendor/built_in_modules/gprs/gprs.gemspec | 23 ------ vendor/built_in_modules/gprs/init.rb | 43 ----------- vendor/built_in_modules/gprs/lib/gprs.rb | 4 - .../built_in_modules/gprs/lib/gprs/engine.rb | 4 - .../built_in_modules/gprs/lib/gprs/version.rb | 3 - .../gprs/lib/tasks/gprs_tasks.rake | 4 - vendor/built_in_modules/gprs/script/rails | 6 -- .../built_in_modules/gprs/test/dummy/Rakefile | 7 -- .../app/assets/javascripts/application.js | 9 --- .../app/assets/stylesheets/application.css | 7 -- .../app/controllers/application_controller.rb | 3 - .../dummy/app/helpers/application_helper.rb | 2 - .../gprs/test/dummy/app/mailers/.gitkeep | 0 .../gprs/test/dummy/app/models/.gitkeep | 0 .../app/views/layouts/application.html.erb | 14 ---- .../gprs/test/dummy/config.ru | 4 - .../gprs/test/dummy/config/application.rb | 45 ----------- .../gprs/test/dummy/config/boot.rb | 10 --- .../gprs/test/dummy/config/database.yml | 25 ------ .../gprs/test/dummy/config/environment.rb | 5 -- .../dummy/config/environments/development.rb | 30 -------- .../dummy/config/environments/production.rb | 60 --------------- .../test/dummy/config/environments/test.rb | 39 ---------- .../initializers/backtrace_silencers.rb | 7 -- .../dummy/config/initializers/inflections.rb | 10 --- .../dummy/config/initializers/mime_types.rb | 5 -- .../dummy/config/initializers/secret_token.rb | 7 -- .../config/initializers/session_store.rb | 8 -- .../config/initializers/wrap_parameters.rb | 14 ---- .../gprs/test/dummy/config/locales/en.yml | 5 -- .../gprs/test/dummy/config/routes.rb | 58 -------------- .../gprs/test/dummy/lib/assets/.gitkeep | 0 .../gprs/test/dummy/log/.gitkeep | 0 .../gprs/test/dummy/public/404.html | 26 ------- .../gprs/test/dummy/public/422.html | 26 ------- .../gprs/test/dummy/public/500.html | 26 ------- .../gprs/test/dummy/public/favicon.ico | 0 .../gprs/test/dummy/script/rails | 6 -- .../back_end/locations_controller_test.rb | 14 ---- .../built_in_modules/gprs/test/gprs_test.rb | 7 -- .../gprs/test/integration/navigation_test.rb | 10 --- .../built_in_modules/gprs/test/test_helper.rb | 10 --- .../gprs/back_end/locations_helper_test.rb | 4 - 68 files changed, 915 deletions(-) delete mode 100644 app/uploaders/gprs_uploader.rb delete mode 100644 vendor/built_in_modules/gprs/.gitignore delete mode 100644 vendor/built_in_modules/gprs/Gemfile delete mode 100644 vendor/built_in_modules/gprs/MIT-LICENSE delete mode 100644 vendor/built_in_modules/gprs/README.rdoc delete mode 100644 vendor/built_in_modules/gprs/Rakefile delete mode 100644 vendor/built_in_modules/gprs/app/assets/images/gprs/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/app/assets/javascripts/gprs/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js delete mode 100644 vendor/built_in_modules/gprs/app/assets/stylesheets/gprs/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css delete mode 100644 vendor/built_in_modules/gprs/app/controllers/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb delete mode 100644 vendor/built_in_modules/gprs/app/helpers/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/app/helpers/panel/gprs/back_end/locations_helper.rb delete mode 100644 vendor/built_in_modules/gprs/app/mailers/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/app/models/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/app/models/location.rb delete mode 100644 vendor/built_in_modules/gprs/app/views/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb delete mode 100644 vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb delete mode 100644 vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb delete mode 100644 vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb delete mode 100644 vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/show.html.erb delete mode 100644 vendor/built_in_modules/gprs/config/routes.rb delete mode 100644 vendor/built_in_modules/gprs/gprs.gemspec delete mode 100644 vendor/built_in_modules/gprs/init.rb delete mode 100644 vendor/built_in_modules/gprs/lib/gprs.rb delete mode 100644 vendor/built_in_modules/gprs/lib/gprs/engine.rb delete mode 100644 vendor/built_in_modules/gprs/lib/gprs/version.rb delete mode 100644 vendor/built_in_modules/gprs/lib/tasks/gprs_tasks.rake delete mode 100755 vendor/built_in_modules/gprs/script/rails delete mode 100644 vendor/built_in_modules/gprs/test/dummy/Rakefile delete mode 100644 vendor/built_in_modules/gprs/test/dummy/app/assets/javascripts/application.js delete mode 100644 vendor/built_in_modules/gprs/test/dummy/app/assets/stylesheets/application.css delete mode 100644 vendor/built_in_modules/gprs/test/dummy/app/controllers/application_controller.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/app/helpers/application_helper.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/app/mailers/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/test/dummy/app/models/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/test/dummy/app/views/layouts/application.html.erb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config.ru delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/application.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/boot.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/database.yml delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/environment.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/environments/development.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/environments/production.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/environments/test.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/backtrace_silencers.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/inflections.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/mime_types.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/secret_token.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/session_store.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/wrap_parameters.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/locales/en.yml delete mode 100644 vendor/built_in_modules/gprs/test/dummy/config/routes.rb delete mode 100644 vendor/built_in_modules/gprs/test/dummy/lib/assets/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/test/dummy/log/.gitkeep delete mode 100644 vendor/built_in_modules/gprs/test/dummy/public/404.html delete mode 100644 vendor/built_in_modules/gprs/test/dummy/public/422.html delete mode 100644 vendor/built_in_modules/gprs/test/dummy/public/500.html delete mode 100644 vendor/built_in_modules/gprs/test/dummy/public/favicon.ico delete mode 100755 vendor/built_in_modules/gprs/test/dummy/script/rails delete mode 100644 vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb delete mode 100644 vendor/built_in_modules/gprs/test/gprs_test.rb delete mode 100644 vendor/built_in_modules/gprs/test/integration/navigation_test.rb delete mode 100644 vendor/built_in_modules/gprs/test/test_helper.rb delete mode 100644 vendor/built_in_modules/gprs/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb diff --git a/app/uploaders/gprs_uploader.rb b/app/uploaders/gprs_uploader.rb deleted file mode 100644 index 4ce413216..000000000 --- a/app/uploaders/gprs_uploader.rb +++ /dev/null @@ -1,61 +0,0 @@ -class GprsUploader < CarrierWave::Uploader::Base - - # Include RMagick or ImageScience support: - # include CarrierWave::RMagick - # include CarrierWave::ImageScience - include CarrierWave::MiniMagick - - # Choose what kind of storage to use for this uploader: - # storage :file - # storage :s3 - - # Override the directory where uploaded files will be stored. - # This is a sensible default for uploaders that are meant to be mounted: - def store_dir - "gprs/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" - end - - # Provide a default URL as a default if there hasn't been a file uploaded: - # def default_url - # "/images/fallback/" + [version_name, "default.png"].compact.join('_') - # end - - # Process files as they are uploaded: - # process :scale => [200, 300] - # - # def scale(width, height) - # # do something - # end - - # Create different versions of your uploaded files: - # version :thumb do - # process :scale => [50, 50] - # end - - version :thumb do - process :resize_to_fill => [150, 120] - end - - # Add a white list of extensions which are allowed to be uploaded. - # For images you might use something like this: - # def extension_white_list - # %w(jpg jpeg gif png) - # end - - # Override the filename of the uploaded files: - # def filename - # "something.jpg" if original_filename - # end - -# def manipulate! -# raise current_path.inspect -# image = ::MiniMagick::Image.open(current_path) -# image = yield(image) -# image.write(current_path) -# ::MiniMagick::Image.open(current_path) -# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e -# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}") -# end - -end - diff --git a/vendor/built_in_modules/gprs/.gitignore b/vendor/built_in_modules/gprs/.gitignore deleted file mode 100644 index 1463de6df..000000000 --- a/vendor/built_in_modules/gprs/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.bundle/ -log/*.log -pkg/ -test/dummy/db/*.sqlite3 -test/dummy/log/*.log -test/dummy/tmp/ \ No newline at end of file diff --git a/vendor/built_in_modules/gprs/Gemfile b/vendor/built_in_modules/gprs/Gemfile deleted file mode 100644 index cdc455aef..000000000 --- a/vendor/built_in_modules/gprs/Gemfile +++ /dev/null @@ -1,17 +0,0 @@ -source "http://rubygems.org" - -# Declare your gem's dependencies in gprs.gemspec. -# Bundler will treat runtime dependencies like base dependencies, and -# development dependencies will be added by default to the :development group. -gemspec - -# jquery-rails is used by the dummy application -gem "jquery-rails" - -# Declare any dependencies that are still in development here instead of in -# your gemspec. These might include edge Rails or gems from your path or -# Git. Remember to move these dependencies to your gemspec before releasing -# your gem to rubygems.org. - -# To use debugger -# gem 'ruby-debug19', :require => 'ruby-debug' diff --git a/vendor/built_in_modules/gprs/MIT-LICENSE b/vendor/built_in_modules/gprs/MIT-LICENSE deleted file mode 100644 index 406f17b70..000000000 --- a/vendor/built_in_modules/gprs/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright 2012 YOURNAME - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/built_in_modules/gprs/README.rdoc b/vendor/built_in_modules/gprs/README.rdoc deleted file mode 100644 index 6cc30110b..000000000 --- a/vendor/built_in_modules/gprs/README.rdoc +++ /dev/null @@ -1,3 +0,0 @@ -= Gprs - -This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/vendor/built_in_modules/gprs/Rakefile b/vendor/built_in_modules/gprs/Rakefile deleted file mode 100644 index e9f3324cd..000000000 --- a/vendor/built_in_modules/gprs/Rakefile +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env rake -begin - require 'bundler/setup' -rescue LoadError - puts 'You must `gem install bundler` and `bundle install` to run rake tasks' -end -begin - require 'rdoc/task' -rescue LoadError - require 'rdoc/rdoc' - require 'rake/rdoctask' - RDoc::Task = Rake::RDocTask -end - -RDoc::Task.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'Gprs' - rdoc.options << '--line-numbers' - rdoc.rdoc_files.include('README.rdoc') - rdoc.rdoc_files.include('lib/**/*.rb') -end - -APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__) -load 'rails/tasks/engine.rake' - - -Bundler::GemHelper.install_tasks - -require 'rake/testtask' - -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.libs << 'test' - t.pattern = 'test/**/*_test.rb' - t.verbose = false -end - - -task :default => :test diff --git a/vendor/built_in_modules/gprs/app/assets/images/gprs/.gitkeep b/vendor/built_in_modules/gprs/app/assets/images/gprs/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/app/assets/javascripts/gprs/.gitkeep b/vendor/built_in_modules/gprs/app/assets/javascripts/gprs/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js b/vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js deleted file mode 100644 index dee720fac..000000000 --- a/vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js +++ /dev/null @@ -1,2 +0,0 @@ -// Place all the behaviors and hooks related to the matching controller here. -// All this logic will automatically be available in application.js. diff --git a/vendor/built_in_modules/gprs/app/assets/stylesheets/gprs/.gitkeep b/vendor/built_in_modules/gprs/app/assets/stylesheets/gprs/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css b/vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css deleted file mode 100644 index afad32db0..000000000 --- a/vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Place all the styles related to the matching controller here. - They will automatically be included in application.css. -*/ diff --git a/vendor/built_in_modules/gprs/app/controllers/.gitkeep b/vendor/built_in_modules/gprs/app/controllers/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb b/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb deleted file mode 100644 index 1ba13703d..000000000 --- a/vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb +++ /dev/null @@ -1,77 +0,0 @@ -class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController - - #before_filter :clean_values, :only => [:create, :update] - - before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :delete] - before_filter :force_order_for_user,:except => [:get_locations,:index] - #before_filter :for_app_sub_manager,:except => [:index, :new, :edit, :delete, :get_locations] - - def index - @locations = Location.all - respond_to do |format| - format.html # new.html.erb - format.json { render json: @locations } - end - end - - def new - @location = Location.new - - respond_to do |format| - format.html # new.html.erb - format.json { render json: @location } - end - end - - def edit - @location = Location.find(params[:id]) - end - - def show - @location = Location.find(params[:id]) - respond_to do |format| - format.html - format.json { render json: @location } - end - end - - def create - @location = Location.new(params[:location]) - @location.save! - redirect_to panel_gprs_back_end_locations_url - end - - def update - @location = Location.find(params[:id]) - @location.update_attributes(params[:location]) - redirect_to panel_gprs_back_end_locations_url - end - - def destroy - @location = Location.find(params[:id]) - @location.destroy - redirect_to panel_gprs_back_end_locations_url - - end - - def get_locations - locations = Location.all - @data = Array.new - - locations.each do |location| - picurl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.url}" - thumburl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.thumb.url}" - @data << { name: location.name, - pic_url: picurl, - thumb_url: thumburl, - longitude: location.longitude, - latitude: location.latitude, - description: location.description } - end - - #print readable json - render :json => JSON.pretty_generate({location: @data}) - - #render :json => {location: @data}.to_json - end -end diff --git a/vendor/built_in_modules/gprs/app/helpers/.gitkeep b/vendor/built_in_modules/gprs/app/helpers/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/app/helpers/panel/gprs/back_end/locations_helper.rb b/vendor/built_in_modules/gprs/app/helpers/panel/gprs/back_end/locations_helper.rb deleted file mode 100644 index 50985d545..000000000 --- a/vendor/built_in_modules/gprs/app/helpers/panel/gprs/back_end/locations_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Panel::Gprs::BackEnd::LocationsHelper -end diff --git a/vendor/built_in_modules/gprs/app/mailers/.gitkeep b/vendor/built_in_modules/gprs/app/mailers/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/app/models/.gitkeep b/vendor/built_in_modules/gprs/app/models/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/app/models/location.rb b/vendor/built_in_modules/gprs/app/models/location.rb deleted file mode 100644 index f6455920b..000000000 --- a/vendor/built_in_modules/gprs/app/models/location.rb +++ /dev/null @@ -1,11 +0,0 @@ -class Location - include Mongoid::Document - include Mongoid::Timestamps - - mount_uploader :file, GprsUploader - - field :name - field :description - field :longitude, type: Float - field :latitude, type: Float -end diff --git a/vendor/built_in_modules/gprs/app/views/.gitkeep b/vendor/built_in_modules/gprs/app/views/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb deleted file mode 100644 index 62e8b21b3..000000000 --- a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/_form.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -
- -
- <%= f.text_field :name, :class=>"span4", :placeholder => "Area" %> -
-
-
- -
- <%= f.file_field :file %> -
-
-
- -
- <%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %> - <%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %> -
-
-
- -
- <%= f.text_area :description, :class=>"span4", :cols=>"30", :row=>"5" %> -
-
-
-
- <%= f.submit "Save", :class=>"btn" %> -
-
diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb deleted file mode 100644 index 82a59afad..000000000 --- a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/edit.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<%= form_for @location, :url=> panel_gprs_back_end_location_path(@location), :html => { :class=>"form-horizontal"} do |f| %> - <%= render :partial => 'form', :locals => {:f => f} %> -<% end %> - diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb deleted file mode 100644 index 95b72b739..000000000 --- a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - <%if is_manager? %> - - - <% end %> - - - - <% @locations.each do |location| %> - - - - - - - <%if is_manager? %> - - - <%end%> - - - <% end %> - -
<%= t('location.picture') %><%= t('location.name') %><%= t('location.longitude') %><%= t('location.latitude') %><%= t('location.description') %><%= t('location.edit') %><%= t('location.delete') %>
<%= image_tag(location.file, alt: location.file, size: "50x50" ) if !location.file.blank? %><%= location.name%><%= location.longitude%><%= location.latitude%><%= location.description%><%= link_to 'Edit', edit_panel_gprs_back_end_location_path(location) %><%= link_to 'Destroy', panel_gprs_back_end_location_path(location), method: :delete , :confirm => t(:sure?) %>
-<%if is_manager? %> -<%= link_to 'New', new_panel_gprs_back_end_location_path %> -<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb deleted file mode 100644 index 4f911d839..000000000 --- a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/new.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= form_for @location, :url=> panel_gprs_back_end_locations_path, :html => { :class=>"form-horizontal"} do |f| %> - <%= render :partial => 'form', :locals => {:f => f} %> -<% end %> diff --git a/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/show.html.erb b/vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/show.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/config/routes.rb b/vendor/built_in_modules/gprs/config/routes.rb deleted file mode 100644 index 0ba8a27cb..000000000 --- a/vendor/built_in_modules/gprs/config/routes.rb +++ /dev/null @@ -1,12 +0,0 @@ -Rails.application.routes.draw do - namespace :panel do - namespace :gprs do - namespace :back_end do - - match "locations/get_locations" => "locations#get_locations" - - resources :locations - end - end - end -end diff --git a/vendor/built_in_modules/gprs/gprs.gemspec b/vendor/built_in_modules/gprs/gprs.gemspec deleted file mode 100644 index a701f9244..000000000 --- a/vendor/built_in_modules/gprs/gprs.gemspec +++ /dev/null @@ -1,23 +0,0 @@ -$:.push File.expand_path("../lib", __FILE__) - -# Maintain your gem's version: -require "gprs/version" - -# Describe your gem and declare its dependencies: -Gem::Specification.new do |s| - s.name = "gprs" - s.version = Gprs::VERSION - s.authors = ["TODO: Your name"] - s.email = ["TODO: Your email"] - s.homepage = "TODO" - s.summary = "TODO: Summary of Gprs." - s.description = "TODO: Description of Gprs." - - s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] - s.test_files = Dir["test/**/*"] - - s.add_dependency "rails", "~> 3.1.8" - # s.add_dependency "jquery-rails" - - s.add_development_dependency "sqlite3" -end diff --git a/vendor/built_in_modules/gprs/init.rb b/vendor/built_in_modules/gprs/init.rb deleted file mode 100644 index 99de7772e..000000000 --- a/vendor/built_in_modules/gprs/init.rb +++ /dev/null @@ -1,43 +0,0 @@ -module Location - OrbitApp.registration "Location",:type=> 'ModuleApp' do - module_label 'miss_module_i18n.location' - base_url File.expand_path File.dirname(__FILE__) - # personal_plugin :enable => true,:path=>"panel/location/plugin/profile",:i18n=>'admin.location' - - # version "0.1" - # organization "Rulingcom" - # author "RD dep" - # intro "I am intro" - # update_info 'some update_info' - - # front_end do - # app_page 'bulletins' - # end - - # category ["BulletinCategory"] - - # widgets do - # default_widget do - # query 'Bulletin.all' - # image :image - # end - - # categories_query 'BulletinCategory.all' - # tags_query 'LocationTag.all' - - # customize_widget "index","location.widget.index",:fields=>["title","category","postdate"],:style=>["cu_style_1","cu_style_2","cu_style_3","cu_style_4","cu_style_5"] - # customize_widget "bulletins_and_web_links","location.widget.bulletins_and_web_links" - # # item "index","location.widget.index",:default_template=>true,:fields=>["title","category","postdate"] - # # item "bulletins_and_web_links","location.widget.bulletins_and_web_links" - # end - - side_bar do - head_label_i18n 'miss_module_i18n.location',:icon_class=>"icons-location" - available_for [:admin,:guest,:manager,:sub_manager] - active_for_controllers ({:private=>['locations']}) - - head_link_path "panel_gprs_back_end_locations_path" - - end - end -end diff --git a/vendor/built_in_modules/gprs/lib/gprs.rb b/vendor/built_in_modules/gprs/lib/gprs.rb deleted file mode 100644 index 7a4d99e7a..000000000 --- a/vendor/built_in_modules/gprs/lib/gprs.rb +++ /dev/null @@ -1,4 +0,0 @@ -require "gprs/engine" - -module Gprs -end diff --git a/vendor/built_in_modules/gprs/lib/gprs/engine.rb b/vendor/built_in_modules/gprs/lib/gprs/engine.rb deleted file mode 100644 index 42da611a5..000000000 --- a/vendor/built_in_modules/gprs/lib/gprs/engine.rb +++ /dev/null @@ -1,4 +0,0 @@ -module Gprs - class Engine < Rails::Engine - end -end diff --git a/vendor/built_in_modules/gprs/lib/gprs/version.rb b/vendor/built_in_modules/gprs/lib/gprs/version.rb deleted file mode 100644 index bf13294df..000000000 --- a/vendor/built_in_modules/gprs/lib/gprs/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module Gprs - VERSION = "0.0.1" -end diff --git a/vendor/built_in_modules/gprs/lib/tasks/gprs_tasks.rake b/vendor/built_in_modules/gprs/lib/tasks/gprs_tasks.rake deleted file mode 100644 index ba45136c1..000000000 --- a/vendor/built_in_modules/gprs/lib/tasks/gprs_tasks.rake +++ /dev/null @@ -1,4 +0,0 @@ -# desc "Explaining what the task does" -# task :gprs do -# # Task goes here -# end diff --git a/vendor/built_in_modules/gprs/script/rails b/vendor/built_in_modules/gprs/script/rails deleted file mode 100755 index e323e44b8..000000000 --- a/vendor/built_in_modules/gprs/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -ENGINE_PATH = File.expand_path('../..', __FILE__) -load File.expand_path('../../test/dummy/script/rails', __FILE__) diff --git a/vendor/built_in_modules/gprs/test/dummy/Rakefile b/vendor/built_in_modules/gprs/test/dummy/Rakefile deleted file mode 100644 index 36458522c..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env rake -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require File.expand_path('../config/application', __FILE__) - -Dummy::Application.load_tasks diff --git a/vendor/built_in_modules/gprs/test/dummy/app/assets/javascripts/application.js b/vendor/built_in_modules/gprs/test/dummy/app/assets/javascripts/application.js deleted file mode 100644 index 37c7bfcdb..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/app/assets/javascripts/application.js +++ /dev/null @@ -1,9 +0,0 @@ -// This is a manifest file that'll be compiled into including all the files listed below. -// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically -// be included in the compiled file accessible from http://example.com/assets/application.js -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -//= require jquery -//= require jquery_ujs -//= require_tree . diff --git a/vendor/built_in_modules/gprs/test/dummy/app/assets/stylesheets/application.css b/vendor/built_in_modules/gprs/test/dummy/app/assets/stylesheets/application.css deleted file mode 100644 index fc25b5723..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/app/assets/stylesheets/application.css +++ /dev/null @@ -1,7 +0,0 @@ -/* - * This is a manifest file that'll automatically include all the stylesheets available in this directory - * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at - * the top of the compiled file, but it's generally better to create a new file per style scope. - *= require_self - *= require_tree . -*/ \ No newline at end of file diff --git a/vendor/built_in_modules/gprs/test/dummy/app/controllers/application_controller.rb b/vendor/built_in_modules/gprs/test/dummy/app/controllers/application_controller.rb deleted file mode 100644 index e8065d950..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/app/controllers/application_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ApplicationController < ActionController::Base - protect_from_forgery -end diff --git a/vendor/built_in_modules/gprs/test/dummy/app/helpers/application_helper.rb b/vendor/built_in_modules/gprs/test/dummy/app/helpers/application_helper.rb deleted file mode 100644 index de6be7945..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/vendor/built_in_modules/gprs/test/dummy/app/mailers/.gitkeep b/vendor/built_in_modules/gprs/test/dummy/app/mailers/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/test/dummy/app/models/.gitkeep b/vendor/built_in_modules/gprs/test/dummy/app/models/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/test/dummy/app/views/layouts/application.html.erb b/vendor/built_in_modules/gprs/test/dummy/app/views/layouts/application.html.erb deleted file mode 100644 index 9a8a761bd..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - Dummy - <%= stylesheet_link_tag "application" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/vendor/built_in_modules/gprs/test/dummy/config.ru b/vendor/built_in_modules/gprs/test/dummy/config.ru deleted file mode 100644 index 1989ed8d0..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run Dummy::Application diff --git a/vendor/built_in_modules/gprs/test/dummy/config/application.rb b/vendor/built_in_modules/gprs/test/dummy/config/application.rb deleted file mode 100644 index f03b73e0f..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/application.rb +++ /dev/null @@ -1,45 +0,0 @@ -require File.expand_path('../boot', __FILE__) - -require 'rails/all' - -Bundler.require -require "gprs" - -module Dummy - class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - - # Enable the asset pipeline - config.assets.enabled = true - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' - end -end - diff --git a/vendor/built_in_modules/gprs/test/dummy/config/boot.rb b/vendor/built_in_modules/gprs/test/dummy/config/boot.rb deleted file mode 100644 index eba068137..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/boot.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'rubygems' -gemfile = File.expand_path('../../../../Gemfile', __FILE__) - -if File.exist?(gemfile) - ENV['BUNDLE_GEMFILE'] = gemfile - require 'bundler' - Bundler.setup -end - -$:.unshift File.expand_path('../../../../lib', __FILE__) \ No newline at end of file diff --git a/vendor/built_in_modules/gprs/test/dummy/config/database.yml b/vendor/built_in_modules/gprs/test/dummy/config/database.yml deleted file mode 100644 index 51a4dd459..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/database.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -development: - adapter: sqlite3 - database: db/development.sqlite3 - pool: 5 - timeout: 5000 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - adapter: sqlite3 - database: db/test.sqlite3 - pool: 5 - timeout: 5000 - -production: - adapter: sqlite3 - database: db/production.sqlite3 - pool: 5 - timeout: 5000 diff --git a/vendor/built_in_modules/gprs/test/dummy/config/environment.rb b/vendor/built_in_modules/gprs/test/dummy/config/environment.rb deleted file mode 100644 index 3da5eb91d..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the rails application -require File.expand_path('../application', __FILE__) - -# Initialize the rails application -Dummy::Application.initialize! diff --git a/vendor/built_in_modules/gprs/test/dummy/config/environments/development.rb b/vendor/built_in_modules/gprs/test/dummy/config/environments/development.rb deleted file mode 100644 index 95a50b91e..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/environments/development.rb +++ /dev/null @@ -1,30 +0,0 @@ -Dummy::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 - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger - config.active_support.deprecation = :log - - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin - - # Do not compress assets - config.assets.compress = false - - # Expands the lines which load the assets - config.assets.debug = true -end diff --git a/vendor/built_in_modules/gprs/test/dummy/config/environments/production.rb b/vendor/built_in_modules/gprs/test/dummy/config/environments/production.rb deleted file mode 100644 index ca2c58883..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/environments/production.rb +++ /dev/null @@ -1,60 +0,0 @@ -Dummy::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # Code is not reloaded between requests - config.cache_classes = true - - # Full error reports are disabled and caching is turned on - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_assets = false - - # Compress JavaScripts and CSS - config.assets.compress = true - - # Don't fallback to assets pipeline if a precompiled asset is missed - config.assets.compile = false - - # Generate digests for assets URLs - config.assets.digest = true - - # Defaults to Rails.root.join("public/assets") - # config.assets.manifest = YOUR_PATH - - # Specifies the header that your server uses for sending files - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx - - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true - - # See everything in the log (default is :info) - # config.log_level = :debug - - # Use a different logger for distributed setups - # config.logger = SyslogLogger.new - - # Use a different cache store in production - # config.cache_store = :mem_cache_store - - # Enable serving of images, stylesheets, and JavaScripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" - - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - # config.assets.precompile += %w( search.js ) - - # Disable delivery errors, bad email addresses will be ignored - # config.action_mailer.raise_delivery_errors = false - - # Enable threaded mode - # config.threadsafe! - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners - config.active_support.deprecation = :notify -end diff --git a/vendor/built_in_modules/gprs/test/dummy/config/environments/test.rb b/vendor/built_in_modules/gprs/test/dummy/config/environments/test.rb deleted file mode 100644 index 6810c9147..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/environments/test.rb +++ /dev/null @@ -1,39 +0,0 @@ -Dummy::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 - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true - - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" - - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Print deprecation notices to the stderr - config.active_support.deprecation = :stderr -end diff --git a/vendor/built_in_modules/gprs/test/dummy/config/initializers/backtrace_silencers.rb b/vendor/built_in_modules/gprs/test/dummy/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cdf3..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/vendor/built_in_modules/gprs/test/dummy/config/initializers/inflections.rb b/vendor/built_in_modules/gprs/test/dummy/config/initializers/inflections.rb deleted file mode 100644 index 9e8b0131f..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/initializers/inflections.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end diff --git a/vendor/built_in_modules/gprs/test/dummy/config/initializers/mime_types.rb b/vendor/built_in_modules/gprs/test/dummy/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e44..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/vendor/built_in_modules/gprs/test/dummy/config/initializers/secret_token.rb b/vendor/built_in_modules/gprs/test/dummy/config/initializers/secret_token.rb deleted file mode 100644 index 370a8fa20..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/initializers/secret_token.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying the integrity of signed cookies. -# 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. -Dummy::Application.config.secret_token = '181584334acb820e1d0e0e53b71c0985251f4e5bfd188a962d5f9acfeeb0e46dfd6ca68784528cab00d8e6e8da087cce2bf7d060fe2b2c742a814c23689ff6af' diff --git a/vendor/built_in_modules/gprs/test/dummy/config/initializers/session_store.rb b/vendor/built_in_modules/gprs/test/dummy/config/initializers/session_store.rb deleted file mode 100644 index 952473ff9..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/initializers/session_store.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -Dummy::Application.config.session_store :cookie_store, key: '_dummy_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") -# Dummy::Application.config.session_store :active_record_store diff --git a/vendor/built_in_modules/gprs/test/dummy/config/initializers/wrap_parameters.rb b/vendor/built_in_modules/gprs/test/dummy/config/initializers/wrap_parameters.rb deleted file mode 100644 index 999df2018..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] -end - -# Disable root element in JSON by default. -ActiveSupport.on_load(:active_record) do - self.include_root_in_json = false -end diff --git a/vendor/built_in_modules/gprs/test/dummy/config/locales/en.yml b/vendor/built_in_modules/gprs/test/dummy/config/locales/en.yml deleted file mode 100644 index 179c14ca5..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" diff --git a/vendor/built_in_modules/gprs/test/dummy/config/routes.rb b/vendor/built_in_modules/gprs/test/dummy/config/routes.rb deleted file mode 100644 index bb509f27a..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/config/routes.rb +++ /dev/null @@ -1,58 +0,0 @@ -Dummy::Application.routes.draw do - # The priority is based upon order of creation: - # first created -> highest priority. - - # Sample of regular route: - # match 'products/:id' => 'catalog#view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase - # This route can be invoked with purchase_url(:id => product.id) - - # Sample resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Sample resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Sample resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Sample resource route with more complex sub-resources - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', :on => :collection - # end - # end - - # Sample resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end - - # You can have the root of your site routed with "root" - # just remember to delete public/index.html. - # root :to => 'welcome#index' - - # See how all your routes lay out with "rake routes" - - # This is a legacy wild controller route that's not recommended for RESTful applications. - # Note: This route will make all actions in every controller accessible via GET requests. - # match ':controller(/:action(/:id(.:format)))' -end diff --git a/vendor/built_in_modules/gprs/test/dummy/lib/assets/.gitkeep b/vendor/built_in_modules/gprs/test/dummy/lib/assets/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/test/dummy/log/.gitkeep b/vendor/built_in_modules/gprs/test/dummy/log/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/test/dummy/public/404.html b/vendor/built_in_modules/gprs/test/dummy/public/404.html deleted file mode 100644 index 9a48320a5..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/public/404.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - -
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
- - diff --git a/vendor/built_in_modules/gprs/test/dummy/public/422.html b/vendor/built_in_modules/gprs/test/dummy/public/422.html deleted file mode 100644 index 83660ab18..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/public/422.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - -
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
- - diff --git a/vendor/built_in_modules/gprs/test/dummy/public/500.html b/vendor/built_in_modules/gprs/test/dummy/public/500.html deleted file mode 100644 index b80307fc1..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/public/500.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - -
-

We're sorry, but something went wrong.

-

We've been notified about this issue and we'll take a look at it shortly.

-
- - diff --git a/vendor/built_in_modules/gprs/test/dummy/public/favicon.ico b/vendor/built_in_modules/gprs/test/dummy/public/favicon.ico deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/built_in_modules/gprs/test/dummy/script/rails b/vendor/built_in_modules/gprs/test/dummy/script/rails deleted file mode 100755 index f8da2cffd..000000000 --- a/vendor/built_in_modules/gprs/test/dummy/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' diff --git a/vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb b/vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb deleted file mode 100644 index bb6d0908b..000000000 --- a/vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'test_helper' - -class Panel::Gprs::BackEnd::LocationsControllerTest < ActionController::TestCase - test "should get index" do - get :index - assert_response :success - end - - test "should get edit" do - get :edit - assert_response :success - end - -end diff --git a/vendor/built_in_modules/gprs/test/gprs_test.rb b/vendor/built_in_modules/gprs/test/gprs_test.rb deleted file mode 100644 index 1ab427079..000000000 --- a/vendor/built_in_modules/gprs/test/gprs_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class GprsTest < ActiveSupport::TestCase - test "truth" do - assert_kind_of Module, Gprs - end -end diff --git a/vendor/built_in_modules/gprs/test/integration/navigation_test.rb b/vendor/built_in_modules/gprs/test/integration/navigation_test.rb deleted file mode 100644 index 97a94c9bb..000000000 --- a/vendor/built_in_modules/gprs/test/integration/navigation_test.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'test_helper' - -class NavigationTest < ActionDispatch::IntegrationTest - fixtures :all - - # test "the truth" do - # assert true - # end -end - diff --git a/vendor/built_in_modules/gprs/test/test_helper.rb b/vendor/built_in_modules/gprs/test/test_helper.rb deleted file mode 100644 index dcd3b276e..000000000 --- a/vendor/built_in_modules/gprs/test/test_helper.rb +++ /dev/null @@ -1,10 +0,0 @@ -# Configure Rails Environment -ENV["RAILS_ENV"] = "test" - -require File.expand_path("../dummy/config/environment.rb", __FILE__) -require "rails/test_help" - -Rails.backtrace_cleaner.remove_silencers! - -# Load support files -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } diff --git a/vendor/built_in_modules/gprs/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb b/vendor/built_in_modules/gprs/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb deleted file mode 100644 index e1302ea29..000000000 --- a/vendor/built_in_modules/gprs/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'test_helper' - -class Panel::Gprs::BackEnd::LocationsHelperTest < ActionView::TestCase -end From bd743a0ca5739e7a91b5e5645fd3da12f55b0411 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 7 Dec 2012 12:40:21 +0800 Subject: [PATCH 6/7] rename of GPRS now it's named location --- app/uploaders/location_uploader.rb | 61 +++++++++++++++ vendor/built_in_modules/location/.gitignore | 6 ++ vendor/built_in_modules/location/Gemfile | 17 ++++ vendor/built_in_modules/location/MIT-LICENSE | 20 +++++ vendor/built_in_modules/location/README.rdoc | 3 + vendor/built_in_modules/location/Rakefile | 39 ++++++++++ .../location/app/assets/images/gprs/.gitkeep | 0 .../app/assets/javascripts/gprs/.gitkeep | 0 .../panel/gprs/back_end/locations.js | 2 + .../app/assets/stylesheets/gprs/.gitkeep | 0 .../panel/gprs/back_end/locations.css | 4 + .../location/app/controllers/.gitkeep | 0 .../back_end/locations_controller.rb | 77 +++++++++++++++++++ .../location/app/helpers/.gitkeep | 0 .../locations/back_end/locations_helper.rb | 2 + .../location/app/mailers/.gitkeep | 0 .../location/app/models/.gitkeep | 0 .../location/app/models/location.rb | 11 +++ .../location/app/views/.gitkeep | 0 .../back_end/locations/_form.html.erb | 30 ++++++++ .../back_end/locations/edit.html.erb | 4 + .../back_end/locations/index.html.erb | 34 ++++++++ .../locations/back_end/locations/new.html.erb | 3 + .../back_end/locations/show.html.erb | 0 .../location/config/routes.rb | 12 +++ vendor/built_in_modules/location/init.rb | 43 +++++++++++ .../built_in_modules/location/lib/location.rb | 4 + .../location/lib/location/engine.rb | 4 + .../location/lib/location/version.rb | 3 + .../location/lib/tasks/location_tasks.rake | 4 + .../location/location.gemspec | 23 ++++++ vendor/built_in_modules/location/script/rails | 6 ++ .../location/test/dummy/Rakefile | 7 ++ .../app/assets/javascripts/application.js | 9 +++ .../app/assets/stylesheets/application.css | 7 ++ .../app/controllers/application_controller.rb | 3 + .../dummy/app/helpers/application_helper.rb | 2 + .../location/test/dummy/app/mailers/.gitkeep | 0 .../location/test/dummy/app/models/.gitkeep | 0 .../app/views/layouts/application.html.erb | 14 ++++ .../location/test/dummy/config.ru | 4 + .../location/test/dummy/config/application.rb | 45 +++++++++++ .../location/test/dummy/config/boot.rb | 10 +++ .../location/test/dummy/config/database.yml | 25 ++++++ .../location/test/dummy/config/environment.rb | 5 ++ .../dummy/config/environments/development.rb | 30 ++++++++ .../dummy/config/environments/production.rb | 60 +++++++++++++++ .../test/dummy/config/environments/test.rb | 39 ++++++++++ .../initializers/backtrace_silencers.rb | 7 ++ .../dummy/config/initializers/inflections.rb | 10 +++ .../dummy/config/initializers/mime_types.rb | 5 ++ .../dummy/config/initializers/secret_token.rb | 7 ++ .../config/initializers/session_store.rb | 8 ++ .../config/initializers/wrap_parameters.rb | 14 ++++ .../location/test/dummy/config/locales/en.yml | 5 ++ .../location/test/dummy/config/routes.rb | 58 ++++++++++++++ .../location/test/dummy/lib/assets/.gitkeep | 0 .../location/test/dummy/log/.gitkeep | 0 .../location/test/dummy/public/404.html | 26 +++++++ .../location/test/dummy/public/422.html | 26 +++++++ .../location/test/dummy/public/500.html | 26 +++++++ .../location/test/dummy/public/favicon.ico | 0 .../location/test/dummy/script/rails | 6 ++ .../back_end/locations_controller_test.rb | 14 ++++ .../test/integration/navigation_test.rb | 10 +++ .../location/test/location_test.rb | 7 ++ .../location/test/test_helper.rb | 10 +++ .../gprs/back_end/locations_helper_test.rb | 4 + 68 files changed, 915 insertions(+) create mode 100644 app/uploaders/location_uploader.rb create mode 100644 vendor/built_in_modules/location/.gitignore create mode 100644 vendor/built_in_modules/location/Gemfile create mode 100644 vendor/built_in_modules/location/MIT-LICENSE create mode 100644 vendor/built_in_modules/location/README.rdoc create mode 100644 vendor/built_in_modules/location/Rakefile create mode 100644 vendor/built_in_modules/location/app/assets/images/gprs/.gitkeep create mode 100644 vendor/built_in_modules/location/app/assets/javascripts/gprs/.gitkeep create mode 100644 vendor/built_in_modules/location/app/assets/javascripts/panel/gprs/back_end/locations.js create mode 100644 vendor/built_in_modules/location/app/assets/stylesheets/gprs/.gitkeep create mode 100644 vendor/built_in_modules/location/app/assets/stylesheets/panel/gprs/back_end/locations.css create mode 100644 vendor/built_in_modules/location/app/controllers/.gitkeep create mode 100644 vendor/built_in_modules/location/app/controllers/panel/locations/back_end/locations_controller.rb create mode 100644 vendor/built_in_modules/location/app/helpers/.gitkeep create mode 100644 vendor/built_in_modules/location/app/helpers/panel/locations/back_end/locations_helper.rb create mode 100644 vendor/built_in_modules/location/app/mailers/.gitkeep create mode 100644 vendor/built_in_modules/location/app/models/.gitkeep create mode 100644 vendor/built_in_modules/location/app/models/location.rb create mode 100644 vendor/built_in_modules/location/app/views/.gitkeep create mode 100644 vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/_form.html.erb create mode 100644 vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/edit.html.erb create mode 100644 vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/index.html.erb create mode 100644 vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/new.html.erb create mode 100644 vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/show.html.erb create mode 100644 vendor/built_in_modules/location/config/routes.rb create mode 100644 vendor/built_in_modules/location/init.rb create mode 100644 vendor/built_in_modules/location/lib/location.rb create mode 100644 vendor/built_in_modules/location/lib/location/engine.rb create mode 100644 vendor/built_in_modules/location/lib/location/version.rb create mode 100644 vendor/built_in_modules/location/lib/tasks/location_tasks.rake create mode 100644 vendor/built_in_modules/location/location.gemspec create mode 100755 vendor/built_in_modules/location/script/rails create mode 100644 vendor/built_in_modules/location/test/dummy/Rakefile create mode 100644 vendor/built_in_modules/location/test/dummy/app/assets/javascripts/application.js create mode 100644 vendor/built_in_modules/location/test/dummy/app/assets/stylesheets/application.css create mode 100644 vendor/built_in_modules/location/test/dummy/app/controllers/application_controller.rb create mode 100644 vendor/built_in_modules/location/test/dummy/app/helpers/application_helper.rb create mode 100644 vendor/built_in_modules/location/test/dummy/app/mailers/.gitkeep create mode 100644 vendor/built_in_modules/location/test/dummy/app/models/.gitkeep create mode 100644 vendor/built_in_modules/location/test/dummy/app/views/layouts/application.html.erb create mode 100644 vendor/built_in_modules/location/test/dummy/config.ru create mode 100644 vendor/built_in_modules/location/test/dummy/config/application.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/boot.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/database.yml create mode 100644 vendor/built_in_modules/location/test/dummy/config/environment.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/environments/development.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/environments/production.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/environments/test.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/initializers/backtrace_silencers.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/initializers/inflections.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/initializers/mime_types.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/initializers/secret_token.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/initializers/session_store.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/initializers/wrap_parameters.rb create mode 100644 vendor/built_in_modules/location/test/dummy/config/locales/en.yml create mode 100644 vendor/built_in_modules/location/test/dummy/config/routes.rb create mode 100644 vendor/built_in_modules/location/test/dummy/lib/assets/.gitkeep create mode 100644 vendor/built_in_modules/location/test/dummy/log/.gitkeep create mode 100644 vendor/built_in_modules/location/test/dummy/public/404.html create mode 100644 vendor/built_in_modules/location/test/dummy/public/422.html create mode 100644 vendor/built_in_modules/location/test/dummy/public/500.html create mode 100644 vendor/built_in_modules/location/test/dummy/public/favicon.ico create mode 100755 vendor/built_in_modules/location/test/dummy/script/rails create mode 100644 vendor/built_in_modules/location/test/functional/panel/gprs/back_end/locations_controller_test.rb create mode 100644 vendor/built_in_modules/location/test/integration/navigation_test.rb create mode 100644 vendor/built_in_modules/location/test/location_test.rb create mode 100644 vendor/built_in_modules/location/test/test_helper.rb create mode 100644 vendor/built_in_modules/location/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb diff --git a/app/uploaders/location_uploader.rb b/app/uploaders/location_uploader.rb new file mode 100644 index 000000000..1c2ec99d8 --- /dev/null +++ b/app/uploaders/location_uploader.rb @@ -0,0 +1,61 @@ +class LocationUploader < CarrierWave::Uploader::Base + + # Include RMagick or ImageScience support: + # include CarrierWave::RMagick + # include CarrierWave::ImageScience + include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + # storage :file + # storage :s3 + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "location/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process :scale => [200, 300] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process :scale => [50, 50] + # end + + version :thumb do + process :resize_to_fill => [150, 120] + end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + # def extension_white_list + # %w(jpg jpeg gif png) + # end + + # Override the filename of the uploaded files: + # def filename + # "something.jpg" if original_filename + # end + +# def manipulate! +# raise current_path.inspect +# image = ::MiniMagick::Image.open(current_path) +# image = yield(image) +# image.write(current_path) +# ::MiniMagick::Image.open(current_path) +# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e +# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}") +# end + +end + diff --git a/vendor/built_in_modules/location/.gitignore b/vendor/built_in_modules/location/.gitignore new file mode 100644 index 000000000..1463de6df --- /dev/null +++ b/vendor/built_in_modules/location/.gitignore @@ -0,0 +1,6 @@ +.bundle/ +log/*.log +pkg/ +test/dummy/db/*.sqlite3 +test/dummy/log/*.log +test/dummy/tmp/ \ No newline at end of file diff --git a/vendor/built_in_modules/location/Gemfile b/vendor/built_in_modules/location/Gemfile new file mode 100644 index 000000000..cdc455aef --- /dev/null +++ b/vendor/built_in_modules/location/Gemfile @@ -0,0 +1,17 @@ +source "http://rubygems.org" + +# Declare your gem's dependencies in gprs.gemspec. +# Bundler will treat runtime dependencies like base dependencies, and +# development dependencies will be added by default to the :development group. +gemspec + +# jquery-rails is used by the dummy application +gem "jquery-rails" + +# Declare any dependencies that are still in development here instead of in +# your gemspec. These might include edge Rails or gems from your path or +# Git. Remember to move these dependencies to your gemspec before releasing +# your gem to rubygems.org. + +# To use debugger +# gem 'ruby-debug19', :require => 'ruby-debug' diff --git a/vendor/built_in_modules/location/MIT-LICENSE b/vendor/built_in_modules/location/MIT-LICENSE new file mode 100644 index 000000000..406f17b70 --- /dev/null +++ b/vendor/built_in_modules/location/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright 2012 YOURNAME + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/built_in_modules/location/README.rdoc b/vendor/built_in_modules/location/README.rdoc new file mode 100644 index 000000000..0e425195f --- /dev/null +++ b/vendor/built_in_modules/location/README.rdoc @@ -0,0 +1,3 @@ += Location + +This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/vendor/built_in_modules/location/Rakefile b/vendor/built_in_modules/location/Rakefile new file mode 100644 index 000000000..663533743 --- /dev/null +++ b/vendor/built_in_modules/location/Rakefile @@ -0,0 +1,39 @@ +#!/usr/bin/env rake +begin + require 'bundler/setup' +rescue LoadError + puts 'You must `gem install bundler` and `bundle install` to run rake tasks' +end +begin + require 'rdoc/task' +rescue LoadError + require 'rdoc/rdoc' + require 'rake/rdoctask' + RDoc::Task = Rake::RDocTask +end + +RDoc::Task.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = 'Location' + rdoc.options << '--line-numbers' + rdoc.rdoc_files.include('README.rdoc') + rdoc.rdoc_files.include('lib/**/*.rb') +end + +APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__) +load 'rails/tasks/engine.rake' + + +Bundler::GemHelper.install_tasks + +require 'rake/testtask' + +Rake::TestTask.new(:test) do |t| + t.libs << 'lib' + t.libs << 'test' + t.pattern = 'test/**/*_test.rb' + t.verbose = false +end + + +task :default => :test diff --git a/vendor/built_in_modules/location/app/assets/images/gprs/.gitkeep b/vendor/built_in_modules/location/app/assets/images/gprs/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/app/assets/javascripts/gprs/.gitkeep b/vendor/built_in_modules/location/app/assets/javascripts/gprs/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/app/assets/javascripts/panel/gprs/back_end/locations.js b/vendor/built_in_modules/location/app/assets/javascripts/panel/gprs/back_end/locations.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/vendor/built_in_modules/location/app/assets/javascripts/panel/gprs/back_end/locations.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/vendor/built_in_modules/location/app/assets/stylesheets/gprs/.gitkeep b/vendor/built_in_modules/location/app/assets/stylesheets/gprs/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/app/assets/stylesheets/panel/gprs/back_end/locations.css b/vendor/built_in_modules/location/app/assets/stylesheets/panel/gprs/back_end/locations.css new file mode 100644 index 000000000..afad32db0 --- /dev/null +++ b/vendor/built_in_modules/location/app/assets/stylesheets/panel/gprs/back_end/locations.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/vendor/built_in_modules/location/app/controllers/.gitkeep b/vendor/built_in_modules/location/app/controllers/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/app/controllers/panel/locations/back_end/locations_controller.rb b/vendor/built_in_modules/location/app/controllers/panel/locations/back_end/locations_controller.rb new file mode 100644 index 000000000..5ad721e6a --- /dev/null +++ b/vendor/built_in_modules/location/app/controllers/panel/locations/back_end/locations_controller.rb @@ -0,0 +1,77 @@ +class Panel::Locations::BackEnd::LocationsController < OrbitBackendController + + #before_filter :clean_values, :only => [:create, :update] + + before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :delete] + before_filter :force_order_for_user,:except => [:get_locations,:index] + #before_filter :for_app_sub_manager,:except => [:index, :new, :edit, :delete, :get_locations] + + def index + @locations = Location.all + respond_to do |format| + format.html # new.html.erb + format.json { render json: @locations } + end + end + + def new + @location = Location.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @location } + end + end + + def edit + @location = Location.find(params[:id]) + end + + def show + @location = Location.find(params[:id]) + respond_to do |format| + format.html + format.json { render json: @location } + end + end + + def create + @location = Location.new(params[:location]) + @location.save! + redirect_to panel_gprs_back_end_locations_url + end + + def update + @location = Location.find(params[:id]) + @location.update_attributes(params[:location]) + redirect_to panel_gprs_back_end_locations_url + end + + def destroy + @location = Location.find(params[:id]) + @location.destroy + redirect_to panel_gprs_back_end_locations_url + + end + + def get_locations + locations = Location.all + @data = Array.new + + locations.each do |location| + picurl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.url}" + thumburl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.thumb.url}" + @data << { name: location.name, + pic_url: picurl, + thumb_url: thumburl, + longitude: location.longitude, + latitude: location.latitude, + description: location.description } + end + + #print readable json + render :json => JSON.pretty_generate({location: @data}) + + #render :json => {location: @data}.to_json + end +end diff --git a/vendor/built_in_modules/location/app/helpers/.gitkeep b/vendor/built_in_modules/location/app/helpers/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/app/helpers/panel/locations/back_end/locations_helper.rb b/vendor/built_in_modules/location/app/helpers/panel/locations/back_end/locations_helper.rb new file mode 100644 index 000000000..c6dcef87c --- /dev/null +++ b/vendor/built_in_modules/location/app/helpers/panel/locations/back_end/locations_helper.rb @@ -0,0 +1,2 @@ +module Panel::Locations::BackEnd::LocationsHelper +end diff --git a/vendor/built_in_modules/location/app/mailers/.gitkeep b/vendor/built_in_modules/location/app/mailers/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/app/models/.gitkeep b/vendor/built_in_modules/location/app/models/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/app/models/location.rb b/vendor/built_in_modules/location/app/models/location.rb new file mode 100644 index 000000000..58d032bdd --- /dev/null +++ b/vendor/built_in_modules/location/app/models/location.rb @@ -0,0 +1,11 @@ +class Location + include Mongoid::Document + include Mongoid::Timestamps + + mount_uploader :file, LocationUploader + + field :name + field :description + field :longitude, type: Float + field :latitude, type: Float +end diff --git a/vendor/built_in_modules/location/app/views/.gitkeep b/vendor/built_in_modules/location/app/views/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/_form.html.erb b/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/_form.html.erb new file mode 100644 index 000000000..62e8b21b3 --- /dev/null +++ b/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/_form.html.erb @@ -0,0 +1,30 @@ +
+ +
+ <%= f.text_field :name, :class=>"span4", :placeholder => "Area" %> +
+
+
+ +
+ <%= f.file_field :file %> +
+
+
+ +
+ <%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %> + <%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %> +
+
+
+ +
+ <%= f.text_area :description, :class=>"span4", :cols=>"30", :row=>"5" %> +
+
+
+
+ <%= f.submit "Save", :class=>"btn" %> +
+
diff --git a/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/edit.html.erb b/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/edit.html.erb new file mode 100644 index 000000000..82a59afad --- /dev/null +++ b/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/edit.html.erb @@ -0,0 +1,4 @@ +<%= form_for @location, :url=> panel_gprs_back_end_location_path(@location), :html => { :class=>"form-horizontal"} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> + diff --git a/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/index.html.erb b/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/index.html.erb new file mode 100644 index 000000000..9bbe06e76 --- /dev/null +++ b/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/index.html.erb @@ -0,0 +1,34 @@ + + + + + + + + + <%if is_manager? %> + + + <% end %> + + + + <% @locations.each do |location| %> + + + + + + + <%if is_manager? %> + + + <%end%> + + + <% end %> + +
<%= t('location.picture') %><%= t('location.name') %><%= t('location.longitude') %><%= t('location.latitude') %><%= t('location.description') %><%= t('location.edit') %><%= t('location.delete') %>
<%= image_tag(location.file, alt: location.file, size: "50x50" ) if !location.file.blank? %><%= location.name%><%= location.longitude%><%= location.latitude%><%= location.description%><%= link_to 'Edit', edit_panel_locations_back_end_location_path(location) %><%= link_to 'Destroy', panel_locations_back_end_location_path(location), method: :delete , :confirm => t(:sure?) %>
+<%if is_manager? %> +<%= link_to 'New', new_panel_locations_back_end_location_path %> +<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/new.html.erb b/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/new.html.erb new file mode 100644 index 000000000..4f911d839 --- /dev/null +++ b/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/new.html.erb @@ -0,0 +1,3 @@ +<%= form_for @location, :url=> panel_gprs_back_end_locations_path, :html => { :class=>"form-horizontal"} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> diff --git a/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/show.html.erb b/vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/show.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/config/routes.rb b/vendor/built_in_modules/location/config/routes.rb new file mode 100644 index 000000000..1205145e5 --- /dev/null +++ b/vendor/built_in_modules/location/config/routes.rb @@ -0,0 +1,12 @@ +Rails.application.routes.draw do + namespace :panel do + namespace :locations do + namespace :back_end do + + match "locations/get_locations" => "locations#get_locations" + + resources :locations + end + end + end +end diff --git a/vendor/built_in_modules/location/init.rb b/vendor/built_in_modules/location/init.rb new file mode 100644 index 000000000..f772c780f --- /dev/null +++ b/vendor/built_in_modules/location/init.rb @@ -0,0 +1,43 @@ +module Location + OrbitApp.registration "Location",:type=> 'ModuleApp' do + module_label 'miss_module_i18n.location' + base_url File.expand_path File.dirname(__FILE__) + # personal_plugin :enable => true,:path=>"panel/location/plugin/profile",:i18n=>'admin.location' + + # version "0.1" + # organization "Rulingcom" + # author "RD dep" + # intro "I am intro" + # update_info 'some update_info' + + # front_end do + # app_page 'bulletins' + # end + + # category ["BulletinCategory"] + + # widgets do + # default_widget do + # query 'Bulletin.all' + # image :image + # end + + # categories_query 'BulletinCategory.all' + # tags_query 'LocationTag.all' + + # customize_widget "index","location.widget.index",:fields=>["title","category","postdate"],:style=>["cu_style_1","cu_style_2","cu_style_3","cu_style_4","cu_style_5"] + # customize_widget "bulletins_and_web_links","location.widget.bulletins_and_web_links" + # # item "index","location.widget.index",:default_template=>true,:fields=>["title","category","postdate"] + # # item "bulletins_and_web_links","location.widget.bulletins_and_web_links" + # end + + side_bar do + head_label_i18n 'miss_module_i18n.location',:icon_class=>"icons-location" + available_for [:admin,:guest,:manager,:sub_manager] + active_for_controllers ({:private=>['locations']}) + + head_link_path "panel_locations_back_end_locations_path" + + end + end +end diff --git a/vendor/built_in_modules/location/lib/location.rb b/vendor/built_in_modules/location/lib/location.rb new file mode 100644 index 000000000..b13f49bde --- /dev/null +++ b/vendor/built_in_modules/location/lib/location.rb @@ -0,0 +1,4 @@ +require "gprs/engine" + +module Location +end diff --git a/vendor/built_in_modules/location/lib/location/engine.rb b/vendor/built_in_modules/location/lib/location/engine.rb new file mode 100644 index 000000000..161a9bbd7 --- /dev/null +++ b/vendor/built_in_modules/location/lib/location/engine.rb @@ -0,0 +1,4 @@ +module Location + class Engine < Rails::Engine + end +end diff --git a/vendor/built_in_modules/location/lib/location/version.rb b/vendor/built_in_modules/location/lib/location/version.rb new file mode 100644 index 000000000..95df884b5 --- /dev/null +++ b/vendor/built_in_modules/location/lib/location/version.rb @@ -0,0 +1,3 @@ +module Location + VERSION = "0.0.1" +end diff --git a/vendor/built_in_modules/location/lib/tasks/location_tasks.rake b/vendor/built_in_modules/location/lib/tasks/location_tasks.rake new file mode 100644 index 000000000..ba45136c1 --- /dev/null +++ b/vendor/built_in_modules/location/lib/tasks/location_tasks.rake @@ -0,0 +1,4 @@ +# desc "Explaining what the task does" +# task :gprs do +# # Task goes here +# end diff --git a/vendor/built_in_modules/location/location.gemspec b/vendor/built_in_modules/location/location.gemspec new file mode 100644 index 000000000..5d20e8691 --- /dev/null +++ b/vendor/built_in_modules/location/location.gemspec @@ -0,0 +1,23 @@ +$:.push File.expand_path("../lib", __FILE__) + +# Maintain your gem's version: +require "gprs/version" + +# Describe your gem and declare its dependencies: +Gem::Specification.new do |s| + s.name = "gprs" + s.version = Location::VERSION + s.authors = ["TODO: Your name"] + s.email = ["TODO: Your email"] + s.homepage = "TODO" + s.summary = "TODO: Summary of Location." + s.description = "TODO: Description of Location." + + s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] + s.test_files = Dir["test/**/*"] + + s.add_dependency "rails", "~> 3.1.8" + # s.add_dependency "jquery-rails" + + s.add_development_dependency "sqlite3" +end diff --git a/vendor/built_in_modules/location/script/rails b/vendor/built_in_modules/location/script/rails new file mode 100755 index 000000000..e323e44b8 --- /dev/null +++ b/vendor/built_in_modules/location/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +ENGINE_PATH = File.expand_path('../..', __FILE__) +load File.expand_path('../../test/dummy/script/rails', __FILE__) diff --git a/vendor/built_in_modules/location/test/dummy/Rakefile b/vendor/built_in_modules/location/test/dummy/Rakefile new file mode 100644 index 000000000..36458522c --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/Rakefile @@ -0,0 +1,7 @@ +#!/usr/bin/env rake +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Dummy::Application.load_tasks diff --git a/vendor/built_in_modules/location/test/dummy/app/assets/javascripts/application.js b/vendor/built_in_modules/location/test/dummy/app/assets/javascripts/application.js new file mode 100644 index 000000000..37c7bfcdb --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/app/assets/javascripts/application.js @@ -0,0 +1,9 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require_tree . diff --git a/vendor/built_in_modules/location/test/dummy/app/assets/stylesheets/application.css b/vendor/built_in_modules/location/test/dummy/app/assets/stylesheets/application.css new file mode 100644 index 000000000..fc25b5723 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/app/assets/stylesheets/application.css @@ -0,0 +1,7 @@ +/* + * This is a manifest file that'll automatically include all the stylesheets available in this directory + * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at + * the top of the compiled file, but it's generally better to create a new file per style scope. + *= require_self + *= require_tree . +*/ \ No newline at end of file diff --git a/vendor/built_in_modules/location/test/dummy/app/controllers/application_controller.rb b/vendor/built_in_modules/location/test/dummy/app/controllers/application_controller.rb new file mode 100644 index 000000000..e8065d950 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/app/controllers/application_controller.rb @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery +end diff --git a/vendor/built_in_modules/location/test/dummy/app/helpers/application_helper.rb b/vendor/built_in_modules/location/test/dummy/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/vendor/built_in_modules/location/test/dummy/app/mailers/.gitkeep b/vendor/built_in_modules/location/test/dummy/app/mailers/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/test/dummy/app/models/.gitkeep b/vendor/built_in_modules/location/test/dummy/app/models/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/test/dummy/app/views/layouts/application.html.erb b/vendor/built_in_modules/location/test/dummy/app/views/layouts/application.html.erb new file mode 100644 index 000000000..9a8a761bd --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + Dummy + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/vendor/built_in_modules/location/test/dummy/config.ru b/vendor/built_in_modules/location/test/dummy/config.ru new file mode 100644 index 000000000..1989ed8d0 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Dummy::Application diff --git a/vendor/built_in_modules/location/test/dummy/config/application.rb b/vendor/built_in_modules/location/test/dummy/config/application.rb new file mode 100644 index 000000000..f03b73e0f --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/application.rb @@ -0,0 +1,45 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +Bundler.require +require "gprs" + +module Dummy + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Enable the asset pipeline + config.assets.enabled = true + + # Version of your assets, change this if you want to expire all your assets + config.assets.version = '1.0' + end +end + diff --git a/vendor/built_in_modules/location/test/dummy/config/boot.rb b/vendor/built_in_modules/location/test/dummy/config/boot.rb new file mode 100644 index 000000000..eba068137 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/boot.rb @@ -0,0 +1,10 @@ +require 'rubygems' +gemfile = File.expand_path('../../../../Gemfile', __FILE__) + +if File.exist?(gemfile) + ENV['BUNDLE_GEMFILE'] = gemfile + require 'bundler' + Bundler.setup +end + +$:.unshift File.expand_path('../../../../lib', __FILE__) \ No newline at end of file diff --git a/vendor/built_in_modules/location/test/dummy/config/database.yml b/vendor/built_in_modules/location/test/dummy/config/database.yml new file mode 100644 index 000000000..51a4dd459 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +development: + adapter: sqlite3 + database: db/development.sqlite3 + pool: 5 + timeout: 5000 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: sqlite3 + database: db/test.sqlite3 + pool: 5 + timeout: 5000 + +production: + adapter: sqlite3 + database: db/production.sqlite3 + pool: 5 + timeout: 5000 diff --git a/vendor/built_in_modules/location/test/dummy/config/environment.rb b/vendor/built_in_modules/location/test/dummy/config/environment.rb new file mode 100644 index 000000000..3da5eb91d --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/environment.rb @@ -0,0 +1,5 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +Dummy::Application.initialize! diff --git a/vendor/built_in_modules/location/test/dummy/config/environments/development.rb b/vendor/built_in_modules/location/test/dummy/config/environments/development.rb new file mode 100644 index 000000000..95a50b91e --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/environments/development.rb @@ -0,0 +1,30 @@ +Dummy::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 + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true +end diff --git a/vendor/built_in_modules/location/test/dummy/config/environments/production.rb b/vendor/built_in_modules/location/test/dummy/config/environments/production.rb new file mode 100644 index 000000000..ca2c58883 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/environments/production.rb @@ -0,0 +1,60 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = false + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to Rails.root.join("public/assets") + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Use a different logger for distributed setups + # config.logger = SyslogLogger.new + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify +end diff --git a/vendor/built_in_modules/location/test/dummy/config/environments/test.rb b/vendor/built_in_modules/location/test/dummy/config/environments/test.rb new file mode 100644 index 000000000..6810c9147 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/environments/test.rb @@ -0,0 +1,39 @@ +Dummy::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 + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Use SQL instead of Active Record's schema dumper when creating the test database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr +end diff --git a/vendor/built_in_modules/location/test/dummy/config/initializers/backtrace_silencers.rb b/vendor/built_in_modules/location/test/dummy/config/initializers/backtrace_silencers.rb new file mode 100644 index 000000000..59385cdf3 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/vendor/built_in_modules/location/test/dummy/config/initializers/inflections.rb b/vendor/built_in_modules/location/test/dummy/config/initializers/inflections.rb new file mode 100644 index 000000000..9e8b0131f --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/initializers/inflections.rb @@ -0,0 +1,10 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end diff --git a/vendor/built_in_modules/location/test/dummy/config/initializers/mime_types.rb b/vendor/built_in_modules/location/test/dummy/config/initializers/mime_types.rb new file mode 100644 index 000000000..72aca7e44 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/vendor/built_in_modules/location/test/dummy/config/initializers/secret_token.rb b/vendor/built_in_modules/location/test/dummy/config/initializers/secret_token.rb new file mode 100644 index 000000000..370a8fa20 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# 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. +Dummy::Application.config.secret_token = '181584334acb820e1d0e0e53b71c0985251f4e5bfd188a962d5f9acfeeb0e46dfd6ca68784528cab00d8e6e8da087cce2bf7d060fe2b2c742a814c23689ff6af' diff --git a/vendor/built_in_modules/location/test/dummy/config/initializers/session_store.rb b/vendor/built_in_modules/location/test/dummy/config/initializers/session_store.rb new file mode 100644 index 000000000..952473ff9 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/initializers/session_store.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +Dummy::Application.config.session_store :cookie_store, key: '_dummy_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") +# Dummy::Application.config.session_store :active_record_store diff --git a/vendor/built_in_modules/location/test/dummy/config/initializers/wrap_parameters.rb b/vendor/built_in_modules/location/test/dummy/config/initializers/wrap_parameters.rb new file mode 100644 index 000000000..999df2018 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# Disable root element in JSON by default. +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false +end diff --git a/vendor/built_in_modules/location/test/dummy/config/locales/en.yml b/vendor/built_in_modules/location/test/dummy/config/locales/en.yml new file mode 100644 index 000000000..179c14ca5 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/locales/en.yml @@ -0,0 +1,5 @@ +# Sample localization file for English. Add more files in this directory for other locales. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + hello: "Hello world" diff --git a/vendor/built_in_modules/location/test/dummy/config/routes.rb b/vendor/built_in_modules/location/test/dummy/config/routes.rb new file mode 100644 index 000000000..bb509f27a --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/config/routes.rb @@ -0,0 +1,58 @@ +Dummy::Application.routes.draw do + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + # root :to => 'welcome#index' + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id(.:format)))' +end diff --git a/vendor/built_in_modules/location/test/dummy/lib/assets/.gitkeep b/vendor/built_in_modules/location/test/dummy/lib/assets/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/test/dummy/log/.gitkeep b/vendor/built_in_modules/location/test/dummy/log/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/test/dummy/public/404.html b/vendor/built_in_modules/location/test/dummy/public/404.html new file mode 100644 index 000000000..9a48320a5 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/public/404.html @@ -0,0 +1,26 @@ + + + + The page you were looking for doesn't exist (404) + + + + + +
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+ + diff --git a/vendor/built_in_modules/location/test/dummy/public/422.html b/vendor/built_in_modules/location/test/dummy/public/422.html new file mode 100644 index 000000000..83660ab18 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/public/422.html @@ -0,0 +1,26 @@ + + + + The change you wanted was rejected (422) + + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+ + diff --git a/vendor/built_in_modules/location/test/dummy/public/500.html b/vendor/built_in_modules/location/test/dummy/public/500.html new file mode 100644 index 000000000..b80307fc1 --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/public/500.html @@ -0,0 +1,26 @@ + + + + We're sorry, but something went wrong (500) + + + + + +
+

We're sorry, but something went wrong.

+

We've been notified about this issue and we'll take a look at it shortly.

+
+ + diff --git a/vendor/built_in_modules/location/test/dummy/public/favicon.ico b/vendor/built_in_modules/location/test/dummy/public/favicon.ico new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/built_in_modules/location/test/dummy/script/rails b/vendor/built_in_modules/location/test/dummy/script/rails new file mode 100755 index 000000000..f8da2cffd --- /dev/null +++ b/vendor/built_in_modules/location/test/dummy/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/vendor/built_in_modules/location/test/functional/panel/gprs/back_end/locations_controller_test.rb b/vendor/built_in_modules/location/test/functional/panel/gprs/back_end/locations_controller_test.rb new file mode 100644 index 000000000..0edd65aba --- /dev/null +++ b/vendor/built_in_modules/location/test/functional/panel/gprs/back_end/locations_controller_test.rb @@ -0,0 +1,14 @@ +require 'test_helper' + +class Panel::Location::BackEnd::LocationsControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + + test "should get edit" do + get :edit + assert_response :success + end + +end diff --git a/vendor/built_in_modules/location/test/integration/navigation_test.rb b/vendor/built_in_modules/location/test/integration/navigation_test.rb new file mode 100644 index 000000000..97a94c9bb --- /dev/null +++ b/vendor/built_in_modules/location/test/integration/navigation_test.rb @@ -0,0 +1,10 @@ +require 'test_helper' + +class NavigationTest < ActionDispatch::IntegrationTest + fixtures :all + + # test "the truth" do + # assert true + # end +end + diff --git a/vendor/built_in_modules/location/test/location_test.rb b/vendor/built_in_modules/location/test/location_test.rb new file mode 100644 index 000000000..b85756bce --- /dev/null +++ b/vendor/built_in_modules/location/test/location_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class LocationTest < ActiveSupport::TestCase + test "truth" do + assert_kind_of Module, Location + end +end diff --git a/vendor/built_in_modules/location/test/test_helper.rb b/vendor/built_in_modules/location/test/test_helper.rb new file mode 100644 index 000000000..dcd3b276e --- /dev/null +++ b/vendor/built_in_modules/location/test/test_helper.rb @@ -0,0 +1,10 @@ +# Configure Rails Environment +ENV["RAILS_ENV"] = "test" + +require File.expand_path("../dummy/config/environment.rb", __FILE__) +require "rails/test_help" + +Rails.backtrace_cleaner.remove_silencers! + +# Load support files +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } diff --git a/vendor/built_in_modules/location/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb b/vendor/built_in_modules/location/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb new file mode 100644 index 000000000..9e39a511d --- /dev/null +++ b/vendor/built_in_modules/location/test/unit/helpers/panel/gprs/back_end/locations_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class Panel::Location::BackEnd::LocationsHelperTest < ActionView::TestCase +end From 858e942da234fffa3053a995231f2b0d9eee43d1 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 7 Dec 2012 12:40:47 +0800 Subject: [PATCH 7/7] fix serval bugs on sidebar. --- app/models/module_app.rb | 24 +++++++++++++++++-- lib/orbit_app/helper/context_link_renderer.rb | 2 +- lib/orbit_app/helper/renderer.rb | 5 ++-- lib/orbit_app/helper/side_bar_renderer.rb | 2 +- vendor/built_in_modules/ad_banner/init.rb | 4 ++-- vendor/built_in_modules/archive/init.rb | 6 ++--- vendor/built_in_modules/gallery/init.rb | 2 +- vendor/built_in_modules/page_content/init.rb | 2 +- .../_web_link_category.html.erb | 2 +- vendor/built_in_modules/web_resource/init.rb | 8 +++---- 10 files changed, 39 insertions(+), 18 deletions(-) diff --git a/app/models/module_app.rb b/app/models/module_app.rb index b64ac9083..98fc719ec 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -63,11 +63,31 @@ class ModuleApp end def is_manager?(user) - managing_users.include?(user) + if user.nil? + return false + else + m_users = managing_users + if m_users.blank? + false + else + m_users.include?(user) + end + end end def is_sub_manager?(user) - sub_managing_users.include?(user) || is_manager?(user) + if user.nil? + return false + else # when user is guest + s_m_users = sub_managing_users + result = false + if s_m_users.blank? + result = false + else + result = s_m_users.include?(user) + end + result || is_manager?(user) + end end def managing_users diff --git a/lib/orbit_app/helper/context_link_renderer.rb b/lib/orbit_app/helper/context_link_renderer.rb index d4014faeb..530b09460 100644 --- a/lib/orbit_app/helper/context_link_renderer.rb +++ b/lib/orbit_app/helper/context_link_renderer.rb @@ -25,7 +25,7 @@ protected else (eval(available_for_in_sym).include? @current_user rescue false) end # of case - return true if result || @current_user.admin? + return true if result || (@current_user.admin? rescue false) end # of collect false end diff --git a/lib/orbit_app/helper/renderer.rb b/lib/orbit_app/helper/renderer.rb index ee2ffb238..70b0f111d 100644 --- a/lib/orbit_app/helper/renderer.rb +++ b/lib/orbit_app/helper/renderer.rb @@ -8,10 +8,11 @@ module Renderer protected def active_for_app_auth? - if @module_app.nil? + module_app = get_module_app + if module_app.nil? false else - @module_app.id.to_s == @params[:module_app_id] ? true : false + module_app.id.to_s == @params[:module_app_id] ? true : false end end diff --git a/lib/orbit_app/helper/side_bar_renderer.rb b/lib/orbit_app/helper/side_bar_renderer.rb index ba6f7c7de..e0e1f9942 100644 --- a/lib/orbit_app/helper/side_bar_renderer.rb +++ b/lib/orbit_app/helper/side_bar_renderer.rb @@ -25,7 +25,7 @@ module SideBarRenderer def display? #控制sidebar 要不要算圖 if is_manager? || is_admin? #如果是系統管理員 或 是模組管理員 true - elsif (@current_module_app.open rescue false) # 如果app 被設定成 開放 + elsif (@current_module_app.open rescue true) # 如果app 被設定成 開放 true elsif is_member? #如果app 是封閉 那至少需要是 member true diff --git a/vendor/built_in_modules/ad_banner/init.rb b/vendor/built_in_modules/ad_banner/init.rb index 6776ee0a8..e4c7f8cc9 100644 --- a/vendor/built_in_modules/ad_banner/init.rb +++ b/vendor/built_in_modules/ad_banner/init.rb @@ -35,12 +35,12 @@ module AdBanner side_bar do head_label_i18n 'admin.ad_banner',:icon_class=>"icons-landscape" available_for [:admin,:guest,:manager,:sub_manager] - active_for_controllers ({:private=>['ad_banners', 'ad_images']}) + active_for_controllers ({:public=>['admin/ad_banners', 'admin/ad_images']}) head_link_path "admin_ad_banners_path" context_link 'module_authorization', - :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: 'ad_banner'}))", + :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: 'AdBanner'}))", :priority=>6, :active_for_app_auth => 'ad_banners', :available_for => [:admin] diff --git a/vendor/built_in_modules/archive/init.rb b/vendor/built_in_modules/archive/init.rb index 565b2cdf9..23cc97b74 100644 --- a/vendor/built_in_modules/archive/init.rb +++ b/vendor/built_in_modules/archive/init.rb @@ -28,7 +28,7 @@ module Archive side_bar do head_label_i18n 'miss_module_i18n.archive',:icon_class=>"icons-archive" available_for [:admin,:guest,:manager,:sub_manager] - active_for_controllers ({:private=>['archive_file_categorys'],:public=>['panel/archive/back_end/tags']}) + active_for_controllers ({:private=>['archive_file_categorys','archive_files'],:public=>['panel/archive/back_end/tags']}) active_for_object_auth ['BulletinCategory'] head_link_path "panel_archive_back_end_archive_files_path" @@ -36,13 +36,13 @@ module Archive context_link 'miss_module_i18n._archive.all', :link_path=>"panel_archive_back_end_archive_files_path" , :priority=>1, - :active_for_action=>{:archive_file=>:index}, + :active_for_action=>{:archive_files=>:index}, :available_for => [:all] context_link 'add', :link_path=>"new_panel_archive_back_end_archive_file_path" , :priority=>2, - :active_for_action=>{:archive_file=>:new}, + :active_for_action=>{:archive_files=>:new}, :available_for => [:admin] context_link 'categories', diff --git a/vendor/built_in_modules/gallery/init.rb b/vendor/built_in_modules/gallery/init.rb index e7db1e811..3e7fa6339 100644 --- a/vendor/built_in_modules/gallery/init.rb +++ b/vendor/built_in_modules/gallery/init.rb @@ -50,7 +50,7 @@ module Gallery :available_for => [:manager] context_link 'module_authorization', - :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: 'gallery'}))", + :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: 'Gallery'}))", :priority=>6, :active_for_app_auth => 'gallery', :available_for => [:admin] diff --git a/vendor/built_in_modules/page_content/init.rb b/vendor/built_in_modules/page_content/init.rb index 2bf8a2f77..73199b184 100644 --- a/vendor/built_in_modules/page_content/init.rb +++ b/vendor/built_in_modules/page_content/init.rb @@ -24,7 +24,7 @@ module PageContent head_link_path "panel_page_content_back_end_page_contexts_path" context_link 'module_authorization', - :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: 'page_content'}))", + :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: 'PageContent'}))", :priority=>1, :active_for_app_auth => 'PageContext', :available_for => [:admin] 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 f78b98785..bb2784351 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 @@ -8,7 +8,7 @@
<% end -%> diff --git a/vendor/built_in_modules/web_resource/init.rb b/vendor/built_in_modules/web_resource/init.rb index c581506b2..3362849a2 100644 --- a/vendor/built_in_modules/web_resource/init.rb +++ b/vendor/built_in_modules/web_resource/init.rb @@ -36,19 +36,19 @@ module WebResource context_link 'list_', :link_path=>"panel_web_resource_back_end_web_links_path" , :priority=>1, - :active_for_action=>{:bulletins=>:index}, + :active_for_action=>{:web_links=>:index}, :available_for => [:all] context_link 'link', :link_path=>"new_panel_web_resource_back_end_web_link_path" , :priority=>2, - :active_for_action=>{:bulletins=>:new}, + :active_for_action=>{:web_links=>:new}, :available_for => [:sub_manager] context_link 'categories', :link_path=>"panel_web_resource_back_end_web_link_categorys_path" , :priority=>3, - :active_for_action=>{:bulletin_categorys=>:index}, + :active_for_action=>{:web_link_categorys=>:index}, :available_for => [:manager] context_link 'tags', @@ -58,7 +58,7 @@ module WebResource :available_for => [:manager] context_link 'module_authorization', - :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: 'web_resource'}))", + :link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: 'WebResource'}))", :priority=>6, :active_for_app_auth => 'web_resource', :available_for => [:admin]