ecrire 0.31.1 → 0.31.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/Gemfile +2 -1
  4. data/Rakefile +1 -45
  5. data/lib/ecrire.rb +12 -0
  6. data/lib/ecrire/app/assets/javascripts/admin/posts/content.coffee +7 -7
  7. data/lib/ecrire/app/assets/javascripts/admin/posts/header.coffee +1 -1
  8. data/lib/ecrire/app/assets/stylesheets/admin/base.scss +12 -3
  9. data/lib/ecrire/app/assets/stylesheets/admin/navigation.scss +0 -31
  10. data/lib/ecrire/app/assets/stylesheets/admin/navigation/base.scss +30 -0
  11. data/lib/ecrire/app/assets/stylesheets/admin/navigation/home.scss +22 -0
  12. data/lib/ecrire/app/assets/stylesheets/admin/posts.scss +0 -50
  13. data/lib/ecrire/app/assets/stylesheets/admin/posts/aside.scss +36 -0
  14. data/lib/ecrire/app/assets/stylesheets/admin/posts/editor.scss +4 -0
  15. data/lib/ecrire/app/assets/stylesheets/admin/posts/header.scss +2 -1
  16. data/lib/ecrire/app/assets/stylesheets/admin/posts/list.scss +61 -0
  17. data/lib/ecrire/app/assets/stylesheets/admin/{preview.scss → posts/preview.scss} +6 -3
  18. data/lib/ecrire/app/assets/stylesheets/editor/blockquote.scss +4 -0
  19. data/lib/ecrire/app/assets/stylesheets/editor/code.scss +1 -0
  20. data/lib/ecrire/app/assets/stylesheets/editor/content.scss +1 -1
  21. data/lib/ecrire/app/assets/stylesheets/editor/html.scss +20 -0
  22. data/lib/ecrire/app/assets/stylesheets/variables.scss +3 -0
  23. data/lib/ecrire/app/controllers/admin/posts_controller.rb +4 -4
  24. data/lib/ecrire/app/helpers/admin/images_helper.rb +4 -4
  25. data/lib/ecrire/app/helpers/admin/posts_helper.rb +4 -4
  26. data/lib/ecrire/app/helpers/application_helper.rb +1 -1
  27. data/lib/ecrire/app/models/admin/image.rb +4 -4
  28. data/lib/ecrire/app/models/post.rb +1 -1
  29. data/lib/ecrire/app/models/user.rb +4 -0
  30. data/lib/ecrire/app/views/admin/posts/_search.html.erb +1 -8
  31. data/lib/ecrire/app/views/admin/posts/help.js.erb +1 -1
  32. data/lib/ecrire/app/views/admin/posts/index.html.erb +43 -20
  33. data/lib/ecrire/app/views/admin/posts/index.js.erb +1 -1
  34. data/lib/ecrire/app/views/admin/posts/show.html.erb +2 -2
  35. data/lib/ecrire/app/views/admin/posts/tags/create.js.erb +2 -2
  36. data/lib/ecrire/app/views/admin/posts/tags/index.js.erb +1 -1
  37. data/lib/ecrire/app/views/admin/posts/tags/toggle.js.erb +2 -2
  38. data/lib/ecrire/app/views/admin/posts/titles/create.js.erb +2 -2
  39. data/lib/ecrire/app/views/admin/posts/titles/index.js.erb +1 -1
  40. data/lib/ecrire/app/views/admin/posts/titles/update.js.erb +1 -1
  41. data/lib/ecrire/app/views/admin/profiles/show.js.erb +1 -1
  42. data/lib/ecrire/app/views/admin/tags/create.js.erb +1 -1
  43. data/lib/ecrire/app/views/admin/tags/index.js.erb +1 -1
  44. data/lib/ecrire/app/views/admin/tags/update.js.erb +1 -1
  45. data/lib/ecrire/app/views/admin/titles/edit.js.erb +1 -1
  46. data/lib/ecrire/app/views/admin/titles/errors.js.erb +1 -1
  47. data/lib/ecrire/app/views/admin/titles/index.js.erb +1 -1
  48. data/lib/ecrire/app/views/layouts/admin/application.html.erb +20 -2
  49. data/lib/ecrire/application.rb +53 -29
  50. data/lib/ecrire/commands/server.rb +12 -2
  51. data/lib/ecrire/configuration.rb +39 -0
  52. data/lib/ecrire/onboarding/controllers/onboarding_controller.rb +2 -0
  53. data/lib/ecrire/onboarding/engine.rb +0 -4
  54. data/lib/ecrire/theme/engine.rb +4 -4
  55. data/lib/ecrire/theme/template/Gemfile +16 -16
  56. data/lib/ecrire/version.rb +1 -1
  57. data/test/configuration/postgresql.rb +60 -11
  58. data/test/editor/initializers.rb +20 -13
  59. data/test/editor/models/image_test.rb +2 -2
  60. data/test/editor/theme/secrets.yml +9 -0
  61. data/test/onboarding/initializers.rb +0 -2
  62. data/test/onboarding/theme/config.ru +0 -0
  63. data/test/task.rb +32 -24
  64. data/test/theme/initializers.rb +17 -12
  65. data/test/{secrets.yml → theme/theme/secrets.yml} +2 -0
  66. metadata +14 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71fe436833035976d884e26021bfa8b131ca568f
