tmatt_cms 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/tmatt_cms/install_generator.rb +73 -80
  3. data/lib/generators/tmatt_cms/templates/config/application.yml +8 -2
  4. data/lib/generators/tmatt_cms/templates/config/deploy.rb +56 -0
  5. data/lib/generators/tmatt_cms/templates/config/initializers/carrier_wave.rb +1 -0
  6. data/lib/generators/tmatt_cms/templates/config/sidekiq.yml +0 -1
  7. data/lib/generators/tmatt_cms/templates/css/application/index.css.scss +5 -2
  8. data/lib/generators/tmatt_cms/templates/css/style.css.scss +15 -0
  9. data/lib/generators/tmatt_cms/templates/css/utils/action_alert.css.scss +31 -0
  10. data/lib/generators/tmatt_cms/templates/css/utils/froala/froala_editor.min.css.scss +7 -0
  11. data/lib/generators/tmatt_cms/templates/css/utils/froala/froala_style.min.css.scss +7 -0
  12. data/lib/generators/tmatt_cms/templates/css/utils/froala/plugins/colors.css.scss +124 -0
  13. data/lib/generators/tmatt_cms/templates/css/utils/froala/plugins/help.css.scss +52 -0
  14. data/lib/generators/tmatt_cms/templates/css/utils/froala/plugins/image.css.scss +244 -0
  15. data/lib/generators/tmatt_cms/templates/css/utils/froala/plugins/image_manager.css.scss +264 -0
  16. data/lib/generators/tmatt_cms/templates/css/utils/froala/plugins/line_breaker.css.scss +37 -0
  17. data/lib/generators/tmatt_cms/templates/css/utils/froala/plugins/quick_insert.css.scss +70 -0
  18. data/lib/generators/tmatt_cms/templates/css/utils/froala/plugins/special_characters.css.scss +51 -0
  19. data/lib/generators/tmatt_cms/templates/css/utils/froala/plugins/table.css.scss +151 -0
  20. data/lib/generators/tmatt_cms/templates/css/utils/froala/plugins/video.css.scss +231 -0
  21. data/lib/generators/tmatt_cms/templates/gemfile/Gemfile +11 -5
  22. data/lib/generators/tmatt_cms/templates/git_ignore/gitignore +1 -1
  23. data/lib/generators/tmatt_cms/templates/helpers/application_helper.rb +63 -0
  24. data/lib/generators/tmatt_cms/templates/js/application.js +24 -1
  25. data/lib/generators/tmatt_cms/templates/js/utils/action_alert.js +32 -0
  26. data/lib/generators/tmatt_cms/templates/js/utils/froala_editor.js +29 -0
  27. data/lib/generators/tmatt_cms/templates/views/layouts/application.html.haml +1 -0
  28. data/lib/tmatt_cms/version.rb +1 -1
  29. metadata +19 -4
  30. data/lib/generators/tmatt_cms/templates/css/application/ckeditor.css.scss +0 -4
  31. data/lib/generators/tmatt_cms/templates/inputs/ckeditor_translation_input.rb +0 -11
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
-
2
+ # source 'https://gems.ruby-china.org/'
3
3
 
4
4
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
5
  gem 'rails', '4.2.6'
@@ -50,7 +50,9 @@ gem 'devise-async'
50
50
  gem 'omniauth-facebook'
51
51
 
52
52
 
53
- gem 'paperclip'
53
+ gem 'carrierwave', '~> 1.0'
54
+ gem 'mini_magick'
55
+
54
56
  gem 'cancan'
55
57
  gem 'exception_notification', '~> 4.0.1'
56
58
  gem 'simple_token_authentication', '~> 1.0'
@@ -74,12 +76,11 @@ gem 'hashie-forbidden_attributes'
74
76
  group :development, :test do
75
77
  # gem 'rspec'
76
78
  gem 'rspec-rails', '~> 3.0'
79
+ gem 'capybara'
77
80
  gem 'simplecov'
78
81
  gem 'factory_girl_rails', '~> 4.0'
79
82
  end
80
83
 
81
- gem 'ckeditor'
82
-
83
84
  # keep track of views count
84
85
  gem 'views_count', '0.0.3'
85
86
 
