ecrire 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/LICENCE +9 -0
- data/README.md +62 -0
- data/Rakefile +72 -0
- data/bin/ecrire +42 -0
- data/ecrire.gemspec +26 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/content.coffee +319 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/ext.coffee +94 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/extensions/clipboard.coffee +98 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/extensions/image.coffee +19 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/delete.js.coffee +11 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/draft.js.coffee +42 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/help.js.coffee +6 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/save.js.coffee +61 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/sticky.js.coffee +11 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/navigation/toggle.js.coffee +10 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/code.coffee +39 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/heading.coffee +19 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/image.coffee +129 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/link.coffee +44 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/lists.coffee +48 -0
- data/lib/ecrire/app/assets/javascripts/admin/editor/parsers/word.coffee +56 -0
- data/lib/ecrire/app/assets/javascripts/admin/posts/header.coffee +69 -0
- data/lib/ecrire/app/assets/javascripts/admin/posts/new.js.coffee +7 -0
- data/lib/ecrire/app/assets/javascripts/admin/posts/title.coffee +15 -0
- data/lib/ecrire/app/assets/javascripts/admin.js +5 -0
- data/lib/ecrire/app/assets/javascripts/application.js +21 -0
- data/lib/ecrire/app/assets/javascripts/shared/overlay.js.coffee +29 -0
- data/lib/ecrire/app/assets/javascripts/shared/popup.js.coffee +7 -0
- data/lib/ecrire/app/assets/javascripts/vendor/moment.js +3043 -0
- data/lib/ecrire/app/assets/javascripts/vendor/prism/prism.ruby.js +25 -0
- data/lib/ecrire/app/assets/javascripts/vendor/prism.js +578 -0
- data/lib/ecrire/app/assets/stylesheets/admin/base.css.scss +98 -0
- data/lib/ecrire/app/assets/stylesheets/admin/documentation.css.scss +28 -0
- data/lib/ecrire/app/assets/stylesheets/admin/editor/base.css.scss +41 -0
- data/lib/ecrire/app/assets/stylesheets/admin/editor/content.css.scss +57 -0
- data/lib/ecrire/app/assets/stylesheets/admin/editor/header.css.scss +62 -0
- data/lib/ecrire/app/assets/stylesheets/admin/editor/image.css.scss +58 -0
- data/lib/ecrire/app/assets/stylesheets/admin/editor/publish.css.scss +40 -0
- data/lib/ecrire/app/assets/stylesheets/admin/editor/save.css.scss +44 -0
- data/lib/ecrire/app/assets/stylesheets/admin/images.css.scss +64 -0
- data/lib/ecrire/app/assets/stylesheets/admin/loading.css.scss +48 -0
- data/lib/ecrire/app/assets/stylesheets/admin/mixins/animations.css.scss +30 -0
- data/lib/ecrire/app/assets/stylesheets/admin/mixins/form.css.scss +22 -0
- data/lib/ecrire/app/assets/stylesheets/admin/navigation.css.scss +96 -0
- data/lib/ecrire/app/assets/stylesheets/admin/posts.css.scss +46 -0
- data/lib/ecrire/app/assets/stylesheets/admin/variables.css.scss +7 -0
- data/lib/ecrire/app/assets/stylesheets/admin.css.scss +5 -0
- data/lib/ecrire/app/assets/stylesheets/application.css.scss +12 -0
- data/lib/ecrire/app/assets/stylesheets/sessions.css.scss +97 -0
- data/lib/ecrire/app/assets/stylesheets/shared/main.css.scss +5 -0
- data/lib/ecrire/app/assets/stylesheets/shared/popup.css.scss +76 -0
- data/lib/ecrire/app/assets/stylesheets/vendor/prism/ruby.scss +11 -0
- data/lib/ecrire/app/assets/stylesheets/vendor/prism.scss +149 -0
- data/lib/ecrire/app/controllers/admin/application_controller.rb +16 -0
- data/lib/ecrire/app/controllers/admin/configurations/images_controller.rb +28 -0
- data/lib/ecrire/app/controllers/admin/images_controller.rb +35 -0
- data/lib/ecrire/app/controllers/admin/labels_controller.rb +18 -0
- data/lib/ecrire/app/controllers/admin/partials_controller.rb +43 -0
- data/lib/ecrire/app/controllers/admin/posts_controller.rb +90 -0
- data/lib/ecrire/app/controllers/admin/properties_controller.rb +35 -0
- data/lib/ecrire/app/controllers/application_controller.rb +29 -0
- data/lib/ecrire/app/controllers/concerns/.keep +0 -0
- data/lib/ecrire/app/controllers/ecrire/posts_controller.rb +42 -0
- data/lib/ecrire/app/controllers/images_controller.rb +2 -0
- data/lib/ecrire/app/controllers/onboarding/databases_controller.rb +67 -0
- data/lib/ecrire/app/controllers/onboarding/users_controller.rb +32 -0
- data/lib/ecrire/app/controllers/onboarding_controller.rb +20 -0
- data/lib/ecrire/app/controllers/partials_controller.rb +8 -0
- data/lib/ecrire/app/controllers/sessions_controller.rb +23 -0
- data/lib/ecrire/app/controllers/static_controller.rb +5 -0
- data/lib/ecrire/app/forms/admin/image_builder.rb +24 -0
- data/lib/ecrire/app/forms/admin/partial_builder.rb +105 -0
- data/lib/ecrire/app/forms/admin/post_builder.rb +47 -0
- data/lib/ecrire/app/helpers/admin/images_helper.rb +60 -0
- data/lib/ecrire/app/helpers/admin/labels_helper.rb +26 -0
- data/lib/ecrire/app/helpers/admin/posts_helper.rb +26 -0
- data/lib/ecrire/app/helpers/application_helper.rb +64 -0
- data/lib/ecrire/app/helpers/content_tag_helper.rb +91 -0
- data/lib/ecrire/app/helpers/open_graph_helper.rb +45 -0
- data/lib/ecrire/app/helpers/posts_helper.rb +19 -0
- data/lib/ecrire/app/models/admin/image.rb +108 -0
- data/lib/ecrire/app/models/admin/partial.rb +4 -0
- data/lib/ecrire/app/models/admin/post.rb +56 -0
- data/lib/ecrire/app/models/concerns/.keep +0 -0
- data/lib/ecrire/app/models/image.rb +5 -0
- data/lib/ecrire/app/models/label.rb +3 -0
- data/lib/ecrire/app/models/partial.rb +3 -0
- data/lib/ecrire/app/models/post.rb +90 -0
- data/lib/ecrire/app/models/property/image.rb +30 -0
- data/lib/ecrire/app/models/property/label.rb +28 -0
- data/lib/ecrire/app/models/user.rb +31 -0
- data/lib/ecrire/app/strategies/password_strategy.rb +17 -0
- data/lib/ecrire/app/views/admin/configurations/images/complete.html.erb +6 -0
- data/lib/ecrire/app/views/admin/configurations/images/show.html.erb +14 -0
- data/lib/ecrire/app/views/admin/images/_errors.html.erb +14 -0
- data/lib/ecrire/app/views/admin/images/_form.html.erb +15 -0
- data/lib/ecrire/app/views/admin/images/destroy.js.erb +0 -0
- data/lib/ecrire/app/views/admin/images/errors.js.erb +1 -0
- data/lib/ecrire/app/views/admin/images/update.js.erb +1 -0
- data/lib/ecrire/app/views/admin/posts/_documentation.html.erb +61 -0
- data/lib/ecrire/app/views/admin/posts/_list.html.erb +18 -0
- data/lib/ecrire/app/views/admin/posts/_post.html.erb +3 -0
- data/lib/ecrire/app/views/admin/posts/edit.html.erb +73 -0
- data/lib/ecrire/app/views/admin/posts/help.js.erb +1 -0
- data/lib/ecrire/app/views/admin/posts/index.js.erb +1 -0
- data/lib/ecrire/app/views/admin/posts/title.html.erb +10 -0
- data/lib/ecrire/app/views/admin/posts/update/content.js.erb +1 -0
- data/lib/ecrire/app/views/admin/posts/update/title.js.erb +1 -0
- data/lib/ecrire/app/views/admin/properties/image/create.js.erb +14 -0
- data/lib/ecrire/app/views/admin/properties/image/destroy.js.erb +6 -0
- data/lib/ecrire/app/views/admin/properties/label/create.js.erb +8 -0
- data/lib/ecrire/app/views/admin/properties/label/destroy.js.erb +2 -0
- data/lib/ecrire/app/views/layouts/admin/application.html.erb +47 -0
- data/lib/ecrire/app/views/partials/show.html.erb +14 -0
- data/lib/ecrire/app/views/sessions/_form.html.erb +18 -0
- data/lib/ecrire/app/views/sessions/_navigation.html.erb +24 -0
- data/lib/ecrire/app/views/sessions/new.html.erb +1 -0
- data/lib/ecrire/application.rb +18 -0
- data/lib/ecrire/commands/base.rb +9 -0
- data/lib/ecrire/commands/console.rb +21 -0
- data/lib/ecrire/commands/new.rb +47 -0
- data/lib/ecrire/commands/server.rb +27 -0
- data/lib/ecrire/commands.rb +19 -0
- data/lib/ecrire/config/environment/development.rb +12 -0
- data/lib/ecrire/config/environment/production.rb +12 -0
- data/lib/ecrire/config/environment/test.rb +3 -0
- data/lib/ecrire/config/environment.rb +46 -0
- data/lib/ecrire/config/onboarding_routes.rb +11 -0
- data/lib/ecrire/config/routes.rb +32 -0
- data/lib/ecrire/db/migrate/20131111222709_create_posts.rb +16 -0
- data/lib/ecrire/db/migrate/20131113200949_create_users.rb +12 -0
- data/lib/ecrire/db/migrate/20131114205041_add_excerpt_to_post.rb +5 -0
- data/lib/ecrire/db/migrate/20131221181640_add_javascript_to_posts.rb +5 -0
- data/lib/ecrire/db/migrate/20131221195338_create_partials.rb +12 -0
- data/lib/ecrire/db/migrate/20140115215122_create_images.rb +12 -0
- data/lib/ecrire/db/migrate/20140209144412_add_favorite_flag_to_image.rb +5 -0
- data/lib/ecrire/db/migrate/20140617224837_create_labels.rb +12 -0
- data/lib/ecrire/db/migrate/20140618321984_add_properties_to_posts.rb +6 -0
- data/lib/ecrire/db/migrate/20150113839713_convert_markdown_in_post_content.rb +6 -0
- data/lib/ecrire/db/migrate/20150120093481_add_preview_to_posts.rb +8 -0
- data/lib/ecrire/db/schema.rb +76 -0
- data/lib/ecrire/locales/admin/configurations/images/en.yml +3 -0
- data/lib/ecrire/locales/admin/en.yml +26 -0
- data/lib/ecrire/locales/admin/images/en.yml +5 -0
- data/lib/ecrire/locales/admin/partials/en.yml +18 -0
- data/lib/ecrire/locales/admin/posts/en.yml +14 -0
- data/lib/ecrire/locales/en.yml +9 -0
- data/lib/ecrire/onboarding/assets/images/.keep +0 -0
- data/lib/ecrire/onboarding/assets/images/background.png +0 -0
- data/lib/ecrire/onboarding/assets/images/github-logo.png +0 -0
- data/lib/ecrire/onboarding/assets/images/profile.png +0 -0
- data/lib/ecrire/onboarding/assets/images/twitter-logo.png +0 -0
- data/lib/ecrire/onboarding/assets/javascripts/base.js +2 -0
- data/lib/ecrire/onboarding/assets/javascripts/databases/information.js.coffee +17 -0
- data/lib/ecrire/onboarding/assets/javascripts/message.js.coffee +5 -0
- data/lib/ecrire/onboarding/assets/stylesheets/base.css.scss +80 -0
- data/lib/ecrire/onboarding/assets/stylesheets/complete.css.scss +3 -0
- data/lib/ecrire/onboarding/assets/stylesheets/fonts.css.scss +17 -0
- data/lib/ecrire/onboarding/assets/stylesheets/form.css.scss +25 -0
- data/lib/ecrire/onboarding/assets/stylesheets/message.css.scss +11 -0
- data/lib/ecrire/onboarding/assets/stylesheets/terminal.css.scss +16 -0
- data/lib/ecrire/onboarding/assets/stylesheets/variables.css.scss +3 -0
- data/lib/ecrire/onboarding/assets/stylesheets/welcome.css.scss +62 -0
- data/lib/ecrire/onboarding/views/layouts/application.html.erb +16 -0
- data/lib/ecrire/onboarding/views/onboarding/complete.html.erb +6 -0
- data/lib/ecrire/onboarding/views/onboarding/databases/index.html.erb +34 -0
- data/lib/ecrire/onboarding/views/onboarding/users/index.html.erb +16 -0
- data/lib/ecrire/onboarding/views/onboarding/welcome.html.erb +12 -0
- data/lib/ecrire/railtie/onboarding.rb +63 -0
- data/lib/ecrire/railtie/theme.rb +69 -0
- data/lib/ecrire/railtie.rb +30 -0
- data/lib/ecrire/tasks/assets.rake +15 -0
- data/lib/ecrire/tasks/routes.rake +6 -0
- data/lib/ecrire/template/Gemfile +31 -0
- data/lib/ecrire/template/Rakefile +4 -0
- data/lib/ecrire/template/assets/images/.keep +0 -0
- data/lib/ecrire/template/assets/javascripts/base.js.coffee +0 -0
- data/lib/ecrire/template/assets/javascripts/post.js.coffee +0 -0
- data/lib/ecrire/template/assets/stylesheets/base.css.scss +86 -0
- data/lib/ecrire/template/assets/stylesheets/code.css.scss +24 -0
- data/lib/ecrire/template/assets/stylesheets/footer.css.scss +5 -0
- data/lib/ecrire/template/assets/stylesheets/header.css.scss +18 -0
- data/lib/ecrire/template/assets/stylesheets/home.css.scss +35 -0
- data/lib/ecrire/template/config.ru +4 -0
- data/lib/ecrire/template/controllers/posts_controller.rb +2 -0
- data/lib/ecrire/template/helpers/blog_helper.rb +2 -0
- data/lib/ecrire/template/views/layouts/application.html.erb +35 -0
- data/lib/ecrire/template/views/posts/_post.html.erb +9 -0
- data/lib/ecrire/template/views/posts/index.html.erb +13 -0
- data/lib/ecrire/template/views/posts/show.html.erb +7 -0
- data/lib/ecrire/template/views/static/about.html +0 -0
- data/lib/ecrire/template/views/static/customize/_helper.html +7 -0
- data/lib/ecrire/template/views/static/customize/_helper_used.html +6 -0
- data/lib/ecrire/template/views/static/customize/_image.html +1 -0
- data/lib/ecrire/template/views/static/customize/_index.html +1 -0
- data/lib/ecrire/template/views/static/customize/_javascript.html +1 -0
- data/lib/ecrire/template/views/static/customize/_layout.html.erb +15 -0
- data/lib/ecrire/template/views/static/customize/_post.html +3 -0
- data/lib/ecrire/template/views/static/customize.html +95 -0
- data/lib/ecrire/version.rb +3 -0
- data/lib/ecrire.rb +24 -0
- data/test/editor/controllers/admin/images_controller_test.rb +6 -0
- data/test/editor/controllers/admin/posts_controller_test.rb +90 -0
- data/test/editor/controllers/base_controller_test.rb +26 -0
- data/test/editor/controllers/images_controller_test.rb +2 -0
- data/test/editor/controllers/partials_controller_test.rb +2 -0
- data/test/editor/controllers/posts_controller_test.rb +21 -0
- data/test/editor/controllers/sessions_controller_test.rb +21 -0
- data/test/editor/helpers/base_helper_test.rb +19 -0
- data/test/editor/helpers/posts_helper_test.rb +3 -0
- data/test/editor/models/image_test.rb +33 -0
- data/test/editor/models/partial_test.rb +4 -0
- data/test/editor/models/post_test.rb +109 -0
- data/test/editor/models/user_test.rb +4 -0
- data/test/editor/test_helper.rb +28 -0
- data/test/fixtures/images.yml +11 -0
- data/test/fixtures/partials.yml +9 -0
- data/test/fixtures/posts.yml +16 -0
- data/test/fixtures/users.yml +9 -0
- data/test/initializations/railtie_test.rb +49 -0
- data/test/isolation.rb +16 -0
- data/test/themes/template/Gemfile +28 -0
- data/test/themes/template/assets/javascripts/blog.js.coffee +0 -0
- data/test/themes/template/assets/javascripts/post.js.coffee +0 -0
- data/test/themes/template/assets/stylesheets/blog.css.scss +0 -0
- data/test/themes/template/assets/stylesheets/post.css.scss +0 -0
- data/test/themes/template/config.ru +0 -0
- data/test/themes/template/views/layouts/application.html.erb +1 -0
- data/test/themes/template/views/posts/index.html.erb +0 -0
- metadata +275 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Ecrire</title>
|
5
|
+
<link rel="shortcut icon" href="<%= url_for("/favicon.ico")%>" />
|
6
|
+
<%= stylesheet_link_tag "admin", media: "all" %>
|
7
|
+
<%= javascript_include_tag "admin" %>
|
8
|
+
<%= csrf_meta_tags %>
|
9
|
+
</head>
|
10
|
+
<%= body_tag class: %W(#{action_name} #{controller_name}) do %>
|
11
|
+
|
12
|
+
<main>
|
13
|
+
<%= content_tag :nav, id: 'Menu', class: ['admin', controller_name] do %>
|
14
|
+
<section>
|
15
|
+
<div class='back'>
|
16
|
+
<%= link_to 'Home', :root %>
|
17
|
+
</div>
|
18
|
+
<div class='posts'>
|
19
|
+
<h4>
|
20
|
+
<%= link_to 'New post', new_title_admin_posts_path, class: %w(new button) %>
|
21
|
+
</h4>
|
22
|
+
<%= link_to admin_posts_path(type: :draft), class: %w(drafts), remote: true, as: 'Posts.Popup' do %>
|
23
|
+
<span class='type'>Drafts</span>
|
24
|
+
<%= content_tag :span, posts.drafted.count, class: %w(count) %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<%= link_to admin_posts_path(type: :published), class: %w(drafts), remote: true, as: 'Posts.Popup' do %>
|
28
|
+
<span class='type'>Published</span>
|
29
|
+
<%= content_tag :span, posts.published.count, class: %w(count) %>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
</section>
|
33
|
+
|
34
|
+
<%= yield :menu %>
|
35
|
+
|
36
|
+
<%= button_to session_path, method: :delete, class: %w(logout), form_class: %w(form logout) do %>
|
37
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="logout" x="0px" y="0px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
|
38
|
+
<path d="M19,10l-6-5v3H6v4h7v3L19,10z M3,3h8V1H3C1.9,1,1,1.9,1,3v14c0,1.1,0.9,2,2,2h8v-2H3V3z"/>
|
39
|
+
</svg>
|
40
|
+
<% end %>
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
<%= yield %>
|
44
|
+
</main>
|
45
|
+
|
46
|
+
<% end %>
|
47
|
+
</html>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="partial">
|
2
|
+
<style scoped>
|
3
|
+
<%= @partial.stylesheet.html_safe %>
|
4
|
+
</style>
|
5
|
+
|
6
|
+
<script type="text/javascript">
|
7
|
+
<%= @partial.javascript.html_safe %>
|
8
|
+
</script>
|
9
|
+
|
10
|
+
<div class="content">
|
11
|
+
<%= @partial.content.html_safe %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= form_for User.new, url: session_path, as: "session", html: { class: %w(session) } do |f| %>
|
2
|
+
|
3
|
+
<% unless warden.errors.empty? %>
|
4
|
+
<%= content_tag :p, warden.errors.full_messages.to_sentence, class: %w(errors) %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<div class="fieldset">
|
8
|
+
<%= f.text_field :email, placeholder: t("sessions.email") %>
|
9
|
+
<%= f.password_field :password, placeholder: t("sessions.password") %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<%= f.button do %>
|
13
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
|
14
|
+
<path d="M14,10L8,5v3H1v4h7v3L14,10z M17,17H9v2h8c1.1,0,2-0.9,2-2V3c0-1.1-0.9-2-2-2H9v2h8V17z"/>
|
15
|
+
</svg>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<% end %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<nav id="Menu" class="admin">
|
2
|
+
|
3
|
+
<section>
|
4
|
+
<div class='posts'>
|
5
|
+
<%= link_to 'New post', new_title_admin_posts_path, class: %w(new button) %>
|
6
|
+
<%= link_to admin_posts_path(type: :draft), class: %w(drafts), remote: true, as: 'Posts.Popup' do %>
|
7
|
+
<span class='type'>Drafts</span>
|
8
|
+
<%= content_tag :span, Post.drafted.count, class: %w(count) %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= link_to admin_posts_path(type: :published), class: %w(drafts), remote: true, as: 'Posts.Popup' do %>
|
12
|
+
<span class='type'>Published</span>
|
13
|
+
<%= content_tag :span, Post.published.count, class: %w(count) %>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
</section>
|
17
|
+
|
18
|
+
|
19
|
+
<%= button_to session_path, method: :delete, class: %w(logout), form_class: %w(form logout) do %>
|
20
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="logout" x="0px" y="0px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
|
21
|
+
<path d="M19,10l-6-5v3H6v4h7v3L19,10z M3,3h8V1H3C1.9,1,1,1.9,1,3v14c0,1.1,0.9,2,2,2h8v-2H3V3z"/>
|
22
|
+
</svg>
|
23
|
+
<% end %>
|
24
|
+
</nav>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'warden'
|
2
|
+
require 'pg'
|
3
|
+
require 's3'
|
4
|
+
require 'kaminari'
|
5
|
+
require 'jointjs'
|
6
|
+
|
7
|
+
module Ecrire
|
8
|
+
class Application < Rails::Application
|
9
|
+
require 'ecrire/config/environment'
|
10
|
+
require 'ecrire/railtie'
|
11
|
+
|
12
|
+
# Let's not put anything in here. Because Rails instantiate the class as soon as it's defined,
|
13
|
+
# it's impossible to rely on any declaration made here.
|
14
|
+
#
|
15
|
+
# Instead, defined any configuration in config/environment.rb
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'ecrire/commands/base'
|
2
|
+
|
3
|
+
module Ecrire
|
4
|
+
module Commands
|
5
|
+
class Console < ::Ecrire::Commands::Base
|
6
|
+
def initialize(options = {}, *args)
|
7
|
+
end
|
8
|
+
|
9
|
+
def run!
|
10
|
+
require 'ecrire'
|
11
|
+
require 'rails/commands/console'
|
12
|
+
|
13
|
+
shift_argv!
|
14
|
+
Ecrire::Application.require_environment!
|
15
|
+
Ecrire::Application.initialize!
|
16
|
+
|
17
|
+
Rails::Console.start(Ecrire::Application, *ARGV)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'yaml'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
require 'ecrire/commands/base'
|
7
|
+
|
8
|
+
module Ecrire
|
9
|
+
module Commands
|
10
|
+
class New < Ecrire::Commands::Base
|
11
|
+
attr_reader :path
|
12
|
+
def initialize(options = {}, *args)
|
13
|
+
if args[0].nil?
|
14
|
+
puts 'Please specify a blog name.'
|
15
|
+
puts 'Example: ecrire new blog.domain.com'
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
@path = Pathname.new(Dir.pwd)
|
19
|
+
@path += args[0]
|
20
|
+
end
|
21
|
+
|
22
|
+
def run!
|
23
|
+
if Dir.exist?(@path)
|
24
|
+
ask_to_overwrite!
|
25
|
+
FileUtils.rm_rf(@path)
|
26
|
+
end
|
27
|
+
generate!
|
28
|
+
end
|
29
|
+
|
30
|
+
def generate!
|
31
|
+
Dir.mkdir @path
|
32
|
+
Dir.chdir @path
|
33
|
+
template = File.expand_path '../../template/*', __FILE__
|
34
|
+
FileUtils.cp_r(Dir[template], @path)
|
35
|
+
end
|
36
|
+
|
37
|
+
def ask_to_overwrite!
|
38
|
+
puts "You are about to overwrite #{@path} with a new theme."
|
39
|
+
puts "Are you sure? [y/n]"
|
40
|
+
confirm = STDIN.gets.chomp
|
41
|
+
if confirm != 'y'
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'ecrire/commands/base'
|
2
|
+
|
3
|
+
module Ecrire
|
4
|
+
module Commands
|
5
|
+
class Server < Ecrire::Commands::Base
|
6
|
+
|
7
|
+
def initialize(options = {}, *args)
|
8
|
+
|
9
|
+
require 'ecrire'
|
10
|
+
require 'rails/commands/server'
|
11
|
+
|
12
|
+
shift_argv!
|
13
|
+
|
14
|
+
@server = Rails::Server.new
|
15
|
+
@server.options[:Port] = options[:Port]
|
16
|
+
end
|
17
|
+
|
18
|
+
def run!
|
19
|
+
@server.tap do |server|
|
20
|
+
Dir.chdir(Ecrire::Application.root)
|
21
|
+
server.start
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'ecrire/commands/server'
|
2
|
+
require 'ecrire/commands/new'
|
3
|
+
require 'ecrire/commands/console'
|
4
|
+
|
5
|
+
module Ecrire
|
6
|
+
module Commands
|
7
|
+
def self.new
|
8
|
+
Ecrire::Commands::New
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.server
|
12
|
+
Ecrire::Commands::Server
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.console
|
16
|
+
Ecrire::Commands::Console
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Ecrire::Application.configure do
|
2
|
+
config.cache_classes = false
|
3
|
+
config.eager_load = false
|
4
|
+
config.consider_all_requests_local = true
|
5
|
+
config.action_controller.perform_caching = false
|
6
|
+
|
7
|
+
config.active_support.deprecation = :log
|
8
|
+
|
9
|
+
config.active_record.migration_error = :page_load
|
10
|
+
|
11
|
+
config.assets.debug = true
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Ecrire::Application.configure do
|
2
|
+
config.assets.js_compressor = :uglifier
|
3
|
+
config.assets.debug = false
|
4
|
+
config.assets.compile = true
|
5
|
+
config.assets.digest = true
|
6
|
+
config.assets.version = '1.0'
|
7
|
+
|
8
|
+
config.serve_static_files = false
|
9
|
+
|
10
|
+
config.log_level = :info
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
config = self.config
|
3
|
+
config.eager_load = true
|
4
|
+
|
5
|
+
config.paths.path = File.expand_path '../../', __FILE__
|
6
|
+
config.paths.add 'app/strategies', eager_load: true
|
7
|
+
config.paths.add 'app/forms', eager_load: true
|
8
|
+
config.paths.add 'lib/tasks', with: 'tasks', glob: '**/*.rake'
|
9
|
+
|
10
|
+
config.paths.add "config/locales", with: "locales", glob: "**/*.{rb,yml}"
|
11
|
+
|
12
|
+
config.paths.add 'Gemfile', with: 'config/Gemfile'
|
13
|
+
|
14
|
+
config.filter_parameters += [:password, :database]
|
15
|
+
config.session_store :cookie_store, key: '_ecrire_com_session'
|
16
|
+
|
17
|
+
config.assets.precompile = [
|
18
|
+
lambda do |filename, path|
|
19
|
+
path =~ /assets/ && !%w(.js .css).include?(File.extname(filename))
|
20
|
+
end,
|
21
|
+
/^(admin|application|base)\.(css|js)$/
|
22
|
+
]
|
23
|
+
|
24
|
+
Warden::Manager.serialize_into_session do |user|
|
25
|
+
user.id
|
26
|
+
end
|
27
|
+
|
28
|
+
Warden::Manager.serialize_from_session do |id|
|
29
|
+
User.find_by_id(id)
|
30
|
+
end
|
31
|
+
|
32
|
+
config.to_prepare do
|
33
|
+
Warden::Strategies.add :password, PasswordStrategy
|
34
|
+
end
|
35
|
+
|
36
|
+
config.middleware.use Warden::Manager do |manager|
|
37
|
+
manager.default_strategies :password
|
38
|
+
manager.failure_app = SessionsController.action(:failed)
|
39
|
+
end
|
40
|
+
|
41
|
+
ActiveSupport.on_load(:action_controller) do
|
42
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
43
|
+
end
|
44
|
+
|
45
|
+
require "ecrire/config/environment/#{Rails.env}"
|
46
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Ecrire::Application.routes.draw do
|
2
|
+
root 'posts#index'
|
3
|
+
|
4
|
+
get '/:year/:month/:id', controller: :posts, action: :show, constraints: { year: /\d+/, month: /\d+/ }, as: "post"
|
5
|
+
get '/feed', controller: :posts, action: :index, defaults: { format: :rss }
|
6
|
+
|
7
|
+
resources :posts, only: [:index]
|
8
|
+
|
9
|
+
resource :session, only: [:new, :create, :destroy]
|
10
|
+
|
11
|
+
resources :partials, only: [:show]
|
12
|
+
|
13
|
+
namespace :admin do
|
14
|
+
root 'posts#index'
|
15
|
+
resources :posts do
|
16
|
+
collection do
|
17
|
+
get 'new/title', controller: :posts, action: :new
|
18
|
+
get 'help', controller: :posts, action: :help
|
19
|
+
end
|
20
|
+
resource :image, shallow: true
|
21
|
+
resource :properties, only: [:create, :destroy]
|
22
|
+
end
|
23
|
+
|
24
|
+
namespace :configurations do
|
25
|
+
resource :images, only: [:show, :create]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
get '/:view', to: 'static#show'
|
30
|
+
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreatePosts < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :posts do |t|
|
4
|
+
|
5
|
+
t.string :title, null: false
|
6
|
+
t.string :slug, null: false
|
7
|
+
t.text :content
|
8
|
+
t.text :stylesheet
|
9
|
+
|
10
|
+
t.datetime :published_at
|
11
|
+
t.timestamps
|
12
|
+
|
13
|
+
end
|
14
|
+
add_index :posts, :title, unique: true
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20150120093481) do
|
15
|
+
|
16
|
+
# These are extensions that must be enabled in order to support this database
|
17
|
+
enable_extension "plpgsql"
|
18
|
+
enable_extension "hstore"
|
19
|
+
|
20
|
+
create_table "abtests", force: :cascade do |t|
|
21
|
+
t.datetime "created_at"
|
22
|
+
t.datetime "updated_at"
|
23
|
+
end
|
24
|
+
|
25
|
+
create_table "images", force: :cascade do |t|
|
26
|
+
t.string "url", limit: 255
|
27
|
+
t.string "key", limit: 255
|
28
|
+
t.integer "post_id"
|
29
|
+
t.datetime "created_at"
|
30
|
+
t.datetime "updated_at"
|
31
|
+
t.boolean "favorite"
|
32
|
+
end
|
33
|
+
|
34
|
+
create_table "labels", force: :cascade do |t|
|
35
|
+
t.string "name", limit: 255, null: false
|
36
|
+
t.datetime "created_at"
|
37
|
+
t.datetime "updated_at"
|
38
|
+
end
|
39
|
+
|
40
|
+
add_index "labels", ["name"], name: "index_labels_on_name", using: :btree
|
41
|
+
|
42
|
+
create_table "partials", force: :cascade do |t|
|
43
|
+
t.datetime "created_at"
|
44
|
+
t.datetime "updated_at"
|
45
|
+
t.string "title", limit: 255, null: false
|
46
|
+
t.text "content"
|
47
|
+
t.text "stylesheet"
|
48
|
+
t.text "javascript"
|
49
|
+
end
|
50
|
+
|
51
|
+
create_table "posts", force: :cascade do |t|
|
52
|
+
t.string "title", limit: 255, null: false
|
53
|
+
t.string "slug", limit: 255, null: false
|
54
|
+
t.text "content"
|
55
|
+
t.text "stylesheet"
|
56
|
+
t.datetime "published_at"
|
57
|
+
t.datetime "created_at"
|
58
|
+
t.datetime "updated_at"
|
59
|
+
t.text "javascript"
|
60
|
+
t.hstore "properties"
|
61
|
+
t.text "compiled_content"
|
62
|
+
t.text "compiled_excerpt"
|
63
|
+
end
|
64
|
+
|
65
|
+
add_index "posts", ["title"], name: "index_posts_on_title", unique: true, using: :btree
|
66
|
+
|
67
|
+
create_table "users", force: :cascade do |t|
|
68
|
+
t.string "email", limit: 255, null: false
|
69
|
+
t.string "encrypted_password", limit: 255, null: false
|
70
|
+
t.datetime "created_at"
|
71
|
+
t.datetime "updated_at"
|
72
|
+
end
|
73
|
+
|
74
|
+
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
en:
|
2
|
+
admin:
|
3
|
+
navigation:
|
4
|
+
posts: "Posts"
|
5
|
+
partials: "Partials"
|
6
|
+
logout: ""
|
7
|
+
|
8
|
+
form:
|
9
|
+
image:
|
10
|
+
drop_pad: "Drop your image here."
|
11
|
+
post:
|
12
|
+
title: "Your title here"
|
13
|
+
content: "Write"
|
14
|
+
stylesheet: "Style"
|
15
|
+
javascript: "Script"
|
16
|
+
slug: "Create your own slug. It will be build with the title otherwise."
|
17
|
+
options:
|
18
|
+
fields:
|
19
|
+
text: 'Write'
|
20
|
+
CSS: 'Stylesheet'
|
21
|
+
JS: 'Javascript'
|
22
|
+
preview: "Preview"
|
23
|
+
partials: "Partials"
|
24
|
+
images:
|
25
|
+
link: "Images"
|
26
|
+
post_not_persisted: "Images unavailable. Save your post first."
|
@@ -0,0 +1,18 @@
|
|
1
|
+
en:
|
2
|
+
admin:
|
3
|
+
partials:
|
4
|
+
|
5
|
+
index:
|
6
|
+
new_idea: "Build small HTML snippet you can reuse in your blog posts. It can be anything: Mailing list form, Christmas HTML snippet, etc."
|
7
|
+
start_writing: "Create a partial."
|
8
|
+
|
9
|
+
form:
|
10
|
+
title: "Partial's title"
|
11
|
+
content: "Write your HTML"
|
12
|
+
stylesheet: "Write your CSS"
|
13
|
+
javascript: "Write your JavaScript"
|
14
|
+
options:
|
15
|
+
fields:
|
16
|
+
text: 'Write'
|
17
|
+
CSS: 'Stylesheet'
|
18
|
+
JS: 'Javascript'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
en:
|
2
|
+
admin:
|
3
|
+
posts:
|
4
|
+
new:
|
5
|
+
title: "Title for your new post"
|
6
|
+
editable: "Don't worry, you will be able to change the title afterwards."
|
7
|
+
index:
|
8
|
+
new_idea: "Every great post starts small."
|
9
|
+
start_writing: "Start writing."
|
10
|
+
update:
|
11
|
+
successful: "Saved"
|
12
|
+
permalink:
|
13
|
+
editable: "The permalink will change if you change the title of your post"
|
14
|
+
permanent: "Your post is published. For accessibility reasons, the permalink won't change if you change your title"
|
File without changes
|