4
- data.tar.gz: 9eea7a3373992ab294b4756fe1c42921874ecdf2
3
+ metadata.gz: 0f86c23ff46a5a0ca670049fc4ef6d0e18715df3
4
+ data.tar.gz: 8324aeb7ec6567a5ae359e7f3f436238997d819e
5
5
  SHA512:
6
- metadata.gz: b4ba6980d252fba844d659ad2b0852376a64de90f62c25d58c94332ffd8769e08b0e1d29d2c81326f22015b81765d26b30a25a3ba08b1a69e40efa706aa1ebe5
7
- data.tar.gz: f996b820cbcd19596240b85a762321c8aa1d4939d034b9dc4868197813f22182912a340f748f2296eaefe28965011e49f5b94b006c75b49e964c7c2cc0e9b699
6
+ metadata.gz: 6aafa4fb63b437092c4d95218e86328575bdfcaae15f017a02df5c1bbcd96315c1d93df0bea01769b1eda1dd78d60dcb8982fee1a3bc12d7dc496a70b1294ff6
7
+ data.tar.gz: 020e45b5558dbae6b12f6c81554b545de660bc20c4a5131fc2b37959eab9b5d070188e00b6d8d5633f6496f632b481c87d959aacd18c379363bc0edf6cbc89b5
data/.gitignore CHANGED
@@ -22,3 +22,6 @@ Gemfile.lock
22
22
  lib/**/secrets.yml
23
23
 
24
24
  /lib/ecrire/template/secrets.yml
25
+ .byebug_history
26
+ *.gem
27
+ .ruby-version
data/Gemfile CHANGED
@@ -4,7 +4,8 @@ gemspec
4
4
 
5
5
  gem 'rails'
6
6
  gem 'observejs', git: 'https://github.com/pothibo/observejs.git'
7
- gem 'written'
7
+ gem 'written', git: 'https://github.com/pothibo/written.git'
8
+ gem 'autoprefixer-rails'
8
9
  gem 'warden'
9
10
  gem 'bcrypt'
10
11
  gem 'nokogiri'
data/Rakefile CHANGED
@@ -3,63 +3,18 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
  ENV['RAILS_ENV'] ||= 'test'
4
4
 
5
5
  require 'ecrire'
6
- require_relative 'test/configuration'
7
6
  require_relative 'test/task'
8
7
 
9
8
  task default: :test
10
9
 
11
- namespace :database do
12
- secrets = YAML.load_file(File.expand_path('../test/secrets.yml', __FILE__))
13
- info = secrets[ENV['RAILS_ENV']]
14
- postgresql = Ecrire::Test::Configuration::Postgresql.new(info['database'], info['username'])
15
-
16
- task :initialize do
17
- begin
18
- unless postgresql.configured?
19
- puts "It seems you are running the development tests for the first time."
20
- puts "Ecrire will try to configure postgresql for you..."
21
-
22
- data = YAML.load_file(File.expand_path('../test/secrets.yml', __FILE__))
23
-
24
- if postgresql.user.new?
25
- postgresql.create_user!
26
- end
27
-
28
- if !postgresql.user.superuser?
29
- postgresql.user.superuser!
30
- end
31
-
32
- if !postgresql.user.login?
33
- postgresql.user.login!
34
- end
35
-
36
- puts "Done configuring postgresql."
37
- end
38
-
39
- postgresql.reset_database!
40
- rescue Ecrire::Test::Configuration::Error => e
41
- puts "Ecrire couldn't configure postgresql."
42
- puts "=> #{e.message}"
43
- puts "To fix this issue, make sure you have a superuser for #{%x(whoami)}"
44
- puts "createuser -l -s postgres"
45
- exit
46
- end
47
- end
48
-
49
- end
50
-
51
10
  namespace :test do