@@ -130,4 +131,9 @@ gem 'geocoder'
130
131
  gem 'owlcarousel-rails'
131
132
 
132
133
  # Material Icon
133
- gem 'material_icons'
134
+ gem 'material_icons'
135
+
136
+ # Froala
137
+ gem 'wysiwyg-rails'
138
+
139
+ gem 'aws-sdk', '~> 2'
@@ -21,7 +21,7 @@
21
21
  .idea/*
22
22
  /spec/public/system/
23
23
  /public/system/
24
- /public/ckeditor_assets/
24
+ /public/uploads/
25
25
  config/settings.local.yml
26
26
  config/settings/*.local.yml
27
27
  config/environments/*.local.yml
@@ -0,0 +1,63 @@
1
+ module ApplicationHelper
2
+ def flash_tag
3
+ return '' if flash.blank?
4
+ html = ''
5
+ flash.each do |name, msg|
6
+ if msg.is_a?(String)
7
+ html << "<div class='action-alert alert alert-#{name} text-center m-c'>"
8
+ html << "<button type='button' class='close'>&times;</button>"
9
+ html << "#{msg}"
10
+ html << '</div>'
11
+ end
12
+ end
13
+ raw html
14
+ end
15
+
16
+ def aws_s3_json(directory)
17
+ aws_s3_hash = {
18
+ bucket: ENV['AWS_S3_BUCKET'],
19
+ region: ENV['AWS_S3_REGION'],
20
+ key_start: "#{ENV['AWS_S3_KEY_START']}#{directory}",
21
+ acl: ENV['AWS_S3_ACL'],
22
+ access_id: ENV['AWS_S3_ACCESS_ID'],
23
+ signature: aws_s3_signature(directory),
24
+ policy: aws_s3_policy(directory),
25
+ }
26
+
27
+ @aws_s3_json = aws_s3_hash.to_json
28
+ end
29
+
30
+ def froala_key
31
+ ENV['FROALA_KEY'];
32
+ end
33
+
34
+ private
35
+
36
+ def aws_s3_signature(directory)
37
+ Base64.encode64(
38
+ OpenSSL::HMAC.digest(
39
+ OpenSSL::Digest.new('sha1'),
40
+ ENV['AWS_S3_SECRET_KEY'], aws_s3_policy(directory)
41
+ )
42
+ ).gsub("\n", '')
43
+ end
44
+
45
+ def aws_s3_policy(directory)
46
+ Base64.encode64(aws_s3_policy_data(directory).to_json).gsub("\n", '')
47
+ end
48
+
49
+ def aws_s3_policy_data(directory)
50
+ {
51
+ expiration: 10.hours.from_now.utc.iso8601,
52
+ conditions: [
53
+ ['starts-with', '$key', "#{ENV['AWS_S3_KEY_START']}#{directory}"],
54
+ %w(starts-with $x-requested-with xhr),
55
+ ['content-length-range', 0, 20.megabytes],
56
+ ['starts-with', '$content-type', ''],
57
+ {bucket: ENV['AWS_S3_BUCKET']},
58
+ {acl: ENV['AWS_S3_ACL']},
59
+ {success_action_status: '201'}
60
+ ]
61
+ }
62
+ end
63
+ end
@@ -20,4 +20,27 @@
20
20
  //= require layout
21
21
  //= require owl.carousel
22
22
  //= require magnific-popup
23
- //= require ckeditor/init
23
+ //= require utils/action_alert
24
+ //= require utils/froala_editor
25
+ //= require froala_editor.min.js
26
+ //= require plugins/align.min.js
27
+ //= require plugins/colors.min.js
28
+ //= require plugins/entities.min.js
29
+ //= require plugins/font_family.min.js
30
+ //= require plugins/font_size.min.js
31
+ //= require plugins/help.min.js
32
+ //= require plugins/image.min.js
33
+ //= require plugins/image_manager.min.js
34
+ //= require plugins/inline_style.min.js
35
+ //= require plugins/line_breaker.min.js
36
+ //= require plugins/link.min.js
37
+ //= require plugins/lists.min.js
38
+ //= require plugins/paragraph_format.min.js
39
+ //= require plugins/paragraph_style.min.js
40
+ //= require plugins/quick_insert.min.js
41
+ //= require plugins/quote.min.js
42
+ //= require plugins/table.min.js
43
+ //= require plugins/special_characters.min.js
44
+ //= require plugins/url.min.js
45
+ //= require plugins/video.min.js
46
+ //= require languages/zh_cn.js
@@ -0,0 +1,32 @@
1
+ $(function() {
2
+ var action_alert = $('.action-alert');
3
+ var action_alert_count = action_alert.length;
4
+
5
+ setTimeout(function() {
6
+ if (action_alert_count !== 0) {
7
+ var temp_height = 0;
8
+ for (var i = 1; i <= action_alert_count; i ++) {
9
+ var alert = $('.action-alert:nth-of-type(' + i + ')');
10
+ alert.animate({bottom: i + temp_height + 'rem'});
11
+ temp_height += parseFloat(alert.css('height')) / 10;
12
+ }
13
+
14
+ // $("#action_alert_audio")[0].play();
15
+ }
16
+ }, 200);
17
+
18
+ var action_alert_close = action_alert.find('.close');
19
+ action_alert_close.click(function(e) {
20
+ var alert = $(this).parent('.action-alert');
21
+ var select_bottom = parseFloat(alert.css('bottom')) / 10;
22
+ var select_height = parseFloat(alert.css('height')) / 10;
23
+ $(this).parent('.action-alert').animate({bottom: -1 * select_height - 5 + 'rem'});
24
+
25
+ $.each(action_alert, function() {
26
+ var bottom = parseFloat($(this).css('bottom')) / 10;
27
+ if (bottom > select_bottom ) {
28
+ $(this).animate({bottom: bottom - select_height - 1 + 'rem'});
29
+ }
30
+ })
31
+ })
32
+ });
@@ -0,0 +1,29 @@
1
+
2
+ $(function() {
3
+ var froala_editor = $('.froala-editor');
4
+
5
+ if (froala_editor.length > 0) {
6
+ var aws_s3 = JSON.parse(froala_editor.attr('data'));
7
+
8
+ froala_editor.froalaEditor({
9
+ language: window.location.href.indexOf('/zh/') > 0 ? 'zh_cn' : 'en',
10
+ charCounterCount: false,
11
+ heightMin: '50rem',
12
+ toolbarButtons:['selectAll', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontFamily', 'fontSize', '|', 'specialCharacters', 'color', 'inlineStyle', 'paragraphStyle', '|', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', 'insertHR', '|', 'insertLink', 'insertImage', 'insertVideo', 'insertTable', 'clearFormatting'],
13
+ toolbarButtonsXS: ['bold', 'italic', 'underline', 'fontFamily', 'fontSize', 'insertLink', 'insertImage'],
14
+ videoInsertButtons: ['videoBack', '|', 'videoByURL', 'videoEmbed'],
15
+ imageUploadToS3: {
16
+ bucket: aws_s3['bucket'],
17
+ region: aws_s3['region'],
18
+ keyStart: aws_s3['key_start'],
19
+ params: {
20
+ acl: aws_s3['acl'],
21
+ AWSAccessKeyId: aws_s3['access_id'],
22
+ policy: aws_s3['policy'],
23
+ signature: aws_s3['signature']
24
+ }
25
+ }
26
+ });
27
+ }
28
+
29
+ });
@@ -5,6 +5,7 @@
5
5
  #main
6
6
  = render 'chromeframe'
7
7
  = render 'header'
8
+ = flash_tag
8
9
  = yield
9
10
  = render 'footer'
10
11
 
@@ -1,3 +1,3 @@
1
1
  module TmattCms
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmatt_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xingyu Ye
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-26 00:00:00.000000000 Z
11
+ date: 2017-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -69,7 +69,9 @@ files:
69
69
  - lib/generators/tmatt_cms/templates/concerns/string_addition.rb
70
70
  - lib/generators/tmatt_cms/templates/concerns/translatable.rb
71
71
  - lib/generators/tmatt_cms/templates/config/application.yml
72
+ - lib/generators/tmatt_cms/templates/config/deploy.rb
72
73
  - lib/generators/tmatt_cms/templates/config/initializers/active_job.rb
74
+ - lib/generators/tmatt_cms/templates/config/initializers/carrier_wave.rb
73
75
  - lib/generators/tmatt_cms/templates/config/initializers/devise.rb
74
76
  - lib/generators/tmatt_cms/templates/config/initializers/devise_async.rb
75
77
  - lib/generators/tmatt_cms/templates/config/locales/views/dashboard/en.yml
@@ -79,7 +81,6 @@ files:
79
81
  - lib/generators/tmatt_cms/templates/config/sidekiq.yml
80
82
  - lib/generators/tmatt_cms/templates/controllers/pages_controller.rb
81
83
  - lib/generators/tmatt_cms/templates/css/application/application.scss
82
- - lib/generators/tmatt_cms/templates/css/application/ckeditor.css.scss
83
84
  - lib/generators/tmatt_cms/templates/css/application/index.css.scss
84
85
  - lib/generators/tmatt_cms/templates/css/application/magnific_popup_rails.css.scss
85
86
  - lib/generators/tmatt_cms/templates/css/application/main.css.scss
@@ -90,13 +91,27 @@ files:
90
91
  - lib/generators/tmatt_cms/templates/css/layouts/form.css.scss
91
92
  - lib/generators/tmatt_cms/templates/css/layouts/header.css.scss
92
93
  - lib/generators/tmatt_cms/templates/css/style.css.scss
94
+ - lib/generators/tmatt_cms/templates/css/utils/action_alert.css.scss
95
+ - lib/generators/tmatt_cms/templates/css/utils/froala/froala_editor.min.css.scss
96
+ - lib/generators/tmatt_cms/templates/css/utils/froala/froala_style.min.css.scss
97
+ - lib/generators/tmatt_cms/templates/css/utils/froala/plugins/colors.css.scss
98
+ - lib/generators/tmatt_cms/templates/css/utils/froala/plugins/help.css.scss
99
+ - lib/generators/tmatt_cms/templates/css/utils/froala/plugins/image.css.scss
100
+ - lib/generators/tmatt_cms/templates/css/utils/froala/plugins/image_manager.css.scss
101
+ - lib/generators/tmatt_cms/templates/css/utils/froala/plugins/line_breaker.css.scss
102
+ - lib/generators/tmatt_cms/templates/css/utils/froala/plugins/quick_insert.css.scss
103
+ - lib/generators/tmatt_cms/templates/css/utils/froala/plugins/special_characters.css.scss
104
+ - lib/generators/tmatt_cms/templates/css/utils/froala/plugins/table.css.scss
105
+ - lib/generators/tmatt_cms/templates/css/utils/froala/plugins/video.css.scss
93
106
  - lib/generators/tmatt_cms/templates/css/utils/jasny-bootstrap.min.css
94
107
  - lib/generators/tmatt_cms/templates/gemfile/Gemfile
95
108
  - lib/generators/tmatt_cms/templates/git_ignore/gitignore
96
- - lib/generators/tmatt_cms/templates/inputs/ckeditor_translation_input.rb
109
+ - lib/generators/tmatt_cms/templates/helpers/application_helper.rb
97
110
  - lib/generators/tmatt_cms/templates/inputs/concerns/translation_hint.rb
98
111
  - lib/generators/tmatt_cms/templates/inputs/translation_input.rb
99
112
  - lib/generators/tmatt_cms/templates/js/application.js
113
+ - lib/generators/tmatt_cms/templates/js/utils/action_alert.js
114
+ - lib/generators/tmatt_cms/templates/js/utils/froala_editor.js
100
115
  - lib/generators/tmatt_cms/templates/js/utils/jasny-bootstrap.min.js
101
116
  - lib/generators/tmatt_cms/templates/js/utils/magnificPopup.js
102
117
  - lib/generators/tmatt_cms/templates/seed_bank/all.seeds.rb
@@ -1,4 +0,0 @@
1
- .cke_chrome {
2
- width: 79.5% !important;
3
- overflow: hidden;
4
- }
@@ -1,11 +0,0 @@
1
- class CkeditorTranslationInput < Ckeditor::Hooks::SimpleForm::CkeditorInput
2
- include Concerns::TranslationHint
3
-
4
- def input(wrapper_options = nil)
5
- format(
6
- '%s%s',
7
- super,
8
- translation_hint
9
- ).html_safe
10
- end
11
- end