From 62aaf79491994c0e925cba5215ada5febfcded19 Mon Sep 17 00:00:00 2001 From: chris2tof Date: Fri, 23 Dec 2011 18:34:21 +0800 Subject: [PATCH] Merge with sub_roles --- .rspec | 1 + .rvmrc | 1 - Gemfile | 7 +- Gemfile.lock | 31 +- app/assets/javascripts/attribute_form.js.erb | 25 + app/assets/javascripts/page_edit.js | 25 +- app/assets/javascripts/rss.js | 513 ++ app/assets/javascripts/site_editor.js | 1 + app/assets/javascripts/user_attribute_form.js | 10 - .../javascripts/user_attribute_model_form.js | 33 - app/assets/javascripts/user_form.js | 8 +- app/assets/stylesheets/admin_back_end.css.erb | 2 +- .../assets/stylesheets/feile.css.erb | 0 app/controllers/admin/app_auths_controller.rb | 17 + app/controllers/admin/infos_controller.rb | 63 + .../admin/module_apps_controller.rb | 9 + app/controllers/admin/pages_controller.rb | 2 + app/controllers/admin/roles_controller.rb | 56 + .../admin/translations_controller.rb | 6 +- .../admin/user_attributes_controller.rb | 43 - .../admin/user_info_models_controller.rb | 59 - .../admin/user_role_models_controller.rb | 60 - app/controllers/admin/users_controller.rb | 29 +- app/controllers/application_controller.rb | 6 +- app/controllers/pages_controller.rb | 35 +- app/helpers/admin/user_helper.rb | 4 +- app/helpers/application_helper.rb | 7 + app/models/app_auth.rb | 77 + app/models/design/design.rb | 36 +- app/models/design/layout.rb | 2 +- app/models/i18n_variable.rb | 2 + app/models/module_app.rb | 6 +- app/models/page.rb | 2 + app/models/purchase/purchase.rb | 4 + app/models/user/attribute.rb | 26 + app/models/user/attribute_field.rb | 37 + app/models/user/attribute_model.rb | 62 - app/models/user/attribute_value.rb | 7 +- app/models/user/info.rb | 3 + app/models/user/role.rb | 29 + app/models/user/sub_role.rb | 11 + app/models/user/user.rb | 62 +- app/models/user/user_attribute.rb | 21 - app/models/user/user_attribute_model.rb | 74 - app/models/user/user_info.rb | 5 - app/models/user/user_info_model.rb | 3 - app/models/user/user_role.rb | 5 - app/models/user/user_role_model.rb | 8 - app/views/admin/app_auths/_auth_unit.html.erb | 3 + app/views/admin/app_auths/index.html.erb | 32 + .../attributes/_attribute_field.html.erb | 34 + app/views/admin/attributes/edit.html.erb | 14 + app/views/admin/attributes/index.html.erb | 39 + app/views/admin/attributes/new.html.erb | 14 + .../admin/attributes/toggle_enable.js.erb | 3 + app/views/admin/designs/_design_file.html.erb | 2 +- app/views/admin/designs/_new.html.erb | 10 + app/views/admin/designs/edit.html.erb | 2 +- app/views/admin/designs/new.html.erb | 4 +- app/views/admin/designs/new.js.erb | 1 + .../admin/infos/_attribute_field.html.erb | 3 + app/views/admin/infos/_form.html.erb | 70 + .../admin/module_apps/_app_selector.html.erb | 1 + .../module_apps/reload_frontend_pages.js.erb | 1 + app/views/admin/pages/_form.html.erb | 7 +- app/views/admin/pages/_show.html.erb | 6 +- .../admin/roles/_attribute_field.html.erb | 3 + app/views/admin/roles/_form.html.erb | 50 + app/views/admin/roles/_form_sub.html.erb | 3 + app/views/admin/roles/_sub_role.html.erb | 68 + .../_attribute_model.html.erb | 36 - .../user_attribute_models/_form.html.erb | 57 - .../user_attribute_models/admin.html.erb | 31 - .../admin/user_attribute_models/edit.html.erb | 14 - .../user_attribute_models/edit.html.erb.back | 14 - .../user_attribute_models/index.html.erb | 41 - .../admin/user_attribute_models/new.html.erb | 18 - .../toggle_enable.js.erb | 3 - .../admin/user_attributes/_form.html.erb | 32 - app/views/admin/user_attributes/edit.html.erb | 12 - .../admin/user_attributes/index.html.erb | 34 - app/views/admin/user_attributes/new.html.erb | 16 - app/views/admin/users/_form.html.erb | 27 +- app/views/admin/users/_info.html.erb | 40 + .../admin/users/_show_attribute.html.erb | 26 + app/views/admin/users/_show_sub_role.html.erb | 4 + .../admin/users/_show_user_attribute.html.erb | 27 - app/views/admin/users/_side_bar.html.erb | 12 +- app/views/admin/users/_sub_role.html.erb | 37 + .../admin/users/_sub_role_selector.html.erb | 4 + .../admin/users/_user_attribute.html.erb | 44 - app/views/admin/users/edit.html.erb | 2 +- app/views/admin/users/index.html.erb | 3 +- app/views/admin/users/new.html.erb | 2 +- app/views/admin/users/show.html.erb | 23 +- config/application.rb | 12 +- config/initializers/fix_using_obj_id.rb | 5 + config/list.yml | 1 + config/locales/en.yml | 18 +- config/locales/zh_tw.yml | 18 +- config/routes.rb | 23 +- lib/fraisier/layout.html | 8 +- lib/parser.rb | 309 - lib/parsers/parser_back_end.rb | 119 + lib/parsers/parser_common.rb | 34 + lib/parsers/parser_front_end.rb | 139 + lib/parsers/parser_layout.rb | 36 + lib/tasks/app_auth.rake | 11 + lib/tasks/dev.rake | 113 +- public/static/kernel.js | 21 +- spec/controllers/design_controller_spec.rb | 47 - spec/helpers/design_helper_spec.rb | 15 - spec/models/app_auth_basic.rb | 137 + spec/models/app_auth_spec.rb | 81 + spec/models/design_spec.rb | 5 - spec/models/role_spec.rb | 113 + spec/spec.opts | 4 - spec/spec_helper.rb | 75 +- spec/views/design/create.html.erb_spec.rb | 5 - spec/views/design/destroy.html.erb_spec.rb | 5 - spec/views/design/edit.html.erb_spec.rb | 5 - spec/views/design/index.html.erb_spec.rb | 5 - spec/views/design/new.html.erb_spec.rb | 5 - spec/views/design/update.html.erb_spec.rb | 5 - .../NewBlog/.gitignore | 0 .../NewBlog/Gemfile | 0 .../NewBlog/Gemfile.lock | 0 .../NewBlog/MIT-LICENSE | 0 .../NewBlog/NewBlog.gemspec | 0 vendor/built_in_modules/NewBlog/NewBlog.json | 10 + .../NewBlog/README.rdoc | 0 .../NewBlog/Rakefile | 0 .../app/assets/images/NewBlog}/.gitkeep | 0 .../app/assets/javascripts/NewBlog}/.gitkeep | 0 .../app/assets/stylesheets}/NewBlog/.gitkeep | 0 .../stylesheets/NewBlog/application.css | 0 .../assets/stylesheets/NewBlog/production.css | 0 .../NewBlog/app/controllers}/.gitkeep | 0 .../app/controllers/application_controller.rb | 0 .../panel/blog/back_end}/posts_controller.rb | 8 +- .../blog/front_end/comments_controller.rb | 7 + .../panel/blog/front_end/posts_controller.rb | 17 + .../panel/blog/widget/posts_controller.rb | 15 + .../NewBlog/app/helpers}/.gitkeep | 0 .../app/helpers/application_helper.rb | 0 .../NewBlog/app/mailers}/.gitkeep | 0 .../NewBlog/app/models}/.gitkeep | 0 .../{blog => NewBlog}/app/models/comment.rb | 0 .../{blog => NewBlog}/app/models/post.rb | 0 .../NewBlog/app/views}/.gitkeep | 0 .../app/views/layouts/application.html.erb | 0 .../app/views/layouts/edit_view.html.erb | 0 .../app/views/layouts/production.html.erb | 0 .../panel/blog/back_end}/posts/_form.html.erb | 0 .../panel/blog/back_end/posts/edit.html.erb | 8 + .../panel/blog/back_end}/posts/index.html.erb | 8 +- .../blog/back_end}/posts/latest_post.html.erb | 0 .../panel/blog/back_end}/posts/new.html.erb | 4 +- .../panel/blog/back_end}/posts/show.html.erb | 4 +- .../front_end/posts/_post_frontend.html.erb | 7 + .../panel/blog/front_end/posts/index.html.erb | 11 + .../panel/blog/front_end}/posts/show.html.erb | 6 +- .../panel/blog/widget/posts/index.html.erb} | 2 +- .../blog/widget/posts/latest_post.html.erb} | 0 .../NewBlog/config/locales/en.yml | 0 .../NewBlog/config/locales/zh_tw.yml | 330 + .../built_in_modules/NewBlog/config/routes.rb | 25 + .../NewBlog/lib/NewBlog.rb | 0 .../NewBlog/lib/NewBlog/engine.rb | 0 .../NewBlog/lib/NewBlog/version.rb | 0 .../NewBlog/lib/tasks/NewBlog_tasks.rake | 0 .../NewBlog/script/rails | 0 .../NewBlog/test/NewBlog_test.rb | 0 .../NewBlog/test/dummy/Rakefile | 0 .../app/assets/javascripts/application.js | 0 .../app/assets/stylesheets/application.css | 0 .../app/controllers/application_controller.rb | 0 .../dummy}/app/helpers/application_helper.rb | 0 .../NewBlog/test/dummy/app/mailers}/.gitkeep | 0 .../NewBlog/test/dummy/app/models}/.gitkeep | 0 .../app/views/layouts/application.html.erb | 0 .../NewBlog/test/dummy/config.ru | 0 .../NewBlog/test/dummy/config/application.rb | 0 .../NewBlog/test/dummy/config/boot.rb | 0 .../NewBlog/test/dummy/config/database.yml | 0 .../NewBlog/test/dummy/config/environment.rb | 0 .../dummy/config/environments/development.rb | 0 .../dummy/config/environments/production.rb | 0 .../test/dummy/config/environments/test.rb | 0 .../initializers/backtrace_silencers.rb | 0 .../dummy}/config/initializers/inflections.rb | 0 .../dummy}/config/initializers/mime_types.rb | 0 .../dummy/config/initializers/secret_token.rb | 0 .../config/initializers/session_store.rb | 0 .../config/initializers/wrap_parameters.rb | 0 .../NewBlog/test/dummy/config/locales/en.yml | 0 .../NewBlog/test/dummy/config/mongoid.yml | 0 .../NewBlog/test/dummy/config/routes.rb | 0 .../NewBlog/test/dummy/lib/assets}/.gitkeep | 0 .../NewBlog/test/dummy/log}/.gitkeep | 0 .../test/dummy}/public/404.html | 0 .../test/dummy}/public/422.html | 0 .../test/dummy}/public/500.html | 0 .../test/dummy}/public/favicon.ico | 0 .../{blog => NewBlog/test/dummy}/script/rails | 0 .../test/integration/navigation_test.rb | 0 .../NewBlog/test/test_helper.rb | 0 vendor/built_in_modules/blog/.gitignore | 4 - vendor/built_in_modules/blog/Gemfile | 32 - vendor/built_in_modules/blog/Gemfile.lock | 83 - vendor/built_in_modules/blog/README | 256 - vendor/built_in_modules/blog/Rakefile | 7 - .../panel/blog/comments_controller.rb | 7 - .../app/views/panel/blog/posts/edit.html.erb | 8 - .../app/views/panel/blog/posts/index.html.erb | 2 +- .../app/views/panel/blog/posts/new.html.erb | 6 - vendor/built_in_modules/blog/config.ru | 4 - .../blog/config/application.rb | 49 - vendor/built_in_modules/blog/config/boot.rb | 6 - .../blog/config/environment.rb | 5 - .../blog/config/environments/development.rb | 26 - .../blog/config/environments/production.rb | 49 - .../blog/config/environments/test.rb | 35 - .../blog/config/initializers/secret_token.rb | 7 - .../blog/config/initializers/session_store.rb | 8 - .../blog/config/locales/en.yml | 18 - .../blog/config/locales/zh_tw.yml | 10 - .../built_in_modules/blog/config/mongoid.yml | 23 - vendor/built_in_modules/blog/config/routes.rb | 66 - vendor/built_in_modules/blog/db/seeds.rb | 7 - .../built_in_modules/blog/doc/README_FOR_APP | 2 - .../blog/public/images/rails.png | Bin 6646 -> 0 bytes .../built_in_modules/blog/public/index.html | 239 - .../blog/public/javascripts/application.js | 2 - .../blog/public/javascripts/controls.js | 965 --- .../blog/public/javascripts/dragdrop.js | 974 --- .../blog/public/javascripts/effects.js | 1123 --- .../blog/public/javascripts/prototype.js | 6001 ----------------- .../blog/public/javascripts/rails.js | 191 - .../built_in_modules/blog/public/robots.txt | 5 - .../blog/test/performance/browsing_test.rb | 9 - .../built_in_modules/blog/test/test_helper.rb | 7 - vendor/plugins/NewBlog/NewBlog.json | 9 - .../app/controllers/application_controller.rb | 23 - .../panel/blog/comments_controller.rb | 7 - .../panel/blog/posts_controller.rb | 111 - vendor/plugins/NewBlog/app/models/comment.rb | 7 - vendor/plugins/NewBlog/app/models/post.rb | 8 - .../app/views/layouts/application.html.erb | 14 - .../app/views/panel/blog/posts/_form.html.erb | 14 - .../app/views/panel/blog/posts/edit.html.erb | 8 - .../plugins/NewBlog/config/locales/zh_tw.yml | 20 - vendor/plugins/NewBlog/config/routes.rb | 13 - .../dummy/app/helpers/application_helper.rb | 2 - .../initializers/backtrace_silencers.rb | 7 - .../dummy/config/initializers/inflections.rb | 10 - .../dummy/config/initializers/mime_types.rb | 5 - .../NewBlog/test/dummy/lib/assets/.gitkeep | 0 .../plugins/NewBlog/test/dummy/log/.gitkeep | 0 .../NewBlog/test/dummy/public/404.html | 26 - .../NewBlog/test/dummy/public/422.html | 26 - .../NewBlog/test/dummy/public/500.html | 26 - .../NewBlog/test/dummy/public/favicon.ico | 0 .../plugins/NewBlog/test/dummy/script/rails | 6 - vendor/plugins/radius/.gitignore | 4 - vendor/plugins/radius/CHANGELOG | 42 - vendor/plugins/radius/LICENSE | 19 - vendor/plugins/radius/QUICKSTART.rdoc | 322 - vendor/plugins/radius/README.rdoc | 100 - vendor/plugins/radius/Rakefile | 8 - vendor/plugins/radius/VERSION | 1 - vendor/plugins/radius/lib/radius.rb | 11 - vendor/plugins/radius/lib/radius/context.rb | 147 - .../lib/radius/delegating_open_struct.rb | 37 - vendor/plugins/radius/lib/radius/error.rb | 43 - .../plugins/radius/lib/radius/ord_string.rb | 13 - vendor/plugins/radius/lib/radius/parse_tag.rb | 24 - vendor/plugins/radius/lib/radius/parser.rb | 79 - .../radius/parser/JavaScanner$Flavor.class | Bin 1086 -> 0 bytes .../lib/radius/parser/JavaScanner$Tag.class | Bin 800 -> 0 bytes .../lib/radius/parser/JavaScanner.class | Bin 16807 -> 0 bytes .../radius/lib/radius/parser/JavaScanner.java | 634 -- .../radius/lib/radius/parser/JavaScanner.rl | 179 - .../radius/lib/radius/parser/java_scanner.jar | Bin 9560 -> 0 bytes .../radius/lib/radius/parser/scanner.rb | 1255 ---- .../radius/lib/radius/parser/scanner.rl | 125 - .../lib/radius/parser/squiggle_scanner.rb | 1238 ---- .../lib/radius/parser/squiggle_scanner.rl | 126 - .../plugins/radius/lib/radius/tag_binding.rb | 71 - .../radius/lib/radius/tag_definitions.rb | 78 - vendor/plugins/radius/lib/radius/utility.rb | 40 - vendor/plugins/radius/lib/radius/version.rb | 8 - vendor/plugins/radius/radius.gemspec | 94 - vendor/plugins/radius/tasks/jeweler.rake | 22 - vendor/plugins/radius/tasks/rdoc.rake | 13 - vendor/plugins/radius/tasks/rubinius.rake | 4 - vendor/plugins/radius/tasks/scan.rake | 79 - vendor/plugins/radius/tasks/test.rake | 7 - vendor/plugins/radius/test/benchmarks.rb | 35 - vendor/plugins/radius/test/context_test.rb | 61 - .../plugins/radius/test/multithreaded_test.rb | 62 - vendor/plugins/radius/test/ord_string_test.rb | 18 - vendor/plugins/radius/test/parser_test.rb | 307 - vendor/plugins/radius/test/quickstart_test.rb | 151 - vendor/plugins/radius/test/squiggle_test.rb | 281 - vendor/plugins/radius/test/test_helper.rb | 36 - vendor/plugins/radius/test/utility_test.rb | 30 - .../templates/sunrise/stylesheets/sunrise.css | 3 - 308 files changed, 2844 insertions(+), 17841 deletions(-) delete mode 100644 .rvmrc create mode 100644 app/assets/javascripts/attribute_form.js.erb create mode 100644 app/assets/javascripts/rss.js delete mode 100644 app/assets/javascripts/user_attribute_form.js delete mode 100644 app/assets/javascripts/user_attribute_model_form.js rename vendor/built_in_modules/blog/lib/tasks/.gitkeep => app/assets/stylesheets/feile.css.erb (100%) create mode 100644 app/controllers/admin/app_auths_controller.rb create mode 100644 app/controllers/admin/infos_controller.rb create mode 100644 app/controllers/admin/module_apps_controller.rb create mode 100644 app/controllers/admin/roles_controller.rb delete mode 100644 app/controllers/admin/user_attributes_controller.rb delete mode 100644 app/controllers/admin/user_info_models_controller.rb delete mode 100644 app/controllers/admin/user_role_models_controller.rb create mode 100644 app/models/app_auth.rb create mode 100644 app/models/user/attribute.rb create mode 100644 app/models/user/attribute_field.rb delete mode 100644 app/models/user/attribute_model.rb create mode 100644 app/models/user/info.rb create mode 100644 app/models/user/role.rb create mode 100644 app/models/user/sub_role.rb delete mode 100644 app/models/user/user_attribute.rb delete mode 100644 app/models/user/user_attribute_model.rb delete mode 100644 app/models/user/user_info.rb delete mode 100644 app/models/user/user_info_model.rb delete mode 100644 app/models/user/user_role.rb delete mode 100644 app/models/user/user_role_model.rb create mode 100644 app/views/admin/app_auths/_auth_unit.html.erb create mode 100644 app/views/admin/app_auths/index.html.erb create mode 100644 app/views/admin/attributes/_attribute_field.html.erb create mode 100644 app/views/admin/attributes/edit.html.erb create mode 100644 app/views/admin/attributes/index.html.erb create mode 100644 app/views/admin/attributes/new.html.erb create mode 100644 app/views/admin/attributes/toggle_enable.js.erb create mode 100644 app/views/admin/designs/_new.html.erb create mode 100644 app/views/admin/designs/new.js.erb create mode 100644 app/views/admin/infos/_attribute_field.html.erb create mode 100644 app/views/admin/infos/_form.html.erb create mode 100644 app/views/admin/module_apps/_app_selector.html.erb create mode 100644 app/views/admin/module_apps/reload_frontend_pages.js.erb create mode 100644 app/views/admin/roles/_attribute_field.html.erb create mode 100644 app/views/admin/roles/_form.html.erb create mode 100644 app/views/admin/roles/_form_sub.html.erb create mode 100644 app/views/admin/roles/_sub_role.html.erb delete mode 100644 app/views/admin/user_attribute_models/_attribute_model.html.erb delete mode 100644 app/views/admin/user_attribute_models/_form.html.erb delete mode 100644 app/views/admin/user_attribute_models/admin.html.erb delete mode 100644 app/views/admin/user_attribute_models/edit.html.erb delete mode 100644 app/views/admin/user_attribute_models/edit.html.erb.back delete mode 100644 app/views/admin/user_attribute_models/index.html.erb delete mode 100644 app/views/admin/user_attribute_models/new.html.erb delete mode 100644 app/views/admin/user_attribute_models/toggle_enable.js.erb delete mode 100644 app/views/admin/user_attributes/_form.html.erb delete mode 100644 app/views/admin/user_attributes/edit.html.erb delete mode 100644 app/views/admin/user_attributes/index.html.erb delete mode 100644 app/views/admin/user_attributes/new.html.erb create mode 100644 app/views/admin/users/_info.html.erb create mode 100644 app/views/admin/users/_show_attribute.html.erb create mode 100644 app/views/admin/users/_show_sub_role.html.erb delete mode 100644 app/views/admin/users/_show_user_attribute.html.erb create mode 100644 app/views/admin/users/_sub_role.html.erb create mode 100644 app/views/admin/users/_sub_role_selector.html.erb delete mode 100644 app/views/admin/users/_user_attribute.html.erb create mode 100644 config/initializers/fix_using_obj_id.rb delete mode 100644 lib/parser.rb create mode 100644 lib/parsers/parser_back_end.rb create mode 100644 lib/parsers/parser_common.rb create mode 100644 lib/parsers/parser_front_end.rb create mode 100644 lib/parsers/parser_layout.rb create mode 100644 lib/tasks/app_auth.rake delete mode 100644 spec/controllers/design_controller_spec.rb delete mode 100644 spec/helpers/design_helper_spec.rb create mode 100644 spec/models/app_auth_basic.rb create mode 100644 spec/models/app_auth_spec.rb delete mode 100644 spec/models/design_spec.rb create mode 100644 spec/models/role_spec.rb delete mode 100644 spec/spec.opts delete mode 100644 spec/views/design/create.html.erb_spec.rb delete mode 100644 spec/views/design/destroy.html.erb_spec.rb delete mode 100644 spec/views/design/edit.html.erb_spec.rb delete mode 100644 spec/views/design/index.html.erb_spec.rb delete mode 100644 spec/views/design/new.html.erb_spec.rb delete mode 100644 spec/views/design/update.html.erb_spec.rb rename vendor/{plugins => built_in_modules}/NewBlog/.gitignore (100%) rename vendor/{plugins => built_in_modules}/NewBlog/Gemfile (100%) rename vendor/{plugins => built_in_modules}/NewBlog/Gemfile.lock (100%) rename vendor/{plugins => built_in_modules}/NewBlog/MIT-LICENSE (100%) rename vendor/{plugins => built_in_modules}/NewBlog/NewBlog.gemspec (100%) create mode 100755 vendor/built_in_modules/NewBlog/NewBlog.json rename vendor/{plugins => built_in_modules}/NewBlog/README.rdoc (100%) rename vendor/{plugins => built_in_modules}/NewBlog/Rakefile (100%) rename vendor/built_in_modules/{blog/public/stylesheets => NewBlog/app/assets/images/NewBlog}/.gitkeep (100%) rename vendor/built_in_modules/{blog/vendor/plugins => NewBlog/app/assets/javascripts/NewBlog}/.gitkeep (100%) rename vendor/{plugins/NewBlog/app/assets/images => built_in_modules/NewBlog/app/assets/stylesheets}/NewBlog/.gitkeep (100%) rename vendor/{plugins => built_in_modules}/NewBlog/app/assets/stylesheets/NewBlog/application.css (100%) rename vendor/{plugins => built_in_modules}/NewBlog/app/assets/stylesheets/NewBlog/production.css (100%) rename vendor/{plugins/NewBlog/app/assets/javascripts/NewBlog => built_in_modules/NewBlog/app/controllers}/.gitkeep (100%) rename vendor/built_in_modules/{blog => NewBlog}/app/controllers/application_controller.rb (100%) rename vendor/built_in_modules/{blog/app/controllers/panel/blog => NewBlog/app/controllers/panel/blog/back_end}/posts_controller.rb (94%) create mode 100644 vendor/built_in_modules/NewBlog/app/controllers/panel/blog/front_end/comments_controller.rb create mode 100644 vendor/built_in_modules/NewBlog/app/controllers/panel/blog/front_end/posts_controller.rb create mode 100644 vendor/built_in_modules/NewBlog/app/controllers/panel/blog/widget/posts_controller.rb rename vendor/{plugins/NewBlog/app/assets/stylesheets/NewBlog => built_in_modules/NewBlog/app/helpers}/.gitkeep (100%) rename vendor/built_in_modules/{blog => NewBlog}/app/helpers/application_helper.rb (100%) rename vendor/{plugins/NewBlog/app/controllers => built_in_modules/NewBlog/app/mailers}/.gitkeep (100%) rename vendor/{plugins/NewBlog/app/helpers => built_in_modules/NewBlog/app/models}/.gitkeep (100%) rename vendor/built_in_modules/{blog => NewBlog}/app/models/comment.rb (100%) rename vendor/built_in_modules/{blog => NewBlog}/app/models/post.rb (100%) rename vendor/{plugins/NewBlog/app/mailers => built_in_modules/NewBlog/app/views}/.gitkeep (100%) rename vendor/built_in_modules/{blog => NewBlog}/app/views/layouts/application.html.erb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/app/views/layouts/edit_view.html.erb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/app/views/layouts/production.html.erb (100%) rename vendor/built_in_modules/{blog/app/views/panel/blog => NewBlog/app/views/panel/blog/back_end}/posts/_form.html.erb (100%) create mode 100644 vendor/built_in_modules/NewBlog/app/views/panel/blog/back_end/posts/edit.html.erb rename vendor/{plugins/NewBlog/app/views/panel/blog => built_in_modules/NewBlog/app/views/panel/blog/back_end}/posts/index.html.erb (51%) rename vendor/{plugins/NewBlog/app/views/panel/blog => built_in_modules/NewBlog/app/views/panel/blog/back_end}/posts/latest_post.html.erb (100%) rename vendor/{plugins/NewBlog/app/views/panel/blog => built_in_modules/NewBlog/app/views/panel/blog/back_end}/posts/new.html.erb (56%) rename vendor/{plugins/NewBlog/app/views/panel/blog => built_in_modules/NewBlog/app/views/panel/blog/back_end}/posts/show.html.erb (77%) create mode 100644 vendor/built_in_modules/NewBlog/app/views/panel/blog/front_end/posts/_post_frontend.html.erb create mode 100644 vendor/built_in_modules/NewBlog/app/views/panel/blog/front_end/posts/index.html.erb rename vendor/built_in_modules/{blog/app/views/panel/blog => NewBlog/app/views/panel/blog/front_end}/posts/show.html.erb (79%) rename vendor/{plugins/NewBlog/app/views/panel/blog/posts/widget_index.html.erb => built_in_modules/NewBlog/app/views/panel/blog/widget/posts/index.html.erb} (77%) rename vendor/{plugins/NewBlog/app/views/panel/blog/posts/widget_latest_post.html.erb => built_in_modules/NewBlog/app/views/panel/blog/widget/posts/latest_post.html.erb} (100%) rename vendor/{plugins => built_in_modules}/NewBlog/config/locales/en.yml (100%) create mode 100644 vendor/built_in_modules/NewBlog/config/locales/zh_tw.yml create mode 100644 vendor/built_in_modules/NewBlog/config/routes.rb rename vendor/{plugins => built_in_modules}/NewBlog/lib/NewBlog.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/lib/NewBlog/engine.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/lib/NewBlog/version.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/lib/tasks/NewBlog_tasks.rake (100%) rename vendor/{plugins => built_in_modules}/NewBlog/script/rails (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/NewBlog_test.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/Rakefile (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/app/assets/javascripts/application.js (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/app/assets/stylesheets/application.css (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/app/controllers/application_controller.rb (100%) rename vendor/{plugins/NewBlog => built_in_modules/NewBlog/test/dummy}/app/helpers/application_helper.rb (100%) rename vendor/{plugins/NewBlog/app/models => built_in_modules/NewBlog/test/dummy/app/mailers}/.gitkeep (100%) rename vendor/{plugins/NewBlog/app/views => built_in_modules/NewBlog/test/dummy/app/models}/.gitkeep (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/app/views/layouts/application.html.erb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config.ru (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/application.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/boot.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/database.yml (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/environment.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/environments/development.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/environments/production.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/environments/test.rb (100%) rename vendor/built_in_modules/{blog => NewBlog/test/dummy}/config/initializers/backtrace_silencers.rb (100%) rename vendor/built_in_modules/{blog => NewBlog/test/dummy}/config/initializers/inflections.rb (100%) rename vendor/built_in_modules/{blog => NewBlog/test/dummy}/config/initializers/mime_types.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/initializers/secret_token.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/initializers/session_store.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/initializers/wrap_parameters.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/locales/en.yml (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/mongoid.yml (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/dummy/config/routes.rb (100%) rename vendor/{plugins/NewBlog/test/dummy/app/mailers => built_in_modules/NewBlog/test/dummy/lib/assets}/.gitkeep (100%) rename vendor/{plugins/NewBlog/test/dummy/app/models => built_in_modules/NewBlog/test/dummy/log}/.gitkeep (100%) rename vendor/built_in_modules/{blog => NewBlog/test/dummy}/public/404.html (100%) rename vendor/built_in_modules/{blog => NewBlog/test/dummy}/public/422.html (100%) rename vendor/built_in_modules/{blog => NewBlog/test/dummy}/public/500.html (100%) rename vendor/built_in_modules/{blog => NewBlog/test/dummy}/public/favicon.ico (100%) rename vendor/built_in_modules/{blog => NewBlog/test/dummy}/script/rails (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/integration/navigation_test.rb (100%) rename vendor/{plugins => built_in_modules}/NewBlog/test/test_helper.rb (100%) delete mode 100644 vendor/built_in_modules/blog/.gitignore delete mode 100644 vendor/built_in_modules/blog/Gemfile delete mode 100644 vendor/built_in_modules/blog/Gemfile.lock delete mode 100644 vendor/built_in_modules/blog/README delete mode 100644 vendor/built_in_modules/blog/Rakefile delete mode 100644 vendor/built_in_modules/blog/app/controllers/panel/blog/comments_controller.rb delete mode 100644 vendor/built_in_modules/blog/app/views/panel/blog/posts/edit.html.erb delete mode 100644 vendor/built_in_modules/blog/app/views/panel/blog/posts/new.html.erb delete mode 100644 vendor/built_in_modules/blog/config.ru delete mode 100644 vendor/built_in_modules/blog/config/application.rb delete mode 100644 vendor/built_in_modules/blog/config/boot.rb delete mode 100644 vendor/built_in_modules/blog/config/environment.rb delete mode 100644 vendor/built_in_modules/blog/config/environments/development.rb delete mode 100644 vendor/built_in_modules/blog/config/environments/production.rb delete mode 100644 vendor/built_in_modules/blog/config/environments/test.rb delete mode 100644 vendor/built_in_modules/blog/config/initializers/secret_token.rb delete mode 100644 vendor/built_in_modules/blog/config/initializers/session_store.rb delete mode 100644 vendor/built_in_modules/blog/config/locales/en.yml delete mode 100644 vendor/built_in_modules/blog/config/locales/zh_tw.yml delete mode 100644 vendor/built_in_modules/blog/config/mongoid.yml delete mode 100644 vendor/built_in_modules/blog/config/routes.rb delete mode 100644 vendor/built_in_modules/blog/db/seeds.rb delete mode 100644 vendor/built_in_modules/blog/doc/README_FOR_APP delete mode 100644 vendor/built_in_modules/blog/public/images/rails.png delete mode 100644 vendor/built_in_modules/blog/public/index.html delete mode 100644 vendor/built_in_modules/blog/public/javascripts/application.js delete mode 100644 vendor/built_in_modules/blog/public/javascripts/controls.js delete mode 100644 vendor/built_in_modules/blog/public/javascripts/dragdrop.js delete mode 100644 vendor/built_in_modules/blog/public/javascripts/effects.js delete mode 100644 vendor/built_in_modules/blog/public/javascripts/prototype.js delete mode 100644 vendor/built_in_modules/blog/public/javascripts/rails.js delete mode 100644 vendor/built_in_modules/blog/public/robots.txt delete mode 100644 vendor/built_in_modules/blog/test/performance/browsing_test.rb delete mode 100644 vendor/built_in_modules/blog/test/test_helper.rb delete mode 100755 vendor/plugins/NewBlog/NewBlog.json delete mode 100644 vendor/plugins/NewBlog/app/controllers/application_controller.rb delete mode 100644 vendor/plugins/NewBlog/app/controllers/panel/blog/comments_controller.rb delete mode 100644 vendor/plugins/NewBlog/app/controllers/panel/blog/posts_controller.rb delete mode 100644 vendor/plugins/NewBlog/app/models/comment.rb delete mode 100644 vendor/plugins/NewBlog/app/models/post.rb delete mode 100644 vendor/plugins/NewBlog/app/views/layouts/application.html.erb delete mode 100644 vendor/plugins/NewBlog/app/views/panel/blog/posts/_form.html.erb delete mode 100644 vendor/plugins/NewBlog/app/views/panel/blog/posts/edit.html.erb delete mode 100644 vendor/plugins/NewBlog/config/locales/zh_tw.yml delete mode 100644 vendor/plugins/NewBlog/config/routes.rb delete mode 100644 vendor/plugins/NewBlog/test/dummy/app/helpers/application_helper.rb delete mode 100644 vendor/plugins/NewBlog/test/dummy/config/initializers/backtrace_silencers.rb delete mode 100644 vendor/plugins/NewBlog/test/dummy/config/initializers/inflections.rb delete mode 100644 vendor/plugins/NewBlog/test/dummy/config/initializers/mime_types.rb delete mode 100644 vendor/plugins/NewBlog/test/dummy/lib/assets/.gitkeep delete mode 100644 vendor/plugins/NewBlog/test/dummy/log/.gitkeep delete mode 100644 vendor/plugins/NewBlog/test/dummy/public/404.html delete mode 100644 vendor/plugins/NewBlog/test/dummy/public/422.html delete mode 100644 vendor/plugins/NewBlog/test/dummy/public/500.html delete mode 100644 vendor/plugins/NewBlog/test/dummy/public/favicon.ico delete mode 100755 vendor/plugins/NewBlog/test/dummy/script/rails delete mode 100644 vendor/plugins/radius/.gitignore delete mode 100644 vendor/plugins/radius/CHANGELOG delete mode 100644 vendor/plugins/radius/LICENSE delete mode 100644 vendor/plugins/radius/QUICKSTART.rdoc delete mode 100644 vendor/plugins/radius/README.rdoc delete mode 100644 vendor/plugins/radius/Rakefile delete mode 100644 vendor/plugins/radius/VERSION delete mode 100644 vendor/plugins/radius/lib/radius.rb delete mode 100644 vendor/plugins/radius/lib/radius/context.rb delete mode 100644 vendor/plugins/radius/lib/radius/delegating_open_struct.rb delete mode 100644 vendor/plugins/radius/lib/radius/error.rb delete mode 100644 vendor/plugins/radius/lib/radius/ord_string.rb delete mode 100644 vendor/plugins/radius/lib/radius/parse_tag.rb delete mode 100644 vendor/plugins/radius/lib/radius/parser.rb delete mode 100644 vendor/plugins/radius/lib/radius/parser/JavaScanner$Flavor.class delete mode 100644 vendor/plugins/radius/lib/radius/parser/JavaScanner$Tag.class delete mode 100644 vendor/plugins/radius/lib/radius/parser/JavaScanner.class delete mode 100644 vendor/plugins/radius/lib/radius/parser/JavaScanner.java delete mode 100644 vendor/plugins/radius/lib/radius/parser/JavaScanner.rl delete mode 100644 vendor/plugins/radius/lib/radius/parser/java_scanner.jar delete mode 100644 vendor/plugins/radius/lib/radius/parser/scanner.rb delete mode 100644 vendor/plugins/radius/lib/radius/parser/scanner.rl delete mode 100644 vendor/plugins/radius/lib/radius/parser/squiggle_scanner.rb delete mode 100644 vendor/plugins/radius/lib/radius/parser/squiggle_scanner.rl delete mode 100644 vendor/plugins/radius/lib/radius/tag_binding.rb delete mode 100644 vendor/plugins/radius/lib/radius/tag_definitions.rb delete mode 100644 vendor/plugins/radius/lib/radius/utility.rb delete mode 100644 vendor/plugins/radius/lib/radius/version.rb delete mode 100644 vendor/plugins/radius/radius.gemspec delete mode 100644 vendor/plugins/radius/tasks/jeweler.rake delete mode 100644 vendor/plugins/radius/tasks/rdoc.rake delete mode 100644 vendor/plugins/radius/tasks/rubinius.rake delete mode 100644 vendor/plugins/radius/tasks/scan.rake delete mode 100644 vendor/plugins/radius/tasks/test.rake delete mode 100644 vendor/plugins/radius/test/benchmarks.rb delete mode 100644 vendor/plugins/radius/test/context_test.rb delete mode 100644 vendor/plugins/radius/test/multithreaded_test.rb delete mode 100644 vendor/plugins/radius/test/ord_string_test.rb delete mode 100644 vendor/plugins/radius/test/parser_test.rb delete mode 100644 vendor/plugins/radius/test/quickstart_test.rb delete mode 100644 vendor/plugins/radius/test/squiggle_test.rb delete mode 100644 vendor/plugins/radius/test/test_helper.rb delete mode 100644 vendor/plugins/radius/test/utility_test.rb delete mode 100644 vendor/templates/sunrise/stylesheets/sunrise.css diff --git a/.rspec b/.rspec index 53607ea5..61f260b7 100644 --- a/.rspec +++ b/.rspec @@ -1 +1,2 @@ --colour +--drb diff --git a/.rvmrc b/.rvmrc deleted file mode 100644 index 15cdbf2b..00000000 --- a/.rvmrc +++ /dev/null @@ -1 +0,0 @@ -rvm use ruby-1.9.2-p290@orbit diff --git a/Gemfile b/Gemfile index 2732e123..4fe1340a 100644 --- a/Gemfile +++ b/Gemfile @@ -10,13 +10,15 @@ gem 'mini_magick' gem 'rubyzip' gem 'sinatra' gem 'execjs' -gem 'mongoid' +gem 'mongoid', :git => 'git://github.com/mongoid/mongoid.git', :ref => '7a915395db50e2bc6071a503a11530e644879e49' gem 'rake' gem 'jquery-rails' gem 'sprockets' +gem 'radius' + # For linux gem 'therubyracer' @@ -33,6 +35,8 @@ end gem 'ruby-debug19' group :test, :development do + gem 'spork' + gem 'database_cleaner' #Strategies for cleaning databases. Can be used to ensure a clean state for testing. gem "rspec", "~> 2.0" gem "rspec-rails", "~> 2.0" gem "factory_girl_rails" @@ -40,6 +44,7 @@ group :test, :development do gem "rcov" gem "delorean" gem "watchr" + gem "spork" # gem "capybara" # gem 'yard' # gem "bluecloth" diff --git a/Gemfile.lock b/Gemfile.lock index 6c1a1ae3..fcf8f0b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,13 @@ +GIT + remote: git://github.com/mongoid/mongoid.git + revision: 7a915395db50e2bc6071a503a11530e644879e49 + ref: 7a915395db50e2bc6071a503a11530e644879e49 + specs: + mongoid (2.4.0) + activemodel (~> 3.1) + mongo (~> 1.3) + tzinfo (~> 0.3.22) + GEM remote: http://rubygems.org/ specs: @@ -32,8 +42,9 @@ GEM archive-tar-minitar (0.5.2) arel (2.2.1) bcrypt-ruby (3.0.1) - bson (1.5.1) - bson_ext (1.5.1) + bson (1.5.2) + bson_ext (1.5.2) + bson (= 1.5.2) builder (3.0.0) carrierwave (0.5.4) activesupport (~> 3.0) @@ -49,6 +60,7 @@ GEM execjs coffee-script-source (1.1.3) columnize (0.3.5) + database_cleaner (0.7.0) delorean (1.1.1) chronic devise (1.5.2) @@ -80,12 +92,8 @@ GEM mime-types (1.17.2) mini_magick (3.3) subexec (~> 0.1.0) - mongo (1.5.1) - bson (= 1.5.1) - mongoid (2.3.4) - activemodel (~> 3.1) - mongo (~> 1.3) - tzinfo (~> 0.3.22) + mongo (1.5.2) + bson (= 1.5.2) multi_json (1.0.4) orm_adapter (0.0.5) polyglot (0.3.3) @@ -100,6 +108,7 @@ GEM rack rack-test (0.6.1) rack (>= 1.0) + radius (0.7.1) rails (3.1.3) actionmailer (= 3.1.3) actionpack (= 3.1.3) @@ -154,6 +163,7 @@ GEM rack (~> 1.3, >= 1.3.4) rack-protection (~> 1.1, >= 1.1.2) tilt (~> 1.3, >= 1.3.3) + spork (0.8.5) sprockets (2.0.3) hike (~> 1.2) rack (~> 1.0) @@ -183,13 +193,15 @@ DEPENDENCIES carrierwave (= 0.5.4) ckeditor coffee-rails + database_cleaner delorean devise execjs factory_girl_rails jquery-rails mini_magick - mongoid + mongoid! + radius rails rake rcov @@ -200,6 +212,7 @@ DEPENDENCIES sass-rails shoulda-matchers sinatra + spork sprockets therubyracer uglifier diff --git a/app/assets/javascripts/attribute_form.js.erb b/app/assets/javascripts/attribute_form.js.erb new file mode 100644 index 00000000..9c2b9099 --- /dev/null +++ b/app/assets/javascripts/attribute_form.js.erb @@ -0,0 +1,25 @@ +$('.attributes_block a.delete').live('click', function(){ + $(this).parents('.list_item').remove(); +}); + +$('.action a.remove_existing_record').live('click', function(){ + $(this).next('.should_destroy').attr('value', 1); + $("#attribute_" + $(this).prev().attr('value')).hide(); +}); + +$('.action a.switch').live('click', function(){ + $(this).parent().toggleClass('disable'); + var $am = $(this).next('.built_in_state') + $am.attr('value', ($am.attr('value') == "false") ? "true" : "false"); +}); + +$('.select_type select').live('change', function(){ + if(this.value == 'select') + { + $(this).next().show(); + } + else + { + $(this).next().hide(); + } +}); \ No newline at end of file diff --git a/app/assets/javascripts/page_edit.js b/app/assets/javascripts/page_edit.js index 71c4ef59..50e974b4 100644 --- a/app/assets/javascripts/page_edit.js +++ b/app/assets/javascripts/page_edit.js @@ -1,4 +1,21 @@ -$("div.editable").live("mouseenter mouseleave", - function (event) { - $(this).children('.edit_link').toggle(); - }); \ No newline at end of file +$("div.editable").live("mouseenter mouseleave", function (event) { + $(this).children('.edit_link').toggle(); +}); + +$("#page_design_id").live('change', function() { + $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes'); +}); + +$("#page_module_app").live('change', function() { + var app_id = $(this).val(); + if(app_id!=''){ + $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_frontend_pages',function(data, textStatus){ + if(textStatus == 'success'){ + $(this).after(data); + } + }); + } + else{ + $("#app_page_url").remove(); + } +}); diff --git a/app/assets/javascripts/rss.js b/app/assets/javascripts/rss.js new file mode 100644 index 00000000..36309900 --- /dev/null +++ b/app/assets/javascripts/rss.js @@ -0,0 +1,513 @@ +//Created by Harry Bomrah on Sep 21 2011 +$rss = jQuery.noConflict(); +var rcom={ +//Pass dom and will return binded dom with starting year till current +insertDatePanel : function(dom,year){ + if(!year)year=1901; + if(dom=="")return false; + domid=dom.attr("id"); + var dt = new Date(); + current_year=dt.getFullYear(); + var dthtml="Year: Date: Month: "; + dom.html(dthtml); +}, + +//loading overlay around a dom... +loadingWrapper : function(dom, display){ + if(display){ + dom.prepend("
"); + $rss("#loading_wrapper").height(dom.height()); + $rss("#loading_wrapper").width(dom.width()); + }else{ + domId=dom.attr("id"); + $rss("#"+domId+" #loading_wrapper").remove(); + } + }, + +//validating a dom.... +validate : function(dom, validation, errormsg){ + var domValue = dom.val(); + var error = false; + var regex=""; + var msg = ""; + switch(validation){ + case "required": + if(domValue=="")error=true; + msg="Cannot be empty."; + break; + case "email": + regex=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; + msg="Invalid Email Address."; + break; + case "number": + regex=/^\d*[0-9](|.\d*[0-9]|,\d*[0-9])?$/; + msg = "Only numbers are accepted."; + break; + case "alphanumeric": + regex=/^\s*[a-zA-Z0-9,\s]+\s*$/; + msg="Only numbers, alphabets and spaces are allowed."; + break; + } + domId=dom.attr("name"); + if(errormsg=="")errormsg=msg; + if(regex!="")if(!regex.test(domValue))error=true; + if(error){$rss("#"+domId+"_error").remove();dom.after(""+errormsg+"");return false;} else{ $rss("#"+domId+"_error").remove();return true;} + }, + +bindToSpinner : function(dom,data,callbackFn){ + var domId = dom.attr("id"); + var dhtml=""; + var spinnerValue=Array(); + var spinnerDisplay=Array(); + $rss.each(data,function(i,it){ + $rss.each(data[i],function(key,it){ + spinnerValue.push(it); + }); + }); + dhtml=""; + dom.html(dhtml); + if(typeof callbackFn=="function") + callbackFn.call(this, dhtml); + }, + + //binds the recieved json to a table +bindToTable : function(dom,data,headers,actions,css_class,callbackFn){ + if(!css_class)css_class=""; + var dhtml=""; + var domId = dom.attr("id"); + if(actions){ + var btnTitles=Array(); + var btnFunctions=Array(); + $rss.each(actions,function(title,func){ + btnTitles.push(title); + btnFunctions.push(func); + }); + rcom.translate(btnTitles,function(convertedData){ + btnTitles=convertedData.slice(); + + rcom.translate(headers,function(convertedData){ + headers=convertedData; + if(!data)return; + $rss.each(headers,function(i,head){ + dhtml+=""; + }); + dhtml+=""; + if(data.length==0)dhtml+=""; + $rss.each(data,function(i,item){ + var cl=""; + if(i%2!=0)cl="even"; + dhtml+=""; + $rss.each(item,function(i,it){ + if(i!="id"){ + if(it==null)it="Not Set"; + dhtml+=""; + } + }) + dhtml+=""; + dhtml+=""; + }); + dhtml+="
"+head+"
No Data
"+it+""; + for(x=0;x"+btnTitles[x]+""; + } + dhtml+="
"; + dom.html(dhtml); + }); + }); + }else{ + rcom.translate(headers,function(convertedData){ + headers=convertedData; + if(!data)return; + if(headers.length>0){ + $rss.each(headers,function(i,head){ + dhtml+=""+head+""; + }); + } + dhtml+=""; + if(data.length==0)dhtml+="No Data"; + + $rss.each(data,function(i,item){ + var cl=""; + if(i%2!=0)cl="even"; + dhtml+=""; + $rss.each(item,function(i,it){ + if(i!="id"){ + if(it==null)it="Not Set"; + dhtml+=""+it+""; + } + }) + dhtml+=""; + }); + dhtml+=""; + dom.html(dhtml); + }); + } + + if(typeof callbackFn=="function") + callbackFn.call(this, dhtml); +}, + //convert to date string which can be directly inserted in database or according to any format. +convertToInsertableDate : function(y,m,d,format){ + var dt=""; + if(m<10)m="0"+m; + if(d<10)d="0"+d; + switch(format){ + case "yyyy-mm-dd": + dt= y+"-"+m+"-"+d; + break; + case "dd-mm-yyyy": + dt= d+"-"+m+"-"+y; + break; + case "mm-dd-yyyy": + dt= m+"-"+d+"-"+y; + break; + default: + dt= y+"-"+m+"-"+d; + break; + } + return dt; + }, +//a fucntion to show specific divs and hide all other +showDoms : function(doms){ + $rss("body").find("div").each(function(){$rss(this).hide();}); + $rss.each(doms,function(i,dom){ + dom.show(); + }); + }, + +//a function to translate the word or array.. +translate : function(data,callbackFn){ + var cdata=""; + var status =true; + if(!data){ + if(typeof callbackFn=="function") + callbackFn.call(this,cdata); + status=false; + } + if(data==""){ + if(typeof callbackFn=="function") + callbackFn.call(this,cdata); + status=false; + } + if(status){ + $rss.getJSON("../../classes/translate.php", {fn:"translateThis",tData:data},function(convertedData){ + if(typeof callbackFn=="function") + callbackFn.call(this, convertedData); + }); + } + }, + +// a function to bind JSON to list +bindToList : function(dom,data,callbackFn){ + var domId = dom.attr("id"); + var dhtml=""; + var listValue=Array(); + var listDisplay=Array(); + $rss.each(data,function(i,it){ + $rss.each(data[i],function(key,it){ + listValue.push(it); + }); + }); + dhtml=""; + dom.html(dhtml); + if(typeof callbackFn=="function") + callbackFn.call(this,dhtml); + }, +makeDraggable : function(handler,dom){ + handler.css("position","absolute"); + dom.css("position","absolute"); + var puranix=0; + var nayeex=0; + var puraniy=0; + var nayeey=0; + var offset=""; + var zIndex=dom.css("z-index"); + handler.mousedown(function(e){ + puranix=e.clientX; + puraniy=e.clientY; + offset=dom.offset(); + $rss(this).mousemove(function(e){ + nayeex=e.clientX-puranix; + nayeex+=offset.left; + nayeey=e.clientY-puraniy; + nayeey+=offset.top; + dom.css({"left":nayeex+"px","top":nayeey+"px","z-index":"9999"}); + }) + }).mouseup(function(){ + $rss(this).unbind("mousemove"); + dom.css("z-index",zIndex); + }) + }, + +//automatically scrolls to the bottom of the div +scrollToBottom : function(dom){ + var domId = dom.attr("id"); +// var domScrollHeight = document.getElementById(domId).scrollHeight; + var obj = document.getElementById(domId); + + if((obj.scrollTop+100) >= (obj.scrollHeight - obj.offsetHeight)) + dom.scrollTop(obj.scrollHeight); + }, + +/*ajax loading of images... needs following settings +dom:in which images ve to be loaded +url:the server url for making ajax calls +limit:how many images to load +divClass:the class of div surrounding each image +nameClass:class for span showing name +fn:function to be called in on the server +imageSrc:the image source of all the images. +bindTo:to bind images to a onclick function or else will be binded to normal a tag. +urlKey:to specify the key of the value.. if bindTo is used, this will be neglected.. +returns json; +*/ +loadImages : function(settings,callbackFn){ + + var dom = settings.dom; + var domid= dom.attr("id"); + var temp_array=Array(); + var starting = $rss("#"+domid+" img:last").attr("id"); + if(typeof starting != 'undefined'){ + starting = starting.substr(4,starting.length-1); + }else{starting = 0}; + var temp_var=""; + var json = ""; + var dhtml=""; + var extraparam=""; + if(typeof settings.extraParam != "undefined"){ + extraparam = settings.extraParam; + } + $rss.getJSON(settings.url,{fn:settings.fn,id:settings.whereId,limit:settings.limit,start:starting,extra:extraparam},function(images){ + json = eval(images); + $rss.each(images,function(i,pic){ + var temp_array=Array(); + var a_var=Array(); + var name_var=""; + var title=""; + $rss.each(pic,function(i,value){ + temp_array.push(value); + }) + if(temp_array.length>=4){ + name_var=""+temp_array[3]+"" + } + if(temp_array[2]==null) + title = ""; + else + title = temp_array[2]; + if(typeof settings.bindTo!="undefined"){ + a_var[1]="onclick='"+settings.bindTo+"("+temp_array[0]+");return false;'"; + a_var[0]=""; + }else{a_var[0]='?'+settings.urlKey+'='+temp_array[0];a_var[1]="";} + dhtml="
"+name_var; + dom.delay(100).append(dhtml); + $rss("#pic_"+pic.id).delay(100).fadeIn(200); + + }) + if(typeof callbackFn=="function") + callbackFn.call(this,json); + }) + + + }, + +//function to get url variables... +getUrlVars : function(){ + var vars = [], hash; + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); + for(var i = 0; i < hashes.length; i++){ + hash = hashes[i].split('='); + vars.push(hash[0]); + vars[hash[0]] = hash[1]; + } + return vars; +}, +/*function to open a modalwindow on a page.. self reliant no images, no css needed. +settings + +width:in percentage or pixcel +height:in percentage or pixcel +closeBtn:true or false +envClose:closing through background click, true or flase +loadDiv:load html from a div +loadPage:load a page +loadHtml: load html + +*/ +modalWindow : function(settings,callbackFn){ + + var envClose = settings.envClose; + var dhtml=""; + if(typeof envClose == "undefined") + envClose = true; + var closeBtn = settings.closeBtn; + if(typeof closeBtn == "undefined") + closeBtn = true; + + var rgmaskHeight = $rss(window).height(); + var rgmaskWidth = $rss(window).width(); + var tempheight = settings.height; + var tempwidth = settings.width; + + if(typeof tempheight!="undefined"){ + if(tempheight.charAt(tempheight.length-1)=='%') + tempheight=(rgmaskHeight*parseInt(tempheight.substr(0,tempheight.length)))/100; + }else{tempheight="auto";} + + if(typeof tempwidth!="undefined"){ + if(tempwidth.charAt(tempwidth.length-1)=='%') + tempwidth=(rgmaskWidth*parseInt(tempwidth.substr(0,tempwidth.length)))/100; + }else{tempwidth="auto";} + + $rss("body").append('
'); + $rss("#rgsheath").css({background: "#000", width: "100%", position: "fixed", top: 0, left: 0,opacity:0.9,'z-index':199}); + $rss("body").append('
'); + $rss("#rgWindow").css({"position": "fixed", "z-index": "999", "background": "#fff", "border": "solid 3px #ccc", "padding": "20px", "overflow": "hidden", "border-radius": "12px", "-webkit-border-radius": "12px", "-moz-border-radius": "12px", "-ms-border-radius": "12px", "box-shadow": "0 0 20px rgba(0,0,0,0.9)","-webkit-box-shadow": "0 0 20px rgba(0,0,0,0.9)","-moz-box-shadow": "0 0 20px rgba(0,0,0,0.9)","-ms-box-shadow": "0 0 20px rgba(0,0,0,0.9)"}); + var rgWTop = (rgmaskHeight-20)/2; + var rgWLeft = (rgmaskWidth-20)/2; + $rss("#rgWindow").css({top:rgWTop+"px", left:rgWLeft+"px"}); + if(typeof settings.loadDiv!="undefined"){ + dhtml = $rss("#"+settings.loadDiv).html(); + $rss("#rgWindow").html(dhtml).hide(); + prepareWindow(); + } + if(typeof settings.loadHtml!="undefined"){ + dhtml = settings.loadHtml; + $rss("#rgWindow").html(dhtml).hide(); + prepareWindow(); + } + if(typeof settings.loadPage!="undefined"){ + $rss("#rgWindow").load(settings.loadPage,function(){$rss(this).hide();dhtml=$rss(this).html();prepareWindow();}); + } + function prepareWindow(){ + if(tempheight!="auto") + rgWTop = (rgmaskHeight-tempheight)/2; + else{ + tempheight=$rss("#rgWindow").height(); + rgWTop=(rgmaskHeight-tempheight)/2; + } + if(tempwidth!="auto") + rgWLeft = (rgmaskWidth-tempwidth)/2; + else{ + tempwidth=$rss("#rgWindow").width(); + rgWLeft=(rgmaskWidth-tempwidth)/2; + } + $rss("#rgWindow").empty().show(); + var closebtn = ""; + if(closeBtn) + closebtn='X'; + $rss("#rgWindow").animate({"width":tempwidth+"px","height":tempheight+"px",top:rgWTop+"px", left:rgWLeft+"px"},500,function(){$rss("#rgWindow").html(closebtn+"
"+dhtml+"
"); + $rss("#close_modal").mouseover(function(){$rss(this).css("color","#999");}).mouseout(function(){$rss(this).css("color","#666");}) + $rss("#close_modal").click(function(){ + $rss("#rgWindow").empty(); + var x = (rgmaskHeight-20)/2; + var y = (rgmaskWidth-20)/2; + $rss("#rgWindow").animate({top:x+"px", left:y+"px","width":"50px","height":"50px"},300,function(){$rss(this).fadeOut(100).remove();$rss("#rgsheath").fadeOut(500).remove();}); + return false; + }) + if(envClose) + $rss("#rgsheath").click(function(){ + $rss("#rgWindow").empty(); + var x = (rgmaskHeight-20)/2; + var y = (rgmaskWidth-20)/2; + $rss("#rgWindow").animate({top:x+"px", left:y+"px","width":"50px","height":"50px"},300,function(){$rss(this).fadeOut(100).remove();$rss("#rgsheath").fadeOut(500).remove();});}) + + if(typeof callbackFn=="function") + callbackFn.call(this,dhtml); + }); + } +}, +modalWindowClose : function(callbackFn){ + if($rss("#rgWindow").length>0){ + $rss("#rgWindow").empty(); + var rgmaskHeight = $rss(window).height(); + var rgmaskWidth = $rss(window).width(); + var x = (rgmaskHeight-20)/2; + var y = (rgmaskWidth-20)/2 + $rss("#rgWindow").animate({top:x+"px", left:y+"px","width":"50px","height":"50px"},300,function(){$rss(this).fadeOut(100).remove();$rss("#rgsheath").fadeOut(500).remove();}) + } + if(typeof callbackFn=="function") + callbackFn.call(this,"harry"); +}, +bindDomToHead : function(dom){ + var gc = dom.css("background"); + var t = dom.offset(); + var gw = dom.width(); + $rss(window).scroll(function(){ + var wt = $rss(window).scrollTop(); + if ( wt > t.top ) { + var cssObj = { + 'position':'fixed', + 'top':0, + 'width':gw, + 'background':gc, + 'box-shadow':'0 1px 0 rgba(0,0,0,0.2)', + 'z-index':99 + } + dom.css(cssObj); + } else { + dom.attr('style',""); + } + }); +}, +progressBar : function(dom,settings){ + var domid = dom.prop("id"); + if($rss("#rss_progressbar_div_"+domid).length==0){ + if(typeof settings.top == "undefined") + settings.value = 1; + if(typeof settings.top == "undefined") + settings.top = (dom.height()-12)/2; + dom.append(""); + $rss("#rss_progressbar_div_"+domid).fadeIn(500); + } +}, +progressBarValue : function(dom,value){ + var domid = dom.prop("id"); + if($rss("#rss_progressbar_div_"+domid).length==1){ + $rss("#rss_progressbar_"+domid).animate({"width":value+"%"},100); + + } +}, +progressBarClose : function(dom){ + var domid = dom.prop("id"); + $rss("#rss_progressbar_div_"+domid).fadeOut(500,function(){$(this).remove();}); +}, +getInternetExplorerVersion: function(){ + var rv = -1; // Return value assumes failure. + if (navigator.appName == 'Microsoft Internet Explorer') + { + var ua = navigator.userAgent; + var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); + if (re.exec(ua) != null) + rv = parseFloat( RegExp.$1 ); + } + return rv; + } +} +$ = jQuery.noConflict(); \ No newline at end of file diff --git a/app/assets/javascripts/site_editor.js b/app/assets/javascripts/site_editor.js index 835884d0..98405564 100644 --- a/app/assets/javascripts/site_editor.js +++ b/app/assets/javascripts/site_editor.js @@ -6,4 +6,5 @@ // //= require jquery //= require jquery_ujs +//= require page_edit //= require side_bar_history \ No newline at end of file diff --git a/app/assets/javascripts/user_attribute_form.js b/app/assets/javascripts/user_attribute_form.js deleted file mode 100644 index 3af8dc01..00000000 --- a/app/assets/javascripts/user_attribute_form.js +++ /dev/null @@ -1,10 +0,0 @@ -var new_one = $('fieldset #new_one').clone(); -$('fieldset #new_one').remove(); - -$('fieldset a.remove').live( "click", function(){ - $(this).parent().remove(); -}); - -$('fieldset a.add').click(function(){ - new_one.clone().appendTo( $('fieldset') ); -}) \ No newline at end of file diff --git a/app/assets/javascripts/user_attribute_model_form.js b/app/assets/javascripts/user_attribute_model_form.js deleted file mode 100644 index 1e1e2ef5..00000000 --- a/app/assets/javascripts/user_attribute_model_form.js +++ /dev/null @@ -1,33 +0,0 @@ -$('#attributes_block a.delete').live('click', function(){ - $(this).parent().parent().parent().remove(); -}); - -$('#attributes_block a.add').click(function(){ - $('#attributes').append("<%= escape_javascript(render(:partial => 'admin/user_attribute_models/attribute_model', :object => @user_attribute_model.attribute_models.build)) %>"); -}); - -$('#attributes_block a.remove_existing_record').click(function(){ - $(this).next('.should_destroy').attr('value', 1); - $(this).parent().parent().hide(); -}); - -$('#attributes_block a.change_built_in').click(function(){ - $(this).parent().toggleClass('disable'); - var $am = $(this).next('.built_in_state') - $am.attr('value', ($am.attr('value') == "false") ? "true" : "false"); -}); - -$('.select_mulitlingual input').live('click', function(){ - $(this).next().attr('value', this.checked); -}); - -$('.select_type select').live('change', function(){ - if(this.value == 'select') - { - $(this).next().show(); - } - else - { - $(this).next().hide(); - } -}); \ No newline at end of file diff --git a/app/assets/javascripts/user_form.js b/app/assets/javascripts/user_form.js index 21a4b454..183d8270 100644 --- a/app/assets/javascripts/user_form.js +++ b/app/assets/javascripts/user_form.js @@ -1,6 +1,10 @@ $(document).ready(function(){ - $('#user_active_role').change(function(){ - $('#role_models .roles_block').hide(); + $('#user_role_id').change(function(){ + $('#roles .attributes_block').hide(); $('#'+this.value+'_block').toggle(); }); + + $('.sub_role_select').change(function(){ + $('#sub_role_' + this.value).toggle(); + }); }); \ No newline at end of file diff --git a/app/assets/stylesheets/admin_back_end.css.erb b/app/assets/stylesheets/admin_back_end.css.erb index a350fc21..f5ba3ccc 100644 --- a/app/assets/stylesheets/admin_back_end.css.erb +++ b/app/assets/stylesheets/admin_back_end.css.erb @@ -224,7 +224,7 @@ body{ .main_list ul { clear:both; } -#porfile { +#profile { padding-top: 100px; } /*add_buttom*/ diff --git a/vendor/built_in_modules/blog/lib/tasks/.gitkeep b/app/assets/stylesheets/feile.css.erb similarity index 100% rename from vendor/built_in_modules/blog/lib/tasks/.gitkeep rename to app/assets/stylesheets/feile.css.erb diff --git a/app/controllers/admin/app_auths_controller.rb b/app/controllers/admin/app_auths_controller.rb new file mode 100644 index 00000000..6f3f1c3d --- /dev/null +++ b/app/controllers/admin/app_auths_controller.rb @@ -0,0 +1,17 @@ +class Admin::AppAuthsController < ApplicationController + layout "admin" + before_filter :authenticate_user! + before_filter :is_admin? + + def index + @user_roles = UserRole.all.entries + apps = Purchase.where(:type =>"App") + @app_auth_data = apps.entries.map do |app| + app_c = eval(app.app_controller) + obj = app_c.new + obj_auth = obj.send "auth" + [:app_obj => app,:auth_field => obj_auth] + end + end + +end \ No newline at end of file diff --git a/app/controllers/admin/infos_controller.rb b/app/controllers/admin/infos_controller.rb new file mode 100644 index 00000000..bc86b662 --- /dev/null +++ b/app/controllers/admin/infos_controller.rb @@ -0,0 +1,63 @@ +class Admin::InfosController < ApplicationController + + layout "admin" + before_filter :authenticate_user! + before_filter :is_admin? + before_filter :set_attribute, :only => [:index, :show, :new, :edit] + + def index + @attributes = Info.all.entries + render :template => 'admin/attributes/index' + end + + def show + + end + + def new + @attribute = Info.new + render :template => 'admin/attributes/new' + end + + def edit + @attribute = Info.find(params[:id]) + @i18n_variable = @attribute.i18n_variable + render :template => 'admin/attributes/edit' + end + + def create + @attribute = Info.new(params[:info]) + @attribute.save + redirect_to :action => :index + end + + def update + @attribute = Info.find(params[:id]) + @attribute.update_attributes(params[:info]) + respond_to do |format| + format.html { redirect_to :action => :index } + format.js { render 'admin/attributes/toggle_enable' } + end + end + + def destroy + @attribute = Info.find(params[:id]) + @attribute.destroy + redirect_to :action => :index + end + + def add_attribute_field + @attribute = Info.find(params[:id]) rescue nil + if !@attribute + @attribute = Info.new + end + end + + protected + + def set_attribute + @attribute_type = 'info' + @class = 'infos' + end + +end diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb new file mode 100644 index 00000000..55be4135 --- /dev/null +++ b/app/controllers/admin/module_apps_controller.rb @@ -0,0 +1,9 @@ +class Admin::ModuleAppsController < ApplicationController + +def reload_frontend_pages + @module_app = ModuleApp.find(params[:id]) + respond_to do |format| + format.js {} + end +end +end \ No newline at end of file diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 224113c3..23f58444 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -19,6 +19,7 @@ class Admin::PagesController < ApplicationController def new @item = Page.new + @apps = ModuleApp.all @item.is_published = true @item.parent_id = @parent_item.id rescue nil @designs = Design.all.entries @@ -27,6 +28,7 @@ class Admin::PagesController < ApplicationController def edit @item = Page.find(params[:id]) + @apps = ModuleApp.all @i18n_variable = @item.i18n_variable @designs = Design.all.entries @design = @item.design diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb new file mode 100644 index 00000000..65c86f36 --- /dev/null +++ b/app/controllers/admin/roles_controller.rb @@ -0,0 +1,56 @@ +class Admin::RolesController < ApplicationController + + layout "admin" + before_filter :authenticate_user! + before_filter :is_admin? + before_filter :set_attribute, :only => [:index, :show, :new, :edit] + + def index + @attributes = Role.all.entries + render :template => 'admin/attributes/index' + end + + def show + + end + + def new + @attribute = Role.new + render :template => 'admin/attributes/new' + end + + def edit + @attribute = Role.find(params[:id]) + @i18n_variable = @attribute.i18n_variable + render :template => 'admin/attributes/edit' + end + + def create + @attribute = Role.new(params[:role]) + @attribute.save + redirect_to :action => :index + end + + def update + @attribute = Role.find(params[:id]) + @attribute.update_attributes(params[:role]) + respond_to do |format| + format.html { redirect_to :action => :index } + format.js { render 'admin/attributes/toggle_enable' } + end + end + + def destroy + @attribute = Role.find(params[:id]) + @attribute.destroy + redirect_to :action => :index + end + + protected + + def set_attribute + @attribute_type = 'role' + @class = 'roles' + end + +end diff --git a/app/controllers/admin/translations_controller.rb b/app/controllers/admin/translations_controller.rb index 590ad556..54da8762 100644 --- a/app/controllers/admin/translations_controller.rb +++ b/app/controllers/admin/translations_controller.rb @@ -68,11 +68,11 @@ class Admin::TranslationsController < ApplicationController result << var if var.document_class.eql?('language') result end - @user_role_model_i18n_variables = @i18n_variables.inject([]) do |result, var| - result << var if var.document_class.eql?('UserRoleModel') + @role_i18n_variables = @i18n_variables.inject([]) do |result, var| + result << var if var.document_class.eql?('Role') result end - @user_info_model_i18n_variables = @i18n_variables.inject([]) do |result, var| + @info_i18n_variables = @i18n_variables.inject([]) do |result, var| result << var if var.document_class.eql?('UserInfoModel') result end diff --git a/app/controllers/admin/user_attributes_controller.rb b/app/controllers/admin/user_attributes_controller.rb deleted file mode 100644 index c7021c74..00000000 --- a/app/controllers/admin/user_attributes_controller.rb +++ /dev/null @@ -1,43 +0,0 @@ -class Admin::UserAttributesController < ApplicationController - - layout "admin" - before_filter :authenticate_user! - - def index - @user_attributes = UserAttribute.all - end - - def show - @user_attribute = UserAttribute.find(params[:id]) - end - - def new - @user_attribute = UserAttribute.new - end - - def edit - @user_attribute = UserAttribute.find(params[:id]) - end - - def create - @user_attribute = UserAttribute.new(params[:user_attribute]) - @user_attribute.save - - redirect_to :action => :index - end - - def update - @user_attribute = UserAttribute.find(params[:id]) - @user_attribute.update_attributes(params[:user_attribute]) - - redirect_to :action => :index - end - - def destroy - @user_attribute = UserAttribute.find(params[:id]) - @user_attribute.destroy - - redirect_to :action => :index - end - -end diff --git a/app/controllers/admin/user_info_models_controller.rb b/app/controllers/admin/user_info_models_controller.rb deleted file mode 100644 index 60360463..00000000 --- a/app/controllers/admin/user_info_models_controller.rb +++ /dev/null @@ -1,59 +0,0 @@ -class Admin::UserInfoModelsController < ApplicationController - - layout "admin" - before_filter :authenticate_user! - before_filter :is_admin? - before_filter :set_attribute, :only => [:index, :show, :new, :edit] - - def index - @user_attribute_models = UserInfoModel.all.entries - render :template => 'admin/user_attribute_models/index' - end - - def show - #@user_attribute_model = UserInfoModel.find(params[:id]) - end - - def new - @user_attribute_model = UserInfoModel.new - render :template => 'admin/user_attribute_models/new' - end - - def edit - @user_attribute_model = UserInfoModel.find(params[:id]) - @i18n_variable = @user_attribute_model.i18n_variable - render :template => 'admin/user_attribute_models/edit' - end - - def create - @user_attribute_model = UserInfoModel.new(params[:user_info_model]) - @user_attribute_model.save - redirect_to :action => :index - end - - def update - @user_attribute_model = UserInfoModel.find(params[:id]) - @user_attribute_model.update_attributes(params[:user_info_model]) - respond_to do |format| - format.html { redirect_to :action => :index } - format.js { render 'admin/user_attribute_models/toggle_enable' } - end - end - - def destroy - @user_attribute_model = UserInfoModel.find(params[:id]) - @user_attribute_model.destroy - - @user_attribute_model.destroy_i18n_variables - - redirect_to :action => :index - end - - protected - - def set_attribute - @attribute = 'info' - @class = 'infos' - end - -end diff --git a/app/controllers/admin/user_role_models_controller.rb b/app/controllers/admin/user_role_models_controller.rb deleted file mode 100644 index bfdf5428..00000000 --- a/app/controllers/admin/user_role_models_controller.rb +++ /dev/null @@ -1,60 +0,0 @@ -class Admin::UserRoleModelsController < ApplicationController - - layout "admin" - before_filter :authenticate_user! - before_filter :is_admin? - before_filter :set_attribute, :only => [:index, :show, :new, :edit] - - def index - @user_attribute_models = UserRoleModel.all.entries - render :template => 'admin/user_attribute_models/index' - end - - def show - #@user_attribute_model = UserRoleModel.find(params[:id]) - end - - def new - @user_attribute_model = UserRoleModel.new - render :template => 'admin/user_attribute_models/new' - end - - def edit - @user_attribute_model = UserRoleModel.find(params[:id]) - @i18n_variable = @user_attribute_model.i18n_variable - render :template => 'admin/user_attribute_models/edit' - end - - def create - @user_attribute_model = UserRoleModel.new(params[:user_role_model]) - @user_attribute_model.save - redirect_to :action => :index - end - - def update - @user_attribute_model = UserRoleModel.find(params[:id]) - @user_attribute_model.update_attributes(params[:user_role_model]) - - respond_to do |format| - format.html { redirect_to :action => :index } - format.js { render 'admin/user_attribute_models/toggle_enable' } - end - end - - def destroy - @user_attribute_model = UserRoleModel.find(params[:id]) - @user_attribute_model.destroy - - @user_attribute_model.destroy_i18n_variables - - redirect_to :action => :index - end - - protected - - def set_attribute - @attribute = 'role' - @class = 'roles' - end - -end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 62e957ba..ef44cfc1 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -10,25 +10,18 @@ class Admin::UsersController < ApplicationController def show @user = User.find(params[:id]) - get_info_role_models + get_info_and_roles end def new @user = User.new - get_info_role_models + get_info_and_roles end def create + puts params.to_yaml @user = User.new(params[:user]) if @user.save - @user.user_infos.each do |user_info| - user_info.save - user_info.attribute_values.each(&:save) - end - @user.user_roles.each do |user_role| - user_role.save - user_role.attribute_values.each(&:save) - end flash[:notice] = t('admin.create_success_user') redirect_to :action => :index else @@ -38,7 +31,7 @@ class Admin::UsersController < ApplicationController def edit @user = User.find(params[:id]) - get_info_role_models + get_info_and_roles end def update @@ -55,7 +48,7 @@ class Admin::UsersController < ApplicationController flash[:notice] = t('admin.update_success_user') redirect_to :action => :index else - get_info_role_models + get_info_and_roles render :action => :edit end end @@ -66,10 +59,6 @@ class Admin::UsersController < ApplicationController else @user = User.find(params[:id]) @user.destroy - @user.user_attributes.each do |ua| - ua.attribute_values.each(&:destroy) - ua.destroy - end end redirect_to :action => :index @@ -77,11 +66,11 @@ class Admin::UsersController < ApplicationController protected - def get_info_role_models - @user_info_models = UserInfoModel.excludes('disabled' => true) - @user_role_models = UserRoleModel.excludes('disabled' => true) + def get_info_and_roles + @infos = Info.excludes('disabled' => true) + @roles = Role.excludes('disabled' => true) end - + def set_attribute @class = 'users' end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 68b32238..cc64e130 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,7 @@ class ApplicationController < ActionController::Base protect_from_forgery - include Parser + include ParserFrontEnd, ParserBackEnd helper :all before_filter :set_locale, :set_site @@ -36,9 +36,9 @@ class ApplicationController < ActionController::Base end # Render the page - def render_page + def render_page(url = nil) if @item - render :text => parse_page(@item) + render :text => parse_page(@item,url) else render :text => '404 Not Found' end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 710c7e47..693243c2 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -9,19 +9,28 @@ class PagesController < ApplicationController end end - def show - begin - item = Item.first(:conditions => {:full_name => params[:page_name]}) - case item._type - when 'Page' - @item = item - render_page - when 'Link' - redirect_to "http://#{item[:url]}" - end - rescue - render :file => "#{Rails.root}/public/404.html", :status => :not_found - end + def appfront + + pre_uri = URI.split request.env['HTTP_REFERER'] + pre_item_fullname = pre_uri[5][1..-1] + @item = Item.first(:conditions => {:full_name => pre_item_fullname}) + redirect_to (request.env['HTTP_REFERER'].partition("?")[0]+"?app_url=#{request.fullpath}") + end + def show + begin + item = Item.first(:conditions => {:full_name => params[:page_name]}) + case item._type + when 'Page' + @item = item + render_page ((params[:app_url]+'?inner='+"true" if params[:app_url])) + when 'Link' + redirect_to "http://#{item[:url]}" + end + rescue + render :file => "#{Rails.root}/public/404.html", :status => :not_found + end + end + end diff --git a/app/helpers/admin/user_helper.rb b/app/helpers/admin/user_helper.rb index 6ebd056f..22da150e 100644 --- a/app/helpers/admin/user_helper.rb +++ b/app/helpers/admin/user_helper.rb @@ -1,7 +1,7 @@ module Admin::UserHelper - def show_user_attribute(object, key, locale = '') - attribute = object.attribute_values.detect {|av| av.key.to_s.eql?(key.to_s) || av[locale.to_s].eql?(locale.to_s) } rescue nil + def show_attribute(object, field_id, locale = '') + attribute = object.attribute_values.detect {|av| av.attribute_field_id.eql?(field_id) || av[locale.to_s].eql?(locale.to_s) } rescue nil if attribute if locale.to_s.blank? attribute['key'] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b8a9c49e..c8754b31 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -48,5 +48,12 @@ module ApplicationHelper message % item end end + + def add_attribute(partial, f, attribute) + new_object = f.object.send(attribute).build + fields = f.fields_for(attribute, new_object, :child_index => "new_#{attribute}") do |f| + render :partial => partial, :object => new_object, :locals => {:f => f} + end + end end diff --git a/app/models/app_auth.rb b/app/models/app_auth.rb new file mode 100644 index 00000000..9602fda0 --- /dev/null +++ b/app/models/app_auth.rb @@ -0,0 +1,77 @@ +class AppAuth + include Mongoid::Document + include Mongoid::Timestamps + # after_save :update_block_list,:update_privilage_list + + field :title + field :token + field :all ,type: Boolean,default: false + belongs_to :module_app + + belongs_to :users + # belongs_to :users,as: :block_users, :inverse_of => :privilege_apps + has_and_belongs_to_many :blocked_users, :inverse_of => nil, :class_name => "User" + has_and_belongs_to_many :privilege_users, :inverse_of => nil, :class_name => "User" + + + has_and_belongs_to_many :roles + + def add_user_to_black_list user + unless self.blocked_users.include?(user) + self.blocked_users << user + self.save! + else + false #should put error message for user existed in list already + end + end + + + def remove_user_from_black_list user + if self.blocked_users.include? user + self.blocked_users.delete user + self.save! + else + false #should put error message for user not existed in list + end + end + + + def add_user_to_privilege_list user + unless self.privilege_users.include? user + self.privilege_users << user + self.save! + else + false #should put error message for user existed in list already + end + end + + + def remove_user_from_privilege_list user + if self.privilege_users.include? user + self.privilege_users.delete user + self.save! + else + false #should put error message for user not existed in list + end + end + + def auth_users + if self.all? + User.all.entries + else + ary= self.roles.collect do |role| + role.users + end + ary << self.privilege_users + ary.flatten! + end + end + + def auth_users_after_block_list + auth_users - self.blocked_users + end + + # protected + + +end \ No newline at end of file diff --git a/app/models/design/design.rb b/app/models/design/design.rb index f1f676b6..e77f7f0f 100644 --- a/app/models/design/design.rb +++ b/app/models/design/design.rb @@ -24,6 +24,35 @@ class Design after_save :procs_embedded_objects # after_destroy :del_embedded_objects + # validate do + # errors.add('atttribute1', 'error for 1') if files_with_duplicate? + # errors.add('atttribute2', 'error for 1') if files_with_noname? + # end + + def files_with_duplicate? + [self.javascripts, self.images,self.themes].each do |objects_hash| + ary = objects_hash.collect{ |k| k.file_filename} + ary.compact! + # debugger + return true if(ary.count!=ary.uniq.count) + end + false + end + + def files_with_noname? + [self.javascripts, self.images,self.themes].each do |objects_hash| + objects_hash.each{ |k| + return true if(k.file_filename.nil? && !k.to_save?) + } + end + false + end + def new_files=(*attrs) + attrs[0].map do |key,items_ary| #Loop by JSs,Themes,Imgs + self.files=([items_ary, key]) + end + end + def javascripts=(*attrs) self.files = (attrs << 'javascripts') end @@ -36,7 +65,7 @@ class Design self.files = (attrs << 'images') end - # Update or create the attribute_model records + # Update or create the attribute records def files=(attrs) case attrs.last when 'layout' @@ -45,6 +74,7 @@ class Design files = eval(attrs.last) end attrs[0].each do |a| + if a[:id].blank? && !a[:file].blank? files.build(:file => a[:file], :to_save => true) else @@ -86,12 +116,14 @@ class Design end end end + self.valid? end def process_object(object) if object.to_save if object.file_filename.nil? - new_object = self.send(object._type.downcase.pluralize).build(object) + new_object = self.send(object._type.downcase.pluralize).build(object.attributes) + new_object.file = object.file object.destroy new_object.to_save = false new_object.save diff --git a/app/models/design/layout.rb b/app/models/design/layout.rb index 7ae4ceef..0b3bf7d9 100644 --- a/app/models/design/layout.rb +++ b/app/models/design/layout.rb @@ -1,5 +1,5 @@ class Layout < DesignFile - include Parser + include ParserLayout attr_reader :content diff --git a/app/models/i18n_variable.rb b/app/models/i18n_variable.rb index e6835347..b5983d35 100644 --- a/app/models/i18n_variable.rb +++ b/app/models/i18n_variable.rb @@ -7,6 +7,8 @@ class I18nVariable field :document_class, :type => String field :parent_id, :type => BSON::ObjectId, :index => true + belongs_to :language_value, polymorphic: true + def method_missing(field) self[field] end diff --git a/app/models/module_app.rb b/app/models/module_app.rb index f692fb21..31a02025 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -2,7 +2,7 @@ class ModuleApp include Mongoid::Document include Mongoid::Timestamps - field :name_of_app + field :title field :version field :organization field :author @@ -10,4 +10,8 @@ class ModuleApp field :update_info field :create_date + field :app_pages ,type: Array + + has_one :app_auth,dependent: :delete + end diff --git a/app/models/page.rb b/app/models/page.rb index dad89219..1e716d4d 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -1,10 +1,12 @@ class Page < Item field :content + field :app_frontend_url field :theme_id, :type => BSON::ObjectId, :default => nil belongs_to :design has_many :page_parts + belongs_to :module_app embeds_many :custom_images, as: :design_image diff --git a/app/models/purchase/purchase.rb b/app/models/purchase/purchase.rb index a8a9bcfd..104e3a8e 100644 --- a/app/models/purchase/purchase.rb +++ b/app/models/purchase/purchase.rb @@ -9,4 +9,8 @@ class Purchase field :downloaded, :type => Boolean field :download_date, :type => Date + field :type + field :app_controller + has_many :app_auths + end diff --git a/app/models/user/attribute.rb b/app/models/user/attribute.rb new file mode 100644 index 00000000..af8a1106 --- /dev/null +++ b/app/models/user/attribute.rb @@ -0,0 +1,26 @@ +class Attribute + + include Mongoid::Document + include Mongoid::Timestamps + + field :key + field :built_in, :type => Boolean, :default => false + field :disabled, :type => Boolean, :default => false + + has_many :attribute_fields, :autosave => true, :dependent => :destroy + has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + accepts_nested_attributes_for :attribute_fields, :allow_destroy => true + + def is_built_in? + self.built_in + end + + def is_disabled? + self.disabled + end + + def get_enabled_attribute_fields + self.attribute_fields.excludes('disabled' => true) + end + +end \ No newline at end of file diff --git a/app/models/user/attribute_field.rb b/app/models/user/attribute_field.rb new file mode 100644 index 00000000..42bbf910 --- /dev/null +++ b/app/models/user/attribute_field.rb @@ -0,0 +1,37 @@ +class AttributeField + + include Mongoid::Document + include Mongoid::Timestamps + + field :key + field :markup + field :locale, :type => Boolean, :default => true + field :list_options, :type => Array + field :built_in, :type => Boolean, :default => false + field :disabled, :type => Boolean, :default => false + + belongs_to :attribute + has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + has_many :attribute_values + + # validates_uniqueness_of :key + + # Convert the string list_options into an array + def select_list_options=(var) + self.list_options = var.gsub(' ', '').split(',') + end + + # Convert the array list_options into a string + def select_list_options + self.list_options.to_a.join(', ') + end + + def is_built_in? + self.built_in + end + + def is_disabled? + self.disabled + end + +end diff --git a/app/models/user/attribute_model.rb b/app/models/user/attribute_model.rb deleted file mode 100644 index d2cb8a1a..00000000 --- a/app/models/user/attribute_model.rb +++ /dev/null @@ -1,62 +0,0 @@ -class AttributeModel - - include Mongoid::Document - include Mongoid::Timestamps - - field :key - field :i18n_variable_id, :type => BSON::ObjectId, :index => true - field :markup - field :locale, :type => Boolean - field :list_options, :type => Array - field :built_in, :type => Boolean, :default => false - field :disabled, :type => Boolean, :default => false - - embedded_in :user_attribute_model - validates_uniqueness_of :key - - # Destroy the i18n_variable - def destroy_i18n_variable - self.i18n_variable.destroy rescue nil - end - - # Get the i18n_variable - def i18n_variable - @i18n_variable ||= I18nVariable.find(self.i18n_variable_id) rescue nil - end - - # Update or create the i18n_variable record - def i18n_variable=(attr) - if self.i18n_variable_id - self.i18n_variable.update_attributes(attr) - else - # var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class, :parent_id => self.user_attribute_model.i18n_variable_id})) - var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class})) - var.save - self.i18n_variable_id = var.id - end - end - - # Convert the string list_options into an array - def select_list_options=(var) - self.list_options = var.gsub(' ', '').split(',') - end - - # Convert the array list_options into a string - def select_list_options - self.list_options.to_a.join(', ') - end - - # Check if the attribute is set to be destroyed - def should_destroy? - should_destroy.to_i == 1 rescue nil - end - - def is_built_in? - self.built_in - end - - def is_disabled? - self.disabled - end - -end diff --git a/app/models/user/attribute_value.rb b/app/models/user/attribute_value.rb index 877431f0..47c84085 100644 --- a/app/models/user/attribute_value.rb +++ b/app/models/user/attribute_value.rb @@ -5,6 +5,11 @@ class AttributeValue field :key - belongs_to :user_attribute + belongs_to :attribute_field + belongs_to :user + + def method_missing(field) + self[field] + end end diff --git a/app/models/user/info.rb b/app/models/user/info.rb new file mode 100644 index 00000000..e55fa6f2 --- /dev/null +++ b/app/models/user/info.rb @@ -0,0 +1,3 @@ +class Info < Attribute + +end diff --git a/app/models/user/role.rb b/app/models/user/role.rb new file mode 100644 index 00000000..86f7266f --- /dev/null +++ b/app/models/user/role.rb @@ -0,0 +1,29 @@ +class Role + + include Mongoid::Document + include Mongoid::Timestamps + + field :key + field :built_in, :type => Boolean, :default => false + field :disabled, :type => Boolean, :default => false + + has_many :sub_roles, :autosave => true, :dependent => :destroy + has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + has_many :users + accepts_nested_attributes_for :i18n_variable, :allow_destroy => true + accepts_nested_attributes_for :sub_roles, :allow_destroy => true + + def is_built_in? + self.built_in + end + + def is_disabled? + self.disabled + end + + # Get an role from key + def self.get_role_from_key(key) + self.first(:conditions => {:key => key}) + end + +end \ No newline at end of file diff --git a/app/models/user/sub_role.rb b/app/models/user/sub_role.rb new file mode 100644 index 00000000..cdefb5f5 --- /dev/null +++ b/app/models/user/sub_role.rb @@ -0,0 +1,11 @@ +class SubRole < Attribute + + belongs_to :role + has_and_belongs_to_many :users + + # Get an sub_role from key + def self.get_sub_role_from_key(key) + self.first(:conditions => {:key => key}) + end + +end \ No newline at end of file diff --git a/app/models/user/user.rb b/app/models/user/user.rb index f582dc04..1e956b80 100644 --- a/app/models/user/user.rb +++ b/app/models/user/user.rb @@ -10,53 +10,37 @@ class User field :admin, :type => Boolean, :default => true field :active_role - has_many :user_attributes - has_many :user_roles - has_many :user_infos + has_many :attribute_values, :autosave => true, :dependent => :destroy + has_many :app_auths,as: :privilege_apps,:inverse_of => :privilege_lists + has_many :blocked_apps, :inverse_of => :blocked_users, :class_name => "AppAuth" + has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth" + belongs_to :role + has_and_belongs_to_many :sub_roles + accepts_nested_attributes_for :attribute_values, :allow_destroy => true - # Update or create the user_role records - def user_roles=(*attrs) - attrs[0].each do |roles| - if roles[:id].blank? - user_roles.build(roles) - else - user_role = user_roles.detect {|a| a.id.to_s == roles[:id].to_s } - user_role.update_attributes(roles) - end - end - end - - # Update or create the user_info records - def user_infos=(*attrs) - attrs[0].each do |infos| - if infos[:id].blank? - user_infos.build(infos) - else - user_info = user_infos.detect {|a| a.id.to_s == infos[:id].to_s } - user_info.update_attributes(infos) - end - end - end - - # Get an user_info from model key - def get_info_from_model_key(key) - self.user_infos.detect {|a| a.key.to_s == key.to_s } - end - - # Get an user_role from model key - def get_role_from_model_key(key) - self.user_roles.detect {|a| a.key.to_s == key.to_s } + def avb_apps + query = AppAuth.any_of({all: true},{privilege_user_ids: self.id},{roles: self.role.id}).excludes(blocked_user_ids: self.id) end def name - infos = self.user_infos.detect {|info| info.key.to_s.eql?('profile') } - if infos - first_name = infos.attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil - last_name = infos.attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil + info = Class::Info.first(:conditions => {:key => 'profile'}) + if info + first_name = get_attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil + last_name = get_attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil return "#{first_name} #{last_name}" else return nil end end + def get_attribute_values + @attribute_values ||= self.attribute_values + end + + def get_value_from_field_id(field_id) + values = get_attribute_values + value = values.detect {|value| value.attribute_field_id == field_id} rescue nil + value ? value : self.attribute_values.build + end + end diff --git a/app/models/user/user_attribute.rb b/app/models/user/user_attribute.rb deleted file mode 100644 index ddf04cc1..00000000 --- a/app/models/user/user_attribute.rb +++ /dev/null @@ -1,21 +0,0 @@ -class UserAttribute - - include Mongoid::Document - include Mongoid::Timestamps - - field :key - has_many :attribute_values - - # Update or create the attribute_value records - def attribute_values=(*args) - args[0].each do |value| - if value[:id].blank? - attribute_values.build(value) - else - attribute_value = attribute_values.detect {|a| a.id.to_s == value[:id].to_s } - attribute_value.update_attributes(value) - end - end - end - -end diff --git a/app/models/user/user_attribute_model.rb b/app/models/user/user_attribute_model.rb deleted file mode 100644 index c8aea4b2..00000000 --- a/app/models/user/user_attribute_model.rb +++ /dev/null @@ -1,74 +0,0 @@ -class UserAttributeModel - - include Mongoid::Document - include Mongoid::Timestamps - - field :key - field :i18n_variable_id, :type => BSON::ObjectId, :index => true - field :built_in, :type => Boolean, :default => false - field :disabled, :type => Boolean, :default => false - - embeds_many :attribute_models - - after_update :destroy_attrs - - # Update or create the attribute_model records - def attribute_models=(*attrs) - attrs[0].each do |attributes| - if attributes[:id].blank? - attribute_models.build(attributes) - else - attribute_model = attribute_models.detect {|a| a.id.to_s == attributes[:id].to_s } - attribute_model.update_attributes(attributes) - end - end - end - - # Destroy the i18n_variables - def destroy_i18n_variables - self.i18n_variable.destroy rescue nil - self.attribute_models.each do |attr| - attr.destroy_i18n_variable - end - end - - # Update or create the i18n_variable record - def i18n_variable=(attr) - if self.i18n_variable_id - self.i18n_variable.update_attributes(attr) rescue nil - else - var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class})) - var.save - self.i18n_variable_id = var.id - end - end - - # Get the i18n_variable - def i18n_variable - @i18n_variable ||= I18nVariable.find(self.i18n_variable_id) rescue nil - end - - def is_built_in? - self.built_in - end - - def is_disabled? - self.disabled.blank? ? false : self.disabled - end - - def get_enabled_attribute_models - self.attribute_models.excludes('disabled' => true) - end - - protected - - # Destroy the i18n_variable for each attribute_models if marked to destroy - def destroy_attrs - attribute_models.each do |a| - if a.should_destroy? - a.destroy_i18n_variable - end - end - end - -end diff --git a/app/models/user/user_info.rb b/app/models/user/user_info.rb deleted file mode 100644 index f216c83a..00000000 --- a/app/models/user/user_info.rb +++ /dev/null @@ -1,5 +0,0 @@ -class UserInfo < UserAttribute - - belongs_to :user - -end diff --git a/app/models/user/user_info_model.rb b/app/models/user/user_info_model.rb deleted file mode 100644 index cacf2a55..00000000 --- a/app/models/user/user_info_model.rb +++ /dev/null @@ -1,3 +0,0 @@ -class UserInfoModel < UserAttributeModel - -end diff --git a/app/models/user/user_role.rb b/app/models/user/user_role.rb deleted file mode 100644 index 1bc23e93..00000000 --- a/app/models/user/user_role.rb +++ /dev/null @@ -1,5 +0,0 @@ -class UserRole < UserAttribute - - belongs_to :user - -end diff --git a/app/models/user/user_role_model.rb b/app/models/user/user_role_model.rb deleted file mode 100644 index d5271edd..00000000 --- a/app/models/user/user_role_model.rb +++ /dev/null @@ -1,8 +0,0 @@ -class UserRoleModel < UserAttributeModel - - # Get an user_role_model from key - def self.get_role_model_from_key(key) - self.first(:conditions => {:key => key}) - end - -end diff --git a/app/views/admin/app_auths/_auth_unit.html.erb b/app/views/admin/app_auths/_auth_unit.html.erb new file mode 100644 index 00000000..5a246fc3 --- /dev/null +++ b/app/views/admin/app_auths/_auth_unit.html.erb @@ -0,0 +1,3 @@ +
+ <%= unit%> +
\ No newline at end of file diff --git a/app/views/admin/app_auths/index.html.erb b/app/views/admin/app_auths/index.html.erb new file mode 100644 index 00000000..0d804b2b --- /dev/null +++ b/app/views/admin/app_auths/index.html.erb @@ -0,0 +1,32 @@ +<% content_for :secondary do %> +
+
+

User Role

+
    + <% @roles.each do |role| %> +
  • <%= link_to content_tag(:span, "Role") %>
  • + <% end -%> +
+
+
+<% end -%> + +

<%= t('admin.list_app_auths') %>

+ + + + + + + +<% @app_auth_data.each do |app| %> + + + <% app[0][:auth_field].each do |unit| %> + + <%end%> + +<% end %> +
<%= t('admin.app.name') %><%= t('admin.description') %>
<%= app[0][:app_obj].title %> + <%= render :partial => "auth_unit",:locals => {:unit => unit } %> +
diff --git a/app/views/admin/attributes/_attribute_field.html.erb b/app/views/admin/attributes/_attribute_field.html.erb new file mode 100644 index 00000000..56d0b3ad --- /dev/null +++ b/app/views/admin/attributes/_attribute_field.html.erb @@ -0,0 +1,34 @@ +" class="list_item"> + <%= attribute_field.new_record? ? (f.text_field :key) : attribute_field.key %> + + <%= f.check_box :locale %> + + <%= f.fields_for :i18n_variable, (attribute_field.new_record? ? attribute_field.build_i18n_variable : attribute_field.i18n_variable) do |f| %> + <% @site_valid_locales.each do |locale| %> + <%= f.text_field locale, :style => "width:130px" %> + <% end %> + <% end %> + + <%= f.select :markup, LIST[:markups], {}, {:style => "width:90px"} %> +
> + <%= t('admin.options') %>: + <%= f.select "select_list_options", attribute_field.select_list_options, :style => "width:130px" %> +
+ + + + <% if attribute_field.new_record? %> + <%= t(:delete) %> + <% else %> + <%= f.hidden_field :id %> + <% if attribute_field.is_built_in? %> + + <%= f.hidden_field :disabled, :value => attribute_field.is_disabled? , :class => 'built_in_state' %> + <% else %> + <%= t(:delete) %> + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> + <% end %> + <% end %> + + + \ No newline at end of file diff --git a/app/views/admin/attributes/edit.html.erb b/app/views/admin/attributes/edit.html.erb new file mode 100644 index 00000000..d45382f6 --- /dev/null +++ b/app/views/admin/attributes/edit.html.erb @@ -0,0 +1,14 @@ +<% content_for :secondary do %> + <%= render 'admin/users/side_bar' %> +<% end %> + +
+ <%= form_for @attribute, :url => eval("admin_#{@attribute_type}_path(@attribute)") do |f| %> + <%= f.error_messages %> + <%= render :partial => "admin/#{@attribute_type}s/form", :locals => { :f => f, :is_new => false } %> +
+ <%= link_back %> + <%= link_to t('update'), "#", :onclick=>"$('#edit_#{@attribute_type}_#{@attribute.id}').submit()" %> +
+ <% end %> +
\ No newline at end of file diff --git a/app/views/admin/attributes/index.html.erb b/app/views/admin/attributes/index.html.erb new file mode 100644 index 00000000..71ec1699 --- /dev/null +++ b/app/views/admin/attributes/index.html.erb @@ -0,0 +1,39 @@ +<% content_for :secondary do %> + <%= render 'admin/users/side_bar' %> +<% end %> + +
+
+ <%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path"), :class => 'new' %> +
+ + + + + + + + + <% @attributes.each do |attribute| %> + "> + + + + + + <% end %> + +
<%= t("admin.#{@attribute_type}") %><%= t('admin.action') %>
<%= attribute.i18n_variable[I18n.locale] %> + + + <%= link_to t(:edit), eval("edit_admin_#{@attribute_type}_path(attribute)"), :class => 'edit' %> + <%= link_to t(:enable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{@attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch' %> + <%= link_to t(:disable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{@attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch' %> + <% if !attribute.is_built_in? %> + <%= link_to t(:delete), eval("admin_#{@attribute_type}_path(attribute)"), :class => 'delete', :confirm => t('sure?'), :method => :delete %> + <% end %> +
+
+ <%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path"), :class => 'new' %> +
+
diff --git a/app/views/admin/attributes/new.html.erb b/app/views/admin/attributes/new.html.erb new file mode 100644 index 00000000..2e96e8f9 --- /dev/null +++ b/app/views/admin/attributes/new.html.erb @@ -0,0 +1,14 @@ +<% content_for :secondary do %> + <%= render 'admin/users/side_bar' %> +<% end %> + +
+ <%= form_for @attribute, :url => eval("admin_#{@attribute_type}s_path") do |f| %> + <%= f.error_messages %> + <%= render :partial => "admin/#{@attribute_type}s/form", :locals => { :f => f, :is_new => true } %> +
+ <%= link_back %> + <%= link_to t('create'), "#", :onclick=>"$('#new_#{@attribute_type}').submit()" %> +
+ <% end -%> +
\ No newline at end of file diff --git a/app/views/admin/attributes/toggle_enable.js.erb b/app/views/admin/attributes/toggle_enable.js.erb new file mode 100644 index 00000000..c42c4744 --- /dev/null +++ b/app/views/admin/attributes/toggle_enable.js.erb @@ -0,0 +1,3 @@ +$("#enable_<%= @attribute.id %>").toggle(); +$("#disable_<%= @attribute.id %>").toggle(); +$("#attribute_<%= @attribute.id %>").toggleClass('disable'); \ No newline at end of file diff --git a/app/views/admin/designs/_design_file.html.erb b/app/views/admin/designs/_design_file.html.erb index 205b5350..c2945069 100644 --- a/app/views/admin/designs/_design_file.html.erb +++ b/app/views/admin/designs/_design_file.html.erb @@ -18,7 +18,7 @@ <% end %>

-<%= fields_for "design[" + field_name + "][]", object.send(field_name).build, :index => nil do |f| %> +<%= fields_for "design[new_files][" + field_name + "][]", object.send(field_name).build, :index => nil do |f| %> <%= f.file_field :file, :class => "multi_files" %>

<% end %> \ No newline at end of file diff --git a/app/views/admin/designs/_new.html.erb b/app/views/admin/designs/_new.html.erb new file mode 100644 index 00000000..ded2237a --- /dev/null +++ b/app/views/admin/designs/_new.html.erb @@ -0,0 +1,10 @@ +

<%= t('admin.new_design') %>

+ +<%= form_for :design, :url => admin_designs_path do |f| %> + <%= f.error_messages %> + <%= render :partial => "form", :locals => { :f => f } %> + +

+ <%= f.submit t('create') %> <%= link_back %> +

+<% end %> diff --git a/app/views/admin/designs/edit.html.erb b/app/views/admin/designs/edit.html.erb index 5e7e705a..16ec7d4c 100644 --- a/app/views/admin/designs/edit.html.erb +++ b/app/views/admin/designs/edit.html.erb @@ -1,6 +1,6 @@

<%= t('admin.editing_design') %>

-<%= form_for @design, :url => admin_design_path(@design) do |f| %> +<%= form_for @design, :url => admin_design_path(@design),:html => {:multipart => true} do |f| %> <%= f.error_messages %> <%= render :partial => "form", :locals => { :f => f } %>

diff --git a/app/views/admin/designs/new.html.erb b/app/views/admin/designs/new.html.erb index 003ac47e..7ada8829 100644 --- a/app/views/admin/designs/new.html.erb +++ b/app/views/admin/designs/new.html.erb @@ -1,7 +1,7 @@

<%= t('admin.new_design') %>

- <%= form_for :design, :url => admin_designs_path do |f| %> + <%= form_for :design, :url => admin_designs_path, :html => {:multipart => true} do |f| %> <%= f.error_messages %> <%= render :partial => "form", :locals => { :f => f } %> @@ -10,4 +10,4 @@ <%= f.submit t('create') %>
<% end %> -
\ No newline at end of file +
diff --git a/app/views/admin/designs/new.js.erb b/app/views/admin/designs/new.js.erb new file mode 100644 index 00000000..7b41a5c0 --- /dev/null +++ b/app/views/admin/designs/new.js.erb @@ -0,0 +1 @@ +rcom.modalWindow({loadHtml:"<%= escape_javascript(render(:partial => 'new')) %>"}); \ No newline at end of file diff --git a/app/views/admin/infos/_attribute_field.html.erb b/app/views/admin/infos/_attribute_field.html.erb new file mode 100644 index 00000000..12ed7828 --- /dev/null +++ b/app/views/admin/infos/_attribute_field.html.erb @@ -0,0 +1,3 @@ +<%= f.fields_for :attribute_fields, attribute_field do |f| %> + <%= render :partial => 'admin/attributes/attribute_field', :object => attribute_field, :locals => {:f => f} %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/infos/_form.html.erb b/app/views/admin/infos/_form.html.erb new file mode 100644 index 00000000..bf31b652 --- /dev/null +++ b/app/views/admin/infos/_form.html.erb @@ -0,0 +1,70 @@ +
+

<%= t("admin.#{@attribute_type}") %>

+
+ + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + + + + <%= f.fields_for :i18n_variable, (@attribute.new_record? ? @attribute.build_i18n_variable : @attribute.i18n_variable) do |f| %> + <% @site_valid_locales.each do |locale| %> + + <% end %> + <% end %> + + +
<%= t('admin.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= is_new ? (f.text_field :key, {:style => "width:150px"}) : @attribute.key %><%= f.text_field locale, :style => "width:150px" %>
+
+
+ + +
+

Attributes

+
+ + + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + + + + + + + + + <% @attribute.attribute_fields.each do |attribute_field| %> + <%= render :partial => 'attribute_field', :object => attribute_field, :locals => {:f => f} %> + <% end %> + +
<%= t('admin.key') %><%= t('admin.multilingual') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %><%= t('admin.type')%> 
+ <%= hidden_field_tag 'attribute_field_count', @attribute.attribute_fields.count %> + <%= t(:add) %> +
+
+
+ +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "attribute_form" %> + +<% end %> \ No newline at end of file diff --git a/app/views/admin/module_apps/_app_selector.html.erb b/app/views/admin/module_apps/_app_selector.html.erb new file mode 100644 index 00000000..90c2aee1 --- /dev/null +++ b/app/views/admin/module_apps/_app_selector.html.erb @@ -0,0 +1 @@ +<%= f.select :module_app, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %> \ No newline at end of file diff --git a/app/views/admin/module_apps/reload_frontend_pages.js.erb b/app/views/admin/module_apps/reload_frontend_pages.js.erb new file mode 100644 index 00000000..d9589cc9 --- /dev/null +++ b/app/views/admin/module_apps/reload_frontend_pages.js.erb @@ -0,0 +1 @@ +$('#app_page_url').html("<%= escape_javascript(select 'page','app_frontend_url', @module_app.app_pages) %>"); \ No newline at end of file diff --git a/app/views/admin/pages/_form.html.erb b/app/views/admin/pages/_form.html.erb index 845e4d37..d0c00d16 100644 --- a/app/views/admin/pages/_form.html.erb +++ b/app/views/admin/pages/_form.html.erb @@ -30,8 +30,13 @@ <%= f.select :theme_id, @default_design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %> <% end %>

- +

+ <%= t('admin.module_app') %> + <%= render :partial => "admin/module_apps/app_selector", :locals => { :f => f } %> + +

<%= f.label :is_published, "#{t('admin.is_published')} ?" %> <%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No

+ diff --git a/app/views/admin/pages/_show.html.erb b/app/views/admin/pages/_show.html.erb index a4b78e2f..1937fe92 100644 --- a/app/views/admin/pages/_show.html.erb +++ b/app/views/admin/pages/_show.html.erb @@ -1,7 +1,3 @@ <%= flash_messages %> -<%= parse_page_edit(@item).html_safe %> - -<% content_for :page_specific_javascript do %> - <%= javascript_include_tag "page_edit" %> -<% end -%> +<%= parse_page_edit(@item).html_safe %> \ No newline at end of file diff --git a/app/views/admin/roles/_attribute_field.html.erb b/app/views/admin/roles/_attribute_field.html.erb new file mode 100644 index 00000000..12ed7828 --- /dev/null +++ b/app/views/admin/roles/_attribute_field.html.erb @@ -0,0 +1,3 @@ +<%= f.fields_for :attribute_fields, attribute_field do |f| %> + <%= render :partial => 'admin/attributes/attribute_field', :object => attribute_field, :locals => {:f => f} %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/roles/_form.html.erb b/app/views/admin/roles/_form.html.erb new file mode 100644 index 00000000..11608072 --- /dev/null +++ b/app/views/admin/roles/_form.html.erb @@ -0,0 +1,50 @@ +
+

<%= t("admin.#{@attribute_type}") %>

+
+ + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + + + + <%= f.fields_for :i18n_variable, (@attribute.new_record? ? @attribute.build_i18n_variable : @attribute.i18n_variable) do |f| %> + <% @site_valid_locales.each do |locale| %> + + <% end %> + <% end %> + + +
<%= t('admin.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= is_new ? (f.text_field :key, {:style => "width:150px"}) : @attribute.key %><%= f.text_field locale, :style => "width:150px" %>
+
+
+ +
+

Sub roles

+ <% @attribute.sub_roles.each_with_index do |sub_role, i| %> + <%= render :partial => 'form_sub', :object => sub_role, :locals => {:f => f, :i => i} %> + <% end %> +
+
+ +
+ <%= hidden_field_tag 'attribute_field_count', @attribute.sub_roles.count %> + <%= t(:add) %> +
+ +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "attribute_form" %> + +<% end %> \ No newline at end of file diff --git a/app/views/admin/roles/_form_sub.html.erb b/app/views/admin/roles/_form_sub.html.erb new file mode 100644 index 00000000..796d8469 --- /dev/null +++ b/app/views/admin/roles/_form_sub.html.erb @@ -0,0 +1,3 @@ +<%= f.fields_for :sub_roles, form_sub do |f| %> + <%= render :partial => 'sub_role', :object => form_sub, :locals => {:f => f, :i => i} %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/roles/_sub_role.html.erb b/app/views/admin/roles/_sub_role.html.erb new file mode 100644 index 00000000..e5a5f076 --- /dev/null +++ b/app/views/admin/roles/_sub_role.html.erb @@ -0,0 +1,68 @@ + +
+ + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + + + + <%= f.fields_for :i18n_variable, (sub_role.new_record? ? sub_role.build_i18n_variable : sub_role.i18n_variable) do |f| %> + <% @site_valid_locales.each do |locale| %> + + <% end %> + <% end %> + + +
<%= t('admin.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= sub_role.new_record? ? (f.text_field :key, {:style => "width:150px"}) : sub_role.key %><%= f.text_field locale, :style => "width:150px" %>
+
+

Attributes

+
+ + + + + + <% @site_valid_locales.each do |locale| %> + + <% end %> + + + + + + + + + + + <% sub_role.attribute_fields.each do |attribute_field| %> + <%= render :partial => 'attribute_field', :object => attribute_field, :locals => {:f => f} %> + <% end %> + +
<%= t('admin.key') %><%= t('admin.multilingual') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %><%= t('admin.type')%> 
+ <%= hidden_field_tag 'attribute_field_count', sub_role.attribute_fields.count %> + <%= t(:add) %> + <%= hidden_field_tag 'sub_role_temp_id', (i rescue 'new_sub_roles') %> +
+
+
+
+ +<% content_for :page_specific_javascript do %> + +<% end unless !sub_role.new_record? %> \ No newline at end of file diff --git a/app/views/admin/user_attribute_models/_attribute_model.html.erb b/app/views/admin/user_attribute_models/_attribute_model.html.erb deleted file mode 100644 index 819f584b..00000000 --- a/app/views/admin/user_attribute_models/_attribute_model.html.erb +++ /dev/null @@ -1,36 +0,0 @@ -<%= fields_for "user_#{@attribute}_model[attribute_models][]", attribute_model, :index => nil do |f| %> - - <%= attribute_model.new_record? ? (f.text_field :key) : attribute_model.key %> - - <%= check_box_tag "locale[]", value = '', attribute_model.locale.nil? ? true : attribute_model.locale %> - <%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][locale]", attribute_model.locale.nil? ? true : attribute_model.locale %> - - <% @site_valid_locales.each do |locale| %> - <%= text_field_tag "user_#{@attribute}_model[attribute_models][][i18n_variable][#{locale}]", (attribute_model.i18n_variable[locale] rescue nil), :style => "width:130px" %> - <% end %> - - <%= f.select :markup, LIST[:markups], {}, {:style => "width:90px"} %> -
> - <%= t('admin.options') %>: - <%= text_field_tag "user_#{@attribute}_model[attribute_models][][select_list_options]", attribute_model.select_list_options, :style => "width:130px" %> -
- - - - <% if attribute_model.new_record? %> - <%= t(:delete) %> - <% else %> - <% if attribute_model.is_built_in? %> - - <%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][disabled]", attribute_model.is_disabled? , :class => 'built_in_state' %> - <% else %> - <%= t(:delete) %> - <%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][should_destroy]", nil , :class => 'should_destroy' %> - <% end %> - <%= f.hidden_field :id %> - <%= f.hidden_field :key %> - <% end %> - - - -<% end %> \ No newline at end of file diff --git a/app/views/admin/user_attribute_models/_form.html.erb b/app/views/admin/user_attribute_models/_form.html.erb deleted file mode 100644 index edbcae39..00000000 --- a/app/views/admin/user_attribute_models/_form.html.erb +++ /dev/null @@ -1,57 +0,0 @@ -
-

<%= t("admin.user_#{@attribute}") %>

-
- - - - - <% @site_valid_locales.each do |locale| %> - - <% end %> - - - - - - <% @site_valid_locales.each do |locale| %> - - <% end %> - - -
<%= t('admin.key') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= is_new ? (f.text_field :key, {:style => "width:150px"}) : @user_attribute_model.key %> - <%= text_field_tag "user_#{@attribute}_model[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :style => "width:150px" %> -
-
-
- - -
-

Attributes

-
- - - - - - <% @site_valid_locales.each do |locale| %> - - <% end %> - - - - - - - - - - - <%= render :partial => 'admin/user_attribute_models/attribute_model', :collection => @user_attribute_model.attribute_models %> - -
<%= t('admin.key') %><%= t('admin.multilingual') %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %><%= t('admin.type')%> 
<%= t(:add) %>
-
-
- -<% content_for :page_specific_javascript do %> - <%= javascript_include_tag "user_attribute_model_form" %> -<% end -%> diff --git a/app/views/admin/user_attribute_models/admin.html.erb b/app/views/admin/user_attribute_models/admin.html.erb deleted file mode 100644 index a4bbbb43..00000000 --- a/app/views/admin/user_attribute_models/admin.html.erb +++ /dev/null @@ -1,31 +0,0 @@ - - - - - <%= @title || APP_CONFIG['orbit'] %> - - <%= stylesheet_link_tag "admin" %> - <%= javascript_include_tag "admin" %> - <%= yield :page_specific_css %> - <%= yield :page_specific_javascript %> - <%= csrf_meta_tag %> - - - - -
- -
- <%= yield %> -
-
<%= yield :tertiary %>
- -
- - diff --git a/app/views/admin/user_attribute_models/edit.html.erb b/app/views/admin/user_attribute_models/edit.html.erb deleted file mode 100644 index f40fca70..00000000 --- a/app/views/admin/user_attribute_models/edit.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -<% content_for :secondary do %> - <%= render 'admin/users/side_bar' %> -<% end %> - -
- <%= form_for @user_attribute_model, :url => eval("admin_user_#{@attribute}_model_path(@user_role_model)") do |f| %> - <%= f.error_messages %> - <%= render :partial => "admin/user_attribute_models/form", :locals => { :f => f, :is_new => false } %> -
- <%= link_to t('update'), "#", :onclick=>"$('#edit_user_role_model_#{@user_attribute_model.id}').submit()" %> - <%= link_back %> -
- <% end -%> -
\ No newline at end of file diff --git a/app/views/admin/user_attribute_models/edit.html.erb.back b/app/views/admin/user_attribute_models/edit.html.erb.back deleted file mode 100644 index d0442fb8..00000000 --- a/app/views/admin/user_attribute_models/edit.html.erb.back +++ /dev/null @@ -1,14 +0,0 @@ -<% content_for :secondary do %> - <%= render 'side_bar' %> -<% end %> - -
- <%= form_for @user, :url => admin_user_path(@user), :html => { :multipart => true } do |f| %> - <%= f.error_messages %> - <%= render :partial => 'form', :locals => { :f => f } %> -
- <%= link_back %> - <%= link_to t('update'), "#", :onclick=>"$('#edit_user_#{@user.id}').submit()" %> -
- <% end -%> -
\ No newline at end of file diff --git a/app/views/admin/user_attribute_models/index.html.erb b/app/views/admin/user_attribute_models/index.html.erb deleted file mode 100644 index 87c5af7f..00000000 --- a/app/views/admin/user_attribute_models/index.html.erb +++ /dev/null @@ -1,41 +0,0 @@ -<% content_for :secondary do %> - <%= render 'admin/users/side_bar' %> -<% end %> - -
-
- <%= link_to t("admin.new_user_#{@attribute}"), eval("new_admin_user_#{@attribute}_model_path"), :class => 'new' %> -
- - - - - - - - - <% @user_attribute_models.each do |user_attribute_model| %> - "> - - - - - - - <% end %> - -
<%= t("admin.#{@attribute}") %><%= t('admin.action') %>
<%= user_attribute_model.i18n_variable[I18n.locale] %> - <%= link_to t(:edit), eval("edit_admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'edit' %> - <% if user_attribute_model.is_built_in? %> - <%= link_to t(:enable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? 'none' : ''}", :class => 'switch' %> - <%= link_to t(:disable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? '' : 'none'}", :class => 'switch' %> - <% else %> - <%= link_to t(:enable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? 'none' : ''}", :class => 'switch' %> - <%= link_to t(:disable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? '' : 'none'}", :class => 'switch' %> - <%= link_to t(:delete), eval("admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'delete', :confirm => t('sure?'), :method => :delete %> - <% end %> -
-
- <%= link_to t("admin.new_user_#{@attribute}"), eval("new_admin_user_#{@attribute}_model_path"), :class => 'new' %> -
-
diff --git a/app/views/admin/user_attribute_models/new.html.erb b/app/views/admin/user_attribute_models/new.html.erb deleted file mode 100644 index ea1b015c..00000000 --- a/app/views/admin/user_attribute_models/new.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<% content_for :secondary do %> - <%= render 'admin/users/side_bar' %> -<% end %> - -
- <%= form_for @user_attribute_model, :url => eval("admin_user_#{@attribute}_models_path") do |f| %> - <%= f.error_messages %> - <%= render :partial => "admin/user_attribute_models/form", :locals => { :f => f, :is_new => true } %> -
- <%= link_back %> - <%= link_to t('create'), "#", :onclick=>"$('#new_user_attribute_model').submit()" %> -
- <% end -%> -
- - - - diff --git a/app/views/admin/user_attribute_models/toggle_enable.js.erb b/app/views/admin/user_attribute_models/toggle_enable.js.erb deleted file mode 100644 index 153c24a8..00000000 --- a/app/views/admin/user_attribute_models/toggle_enable.js.erb +++ /dev/null @@ -1,3 +0,0 @@ -$("#enable_<%= @user_attribute_model.id %>").toggle(); -$("#disable_<%= @user_attribute_model.id %>").toggle(); -$("#attribute_<%= @user_attribute_model.id %>").toggleClass('disable'); \ No newline at end of file diff --git a/app/views/admin/user_attributes/_form.html.erb b/app/views/admin/user_attributes/_form.html.erb deleted file mode 100644 index 98953d2c..00000000 --- a/app/views/admin/user_attributes/_form.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -

- <%= f.label :name %> - <%= f.text_field :name %> -

- -
- <% @user_attribute.attrs.each_with_index do |attr, i| %> -

- - <%= hidden_field_tag "user_attribute[attrs][][key]", attr["key"] %> - <%= text_field_tag "user_attribute[attrs][][name]", attr["name"] %> - <%= select_tag "user_attribute[attrs][][type]", options_for_select(["text_field", "select"], attr["type"]) %> - (remove) -

- <% end -%> - -

- - <%= text_field_tag "user_attribute[attrs][][key]", "" %> - - <%= text_field_tag "user_attribute[attrs][][name]", "" %> - <%= select_tag "user_attribute[attrs][][type]", options_for_select(["text_field"], "") %> - (remove) -

- - (add) - -
- -<% content_for :page_specific_javascript do %> - <%= javascript_include_tag "user_attribute_form" %> -<% end -%> \ No newline at end of file diff --git a/app/views/admin/user_attributes/edit.html.erb b/app/views/admin/user_attributes/edit.html.erb deleted file mode 100644 index 1bc86bc4..00000000 --- a/app/views/admin/user_attributes/edit.html.erb +++ /dev/null @@ -1,12 +0,0 @@ - -

Editing user attribute: <%= @user_attribute.key %>

- -<% form_for @user_attribute, :url => admin_user_attribute_path(@user_attribute) do |f| %> - - <%= render :partial => "form", :locals => { :f => f } %> - -

- <%= f.submit %> -

- -<% end -%> diff --git a/app/views/admin/user_attributes/index.html.erb b/app/views/admin/user_attributes/index.html.erb deleted file mode 100644 index b5965a79..00000000 --- a/app/views/admin/user_attributes/index.html.erb +++ /dev/null @@ -1,34 +0,0 @@ -<% content_for :secondary do %> - <%= render 'admin/users/side_bar' %> -<% end %> - -
-
- <%= link_to t("admin.new_user_#{@attribute}"), eval("new_admin_user_#{@attribute}_model_path") %> -
- -
- <%= link_to t("admin.new_user_#{@attribute}"), eval("new_admin_user_#{@attribute}_model_path") %> -
-
diff --git a/app/views/admin/user_attributes/new.html.erb b/app/views/admin/user_attributes/new.html.erb deleted file mode 100644 index f04da0e5..00000000 --- a/app/views/admin/user_attributes/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

New user attribute: <%= @user_attribute.key %>

- -<% form_for @user_attribute, :url => admin_user_attributes_path do |f| %> - -

- <%= f.label :key, "Key" %> - <%= f.text_field :key %> -

- - <%= render :partial => "form", :locals => { :f => f } %> - -

- <%= f.submit %> -

- -<% end -%> diff --git a/app/views/admin/users/_form.html.erb b/app/views/admin/users/_form.html.erb index bbf39e4d..07e7dc7f 100644 --- a/app/views/admin/users/_form.html.erb +++ b/app/views/admin/users/_form.html.erb @@ -16,28 +16,21 @@ -<% @user_info_models.each do |ua| %> -
-

<%= ua.i18n_variable[I18n.locale] %>

-
- <%= render :partial => 'user_attribute', - :object => (@user.user_infos.detect {|u| u.key == ua.key } || @user.user_infos.build), - :locals => {:ua => ua, :type => 'info'} %> -
-<% end -%> -
- <% @user_role_models.each do |ua| %> -
-

<%= t('admin.setup_member') %>

-
    -
  • <%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %>
  • -
  • <%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %>
  • -
  • <%= link_to content_tag(:span, t('admin.list_user_infos')), admin_user_info_models_path %>
  • -
+

<%= t('admin.setup_member') %>

+
    +
  • <%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %>
  • +
  • <%= link_to content_tag(:span, t('admin.list_roles')), admin_roles_path %>
  • +
  • <%= link_to content_tag(:span, t('admin.list_infos')), admin_infos_path %>
  • +
\ No newline at end of file diff --git a/app/views/admin/users/_sub_role.html.erb b/app/views/admin/users/_sub_role.html.erb new file mode 100644 index 00000000..f55b8b48 --- /dev/null +++ b/app/views/admin/users/_sub_role.html.erb @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/app/views/admin/users/_sub_role_selector.html.erb b/app/views/admin/users/_sub_role_selector.html.erb new file mode 100644 index 00000000..6d7924ca --- /dev/null +++ b/app/views/admin/users/_sub_role_selector.html.erb @@ -0,0 +1,4 @@ +<% role.sub_roles.each do |sub_role| %> + <%= sub_role.i18n_variable[I18n.locale] %> + <%= check_box_tag "user[sub_role_ids][]", sub_role.id, @user.sub_role_ids.include?(sub_role.id), :class => 'sub_role_select' %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/users/_user_attribute.html.erb b/app/views/admin/users/_user_attribute.html.erb deleted file mode 100644 index 0a4bd269..00000000 --- a/app/views/admin/users/_user_attribute.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -<%= fields_for "user[user_#{type}s]", user_attribute, :index => nil do |f| %> - <%= f.hidden_field :key, :value => ua.key %> - <%= f.hidden_field :id unless user_attribute.new_record? %> - -
- - - - - <% @site_valid_locales.each do |locale| %> - - <% end %> - - - - <% ua.get_enabled_attribute_models.each do |attr| %> - <% value = user_attribute.attribute_values.detect{|v| v.key == attr.key } %> - <%= hidden_field_tag "user[user_#{type}s][][attribute_values][][id]", value.id rescue nil %> - <%= hidden_field_tag "user[user_#{type}s][][attribute_values][][key]", attr.key %> - - - <% if attr["locale"] && attr["markup"] == 'text_field' %> - <%= hidden_field_tag "user[user_#{type}s][][attribute_values][][non_locale]", nil %> - <% @site_valid_locales.each do |locale| %> - - <% end -%> - <% else %> - - <% end -%> - - <% end %> - -
<%= t("admin.key") %><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= attr.i18n_variable[I18n.locale] %> - <%= text_field_tag "user[user_#{type}s][][attribute_values][][#{locale}]", (value[locale] rescue nil) %> - > - <% if attr["markup"] == "text_field" %> - <%= text_field_tag "user[user_#{type}s][][attribute_values][][non_locale]", (value['non_locale'] rescue nil) %> - <% elsif attr["markup"] == "select" %> - <%= select_tag "user[user_#{type}s][][attribute_values][][non_locale]", options_for_select(attr["options"], value['non_locale']) %> - <% end -%> -
-
- -<% end %> diff --git a/app/views/admin/users/edit.html.erb b/app/views/admin/users/edit.html.erb index 71a1d05e..e60a9b55 100644 --- a/app/views/admin/users/edit.html.erb +++ b/app/views/admin/users/edit.html.erb @@ -2,7 +2,7 @@ <%= render 'side_bar' %> <% end %> -
+
> <%= form_for @user, :url => admin_user_path(@user), :html => { :multipart => true } do |f| %> <%= f.error_messages %> <%= render :partial => 'form', :locals => { :f => f } %> diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index 0c5e232b..cb794ccf 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -19,9 +19,8 @@ <% @users.each do |user| %> - <% active_role = UserRoleModel.get_role_model_from_key(user.active_role) %> - <%= active_role.i18n_variable[I18n.locale] rescue nil %> + <%= user.role.i18n_variable[I18n.locale] rescue nil %> <%= user.name ? user.name : 'bob' %> <%= user.email %> <%= user.admin ? t(:yes_) : t(:no_) %> diff --git a/app/views/admin/users/new.html.erb b/app/views/admin/users/new.html.erb index cafad3d3..472e745d 100644 --- a/app/views/admin/users/new.html.erb +++ b/app/views/admin/users/new.html.erb @@ -2,7 +2,7 @@ <%= render 'side_bar' %> <% end %> -
+
<%= form_for @user, :url => admin_users_path, :html => { :multipart => true } do |f| %> <%= f.error_messages %> <%= render :partial => 'form', :locals => { :f => f } %> diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb index 1535d0c0..4ca95d09 100644 --- a/app/views/admin/users/show.html.erb +++ b/app/views/admin/users/show.html.erb @@ -2,29 +2,28 @@ <%= render 'side_bar' %> <% end %> -
+
- <% if @user.avatar? %> - <%= image_tag(@user.avatar.thumb.url) %> + <% if @user.avatar? %> + <%= image_tag(@user.avatar.thumb.url) %> <% else %> - <%= image_tag "person.png" %> + <%= image_tag "person.png" %> <% end %> +
- - <% @user_info_models.each do |am| %> + <% @infos.each do |a| %>
-

<%= am.i18n_variable[I18n.locale] %>

+

<%= a.i18n_variable[I18n.locale] %>


- <%= render :partial => 'show_user_attribute', :locals => {:am => am, :object => @user.get_info_from_model_key(am.key)} %> + <%= render :partial => 'show_attribute', :object => a %>
<% end -%> -
- <% active_role = UserRoleModel.get_role_model_from_key(@user.active_role) %> -

<%= active_role.i18n_variable[I18n.locale] %>

+
+

<%= @user.role.i18n_variable[I18n.locale] %>


- <%= render :partial => 'show_user_attribute', :locals => {:am => active_role, :object => @user.get_role_from_model_key(active_role.key)} %> + <%= render :partial => 'show_sub_role', :collection => @user.sub_roles %>
<%= link_to t(:edit), edit_admin_user_path(@user) %> diff --git a/config/application.rb b/config/application.rb index bcd418ac..36e1006e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -15,10 +15,11 @@ Bundler.require *Rails.groups(:assets) if defined?(Bundler) module PrototypeR4 class Application < Rails::Application -# config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/built_in_modules"]) - # config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/downloaded_modules"]) - # config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/radius"]) - + # Add directories for plugins + config.paths["vendor/plugins"] += %W(#{config.root}/vendor/built_in_modules) + config.paths["vendor/plugins"] += %W(#{config.root}/vendor/downloaded_modules) + + # 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. @@ -26,7 +27,8 @@ module PrototypeR4 # Custom directories with classes and modules you want to be autoloadable. # config.autoload_paths += %W(#{config.root}/extras) config.autoload_paths += %W(#{config.root}/lib) - config.autoload_paths += %W( #{config.root}/app/models/ckeditor ) + config.autoload_paths += %W(#{config.root}/lib/parsers) + config.autoload_paths += %W(#{config.root}/app/models/ckeditor ) config.autoload_paths += %W(#{config.root}/app/models/design) config.autoload_paths += %W(#{config.root}/app/models/purchase) config.autoload_paths += %W(#{config.root}/app/models/user) diff --git a/config/initializers/fix_using_obj_id.rb b/config/initializers/fix_using_obj_id.rb new file mode 100644 index 00000000..a215cb86 --- /dev/null +++ b/config/initializers/fix_using_obj_id.rb @@ -0,0 +1,5 @@ +Module.instance_eval do + def using_object_ids? + false + end +end \ No newline at end of file diff --git a/config/list.yml b/config/list.yml index b6390b9c..e7e8c41d 100644 --- a/config/list.yml +++ b/config/list.yml @@ -1,6 +1,7 @@ forbidden_item_names: - admin - panel + - appfront markups: - text_field diff --git a/config/locales/en.yml b/config/locales/en.yml index be4ecdb3..27d5cbb2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -55,8 +55,8 @@ en: editing_link: Editing link editing_page: Editing page editing_snippet: Editing snippet - editing_user_info: Editing user information - editing_user_role: Editing user role + editing_info: Editing user information + editing_role: Editing user role email: Email enable_language: Enable language file_name: Filename @@ -78,8 +78,8 @@ en: list_puchases: Purchases list list_snippets: Snippets list list_users: Users list - list_user_infos: User information list - list_user_roles: User roles list + list_infos: User information list + list_roles: User roles list member: Member move_down: Move down move_up: Move up @@ -97,8 +97,8 @@ en: new_page: New page new_snippet: New snippet new_user: New user - new_user_info: New user information - new_user_role: New user role + new_info: New user information + new_role: New user role non_multilingual: Non multilingual options: Options orig_upload_file: Original filename @@ -128,8 +128,8 @@ en: upload_design: Upload design url: URL user: User - user_info: User information - user_panel: User panel - user_role: User role + info: User information + panel: User panel + role: User role panel: diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index e6e9d252..a83f327b 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -50,8 +50,8 @@ zh_tw: editing_link: 編輯連結 editing_page: 編輯頁面 editing_snippet: 編輯片段 - editing_user_info: 編輯用戶資料 - editing_user_role: 編輯用戶角色 + editing_info: 編輯用戶資料 + editing_role: 編輯用戶角色 email: Email enable_language: 啟用語言 file_name: 檔名 @@ -73,8 +73,8 @@ zh_tw: list_layouts: 佈局列表 list_snippets: 斷片列表 list_users: 使用列表 - list_user_infos: 用戶資料列表 - list_user_roles: 用戶角色列表 + list_infos: 用戶資料列表 + list_roles: 用戶角色列表 member: 會員 move_down: 往下移 move_up: 往上移 @@ -92,8 +92,8 @@ zh_tw: new_page: 新增頁面 new_snippet: 新增片段 new_user: 新增使用 - new_user_info: 新增用戶資料 - new_user_role: 新增用戶角色 + new_info: 新增用戶資料 + new_role: 新增用戶角色 non_multilingual: 非多種語言 options: 選項 orig_upload_file: 原上傳檔名 @@ -121,9 +121,9 @@ zh_tw: upload_design: 上傳設計 url: URL user: 用戶 - user_info: 用戶資料 - user_panel: 用戶面板 - user_role: 用戶角色 + info: 用戶資料 + panel: 用戶面板 + role: 用戶角色 panel: diff --git a/config/routes.rb b/config/routes.rb index fba21f02..f2b4cc17 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,12 +7,13 @@ PrototypeR4::Application.routes.draw do match '/site/public_key', :to => CentralServerExchangeApp match '/site/update', :to => GithubApp match '/purchase/:type', :to => CentralServerExchangeApp - match "/panel/:app_name/frontend/:action" => redirect {|params| "/panel/#{params[:app_name]}/#{params[:action]}" } - + # routes for admin namespace :admin do resources :assets + resources :app_auths + resources :designs do collection do get 'upload_package' @@ -22,6 +23,9 @@ PrototypeR4::Application.routes.draw do post 'edit_file' => 'designs#edit_file' end end + resources :infos do + get 'add_attribute_field' + end resources :items resources :links do member do @@ -34,6 +38,11 @@ PrototypeR4::Application.routes.draw do get 'reload_themes' end end + resources :module_apps do + member do + get 'reload_frontend_pages' + end + end resources :page_parts resources :purchases do collection do @@ -43,18 +52,24 @@ PrototypeR4::Application.routes.draw do get 'download' end end + resources :roles do + get 'add_sub_role' + get 'add_attribute_field' + end resources :sites resources :snippets resources :translations resources :users - resources :user_info_models - resources :user_role_models end # end admin namespace :panel do resources :users end + + match '/panel/:app_name/front_end/*page_name' => 'pages#appfront', :via => "get",:constraints => lambda { |request| + !request.query_string.include?("inner=true") + } # routes for gridfs files match "/gridfs/*path" => "gridfs#serve" diff --git a/lib/fraisier/layout.html b/lib/fraisier/layout.html index 5fea7a2a..b2b97924 100644 --- a/lib/fraisier/layout.html +++ b/lib/fraisier/layout.html @@ -24,10 +24,10 @@
- - -
-
+ + +
+