52
11
  ['editor', 'onboarding', 'theme'].each do |name|
53
12
  Ecrire::Test::Task.new(name) do |t|
54
- t.before do
55
- Rake::Task['database:initialize'].invoke
56
- end
57
13
  t.libs << "test"
58
14
  t.test_files = FileList["test/#{name}/**/*_test.rb"]
59
15
  t.verbose = true
60
16
  end
61
17
  end
62
-
63
18
  end
64
19
 
65
20
  task :test do
@@ -74,6 +29,7 @@ namespace :template do
74
29
  task :server do
75
30
  require 'ecrire/commands/server'
76
31
  Dir.chdir 'lib/ecrire/theme/template'
32
+ ENV[Ecrire::SECRET_ENVIRONMENT_KEY] = {onboarding: false}.to_json
77
33
  Rails.env = ENV['RAILS_ENV'] = 'development'
78
34
  Ecrire::Commands::Server.new(Port: 3000).run!
79
35
  end
data/lib/ecrire.rb CHANGED
@@ -1,6 +1,18 @@
1
1
  module Ecrire
2
+ SECRET_ENVIRONMENT_KEY = 'ECRIRE_SECRETS'.freeze
2
3
 
3
4
  autoload :Application, 'ecrire/application'
5
+ autoload :Configuration, 'ecrire/configuration'
6
+
7
+ module Theme
8
+ def self.path=(pathname)
9
+ @@path = pathname
10
+ end
11
+
12
+ def self.path
13
+ @@path ||= Pathname.new(Dir.pwd)
14
+ end
15
+ end
4
16
 
5
17
  ##
6
18
  # Returns true if Ecrire could find
@@ -1,11 +1,5 @@
1
1
  ObserveJS.bind 'Editor.Content', class
2
2
  loaded: =>
3
- Written.Parsers.get('pre').highlightWith (element) ->
4
- Prism.highlightElement(element, false)
5
-
6
- Written.Parsers.get('code').highlightWith (element) ->
7
- Prism.highlightElement(element, false)
8
-
9
3
  if @element().dataset.bucket?
10
4
  window.AWS = {
11
5
  bucket: @element().dataset.bucket,
@@ -15,4 +9,10 @@ ObserveJS.bind 'Editor.Content', class
15
9
  }
16
10
 
17
11
  @written = new Written(this.element())
18
- @written.initialize()
12
+
13
+ @written.parsers.get('pre')?.highlightWith (element) ->
14
+ Prism.highlightElement(element, false)
15
+
16
+ @written.parsers.get('code')?.highlightWith (element) ->
17
+ Prism.highlightElement(element, false)
18
+
@@ -63,7 +63,7 @@ ObserveJS.bind 'Post.Header', class
63
63
  @hide(@template('div.status.uploading'))
64
64
  @show(@template('div.error.status'))
65
65
  ul = @template('div.error.status').querySelector('ul')
66
- @on 'click', @template('div.error.status').querySelector('button'), @clear
66
+ @on 'click', @element().querySelector('div.error.status button'), @clear
67
67
  for error in errors
68
68
  ul.insertAdjacentHTML('beforeend', "<li>#{error}</li>")
69
69
 
