manuscript 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/manuscript/template_file.rb +4 -0
- data/lib/manuscript/template_file_manager.rb +23 -2
- data/manuscript.gemspec +2 -1
- data/views/edit_template_file.haml +9 -0
- data/views/new_template_file.haml +3 -3
- data/views/template_files.haml +4 -1
- metadata +2 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
@@ -19,8 +19,29 @@ module Manuscript
|
|
19
19
|
@file = TemplateFile.new
|
20
20
|
@file.file = new_file
|
21
21
|
@file.save
|
22
|
-
|
23
|
-
|
22
|
+
redirect '/admin/template_files'
|
23
|
+
end
|
24
|
+
|
25
|
+
get '/admin/template_files/:id/edit' do
|
26
|
+
@file = TemplateFile.find(params[:id])
|
27
|
+
haml :edit_template_file
|
28
|
+
end
|
29
|
+
|
30
|
+
put '/admin/template_files/:id' do
|
31
|
+
new_file = params[:template_file][:file][:tempfile]
|
32
|
+
new_file.original_filename = params[:template_file][:file][:filename]
|
33
|
+
|
34
|
+
@file = TemplateFile.find(params[:id])
|
35
|
+
raise Sinatra::NotFound unless @file
|
36
|
+
@file.file = new_file
|
37
|
+
@file.save
|
38
|
+
redirect '/admin/template_files'
|
39
|
+
end
|
40
|
+
|
41
|
+
delete '/admin/template_files/:id' do
|
42
|
+
@file = TemplateFile.find(params[:id])
|
43
|
+
raise Sinatra::NotFound unless @file
|
44
|
+
@file.destroy
|
24
45
|
redirect '/admin/template_files'
|
25
46
|
end
|
26
47
|
end
|
data/manuscript.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{manuscript}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["hotink"]
|
@@ -52,6 +52,7 @@ Gem::Specification.new do |s|
|
|
52
52
|
"spec/manuscript/template_manager_spec.rb",
|
53
53
|
"spec/spec.opts",
|
54
54
|
"spec/spec_helper.rb",
|
55
|
+
"views/edit_template_file.haml",
|
55
56
|
"views/layout.haml",
|
56
57
|
"views/menu.haml",
|
57
58
|
"views/new_template_file.haml",
|
@@ -0,0 +1,9 @@
|
|
1
|
+
%p
|
2
|
+
%a{ :href => "/admin/template_files" } « back
|
3
|
+
%form{:method =>:post, :action => "/admin/template_files/#{@file.id}", :enctype => "multipart/form-data"}
|
4
|
+
%fieldset
|
5
|
+
%legend
|
6
|
+
= "Replace file: #{@file.url}"
|
7
|
+
%input{:type => 'file', :name => 'template_file[file]', :id => 'template_file_file'}
|
8
|
+
%input{:type => 'hidden', :name => '_method', :value => 'put'}
|
9
|
+
%input{ :type => :submit, :value => "Upload" }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
%p
|
2
2
|
%a{ :href => "/admin/template_files" } « back
|
3
3
|
%form{:method =>:post, :action => "/admin/template_files", :enctype => "multipart/form-data"}
|
4
|
-
%
|
5
|
-
Upload template file
|
4
|
+
%fieldset
|
5
|
+
%legend Upload template file
|
6
6
|
%input{:type => 'file', :name => 'template_file[file]', :id => 'template_file_file'}
|
7
|
-
|
7
|
+
%input{ :type => :submit, :value => "Upload" }
|
data/views/template_files.haml
CHANGED
@@ -2,5 +2,8 @@
|
|
2
2
|
%ol
|
3
3
|
- @files.each do |file|
|
4
4
|
%li
|
5
|
-
= file.
|
5
|
+
= "#{file.url} "
|
6
|
+
%small
|
7
|
+
%a{:href => "/admin/template_files/#{file.id}/edit"} edit
|
8
|
+
%a{ :onclick => "if(confirm('You are about to delete a template file. Click OK to delete or Cancel to return to the page.')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); { f.method = 'POST'; f.action = this.href;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'delete'); f.appendChild(m);f.submit(); } } return false;", :href => "/admin/template_files/#{file.id}" } delete
|
6
9
|
%a{ :href => "/admin/template_files/new" } Upload a file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manuscript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hotink
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- spec/manuscript/template_manager_spec.rb
|
138
138
|
- spec/spec.opts
|
139
139
|
- spec/spec_helper.rb
|
140
|
+
- views/edit_template_file.haml
|
140
141
|
- views/layout.haml
|
141
142
|
- views/menu.haml
|
142
143
|
- views/new_template_file.haml
|