pageflow-internal-links 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +22 -0
- data/.jshintrc +22 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +10 -0
- data/README.md +63 -0
- data/Rakefile +7 -0
- data/app/assets/images/pageflow/internal_links_grid_pictogram.png +0 -0
- data/app/assets/images/pageflow/internal_links_grid_pictogram_small.png +0 -0
- data/app/assets/images/pageflow/internal_links_grid_sprite.png +0 -0
- data/app/assets/images/pageflow/internal_links_list_pictogram.png +0 -0
- data/app/assets/images/pageflow/internal_links_list_pictogram_small.png +0 -0
- data/app/assets/images/pageflow/internal_links_list_sprite.png +0 -0
- data/app/assets/images/pageflow/ov-internal_links_grid.png +0 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/collections/grid_page_links_collection.js +20 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/collections/list_page_links_collection.js +12 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/collections/page_links_collection.js +90 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/config.js +45 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/controllers/side_bar_controller.js +14 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/models/page_configuration_mixin.js +19 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/models/page_link.js +35 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/routers/side_bar_router.js +5 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/templates/edit_page_link.jst.ejs +3 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/templates/grid_item_embedded.jst.ejs +4 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/templates/list_item_embedded.jst.ejs +7 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/views/edit_page_link_view.js +67 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/views/editable_links_mode_view.js +10 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/views/grid_configuration_editor_view.js +30 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/views/grid_item_embedded_view.js +227 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/views/list_configuration_editor_view.js +29 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/views/list_embedded_view.js +23 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/views/list_item_embedded_view.js +103 -0
- data/app/assets/javascripts/pageflow/internal_links/editor/views/page_link_embedded_view.js +106 -0
- data/app/assets/javascripts/pageflow/internal_links/editor.js +11 -0
- data/app/assets/javascripts/pageflow/internal_links/grid_page_type.js +31 -0
- data/app/assets/javascripts/pageflow/internal_links/list_page_type.js +29 -0
- data/app/assets/javascripts/pageflow/internal_links.js +2 -0
- data/app/assets/stylesheets/pageflow/internal_links/editor/embedded_grid_item.css.scss +118 -0
- data/app/assets/stylesheets/pageflow/internal_links/editor/embedded_list_item.scss +33 -0
- data/app/assets/stylesheets/pageflow/internal_links/editor.css.scss +2 -0
- data/app/assets/stylesheets/pageflow/internal_links/grid.scss +230 -0
- data/app/assets/stylesheets/pageflow/internal_links/list.scss +76 -0
- data/app/assets/stylesheets/pageflow/internal_links.css.scss +2 -0
- data/app/helpers/pageflow/internal_links/grid_helper.rb +50 -0
- data/app/helpers/pageflow/internal_links/list_helper.rb +10 -0
- data/app/helpers/pageflow/internal_links/page_links.rb +79 -0
- data/app/views/pageflow/internal_links/grid/_grid.html.erb +7 -0
- data/app/views/pageflow/internal_links/grid/page.html.erb +25 -0
- data/app/views/pageflow/internal_links/list/_list.html.erb +6 -0
- data/app/views/pageflow/internal_links/list/_page_link.html.erb +14 -0
- data/app/views/pageflow/internal_links/list/page.html.erb +26 -0
- data/config/locales/de.yml +61 -0
- data/config/locales/en.yml +64 -0
- data/db/migrate/20150109121800_rename_internal_links_page_type.rb +13 -0
- data/lib/pageflow/internal_links/engine.rb +9 -0
- data/lib/pageflow/internal_links/grid_page_type.rb +19 -0
- data/lib/pageflow/internal_links/list_page_type.rb +19 -0
- data/lib/pageflow/internal_links/plugin.rb +9 -0
- data/lib/pageflow-internal-links.rb +17 -0
- data/pageflow-internal-links.gemspec +18 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NTYxZDcyYmRmMGViYjdlZGMxMzFkNTJmOGI1MmI1ZjQ1ODM3M2QxNQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Y2NkMzU4OTliNzRiNWU2MmE3MTg0ZTcxOWRmZTk1ZDQyYzgwOGQ3Zg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZDQ2NWFmOGUyMGMzMWUyNGYzYTNmODE4YzgwYjk4NDYwYmNhN2Y2YTdhYjg4
|
10
|
+
Mjg1ZmVlNzFiNTQxMzYyODZjMzIyOWU5MWM4MTIwZmRjNGU4YjBhYzgzMDNj
|
11
|
+
MTg0ZGQ4ZjZkNDJhNjZlYjFkN2UwYzg1YzM5ZTM4ZmQ4MzU4NDY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OTQ0YTZlY2MyMTJiMDJiNDczMWIwYTNlYjU0NTVjZTI1MjBjMTdkNDgyMWE0
|
14
|
+
YWU4N2M3ZmJhNjJhYjQyNzNmYTBkMjJjMTVlOTJkMTBiZmJmZTg0ZWI1NGI3
|
15
|
+
ZWVhZmM1NGNlZTU0Y2JhYzdiMDE2YWIzZDAzYzRiZjg0MzQ1YjM=
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
*.sqlite3
|
4
|
+
.bundle
|
5
|
+
.config
|
6
|
+
.yardoc
|
7
|
+
.idea
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
test/tmp
|
17
|
+
test/version_tmp
|
18
|
+
tmp
|
19
|
+
log
|
20
|
+
Gemfile.lock
|
21
|
+
|
22
|
+
.localeapp
|
data/.jshintrc
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"browser": true,
|
3
|
+
"undef": true,
|
4
|
+
"immed": true,
|
5
|
+
"trailing": true,
|
6
|
+
"globals": {
|
7
|
+
"jQuery": true,
|
8
|
+
"$": true,
|
9
|
+
"Backbone": true,
|
10
|
+
"Cocktail": true,
|
11
|
+
"_": true,
|
12
|
+
"vjs": true,
|
13
|
+
"Audio5js": true,
|
14
|
+
"I18n": true,
|
15
|
+
|
16
|
+
"pageflow": true,
|
17
|
+
"editor": true,
|
18
|
+
|
19
|
+
"confirm": true,
|
20
|
+
"alert": true
|
21
|
+
}
|
22
|
+
}
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in chart.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
# Rails 4 compat
|
7
|
+
gem 'activeadmin', :git => 'https://github.com/codevise/active_admin.git', :branch => 'rails4'
|
8
|
+
gem 'ransack'
|
9
|
+
gem 'inherited_resources', '1.4.1'
|
10
|
+
gem 'formtastic', '2.3.0.rc2'
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Pageflow Internal Links
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/pageflow-internal-links.svg)](http://badge.fury.io/rb/pageflow-internal-links)
|
4
|
+
|
5
|
+
Page types for linking to pages inside a Pageflow.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
# Gemfile
|
12
|
+
gem 'pageflow-internal-links'
|
13
|
+
|
14
|
+
Register the page types:
|
15
|
+
|
16
|
+
# config/initializers/pageflow.rb
|
17
|
+
Pageflow.configure do |config|
|
18
|
+
config.page_types.register(Pageflow::InternalLinks.grid_page_type)
|
19
|
+
end
|
20
|
+
|
21
|
+
Include javascripts and stylesheets:
|
22
|
+
|
23
|
+
# app/assets/javascripts/pageflow/application.js
|
24
|
+
//= require pageflow/internal_links
|
25
|
+
|
26
|
+
# app/assets/javascripts/pageflow/editor.js
|
27
|
+
//= require pageflow/internal_links/editor
|
28
|
+
|
29
|
+
# app/assets/stylesheets/pageflow/application.css.scss
|
30
|
+
@import "pageflow/internal_links";
|
31
|
+
|
32
|
+
# app/assets/stylesheets/pageflow/editor.css.scss
|
33
|
+
@import "pageflow/internal_links/editor";
|
34
|
+
|
35
|
+
Install dependencies:
|
36
|
+
|
37
|
+
bundle install
|
38
|
+
|
39
|
+
Copy migrations of pageflow-internal-links into your project:
|
40
|
+
|
41
|
+
bundle exec rake pageflow_internal_links:install:migrations
|
42
|
+
|
43
|
+
Migrate the database:
|
44
|
+
|
45
|
+
bundle exec rake db:migrate
|
46
|
+
|
47
|
+
Restart the application server.
|
48
|
+
|
49
|
+
## Troubleshooting
|
50
|
+
|
51
|
+
If you run into problems while installing the page type, please also
|
52
|
+
refer to the
|
53
|
+
[Troubleshooting](https://github.com/codevise/pageflow/wiki/Troubleshooting)
|
54
|
+
wiki page in the
|
55
|
+
[Pageflow repository](https://github.com/codevise/pageflow). If that
|
56
|
+
doesn't help, consider
|
57
|
+
[filing an issue](https://github.com/codevise/pageflow-internal-links/issues).
|
58
|
+
|
59
|
+
## Contributing Locales
|
60
|
+
|
61
|
+
Edit the translations directly on the
|
62
|
+
[pageflow-internal-links](http://www.localeapp.com/projects/public?search=tf/pageflow-internal-links)
|
63
|
+
locale project.
|
data/Rakefile
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/app/assets/javascripts/pageflow/internal_links/editor/collections/grid_page_links_collection.js
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
//= require ./page_links_collection
|
2
|
+
|
3
|
+
pageflow.internalLinks.GridPageLinksCollection = pageflow.internalLinks.PageLinksCollection.extend({
|
4
|
+
canAddLink: function() {
|
5
|
+
return this.defaultPosition() !== undefined;
|
6
|
+
},
|
7
|
+
|
8
|
+
defaultPosition: function() {
|
9
|
+
var collection = this;
|
10
|
+
|
11
|
+
return _.chain(25)
|
12
|
+
.times(function(index) {
|
13
|
+
return index;
|
14
|
+
})
|
15
|
+
.find(function(position) {
|
16
|
+
return !collection.findWhere({position: position});
|
17
|
+
})
|
18
|
+
.value();
|
19
|
+
}
|
20
|
+
});
|
data/app/assets/javascripts/pageflow/internal_links/editor/collections/list_page_links_collection.js
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
//= require ./page_links_collection
|
2
|
+
|
3
|
+
pageflow.internalLinks.ListPageLinksCollection = pageflow.internalLinks.PageLinksCollection.extend({
|
4
|
+
defaultPosition: function() {
|
5
|
+
return Math.max(0, _.max(this.map(function(pageLink) {
|
6
|
+
return pageLink.get('position');
|
7
|
+
}))) + 1;
|
8
|
+
},
|
9
|
+
|
10
|
+
saveOrder: function() {
|
11
|
+
}
|
12
|
+
});
|
data/app/assets/javascripts/pageflow/internal_links/editor/collections/page_links_collection.js
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
pageflow.internalLinks.PageLinksCollection = Backbone.Collection.extend({
|
2
|
+
model: pageflow.internalLinks.PageLink,
|
3
|
+
|
4
|
+
comparator: 'position',
|
5
|
+
|
6
|
+
initialize: function(models, options) {
|
7
|
+
this.configuration = options.configuration;
|
8
|
+
this.page = options.configuration.page;
|
9
|
+
|
10
|
+
this.load();
|
11
|
+
|
12
|
+
this.listenTo(this, 'add remove change', this.save);
|
13
|
+
this.listenTo(this.configuration, 'change:internal_links', this.load);
|
14
|
+
},
|
15
|
+
|
16
|
+
addLink: function(targetPageId) {
|
17
|
+
this.addWithPosition(this.defaultPosition(), targetPageId);
|
18
|
+
},
|
19
|
+
|
20
|
+
canAddLink: function(targetPageId) {
|
21
|
+
return true;
|
22
|
+
},
|
23
|
+
|
24
|
+
updateLink: function(link, targetPageId) {
|
25
|
+
link.set('target_page_id', targetPageId);
|
26
|
+
},
|
27
|
+
|
28
|
+
removeLink: function(link) {
|
29
|
+
this.remove(link);
|
30
|
+
},
|
31
|
+
|
32
|
+
addWithPosition: function(position, targetPageId) {
|
33
|
+
this.add(this.pageLinkAttributes(position, targetPageId));
|
34
|
+
},
|
35
|
+
|
36
|
+
removeByPosition: function(position) {
|
37
|
+
this.remove(this.findByPosition(position));
|
38
|
+
},
|
39
|
+
|
40
|
+
findByPosition: function(position) {
|
41
|
+
return this.findWhere({position: position});
|
42
|
+
},
|
43
|
+
|
44
|
+
load: function() {
|
45
|
+
this.set(this.pageLinksAttributes() ||
|
46
|
+
this.legacyPageLinksAttributes());
|
47
|
+
},
|
48
|
+
|
49
|
+
save: function(referenceKey, pageId) {
|
50
|
+
this.configuration.set('internal_links', this.map(function(pageLink) {
|
51
|
+
return pageLink.toSerializedJSON();
|
52
|
+
}));
|
53
|
+
},
|
54
|
+
|
55
|
+
pageLinksAttributes: function() {
|
56
|
+
if (this.configuration.has('internal_links')) {
|
57
|
+
return this.configuration.get('internal_links') || [];
|
58
|
+
}
|
59
|
+
},
|
60
|
+
|
61
|
+
legacyPageLinksAttributes: function() {
|
62
|
+
return _(this.configuration.get('linked_page_ids') || {}).reduce(function(result, pageId, position) {
|
63
|
+
var page = pageflow.pages.getByPermaId(pageId);
|
64
|
+
|
65
|
+
if (page) {
|
66
|
+
result.push(this.pageLinkAttributes(parseInt(position, 10) - 1,
|
67
|
+
pageId,
|
68
|
+
this.configuration.page.id + ':' + position));
|
69
|
+
}
|
70
|
+
|
71
|
+
return result;
|
72
|
+
}, [], this);
|
73
|
+
},
|
74
|
+
|
75
|
+
pageLinkAttributes: function(position, targetPageId, id) {
|
76
|
+
return {
|
77
|
+
id: id || this.getUniqueId(),
|
78
|
+
target_page_id: targetPageId,
|
79
|
+
position: position
|
80
|
+
};
|
81
|
+
},
|
82
|
+
|
83
|
+
getUniqueId: function() {
|
84
|
+
var maxId = Math.max(0, _.max(this.map(function(pageLink) {
|
85
|
+
return parseInt(pageLink.id.split(':').pop(), 10);
|
86
|
+
})));
|
87
|
+
|
88
|
+
return this.configuration.page.id + ':' + (maxId + 1);
|
89
|
+
}
|
90
|
+
});
|
@@ -0,0 +1,45 @@
|
|
1
|
+
pageflow.editor.pageTypes.register('internal_links_grid', {
|
2
|
+
configurationEditorView: pageflow.internalLinks.GridConfigurationEditorView,
|
3
|
+
|
4
|
+
embeddedViews: {
|
5
|
+
'nav li': {
|
6
|
+
view: pageflow.internalLinks.GridItemEmbeddedView,
|
7
|
+
options: {propertyName: 'linked_page_ids'}
|
8
|
+
},
|
9
|
+
|
10
|
+
'.background_image': {
|
11
|
+
view: pageflow.BackgroundImageEmbeddedView,
|
12
|
+
options: {propertyName: 'background_image_id'}
|
13
|
+
}
|
14
|
+
},
|
15
|
+
|
16
|
+
pageLinks: function(configuration) {
|
17
|
+
return configuration.internalLinksGrid();
|
18
|
+
}
|
19
|
+
});
|
20
|
+
|
21
|
+
pageflow.editor.pageTypes.register('internal_links_list', {
|
22
|
+
configurationEditorView: pageflow.internalLinks.ListConfigurationEditorView,
|
23
|
+
|
24
|
+
embeddedViews: {
|
25
|
+
'nav': {
|
26
|
+
view: pageflow.internalLinks.ListEmbeddedView
|
27
|
+
},
|
28
|
+
|
29
|
+
'.background_image': {
|
30
|
+
view: pageflow.BackgroundImageEmbeddedView,
|
31
|
+
options: {propertyName: 'background_image_id'}
|
32
|
+
}
|
33
|
+
},
|
34
|
+
|
35
|
+
pageLinks: function(configuration) {
|
36
|
+
return configuration.internalLinksList();
|
37
|
+
}
|
38
|
+
});
|
39
|
+
|
40
|
+
pageflow.editor.registerPageConfigurationMixin(pageflow.internalLinks.pageConfigurationMixin);
|
41
|
+
|
42
|
+
pageflow.editor.registerSideBarRouting({
|
43
|
+
router: pageflow.internalLinks.SideBarRouter,
|
44
|
+
controller: pageflow.internalLinks.SideBarController
|
45
|
+
});
|
@@ -0,0 +1,14 @@
|
|
1
|
+
pageflow.internalLinks.SideBarController = Backbone.Marionette.Controller.extend({
|
2
|
+
initialize: function(options) {
|
3
|
+
this.region = options.region;
|
4
|
+
},
|
5
|
+
|
6
|
+
pageLink: function(pageId, linkId) {
|
7
|
+
var page = pageflow.pages.get(pageId);
|
8
|
+
|
9
|
+
this.region.show(new pageflow.internalLinks.EditPageLinkView({
|
10
|
+
model: page.pageLinks().get(linkId),
|
11
|
+
page: page
|
12
|
+
}));
|
13
|
+
}
|
14
|
+
});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
pageflow.internalLinks.pageConfigurationMixin = {
|
2
|
+
internalLinksList: function() {
|
3
|
+
this._internalLinksList = this._internalLinksList ||
|
4
|
+
new pageflow.internalLinks.ListPageLinksCollection(null, {
|
5
|
+
configuration: this
|
6
|
+
});
|
7
|
+
|
8
|
+
return this._internalLinksList;
|
9
|
+
},
|
10
|
+
|
11
|
+
internalLinksGrid: function() {
|
12
|
+
this._internalLinksGrid = this._internalLinksGrid ||
|
13
|
+
new pageflow.internalLinks.GridPageLinksCollection(null, {
|
14
|
+
configuration: this
|
15
|
+
});
|
16
|
+
|
17
|
+
return this._internalLinksGrid;
|
18
|
+
}
|
19
|
+
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
pageflow.internalLinks.PageLink = Backbone.Model.extend({
|
2
|
+
i18nKey: 'pageflow/internal_links/page_link',
|
3
|
+
|
4
|
+
targetPage: function() {
|
5
|
+
return pageflow.pages.getByPermaId(this.get('target_page_id'));
|
6
|
+
},
|
7
|
+
|
8
|
+
label: function() {
|
9
|
+
return this.get('label');
|
10
|
+
},
|
11
|
+
|
12
|
+
editPath: function() {
|
13
|
+
return '/internal_links_pages/' + this.getRoutableId() + '/page_links/' + this.id;
|
14
|
+
},
|
15
|
+
|
16
|
+
getRoutableId: function() {
|
17
|
+
return this.collection.page.id;
|
18
|
+
},
|
19
|
+
|
20
|
+
toSerializedJSON: function() {
|
21
|
+
return _.omit(this.attributes, 'highlighted');
|
22
|
+
},
|
23
|
+
|
24
|
+
highlight: function() {
|
25
|
+
this.set('highlighted', true);
|
26
|
+
},
|
27
|
+
|
28
|
+
resetHighlight: function() {
|
29
|
+
this.unset('highlighted');
|
30
|
+
},
|
31
|
+
|
32
|
+
remove: function() {
|
33
|
+
this.collection.remove(this);
|
34
|
+
}
|
35
|
+
});
|
data/app/assets/javascripts/pageflow/internal_links/editor/templates/grid_item_embedded.jst.ejs
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
<a class="edit" href="" title="<%= I18n.t('pageflow.internal_links.editor.templates.embedded.grid_page_link.edit') %>"></a>
|
2
|
+
<a class="set" href="" title="<%= I18n.t('pageflow.internal_links.editor.templates.embedded.grid_page_link.set') %>"></a>
|
3
|
+
<div class="placeholder"></div>
|
4
|
+
<span class="title"></span>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
pageflow.internalLinks.EditPageLinkView = Backbone.Marionette.Layout.extend({
|
2
|
+
template: 'pageflow/internal_links/editor/templates/edit_page_link',
|
3
|
+
|
4
|
+
regions: {
|
5
|
+
formContainer: '.form_container'
|
6
|
+
},
|
7
|
+
|
8
|
+
ui: {
|
9
|
+
backButton: 'a.back'
|
10
|
+
},
|
11
|
+
|
12
|
+
events: {
|
13
|
+
'click a.back': 'goBack',
|
14
|
+
|
15
|
+
'click a.destroy': 'destroy'
|
16
|
+
},
|
17
|
+
|
18
|
+
onRender: function() {
|
19
|
+
var configurationEditor = new pageflow.ConfigurationEditorView({
|
20
|
+
model: this.model
|
21
|
+
});
|
22
|
+
|
23
|
+
this.configure(configurationEditor);
|
24
|
+
this.formContainer.show(configurationEditor);
|
25
|
+
|
26
|
+
this.highlight();
|
27
|
+
},
|
28
|
+
|
29
|
+
highlight: function() {
|
30
|
+
var page = this.model.collection.page;
|
31
|
+
|
32
|
+
this.model.highlight();
|
33
|
+
page.set('internal_links_editable', true);
|
34
|
+
|
35
|
+
this.listenTo(this, 'close', function() {
|
36
|
+
this.model.resetHighlight();
|
37
|
+
page.unset('internal_links_editable');
|
38
|
+
});
|
39
|
+
},
|
40
|
+
|
41
|
+
configure: function(configurationEditor) {
|
42
|
+
configurationEditor.tab('general', function() {
|
43
|
+
this.input('label', pageflow.TextInputView);
|
44
|
+
this.input('target_page_id', pageflow.PageLinkInputView);
|
45
|
+
this.input('page_transition', pageflow.SelectInputView, {
|
46
|
+
translationKeyPrefix: 'pageflow.page_transitions',
|
47
|
+
includeBlank: true,
|
48
|
+
blankTranslationKey: 'pageflow.internal_links.editor.views.edit_page_link_view.default_page_transition',
|
49
|
+
values: pageflow.pageTransitions.names()
|
50
|
+
});
|
51
|
+
this.input('description', pageflow.TextAreaInputView, {
|
52
|
+
size: 'short'
|
53
|
+
});
|
54
|
+
});
|
55
|
+
},
|
56
|
+
|
57
|
+
destroy: function() {
|
58
|
+
if (confirm(I18n.t('pageflow.internal_links.editor.views.edit_page_link_view.confirm_destroy'))) {
|
59
|
+
this.model.remove();
|
60
|
+
this.goBack();
|
61
|
+
}
|
62
|
+
},
|
63
|
+
|
64
|
+
goBack: function() {
|
65
|
+
pageflow.editor.navigate('/pages/' + this.options.page.id + '/links', {trigger: true});
|
66
|
+
}
|
67
|
+
});
|
data/app/assets/javascripts/pageflow/internal_links/editor/views/grid_configuration_editor_view.js
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
pageflow.internalLinks.GridConfigurationEditorView = pageflow.ConfigurationEditorView.extend({
|
2
|
+
configure: function() {
|
3
|
+
this.tab('general', function() {
|
4
|
+
this.group('general');
|
5
|
+
});
|
6
|
+
|
7
|
+
this.tab('files', function() {
|
8
|
+
this.input('background_image_id', pageflow.FileInputView, {collection: pageflow.imageFiles});
|
9
|
+
this.input('thumbnail_image_id', pageflow.FileInputView, {
|
10
|
+
collection: pageflow.imageFiles,
|
11
|
+
positioning: false
|
12
|
+
});
|
13
|
+
});
|
14
|
+
|
15
|
+
this.tab('links', function() {
|
16
|
+
this.view(pageflow.internalLinks.EditableLinksModeView, {
|
17
|
+
model: this.model.page
|
18
|
+
});
|
19
|
+
|
20
|
+
this.input('linked_pages_layout', pageflow.SelectInputView, {values: pageflow.Page.linkedPagesLayouts});
|
21
|
+
this.view(pageflow.PageLinksView, {
|
22
|
+
model: this.model.page
|
23
|
+
});
|
24
|
+
});
|
25
|
+
|
26
|
+
this.tab('options', function() {
|
27
|
+
this.group('options');
|
28
|
+
});
|
29
|
+
}
|
30
|
+
});
|