designer 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +2 -0
  3. data/.gitignore +4 -0
  4. data/.travis.yml +17 -0
  5. data/Gemfile +6 -0
  6. data/Gemfile.lock +142 -0
  7. data/LICENSE +21 -0
  8. data/README.md +102 -0
  9. data/Rakefile +27 -0
  10. data/TODO.md +6 -0
  11. data/app/assets/stylesheets/designer.scss +189 -0
  12. data/app/assets/stylesheets/designer/_texy.scss +311 -0
  13. data/app/controllers/designer/application_controller.rb +33 -0
  14. data/app/controllers/designer/editor_controller.rb +50 -0
  15. data/app/controllers/designer/images_controller.rb +66 -0
  16. data/app/helpers/designer/designer_helper.rb +95 -0
  17. data/app/javascript/designer/DefaultInput.vue +82 -0
  18. data/app/javascript/designer/components/DefaultForm.vue +65 -0
  19. data/app/javascript/designer/components/DefaultInput.vue +82 -0
  20. data/app/javascript/designer/components/MediaGallery.vue +564 -0
  21. data/app/javascript/designer/components/SortableInputArray.vue +74 -0
  22. data/app/javascript/designer/editor.js +65 -0
  23. data/app/javascript/designer/helpers.js +73 -0
  24. data/app/javascript/designer/index.js +136 -0
  25. data/app/javascript/packs/designer.js +2 -0
  26. data/app/views/designer/application/notifications.js.erb +13 -0
  27. data/app/views/designer/editor/show.html.slim +88 -0
  28. data/app/views/designer/elements/_image.html.slim +11 -0
  29. data/app/views/designer/elements/_quote.html.slim +7 -0
  30. data/app/views/designer/elements/_separator.html.slim +1 -0
  31. data/app/views/designer/elements/_text.html.slim +5 -0
  32. data/app/views/layouts/designer/application.html.slim +9 -0
  33. data/bin/test +6 -0
  34. data/bin/webpack +19 -0
  35. data/bin/webpack-dev-server +19 -0
  36. data/config/routes.rb +6 -0
  37. data/designer.gemspec +29 -0
  38. data/lib/designer.rb +10 -0
  39. data/lib/designer/attribute.rb +15 -0
  40. data/lib/designer/configuration.rb +6 -0
  41. data/lib/designer/engine.rb +35 -0
  42. data/lib/designer/version.rb +5 -0
  43. data/lib/tasks/designer.rake +20 -0
  44. data/lib/templates/dev_installer.rb +13 -0
  45. data/lib/templates/installer.rb +11 -0
  46. data/package.json +33 -0
  47. data/yarn.lock +288 -0
  48. metadata +160 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 06c10fc816f6482724649727d5821e2d1a8b94830424bb3a80599481f9880ef1