@@ -1,3 +1,5 @@
1
+ @import 'navigation/**/*';
2
+
1
3
  * {
2
4
  box-sizing: border-box;
3
5
  -moz-box-sizing: border-box;
@@ -14,7 +16,6 @@ html {
14
16
  }
15
17
 
16
18
  body {
17
- @include background(linear-gradient(darken($bright-blue, 5%), $bright-blue));
18
19
 
19
20
  margin: 0;
20
21
  padding: 0;
@@ -123,17 +124,25 @@ main {
123
124
 
124
125
  position: relative;
125
126
  z-index: 1;
127
+ padding-top: 52px;
126
128
 
127
129
  top: 0;
128
130
  left:0;
129
131
  right:0;
130
132
  bottom:0;
133
+
134
+ &[data-style='split'] {
135
+ flex-direction: row;
136
+ }
137
+
138
+ &:not([data-style='split']) {
139
+ flex-direction: column;
140
+ }
131
141
  }
132
142
 
133
143
  main > section {
134
- @include flex(0 1 60vw);
144
+ flex: 1 auto;
135
145
  background: white;
136
- margin: 0 auto 0 0;
137
146
  }
138
147
 
139
148
  .hidden {
@@ -1,34 +1,3 @@
1
- #AdminNavigation {
2
- @include display(flex);
3
- @include flex-direction(column);
4
- @include flex(1 0 180px);
5
- max-width: 200px;
6
- margin-left: auto;
7
- color: $light-blue;
8
- border-left: 1px solid rgba(0,0,0,0.1);
9
- }
10
-
11
- #AdminNavigation > a.home {
12
- @include display(flex);
13
- @include align-items(center);
14
- @include justify-content(center);
15
-
16
- padding: 12px 8px;
17
-
18
- &:hover > svg {
19
- fill: lighten($light-blue, 45%);
20
- }
21
-
22
- & > svg {
23
- @include transition(fill 0.2s ease-in);
24
- width: 14px;
25
- height: 14px;
26
- margin-right: 12px;
27
-
28
- fill: $light-blue;
29
- }
30
- }
31
-
32
1
  #AdminNavigation > div.current.user {
33
2
  position: relative;
34
3
  margin: 1vh 5% 0 5%;
@@ -0,0 +1,30 @@
1
+ #AdminNavigation {
2
+ z-index: 100;
3
+ display: flex;
4
+ align-items: center;
5
+ justify-content: space-between;
6
+
7
+ position: fixed;
8
+ top: 0;
9
+ left: 0;
10
+ right: 0;
11
+ height: 52px;
12
+
13
+ padding: 0 12px;
14
+
15
+ background: $bright-blue;
16
+ border-bottom: 1px solid darken($bright-blue, 15%);
17
+ }
18
+
19
+ #AdminNavigation a:not(.home):not(.profile) {
20
+ font-weight: bold;
21
+ }
22
+
23
+ #AdminNavigation > div {
24
+ display: flex;
25
+ align-items: center;
26
+ margin: 0 auto;
27
+ justify-content: space-around;
28
+
29
+ flex: 0 30%;
30
+ }
@@ -0,0 +1,22 @@
1
+ #AdminNavigation > a.home {
2
+ @include display(flex);
3
+ @include align-items(center);
4
+ @include justify-content(center);
5
+
6
+ padding: 12px 0;
7
+
8
+ &:hover > svg {
9
+ fill: lighten($light-blue, 45%);
10
+ }
11
+
12
+ & > svg {
13
+ @include transition(fill 0.2s ease-in);
14
+ width: 14px;
15
+ height: 14px;
16
+ margin-right: 12px;
17
+
18
+ fill: $light-blue;
19
+ }
20
+ }
21
+
22
+
@@ -16,56 +16,6 @@
16
16
  margin-top: 214px;
17
17
  }
18
18
 
19
- #PostsIndexList ul.posts {
20
- @include flex(1);
21
- @include display(flex);
22
- @include flex-direction(column);
23
- width: 100%;
24
- }
25
-
26
-
27
- #PostsIndexList > ul.posts li {
28
- @include display(flex);
29
- @include flex-direction(column);
30
- @include justify-content(center);
31
- border-bottom: 1px solid rgba($gray-blue, 0.2);
32
- padding: 1% 2%; min-height: 80px;
33
- }
34
-
35
- #PostsIndexList > ul.posts li:nth-child(even) {
36
- background: lighten($gray-blue, 40%);
37
- }
38
-
39
- #PostsIndexList > ul.posts li > a {
40
- font-size: 2em;
41
- margin: 8px 0;
42
- }
43
-
44
- #PostsIndexList > ul.posts li > div.info {
45
- @include display(flex);
46
- @include align-items(center);
47
-
48
- & > span.tags {
49
- @include flex(1);
50
-
51
- white-space: nowrap;
52
- text-overflow: ellipsis;
53
- overflow: hidden;
54
- margin: 0;
55
- }
56
-
57
- & > span.status {
58
- @include flex(0 auto);
59
- margin-left: auto;
60
- }
61
- }
62
-
63
- #PostsIndexList > ul.posts li > span.tags svg {
64
- width: 14px;
65
- height: 14px;
66
- fill: $gray-blue;
67
- }
68
-
69
19
  body.posts section.new.post {
70
20
  @include display(flex);
71
21
  }
