simple_text 0.0.9 → 0.0.17

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 790b7b6541f6e1481ecd564449ae099d05326bc3
4
- data.tar.gz: 3d52b89fe08edecb4df5c81273d33db429c7a8ec
3
+ metadata.gz: d31dd8cd522df8036941fa8b352c4d454205406c
4
+ data.tar.gz: a31ab3ff69c1189e89b3d504abc2e8a37cec3556
5
5
  SHA512:
6
- metadata.gz: ccabc8b46ce186099f7a728e7a7faea1cae8c042f170c80f943ae2f7813b0474d1c04079e3d5c92193ad0500c6c65be2a3639d5611a40d433cdb351cf75624ac
7
- data.tar.gz: a0552ea4a97d7b032a376ef61ff0c377cd07c18093278f54c7121387629538c02b5728372440c94deb936450fb7e2eab450d1228939dfdca64a086796af6c38a
6
+ metadata.gz: b804e4cd009dcf6abdd0c351711a469e9d89c0cfcaba703a3586aa2784667875fdea49b6c6d1302312c5c70cf4aa10196ecaf4f2ca4f02b3345bab6eae4d9257
7
+ data.tar.gz: 8be57a2b26b7f039a8f460678412f59dd72f5aad4ba262bdf75612dab3b5d5b9a5b4e0f7c3b6f300875d3fcbe6733c73c27c1d169b7e203be99797b222857533
@@ -1,5 +1,3 @@
1
- module SimpleText
2
- class ApplicationController < ActionController::Base
3
-
4
- end
1
+ class SimpleText::ApplicationController < ::ApplicationController
2
+ layout 'layouts/application'
5
3
  end
@@ -1,65 +1,63 @@
1
- module SimpleText
2
- class DocumentsController < ApplicationController
1
+ class SimpleText::DocumentsController < SimpleText::ApplicationController
3
2
 
4
- def index
5
- @documents = Document.all.page params[:page]
6
- end
3
+ def index
4
+ @documents = Document.all.page params[:page]
5
+ end
7
6
 
8
- def show
9
- @document = Document.where(name: params[:name]).first || not_found
7
+ def show
8
+ @document = Document.where(name: params[:name]).first || not_found
10
9
 
11
- unless fresh_when(etag: @document, last_modified: @document.created_at, public: true)
12
- render
13
- end
10
+ unless fresh_when(etag: @document, last_modified: @document.created_at, public: true)
11
+ render
14
12
  end
13
+ end
15
14
 
16
- def new
17
- @document = Document.new
18
- end
15
+ def new
16
+ @document = Document.new
17
+ end
19
18
 
20
- def create
21
- @document = Document.create create_params
19
+ def create
20
+ @document = Document.create create_params
22
21
 
23
- respond_to do |format|
24
- if @document.save
25
- create_edit_entry @document, :a_create
26
- format.html { redirect_to documents_path, notice: t('simple_text.created') }
27
- else
28
- format.html { render new_document_path, notice: t('simple_text.error') }
29
- end
22
+ respond_to do |format|
23
+ if @document.save
24
+ create_edit_entry @document, :a_create
25
+ format.html { redirect_to documents_path, notice: t('simple_text.created') }
26
+ else
27
+ format.html { render new_document_path, notice: t('simple_text.error') }
30
28
  end
31
29
  end
30
+ end
32
31
 
33
- def edit
34
- @document = Document.where(name: params[:id]).first || not_found
35
- end
32
+ def edit
33
+ @document = Document.where(name: params[:id]).first || not_found
34
+ end
36
35
 
37
- def update
38
- @document = Document.where(name: params[:document][:name]).first || not_found
39
- _old_doc = @document.clone
40
- respond_to do |format|
41
- if @document.update permit_params
42
- create_edit_entry @document, :a_update, _old_doc.as_json.to_s
43
- format.html { redirect_to documents_path, notice: t('simple_text.succeeded') }
44
- else
45
- format.html { render 'edit' }
46
- end
36
+ def update
37
+ @document = Document.where(name: params[:document][:name]).first || not_found
38
+ _old_doc = @document.clone
39
+ respond_to do |format|
40
+ if @document.update permit_params
41
+ create_edit_entry @document, :a_update, _old_doc.as_json.to_s
42
+ format.html { redirect_to documents_path, notice: t('simple_text.succeeded') }
43
+ else
44
+ format.html { render 'edit' }
47
45
  end
48
46
  end
47
+ end
49
48
 
50
- private
51
-
52
- def permit_params
53
- params.require(:document).permit(:title, :contents)
54
- end
49
+ private
55
50
 
56
- def create_params
57
- params.require(:document).permit(:name, :title, :contents)
58
- end
51
+ def permit_params
52
+ params.require(:document).permit(:title, :contents)
53
+ end
59
54
 
60
- def not_found
61
- raise ActionController::RoutingError.new('Not Found')
62
- end
55
+ def create_params
56
+ params.require(:document).permit(:name, :title, :contents)
57
+ end
63
58
 
59
+ def not_found
60
+ raise ActionController::RoutingError.new('Not Found')
64
61
  end
65
- end
62
+
63
+ end
data/config/routes.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  SimpleText::Engine.routes.draw do
2
- resources :documents, only: [:edit, :update, :index, :new, :create]
2
+
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleText
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.17"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_text
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher91