constructor-cms 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.idea/.name +1 -0
- data/.idea/constructor.iml +62 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/.idea/workspace.xml +873 -0
- data/.rspec +2 -0
- data/cap/app/assets/images/constructor_cap/cross.png +0 -0
- data/cap/app/assets/images/constructor_cap/page_white_edit.png +0 -0
- data/cap/app/controllers/constructor_cap/emails_controller.rb +71 -0
- data/cap/app/models/constructor_cap/email.rb +15 -0
- data/cap/app/views/constructor_cap/emails/_form.haml +17 -0
- data/cap/app/views/constructor_cap/emails/edit.haml +5 -0
- data/cap/app/views/constructor_cap/emails/index.haml +27 -0
- data/cap/app/views/constructor_cap/emails/new.haml +5 -0
- data/cap/app/views/constructor_cap/emails/show.haml +54 -0
- data/cap/config/initializers/admin_menu.rb +4 -0
- data/cap/config/locales/ru.yml +23 -0
- data/cap/config/routes.rb +9 -0
- data/cap/constructor-cap.gemspec +19 -0
- data/cap/db/migrate/20110510182404_create_emails.rb +12 -0
- data/cap/lib/constructor-cap.rb +2 -0
- data/cap/lib/constructor_cap/engine.rb +6 -0
- data/config/routes.rb +4 -0
- data/constructor-cms.gemspec +21 -0
- data/core/app/assets/images/constructor_core/glyphicons-halflings-white.png +0 -0
- data/core/app/assets/images/constructor_core/glyphicons-halflings.png +0 -0
- data/core/app/assets/images/constructor_core/minus.gif +0 -0
- data/core/app/assets/images/constructor_core/plus.gif +0 -0
- data/core/app/assets/images/constructor_core/rss.png +0 -0
- data/core/app/assets/images/constructor_core/treeview-black-line.gif +0 -0
- data/core/app/assets/images/constructor_core/treeview-black.gif +0 -0
- data/core/app/assets/images/constructor_core/treeview-default-line.gif +0 -0
- data/core/app/assets/images/constructor_core/treeview-default.gif +0 -0
- data/core/app/assets/images/constructor_core/treeview-famfamfam-line.gif +0 -0
- data/core/app/assets/images/constructor_core/treeview-famfamfam.gif +0 -0
- data/core/app/assets/images/constructor_core/treeview-gray-line.gif +0 -0
- data/core/app/assets/images/constructor_core/treeview-gray.gif +0 -0
- data/core/app/assets/images/constructor_core/treeview-red-line.gif +0 -0
- data/core/app/assets/images/constructor_core/treeview-red.gif +0 -0
- data/core/app/assets/images/constructor_core/twitter.png +0 -0
- data/core/app/assets/images/constructor_core/widgets.png +0 -0
- data/core/app/assets/javascripts/constructor_core/application.js.coffee +57 -0
- data/core/app/assets/javascripts/constructor_core/bootstrap.js +2276 -0
- data/core/app/assets/javascripts/constructor_core/jquery.cookie.js +92 -0
- data/core/app/assets/javascripts/constructor_core/jquery.treeview.js +256 -0
- data/core/app/assets/javascripts/constructor_core/jquery_bundle.js.coffee +4 -0
- data/core/app/assets/javascripts/constructor_core/urlify.js +82 -0
- data/core/app/assets/stylesheets/constructor_core/application.css.scss +57 -0
- data/core/app/assets/stylesheets/constructor_core/bootstrap-responsive.css +1109 -0
- data/core/app/assets/stylesheets/constructor_core/bootstrap.css +6158 -0
- data/core/app/assets/stylesheets/constructor_core/jquery.treeview.css +73 -0
- data/core/app/controllers/constructor_core/admin_controller.rb +6 -0
- data/core/app/controllers/constructor_core/sessions_controller.rb +15 -0
- data/core/app/helpers/constructor_core/devise_helper.rb +24 -0
- data/core/app/models/constructor_core/user.rb +10 -0
- data/core/app/views/constructor_core/devise/confirmations/new.html.haml +10 -0
- data/core/app/views/constructor_core/devise/mailer/confirmation_instructions.html.haml +5 -0
- data/core/app/views/constructor_core/devise/mailer/reset_password_instructions.html.haml +7 -0
- data/core/app/views/constructor_core/devise/mailer/unlock_instructions.html.haml +5 -0
- data/core/app/views/constructor_core/devise/passwords/edit.html.haml +21 -0
- data/core/app/views/constructor_core/devise/passwords/new.html.haml +13 -0
- data/core/app/views/constructor_core/devise/registrations/edit.html.haml +28 -0
- data/core/app/views/constructor_core/devise/registrations/new.html.haml +20 -0
- data/core/app/views/constructor_core/devise/shared/_links.html.haml +19 -0
- data/core/app/views/constructor_core/devise/unlocks/new.html.haml +9 -0
- data/core/app/views/constructor_core/sessions/new.html.haml +24 -0
- data/core/app/views/layouts/constructor_core/application_admin.haml +65 -0
- data/core/config/environments/production.rb +3 -0
- data/core/config/initializers/devise.rb +223 -0
- data/core/config/locales/devise.en.yml +56 -0
- data/core/config/locales/devise.ru.yml +52 -0
- data/core/config/locales/ru.yml +12 -0
- data/core/config/routes.rb +9 -0
- data/core/constructor-core.gemspec +16 -0
- data/core/db/migrate/1_devise_users.rb +56 -0
- data/core/db/migrate/2_add_default_user.rb +9 -0
- data/core/lib/constructor-core.rb +23 -0
- data/core/lib/constructor_core/engine.rb +6 -0
- data/core/spec/factories.rb +2 -0
- data/core/spec/lib/nav/group_spec.rb +61 -0
- data/core/spec/lib/nav/item_spec.rb +151 -0
- data/core/spec/lib/nav_lib_spec.rb +60 -0
- data/core/spec/spec_helper.rb +34 -0
- data/core/vendor/assets/javascripts/.gitkeep +0 -0
- data/core/vendor/assets/javascripts/ckeditor/ckeditor.js +913 -0
- data/core/vendor/assets/javascripts/ckeditor/config.js +38 -0
- data/core/vendor/assets/javascripts/ckeditor/lang/en.js +5 -0
- data/core/vendor/assets/javascripts/ckeditor/lang/ru.js +5 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/_translationstatus.txt +25 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ar.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/bg.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ca.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cs.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cy.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/da.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/de.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/el.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/eo.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/es.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/et.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fa.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fi.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fr.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/gu.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/he.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hi.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hr.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hu.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/it.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ja.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/km.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ku.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/lt.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/lv.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/mk.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/mn.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nb.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nl.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/no.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pl.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt-br.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ro.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sk.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sl.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sv.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/th.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/tr.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ug.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/uk.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/vi.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/zh-cn.js +7 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +6 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +11 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +4 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/fakeobjects/images/spacer.gif +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +24 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/icons.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/iframe/images/placeholder.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +43 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/image/images/noimage.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +8 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +36 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/link/images/anchor.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/magicline/images/icon.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +31 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/preview/preview.html +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/scayt/LICENSE.md +28 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/scayt/README.md +25 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +20 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/scayt/dialogs/toolbar.css +71 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_address.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_div.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_p.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/_translationstatus.txt +20 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ca.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/cs.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/cy.js +14 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/de.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/el.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/eo.js +12 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/et.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fa.js +12 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fi.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fr.js +11 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/he.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/hr.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/it.js +14 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ku.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/lv.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/nb.js +11 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/nl.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/no.js +11 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pl.js +12 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pt-br.js +11 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sk.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sv.js +11 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/th.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/tr.js +12 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ug.js +13 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/zh-cn.js +9 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +14 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +21 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +16 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +84 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +10 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/templates/templates/default.js +6 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/wsc/LICENSE.md +28 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/wsc/README.md +25 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/ciframe.html +49 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +52 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.css +82 -0
- data/core/vendor/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +11 -0
- data/core/vendor/assets/javascripts/ckeditor/styles.js +111 -0
- data/core/vendor/assets/stylesheets/.gitkeep +0 -0
- data/core/vendor/assets/stylesheets/ckeditor/contents.css +103 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/dialog.css +5 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/dialog_ie.css +5 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/dialog_ie7.css +5 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/dialog_ie8.css +5 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/dialog_opera.css +5 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/editor.css +5 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/editor_gecko.css +5 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/editor_ie.css +5 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/editor_ie7.css +5 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/editor_ie8.css +5 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/icons.png +0 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/images/arrow.png +0 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/images/close.png +0 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/images/mini.png +0 -0
- data/core/vendor/assets/stylesheets/ckeditor/skins/moono/readme.md +51 -0
- data/lib/constructor/engine.rb +6 -0
- data/lib/constructor-cms.rb +3 -0
- data/pages/app/assets/images/constructor_pages/arrow_down.png +0 -0
- data/pages/app/assets/images/constructor_pages/arrow_up.png +0 -0
- data/pages/app/assets/images/constructor_pages/information.png +0 -0
- data/pages/app/assets/images/constructor_pages/page_white_edit.png +0 -0
- data/pages/app/assets/images/constructor_pages/photos.png +0 -0
- data/pages/app/controllers/constructor_pages/fields_controller.rb +60 -0
- data/pages/app/controllers/constructor_pages/pages_controller.rb +207 -0
- data/pages/app/controllers/constructor_pages/templates_controller.rb +71 -0
- data/pages/app/helpers/constructor_pages/fields_helper.rb +18 -0
- data/pages/app/helpers/constructor_pages/pages_helper.rb +15 -0
- data/pages/app/helpers/constructor_pages/templates_helper.rb +11 -0
- data/pages/app/models/constructor_pages/field.rb +60 -0
- data/pages/app/models/constructor_pages/page.rb +117 -0
- data/pages/app/models/constructor_pages/template.rb +30 -0
- data/pages/app/models/constructor_pages/types/boolean_type.rb +12 -0
- data/pages/app/models/constructor_pages/types/date_type.rb +16 -0
- data/pages/app/models/constructor_pages/types/float_type.rb +12 -0
- data/pages/app/models/constructor_pages/types/html_type.rb +12 -0
- data/pages/app/models/constructor_pages/types/image_type.rb +18 -0
- data/pages/app/models/constructor_pages/types/integer_type.rb +12 -0
- data/pages/app/models/constructor_pages/types/string_type.rb +12 -0
- data/pages/app/models/constructor_pages/types/text_type.rb +12 -0
- data/pages/app/views/constructor_pages/fields/_form.haml +28 -0
- data/pages/app/views/constructor_pages/fields/edit.haml +6 -0
- data/pages/app/views/constructor_pages/fields/new.haml +6 -0
- data/pages/app/views/constructor_pages/fields/types/_boolean.haml +1 -0
- data/pages/app/views/constructor_pages/fields/types/_date.haml +1 -0
- data/pages/app/views/constructor_pages/fields/types/_float.haml +1 -0
- data/pages/app/views/constructor_pages/fields/types/_html.haml +1 -0
- data/pages/app/views/constructor_pages/fields/types/_image.haml +4 -0
- data/pages/app/views/constructor_pages/fields/types/_integer.haml +1 -0
- data/pages/app/views/constructor_pages/fields/types/_string.haml +1 -0
- data/pages/app/views/constructor_pages/fields/types/_text.haml +1 -0
- data/pages/app/views/constructor_pages/pages/_breadcrumbs.haml +7 -0
- data/pages/app/views/constructor_pages/pages/_form.haml +98 -0
- data/pages/app/views/constructor_pages/pages/_menu.haml +8 -0
- data/pages/app/views/constructor_pages/pages/_submenu.haml +6 -0
- data/pages/app/views/constructor_pages/pages/edit.haml +6 -0
- data/pages/app/views/constructor_pages/pages/error_404.haml +23 -0
- data/pages/app/views/constructor_pages/pages/index.haml +50 -0
- data/pages/app/views/constructor_pages/pages/new.haml +6 -0
- data/pages/app/views/constructor_pages/pages/show.haml +5 -0
- data/pages/app/views/constructor_pages/pages/sitemap.haml +12 -0
- data/pages/app/views/constructor_pages/templates/_form.haml +48 -0
- data/pages/app/views/constructor_pages/templates/edit.haml +6 -0
- data/pages/app/views/constructor_pages/templates/index.haml +38 -0
- data/pages/app/views/constructor_pages/templates/new.haml +6 -0
- data/pages/config/initializers/dragonfly.rb +9 -0
- data/pages/config/locales/ru.yml +39 -0
- data/pages/config/routes.rb +34 -0
- data/pages/constructor-pages.gemspec +21 -0
- data/pages/db/migrate/10_create_html_types.rb +15 -0
- data/pages/db/migrate/11_create_image_types.rb +16 -0
- data/pages/db/migrate/12_add_default_template.rb +13 -0
- data/pages/db/migrate/1_create_pages.rb +27 -0
- data/pages/db/migrate/2_create_templates.rb +18 -0
- data/pages/db/migrate/3_create_fields.rb +17 -0
- data/pages/db/migrate/4_create_string_types.rb +15 -0
- data/pages/db/migrate/5_create_float_types.rb +15 -0
- data/pages/db/migrate/6_create_boolean_types.rb +15 -0
- data/pages/db/migrate/7_create_integer_types.rb +15 -0
- data/pages/db/migrate/8_create_text_types.rb +15 -0
- data/pages/db/migrate/9_create_date_types.rb +15 -0
- data/pages/lib/constructor-pages.rb +7 -0
- data/pages/lib/constructor_pages/engine.rb +6 -0
- data/pages/public/hello.txt +1 -0
- data/pages/spec/factories.rb +7 -0
- data/pages/spec/models/page_model_spec.rb +113 -0
- metadata +396 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
- content_for :header do
|
2
|
+
= @title
|
3
|
+
.sitemap
|
4
|
+
%p
|
5
|
+
%ul
|
6
|
+
- @pages.each do |page|
|
7
|
+
- if page.active and page.in_map
|
8
|
+
%li{:class => "level#{page.level}"}
|
9
|
+
- if page.link.empty?
|
10
|
+
= link_to page.name, page.full_url
|
11
|
+
- else
|
12
|
+
= link_to page.name, page.link
|
@@ -0,0 +1,48 @@
|
|
1
|
+
= form_for @template do |f|
|
2
|
+
- if @template.errors.any?
|
3
|
+
.alert.alert-error.fade.in.span12
|
4
|
+
= link_to "×", "#", :class => "close", 'data-dismiss' => 'alert'
|
5
|
+
- @template.errors.full_messages.each do |m|
|
6
|
+
= m
|
7
|
+
|
8
|
+
.form-horizontal
|
9
|
+
.control-group
|
10
|
+
= f.label :name, :class => 'control-label'
|
11
|
+
.controls= f.text_field :name, :class => "span4"
|
12
|
+
|
13
|
+
.control-group
|
14
|
+
= f.label :code_name, :class => 'control-label'
|
15
|
+
.controls= f.text_field :code_name, :class => "span4"
|
16
|
+
|
17
|
+
.control-group
|
18
|
+
= f.label :parent, :class => 'control-label'
|
19
|
+
.controls
|
20
|
+
= f.select :parent_id, options_for_select(for_select(@roots), :selected => @template.parent_id), :include_blank => 'Нет'
|
21
|
+
|
22
|
+
.control-group
|
23
|
+
= f.label :child, :class => 'control-label'
|
24
|
+
.controls
|
25
|
+
= f.select :child_id, options_for_select(for_select(@roots), :selected => @template.child_id), :include_blank => 'Нет'
|
26
|
+
|
27
|
+
- unless @template.new_record?
|
28
|
+
.control-group
|
29
|
+
.controls
|
30
|
+
= link_to "<i class='icon-plus icon-white'></i> Добавить поле".html_safe, new_field_path(@template.id), :class => "btn btn-mini btn-success"
|
31
|
+
|
32
|
+
- @template.fields.each do |field|
|
33
|
+
.control-group
|
34
|
+
= label_tag "", field.name, :class => 'control-label'
|
35
|
+
.controls
|
36
|
+
= link_to "<i class='icon-arrow-down'></i>".html_safe, field_move_down_path(field), :class => "btn btn-mini #{"disabled" if field.last?}"
|
37
|
+
= link_to "<i class='icon-arrow-up'></i>".html_safe, field_move_up_path(field), :class => "btn btn-mini #{"disabled" if field.first?}"
|
38
|
+
|
39
|
+
= link_to "<i class='icon-pencil icon-white'></i>".html_safe, edit_field_path(field, field.template), :class => "btn btn-mini btn-primary"
|
40
|
+
= link_to "<i class='icon-remove icon-white'></i>".html_safe, field_path(field), :method => :delete, :confirm => "Вы уверены?", :class => "btn btn-mini btn-danger"
|
41
|
+
|
42
|
+
.row-fluid
|
43
|
+
.span12
|
44
|
+
.form-actions
|
45
|
+
.btn-group
|
46
|
+
= f.submit :class => "btn btn-primary"
|
47
|
+
= link_to "Отмена", templates_url, :class => "btn"
|
48
|
+
= link_to "Удалить шаблон", @template, :confirm => 'Вы уверены?', :method => :delete, :class => "btn btn-danger pull-right" unless @template.new_record?
|
@@ -0,0 +1,38 @@
|
|
1
|
+
- content_for :page_title do
|
2
|
+
Шаблоны
|
3
|
+
|
4
|
+
- content_for :actions do
|
5
|
+
.span4.clearfix.text-right
|
6
|
+
= link_to 'Создать шаблон', new_template_path, :class => "btn btn-success btn-large"
|
7
|
+
|
8
|
+
%section.span8
|
9
|
+
%ul#tree.treeview-gray
|
10
|
+
- @roots.each do |root|
|
11
|
+
- level = root.level
|
12
|
+
- last_template = nil
|
13
|
+
|
14
|
+
- root.self_and_descendants.each do |template|
|
15
|
+
- if template.level > level
|
16
|
+
<ul>
|
17
|
+
- elsif template.level < level
|
18
|
+
</li>
|
19
|
+
= raw "</ul></li>" * (level-template.level)
|
20
|
+
- elsif !template.root?
|
21
|
+
</li>
|
22
|
+
|
23
|
+
<li>
|
24
|
+
%button.btn.disabled= template.name
|
25
|
+
|
26
|
+
.btn-group
|
27
|
+
- if not template.right_sibling.nil? and template.move_possible?(template.right_sibling)
|
28
|
+
= link_to "<i class='icon-arrow-down'></i>".html_safe, template_move_down_path(template), :method => :post, :class => "btn btn-mini"
|
29
|
+
- if not template.left_sibling.nil? and template.move_possible?(template.left_sibling)
|
30
|
+
= link_to "<i class='icon-arrow-up'></i>".html_safe, template_move_up_path(template), :method => :post, :class => "btn btn-mini"
|
31
|
+
|
32
|
+
= link_to "<i class='icon-pencil icon-white'></i>".html_safe, edit_template_path(template), :class => "btn btn-primary btn-mini"
|
33
|
+
|
34
|
+
|
35
|
+
- level = template.level
|
36
|
+
- last_template = template
|
37
|
+
</li>
|
38
|
+
= raw "</ul></li>" * last_template.level
|
@@ -0,0 +1,39 @@
|
|
1
|
+
ru:
|
2
|
+
activerecord:
|
3
|
+
attributes:
|
4
|
+
constructor_pages/field:
|
5
|
+
name: "Название"
|
6
|
+
code_name: "Кодовое имя"
|
7
|
+
type_value: "Тип"
|
8
|
+
constructor_pages/template:
|
9
|
+
name: "Название"
|
10
|
+
code_name: "Кодовое имя"
|
11
|
+
parent: "Родительский"
|
12
|
+
child: "Дочерний"
|
13
|
+
constructor_pages/page:
|
14
|
+
active: "Вкл./Выкл."
|
15
|
+
image: "Изображение"
|
16
|
+
name: "Название"
|
17
|
+
template: "Шаблон"
|
18
|
+
auto_url: "Авто-ссылка"
|
19
|
+
url: "Адрес"
|
20
|
+
in_menu: "Меню"
|
21
|
+
in_nav: "Хлебные крошки"
|
22
|
+
in_map: "Карта сайта"
|
23
|
+
parent: "Родитель"
|
24
|
+
parent_id: "Родительская страница"
|
25
|
+
link: "Ссылка"
|
26
|
+
title: "Заголовок"
|
27
|
+
keywords: "Ключевые слова"
|
28
|
+
description: "Описание"
|
29
|
+
errors:
|
30
|
+
models:
|
31
|
+
constructor_pages/image:
|
32
|
+
incorrect_size: "не может превышать 5MB"
|
33
|
+
incorrect_format: "должно быть в формате jpg, png или gif"
|
34
|
+
constructor_pages/page:
|
35
|
+
attributes:
|
36
|
+
title:
|
37
|
+
blank: "не может быть пустым"
|
38
|
+
url:
|
39
|
+
blank: "не может быть пустой"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
ConstructorPages::Engine.routes.draw do
|
2
|
+
scope '/admin' do
|
3
|
+
resources :pages, :except => [:show]
|
4
|
+
resources :templates, :except => [:show]
|
5
|
+
resources :fields, :except => [:show, :new, :edit]
|
6
|
+
|
7
|
+
scope '/fields' do
|
8
|
+
get ':template_id/new/' => 'fields#new', :as => :new_field
|
9
|
+
get ':id/:template_id/edit/' => 'fields#edit', :as => :edit_field
|
10
|
+
|
11
|
+
get 'move/up/:id' => "fields#move_up", :as => :field_move_up
|
12
|
+
get 'move/down/:id' => "fields#move_down", :as => :field_move_down
|
13
|
+
end
|
14
|
+
|
15
|
+
scope '/pages' do
|
16
|
+
post 'move/up/:id' => "pages#move_up", :as => :page_move_up
|
17
|
+
post 'move/down/:id' => "pages#move_down", :as => :page_move_down
|
18
|
+
|
19
|
+
get ':page/new' => "pages#new", :as => :new_child_page
|
20
|
+
end
|
21
|
+
|
22
|
+
scope '/templates' do
|
23
|
+
post 'move/up/:id' => "templates#move_up", :as => :template_move_up
|
24
|
+
post 'move/down/:id' => "templates#move_down", :as => :template_move_down
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
get '/sitemap' => "pages#sitemap", :as => :sitemap
|
29
|
+
|
30
|
+
root :to => "pages#show"
|
31
|
+
get '*all/search/:what_search' => "pages#search", :format => false
|
32
|
+
get '*all.:format' => "pages#show"
|
33
|
+
get '*all' => "pages#show"
|
34
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.platform = Gem::Platform::RUBY
|
5
|
+
s.name = %q{constructor-pages}
|
6
|
+
s.version = '0.2.1'
|
7
|
+
s.summary = %q{Pages for Constructor}
|
8
|
+
s.authors = ['Ivan Zotov']
|
9
|
+
s.require_paths = %w(lib)
|
10
|
+
|
11
|
+
s.files = `git ls-files`.split("\n")
|
12
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
13
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
14
|
+
|
15
|
+
s.add_dependency 'dragonfly'
|
16
|
+
s.add_dependency 'rack-cache'
|
17
|
+
s.add_dependency 'awesome_nested_set', '~> 2.0'
|
18
|
+
s.add_dependency 'haml-rails'
|
19
|
+
s.add_dependency 'russian', '~> 0.6.0'
|
20
|
+
s.add_dependency 'RedCloth'
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateHtmlTypes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ConstructorPages::Types::HtmlType.table_name do |t|
|
4
|
+
t.text :value, :default => ""
|
5
|
+
t.references :field
|
6
|
+
t.references :page
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table ConstructorPages::Types::HtmlType.table_name
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateImageTypes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ConstructorPages::Types::ImageType.table_name do |t|
|
4
|
+
t.string :value_uid
|
5
|
+
t.string :value_name
|
6
|
+
t.references :field
|
7
|
+
t.references :page
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table ConstructorPages::Types::ImageType.table_name
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class CreatePages < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ConstructorPages::Page.table_name do |t|
|
4
|
+
t.boolean :active, :default => true
|
5
|
+
t.string :name, :default => ""
|
6
|
+
t.boolean :auto_url, :default => true
|
7
|
+
t.string :full_url, :default => ""
|
8
|
+
t.string :url, :default => ""
|
9
|
+
t.string :link, :default => ""
|
10
|
+
t.string :title, :default => ""
|
11
|
+
t.string :keywords, :default => ""
|
12
|
+
t.text :description, :default => ""
|
13
|
+
t.boolean :in_menu, :default => true
|
14
|
+
t.boolean :in_nav, :default => true
|
15
|
+
t.boolean :in_map, :default => true
|
16
|
+
t.integer :parent_id
|
17
|
+
t.integer :lft
|
18
|
+
t.integer :rgt
|
19
|
+
t.references :template
|
20
|
+
t.timestamps
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.down
|
25
|
+
drop_table ConstructorPages::Page.table_name
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateTemplates < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ConstructorPages::Template.table_name do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :code_name
|
6
|
+
t.integer :parent_id
|
7
|
+
t.integer :child_id
|
8
|
+
t.integer :lft
|
9
|
+
t.integer :rgt
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table ConstructorPages::Template.table_name
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateFields < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ConstructorPages::Field.table_name do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :code_name
|
6
|
+
t.string :type_value
|
7
|
+
t.integer :position
|
8
|
+
t.references :template
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table ConstructorPages::Field.table_name
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateStringTypes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ConstructorPages::Types::StringType.table_name do |t|
|
4
|
+
t.string :value, :default => ""
|
5
|
+
t.references :field
|
6
|
+
t.references :page
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table ConstructorPages::Types::StringType.table_name
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateFloatTypes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ConstructorPages::Types::FloatType.table_name do |t|
|
4
|
+
t.float :value, :default => 0.0
|
5
|
+
t.references :field
|
6
|
+
t.references :page
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table ConstructorPages::Types::FloatType.table_name
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateBooleanTypes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ConstructorPages::Types::BooleanType.table_name do |t|
|
4
|
+
t.boolean :value, :default => false
|
5
|
+
t.references :field
|
6
|
+
t.references :page
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table ConstructorPages::Types::BooleanType.table_name
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateIntegerTypes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ConstructorPages::Types::IntegerType.table_name do |t|
|
4
|
+
t.integer :value, :default => 0
|
5
|
+
t.references :field
|
6
|
+
t.references :page
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table ConstructorPages::Types::IntegerType.table_name
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateTextTypes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ConstructorPages::Types::TextType.table_name do |t|
|
4
|
+
t.text :value, :default => ""
|
5
|
+
t.references :field
|
6
|
+
t.references :page
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table ConstructorPages::Types::TextType.table_name
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateDateTypes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table ConstructorPages::Types::DateType.table_name do |t|
|
4
|
+
t.date :value, :default => Time.now
|
5
|
+
t.references :field
|
6
|
+
t.references :page
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table ConstructorPages::Types::DateType.table_name
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
hello world
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require './../spec/spec_helper'
|
4
|
+
|
5
|
+
describe Page do
|
6
|
+
describe "Title and Url" do
|
7
|
+
before :each do
|
8
|
+
Factory(:page, :title => "Hello", :url => '/hello')
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be unique" do
|
12
|
+
page = Factory.build(:page, :title => "Hello", :url => '/hello')
|
13
|
+
page.should_not be_valid
|
14
|
+
page.url = '/hello@#$%^&'
|
15
|
+
page.should_not be_valid
|
16
|
+
page.should have(1).error_on(:base)
|
17
|
+
|
18
|
+
page.url = "/world"
|
19
|
+
page.should be_valid
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should be unique even before save" do
|
23
|
+
page = Factory.build(:page, :title => "Hello", :url => "")
|
24
|
+
|
25
|
+
page.should_not be_valid
|
26
|
+
page.should have(1).error_on(:base)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "Title" do
|
31
|
+
it "should not be empty" do
|
32
|
+
page = Factory.build(:page, :title => ' ')
|
33
|
+
page.should_not be_valid
|
34
|
+
page.should have(1).error_on(:title)
|
35
|
+
page.errors[:title].should == ['не может быть пустым']
|
36
|
+
|
37
|
+
page.title = "Title"
|
38
|
+
page.should be_valid
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "In nav, in menu, in map" do
|
43
|
+
it "should be true by default" do
|
44
|
+
page = Page.new
|
45
|
+
page.in_nav.should be_true
|
46
|
+
page.in_menu.should be_true
|
47
|
+
page.in_map.should be_true
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should change when given in new method" do
|
51
|
+
page = Page.new(:in_nav => false, :in_menu => false, :in_map => false)
|
52
|
+
page.in_nav.should be_false
|
53
|
+
page.in_menu.should be_false
|
54
|
+
page.in_map.should be_false
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "Parent" do
|
59
|
+
it "should not be same as self" do
|
60
|
+
page = Factory(:page)
|
61
|
+
page.parent_id = page.id
|
62
|
+
|
63
|
+
page.save
|
64
|
+
page.should have(1).errors
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "Url" do
|
69
|
+
context "Fix mistakes if remote" do
|
70
|
+
it "should fix http// and http:/" do
|
71
|
+
page = Factory(:page, :url => 'http:/myurl.com/')
|
72
|
+
page.url.should == 'http://myurl.com/'
|
73
|
+
|
74
|
+
page = Factory(:page, :url => 'http//myurl.com/')
|
75
|
+
page.url.should == 'http://myurl.com/'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context "If empty or nil" do
|
80
|
+
it "should be generated from title" do
|
81
|
+
page = Factory(:page, :title => " //Hello!@#$\%^&*() my WORLD /// привет// ", :url => ' ')
|
82
|
+
page.url.should == "\/hello-my-world\/privet"
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should add parent url before if parent selected" do
|
86
|
+
page_parent = Factory(:page, :id => 1, :url => '/hello')
|
87
|
+
page = Factory(:page, :parent_id => page_parent, :title => 'World', :url => ' ')
|
88
|
+
page.url.should == '/hello/world'
|
89
|
+
|
90
|
+
# if parent not selected
|
91
|
+
page.parent_id = nil
|
92
|
+
page.url = ' '
|
93
|
+
page.save
|
94
|
+
page.url.should == '/world'
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should be empty when page not valid" do
|
98
|
+
Factory(:page, :title => "Hello", :url => "/hello")
|
99
|
+
page = Factory.build(:page, :title => "Hello", :url => "")
|
100
|
+
|
101
|
+
page.should_not be_valid
|
102
|
+
page.url.should == ""
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context "Finish cleanup" do
|
107
|
+
it "should cleanup url: remove spaces, fix backslashes, unknown chars etc." do
|
108
|
+
page = Factory(:page, :url => " //Hello!@#$\%^&*() my WORLD /// привет// ")
|
109
|
+
page.url.should == "\/hello-my-world\/privet"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|