slices 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -0
- data/README.md +51 -0
- data/Rakefile +9 -0
- data/app/assets/images/slices/ajax-loader.gif +0 -0
- data/app/assets/images/slices/asset-background.png +0 -0
- data/app/assets/images/slices/asset-spinner.gif +0 -0
- data/app/assets/images/slices/bg_header.gif +0 -0
- data/app/assets/images/slices/black-Linen.png +0 -0
- data/app/assets/images/slices/calendar.svg +68 -0
- data/app/assets/images/slices/chosen-sprite.png +0 -0
- data/app/assets/images/slices/drag-handle.svg +9 -0
- data/app/assets/images/slices/icon_admins.png +0 -0
- data/app/assets/images/slices/icon_app.png +0 -0
- data/app/assets/images/slices/icon_assets.png +0 -0
- data/app/assets/images/slices/icon_collapse.png +0 -0
- data/app/assets/images/slices/icon_drag.png +0 -0
- data/app/assets/images/slices/icon_files.png +0 -0
- data/app/assets/images/slices/icon_generic_file.png +0 -0
- data/app/assets/images/slices/icon_images.png +0 -0
- data/app/assets/images/slices/icon_padlock.png +0 -0
- data/app/assets/images/slices/icon_page.png +0 -0
- data/app/assets/images/slices/icon_search.png +0 -0
- data/app/assets/images/slices/icon_set-link.png +0 -0
- data/app/assets/images/slices/icon_set.png +0 -0
- data/app/assets/images/slices/icon_sitemap.png +0 -0
- data/app/assets/images/slices/icon_snippets.png +0 -0
- data/app/assets/images/slices/icon_template.jpg +0 -0
- data/app/assets/images/slices/icon_upload_happy.png +0 -0
- data/app/assets/images/slices/icon_upload_sad.png +0 -0
- data/app/assets/images/slices/icon_upload_thinking.png +0 -0
- data/app/assets/images/slices/noise.png +0 -0
- data/app/assets/images/slices/sitemap_icon_ghost.png +0 -0
- data/app/assets/images/slices/sitemap_icon_home.png +0 -0
- data/app/assets/images/slices/sitemap_icon_page.png +0 -0
- data/app/assets/images/slices/sitemap_icon_set_page.png +0 -0
- data/app/assets/images/slices/sitemap_icon_virtual_page.png +0 -0
- data/app/assets/images/slices/sitemap_overlay.png +0 -0
- data/app/assets/images/slices/spinner.gif +0 -0
- data/app/assets/images/slices/trash.png +0 -0
- data/app/assets/javascripts/admin.js.erb +18 -0
- data/app/assets/javascripts/slices/app/backbones/admins.js +114 -0
- data/app/assets/javascripts/slices/app/backbones/entries.js +172 -0
- data/app/assets/javascripts/slices/app/backbones/generic.js +101 -0
- data/app/assets/javascripts/slices/app/backbones/snippets.js +113 -0
- data/app/assets/javascripts/slices/app/helpers/assets.js +61 -0
- data/app/assets/javascripts/slices/app/helpers/breadcrumbs.js +30 -0
- data/app/assets/javascripts/slices/app/helpers/composer.js +26 -0
- data/app/assets/javascripts/slices/app/helpers/date_field.js +16 -0
- data/app/assets/javascripts/slices/app/helpers/get_value.js +31 -0
- data/app/assets/javascripts/slices/app/helpers/icon_upload_names.js.erb +5 -0
- data/app/assets/javascripts/slices/app/helpers/layout.js +20 -0
- data/app/assets/javascripts/slices/app/helpers/sitemap.js +150 -0
- data/app/assets/javascripts/slices/app/helpers/slice_preview.js +48 -0
- data/app/assets/javascripts/slices/app/helpers/tagging.js +73 -0
- data/app/assets/javascripts/slices/app/helpers/token_field.js +17 -0
- data/app/assets/javascripts/slices/app/helpers/upload_icons.js.erb +5 -0
- data/app/assets/javascripts/slices/app/helpers/uploader.js +127 -0
- data/app/assets/javascripts/slices/app/models/asset.js +29 -0
- data/app/assets/javascripts/slices/app/models/asset_collection.js +41 -0
- data/app/assets/javascripts/slices/app/models/attachment.js +29 -0
- data/app/assets/javascripts/slices/app/models/attachment_collection.js +7 -0
- data/app/assets/javascripts/slices/app/models/composer_item.js +1 -0
- data/app/assets/javascripts/slices/app/models/composer_item_collection.js +3 -0
- data/app/assets/javascripts/slices/app/models/file.js +103 -0
- data/app/assets/javascripts/slices/app/models/page.js +186 -0
- data/app/assets/javascripts/slices/app/models/s3_file.js +64 -0
- data/app/assets/javascripts/slices/app/slices.js +661 -0
- data/app/assets/javascripts/slices/app/views/asset_editor_view.js.erb +209 -0
- data/app/assets/javascripts/slices/app/views/asset_library_view.js +720 -0
- data/app/assets/javascripts/slices/app/views/asset_thumb_view.js.erb +191 -0
- data/app/assets/javascripts/slices/app/views/attachment_composer_view.js +350 -0
- data/app/assets/javascripts/slices/app/views/attachment_view.js +101 -0
- data/app/assets/javascripts/slices/app/views/calendar_view.js +198 -0
- data/app/assets/javascripts/slices/app/views/composer_item_view.js +54 -0
- data/app/assets/javascripts/slices/app/views/composer_view.js +130 -0
- data/app/assets/javascripts/slices/app/views/date_field_view.js +177 -0
- data/app/assets/javascripts/slices/app/views/file_view.js +142 -0
- data/app/assets/javascripts/slices/app/views/token_field_view.js +253 -0
- data/app/assets/javascripts/slices/lib/freeze.js +14 -0
- data/app/assets/javascripts/slices/lib/human_file_size.js +16 -0
- data/app/assets/javascripts/slices/lib/json_patch.js +9 -0
- data/app/assets/javascripts/slices/lib/moment.js +47 -0
- data/app/assets/javascripts/slices/lib/plugins.js +101 -0
- data/app/assets/javascripts/slices/lib/sortable.js +14 -0
- data/app/assets/javascripts/slices/slices.js +27 -0
- data/app/assets/javascripts/slices/vendor/autoscroll.js +188 -0
- data/app/assets/javascripts/slices/vendor/backbone.js +38 -0
- data/app/assets/javascripts/slices/vendor/handlebars.js +1920 -0
- data/app/assets/javascripts/slices/vendor/jqmodal.js +69 -0
- data/app/assets/javascripts/slices/vendor/jquery-ui.js +274 -0
- data/app/assets/javascripts/slices/vendor/jquery-ui_nested-sortable.js +357 -0
- data/app/assets/javascripts/slices/vendor/jquery.ajaxprogress.js +76 -0
- data/app/assets/javascripts/slices/vendor/jquery.js +2 -0
- data/app/assets/javascripts/slices/vendor/livefield.js +459 -0
- data/app/assets/javascripts/slices/vendor/moment.js +6 -0
- data/app/assets/javascripts/slices/vendor/rails.js +315 -0
- data/app/assets/javascripts/slices/vendor/underscore-string.js +1 -0
- data/app/assets/javascripts/slices/vendor/underscore.js +5 -0
- data/app/assets/stylesheets/admin.css +1 -0
- data/app/assets/stylesheets/slices/admin.css.erb +2237 -0
- data/app/assets/stylesheets/slices/reset_html5.css +106 -0
- data/app/assets/stylesheets/slices/slices.css +7 -0
- data/app/controllers/admin/admin_controller.rb +10 -0
- data/app/controllers/admin/admins_controller.rb +76 -0
- data/app/controllers/admin/assets_controller.rb +53 -0
- data/app/controllers/admin/auth/omniauth_callbacks_controller.rb +15 -0
- data/app/controllers/admin/auth/passwords_controller.rb +4 -0
- data/app/controllers/admin/auth/sessions_controller.rb +4 -0
- data/app/controllers/admin/entries_controller.rb +88 -0
- data/app/controllers/admin/page_search_controller.rb +12 -0
- data/app/controllers/admin/pages_controller.rb +103 -0
- data/app/controllers/admin/site_maps_controller.rb +15 -0
- data/app/controllers/admin/snippets_controller.rb +33 -0
- data/app/controllers/application_controller.rb +4 -0
- data/app/controllers/pages_controller.rb +45 -0
- data/app/controllers/slices_controller.rb +63 -0
- data/app/controllers/static_assets_controller.rb +52 -0
- data/app/helpers/admin/admin_helper.rb +63 -0
- data/app/helpers/admin/assets_helper.rb +36 -0
- data/app/helpers/admin/entries_helper.rb +13 -0
- data/app/helpers/admin/site_maps_helper.rb +104 -0
- data/app/helpers/assets_helper.rb +64 -0
- data/app/helpers/navigation_helper.rb +195 -0
- data/app/helpers/pages_helper.rb +119 -0
- data/app/models/admin.rb +34 -0
- data/app/models/asset.rb +211 -0
- data/app/models/attachment.rb +11 -0
- data/app/models/layout.rb +44 -0
- data/app/models/page.rb +214 -0
- data/app/models/placeholder_slice.rb +8 -0
- data/app/models/set_page.rb +12 -0
- data/app/models/set_slice.rb +57 -0
- data/app/models/site_map.rb +24 -0
- data/app/models/slice.rb +80 -0
- data/app/models/snippet.rb +21 -0
- data/app/observers/asset_observer.rb +6 -0
- data/app/observers/page_observer.rb +37 -0
- data/app/presenters/entry_presenter.rb +17 -0
- data/app/presenters/page_presenter.rb +67 -0
- data/app/presenters/presenter.rb +9 -0
- data/app/presenters/set_page_presenter.rb +2 -0
- data/app/views/admin/admins/index.html.erb +26 -0
- data/app/views/admin/admins/show.html.erb +27 -0
- data/app/views/admin/assets/index.html.erb +1 -0
- data/app/views/admin/auth/passwords/edit.html.erb +20 -0
- data/app/views/admin/auth/passwords/new.html.erb +14 -0
- data/app/views/admin/auth/sessions/_form.html.erb +35 -0
- data/app/views/admin/auth/sessions/new.html.erb +14 -0
- data/app/views/admin/entries/index.html.erb +32 -0
- data/app/views/admin/pages/_breadcrumbs.html.erb +32 -0
- data/app/views/admin/pages/_slices.html.erb +27 -0
- data/app/views/admin/pages/new.html.erb +14 -0
- data/app/views/admin/pages/show.html.erb +50 -0
- data/app/views/admin/shared/_asset_storage.html.erb +17 -0
- data/app/views/admin/shared/_custom_links.html.erb +1 -0
- data/app/views/admin/shared/_custom_navigation.html.erb +1 -0
- data/app/views/admin/shared/_navigation.html.erb +5 -0
- data/app/views/admin/site_maps/_page_li.html.erb +20 -0
- data/app/views/admin/site_maps/_set_page_li.html.erb +23 -0
- data/app/views/admin/site_maps/index.html.erb +29 -0
- data/app/views/admin/snippets/form.html.erb +12 -0
- data/app/views/admin/snippets/index.html.erb +20 -0
- data/app/views/admin/snippets/update.html.erb +0 -0
- data/app/views/layouts/admin.html.erb +72 -0
- data/lib/ext/file_store_cache.rb +18 -0
- data/lib/generators/humans/USAGE +8 -0
- data/lib/generators/humans/humans_generator.rb +10 -0
- data/lib/generators/humans/templates/humans.txt +6 -0
- data/lib/generators/slice/USAGE +28 -0
- data/lib/generators/slice/slice_generator.rb +123 -0
- data/lib/generators/slice/templates/main_fields.hbs +11 -0
- data/lib/generators/slice/templates/meta_fields.hbs +11 -0
- data/lib/generators/slice/templates/page.rb +19 -0
- data/lib/generators/slice/templates/presenter.rb +53 -0
- data/lib/generators/slice/templates/set.html.erb +8 -0
- data/lib/generators/slice/templates/set_slice.rb +14 -0
- data/lib/generators/slice/templates/set_slice_fields.hbs +5 -0
- data/lib/generators/slice/templates/show.html.erb +48 -0
- data/lib/generators/slice/templates/show_slice.rb +20 -0
- data/lib/generators/slice/templates/slice.rb +58 -0
- data/lib/generators/slice/templates/slice_fields.hbs +74 -0
- data/lib/generators/templates/slices.rb +211 -0
- data/lib/mongo_search.rb +84 -0
- data/lib/paperclip_validator.rb +5 -0
- data/lib/rack_utf8_fix.rb +10 -0
- data/lib/sRGB.icc +0 -0
- data/lib/set_link_renderer.rb +31 -0
- data/lib/slices.rb +68 -0
- data/lib/slices/asset/maker.rb +55 -0
- data/lib/slices/asset/rename.rb +67 -0
- data/lib/slices/available_slices.rb +43 -0
- data/lib/slices/cms_form_builder.rb +42 -0
- data/lib/slices/config.rb +93 -0
- data/lib/slices/container_parser.rb +70 -0
- data/lib/slices/generator_macros.rb +36 -0
- data/lib/slices/has_attachments.rb +111 -0
- data/lib/slices/has_slices.rb +88 -0
- data/lib/slices/i18n.rb +6 -0
- data/lib/slices/i18n/backend.rb +32 -0
- data/lib/slices/i18n_backend.rb +24 -0
- data/lib/slices/paperclip.rb +13 -0
- data/lib/slices/position_helper.rb +98 -0
- data/lib/slices/renderer.rb +52 -0
- data/lib/slices/slices_engine.rb +51 -0
- data/lib/slices/split_date_time_field.rb +14 -0
- data/lib/slices/tasks/assets.rake +35 -0
- data/lib/slices/tasks/db.rake +50 -0
- data/lib/slices/tasks/seeds.rake +93 -0
- data/lib/slices/tasks/validate.rake +62 -0
- data/lib/slices/tree.rb +306 -0
- data/lib/slices/version.rb +4 -0
- data/lib/slices/will_paginate.rb +12 -0
- data/lib/slices/will_paginate_mongoid.rb +45 -0
- data/lib/standard_tree.rb +193 -0
- metadata +483 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
class Snippet
|
2
|
+
include Mongoid::Document
|
3
|
+
|
4
|
+
field :key
|
5
|
+
field :value
|
6
|
+
index :key
|
7
|
+
|
8
|
+
scope :by_key, ascending(:key)
|
9
|
+
|
10
|
+
def self.find_value_by_key(key)
|
11
|
+
find(:first, conditions: { key: key }).try(:value)
|
12
|
+
end
|
13
|
+
|
14
|
+
def as_json(*args)
|
15
|
+
{
|
16
|
+
id: id.to_s,
|
17
|
+
key: key,
|
18
|
+
value: value,
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class PageObserver < Mongoid::Observer
|
2
|
+
attr_accessor :record
|
3
|
+
|
4
|
+
def around_save(record)
|
5
|
+
self.record = record
|
6
|
+
|
7
|
+
if attachment_assets_changed?
|
8
|
+
attachment_assets = record.attachment_assets
|
9
|
+
to_update = record.assets + attachment_assets
|
10
|
+
record.assets = attachment_assets
|
11
|
+
end
|
12
|
+
|
13
|
+
yield
|
14
|
+
|
15
|
+
if page_changed? || did_attachment_assets_change?
|
16
|
+
(to_update || record.assets).each do |asset|
|
17
|
+
asset.reload
|
18
|
+
asset.save
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
true # Not returning true causes problems with Mongoid 2.5.1
|
23
|
+
end
|
24
|
+
|
25
|
+
def attachment_assets_changed?
|
26
|
+
@did_attachment_assets_change = record.attachment_asset_ids != record.asset_ids
|
27
|
+
end
|
28
|
+
|
29
|
+
def did_attachment_assets_change?
|
30
|
+
@did_attachment_assets_change
|
31
|
+
end
|
32
|
+
|
33
|
+
def page_changed?
|
34
|
+
record.path_changed?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,67 @@
|
|
1
|
+
class PagePresenter < Presenter
|
2
|
+
def bson_id
|
3
|
+
@source.id.to_s
|
4
|
+
end
|
5
|
+
|
6
|
+
def available_slices
|
7
|
+
slices = {}
|
8
|
+
ObjectSpace.each_object do |object|
|
9
|
+
ActiveSupport::Deprecation.silence do
|
10
|
+
if object.class == Class && object.name =~ /\w+Slice$/
|
11
|
+
key = object.name.underscore.sub('_slice', '')
|
12
|
+
slices[key] = key.humanize
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
slices
|
17
|
+
end
|
18
|
+
|
19
|
+
def name
|
20
|
+
@source.name
|
21
|
+
end
|
22
|
+
|
23
|
+
def editing_entry_content_slices?(entries)
|
24
|
+
set_page? && (! entries.nil?)
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_page?
|
28
|
+
@source.set_page?
|
29
|
+
end
|
30
|
+
|
31
|
+
def main_template
|
32
|
+
'page_main'
|
33
|
+
end
|
34
|
+
|
35
|
+
def meta_template
|
36
|
+
'page_meta'
|
37
|
+
end
|
38
|
+
|
39
|
+
def main_extra_template
|
40
|
+
'page_main_extra'
|
41
|
+
end
|
42
|
+
|
43
|
+
def meta_extra_template
|
44
|
+
'page_meta_extra'
|
45
|
+
end
|
46
|
+
|
47
|
+
def breadcrumbs
|
48
|
+
[@source] + @source.ancestors
|
49
|
+
end
|
50
|
+
|
51
|
+
def children
|
52
|
+
@source.children
|
53
|
+
end
|
54
|
+
|
55
|
+
def as_json(options={})
|
56
|
+
json = {
|
57
|
+
'_id' => @source.id,
|
58
|
+
'url' => "/admin/pages/#{@source.id}"
|
59
|
+
}
|
60
|
+
self.class.columns.each do |key, val|
|
61
|
+
json[key.to_s] = send(key)
|
62
|
+
end
|
63
|
+
json
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<div id="container-actions" class="toolbar">
|
2
|
+
<input type="search" id="entries-search" placeholder="Search admin users…">
|
3
|
+
<div class="actions">
|
4
|
+
<ul>
|
5
|
+
<li><input type="submit" value="Add Admin" id='add-admin' name='add-admin'/></li>
|
6
|
+
</ul>
|
7
|
+
</div>
|
8
|
+
<ul id="pagination">
|
9
|
+
</ul>
|
10
|
+
</div>
|
11
|
+
<div id="main">
|
12
|
+
<section>
|
13
|
+
<table class="elements-table" id='entries-list'>
|
14
|
+
<thead>
|
15
|
+
<tr><th>Name</th><th>Email</th><th>Last Login</th><th></th></tr>
|
16
|
+
</thead>
|
17
|
+
<tbody>
|
18
|
+
</tbody>
|
19
|
+
</table>
|
20
|
+
</section>
|
21
|
+
</div>
|
22
|
+
<% content_for :js_head do %>
|
23
|
+
$(function() {
|
24
|
+
AdminsBackbone.boot();
|
25
|
+
});
|
26
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= form_for [:admin, @admin],
|
2
|
+
html: {multipart: true},
|
3
|
+
builder: Slices::CmsFormBuilder do |form| %>
|
4
|
+
<div id="container-actions" class="toolbar">
|
5
|
+
|
6
|
+
<div class="actions">
|
7
|
+
<ul>
|
8
|
+
<li><input type="submit" value="Save" class="add"/></li>
|
9
|
+
<% if ! @admin.new_record? %>
|
10
|
+
<li><%= link_to 'Delete' , admin_admin_path(@admin), method: :delete, class: 'delete' %></li>
|
11
|
+
<% end %>
|
12
|
+
</ul>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div id="main" class="with-padding">
|
17
|
+
<section class="admins-editor">
|
18
|
+
<ul>
|
19
|
+
<%= form.cms_text_field :name %>
|
20
|
+
<%= form.cms_text_field :email %>
|
21
|
+
<%= form.cms_password_field :password %>
|
22
|
+
<%= form.cms_password_field :password_confirmation %>
|
23
|
+
</ul>
|
24
|
+
</section>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
27
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<script>library = slices.renderAssetLibrary({ mode: 'full' })</script>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<div class="login">
|
2
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
3
|
+
<%= devise_error_messages! %>
|
4
|
+
<%= f.hidden_field :reset_password_token %>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<%= f.label :password, "New password" %><br />
|
8
|
+
<%= f.password_field :password %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
13
|
+
<%= f.password_field :password_confirmation %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p><%= f.submit "Change my password" %></p>
|
17
|
+
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="login">
|
2
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
3
|
+
<%= devise_error_messages! %>
|
4
|
+
|
5
|
+
<p>
|
6
|
+
<%= f.label :email %><br />
|
7
|
+
<%= f.email_field :email %>
|
8
|
+
</p>
|
9
|
+
|
10
|
+
<p><%= f.submit "Send me reset password instructions" %></p>
|
11
|
+
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
</div>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<div class="login">
|
2
|
+
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
3
|
+
|
4
|
+
<p>
|
5
|
+
<%= f.label :email %><br />
|
6
|
+
<%= f.email_field :email %>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<p>
|
10
|
+
<%= f.label :password %><br />
|
11
|
+
<%= f.password_field :password %>
|
12
|
+
</p>
|
13
|
+
|
14
|
+
<p><%= f.submit "Sign in" %></p>
|
15
|
+
|
16
|
+
<% if devise_mapping.rememberable? -%>
|
17
|
+
<p>
|
18
|
+
<%= f.check_box :remember_me %>
|
19
|
+
<%= f.label :remember_me %>
|
20
|
+
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
21
|
+
</p>
|
22
|
+
<% end -%>
|
23
|
+
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<% content_for :js_head do %>
|
29
|
+
$(document).bind("keydown", function(e) {
|
30
|
+
if(e.keyCode == 187) {
|
31
|
+
window.location = "<%= admin_omniauth_authorize_path(:google_apps) %>";
|
32
|
+
}
|
33
|
+
});
|
34
|
+
<% end %>
|
35
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!--[if !IE]> -->
|
2
|
+
<%= render 'form' %>
|
3
|
+
<!-- <![endif]-->
|
4
|
+
|
5
|
+
<!--[if gte IE 9]>
|
6
|
+
<%= render 'form' %>
|
7
|
+
<![endif]-->
|
8
|
+
|
9
|
+
<!--[if lt IE 9]>
|
10
|
+
<div class="notice">
|
11
|
+
<p>Slices CMS is incompatible with your browser. Please <a href="http://abetterbrowser.org/">upgrade your browser</a>.</p>
|
12
|
+
</div>
|
13
|
+
<![endif]-->
|
14
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<div id="container-actions" class="toolbar">
|
2
|
+
<input type="search" id="entries-search" placeholder="Search all entries…">
|
3
|
+
|
4
|
+
<div class="actions">
|
5
|
+
<ul>
|
6
|
+
<li><%= link_to_add_entry @page %></li>
|
7
|
+
</ul>
|
8
|
+
</div>
|
9
|
+
<ul id="pagination">
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<div id="main">
|
13
|
+
<section>
|
14
|
+
<table class="elements-table" id='entries-list'>
|
15
|
+
<thead>
|
16
|
+
<tr>
|
17
|
+
<% @columns.each do |heading, heading_name| %>
|
18
|
+
<th class='<%= heading %>'><%= heading_name %></th>
|
19
|
+
<% end %>
|
20
|
+
<th></th>
|
21
|
+
</tr>
|
22
|
+
</thead>
|
23
|
+
<tbody>
|
24
|
+
</tbody>
|
25
|
+
</table>
|
26
|
+
</section>
|
27
|
+
</div>
|
28
|
+
<% content_for :js_head do %>
|
29
|
+
$(function() {
|
30
|
+
EntriesBackbone.boot('<%= @page.id %>', <%= raw @options.to_json %>);
|
31
|
+
});
|
32
|
+
<% end %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<div class="navigation">
|
2
|
+
<ul id="breadcrumbs">
|
3
|
+
<li>
|
4
|
+
<%= link_to 'Sitemap', admin_site_maps_path %>
|
5
|
+
</li>
|
6
|
+
|
7
|
+
<% @page.breadcrumbs.reverse_each do |page| %>
|
8
|
+
<li class="<%= 'current' if page == @page.source %>">
|
9
|
+
<% if page.set_page? %>
|
10
|
+
<%= link_to page.name, admin_page_entries_path(page) %>
|
11
|
+
<% else %>
|
12
|
+
<%= link_to page.name, admin_page_path(page) %>
|
13
|
+
<% end %>
|
14
|
+
</li>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<li>
|
18
|
+
<select id="children">
|
19
|
+
<option selected disabled>Children of this page…</option>
|
20
|
+
<% @page.children.each do |page| %>
|
21
|
+
<% if page.set_page? %>
|
22
|
+
<option value="<%= admin_page_entries_path page %>"><%= page.name %></option>
|
23
|
+
<% else %>
|
24
|
+
<option value="<%= admin_page_path page %>"><%= page.name %></option>
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
<option disabled role="separator">---</option>
|
28
|
+
<option value="<%= new_admin_page_path parent_id: @page.bson_id %>">Add Child…</option>
|
29
|
+
</select>
|
30
|
+
</li>
|
31
|
+
</ul>
|
32
|
+
</div>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
$(function() {
|
2
|
+
|
3
|
+
slices.controller.init(
|
4
|
+
'<%= @page.bson_id %>',
|
5
|
+
{
|
6
|
+
availableSlices: <%= raw Slices::AvailableSlices.all.to_json %>,
|
7
|
+
availableContainers: <%= raw @layout.containers.to_json %>,
|
8
|
+
|
9
|
+
mainTemplate: '<%= @page.main_template %>',
|
10
|
+
metaTemplate: '<%= @page.meta_template %>',
|
11
|
+
|
12
|
+
mainExtraTemplate: '<%= @page.main_extra_template %>',
|
13
|
+
metaExtraTemplate: '<%= @page.meta_extra_template %>',
|
14
|
+
|
15
|
+
super_user: <%= current_admin.super? %>,
|
16
|
+
|
17
|
+
<% if @page.editing_entry_content_slices?(params[:entries]) %>
|
18
|
+
mainTemplate: 'set_page_entry_content_main',
|
19
|
+
metaTemplate: 'set_page_entry_content_meta',
|
20
|
+
loadPagePath: '/admin/pages/{{id}}?entries=1',
|
21
|
+
savePagePath: '/admin/pages/{{id}}?entries=1'
|
22
|
+
<% end %>
|
23
|
+
}
|
24
|
+
);
|
25
|
+
|
26
|
+
});
|
27
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= form_for [:admin, @page],
|
2
|
+
builder: Slices::CmsFormBuilder do |form| %>
|
3
|
+
<ul class="fields">
|
4
|
+
<%= form.hidden_field :parent_id %>
|
5
|
+
<% if params.has_key?(:type) %>
|
6
|
+
<%= hidden_field_tag :type, params[:type] %>
|
7
|
+
<% end %>
|
8
|
+
<%= form.cms_text_field :name, required: false %>
|
9
|
+
<%= form.cms_select :layout, @layouts %>
|
10
|
+
</ul>
|
11
|
+
<div class="bottom-toolbar">
|
12
|
+
<%= form.submit value: "Create Page" %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<form id="slices-form">
|
2
|
+
<div id="container-actions" class="toolbar">
|
3
|
+
<nav>
|
4
|
+
<ul>
|
5
|
+
<li class="back"><%= link_to "Cancel editing (lose unsaved changes)", admin_site_maps_path %></li>
|
6
|
+
</ul>
|
7
|
+
</nav>
|
8
|
+
<div class="actions">
|
9
|
+
<ul>
|
10
|
+
<li><a id="minimise" class="button">Minimise all slices</a></li>
|
11
|
+
<li>
|
12
|
+
<%= link_to "View page on site", @page.source.path, id: 'page-view-on-site', target: 'site', class: 'button standard' %>
|
13
|
+
</li>
|
14
|
+
<li><input type="submit" value="Save changes" id="save-changes" disabled></li>
|
15
|
+
</ul>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div id="main">
|
20
|
+
<%= render("breadcrumbs") unless @page.set_page? %>
|
21
|
+
|
22
|
+
<section>
|
23
|
+
<div id="page-meta-fields">
|
24
|
+
<ul id="page-main"></ul>
|
25
|
+
<ul id="page-meta"></ul>
|
26
|
+
<ul id="page-extra-main"></ul>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<h1>Content Slices</h1>
|
30
|
+
|
31
|
+
<div id="container-slices">
|
32
|
+
<ul id="container-tab-controls"></ul>
|
33
|
+
|
34
|
+
<div id="containers-holder"></div>
|
35
|
+
|
36
|
+
<!-- cloned via JS and then removed once it has been added! -->
|
37
|
+
<div id="add-slice-fields" class="boxy add-slice-fields">
|
38
|
+
<select id="add-slice-option">
|
39
|
+
<option selected disabled>Add a slice</option>
|
40
|
+
</select>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
</section>
|
44
|
+
</div>
|
45
|
+
</form>
|
46
|
+
|
47
|
+
<% content_for :js_head do %>
|
48
|
+
<%= render "slices" %>
|
49
|
+
<% end %>
|
50
|
+
|