Skip to content

Commit 27a2dd3

Browse files
committed
Merge branch 'develop'
2 parents 0f57c73 + 9cf8c90 commit 27a2dd3

File tree

6 files changed

+37
-22
lines changed

6 files changed

+37
-22
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ gem 'rails', '~> 5.0.1'
1212

1313
# Cortex-specific
1414
gem 'cortex-exceptions', '= 0.0.4'
15-
gem 'cortex-plugins-core', '= 0.7.2'
15+
gem 'cortex-plugins-core', '= 0.8.0'
1616

1717
# API
1818
gem 'grape', '~> 0.17'

Gemfile.lock

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ GIT
2121
rails-observers (0.1.3.alpha)
2222
activemodel (>= 4.0, < 5.1)
2323

24+
PATH
25+
remote: ../cortex-plugins-core
26+
specs:
27+
cortex-plugins-core (0.7.2)
28+
cells (~> 4.1)
29+
cells-haml (~> 0.0.10)
30+
cells-rails (~> 0.0.6)
31+
jsonb_accessor (~> 1.0.0.beta)
32+
mimemagic (~> 0.3.2)
33+
rails (>= 4)
34+
2435
GEM
2536
remote: https://rubygems.org/
2637
specs:
@@ -136,13 +147,6 @@ GEM
136147
concurrent-ruby (1.0.4)
137148
connection_pool (2.2.1)
138149
cortex-exceptions (0.0.4)
139-
cortex-plugins-core (0.7.2)
140-
cells (~> 4.1)
141-
cells-haml (~> 0.0.10)
142-
cells-rails (~> 0.0.6)
143-
jsonb_accessor (~> 1.0.0.beta)
144-
mimemagic (~> 0.3.2)
145-
rails (>= 4)
146150
database_cleaner (1.5.3)
147151
debug_inspector (0.0.2)
148152
descendants_tracker (0.0.4)
@@ -702,7 +706,7 @@ DEPENDENCIES
702706
cells-rails (~> 0.0.6)
703707
codeclimate-test-reporter (~> 0.6)
704708
cortex-exceptions (= 0.0.4)
705-
cortex-plugins-core (= 0.7.2)
709+
cortex-plugins-core!
706710
database_cleaner (~> 1.5)
707711
devise (~> 4.2.0)
708712
doorkeeper (~> 4.2)

app/assets/javascripts/media_popups.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ if (!window.DOM_HELPER) {
1414
}
1515

1616
window.setModals = function () {
17-
var modals = window.DOM_HELPER.getAll('.dialog-backdrop').reduce(function(modalHolder, modal, i) {
17+
var modals = window.DOM_HELPER.getAll('.dialog-backdrop').reduce(function (modalHolder, modal, i) {
1818
modalHolder[modal.dataset.type] = {
1919
elem: modal,
2020
isOpen: false,
21-
open: function() {
21+
open: function () {
2222
modal.classList.remove('hidden');
2323
this.isOpen = true;
2424
},
25-
close: function() {
25+
close: function () {
2626
if (!this.isOpen) {
2727
return
2828
}
@@ -31,7 +31,7 @@ window.setModals = function () {
3131
}
3232
};
3333

34-
modal.querySelector('.close').onclick = function() {
34+
modal.querySelector('.close').onclick = function () {
3535
modalHolder[modal.dataset.type].close();
3636
};
3737
return modalHolder
@@ -40,20 +40,23 @@ window.setModals = function () {
4040
window.MODALS = modals
4141
};
4242

43-
window.onload = function() {
44-
window.setModals();
43+
window.onload = function () {
44+
window.setModals();
4545
};
4646

47-
$(".popup--open").on("click", function(ev){
47+
$(".popup--open").on("click", function (ev) {
4848
ev.preventDefault();
4949
window.MODALS.featured.open();
5050
});
5151

52-
$(".media-select--wysiwyg").on("click", function(ev){
52+
$(".media-select--wysiwyg").on("click", function (ev) {
5353
ev.preventDefault();
5454

55-
var id = $(this).data().id;
56-
var title = $(this).data().title;
55+
var element = $(this),
56+
id = element.data().id,
57+
title = element.data().title,
58+
src = element.data().src,
59+
alt = element.data().alt;
5760

58-
media_select_defer.resolve({'id': id, 'title': title});
61+
media_select_defer.resolve({id: id, title: title, src: src, alt: alt});
5962
});

app/cells/index/table_body.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
= cell('index/content_item', nil, { cells: column[:cells], content_item: content_item }).(:column)
77
- if context[:popup]
88
%td{ class: 'mdl-data-table__cell--non-numeric' }
9-
%a{ href: "#", data: { id: content_item.id, title: content_item_title(content_item), thumb: content_item_thumb_url(content_item) }, class: "media-select--#{context[:popup]} mdl-button mdl-js-button mdl-button--icon" }
9+
%a{ href: "#", data: { id: content_item.id, title: content_item_title(content_item), thumb: content_item_thumb_url(content_item), src: content_item_asset_url(content_item), alt: content_item_asset_alt_text(content_item) }, class: "media-select--#{context[:popup]} mdl-button mdl-js-button mdl-button--icon" }
1010
%i{ class: 'material-icons' }
1111
add
1212
- else

app/cells/index_cell.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,12 @@ def content_item_title(content_item)
2626
def content_item_thumb_url(content_item)
2727
content_item.field_items.find { |field_item| field_item.field.name == 'Asset' }.data['asset']['style_urls']['mini']
2828
end
29+
30+
def content_item_asset_url(content_item)
31+
content_item.field_items.find { |field_item| field_item.field.name == 'Asset' }.data['asset']['url']
32+
end
33+
34+
def content_item_asset_alt_text(content_item)
35+
content_item.field_items.find { |field_item| field_item.field.name == 'Alt Tag' }.data['text']
36+
end
2937
end

app/views/layouts/application.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
%main.mdl-layout__content.layout__main-content
1818
= yield
1919

20-
%script{src: '//cdn.ckeditor.com/4.6.1/standard/ckeditor.js', type: 'text/javascript'}
20+
%script{src: '//cdn.ckeditor.com/4.6.1/standard-all/ckeditor.js', type: 'text/javascript'}
2121
= javascript_include_tag :application, {'data-turbolinks-eval': false}
2222
= render 'layouts/google_analytics' if extra_config.google_analytics_id?
2323
= render 'partials/flash'

0 commit comments

Comments
 (0)