Skip to content

Commit 3c760d0

Browse files
authored
[feature] Enable UI-customizable message layout (#156)
* [feature] Enable UI-customizable message layout Fixes #140 Instead of using a hard-coded message layout (mailer.html.erb), make it configurable through the management UI with a sane default for all hackathons. * Hound feedback * Disable eslint * Fix flaky test
1 parent c0dce7b commit 3c760d0

33 files changed

+12376
-434
lines changed

.hound.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ ruby:
22
config_file: .rubocop.yml
33
haml:
44
config_file: .haml-lint.yml
5+
eslint:
6+
enabled: false

.rubocop-shared.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ Style/IfUnlessModifier:
6060
Style/StringLiterals:
6161
Enabled: false
6262

63+
Style/TrailingCommaInArguments:
64+
Enabled: false
65+
6366
TrailingCommaInHashLiteral:
6467
Enabled: false
6568

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ group :test do
118118
gem 'codeclimate-test-reporter', '~> 0.6.0', require: nil
119119
gem 'rails-controller-testing' # Rails 4 fallback
120120
gem 'webmock', '~> 3.4'
121+
gem 'timecop'
121122

122123
# Adds support for Capybara system testing and selenium driver
123124
gem 'capybara', '>= 2.15'

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ GEM
414414
thor (0.20.3)
415415
thread_safe (0.3.6)
416416
tilt (2.0.9)
417+
timecop (0.9.1)
417418
turbolinks (5.2.0)
418419
turbolinks-source (~> 5.2)
419420
turbolinks-source (5.2.0)
@@ -505,6 +506,7 @@ DEPENDENCIES
505506
sprockets
506507
strip_attributes
507508
test-unit (~> 3.0)
509+
timecop
508510
turbolinks (~> 5)
509511
uglifier (>= 1.3.0)
510512
valid_attribute

app/assets/javascripts/manage/application.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
//= require popper
44
//= require bootstrap
55
//= require ../vendor/datatables.min
6+
//= require ../vendor/codemirror
7+
//= require ../vendor/codemirror-modes/htmlmixed
8+
//= require ../vendor/codemirror-modes/xml
9+
//= require ../vendor/codemirror-modes/css
610
//= require selectize
711
//= require_directory ./lib
812

@@ -18,6 +22,7 @@ function applicationReady() {
1822
setupSimpleMde();
1923
setupEmailEvents();
2024
setupManageForms();
25+
setupCodeMirror();
2126

2227
$.ajaxSetup({
2328
beforeSend: function(xhr) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function setupCodeMirror() {
2+
$('[data-code-mirror-textarea]').each(function(i, element) {
3+
var myCodeMirror = CodeMirror.fromTextArea(element, {
4+
lineNumbers: true,
5+
mode: 'htmlmixed',
6+
});
7+
myCodeMirror.setSize(null, window.innerHeight - 200);
8+
});
9+
}

0 commit comments

Comments
 (0)