@@ -0,0 +1,36 @@
1
+ body.posts main > aside {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: 10vw;
5
+ min-width: 200px;
6
+ max-width: 400px;
7
+ padding: 5vh 12px;
8
+ border-right: 1px solid $light-gray;
9
+ margin-left: auto;
10
+ }
11
+
12
+ body.posts main aside > a.new {
13
+ background-color: $bright-blue;
14
+ text-align: center;
15
+ font-weight: bold;
16
+ margin-bottom: 24px;
17
+
18
+ &:hover {
19
+ background-color: $bright-blue
20
+ }
21
+ }
22
+
23
+ body.posts main aside > ol {
24
+ display: flex;
25
+ flex-direction: column;
26
+ margin: 4px 12px;
27
+ }
28
+
29
+ body.posts main aside ol > li {
30
+ margin: 4px;
31
+ padding: 0;
32
+ }
33
+
34
+ body.posts main aside ol li > a.selected {
35
+ font-weight: bold;
36
+ }
@@ -0,0 +1,4 @@
1
+ body.edit.posts main > section {
2
+ width: 80vw;
3
+ padding-bottom: 10rem;
4
+ }
@@ -7,7 +7,7 @@
7
7
  @include transition(background-color 0.3s ease);
8
8
 
9
9
  position: fixed;
10
- top: 0;
10
+ top: 52px;
11
11
  left: 0;
12
12
  right: 0;
13
13
  width: 100%;
@@ -25,6 +25,7 @@
25
25
  }
26
26
 
27
27
  [as='Post.Header'] > nav.actions {
28
+ top: 0;
28
29
  font-weight: bold;
29
30
  }
30
31
 
@@ -0,0 +1,61 @@
1
+ body.posts main.list > section {
2
+ min-width: 400px;
3
+ max-width: 700px;
4
+ width: 90%;
5
+ margin: 0 auto 0 0;
6
+ }
7
+
8
+ body.posts main.list section > h2 {
9
+ font-size: 1.2em;
10
+ text-align: center;
11
+ margin: 2em 0;
12
+ color: $gray-blue;
13
+ }
14
+
15
+ body.posts main.list section > ul.posts {
16
+ @include flex(1);
17
+ @include display(flex);
18
+ @include flex-direction(column);
19
+ width: 90%;
20
+ margin: 0 auto;
21
+ }
22
+
23
+
24
+ body.posts main.list section ul.posts > li {
25
+ @include display(flex);
26
+ @include flex-direction(column);
27
+ @include justify-content(center);
28
+ border-bottom: 1px solid rgba($gray-blue, 0.2);
29
+ min-height: 80px;
30
+ }
31
+
32
+ #PostsIndexList > ul.posts li > a {
33
+ font-size: 2em;
34
+ margin: 8px 0;
35
+ }
36
+
37
+ #PostsIndexList > ul.posts li > div.info {
38
+ @include display(flex);
39
+ @include align-items(center);
40
+
41
+ & > span.tags {
42
+ @include flex(1);
43
+
44
+ white-space: nowrap;
45
+ text-overflow: ellipsis;
46
+ overflow: hidden;
47
+ margin: 0;
48
+ }
49
+
50
+ & > span.status {
51
+ @include flex(0 auto);
52
+ margin-left: auto;
53
+ }
54
+ }
55
+
56
+ #PostsIndexList > ul.posts li > span.tags svg {
57
+ width: 14px;
58
+ height: 14px;
59
+ fill: $gray-blue;
60
+ }
61
+