documentation-editor 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e6bd0a7e0fd131c4cc89835f651bd4fd6394a72
4
- data.tar.gz: af014098a71b07a5782d2d8cbc6861b0fac2a250
3
+ metadata.gz: dbb5969b82e47ef0d7a854fb6f5b1885525c89ac
4
+ data.tar.gz: b3d341801cbce4302874858a865e2a0d8271b0cc
5
5
  SHA512:
6
- metadata.gz: cd2f4e684959b41a21be1794a0ddf60669e60dd7bc6e3ce7aa86719eccb605ddaffabeed0c5080d528ad9d9a89c4cc26c81dad28d92ff27485f3347d3ba20a70
7
- data.tar.gz: 7dbff47da968167994ec8eee56b2b3701b441e2d11269d66cbe3eaaedd38668247707ab86a9b25c9a39e4bd068eca904921adf5ab951f13a059bdbbc4f6e0aa9
6
+ metadata.gz: 535949a0f92af8f2ea32836807a93e9e47d231dc6fdb067e8462fbe094209aab0515830f3ffb3b0973ddefcbd0c6ec261b1dddb39c25a5d6fd8b1c829d8d7fbf
7
+ data.tar.gz: 46ea675dbf81e60efba33e724f7bc3dcc31621699bc27d8702168f7762bc52b8092c03fe893231b65c80fbcd620e07e19eda7067491c9926e6c3fef261a129c6
@@ -1,3 +1,9 @@
1
+ //= require best_in_place
2
+
3
+ $(document).ready(function() {
4
+ $(".best_in_place").best_in_place();
5
+ });
6
+
1
7
  angular.module('documentationEditorApp', ['ngFileUpload'])
2
8
  .config(['$locationProvider', function($locationProvider) {
3
9
  $locationProvider.html5Mode({ enabled: true, requireBase: false, rewriteLinks: false });
@@ -19,7 +19,7 @@ module DocumentationEditor
19
19
  before_filter DocumentationEditor::Config.before_filter, only: [:preview, :show]
20
20
  end
21
21
 
22
- before_filter :setup_page, only: [:edit, :source, :update, :preview, :destroy, :history, :versions]
22
+ before_filter :setup_page, only: [:edit, :source, :update, :commit, :preview, :destroy, :history, :versions]
23
23
 
24
24
  def index
25
25
  end
@@ -32,6 +32,13 @@ module DocumentationEditor
32
32
  end
33
33
 
34
34
  def update
35
+ @page.title = params[:page][:title]
36
+ @page.slug = params[:page][:slug]
37
+ @page.save!
38
+ render nothing: true
39
+ end
40
+
41
+ def commit
35
42
  @page.add_revision!(params[:data], params[:preview].to_s == 'false', respond_to?(:current_user) ? current_user.id : nil)
36
43
  render nothing: true
37
44
  end
@@ -39,6 +46,7 @@ module DocumentationEditor
39
46
  def create
40
47
  p = Page.new
41
48
  p.author_id = respond_to?(:current_user) ? current_user.id : nil
49
+ p.title = params[:page][:title]
42
50
  p.slug = params[:page][:slug]
43
51
  p.save!
44
52
  redirect_to edit_page_path(p)
@@ -7,6 +7,7 @@
7
7
  %table.table.table-striped
8
8
  %thead
9
9
  %tr
10
+ %th Title
10
11
  %th Slug
11
12
  %th Last modification
12
13
  %th Published at
@@ -15,7 +16,8 @@
15
16
  %tbody
16
17
  - DocumentationEditor::Page.order('id DESC').each do |p|
17
18
  %tr
18
- %td= link_to "#{request.path.split('/admin').first}/#{p.slug}", edit_page_path(p)
19
+ %td= best_in_place p, :title, url: update_path(p)
20
+ %td= best_in_place p, :slug, url: update_path(p)
19
21
  %td= l p.created_at, format: :short
20
22
  %td= p.published_revision ? l(p.published_revision.created_at, format: :long) : ''
21
23
  %td= p.published_revision ? p.published_revision.author_id : ''
@@ -34,6 +36,6 @@
34
36
  Delete
35
37
  %h3 Create a new page
36
38
  = form_for DocumentationEditor::Page.new, url: admin_path, html: { class: 'form form-inline' } do |f|
39
+ = f.text_field :title, placeholder: 'Title', class: 'form-control'
37
40
  = f.text_field :slug, placeholder: 'tutorials/my-tutorial', class: 'form-control'
38
41
  = f.submit 'Create', class: 'btn btn-success'
39
- %p.text-muted Will be appended to #{page_path('')}
@@ -3,6 +3,8 @@
3
3
  - cache("page-#{id}-toc") do
4
4
  = render partial: 'menu_items', object: @revision.to_toc(@options)
5
5
 
6
+ - content_for :page_title, @page.title
7
+
6
8
  .markdown-page
7
9
  - if DocumentationEditor::Config.is_admin && send(DocumentationEditor::Config.is_admin)
8
10
  .text-right
data/config/routes.rb CHANGED
@@ -7,7 +7,8 @@ DocumentationEditor::Engine.routes.draw do
7
7
 
8
8
  get '/:id', :controller => 'pages', :action => 'source'
9
9
  get '/:id/edit', as: :edit_page, :controller => 'pages', :action => 'edit'
10
- post '/:id', :controller => 'pages', :action => 'update'
10
+ put '/:id', as: :update, :controller => 'pages', :action => 'update'
11
+ post '/:id', :controller => 'pages', :action => 'commit'
11
12
  delete '/:id', as: :delete_page, :controller => 'pages', :action => 'destroy'
12
13
  get '/:id/preview', as: :preview_page, :controller => 'pages', :action => 'preview'
13
14
  get '/:prev/:cur/diff', :controller => 'pages', :action => 'diff'
@@ -0,0 +1,5 @@
1
+ class AddTitleToPages < ActiveRecord::Migration
2
+ def change
3
+ add_column :documentation_editor_pages, :title, :string, limit: 255
4
+ end
5
+ end
@@ -10,6 +10,8 @@ require 'sass-rails'
10
10
  require 'paperclip'
11
11
  ## diff
12
12
  require 'diffy'
13
+ ## best in place
14
+ require 'best_in_place'
13
15
 
14
16
  module DocumentationEditor
15
17
  end
@@ -1,3 +1,3 @@
1
1
  module DocumentationEditor
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: documentation-editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-04 00:00:00.000000000 Z
11
+ date: 2015-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: best_in_place
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: The goal of this project is to provide an easy & frictionless way to
112
126
  edit an online tech documentation. The sweet spot of this editor is to be able to
113
127
  generate pages containing multiple snippets of highlighted code & conditional sections
@@ -143,6 +157,7 @@ files:
143
157
  - db/migrate/20150722230424_create_documentation_editor_pages.rb
144
158
  - db/migrate/20150725063642_create_documentation_editor_images.rb
145
159
  - db/migrate/20150728040718_create_documentation_editor_revisions.rb
160
+ - db/migrate/20150818102838_add_title_to_pages.rb
146
161
  - lib/documentation-editor.rb
147
162
  - lib/documentation_editor.rb
148
163
  - lib/documentation_editor/configuration.rb
@@ -170,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
185
  version: '0'
171
186
  requirements: []
172
187
  rubyforge_project:
173
- rubygems_version: 2.2.2
188
+ rubygems_version: 2.4.5
174
189
  signing_key:
175
190
  specification_version: 4
176
191
  summary: Mountable Rails application providing an extended Markdown documentation