Skip to content

Commit 76b99fa

Browse files
committed
Merge branch 'develop'
2 parents 0b605ef + 9868306 commit 76b99fa

File tree

26 files changed

+188
-109
lines changed

26 files changed

+188
-109
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
**Purpose:**
1+
## Purpose:
22

33

4-
**JIRA:**
4+
## JIRA:
55

66

7-
**Changes:**
7+
## Steps to Take On Prod
8+
9+
10+
## Changes:
811
* Changes to setup
912
*
1013

@@ -13,23 +16,23 @@
1316

1417
* Migrations
1518
*
16-
19+
1720
* Library changes
1821
*
1922

2023
* Side effects
2124
*
2225

23-
**Screenshots**
26+
## Screenshots
2427
* Before
2528

2629
* After
2730

2831

29-
**QA Links:**
32+
## QA Links:
3033

3134

32-
**How to Verify These Changes**
35+
## How to Verify These Changes
3336
* Specific pages to visit
3437
*
3538

@@ -40,7 +43,7 @@
4043
*
4144

4245

43-
**Relevant PRs/Dependencies:**
46+
## Relevant PRs/Dependencies:
4447

4548

46-
**Additional Information**
49+
## Additional Information

Gemfile

+1-1
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.11.1'
15+
gem 'cortex-plugins-core', '= 0.11.2'
1616

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

Gemfile.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ GEM
137137
concurrent-ruby (1.0.4)
138138
connection_pool (2.2.1)
139139
cortex-exceptions (0.0.4)
140-
cortex-plugins-core (0.11.1)
140+
cortex-plugins-core (0.11.2)
141141
cells (~> 4.1)
142142
cells-haml (~> 0.0.10)
143143
cells-rails (~> 0.0.6)
@@ -435,8 +435,8 @@ GEM
435435
json_spec (1.1.4)
436436
multi_json (~> 1.0)
437437
rspec (>= 2.0, < 4.0)
438-
jsonb_accessor (1.0.0.beta.2)
439-
activerecord (>= 5.0.0)
438+
jsonb_accessor (1.0.0.beta.3)
439+
activerecord (>= 5.0)
440440
pg (>= 0.18.1)
441441
kaminari (0.17.0)
442442
actionpack (>= 3.0.0)
@@ -725,7 +725,7 @@ DEPENDENCIES
725725
cells-rails (~> 0.0.7)
726726
codeclimate-test-reporter (~> 0.6)
727727
cortex-exceptions (= 0.0.4)
728-
cortex-plugins-core (= 0.11.1)
728+
cortex-plugins-core (= 0.11.2)
729729
database_cleaner (~> 1.5)
730730
deep_cloneable (~> 2.2.2)
731731
devise (~> 4.2.0)

app/api/v1/resources/posts.rb

+10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ class Posts < Grape::API
4646
posts_page
4747
end
4848

49+
desc 'Show all published posts', { entity: ::V1::Entities::Post, nickname: "allPostFeed" }
50+
paginate per_page: 10000
51+
get 'feed/all_posts' do
52+
require_scope! 'view:posts'
53+
authorize! :view, ::Post
54+
55+
posts = ::GetPosts.call(params: declared(clean_params(params), include_missing: false), tenant: current_tenant, published: true).posts
56+
posts_page = ::V1::Entities::Post.represent posts.to_a
57+
end
58+
4959
desc 'Show published post authors'
5060
get 'feed/authors' do
5161
present Author.published.distinct, with: ::V1::Entities::Author

app/assets/javascripts/authentication.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
//= require material
66

77
//= require base
8+
//= require authentication/login
89

