constructor-core 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +13 -0
- data/.yardopts +9 -0
- data/Gemfile +31 -0
- data/Guardfile +15 -0
- data/LICENSE.md +7 -0
- data/README.md +35 -0
- data/Rakefile +19 -0
- data/bin/rails +8 -0
- data/config.ru +4 -0
- data/config/routes.rb +3 -17
- data/constructor-cms.gemspec +26 -0
- data/{app → core/app}/assets/images/constructor_core/glyphicons-halflings-white.png +0 -0
- data/{app → core/app}/assets/images/constructor_core/glyphicons-halflings.png +0 -0
- data/{app → core/app}/assets/images/constructor_core/minus.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/plus.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/rss.png +0 -0
- data/{app → core/app}/assets/images/constructor_core/treeview-black-line.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/treeview-black.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/treeview-default-line.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/treeview-default.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/treeview-famfamfam-line.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/treeview-famfamfam.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/treeview-gray-line.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/treeview-gray.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/treeview-red-line.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/treeview-red.gif +0 -0
- data/{app → core/app}/assets/images/constructor_core/twitter.png +0 -0
- data/{app → core/app}/assets/images/constructor_core/widgets.png +0 -0
- data/{app → core/app}/assets/javascripts/constructor_core/application.js.coffee +0 -0
- data/{app → core/app}/assets/javascripts/constructor_core/bootstrap.js +0 -0
- data/{app → core/app}/assets/javascripts/constructor_core/jquery.cookie.js +0 -0
- data/{app → core/app}/assets/javascripts/constructor_core/jquery_bundle.js.coffee +0 -0
- data/{app → core/app}/assets/javascripts/constructor_core/keys_snippet.js +0 -0
- data/{app → core/app}/assets/javascripts/constructor_core/retina.js +0 -0
- data/{app → core/app}/assets/javascripts/constructor_core/urlify.js +0 -0
- data/{app → core/app}/assets/stylesheets/constructor_core/application.css.scss +0 -0
- data/{app → core/app}/assets/stylesheets/constructor_core/main.css.scss +0 -0
- data/{app → core/app}/controllers/constructor_core/application_controller.rb +0 -0
- data/{app → core/app}/controllers/constructor_core/sessions_controller.rb +0 -0
- data/{app → core/app}/controllers/constructor_core/users_controller.rb +0 -0
- data/{app → core/app}/helpers/constructor_core/application_helper.rb +0 -0
- data/{app → core/app}/models/constructor_core/user.rb +0 -0
- data/{app → core/app}/views/constructor_core/devise/confirmations/new.html.haml +0 -0
- data/{app → core/app}/views/constructor_core/devise/mailer/confirmation_instructions.html.haml +0 -0
- data/{app → core/app}/views/constructor_core/devise/mailer/reset_password_instructions.html.haml +0 -0
- data/{app → core/app}/views/constructor_core/devise/mailer/unlock_instructions.html.haml +0 -0
- data/{app → core/app}/views/constructor_core/devise/passwords/edit.html.haml +0 -0
- data/{app → core/app}/views/constructor_core/devise/passwords/new.html.haml +0 -0
- data/{app → core/app}/views/constructor_core/devise/registrations/edit.html.haml +0 -0
- data/{app → core/app}/views/constructor_core/devise/registrations/new.html.haml +0 -0
- data/{app → core/app}/views/constructor_core/devise/shared/_links.html.haml +0 -0
- data/{app → core/app}/views/constructor_core/devise/unlocks/new.html.haml +0 -0
- data/{app → core/app}/views/constructor_core/sessions/new.html.haml +0 -0
- data/{app → core/app}/views/constructor_core/users/profile.haml +0 -0
- data/{app → core/app}/views/layouts/constructor_core/application.haml +0 -0
- data/{config → core/config}/environments/production.rb +0 -0
- data/{config → core/config}/initializers/devise.rb +0 -0
- data/{config → core/config}/locales/devise.en.yml +0 -0
- data/{config → core/config}/locales/devise.fr.yml +0 -0
- data/{config → core/config}/locales/devise.ru.yml +0 -0
- data/{config → core/config}/locales/en.yml +0 -0
- data/{config → core/config}/locales/fr.yml +0 -0
- data/{config → core/config}/locales/ru.yml +0 -0
- data/core/config/routes.rb +18 -0
- data/{constructor-core.gemspec → core/constructor-core.gemspec} +0 -0
- data/{db → core/db}/migrate/1_devise_users.rb +0 -0
- data/{db → core/db}/migrate/2_add_default_user.rb +0 -0
- data/{lib → core/lib}/constructor-core.rb +0 -0
- data/{lib → core/lib}/constructor_core/engine.rb +0 -0
- data/{lib → core/lib}/constructor_core/version.rb +1 -1
- data/{vendor → core/vendor}/assets/javascripts/.gitkeep +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/ckeditor.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/config.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/lang/en.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/lang/ru.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/_translationstatus.txt +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ar.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/bg.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ca.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cs.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cy.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/da.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/de.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/el.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/eo.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/es.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/et.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fa.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fi.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fr.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/gu.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/he.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hi.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hr.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hu.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/it.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ja.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/km.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ku.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/lt.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/lv.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/mk.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/mn.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nb.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nl.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/no.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pl.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt-br.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ro.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sk.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sl.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sv.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/th.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/tr.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ug.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/uk.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/vi.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/zh-cn.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/fakeobjects/images/spacer.gif +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/icons.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/iframe/images/placeholder.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/image/images/noimage.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/link/images/anchor.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/magicline/images/icon.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/preview/preview.html +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/scayt/LICENSE.md +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/scayt/README.md +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/scayt/dialogs/toolbar.css +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_address.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_div.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_p.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/_translationstatus.txt +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ca.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/cs.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/cy.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/de.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/el.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/eo.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/et.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fa.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fi.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fr.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/he.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/hr.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/it.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ku.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/lv.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/nb.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/nl.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/no.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pl.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pt-br.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sk.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sv.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/th.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/tr.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ug.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/zh-cn.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/templates/templates/default.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/wsc/LICENSE.md +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/wsc/README.md +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/wsc/dialogs/ciframe.html +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.css +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +0 -0
- data/{vendor → core/vendor}/assets/javascripts/ckeditor/styles.js +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/.gitkeep +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/contents.css +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/dialog.css +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/dialog_ie.css +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/dialog_ie7.css +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/dialog_ie8.css +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/dialog_opera.css +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/editor.css +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/editor_gecko.css +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/editor_ie.css +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/editor_ie7.css +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/editor_ie8.css +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/icons.png +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/images/arrow.png +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/images/close.png +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/images/mini.png +0 -0
- data/{vendor → core/vendor}/assets/stylesheets/ckeditor/skins/moono/readme.md +0 -0
- data/lib/constructor-cms.rb +3 -0
- data/lib/constructor-cms/engine.rb +6 -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/assets/javascripts/constructor_pages/ajax_pages.js +61 -0
- data/pages/app/assets/javascripts/constructor_pages/jquery.history.js +1 -0
- data/pages/app/controllers/constructor_pages/application_controller.rb +20 -0
- data/pages/app/controllers/constructor_pages/fields_controller.rb +70 -0
- data/pages/app/controllers/constructor_pages/pages_controller.rb +155 -0
- data/pages/app/controllers/constructor_pages/templates_controller.rb +62 -0
- data/pages/app/helpers/constructor_pages/code_name_uniq.rb +7 -0
- data/pages/app/helpers/constructor_pages/fields_helper.rb +18 -0
- data/pages/app/helpers/constructor_pages/pages_helper.rb +22 -0
- data/pages/app/helpers/constructor_pages/templates_helper.rb +13 -0
- data/pages/app/helpers/constructor_pages/treeview_helper.rb +33 -0
- data/pages/app/models/constructor_pages/field.rb +59 -0
- data/pages/app/models/constructor_pages/page.rb +173 -0
- data/pages/app/models/constructor_pages/template.rb +38 -0
- data/pages/app/models/constructor_pages/types/boolean_type.rb +11 -0
- data/pages/app/models/constructor_pages/types/date_type.rb +11 -0
- data/pages/app/models/constructor_pages/types/float_type.rb +11 -0
- data/pages/app/models/constructor_pages/types/html_type.rb +11 -0
- data/pages/app/models/constructor_pages/types/image_type.rb +19 -0
- data/pages/app/models/constructor_pages/types/integer_type.rb +11 -0
- data/pages/app/models/constructor_pages/types/string_type.rb +11 -0
- data/pages/app/models/constructor_pages/types/text_type.rb +11 -0
- data/pages/app/views/constructor_pages/fields/_form.haml +29 -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 +7 -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/index.haml +42 -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/partials/_arrow_buttons.haml +6 -0
- data/pages/app/views/constructor_pages/templates/_form.haml +53 -0
- data/pages/app/views/constructor_pages/templates/edit.haml +6 -0
- data/pages/app/views/constructor_pages/templates/index.haml +24 -0
- data/pages/app/views/constructor_pages/templates/new.haml +6 -0
- data/pages/config/initializers/dragonfly.rb +9 -0
- data/pages/config/locales/en.yml +65 -0
- data/pages/config/locales/fr.yml +65 -0
- data/pages/config/locales/ru.yml +100 -0
- data/pages/config/routes.rb +26 -0
- data/pages/constructor-pages.gemspec +31 -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 +6 -0
- data/pages/lib/constructor_pages/engine.rb +6 -0
- data/pages/public/hello.txt +1 -0
- data/pages/spec/features/constructor_pages/fields_spec.rb +217 -0
- data/pages/spec/features/constructor_pages/pages_spec.rb +313 -0
- data/pages/spec/features/constructor_pages/templates_spec.rb +267 -0
- data/pages/spec/helpers/constructor_pages/.keep +0 -0
- data/pages/spec/models/constructor_pages/field_spec.rb +135 -0
- data/pages/spec/models/constructor_pages/page_spec.rb +420 -0
- data/pages/spec/models/constructor_pages/template_spec.rb +34 -0
- data/pages/spec/models/constructor_pages/types/boolean_type_spec.rb +21 -0
- data/pages/spec/models/constructor_pages/types/date_type_spec.rb +21 -0
- data/pages/spec/models/constructor_pages/types/float_type_spec.rb +21 -0
- data/pages/spec/models/constructor_pages/types/html_type_spec.rb +63 -0
- data/pages/spec/models/constructor_pages/types/integer_type_spec.rb +24 -0
- data/pages/spec/models/constructor_pages/types/string_type_spec.rb +21 -0
- data/pages/spec/models/constructor_pages/types/text_type_spec.rb +63 -0
- data/pages/spec/routing/constructor_pages/.keep +0 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/html_templates/page.haml +1 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/lib/tasks/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/spec_helper.rb +46 -0
- data/tasks/constructor-cms_tasks.rake +15 -0
- metadata +396 -211
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt-br.js
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/zh-cn.js
RENAMED
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/about/dialogs/logo_ckeditor.png
RENAMED
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js
RENAMED
File without changes
|
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/fakeobjects/images/spacer.gif
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/iframe/images/placeholder.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js
RENAMED
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_address.png
RENAMED
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_div.png
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h1.png
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h2.png
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h3.png
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h4.png
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h5.png
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_h6.png
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_p.png
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/showblocks/images/block_pre.png
RENAMED
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ca.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/cs.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/cy.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/de.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/el.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/eo.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/et.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fa.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fi.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fr.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/he.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/hr.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/it.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ku.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/lv.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/nb.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/nl.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/no.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pl.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pt-br.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sk.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sv.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/th.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/tr.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ug.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/zh-cn.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js
RENAMED
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js
RENAMED
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/templates/templates/default.js
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/{vendor → core/vendor}/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,61 @@
|
|
1
|
+
//= require constructor_pages/jquery.history.js
|
2
|
+
|
3
|
+
$(document).ready(function() {
|
4
|
+
$page = {};
|
5
|
+
|
6
|
+
var History = window.History;
|
7
|
+
|
8
|
+
if ( !History.enabled ) { return false }
|
9
|
+
|
10
|
+
History.Adapter.bind(window,'statechange',function(){
|
11
|
+
update_page(History.getState().url);
|
12
|
+
});
|
13
|
+
|
14
|
+
|
15
|
+
update_pages();
|
16
|
+
});
|
17
|
+
|
18
|
+
function update_pages(){
|
19
|
+
$('.b-page-json').each(function(index, el){
|
20
|
+
var _href = $(el).attr('href');
|
21
|
+
|
22
|
+
$(el).unbind('click');
|
23
|
+
|
24
|
+
$(el).click(function(event){
|
25
|
+
event.preventDefault();
|
26
|
+
History.pushState(null, null, _href);
|
27
|
+
});
|
28
|
+
});
|
29
|
+
}
|
30
|
+
|
31
|
+
function update_page(href) {
|
32
|
+
|
33
|
+
$.get(href+'.json', function(page){
|
34
|
+
$page = page;
|
35
|
+
|
36
|
+
$('title').html(page.title || page.name);
|
37
|
+
|
38
|
+
var partials = JSON.parse(page.template);
|
39
|
+
var names = Object.keys(partials);
|
40
|
+
|
41
|
+
for (i in names) {
|
42
|
+
var name = names[i];
|
43
|
+
|
44
|
+
$('.b-page-part__'+name).html(partials[name]);
|
45
|
+
}
|
46
|
+
|
47
|
+
$("[class*='b-page-json__id-']").removeClass('active');
|
48
|
+
|
49
|
+
for (var i in $page.self_and_ancestors) {
|
50
|
+
$('.b-page-json__id-'+$page.self_and_ancestors[i]).addClass('active');
|
51
|
+
}
|
52
|
+
|
53
|
+
update_pages();
|
54
|
+
|
55
|
+
if (typeof Retina != 'undefined') {
|
56
|
+
Retina.update();
|
57
|
+
}
|
58
|
+
|
59
|
+
eval(page.js);
|
60
|
+
});
|
61
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
window.JSON||(window.JSON={}),function(){function f(a){return a<10?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b=="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i&&typeof i=="object"&&typeof i.toJSON=="function"&&(i=i.toJSON(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c<f;c+=1)h[c]=str(c,i)||"null";return e=h.length===0?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]",gap=g,e}if(rep&&typeof rep=="object"){f=rep.length;for(c=0;c<f;c+=1)d=rep[c],typeof d=="string"&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e))}else for(d in i)Object.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e));return e=h.length===0?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}",gap=g,e}}"use strict",typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var JSON=window.JSON,cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(a,b,c){var d;gap="",indent="";if(typeof c=="number")for(d=0;d<c;d+=1)indent+=" ";else typeof c=="string"&&(indent=c);rep=b;if(!b||typeof b=="function"||typeof b=="object"&&typeof b.length=="number")return str("",{"":a});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&typeof e=="object")for(c in e)Object.hasOwnProperty.call(e,c)&&(d=walk(e,c),d!==undefined?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),function(a,b){"use strict";var c=a.History=a.History||{},d=a.jQuery;if(typeof c.Adapter!="undefined")throw new Error("History.js Adapter has already been loaded...");c.Adapter={bind:function(a,b,c){d(a).bind(b,c)},trigger:function(a,b,c){d(a).trigger(b,c)},extractEventData:function(a,c,d){var e=c&&c.originalEvent&&c.originalEvent[a]||d&&d[a]||b;return e},onDomLoad:function(a){d(a)}},typeof c.init!="undefined"&&c.init()}(window),function(a,b){"use strict";var c=a.document,d=a.setTimeout||d,e=a.clearTimeout||e,f=a.setInterval||f,g=a.History=a.History||{};if(typeof g.initHtml4!="undefined")throw new Error("History.js HTML4 Support has already been loaded...");g.initHtml4=function(){if(typeof g.initHtml4.initialized!="undefined")return!1;g.initHtml4.initialized=!0,g.enabled=!0,g.savedHashes=[],g.isLastHash=function(a){var b=g.getHashByIndex(),c;return c=a===b,c},g.saveHash=function(a){return g.isLastHash(a)?!1:(g.savedHashes.push(a),!0)},g.getHashByIndex=function(a){var b=null;return typeof a=="undefined"?b=g.savedHashes[g.savedHashes.length-1]:a<0?b=g.savedHashes[g.savedHashes.length+a]:b=g.savedHashes[a],b},g.discardedHashes={},g.discardedStates={},g.discardState=function(a,b,c){var d=g.getHashByState(a),e;return e={discardedState:a,backState:c,forwardState:b},g.discardedStates[d]=e,!0},g.discardHash=function(a,b,c){var d={discardedHash:a,backState:c,forwardState:b};return g.discardedHashes[a]=d,!0},g.discardedState=function(a){var b=g.getHashByState(a),c;return c=g.discardedStates[b]||!1,c},g.discardedHash=function(a){var b=g.discardedHashes[a]||!1;return b},g.recycleState=function(a){var b=g.getHashByState(a);return g.discardedState(a)&&delete g.discardedStates[b],!0},g.emulated.hashChange&&(g.hashChangeInit=function(){g.checkerFunction=null;var b="",d,e,h,i;return g.isInternetExplorer()?(d="historyjs-iframe",e=c.createElement("iframe"),e.setAttribute("id",d),e.style.display="none",c.body.appendChild(e),e.contentWindow.document.open(),e.contentWindow.document.close(),h="",i=!1,g.checkerFunction=function(){if(i)return!1;i=!0;var c=g.getHash()||"",d=g.unescapeHash(e.contentWindow.document.location.hash)||"";return c!==b?(b=c,d!==c&&(h=d=c,e.contentWindow.document.open(),e.contentWindow.document.close(),e.contentWindow.document.location.hash=g.escapeHash(c)),g.Adapter.trigger(a,"hashchange")):d!==h&&(h=d,g.setHash(d,!1)),i=!1,!0}):g.checkerFunction=function(){var c=g.getHash();return c!==b&&(b=c,g.Adapter.trigger(a,"hashchange")),!0},g.intervalList.push(f(g.checkerFunction,g.options.hashChangeInterval)),!0},g.Adapter.onDomLoad(g.hashChangeInit)),g.emulated.pushState&&(g.onHashChange=function(b){var d=b&&b.newURL||c.location.href,e=g.getHashByUrl(d),f=null,h=null,i=null,j;return g.isLastHash(e)?(g.busy(!1),!1):(g.doubleCheckComplete(),g.saveHash(e),e&&g.isTraditionalAnchor(e)?(g.Adapter.trigger(a,"anchorchange"),g.busy(!1),!1):(f=g.extractState(g.getFullUrl(e||c.location.href,!1),!0),g.isLastSavedState(f)?(g.busy(!1),!1):(h=g.getHashByState(f),j=g.discardedState(f),j?(g.getHashByIndex(-2)===g.getHashByState(j.forwardState)?g.back(!1):g.forward(!1),!1):(g.pushState(f.data,f.title,f.url,!1),!0))))},g.Adapter.bind(a,"hashchange",g.onHashChange),g.pushState=function(b,d,e,f){if(g.getHashByUrl(e))throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(f!==!1&&g.busy())return g.pushQueue({scope:g,callback:g.pushState,args:arguments,queue:f}),!1;g.busy(!0);var h=g.createStateObject(b,d,e),i=g.getHashByState(h),j=g.getState(!1),k=g.getHashByState(j),l=g.getHash();return g.storeState(h),g.expectedStateId=h.id,g.recycleState(h),g.setTitle(h),i===k?(g.busy(!1),!1):i!==l&&i!==g.getShortUrl(c.location.href)?(g.setHash(i,!1),!1):(g.saveState(h),g.Adapter.trigger(a,"statechange"),g.busy(!1),!0)},g.replaceState=function(a,b,c,d){if(g.getHashByUrl(c))throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(d!==!1&&g.busy())return g.pushQueue({scope:g,callback:g.replaceState,args:arguments,queue:d}),!1;g.busy(!0);var e=g.createStateObject(a,b,c),f=g.getState(!1),h=g.getStateByIndex(-2);return g.discardState(f,e,h),g.pushState(e.data,e.title,e.url,!1),!0}),g.emulated.pushState&&g.getHash()&&!g.emulated.hashChange&&g.Adapter.onDomLoad(function(){g.Adapter.trigger(a,"hashchange")})},typeof g.init!="undefined"&&g.init()}(window),function(a,b){"use strict";var c=a.console||b,d=a.document,e=a.navigator,f=a.sessionStorage||!1,g=a.setTimeout,h=a.clearTimeout,i=a.setInterval,j=a.clearInterval,k=a.JSON,l=a.alert,m=a.History=a.History||{},n=a.history;k.stringify=k.stringify||k.encode,k.parse=k.parse||k.decode;if(typeof m.init!="undefined")throw new Error("History.js Core has already been loaded...");m.init=function(){return typeof m.Adapter=="undefined"?!1:(typeof m.initCore!="undefined"&&m.initCore(),typeof m.initHtml4!="undefined"&&m.initHtml4(),!0)},m.initCore=function(){if(typeof m.initCore.initialized!="undefined")return!1;m.initCore.initialized=!0,m.options=m.options||{},m.options.hashChangeInterval=m.options.hashChangeInterval||100,m.options.safariPollInterval=m.options.safariPollInterval||500,m.options.doubleCheckInterval=m.options.doubleCheckInterval||500,m.options.storeInterval=m.options.storeInterval||1e3,m.options.busyDelay=m.options.busyDelay||250,m.options.debug=m.options.debug||!1,m.options.initialTitle=m.options.initialTitle||d.title,m.intervalList=[],m.clearAllIntervals=function(){var a,b=m.intervalList;if(typeof b!="undefined"&&b!==null){for(a=0;a<b.length;a++)j(b[a]);m.intervalList=null}},m.debug=function(){(m.options.debug||!1)&&m.log.apply(m,arguments)},m.log=function(){var a=typeof c!="undefined"&&typeof c.log!="undefined"&&typeof c.log.apply!="undefined",b=d.getElementById("log"),e,f,g,h,i;a?(h=Array.prototype.slice.call(arguments),e=h.shift(),typeof c.debug!="undefined"?c.debug.apply(c,[e,h]):c.log.apply(c,[e,h])):e="\n"+arguments[0]+"\n";for(f=1,g=arguments.length;f<g;++f){i=arguments[f];if(typeof i=="object"&&typeof k!="undefined")try{i=k.stringify(i)}catch(j){}e+="\n"+i+"\n"}return b?(b.value+=e+"\n-----\n",b.scrollTop=b.scrollHeight-b.clientHeight):a||l(e),!0},m.getInternetExplorerMajorVersion=function(){var a=m.getInternetExplorerMajorVersion.cached=typeof m.getInternetExplorerMajorVersion.cached!="undefined"?m.getInternetExplorerMajorVersion.cached:function(){var a=3,b=d.createElement("div"),c=b.getElementsByTagName("i");while((b.innerHTML="<!--[if gt IE "+ ++a+"]><i></i><![endif]-->")&&c[0]);return a>4?a:!1}();return a},m.isInternetExplorer=function(){var a=m.isInternetExplorer.cached=typeof m.isInternetExplorer.cached!="undefined"?m.isInternetExplorer.cached:Boolean(m.getInternetExplorerMajorVersion());return a},m.emulated={pushState:!Boolean(a.history&&a.history.pushState&&a.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(e.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(e.userAgent)),hashChange:Boolean(!("onhashchange"in a||"onhashchange"in d)||m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8)},m.enabled=!m.emulated.pushState,m.bugs={setHash:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),safariPoll:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),ieDoubleCheck:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<7)},m.isEmptyObject=function(a){for(var b in a)return!1;return!0},m.cloneObject=function(a){var b,c;return a?(b=k.stringify(a),c=k.parse(b)):c={},c},m.getRootUrl=function(){var a=d.location.protocol+"//"+(d.location.hostname||d.location.host);if(d.location.port||!1)a+=":"+d.location.port;return a+="/",a},m.getBaseHref=function(){var a=d.getElementsByTagName("base"),b=null,c="";return a.length===1&&(b=a[0],c=b.href.replace(/[^\/]+$/,"")),c=c.replace(/\/+$/,""),c&&(c+="/"),c},m.getBaseUrl=function(){var a=m.getBaseHref()||m.getBasePageUrl()||m.getRootUrl();return a},m.getPageUrl=function(){var a=m.getState(!1,!1),b=(a||{}).url||d.location.href,c;return c=b.replace(/\/+$/,"").replace(/[^\/]+$/,function(a,b,c){return/\./.test(a)?a:a+"/"}),c},m.getBasePageUrl=function(){var a=d.location.href.replace(/[#\?].*/,"").replace(/[^\/]+$/,function(a,b,c){return/[^\/]$/.test(a)?"":a}).replace(/\/+$/,"")+"/";return a},m.getFullUrl=function(a,b){var c=a,d=a.substring(0,1);return b=typeof b=="undefined"?!0:b,/[a-z]+\:\/\//.test(a)||(d==="/"?c=m.getRootUrl()+a.replace(/^\/+/,""):d==="#"?c=m.getPageUrl().replace(/#.*/,"")+a:d==="?"?c=m.getPageUrl().replace(/[\?#].*/,"")+a:b?c=m.getBaseUrl()+a.replace(/^(\.\/)+/,""):c=m.getBasePageUrl()+a.replace(/^(\.\/)+/,"")),c.replace(/\#$/,"")},m.getShortUrl=function(a){var b=a,c=m.getBaseUrl(),d=m.getRootUrl();return m.emulated.pushState&&(b=b.replace(c,"")),b=b.replace(d,"/"),m.isTraditionalAnchor(b)&&(b="./"+b),b=b.replace(/^(\.\/)+/g,"./").replace(/\#$/,""),b},m.store={},m.idToState=m.idToState||{},m.stateToId=m.stateToId||{},m.urlToId=m.urlToId||{},m.storedStates=m.storedStates||[],m.savedStates=m.savedStates||[],m.normalizeStore=function(){m.store.idToState=m.store.idToState||{},m.store.urlToId=m.store.urlToId||{},m.store.stateToId=m.store.stateToId||{}},m.getState=function(a,b){typeof a=="undefined"&&(a=!0),typeof b=="undefined"&&(b=!0);var c=m.getLastSavedState();return!c&&b&&(c=m.createStateObject()),a&&(c=m.cloneObject(c),c.url=c.cleanUrl||c.url),c},m.getIdByState=function(a){var b=m.extractId(a.url),c;if(!b){c=m.getStateString(a);if(typeof m.stateToId[c]!="undefined")b=m.stateToId[c];else if(typeof m.store.stateToId[c]!="undefined")b=m.store.stateToId[c];else{for(;;){b=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof m.idToState[b]=="undefined"&&typeof m.store.idToState[b]=="undefined")break}m.stateToId[c]=b,m.idToState[b]=a}}return b},m.normalizeState=function(a){var b,c;if(!a||typeof a!="object")a={};if(typeof a.normalized!="undefined")return a;if(!a.data||typeof a.data!="object")a.data={};b={},b.normalized=!0,b.title=a.title||"",b.url=m.getFullUrl(m.unescapeString(a.url||d.location.href)),b.hash=m.getShortUrl(b.url),b.data=m.cloneObject(a.data),b.id=m.getIdByState(b),b.cleanUrl=b.url.replace(/\??\&_suid.*/,""),b.url=b.cleanUrl,c=!m.isEmptyObject(b.data);if(b.title||c)b.hash=m.getShortUrl(b.url).replace(/\??\&_suid.*/,""),/\?/.test(b.hash)||(b.hash+="?"),b.hash+="&_suid="+b.id;return b.hashedUrl=m.getFullUrl(b.hash),(m.emulated.pushState||m.bugs.safariPoll)&&m.hasUrlDuplicate(b)&&(b.url=b.hashedUrl),b},m.createStateObject=function(a,b,c){var d={data:a,title:b,url:c};return d=m.normalizeState(d),d},m.getStateById=function(a){a=String(a);var c=m.idToState[a]||m.store.idToState[a]||b;return c},m.getStateString=function(a){var b,c,d;return b=m.normalizeState(a),c={data:b.data,title:a.title,url:a.url},d=k.stringify(c),d},m.getStateId=function(a){var b,c;return b=m.normalizeState(a),c=b.id,c},m.getHashByState=function(a){var b,c;return b=m.normalizeState(a),c=b.hash,c},m.extractId=function(a){var b,c,d;return c=/(.*)\&_suid=([0-9]+)$/.exec(a),d=c?c[1]||a:a,b=c?String(c[2]||""):"",b||!1},m.isTraditionalAnchor=function(a){var b=!/[\/\?\.]/.test(a);return b},m.extractState=function(a,b){var c=null,d,e;return b=b||!1,d=m.extractId(a),d&&(c=m.getStateById(d)),c||(e=m.getFullUrl(a),d=m.getIdByUrl(e)||!1,d&&(c=m.getStateById(d)),!c&&b&&!m.isTraditionalAnchor(a)&&(c=m.createStateObject(null,null,e))),c},m.getIdByUrl=function(a){var c=m.urlToId[a]||m.store.urlToId[a]||b;return c},m.getLastSavedState=function(){return m.savedStates[m.savedStates.length-1]||b},m.getLastStoredState=function(){return m.storedStates[m.storedStates.length-1]||b},m.hasUrlDuplicate=function(a){var b=!1,c;return c=m.extractState(a.url),b=c&&c.id!==a.id,b},m.storeState=function(a){return m.urlToId[a.url]=a.id,m.storedStates.push(m.cloneObject(a)),a},m.isLastSavedState=function(a){var b=!1,c,d,e;return m.savedStates.length&&(c=a.id,d=m.getLastSavedState(),e=d.id,b=c===e),b},m.saveState=function(a){return m.isLastSavedState(a)?!1:(m.savedStates.push(m.cloneObject(a)),!0)},m.getStateByIndex=function(a){var b=null;return typeof a=="undefined"?b=m.savedStates[m.savedStates.length-1]:a<0?b=m.savedStates[m.savedStates.length+a]:b=m.savedStates[a],b},m.getHash=function(){var a=m.unescapeHash(d.location.hash);return a},m.unescapeString=function(b){var c=b,d;for(;;){d=a.unescape(c);if(d===c)break;c=d}return c},m.unescapeHash=function(a){var b=m.normalizeHash(a);return b=m.unescapeString(b),b},m.normalizeHash=function(a){var b=a.replace(/[^#]*#/,"").replace(/#.*/,"");return b},m.setHash=function(a,b){var c,e,f;return b!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.setHash,args:arguments,queue:b}),!1):(c=m.escapeHash(a),m.busy(!0),e=m.extractState(a,!0),e&&!m.emulated.pushState?m.pushState(e.data,e.title,e.url,!1):d.location.hash!==c&&(m.bugs.setHash?(f=m.getPageUrl(),m.pushState(null,null,f+"#"+c,!1)):d.location.hash=c),m)},m.escapeHash=function(b){var c=m.normalizeHash(b);return c=a.escape(c),m.bugs.hashEscape||(c=c.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),c},m.getHashByUrl=function(a){var b=String(a).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return b=m.unescapeHash(b),b},m.setTitle=function(a){var b=a.title,c;b||(c=m.getStateByIndex(0),c&&c.url===a.url&&(b=c.title||m.options.initialTitle));try{d.getElementsByTagName("title")[0].innerHTML=b.replace("<","<").replace(">",">").replace(" & "," & ")}catch(e){}return d.title=b,m},m.queues=[],m.busy=function(a){typeof a!="undefined"?m.busy.flag=a:typeof m.busy.flag=="undefined"&&(m.busy.flag=!1);if(!m.busy.flag){h(m.busy.timeout);var b=function(){var a,c,d;if(m.busy.flag)return;for(a=m.queues.length-1;a>=0;--a){c=m.queues[a];if(c.length===0)continue;d=c.shift(),m.fireQueueItem(d),m.busy.timeout=g(b,m.options.busyDelay)}};m.busy.timeout=g(b,m.options.busyDelay)}return m.busy.flag},m.busy.flag=!1,m.fireQueueItem=function(a){return a.callback.apply(a.scope||m,a.args||[])},m.pushQueue=function(a){return m.queues[a.queue||0]=m.queues[a.queue||0]||[],m.queues[a.queue||0].push(a),m},m.queue=function(a,b){return typeof a=="function"&&(a={callback:a}),typeof b!="undefined"&&(a.queue=b),m.busy()?m.pushQueue(a):m.fireQueueItem(a),m},m.clearQueue=function(){return m.busy.flag=!1,m.queues=[],m},m.stateChanged=!1,m.doubleChecker=!1,m.doubleCheckComplete=function(){return m.stateChanged=!0,m.doubleCheckClear(),m},m.doubleCheckClear=function(){return m.doubleChecker&&(h(m.doubleChecker),m.doubleChecker=!1),m},m.doubleCheck=function(a){return m.stateChanged=!1,m.doubleCheckClear(),m.bugs.ieDoubleCheck&&(m.doubleChecker=g(function(){return m.doubleCheckClear(),m.stateChanged||a(),!0},m.options.doubleCheckInterval)),m},m.safariStatePoll=function(){var b=m.extractState(d.location.href),c;if(!m.isLastSavedState(b))c=b;else return;return c||(c=m.createStateObject()),m.Adapter.trigger(a,"popstate"),m},m.back=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.back,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.back(!1)}),n.go(-1),!0)},m.forward=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.forward,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.forward(!1)}),n.go(1),!0)},m.go=function(a,b){var c;if(a>0)for(c=1;c<=a;++c)m.forward(b);else{if(!(a<0))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(c=-1;c>=a;--c)m.back(b)}return m};if(m.emulated.pushState){var o=function(){};m.pushState=m.pushState||o,m.replaceState=m.replaceState||o}else m.onPopState=function(b,c){var e=!1,f=!1,g,h;return m.doubleCheckComplete(),g=m.getHash(),g?(h=m.extractState(g||d.location.href,!0),h?m.replaceState(h.data,h.title,h.url,!1):(m.Adapter.trigger(a,"anchorchange"),m.busy(!1)),m.expectedStateId=!1,!1):(e=m.Adapter.extractEventData("state",b,c)||!1,e?f=m.getStateById(e):m.expectedStateId?f=m.getStateById(m.expectedStateId):f=m.extractState(d.location.href),f||(f=m.createStateObject(null,null,d.location.href)),m.expectedStateId=!1,m.isLastSavedState(f)?(m.busy(!1),!1):(m.storeState(f),m.saveState(f),m.setTitle(f),m.Adapter.trigger(a,"statechange"),m.busy(!1),!0))},m.Adapter.bind(a,"popstate",m.onPopState),m.pushState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.pushState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.pushState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0},m.replaceState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.replaceState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.replaceState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0};if(f){try{m.store=k.parse(f.getItem("History.store"))||{}}catch(p){m.store={}}m.normalizeStore()}else m.store={},m.normalizeStore();m.Adapter.bind(a,"beforeunload",m.clearAllIntervals),m.Adapter.bind(a,"unload",m.clearAllIntervals),m.saveState(m.storeState(m.extractState(d.location.href,!0))),f&&(m.onUnload=function(){var a,b;try{a=k.parse(f.getItem("History.store"))||{}}catch(c){a={}}a.idToState=a.idToState||{},a.urlToId=a.urlToId||{},a.stateToId=a.stateToId||{};for(b in m.idToState){if(!m.idToState.hasOwnProperty(b))continue;a.idToState[b]=m.idToState[b]}for(b in m.urlToId){if(!m.urlToId.hasOwnProperty(b))continue;a.urlToId[b]=m.urlToId[b]}for(b in m.stateToId){if(!m.stateToId.hasOwnProperty(b))continue;a.stateToId[b]=m.stateToId[b]}m.store=a,m.normalizeStore(),f.setItem("History.store",k.stringify(a))},m.intervalList.push(i(m.onUnload,m.options.storeInterval)),m.Adapter.bind(a,"beforeunload",m.onUnload),m.Adapter.bind(a,"unload",m.onUnload));if(!m.emulated.pushState){m.bugs.safariPoll&&m.intervalList.push(i(m.safariStatePoll,m.options.safariPollInterval));if(e.vendor==="Apple Computer, Inc."||(e.appCodeName||"")==="Mozilla")m.Adapter.bind(a,"hashchange",function(){m.Adapter.trigger(a,"popstate")}),m.getHash()&&m.Adapter.onDomLoad(function(){m.Adapter.trigger(a,"hashchange")})}},m.init()}(window)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module ConstructorPages
|
4
|
+
class ApplicationController < ConstructorCore::ApplicationController
|
5
|
+
def self.movable(what)
|
6
|
+
%w{up down}.each {|m| define_method "move_#{m}" do move_to what, params[:id], m.to_sym end}
|
7
|
+
end
|
8
|
+
|
9
|
+
def move_to(what, id, to)
|
10
|
+
from = ('constructor_pages/'+what.to_s).classify.constantize.find(id)
|
11
|
+
to_sibling = to == :up ? from.left_sibling : from.right_sibling
|
12
|
+
|
13
|
+
if not to_sibling.nil? and from.move_possible?(to_sibling)
|
14
|
+
to == :up ? from.move_left : from.move_right
|
15
|
+
end
|
16
|
+
|
17
|
+
redirect_to :back
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module ConstructorPages
|
4
|
+
class FieldsController < ApplicationController
|
5
|
+
def new
|
6
|
+
@field = Field.new.tap {|f| f.template = Template.find(params[:template_id])}
|
7
|
+
end
|
8
|
+
|
9
|
+
def edit
|
10
|
+
@field = Field.find(params[:id]).tap {|f| f.template = Template.find(params[:template_id])}
|
11
|
+
end
|
12
|
+
|
13
|
+
def create
|
14
|
+
@field = Field.new field_params
|
15
|
+
|
16
|
+
if @field.save
|
17
|
+
redirect_to edit_template_path(@field.template_id), notice: t(:field_success_added, name: @field.name)
|
18
|
+
else
|
19
|
+
render action: :new, template_id: @field.template_id
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def update
|
24
|
+
@field = Field.find params[:id]
|
25
|
+
|
26
|
+
unless @field.type_value == params[:field][:type_value]
|
27
|
+
@field.type_class.where(field_id: @field.id).each do |field|
|
28
|
+
"constructor_pages/types/#{params[:field][:type_value]}_type".classify.constantize.new(
|
29
|
+
field_id: @field.id, page_id: field.page_id).tap {|f|
|
30
|
+
f.value = field.value unless [@field.type_value, params[:field][:type_value]].include?('image') and
|
31
|
+
(@field.type_value == 'string' and field.value.strip == '')
|
32
|
+
f.save; field.destroy
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
if @field.update field_params
|
38
|
+
redirect_to edit_template_url(@field.template.id), notice: t(:field_success_updated, name: @field.name)
|
39
|
+
else
|
40
|
+
render action: :edit
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def destroy
|
45
|
+
@field = Field.find(params[:id])
|
46
|
+
name, template = @field.name, @field.template.id
|
47
|
+
@field.destroy
|
48
|
+
redirect_to edit_template_url(template), notice: t(:field_success_removed, name: name)
|
49
|
+
end
|
50
|
+
|
51
|
+
%w{up down}.each {|m| define_method "move_#{m}" do move_to m.to_sym end}
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def field_params
|
56
|
+
params.require(:field).permit(
|
57
|
+
:name,
|
58
|
+
:code_name,
|
59
|
+
:template_id,
|
60
|
+
:type_value
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def move_to(to)
|
65
|
+
@field = Field.find(params[:id])
|
66
|
+
to == :up ? @field.move_higher : @field.move_lower
|
67
|
+
redirect_to :back, notice: t(:field_success_moved, name: @field.name)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module ConstructorPages
|
4
|
+
class PagesController < ApplicationController
|
5
|
+
movable :page
|
6
|
+
|
7
|
+
before_filter {@roots, @template_exists = Page.roots, Template.count > 0}
|
8
|
+
|
9
|
+
def index
|
10
|
+
flash.notice = 'Create at least one template' unless @template_exists
|
11
|
+
end
|
12
|
+
|
13
|
+
def new
|
14
|
+
redirect_to pages_path and return unless @template_exists
|
15
|
+
@page, @template_id, @multipart = Page.new, Template.first.id, false
|
16
|
+
|
17
|
+
if params[:page] and (@page.parent = Page.find(params[:page]))
|
18
|
+
@template_id = @page.parent.template.child.id
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def show
|
23
|
+
@page = Page.find_by_request_or_first("/#{params[:all]}")
|
24
|
+
|
25
|
+
error_404 and return if @page.nil? or !@page.active?
|
26
|
+
|
27
|
+
redirect_to @page.link if @page.redirect?
|
28
|
+
|
29
|
+
_code_name = @page.template.code_name.to_s
|
30
|
+
|
31
|
+
instance_variable_set('@'+_code_name, @page)
|
32
|
+
|
33
|
+
respond_to do |format|
|
34
|
+
format.html { render template: "html_templates/#{_code_name}" }
|
35
|
+
format.json {
|
36
|
+
_template = render_to_string partial: "json_templates/#{_code_name}.json.erb", layout: false, locals: {_code_name.to_sym => @page, page: @page}
|
37
|
+
_js = render_to_string partial: "js_partials/#{_code_name}.js"
|
38
|
+
|
39
|
+
render json: @page, self_and_ancestors: @page.self_and_ancestors.map(&:id), template: _template.gsub(/\n/, '\\\\n'), js: _js
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
=begin
|
45
|
+
def search
|
46
|
+
if params[:all].nil?
|
47
|
+
@page = Page.first
|
48
|
+
else
|
49
|
+
@request = '/' + params[:all]
|
50
|
+
@page = Page.where(:full_url => @request).first
|
51
|
+
end
|
52
|
+
|
53
|
+
instance_variable_set('@'+@page.template.code_name.to_s, @page)
|
54
|
+
|
55
|
+
what_search = params[:what_search]
|
56
|
+
params_selection = request.query_parameters
|
57
|
+
|
58
|
+
template = Template.find_by_code_name(what_search.singularize)
|
59
|
+
|
60
|
+
if template.nil?
|
61
|
+
render :action => "error_404", :layout => false
|
62
|
+
return
|
63
|
+
end
|
64
|
+
|
65
|
+
@pages = @page.descendants.where(:template_id => template.id)
|
66
|
+
|
67
|
+
params_selection.each_pair do |code_name, value|
|
68
|
+
if value.numeric?
|
69
|
+
value = value.to_f
|
70
|
+
elsif value.boolean?
|
71
|
+
value = value.to_bool
|
72
|
+
end
|
73
|
+
|
74
|
+
@pages = @pages.select do |page|
|
75
|
+
if code_name == 'name'
|
76
|
+
page.name == value
|
77
|
+
else
|
78
|
+
page.field(code_name) == value
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
instance_variable_set('@'+template.code_name.pluralize, @pages)
|
84
|
+
|
85
|
+
render :template => "templates/#{template.code_name}_search"
|
86
|
+
end
|
87
|
+
=end
|
88
|
+
|
89
|
+
def edit
|
90
|
+
@page = Page.find(params[:id])
|
91
|
+
@page.template ||= Template.first
|
92
|
+
@template_id = @page.template.id
|
93
|
+
|
94
|
+
@multipart = @page.fields.map{|f| f.type_value == 'image'}.include?(true) ? true : false
|
95
|
+
end
|
96
|
+
|
97
|
+
def create
|
98
|
+
@page = Page.new page_params
|
99
|
+
|
100
|
+
if @page.save
|
101
|
+
redirect_to pages.pages_url, notice: t(:page_success_added, name: @page.name)
|
102
|
+
else
|
103
|
+
render action: :new
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def update
|
108
|
+
@page = Page.find params[:id]
|
109
|
+
|
110
|
+
_template_changed = @page.template.id != params[:page][:template_id].to_i
|
111
|
+
|
112
|
+
@page.remove_fields_values if _template_changed
|
113
|
+
|
114
|
+
if @page.update page_params
|
115
|
+
@page.create_fields_values if _template_changed
|
116
|
+
@page.update_fields_values params[:fields]
|
117
|
+
|
118
|
+
redirect_to pages_url, notice: t(:page_success_updated, name: @page.name)
|
119
|
+
else
|
120
|
+
render action: :edit
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def destroy
|
125
|
+
@page = Page.find(params[:id])
|
126
|
+
_name = @page.name
|
127
|
+
@page.destroy
|
128
|
+
redirect_to pages_url, notice: t(:page_success_removed, name: _name)
|
129
|
+
end
|
130
|
+
|
131
|
+
private
|
132
|
+
|
133
|
+
def page_params
|
134
|
+
params.require(:page).permit(
|
135
|
+
:active,
|
136
|
+
:name,
|
137
|
+
:url,
|
138
|
+
:title,
|
139
|
+
:keywords,
|
140
|
+
:description,
|
141
|
+
:auto_url,
|
142
|
+
:parent_id,
|
143
|
+
:template_id,
|
144
|
+
:in_nav,
|
145
|
+
:in_map,
|
146
|
+
:in_menu,
|
147
|
+
:link
|
148
|
+
)
|
149
|
+
end
|
150
|
+
|
151
|
+
def error_404
|
152
|
+
render file: "#{Rails.root}/public/404", layout: false, status: 404
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|