Skip to content

Commit 2be95b9

Browse files
committed
Merge branch 'develop'
2 parents b8e9a4d + 5bf8c86 commit 2be95b9

File tree

9 files changed

+141
-81
lines changed

9 files changed

+141
-81
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Cortex follows a decentralized, API-only architecture - it is *not* built like W
4343
- [Webpages and Snippets](#webpages-and-snippets)
4444
- [Exceptions](#exceptions)
4545
- [Applications Using Cortex](#applications-using-cortex)
46+
- [Troubleshooting](#troubleshooting)
4647
- [Contributing](#contributing)
4748
- [License](#license)
4849
- [Copyright](#copyright)
@@ -55,7 +56,7 @@ Copy and rename the example `.env.example` file as `.env` and modify it to match
5556

5657
For a rudimentary setup, these variables should be configured:
5758

58-
* Use `$ rake secret` to generate `APP_SECRET` and `DEVISE_SECRET`
59+
* Execute `$ bundle exec rails secret` twice to generate both an `APP_SECRET` and `DEVISE_SECRET`
5960
* If the superuser isn't used for the app databases, the `DATABASE_USERNAME` and `DATABASE_PASSWORD` should be set accordingly.
6061
* Set `HOST` to the local Web server's root URL to properly configure Fog (local asset storage)
6162

@@ -312,6 +313,9 @@ If a consuming or companion application would like to produce Cortex-equivalent
312313
* [CB1 Lander Shell](https://github.com/cbdr/cb1-lander-shell) - Platform for hosting lander pages and experiments, utilizing Cortex Posts and Sinatra. [Live Site](http://corporate.careerbuilder.com/)
313314
* [CareerBuilder.com](https://github.com/cbdr/consumer-main) - The main Consumer Web site for CB.com uses Cortex Posts for the [Privacy](http://www.careerbuilder.com/privacy) and [Terms of Service](http://www.careerbuilder.com/terms) pages.
314315

316+
## Troubleshooting
317+
* For OS X / homebrew users: Run `which node` to ensure node is properly linked. The path shown should match homebrew's default installation path (run `which brew` to reveal this). If its not, then run `brew link node` and follow the instructions.
318+
315319
## Contributing
316320

317321
Anyone and everyone is encouraged to fork Cortex and submit pull requests, propose new features and create issues.

app/api/v1/entities/webpage.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ class Webpage < Grape::Entity
2121
expose :dynamic_yield_category, documentation: { type: 'String', desc: "Dynamic Yield Webpage Category" }
2222

2323
expose :tables_widget_json, documentation: {type: 'Hash', is_array: true, desc: 'Tables Widget Data as JSON'}
24+
expose :charts_widget_json, documentation: {type: 'Hash', is_array: true, desc: 'Charts Widget Data as JSON'}
2425

2526
with_options if: { full: true } do
2627
expose :user, with: '::V1::Entities::User', documentation: {type: 'User', desc: 'Owner'}
2728
expose :url, documentation: { type: 'String', desc: 'URL of Webpage' }
2829

2930
expose :tables_widget_yaml, documentation: {type: 'Hash', is_array: true, desc: 'Tables Widget Data as YAML'}
31+
expose :charts_widget_yaml, documentation: {type: 'Hash', is_array: true, desc: 'Charts Widget Data as YAML'}
3032
end
3133
end
3234
end

app/assets/javascripts/media_dialogs.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@
99
global.dialogs[dialog.id] = dialog;
1010
});
1111

12-
$('.close-dialog').click(function(event) {
12+
$('.close-dialog').on('click', function(event) {
13+
closeDialog();
14+
});
15+
16+
$('body').on('click', function(event) {
1317
var dialog = document.getElementById(event.target.closest('dialog').id);
14-
dialog.close();
15-
global.unblur_backdrop();
18+
var rect = dialog.getBoundingClientRect();
19+
var isInDialog=(rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width);
20+
21+
if (!isInDialog) {
22+
closeDialog();
23+
}
1624
});
1725

1826
global.blur_backdrop = function() {
@@ -22,4 +30,10 @@
2230
global.unblur_backdrop = function() {
2331
$('.mdl-layout__container').removeClass('blur');
2432
};
33+
34+
function closeDialog() {
35+
var dialog = document.getElementById(event.target.closest('dialog').id);
36+
dialog.close();
37+
global.unblur_backdrop();
38+
}
2539
}(this));

app/assets/legacy_templates/webpages/edit.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@
112112
ng-model="data.webpage.tables_widget_yaml"
113113
placeholder="YAML-formatted table data"></textarea>
114114
</div>
115+
<div class="form-group">
116+
<label for="charts_widget_yaml">Charts Data</label>
117+
<textarea id="charts_widget_yaml" name="charts_widget_yaml" class="form-control" rows="15"
118+
ng-model="data.webpage.charts_widget_yaml"
119+
placeholder="YAML-formatted chart data"></textarea>
120+
</div>
115121
</form>
116122
</div>
117123
</tab>

app/models/concerns/searchable_webpage.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module SearchableWebpage
3030
indexes :noarchive, :type => :boolean, :index => :not_analyzed
3131
indexes :noimageindex, :type => :boolean, :index => :not_analyzed
3232
indexes :tables_widget, :type => :nested, :enabled => false
33+
indexes :charts_widget, :type => :nested, :enabled => false
3334
end
3435

3536
def as_indexed_json(options = {})

app/models/webpage.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ class Webpage < ApplicationRecord
33
include SearchableWebpage
44

55
serialize :tables_widget
6+
serialize :charts_widget
67

78
scope :find_by_protocol_agnostic_url, ->(suffix) { where('url LIKE :suffix', suffix: "%#{suffix}") }
89

@@ -30,4 +31,20 @@ def tables_widget_json
3031
def tables_widget_json= p
3132
self.tables_widget = JSON.parse(p, quirks_mode: true) # Quirks mode will let us parse a null JSON object
3233
end
34+
35+
def charts_widget_yaml
36+
charts_widget.to_yaml
37+
end
38+
39+
def charts_widget_yaml= p
40+
self.charts_widget = YAML.load(p)
41+
end
42+
43+
def charts_widget_json
44+
charts_widget.to_json
45+
end
46+
47+
def charts_widget_json= p
48+
self.charts_widget = JSON.parse(p, quirks_mode: true) # Quirks mode will let us parse a null JSON object
49+
end
3350
end

app/views/partials/_sidebar.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
= render 'partials/navigation'
77
%footer
88
%nav.demo-navigation.mdl-navigation
9-
- unless environment == :production
9+
- unless Rails.env.production?
1010
= render 'partials/environment_display'
1111
= render 'partials/tenant_display'
1212
.sidebar__toggle-button#sidebar__toggle-button
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddChartsWidgetToWebpage < ActiveRecord::Migration[5.0]
2+
def change
3+
add_column :webpages, :charts_widget, :jsonb
4+
end
5+
end

0 commit comments

Comments
 (0)