emergent-core 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.bnsignore +16 -0
- data/History.txt +4 -0
- data/Manifest.txt +348 -0
- data/README.rdoc +47 -0
- data/Rakefile +39 -0
- data/app_generators/emergent_core/USAGE +5 -0
- data/app_generators/emergent_core/emergent_core_generator.rb +73 -0
- data/app_generators/emergent_core/templates/core/actionscript.properties +16 -0
- data/app_generators/emergent_core/templates/core/actionscriptair.properties +16 -0
- data/app_generators/emergent_core/templates/core/app.yaml.erb +12 -0
- data/app_generators/emergent_core/templates/core/default_tasks.rake +51 -0
- data/app_generators/emergent_core/templates/core/empty.txt +0 -0
- data/app_generators/emergent_core/templates/core/expressInstall.swf +0 -0
- data/app_generators/emergent_core/templates/core/flex.properties +2 -0
- data/app_generators/emergent_core/templates/core/generate.rb +17 -0
- data/app_generators/emergent_core/templates/core/html-template/AC_OETags.js +276 -0
- data/app_generators/emergent_core/templates/core/html-template/history/history.css +6 -0
- data/app_generators/emergent_core/templates/core/html-template/history/history.js +645 -0
- data/app_generators/emergent_core/templates/core/html-template/history/historyFrame.html +29 -0
- data/app_generators/emergent_core/templates/core/html-template/index.template.html +121 -0
- data/app_generators/emergent_core/templates/core/html-template/playerProductInstall.swf +0 -0
- data/app_generators/emergent_core/templates/core/index.html.erb +18 -0
- data/app_generators/emergent_core/templates/core/index.yaml +11 -0
- data/app_generators/emergent_core/templates/core/mainair-app.xml +134 -0
- data/app_generators/emergent_core/templates/core/mainapp-config.xml +21 -0
- data/app_generators/emergent_core/templates/core/mainapp.mxml +106 -0
- data/app_generators/emergent_core/templates/core/project-textmate.erb +52 -0
- data/app_generators/emergent_core/templates/core/project.properties +18 -0
- data/app_generators/emergent_core/templates/core/projectair.properties +24 -0
- data/app_generators/emergent_core/templates/core/swfobject.js +5 -0
- data/bin/emergent +17 -0
- data/lib/emergent_core.rb +49 -0
- data/lib/restfulx/active_foo.rb +194 -0
- data/lib/restfulx/active_record_tasks.rb +81 -0
- data/lib/restfulx/configuration.rb +76 -0
- data/lib/restfulx/datamapper_foo.rb +31 -0
- data/lib/restfulx/rails/recipes.rb +60 -0
- data/lib/restfulx/rails/swf_helper.rb +60 -0
- data/lib/restfulx/tasks.rb +85 -0
- data/lib/restfulx.rb +117 -0
- data/rails_generators/emergent_cms/USAGE +5 -0
- data/rails_generators/emergent_cms/emergent_cms_generator.rb +21 -0
- data/rails_generators/emergent_cms/templates/PagesEditModel.as +114 -0
- data/rails_generators/emergent_cms/templates/PagesEditView.mxml +102 -0
- data/rails_generators/emergent_config/USAGE +5 -0
- data/rails_generators/emergent_config/emergent_config_generator.rb +330 -0
- data/rails_generators/emergent_config/templates/app/controllers/accounts_controller.rb +104 -0
- data/rails_generators/emergent_config/templates/app/controllers/addresses_controller.rb +97 -0
- data/rails_generators/emergent_config/templates/app/controllers/application.rb +26 -0
- data/rails_generators/emergent_config/templates/app/controllers/assets_controller.rb +1 -0
- data/rails_generators/emergent_config/templates/app/controllers/content_assignments_controller.rb +97 -0
- data/rails_generators/emergent_config/templates/app/controllers/contents_controller.rb +114 -0
- data/rails_generators/emergent_config/templates/app/controllers/sessions_controller.rb +72 -0
- data/rails_generators/emergent_config/templates/app/controllers/sites_controller.rb +1 -0
- data/rails_generators/emergent_config/templates/app/controllers/users_controller.rb +97 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/command/ICommand.as +16 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/command/Undoable.as +46 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/command/UpdateDocumentCommand.as +73 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/event/DocumentEvent.as +46 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/event/NavigationEvent.as +31 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/event/ResourceEvent.as +27 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/event/UndoEvent.as +36 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/AboutUsManager.as +15 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/AccountManager.as +31 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/AuthenticationManager.as +76 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/ContentManager.as +92 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/DocumentManager.as +131 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/DocumentsManager.as +156 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/HomeManager.as +18 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/MainManager.as +23 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/PagesManager.as +71 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/ResourceManager.as +195 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/SiteManager.as +25 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/manager/UndoManager.as +143 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/map/DocumentMap.mxml +123 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/map/DocumentsMap.mxml +134 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/map/ManagerPresentationModelMap.mxml +59 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/map/ObjectMap.mxml +75 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/map/PresentationModelViewMap.mxml +81 -0
- data/rails_generators/emergent_config/templates/app/flex/application/controllers/map/PresenterViewMap.mxml +67 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/constant/DocumentType.as +52 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/constant/Resource.as +25 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/constant/ResourceAction.as +28 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/constant/ResourceResult.as +8 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/Account.as +32 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/Address.as +26 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/Asset.as +25 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/AssetAssignment.as +25 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/Content.as +46 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/ContentAssignment.as +33 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/Document.as +131 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/PlainDocument.as +19 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/RichDocument.as +19 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/Session.as +13 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/Snapshot.as +21 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/domain/User.as +28 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/factory/DocumentFactory.as +61 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/factory/DocumentViewFactory.as +59 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/factory/ResourceFactory.as +28 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/AboutUsModel.as +22 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/AccountModel.as +68 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/AuthenticationModel.as +44 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/ContactUsModel.as +45 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/ContentModel.as +70 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/DocumentModel.as +235 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/DocumentsModel.as +169 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/HomeModel.as +23 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/MainModel.as +35 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/PagesModel.as +44 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/ProfileModel.as +99 -0
- data/rails_generators/emergent_config/templates/app/flex/application/models/presentation/ResourceModel.as +100 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/about_us/about_us.mxml +105 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/account/account.mxml +97 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/contact_us/contact_us.mxml +65 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/document/document.mxml +71 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/document/documents.mxml +201 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/document/plain_document.mxml +9 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/document/rich_document.mxml +12 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/gallery/gallery.mxml +37 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/home/home.mxml +58 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/home/home_presenter.as +81 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/home/home_troparchy.mxml +71 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/login/login.mxml +50 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/main/main.mxml +131 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/main/main_presenter.as +166 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/main/main_troparchy.mxml +74 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_bottom_model.as +13 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_bottom_presenter.as +10 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_bottom_view.mxml +48 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_left_model.as +13 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_left_presenter.as +10 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_left_view.mxml +43 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_right_model.as +13 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_right_presenter.as +10 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_right_view.mxml +47 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_top_model.as +13 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_top_presenter.as +10 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bar_top_view.mxml +49 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bars_presenter.as +63 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bars_troparchy.mxml +63 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/navigation/navigation_bars_view.mxml +59 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/pages/pages.mxml +44 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/pages/pages_presenter.as +83 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/pages/pages_troparchy.mxml +62 -0
- data/rails_generators/emergent_config/templates/app/flex/application/views/profile/profile.mxml +73 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/fonts/MyriadPro-Bold.otf +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/fonts/MyriadPro-Regular.otf +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/html/lorem.html +3 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture10.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture11.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture12.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture13.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture14.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture3.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture4.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture5.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture6.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture7.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture8.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/alexgrey/Picture9.png +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/hot_nebula_0.jpg +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/hot_nebula_180.jpg +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/hot_nebula_270.jpg +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/hot_nebula_90.jpg +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/hot_nebula_bottom.jpg +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/images/hot_nebula_top.jpg +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/styles/itunes7Bg.jpg +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/styles/jukebox.css +764 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/styles/jukeboxGfx.swf +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/styles/obsidian.css +734 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/styles/obsidianBg.jpg +0 -0
- data/rails_generators/emergent_config/templates/app/flex/assets/styles/obsidianGfx.swf +0 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/actions/LayoutAction.as +377 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/actions/SimpleLayoutAction.as +210 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/animators/FourDTweenCollection.mxml +50 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/animators/IAnimator.as +39 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/animators/TweenMaxAnimator.as +269 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/cameras/AstroCamera.as +177 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/components/FourDDataGrid.mxml +105 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/components/FourDItemRenderer.mxml +54 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/CenterPerspectiveProjection.as +72 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/ComplexCondition.as +44 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/ConditionsUtil.as +82 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/FourDComponent.as +309 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/InstanceMethodInvoker.as +50 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/InstancePropertyInjector.as +43 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/MethodCaller.as +51 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/Pathway.as +10 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/PathwayEvent.as +28 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/Pheron.as +34 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/Pheron2.as +41 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/PheronReceptor.as +125 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/Properties.as +57 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/Router.as +50 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/RouterUtil.as +70 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/SimpleCondition.as +42 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/SimpleZSortVO.as +1 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/SimpleZSorter.as +1 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/Tecton.as +70 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/Tecton2.as +234 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/TectonCache.as +111 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/TectonEvent.as +39 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/TectonMap.as +515 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/TectonMap2.as +289 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/TectonMapSample.mxml +73 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/TectonReceptor.as +43 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/TectonScope.as +38 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/TectonScopeProperties.as +18 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/core/TectonUtils.as +51 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/events/LayoutActionEvent.as +75 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/layouts/CarouselLayout.as +85 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/layouts/CircleLayout.as +102 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/layouts/CoverFlowLayout.as +136 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/layouts/FourDLayout.as +272 -0
- data/rails_generators/emergent_config/templates/app/flex/com/fourD/utils/TweenUtil.as +110 -0
- data/rails_generators/emergent_config/templates/app/helpers/accounts_helper.rb +93 -0
- data/rails_generators/emergent_config/templates/app/helpers/application_helper.rb +3 -0
- data/rails_generators/emergent_config/templates/app/models/account.rb +84 -0
- data/rails_generators/emergent_config/templates/app/models/account_mailer.rb +24 -0
- data/rails_generators/emergent_config/templates/app/models/account_observer.rb +17 -0
- data/rails_generators/emergent_config/templates/app/models/address.rb +2 -0
- data/rails_generators/emergent_config/templates/app/models/asset.rb +6 -0
- data/rails_generators/emergent_config/templates/app/models/asset_assignment.rb +4 -0
- data/rails_generators/emergent_config/templates/app/models/category.rb +35 -0
- data/rails_generators/emergent_config/templates/app/models/comment.rb +98 -0
- data/rails_generators/emergent_config/templates/app/models/content.rb +89 -0
- data/rails_generators/emergent_config/templates/app/models/content_assignment.rb +21 -0
- data/rails_generators/emergent_config/templates/app/models/image.rb +3 -0
- data/rails_generators/emergent_config/templates/app/models/post.rb +76 -0
- data/rails_generators/emergent_config/templates/app/models/section.rb +97 -0
- data/rails_generators/emergent_config/templates/app/models/site.rb +1 -0
- data/rails_generators/emergent_config/templates/app/models/tag.rb +1 -0
- data/rails_generators/emergent_config/templates/app/models/user.rb +4 -0
- data/rails_generators/emergent_config/templates/app/views/account_mailer/activation.erb +3 -0
- data/rails_generators/emergent_config/templates/app/views/account_mailer/signup_notification.erb +8 -0
- data/rails_generators/emergent_config/templates/config/Capfile +4 -0
- data/rails_generators/emergent_config/templates/config/README.txt +18 -0
- data/rails_generators/emergent_config/templates/config/deploy.rb +36 -0
- data/rails_generators/emergent_config/templates/config/routes.rb +72 -0
- data/rails_generators/emergent_config/templates/core/actionscript.properties +16 -0
- data/rails_generators/emergent_config/templates/core/actionscriptair.properties +16 -0
- data/rails_generators/emergent_config/templates/core/app.yaml.erb +12 -0
- data/rails_generators/emergent_config/templates/core/default_tasks.rake +51 -0
- data/rails_generators/emergent_config/templates/core/emergent_tasks.rake +42 -0
- data/rails_generators/emergent_config/templates/core/empty.txt +0 -0
- data/rails_generators/emergent_config/templates/core/expressInstall.swf +0 -0
- data/rails_generators/emergent_config/templates/core/flex.properties +2 -0
- data/rails_generators/emergent_config/templates/core/generate.rb +17 -0
- data/rails_generators/emergent_config/templates/core/html-template/AC_OETags.js +276 -0
- data/rails_generators/emergent_config/templates/core/html-template/history/history.css +6 -0
- data/rails_generators/emergent_config/templates/core/html-template/history/history.js +645 -0
- data/rails_generators/emergent_config/templates/core/html-template/history/historyFrame.html +29 -0
- data/rails_generators/emergent_config/templates/core/html-template/index.template.html +121 -0
- data/rails_generators/emergent_config/templates/core/html-template/playerProductInstall.swf +0 -0
- data/rails_generators/emergent_config/templates/core/index.html.erb +18 -0
- data/rails_generators/emergent_config/templates/core/index.yaml +11 -0
- data/rails_generators/emergent_config/templates/core/mainair-app.xml +134 -0
- data/rails_generators/emergent_config/templates/core/mainapp-config.xml +21 -0
- data/rails_generators/emergent_config/templates/core/mainapp.mxml +101 -0
- data/rails_generators/emergent_config/templates/core/project-textmate.erb +52 -0
- data/rails_generators/emergent_config/templates/core/project.properties +18 -0
- data/rails_generators/emergent_config/templates/core/projectair.properties +24 -0
- data/rails_generators/emergent_config/templates/core/restfulx.yml +14 -0
- data/rails_generators/emergent_config/templates/core/restfulx_tasks.rake +6 -0
- data/rails_generators/emergent_config/templates/core/swfobject.js +5 -0
- data/rails_generators/emergent_config/templates/db/migrate/create_accounts.rb +40 -0
- data/rails_generators/emergent_config/templates/db/migrate/create_addresses.rb +18 -0
- data/rails_generators/emergent_config/templates/db/migrate/create_asset_assignments.rb +19 -0
- data/rails_generators/emergent_config/templates/db/migrate/create_assets.rb +20 -0
- data/rails_generators/emergent_config/templates/db/migrate/create_content_assignments.rb +26 -0
- data/rails_generators/emergent_config/templates/db/migrate/create_contents.rb +21 -0
- data/rails_generators/emergent_config/templates/db/migrate/create_sessions.rb +16 -0
- data/rails_generators/emergent_config/templates/db/migrate/create_sites.rb +27 -0
- data/rails_generators/emergent_config/templates/db/migrate/create_users.rb +15 -0
- data/rails_generators/emergent_config/templates/lib/analytics.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/app_controller.rb.erb +26 -0
- data/rails_generators/emergent_config/templates/lib/as3corelib-0.92.1.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/as3crypto-1.3patched.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/as3crypto.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/as3ds-1.04.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/as3httpclientlib-1.0.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/authenticated_system.rb +189 -0
- data/rails_generators/emergent_config/templates/lib/authenticated_test_helper.rb +11 -0
- data/rails_generators/emergent_config/templates/lib/containerEx.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/flare.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/flash_session_hack.rb +27 -0
- data/rails_generators/emergent_config/templates/lib/flex2BrowserManager.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/flexlib.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/fluint.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/mate_0_8_6_enhanced.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/openflux.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/pv3d.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/restfulx.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/site_keys.rb +38 -0
- data/rails_generators/emergent_config/templates/lib/tweenMax.swc +0 -0
- data/rails_generators/emergent_config/templates/lib/urlkitFlex3.swc +0 -0
- data/rails_generators/emergent_config/templates/shell_script +31 -0
- data/rails_generators/emergent_controller/USAGE +5 -0
- data/rails_generators/emergent_controller/emergent_controller_generator.rb +25 -0
- data/rails_generators/emergent_controller/templates/controller.as.erb +37 -0
- data/rails_generators/emergent_core/USAGE +5 -0
- data/rails_generators/emergent_core/emergent_core_generator.rb +157 -0
- data/rails_generators/emergent_iphone/USAGE +5 -0
- data/rails_generators/emergent_iphone/emergent_iphone_generator.rb +27 -0
- data/rails_generators/emergent_scaffold/USAGE +5 -0
- data/rails_generators/emergent_scaffold/emergent_scaffold_generator.rb +157 -0
- data/rails_generators/emergent_scaffold/templates/component.mxml.erb +101 -0
- data/rails_generators/emergent_scaffold/templates/controller.rb.erb +101 -0
- data/rails_generators/emergent_scaffold/templates/edit_index_view.mxml.erb +114 -0
- data/rails_generators/emergent_scaffold/templates/edit_show_view.mxml.erb +84 -0
- data/rails_generators/emergent_scaffold/templates/filter_view.mxml.erb +1 -0
- data/rails_generators/emergent_scaffold/templates/fixtures.yml.erb +128 -0
- data/rails_generators/emergent_scaffold/templates/index_view.mxml.erb +58 -0
- data/rails_generators/emergent_scaffold/templates/item_renderer.mxml.erb +53 -0
- data/rails_generators/emergent_scaffold/templates/manager.as.erb +31 -0
- data/rails_generators/emergent_scaffold/templates/migration.rb.erb +22 -0
- data/rails_generators/emergent_scaffold/templates/model.as.erb +42 -0
- data/rails_generators/emergent_scaffold/templates/model.rb.erb +11 -0
- data/rails_generators/emergent_scaffold/templates/presentation_model.as.erb +33 -0
- data/rails_generators/emergent_scaffold/templates/presenter.as.erb +98 -0
- data/rails_generators/emergent_scaffold/templates/show_view.mxml.erb +50 -0
- data/rails_generators/emergent_scaffold/templates/view_map.mxml.erb +40 -0
- data/rails_generators/emergent_scaffold/templates/views_panel.mxml.erb +64 -0
- data/rails_generators/emergent_styler/USAGE +5 -0
- data/rails_generators/emergent_styler/emergent_styler_generator.rb +21 -0
- data/rails_generators/rx_yaml_scaffold/USAGE +51 -0
- data/rails_generators/rx_yaml_scaffold/rx_yaml_scaffold_generator.rb +49 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/emergent_core_spec.rb +7 -0
- data/spec/spec_helper.rb +16 -0
- data/tasks/ann.rake +80 -0
- data/tasks/bones.rake +20 -0
- data/tasks/gem.rake +201 -0
- data/tasks/git.rake +40 -0
- data/tasks/manifest.rake +48 -0
- data/tasks/notes.rake +27 -0
- data/tasks/post_load.rake +39 -0
- data/tasks/rdoc.rake +50 -0
- data/tasks/rubyforge.rake +55 -0
- data/tasks/setup.rb +279 -0
- data/tasks/spec.rake +54 -0
- data/tasks/svn.rake +47 -0
- data/tasks/test.rake +40 -0
- data/test/test_emergent_core.rb +0 -0
- data/test/test_emergent_iphone_generator.rb +46 -0
- data/test/test_generator_helper.rb +29 -0
- metadata +437 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
module AccountsHelper
|
2
|
+
|
3
|
+
#
|
4
|
+
# Use this to wrap view elements that the user can't access.
|
5
|
+
# !! Note: this is an *interface*, not *security* feature !!
|
6
|
+
# You need to do all access control at the controller level.
|
7
|
+
#
|
8
|
+
# Example:
|
9
|
+
# <%= if_authorized?(:index, User) do link_to('List all users', users_path) end %> |
|
10
|
+
# <%= if_authorized?(:edit, @user) do link_to('Edit this user', edit_user_path) end %> |
|
11
|
+
# <%= if_authorized?(:destroy, @user) do link_to 'Destroy', @user, :confirm => 'Are you sure?', :method => :delete end %>
|
12
|
+
#
|
13
|
+
#
|
14
|
+
def if_authorized?(action, resource, &block)
|
15
|
+
if authorized?(action, resource)
|
16
|
+
yield action, resource
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# Link to user's page ('accounts/1')
|
22
|
+
#
|
23
|
+
# By default, their login is used as link text and link title (tooltip)
|
24
|
+
#
|
25
|
+
# Takes options
|
26
|
+
# * :content_text => 'Content text in place of account.login', escaped with
|
27
|
+
# the standard h() function.
|
28
|
+
# * :content_method => :account_instance_method_to_call_for_content_text
|
29
|
+
# * :title_method => :account_instance_method_to_call_for_title_attribute
|
30
|
+
# * as well as link_to()'s standard options
|
31
|
+
#
|
32
|
+
# Examples:
|
33
|
+
# link_to_account @account
|
34
|
+
# # => <a href="/accounts/3" title="barmy">barmy</a>
|
35
|
+
#
|
36
|
+
# # if you've added a .name attribute:
|
37
|
+
# content_tag :span, :class => :vcard do
|
38
|
+
# (link_to_account account, :class => 'fn n', :title_method => :login, :content_method => :name) +
|
39
|
+
# ': ' + (content_tag :span, account.email, :class => 'email')
|
40
|
+
# end
|
41
|
+
# # => <span class="vcard"><a href="/accounts/3" title="barmy" class="fn n">Cyril Fotheringay-Phipps</a>: <span class="email">barmy@blandings.com</span></span>
|
42
|
+
#
|
43
|
+
# link_to_account @account, :content_text => 'Your user page'
|
44
|
+
# # => <a href="/accounts/3" title="barmy" class="nickname">Your user page</a>
|
45
|
+
#
|
46
|
+
def link_to_account(account, options={})
|
47
|
+
raise "Invalid account" unless account
|
48
|
+
options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname
|
49
|
+
content_text = options.delete(:content_text)
|
50
|
+
content_text ||= account.send(options.delete(:content_method))
|
51
|
+
options[:title] ||= account.send(options.delete(:title_method))
|
52
|
+
link_to h(content_text), account_path(account), options
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# Link to login page using remote ip address as link content
|
57
|
+
#
|
58
|
+
# The :title (and thus, tooltip) is set to the IP address
|
59
|
+
#
|
60
|
+
# Examples:
|
61
|
+
# link_to_login_with_IP
|
62
|
+
# # => <a href="/login" title="169.69.69.69">169.69.69.69</a>
|
63
|
+
#
|
64
|
+
# link_to_login_with_IP :content_text => 'not signed in'
|
65
|
+
# # => <a href="/login" title="169.69.69.69">not signed in</a>
|
66
|
+
#
|
67
|
+
def link_to_login_with_IP content_text=nil, options={}
|
68
|
+
ip_addr = request.remote_ip
|
69
|
+
content_text ||= ip_addr
|
70
|
+
options.reverse_merge! :title => ip_addr
|
71
|
+
if tag = options.delete(:tag)
|
72
|
+
content_tag tag, h(content_text), options
|
73
|
+
else
|
74
|
+
link_to h(content_text), login_path, options
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# Link to the current user's page (using link_to_account) or to the login page
|
80
|
+
# (using link_to_login_with_IP).
|
81
|
+
#
|
82
|
+
def link_to_current_account(options={})
|
83
|
+
if current_account
|
84
|
+
link_to_account current_account, options
|
85
|
+
else
|
86
|
+
content_text = options.delete(:content_text) || 'not signed in'
|
87
|
+
# kill ignored options from link_to_account
|
88
|
+
[:content_method, :title_method].each{|opt| options.delete(opt)}
|
89
|
+
link_to_login_with_IP content_text, options
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
|
3
|
+
class Account < ActiveRecord::Base
|
4
|
+
include Authentication
|
5
|
+
include Authentication::ByPassword
|
6
|
+
include Authentication::ByCookieToken
|
7
|
+
include Authorization::AasmRoles
|
8
|
+
|
9
|
+
DEFAULT_PHOTO_URL = '/images/avatar-missing.png'
|
10
|
+
|
11
|
+
validates_presence_of :login
|
12
|
+
validates_length_of :login, :within => 3..40
|
13
|
+
validates_uniqueness_of :login
|
14
|
+
validates_format_of :login, :with => Authentication.login_regex, :message => Authentication.bad_login_message
|
15
|
+
|
16
|
+
# validates_format_of :first_name, :with => Authentication.name_regex, :message => Authentication.bad_name_message, :allow_nil => true
|
17
|
+
# validates_length_of :first_name, :maximum => 100
|
18
|
+
|
19
|
+
# validates_format_of :last_name, :with => Authentication.name_regex, :message => Authentication.bad_name_message, :allow_nil => true
|
20
|
+
# validates_length_of :last_name, :maximum => 100
|
21
|
+
|
22
|
+
validates_presence_of :email
|
23
|
+
validates_length_of :email, :within => 6..100 #r@a.wk
|
24
|
+
validates_uniqueness_of :email
|
25
|
+
validates_format_of :email, :with => Authentication.email_regex, :message => Authentication.bad_email_message
|
26
|
+
|
27
|
+
has_one :user
|
28
|
+
|
29
|
+
has_attached_file :avatar, :styles => {:thumb => '100x100>'} # doesn't resize for some reason, check!
|
30
|
+
|
31
|
+
# has_attachment :content_type => :image,
|
32
|
+
# :storage => :file_system,
|
33
|
+
# :resize_to => '100x100>',
|
34
|
+
# :path_prefix => 'public/images/accounts'
|
35
|
+
|
36
|
+
cattr_accessor :current_account, :session_token
|
37
|
+
|
38
|
+
# HACK HACK HACK -- how to do attr_accessible from here?
|
39
|
+
# prevents a user from submitting a crafted form that bypasses activation
|
40
|
+
# anything else you want your user to change should be added here.
|
41
|
+
attr_accessible :login, :email, :first_name, :last_name, :password, :password_confirmation, :session_token, :avatar #:uploaded_data
|
42
|
+
|
43
|
+
# Authenticates a user by their login name and unencrypted password. Returns the user or nil.
|
44
|
+
#
|
45
|
+
# uff. this is really an authorization, not authentication routine.
|
46
|
+
# We really need a Dispatch Chain here or something.
|
47
|
+
# This will also let us return a human error message.
|
48
|
+
#
|
49
|
+
def self.authenticate(login, password)
|
50
|
+
return nil if login.blank? || password.blank?
|
51
|
+
u = find_in_state :first, :pending, :conditions => {:login => login} # need to get the salt
|
52
|
+
u && u.authenticated?(password) ? u : nil
|
53
|
+
end
|
54
|
+
|
55
|
+
def session_token
|
56
|
+
Account.session_token
|
57
|
+
end
|
58
|
+
|
59
|
+
def login=(value)
|
60
|
+
write_attribute :login, (value ? value.downcase : nil)
|
61
|
+
end
|
62
|
+
|
63
|
+
def email=(value)
|
64
|
+
write_attribute :email, (value ? value.downcase : nil)
|
65
|
+
end
|
66
|
+
|
67
|
+
def photo_url
|
68
|
+
begin
|
69
|
+
#public_filename
|
70
|
+
avatar.url(:original)
|
71
|
+
rescue
|
72
|
+
DEFAULT_PHOTO_URL
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
protected
|
77
|
+
|
78
|
+
def make_activation_code
|
79
|
+
self.deleted_at = nil
|
80
|
+
self.activation_code = self.class.make_token
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class AccountMailer < ActionMailer::Base
|
2
|
+
def signup_notification(account)
|
3
|
+
setup_email(account)
|
4
|
+
subject += 'Please activate your new account'
|
5
|
+
|
6
|
+
body[:url] = "http://localhost:3000/activate/#{account.activation_code}"
|
7
|
+
|
8
|
+
end
|
9
|
+
|
10
|
+
def activation(account)
|
11
|
+
setup_email(account)
|
12
|
+
subject += 'Your account has been activated!'
|
13
|
+
body[:url] = "http://localhost:3000/"
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
def setup_email(account)
|
18
|
+
recipients = "#{account.email}"
|
19
|
+
from = "Administrator"
|
20
|
+
subject = "[pomodo] "
|
21
|
+
sent_on = Time.now
|
22
|
+
body[:account] = account
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class AccountObserver < ActiveRecord::Observer
|
2
|
+
def after_create(account)
|
3
|
+
# AccountMailer.deliver_signup_notification(account)
|
4
|
+
|
5
|
+
address = Address.new
|
6
|
+
address.save!
|
7
|
+
|
8
|
+
user = User.new
|
9
|
+
user.account = account
|
10
|
+
user.address = address
|
11
|
+
user.save!
|
12
|
+
end
|
13
|
+
|
14
|
+
def after_save(account)
|
15
|
+
# AccountMailer.deliver_activation(account) if account.recently_activated?
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
class Asset < ActiveRecord::Base
|
2
|
+
has_many :contents, :through => :asset_assignments
|
3
|
+
has_many :asset_assignments, :order => 'position', :dependent => :delete_all
|
4
|
+
|
5
|
+
has_attached_file :attachment, :styles => {:thumb => '100x100>'} # doesn't resize for some reason, check!
|
6
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class Category < ActiveRecord::Base
|
2
|
+
|
3
|
+
acts_as_nested_set
|
4
|
+
has_permalink :title, :scope => :section_id
|
5
|
+
|
6
|
+
belongs_to :section, :foreign_key => 'section_id'
|
7
|
+
has_many :contents, :through => :category_assignments
|
8
|
+
has_many :category_assignments, :dependent => :delete_all
|
9
|
+
|
10
|
+
before_validation :set_path
|
11
|
+
|
12
|
+
validates_presence_of :section, :title
|
13
|
+
validates_uniqueness_of :permalink, :scope => :section_id
|
14
|
+
|
15
|
+
def set_path
|
16
|
+
new_path = build_path
|
17
|
+
unless self.path == new_path
|
18
|
+
self.path = new_path
|
19
|
+
@paths_dirty = true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def update_child_paths
|
24
|
+
return unless @paths_dirty
|
25
|
+
self.all_children.each do |child|
|
26
|
+
child.path = child.build_path
|
27
|
+
child.save
|
28
|
+
end
|
29
|
+
@paths_dirty = false
|
30
|
+
end
|
31
|
+
|
32
|
+
def build_path
|
33
|
+
self_and_ancestors.map(&:permalink).join('/')
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
class Comment < Content
|
2
|
+
|
3
|
+
acts_as_role_context # :parent => Content
|
4
|
+
|
5
|
+
filtered_column :body
|
6
|
+
filters_attributes :sanitize => :body_html
|
7
|
+
|
8
|
+
belongs_to :site
|
9
|
+
belongs_to :section
|
10
|
+
belongs_to :commentable, :polymorphic => true
|
11
|
+
belongs_to_author
|
12
|
+
|
13
|
+
validates_presence_of :body, :commentable
|
14
|
+
|
15
|
+
before_validation :set_owners
|
16
|
+
before_create :authorize_commenting
|
17
|
+
after_save :update_commentable
|
18
|
+
after_destroy :update_commentable
|
19
|
+
|
20
|
+
def owner
|
21
|
+
commentable
|
22
|
+
end
|
23
|
+
|
24
|
+
def filter
|
25
|
+
commentable.comment_filter
|
26
|
+
end
|
27
|
+
|
28
|
+
def unapproved?
|
29
|
+
!approved?
|
30
|
+
end
|
31
|
+
|
32
|
+
def just_approved?
|
33
|
+
approved_changed? and approved?
|
34
|
+
end
|
35
|
+
|
36
|
+
def just_unapproved?
|
37
|
+
approved_changed? and unapproved?
|
38
|
+
end
|
39
|
+
|
40
|
+
def state_changes
|
41
|
+
state_changes = if just_approved?
|
42
|
+
[:approved]
|
43
|
+
elsif just_unapproved?
|
44
|
+
[:unapproved]
|
45
|
+
end || []
|
46
|
+
super + state_changes
|
47
|
+
end
|
48
|
+
|
49
|
+
def spam_info
|
50
|
+
read_attribute(:spam_info) || {}
|
51
|
+
end
|
52
|
+
|
53
|
+
has_many :spam_reports, :as => :subject
|
54
|
+
|
55
|
+
def spam_threshold
|
56
|
+
51 # TODO have a config option on site for this
|
57
|
+
end
|
58
|
+
|
59
|
+
def ham?
|
60
|
+
spaminess < spam_threshold
|
61
|
+
end
|
62
|
+
|
63
|
+
def spam?
|
64
|
+
spaminess >= spam_threshold
|
65
|
+
end
|
66
|
+
|
67
|
+
def check_approval(context = {})
|
68
|
+
section.spam_engine.check_comment(self, context)
|
69
|
+
self.spaminess = calculate_spaminess
|
70
|
+
self.approved = ham?
|
71
|
+
save!
|
72
|
+
end
|
73
|
+
|
74
|
+
def calculate_spaminess
|
75
|
+
sum = spam_reports(true).inject(0){|sum, report| sum + report.spaminess }
|
76
|
+
sum > 0 ? sum / spam_reports.count : 0
|
77
|
+
end
|
78
|
+
|
79
|
+
protected
|
80
|
+
|
81
|
+
def authorize_commenting
|
82
|
+
if commentable && !commentable.accept_comments?
|
83
|
+
raise CommentNotAllowed, I18n.t(:'adva.comments.messages.not_allowed')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def set_owners
|
88
|
+
if commentable # TODO in what cases would commentable be nil here?
|
89
|
+
self.site = commentable.site
|
90
|
+
self.section = commentable.section
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def update_commentable
|
95
|
+
owner.after_comment_update(self) if owner && owner.respond_to?(:after_comment_update)
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
class Content < ActiveRecord::Base
|
2
|
+
has_many :content_assignments
|
3
|
+
has_many :asset_assignments
|
4
|
+
has_many :assets, :through => :asset_assignments
|
5
|
+
|
6
|
+
def self.find_entire_tree(builder=nil)
|
7
|
+
# add something here to get the content, not the assignment
|
8
|
+
to_fxml(:builder => builder, :skip_instruct => true) do |fxml|
|
9
|
+
ContentAssignment.roots(:first, :conditions => {:content_id => self.id}).children.each do |child|
|
10
|
+
child.content.to_fxml_content_tree(fxml)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_fxml_content_tree(builder=nil)
|
16
|
+
# add something here to get the content, not the assignment
|
17
|
+
to_fxml(:builder => builder, :skip_instruct => true) do |fxml|
|
18
|
+
ContentAssignment.find(:first, :conditions => {:content_id => self.id}).children.each do |child|
|
19
|
+
child.content.to_fxml_content_tree(fxml)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def desc
|
25
|
+
@content_assignments = []
|
26
|
+
@procs = []
|
27
|
+
ContentAssignment.find(:first, :conditions => {:target_id => self.id}).descendants.each do |child|
|
28
|
+
proc = Proc.new do |opts|
|
29
|
+
opts[:builder].tag!('parent_id', child.parent.target_id)
|
30
|
+
end
|
31
|
+
@content_assignments.push(child)
|
32
|
+
@procs.push(proc)
|
33
|
+
end
|
34
|
+
to_fxml(:child_proc => @procs)
|
35
|
+
end
|
36
|
+
|
37
|
+
def descendants(builder=nil)
|
38
|
+
@children = []
|
39
|
+
@parent_ids = []
|
40
|
+
@contents = []
|
41
|
+
ContentAssignment.find(:first, :conditions => {:target_id => self.id}).self_and_descendants.each do |child|
|
42
|
+
proc = Proc.new do |opts|
|
43
|
+
opts[:builder].tag!('parent_id', child.source_id)
|
44
|
+
end
|
45
|
+
# CAN'T JUST PUSH THEM IN, THE ID's GET ALL SCREWED UP
|
46
|
+
@children.push(child)
|
47
|
+
@parent_ids.push(proc)
|
48
|
+
end
|
49
|
+
@contents = self.class.find(@children).to_fxml(:child_proc => @parent_ids)
|
50
|
+
end
|
51
|
+
|
52
|
+
def descendants2(builder=nil)
|
53
|
+
@children = []
|
54
|
+
@parent_ids = []
|
55
|
+
@contents = []
|
56
|
+
@nodes = {}
|
57
|
+
@tmp = []
|
58
|
+
ContentAssignment.find(:first, :conditions => {:target_id => self.id}).self_and_descendants.each do |child|
|
59
|
+
proc = Proc.new do |opts|
|
60
|
+
opts[:builder].tag!('parent_id', child.source_id)
|
61
|
+
end
|
62
|
+
# CAN'T JUST PUSH THEM IN, THE ID's GET ALL SCREWED UP
|
63
|
+
@parent_ids.push(proc)
|
64
|
+
if !@nodes[child.source_id]
|
65
|
+
@nodes[child.source_id] = true
|
66
|
+
@children.push(child)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
@contents = self.class.find(@children)
|
70
|
+
@parent_ids.each do |node|
|
71
|
+
if node
|
72
|
+
end
|
73
|
+
to_fxml(:child_proc => @parent_ids)
|
74
|
+
end
|
75
|
+
|
76
|
+
def to_xml_content_tree(builder=nil)
|
77
|
+
# add something here to get the content, not the assignment
|
78
|
+
to_xml(:builder => builder, :skip_instruct => true) do |xml|
|
79
|
+
ContentAssignment.find(:first, :conditions => {:content_id => self.id}).children.each do |child|
|
80
|
+
child.content.to_xml_content_tree(xml)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def parent
|
86
|
+
@parent = ContentAssignment.find(:first, :conditions => {:content_id => self.id}).parent.content
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class ContentLink < ActiveRecord::Base
|
2
|
+
belongs_to :content_node, :class_name => "ContentNode", :foreign_key => "target_id"
|
3
|
+
acts_as_nested_set(:parent_column => "ancestor_id")
|
4
|
+
|
5
|
+
def full_xml(builder=nil)
|
6
|
+
# add something here to get the content, not the assignment
|
7
|
+
to_xml(:builder => builder, :skip_instruct => true) do |xml|
|
8
|
+
children.each { |child| child.full_xml(xml) }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.find_parent_content_by_content_id(content_id)
|
13
|
+
@parent_content = find(:all, :conditions => {:content_id => content_id}).parent.content
|
14
|
+
return @parent_content
|
15
|
+
end
|
16
|
+
|
17
|
+
#before filter on controller:
|
18
|
+
def title
|
19
|
+
#name += "Link between #{source} and #{target}"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class Post < Content
|
2
|
+
|
3
|
+
filters_attributes :except => [:excerpt, :excerpt_html, :body, :body_html, :cached_tag_list]
|
4
|
+
write_inheritable_attribute :default_find_options, { :order => 'contents.published_at desc' }
|
5
|
+
|
6
|
+
before_create :set_position
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def find_by_permalink(*args)
|
10
|
+
options = args.extract_options!
|
11
|
+
if args.size > 1
|
12
|
+
permalink = args.pop
|
13
|
+
with_time_delta(*args) do find_by_permalink(permalink, options) end
|
14
|
+
else
|
15
|
+
find :first, options.merge(:conditions => ['permalink = ?', args.first])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def full_permalink
|
21
|
+
raise "can not create full_permalink for an article that belongs to a non-blog section" unless section.is_a? Blog
|
22
|
+
# raise "can not create full_permalink for an unpublished article" unless published?
|
23
|
+
date = [:year, :month, :day].map { |key| [key, (published? ? published_at : created_at).send(key)] }.flatten
|
24
|
+
Hash[:permalink, permalink, *date]
|
25
|
+
end
|
26
|
+
|
27
|
+
def primary?
|
28
|
+
section.articles.primary == self
|
29
|
+
end
|
30
|
+
|
31
|
+
def accept_comments?
|
32
|
+
published? && (comment_age > -1) && (comment_age == 0 || comments_expired_at > Time.zone.now)
|
33
|
+
end
|
34
|
+
|
35
|
+
def has_excerpt?
|
36
|
+
!excerpt.blank?
|
37
|
+
end
|
38
|
+
|
39
|
+
def published_month
|
40
|
+
Time.local published_at.year, published_at.month, 1
|
41
|
+
end
|
42
|
+
|
43
|
+
def draft?
|
44
|
+
published_at.nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
def pending?
|
48
|
+
!published?
|
49
|
+
end
|
50
|
+
|
51
|
+
def published?
|
52
|
+
!published_at.nil? and published_at <= Time.zone.now
|
53
|
+
end
|
54
|
+
|
55
|
+
def published_at?(date)
|
56
|
+
published? and date == [:year, :month, :day].map {|key| published_at.send(key).to_s }
|
57
|
+
end
|
58
|
+
|
59
|
+
def state
|
60
|
+
pending? ? :pending : :published
|
61
|
+
end
|
62
|
+
|
63
|
+
def previous
|
64
|
+
section.articles.find_published :first, :conditions => ['published_at < ?', published_at], :order => :published_at
|
65
|
+
end
|
66
|
+
|
67
|
+
def next
|
68
|
+
section.articles.find_published :first, :conditions => ['published_at > ?', published_at], :order => :published_at
|
69
|
+
end
|
70
|
+
|
71
|
+
protected
|
72
|
+
|
73
|
+
def set_position
|
74
|
+
self.position ||= section.articles.maximum(:position).to_i + 1 if section
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
class Section < Content
|
2
|
+
|
3
|
+
@@types = ['Section']
|
4
|
+
cattr_reader :types
|
5
|
+
|
6
|
+
acts_as_role_context :actions => ["create article", "update article", "delete article"],
|
7
|
+
:parent => Site
|
8
|
+
|
9
|
+
|
10
|
+
serialize :permissions
|
11
|
+
|
12
|
+
has_option :articles_per_page, :default => 15
|
13
|
+
has_permalink :title, :scope => :site_id
|
14
|
+
acts_as_nested_set
|
15
|
+
has_many_comments
|
16
|
+
instantiates_with_sti
|
17
|
+
|
18
|
+
belongs_to :site
|
19
|
+
has_many :articles, :foreign_key => 'section_id', :dependent => :destroy do
|
20
|
+
def primary
|
21
|
+
find_published :first, :order => :position
|
22
|
+
end
|
23
|
+
|
24
|
+
def permalinks
|
25
|
+
find_published(:all).map(&:permalink)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
has_many :categories, :dependent => :destroy, :order => 'lft' do
|
30
|
+
def roots
|
31
|
+
find :all, :conditions => {:parent_id => nil}, :order => 'lft'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
before_validation :set_path, :set_comment_age
|
36
|
+
|
37
|
+
validates_presence_of :title # :site wtf ... this breaks install_controller#index
|
38
|
+
validates_uniqueness_of :permalink, :scope => :site_id
|
39
|
+
validates_numericality_of :articles_per_page, :only_integer => true, :message => :only_integer
|
40
|
+
|
41
|
+
# TODO validates_inclusion_of :articles_per_page, :in => 1..30, :message => "can only be between 1 and 30."
|
42
|
+
|
43
|
+
delegate :spam_engine, :to => :site
|
44
|
+
|
45
|
+
class << self
|
46
|
+
def register_type(type)
|
47
|
+
@@types << type
|
48
|
+
@@types.uniq!
|
49
|
+
end
|
50
|
+
|
51
|
+
def content_type
|
52
|
+
'Article'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def owner
|
57
|
+
site
|
58
|
+
end
|
59
|
+
|
60
|
+
def type
|
61
|
+
read_attribute(:type) || 'Section'
|
62
|
+
end
|
63
|
+
|
64
|
+
def tag_counts
|
65
|
+
Content.tag_counts :conditions => "section_id = #{id}"
|
66
|
+
end
|
67
|
+
|
68
|
+
def render_options(options = {:template => nil, :layout => nil})
|
69
|
+
options.merge options.keys.inject({}) { |options, type|
|
70
|
+
value = send(type)
|
71
|
+
options[type] = value.sub /^templates\//, '' unless value.blank?
|
72
|
+
options
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
def root_section?
|
77
|
+
self == site.sections.root
|
78
|
+
end
|
79
|
+
|
80
|
+
def accept_comments?
|
81
|
+
comment_age.to_i > -1
|
82
|
+
end
|
83
|
+
|
84
|
+
protected
|
85
|
+
|
86
|
+
def set_comment_age
|
87
|
+
self.comment_age ||= -1
|
88
|
+
end
|
89
|
+
|
90
|
+
def set_path
|
91
|
+
self.path = build_path
|
92
|
+
end
|
93
|
+
|
94
|
+
def build_path
|
95
|
+
self_and_ancestors.map(&:permalink).join('/')
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
controller.as.erb
|
@@ -0,0 +1 @@
|
|
1
|
+
controller.as.erb
|