4
+ data.tar.gz: 286a7149c4c6259ca391738680f4159204ea59a32c33f46ceb15574d7cf89a04
5
+ SHA512:
6
+ metadata.gz: 5ba179dc8959b91f61a87ded776d299fec8089eef56406d21bc0d1861e00c106e79ec9521b702da938124ba67aaffb3543642a55a50fd7d153c58e8a19673f7e
7
+ data.tar.gz: 7bbe1e69658e7d843f900a710e431456f8228aff2c2e7d5ad758331e6ccda6b3368bc8fd1e5bdf19e49bde9cbaa324f81108aa3937d1f9f3523803e8611fba41
data/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ .bundle/
2
+ node_modules/
3
+ pkg/
4
+ bak/
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+ sudo: false
3
+
4
+ rvm:
5
+ - 2.5.3
6
+ - ruby-head
7
+
8
+ cache:
9
+ bundler: true
10
+
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: ruby-head
14
+ fast_finish: true
15
+
16
+ script:
17
+ - bundle exec rake
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo_path| "https://github.com/#{repo_path}.git" }
3
+
4
+ gemspec
5
+
6
+ gem "rails", github: "rails/rails"
data/Gemfile.lock ADDED
@@ -0,0 +1,142 @@
1
+ GIT
2
+ remote: https://github.com/rails/rails.git
3
+ revision: a1ee4a9ff9d4a3cb255365310ead0dc7b739c6be
4
+ specs:
5
+ actioncable (6.0.0.alpha)
6
+ actionpack (= 6.0.0.alpha)
7
+ nio4r (~> 2.0)
8
+ websocket-driver (>= 0.6.1)
9
+ actionmailer (6.0.0.alpha)
10
+ actionpack (= 6.0.0.alpha)
11
+ actionview (= 6.0.0.alpha)
12
+ activejob (= 6.0.0.alpha)
13
+ mail (~> 2.5, >= 2.5.4)
14
+ rails-dom-testing (~> 2.0)
15
+ actionpack (6.0.0.alpha)
16
+ actionview (= 6.0.0.alpha)
17
+ activesupport (= 6.0.0.alpha)
18
+ rack (~> 2.0)
19
+ rack-test (>= 0.6.3)
20
+ rails-dom-testing (~> 2.0)
21
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
22
+ actionview (6.0.0.alpha)
23
+ activesupport (= 6.0.0.alpha)
24
+ builder (~> 3.1)
25
+ erubi (~> 1.4)
26
+ rails-dom-testing (~> 2.0)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
28
+ activejob (6.0.0.alpha)
29
+ activesupport (= 6.0.0.alpha)
30
+ globalid (>= 0.3.6)
31
+ activemodel (6.0.0.alpha)
32
+ activesupport (= 6.0.0.alpha)
33
+ activerecord (6.0.0.alpha)
34
+ activemodel (= 6.0.0.alpha)
35
+ activesupport (= 6.0.0.alpha)
36
+ activestorage (6.0.0.alpha)
37
+ actionpack (= 6.0.0.alpha)
38
+ activerecord (= 6.0.0.alpha)
39
+ marcel (~> 0.3.1)
40
+ activesupport (6.0.0.alpha)
41
+ concurrent-ruby (~> 1.0, >= 1.0.2)
42
+ i18n (>= 0.7, < 2)
43
+ minitest (~> 5.1)
44
+ tzinfo (~> 1.1)
45
+ rails (6.0.0.alpha)
46
+ actioncable (= 6.0.0.alpha)
47
+ actionmailer (= 6.0.0.alpha)
48
+ actionpack (= 6.0.0.alpha)
49
+ actionview (= 6.0.0.alpha)
50
+ activejob (= 6.0.0.alpha)
51
+ activemodel (= 6.0.0.alpha)
52
+ activerecord (= 6.0.0.alpha)
53
+ activestorage (= 6.0.0.alpha)
54
+ activesupport (= 6.0.0.alpha)
55
+ bundler (>= 1.3.0)
56
+ railties (= 6.0.0.alpha)
57
+ sprockets-rails (>= 2.0.0)
58
+ railties (6.0.0.alpha)
59
+ actionpack (= 6.0.0.alpha)
60
+ activesupport (= 6.0.0.alpha)
61
+ method_source
62
+ rake (>= 0.8.7)
63
+ thor (>= 0.19.0, < 2.0)
64
+
65
+ GIT
66
+ remote: https://github.com/rails/webpacker.git
67
+ revision: 2c0a8dc82a6b0e58997522bb604b4aec6b9c6488
68
+ specs:
69
+ webpacker (4.0.0.rc.2)
70
+ activesupport (>= 4.2)
71
+ rack-proxy (>= 0.6.1)
72
+ railties (>= 4.2)
73
+
74
+ PATH
75
+ remote: .
76
+ specs:
77
+ designer (0.1.0)
78
+ rails (>= 5.2.0)
79
+
80
+ GEM
81
+ remote: https://rubygems.org/
82
+ specs:
83
+ builder (3.2.3)
84
+ concurrent-ruby (1.0.5)
85
+ crass (1.0.4)
86
+ erubi (1.7.1)
87
+ globalid (0.4.1)
88
+ activesupport (>= 4.2.0)
89
+ i18n (1.1.0)
90
+ concurrent-ruby (~> 1.0)
91
+ loofah (2.2.2)
92
+ crass (~> 1.0.2)
93
+ nokogiri (>= 1.5.9)
94
+ mail (2.7.0)
95
+ mini_mime (>= 0.1.1)
96
+ marcel (0.3.3)
97
+ mimemagic (~> 0.3.2)
98
+ method_source (0.9.0)
99
+ mimemagic (0.3.2)
100
+ mini_mime (1.0.1)
101
+ mini_portile2 (2.3.0)
102
+ minitest (5.11.3)
103
+ nio4r (2.3.1)
104
+ nokogiri (1.8.2)
105
+ mini_portile2 (~> 2.3.0)
106
+ rack (2.0.4)
107
+ rack-proxy (0.6.5)
108
+ rack
109
+ rack-test (1.1.0)
110
+ rack (>= 1.0, < 3)
111
+ rails-dom-testing (2.0.3)
112
+ activesupport (>= 4.2.0)
113
+ nokogiri (>= 1.6)
114
+ rails-html-sanitizer (1.0.4)
115
+ loofah (~> 2.2, >= 2.2.2)
116
+ rake (12.3.1)
117
+ sprockets (3.7.2)
118
+ concurrent-ruby (~> 1.0)
119
+ rack (> 1, < 3)
120
+ sprockets-rails (3.2.1)
121
+ actionpack (>= 4.0)
122
+ activesupport (>= 4.0)
123
+ sprockets (>= 3.0.0)
124
+ thor (0.20.0)
125
+ thread_safe (0.3.6)
126
+ tzinfo (1.2.5)
127
+ thread_safe (~> 0.1)
128
+ websocket-driver (0.7.0)
129
+ websocket-extensions (>= 0.1.0)
130
+ websocket-extensions (0.1.3)
131
+
132
+ PLATFORMS
133
+ ruby
134
+
135
+ DEPENDENCIES
136
+ bundler (~> 1.15)
137
+ designer!
138
+ rails!
139
+ webpacker!
140
+
141
+ BUNDLED WITH
142
+ 1.16.2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Sourcey
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # Page Designer
2
+
3
+ Design rich text markdown pages in Rails application.
4
+
5
+ ## Installation
6
+
7
+ Add the gem to your Gemfile
8
+
9
+ ``
10
+ gem 'designer', github: 'sourcey/designer'
11
+ ```
12
+
13
+ Run the installation task
14
+
15
+ ```
16
+ rake designer:run_installer
17
+ ```
18
+
19
+ Add the designer engine to your routes
20
+
21
+ ```
22
+ mount Designer::Engine => "/designer"
23
+ ```
24
+
25
+ Add `acts_as_designer` to each modal you want to use the designer on
26
+
27
+ ```
28
+ acts_as_designer
29
+ ```
30
+
31
+ Add designer.yml to your config folder.
32
+
33
+ Example config/designer.yml
34
+
35
+ ```
36
+ ---
37
+ image_sizes: &image_sizes
38
+ - 1920x
39
+ - 1280x
40
+ - 640x
41
+ - 480x
42
+ spec: &default_spec
43
+ - label: Text
44
+ template: text
45
+ properties:
46
+ text:
47
+ type: string
48
+ multiline: true
49
+ markdown: true
50
+ - label: Image
51
+ template: image
52
+ properties:
53
+ image_key:
54
+ type: string
55
+ caption:
56
+ type: string
57
+ size:
58
+ type: string
59
+ enum: *image_sizes
60
+ classes:
61
+ type: array
62
+ custom: true
63
+ enum:
64
+ - left
65
+ - right
66
+ - center
67
+ - block
68
+ - pull
69
+ - parallax
70
+ - label: Quote
71
+ template: quote
72
+ properties:
73
+ text:
74
+ type: string
75
+ multiline: true
76
+ cite:
77
+ type: string
78
+ classes:
79
+ type: array
80
+ custom: true
81
+ enum:
82
+ - left
83
+ - right
84
+ - center
85
+ - block
86
+ - pull
87
+ - label: Separator
88
+ template: separator
89
+ properties:
90
+ size:
91
+ type: number
92
+ articles:
93
+ preview_path: /articles/:slug
94
+ designer_template_path: /articles/designer
95
+ elements_template_path: /articles/elements
96
+ spec: *default_spec
97
+ projects:
98
+ preview_path: /:slug
99
+ designer_template_path: /projects/designer
100
+ elements_template_path: /projects/elements
101
+ spec: *default_spec
102
+ ```
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Action Text'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
18
+
19
+ require 'rake/testtask'
20
+
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.libs << 'test'
23
+ t.pattern = 'test/**/*_test.rb'
24
+ t.verbose = false
25
+ end
26
+
27
+ task default: :test
data/TODO.md ADDED
@@ -0,0 +1,6 @@
1
+ # TODO
2
+
3
+ * Galleries
4
+ * Release gem
5
+ * Write README
6
+ * Install migrations per modal
@@ -0,0 +1,189 @@
1
+ //
2
+ // Page Designer SCSS
3
+ //
4
+
5
+ $link-color: #C72073;
6
+ $font-size-base: 0.875rem;
7
+ $font-family-sans-serif: 'Open Sans', sans-serif;
8
+
9
+ @import 'bootstrap/scss/bootstrap';
10
+ @import 'toastr/build/toastr';
11
+ @import 'simplemde/dist/simplemde.min';
12
+ @import '@voerro/vue-tagsinput/dist/style';
13
+
14
+ // @import 'font-awesome';
15
+ // @import "font-awesome-sprockets";
16
+ @import url('https://use.fontawesome.com/releases/v5.6.3/css/all.css');
17
+ @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,400i,600,600i,700');
18
+
19
+
20
+ html, body {
21
+ height: 100%;
22
+ }
23
+
24
+ #app {
25
+ display: flex;
26
+ flex-direction: row;
27
+ width: 100%;
28
+ overflow: hidden;
29
+ height: 100%;
30
+ xtouch-action: none;
31
+
32
+ .panel-left {
33
+ flex: 0 0 auto;
34
+ width: 33%;
35
+ min-width: 200px;
36
+ height: 100%;
37
+ overflow-y: auto;
38
+ overflow-x: hidden;
39
+ }
40
+
41
+ .splitter {
42
+ flex: 0 0 auto;
43
+ width: 2px;
44
+ background: $gray-300;
45
+ cursor: col-resize;
46
+ }
47
+
48
+ .panel-right {
49
+ flex: 1 1 auto;
50
+ width: 100%;
51
+ height: 100%;
52
+ }
53
+
54
+ //
55
+ // Preview iFrame
56
+
57
+ #preview {
58
+ border: none;
59
+ }
60
+
61
+ //
62
+ // Sidebar
63
+
64
+ #sidebar {
65
+ background: #f6f6f6;
66
+
67
+ .tab-title {
68
+ font-size: .7rem;
69
+ text-transform: uppercase;
70
+ }
71
+
72
+ //
73
+ // Elements List
74
+
75
+ #elements {
76
+ .section-heading {
77
+ padding-left: 1rem;
78
+ .title {
79
+ font-size: .75rem;
80
+ text-transform: uppercase;
81
+ }
82
+ }
83
+
84
+ .form-group {
85
+ padding: .5rem 1rem;
86
+ border-bottom: 1px solid #f6f6f6;
87
+ margin: 0;
88
+ }
89
+ .form-check {
90
+ padding: .5rem 1rem .5rem 2.25rem;
91
+ border-bottom: 1px solid #f6f6f6;
92
+ margin: 0;
93
+ }
94
+ .form-row > .col, .form-row > [class*="col-"] {
95
+ padding-right: 0;
96
+ padding-left: 0;
97
+ }
98
+
99
+ .card {
100
+ border-bottom: 0;
101
+ border-left: 0;
102
+ border-right: 0;
103
+
104
+ .card-header {
105
+ padding: .75rem 1rem;
106
+ background-color: #fdf4d9;
107
+ border-bottom: 0;
108
+ }
109
+ .card-body {
110
+ padding: 0;
111
+ }
112
+
113
+ &.child {
114
+ .card-header {
115
+ background-color: #f6f6f6;
116
+ padding: .5rem 1rem;
117
+ .title {
118
+ }
119
+ }
120
+ .card-body {
121
+ }
122
+ }
123
+ }
124
+ }
125
+
126
+ //
127
+ // Media Gallery
128
+
129
+ #gallery {
130
+ .table-responsive {
131
+ overflow: inherit !important;
132
+ }
133
+ }
134
+
135
+ //
136
+ // Resource Form
137
+
138
+ #editor {
139
+ overflow-y: auto !important;
140
+ input, textarea {
141
+ font-size: 1rem;
142
+ }
143
+ }
144
+ }
145
+ }
146
+
147
+ //
148
+ // Markdown Editor
149
+
150
+ #markdown-editor-modal {
151
+ .modal-dialog {
152
+ width: 98%;
153
+ height: 92%;
154
+ padding: 0;
155
+ max-width: none;
156
+ }
157
+
158
+ .modal-content {
159
+ height: 99%;
160
+ }
161
+
162
+ .close {
163
+ position: absolute;
164
+ top: 1rem;
165
+ right: 1rem;
166
+ z-index: 1;
167
+ // margin: 1rem;
168
+ }
169
+
170
+ .CodeMirror-wrap {
171
+ font-size: 1.1rem;
172
+ }
173
+
174
+ .markdown {
175
+ line-height: 1.5;
176
+ height: auto;
177
+ }
178
+ }
179
+
180
+ // .simplemde-fullscreen .modal-dialog {
181
+ // position: absolute;
182
+ // top: 0;
183
+ // right: 0;
184
+ // bottom: 0;
185
+ // left: 0;
186
+ // width: 100%;
187
+ // max-width: 100%;
188
+ // margin: 0;
189
+ // }