910
// require turbolinks # temporarily disabled
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var login_tab_change = function() {
2+
$('.login_tab').on('click', function(ev) {
3+
var value = this.text;
4+
$('#user_email').focus();
5+
6+
if (value === 'Legacy') {
7+
$('.legacy_value').val(1)
8+
} else {
9+
$('.legacy_value').val(0)
10+
}
11+
}
12+
}
13+
14+
$(document).ready(login_tab_change);
15+
$(document).on('page:load', login_tab_change);

app/assets/stylesheets/application.scss

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
@import 'components/flash';
2525
@import 'components/form';
2626
@import 'components/header';
27+
@import 'components/index';
2728
@import 'components/jumbo-button';
2829
@import 'components/notes';
2930
@import 'components/sidebar';
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.mdl-data-table {
2+
white-space: normal;
3+
}
4+
15
.mdl-data-table th {
26
@extend .text-style-4;
37
}

app/assets/stylesheets/components/dialog.scss

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.mdl-dialog {
22
width: 80%;
33
max-height: 80%;
4+
padding: 0;
5+
overflow-x: hidden;
46
overflow-y: auto;
57
}
68

@@ -10,6 +12,12 @@
1012
font-size: 1.17rem;
1113
}
1214

15+
.mdl-dialog__content {
16+
box-sizing: border-box;
17+
padding: 0;
18+
width: 100%;
19+
}
20+
1321
.content-item-button {
1422
display: flex;
1523
justify-content: center;

app/assets/stylesheets/components/form.scss

+26-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ footer .mdl-button {
77
.mdl-textfield {
88
width: auto;
99
display: block;
10+
11+
.tooltip-icon {
12+
position: absolute;
13+
right: 0;
14+
top: 8%;
15+
}
16+
}
17+
18+
.mdl-textfield__label {
19+
font-size: $base-font-size !important;
20+
}
21+
22+
.mdl-textfield--floating-label.is-dirty .mdl-textfield__label,
23+
.mdl-textfield--floating-label.is-focused .mdl-textfield__label {
24+
color: $color-black !important;
1025
}
1126

1227
form {
@@ -24,9 +39,13 @@ form {
2439
}
2540

2641
// Tags
27-
28-
div.bootstrap-tagsinput input {
29-
width: 100% !important;
42+
.bootstrap-tagsinput {
43+
width: 100%;
44+
border-radius: 0 !important;
45+
border-top: none;
46+
border-right: none;
47+
border-left: none;
48+
border-bottom: 1px solid $color-grey-light;
3049
}
3150
.cortex-bootstrap .label {
3251
border-radius: 0.75em;
@@ -42,3 +61,7 @@ div.bootstrap-tagsinput input {
4261
}
4362

4463
// Extras
64+
.tooltip-icon {
65+
color: $color-grey;
66+
font-size: $base-font-size * 1.25;
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.content_item-link {
2+
cursor: pointer;
3+
4+
a {
5+
text-decoration: none;
6+
color: inherit;
7+
display: inline-table;
8+
height: 100%;
9+
width: 100%;
10+
11+
&:hover,
12+
&:active,
13+
&:focus {
14+
color: inherit;
15+
text-decoration: none;
16+
}
17+
18+
span.circular {
19+
line-height: 50px;
20+
vertical-align: middle;
21+
}
22+
}
23+
}

app/assets/stylesheets/variables/_colors.scss

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ $color-grey-extralight: #F4F4F4; // Wizard Instruction Panel background color
2424
$color-red: #d85252;
2525

2626
$color-white: white; // Header
27+
$color-black: #000000;
2728

2829

2930
// Color Semantics

app/cells/field_cell.rb

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ def render_label
2323
@options[:form].label :data, field.name
2424
end
2525

26+
def render_tooltip
27+
cell(Plugins::Core::TooltipCell, nil, tooltip: @options[:tooltip], id: SecureRandom.base64(4))
28+
end
29+
2630
def render_field_id
2731
@options[:form].hidden_field :field_id, value: field.id
2832
end

app/cells/index/table_body.haml

+7-12
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@
22
- context[:content_items].each do |content_item|
33
%tr
44
- @options[:data][:columns].each do |column|
5-
%td{ class: 'mdl-data-table__cell--non-numeric' }
6-
= cell('index/content_item', nil, { cells: column[:cells], content_item: content_item }).(:column)
7-
- if context[:popup]
8-
%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), url: content_item_asset_url(content_item), alt: content_item_asset_alt_text(content_item), asset_type: content_item_asset_type(content_item) }, class: "media-select--#{context[:popup]} mdl-button mdl-js-button mdl-button--icon" }
10-
%i{ class: 'material-icons' }
11-
add
12-
- else
13-
%td{ class: 'mdl-data-table__cell--non-numeric' }
14-
= link_to edit_content_type_content_item_path(context[:content_type].id, content_item.id), class: 'mdl-button mdl-js-button mdl-button--icon' do
15-
%i{ class: 'material-icons' }
16-
create
5+
%td.mdl-data-table__cell--non-numeric.content_item-link
6+
- if context[:popup]
7+
= link_to '#', data: { id: content_item.id, title: content_item_title(content_item), thumb: content_item_thumb_url(content_item), url: content_item_asset_url(content_item), alt: content_item_asset_alt_text(content_item), asset_type: content_item_asset_type(content_item) }, class: "media-select--#{context[:popup]}" do
8+
= cell('index/content_item', nil, { cells: column[:cells], content_item: content_item }).(:column)
9+
- else
10+
= link_to edit_content_type_content_item_path(context[:content_type].id, content_item.id) do
11+
= cell('index/content_item', nil, { cells: column[:cells], content_item: content_item }).(:column)

app/cells/index/table_headers.haml

-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,3 @@
33
- @options[:data][:columns].each do |column|
44
%th{ class: 'mdl-data-table__cell--non-numeric' }
55
= render_table_header(column)
6-
- if context[:popup]
7-
%th{ class: 'mdl-data-table__cell--non-numeric' }
8-
Select
9-
- else
10-
%th{ class: 'mdl-data-table__cell--non-numeric' }
11-
Edit

app/cells/wizard/column/show.haml

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
%div{class: ['mdl-cell', grid_class]}
2+
%p
3+
= description
24
- elements.each do |element|
35
- if element.keys.include?("id")
46
= cell(Wizard::FieldCell, element).()

app/cells/wizard/column_cell.rb

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class ColumnCell < Cell::ViewModel
44
property :grid_width
55
property :display
66
property :elements
7+
property :description
78

89
def show
910
render

app/cells/wizard/field/show.haml

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
= context[:form].fields_for 'field_items', field_item do |field_item_form|
22
- if field_item.field.field_type_instance.class == TextFieldType
33
- if render_method
4-
= cell(Plugins::Core::TextCell, field_item, form: field_item_form, input_options: input, label_options: label).(render_method)
4+
= cell(Plugins::Core::TextCell, field_item, form: field_item_form, input_options: input, label_options: label, tooltip: tooltip).(render_method)
55
- else
6-
= cell(Plugins::Core::TextCell, field_item, form: field_item_form, input_options: input, label_options: label).(:input)
6+
= cell(Plugins::Core::TextCell, field_item, form: field_item_form, input_options: input, label_options: label, tooltip: tooltip).(:input)
77

88
- if field_item.field.field_type_instance.class == BooleanFieldType
9-
= cell(Plugins::Core::BooleanCell, field_item, form: field_item_form, field_name: field_item.field.name, default_value: false, input_options: input, label_options: label).(:checkbox)
9+
= cell(Plugins::Core::BooleanCell, field_item, form: field_item_form, field_name: field_item.field.name, default_value: false, input_options: input, label_options: label, tooltip: tooltip).(:checkbox)
1010

1111
- if field_item.field.field_type_instance.class == TreeFieldType
12-
= cell(Plugins::Core::TreeCell, field_item, form: field_item_form, metadata: field_item.field.metadata["allowed_values"], field: field, input_options: input, label_options: label).(render_method)
12+
= cell(Plugins::Core::TreeCell, field_item, form: field_item_form, metadata: field_item.field.metadata["allowed_values"], field: field, input_options: input, label_options: label, tooltip: tooltip).(render_method)
1313

1414
- if field_item.field.field_type_instance.class == DateTimeFieldType
15-
= cell(Plugins::Core::DateTimeCell, field_item, form: field_item_form, default_value: '', input_options: input, label_options: label).(:datepicker)
15+
= cell(Plugins::Core::DateTimeCell, field_item, form: field_item_form, default_value: '', input_options: input, label_options: label, tooltip: tooltip).(:datepicker)
1616

1717
- if field_item.field.field_type_instance.class == TagFieldType
18-
= cell(Plugins::Core::TagCell, field_item, form: field_item_form, default_value: [], input_options: input, label_options: label).(:tag_picker)
18+
= cell(Plugins::Core::TagCell, field_item, form: field_item_form, default_value: [], input_options: input, label_options: label, tooltip: tooltip).(:tag_picker)
1919

2020
- if field_item.field.field_type_instance.class == UserFieldType
21-
= cell(Plugins::Core::UserCell, field_item, form: field_item_form, user_data: User.all, input_options: input, label_options: label).(:dropdown)
21+
= cell(Plugins::Core::UserCell, field_item, form: field_item_form, user_data: User.all, input_options: input, label_options: label, tooltip: tooltip).(:dropdown)
2222

2323
- if field_item.field.field_type_instance.class == AssetFieldType
24-
= cell(Plugins::Core::AssetCell, field_item, form: field_item_form, input_options: input, label_options: label).(:input)
24+
= cell(Plugins::Core::AssetCell, field_item, form: field_item_form, input_options: input, label_options: label, tooltip: tooltip).(:input)
2525

2626
- if field_item.field.field_type_instance.class == ContentItemFieldType
27-
= cell(Plugins::Core::ContentItemCell, field_item, form: field_item_form).(:popup)
27+
= cell(Plugins::Core::ContentItemCell, field_item, form: field_item_form, tooltip: tooltip).(:popup)
2828

2929
- if field_item.field.field_type_instance.class == AuthorFieldType
30-
= cell(Plugins::Core::AuthorCell, field_item, form: field_item_form).(:input)
30+
= cell(Plugins::Core::AuthorCell, field_item, form: field_item_form, tooltip: tooltip).(:input)

app/cells/wizard/field_cell.rb

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class FieldCell < Cell::ViewModel
44
property :label
55
property :input
66
property :render_method
7+
property :tooltip
78

89
def show
910
render

app/models/content_item.rb

+10-11
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,8 @@ def self.taggable_fields
4242
Field.select { |field| field.field_type_instance.is_a?(TagFieldType) }.map { |field_item| field_item.name.parameterize('_') }
4343
end
4444

45-
# The following method (#author_image) is currently faked
46-
# author_image is faked pending being able to reference the specific User object (ex:
47-
# content_item.author.user_image)
48-
49-
def author_image
50-
"<img src='#{creator.gravatar}' height='50px' />".html_safe
45+
def author_email
46+
creator.email
5147
end
5248

5349
def publish_state
@@ -64,11 +60,14 @@ def rss_url(base_url, slug_field_id)
6460
"#{base_url}#{slug}"
6561
end
6662

67-
def user_email(user_field_id)
68-
user_id = field_items.find_by_field_id(user_field_id).data.values.join
69-
user_email = User.find_by_id(user_id).try(:email)
70-
user_fullname = User.find_by_id(user_id).try(:fullname)
71-
"#{user_email} (#{user_fullname})"
63+
def rss_date(date_field_id)
64+
date = field_items.find_by_field_id(date_field_id).data["timestamp"]
65+
Date.parse(date).rfc2822
66+
end
67+
68+
def rss_author(field_id)
69+
author = field_items.find_by_field_id(field_id).data["author_name"]
70+
"[email protected] (#{author})"
7271
end
7372

7473
# The Method self.taggable_fields must always be above the acts_as_taggable_on inclusion for it.

0 commit comments

Comments
 (0)