whurl_engine 2.1.4 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/whurl_engine/chapters_controller.rb +32 -0
- data/app/controllers/whurl_engine/stories_controller.rb +36 -0
- data/app/models/whurl_engine/chapter.rb +6 -0
- data/app/models/whurl_engine/story.rb +5 -0
- data/app/views/layouts/whurl_engine/application.html.haml +3 -1
- data/app/views/whurl_engine/categories/index.html.haml +2 -2
- data/app/views/whurl_engine/chapters/_chapter.html.haml +9 -0
- data/app/views/whurl_engine/chapters/_form.html.haml +29 -0
- data/app/views/whurl_engine/chapters/create.js.haml +5 -0
- data/app/views/whurl_engine/chapters/destroy.js.haml +1 -0
- data/app/views/whurl_engine/chapters/edit.js.haml +3 -0
- data/app/views/whurl_engine/chapters/new.js.haml +3 -0
- data/app/views/whurl_engine/chapters/update.js.haml +6 -0
- data/app/views/whurl_engine/resources/show.html.haml +1 -0
- data/app/views/whurl_engine/stories/_form.html.haml +24 -0
- data/app/views/whurl_engine/stories/_story.html.haml +10 -0
- data/app/views/whurl_engine/stories/create.js.haml +5 -0
- data/app/views/whurl_engine/stories/destroy.js.haml +1 -0
- data/app/views/whurl_engine/stories/edit.js.haml +3 -0
- data/app/views/whurl_engine/stories/index.html.haml +5 -0
- data/app/views/whurl_engine/stories/new.js.haml +3 -0
- data/app/views/whurl_engine/stories/update.js.haml +6 -0
- data/config/initializers/string.rb +0 -1
- data/config/routes.rb +2 -0
- data/db/migrate/20120309045108_whurl_create_stories_table.rb +9 -0
- data/db/migrate/20120309055033_whurl_create_chapters_table.rb +11 -0
- data/lib/whurl_engine/version.rb +1 -1
- metadata +47 -26
@@ -0,0 +1,32 @@
|
|
1
|
+
module WhurlEngine
|
2
|
+
class ChaptersController < WhurlEngine::ApplicationController
|
3
|
+
def new
|
4
|
+
@chapter = WhurlEngine::Chapter.new(:story_id => params[:story_id])
|
5
|
+
end
|
6
|
+
|
7
|
+
def create
|
8
|
+
@chapter = WhurlEngine::Chapter.new(params[:chapter])
|
9
|
+
unless @chapter.save
|
10
|
+
render :partial => 'error'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def edit
|
15
|
+
@chapter = WhurlEngine::Chapter.find(params[:id])
|
16
|
+
end
|
17
|
+
|
18
|
+
def update
|
19
|
+
@chapter = WhurlEngine::Chapter.find(params[:id])
|
20
|
+
unless @chapter.update_attributes(params[:chapter])
|
21
|
+
render :partial => 'error'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def destroy
|
26
|
+
@chapter = WhurlEngine::Chapter.find(params[:id])
|
27
|
+
unless @chapter.destroy
|
28
|
+
render :partial => 'error'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module WhurlEngine
|
2
|
+
class StoriesController < WhurlEngine::ApplicationController
|
3
|
+
def index
|
4
|
+
@stories = WhurlEngine::Story.all
|
5
|
+
end
|
6
|
+
|
7
|
+
def new
|
8
|
+
@story = WhurlEngine::Story.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def create
|
12
|
+
@story = WhurlEngine::Story.new(params[:story])
|
13
|
+
unless @story.save
|
14
|
+
render :partial => 'whurl_engine/shared/error', :locals => {:object => @story}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def edit
|
19
|
+
@story = WhurlEngine::Story.find(params[:id])
|
20
|
+
end
|
21
|
+
|
22
|
+
def update
|
23
|
+
@story = WhurlEngine::Story.find(params[:id])
|
24
|
+
unless @story.update_attributes(params[:story])
|
25
|
+
render :partial => 'whurl_engine/shared/error', :locals => {:object => @story}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def destroy
|
30
|
+
@story = WhurlEngine::Story.find(params[:id])
|
31
|
+
unless @story.destroy
|
32
|
+
render :partial => 'whurl_engine/shared/error', :locals => {:object => @story}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -31,6 +31,8 @@
|
|
31
31
|
=link_to "Documentation Home", root_path
|
32
32
|
|
|
33
33
|
=link_to "Console", new_whurl_path
|
34
|
+
|
|
35
|
+
=link_to "Stories", stories_path
|
34
36
|
.content
|
35
37
|
- if notice || alert
|
36
38
|
.flash
|
@@ -48,4 +50,4 @@
|
|
48
50
|
%a.contact{:href => "mailto:will.read@gmail.com"} Will Read
|
49
51
|
See it on
|
50
52
|
= succeed "." do
|
51
|
-
%a{:href => "https://github.com/tildewill/
|
53
|
+
%a{:href => "https://github.com/tildewill/whurl_engine"} Github
|
@@ -3,5 +3,5 @@
|
|
3
3
|
-if authorized?(:manage, nil, WhurlEngine::Category)
|
4
4
|
= link_to('Add Category', new_category_path, :remote => true, :class => 'popup button')
|
5
5
|
.category_list
|
6
|
-
- @categories.each do |category|
|
7
|
-
|
6
|
+
- @categories.each do |category|
|
7
|
+
= render(category)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
%li
|
2
|
+
%div{:id => "chapter_#{chapter.id}"}
|
3
|
+
%h3
|
4
|
+
=chapter.title
|
5
|
+
-if authorized?(:manage, nil, WhurlEngine::Chapter)
|
6
|
+
= link_to('', edit_chapter_path(chapter), :remote => true, :class => 'edit button icon_only')
|
7
|
+
= link_to( '', chapter, :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => 'destroy button icon_only')
|
8
|
+
%p=chapter.description
|
9
|
+
= render(chapter.whurl)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
:javascript
|
2
|
+
$(function() {
|
3
|
+
$( ".whurl_engine_chapter" ).dialog(
|
4
|
+
{
|
5
|
+
modal: true,
|
6
|
+
autoOpen: false,
|
7
|
+
title: 'Manage Resources',
|
8
|
+
minWidth: 375,
|
9
|
+
minHeight: 300,
|
10
|
+
close: function(event, ui) {
|
11
|
+
$(this).remove();
|
12
|
+
}
|
13
|
+
});
|
14
|
+
});
|
15
|
+
.whurl_engine_chapter
|
16
|
+
= form_for @chapter, :remote => true do |f|
|
17
|
+
= f.hidden_field :story_id
|
18
|
+
|
19
|
+
%div
|
20
|
+
= f.label :title
|
21
|
+
= f.text_field :title, :placeholder => 'eg. Logging in'
|
22
|
+
%div
|
23
|
+
= f.label :description
|
24
|
+
%div
|
25
|
+
= f.text_area :description
|
26
|
+
%div
|
27
|
+
= f.label :whurl_id
|
28
|
+
= f.text_field :whurl_id, :placeholder => "the last part of a Whurl's url"
|
29
|
+
= f.submit :value => 'Submit'
|
@@ -0,0 +1 @@
|
|
1
|
+
$("#chapter_#{@chapter.id}").fadeOut()
|
@@ -31,6 +31,7 @@
|
|
31
31
|
%h3{:class => "whurl_#{whurl.id}"}
|
32
32
|
%a{:href => "#whurl_#{whurl.id}"}=whurl.name
|
33
33
|
.container{:class => "whurl_#{whurl.id}"}
|
34
|
+
.permalink= link_to short_whurl_url(whurl), short_whurl_url(whurl), target: 'whurl'
|
34
35
|
-if authorized?(:manage, nil, WhurlEngine::Resource)
|
35
36
|
= link_to('', edit_whurl_path(whurl), :remote => true, :class => 'edit button icon_only')
|
36
37
|
= link_to( '', whurl, :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => 'destroy button icon_only')
|
@@ -0,0 +1,24 @@
|
|
1
|
+
:javascript
|
2
|
+
$(function() {
|
3
|
+
$( ".whurl_engine_story" ).dialog(
|
4
|
+
{
|
5
|
+
modal: true,
|
6
|
+
autoOpen: false,
|
7
|
+
title: 'Manage Stories',
|
8
|
+
minWidth: 375,
|
9
|
+
minHeight: 300,
|
10
|
+
close: function(event, ui) {
|
11
|
+
$(this).remove();
|
12
|
+
}
|
13
|
+
});
|
14
|
+
});
|
15
|
+
.whurl_engine_story
|
16
|
+
= form_for story, :remote => true do |f|
|
17
|
+
%div
|
18
|
+
= f.label :title
|
19
|
+
= f.text_field :title, :placeholder => 'eg. Log in, Change my profile, Log out'
|
20
|
+
%div
|
21
|
+
= f.label :description
|
22
|
+
%div
|
23
|
+
= f.text_area :description
|
24
|
+
= f.submit :value => 'Submit'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
%div{:id => "story_#{story.id}"}
|
2
|
+
%h2
|
3
|
+
= story.title
|
4
|
+
-if authorized?(:manage, nil, WhurlEngine::Story)
|
5
|
+
= link_to('Add Chapter', new_chapter_path(:story_id => story.id), :remote => true, :class => 'popup button')
|
6
|
+
= link_to('', edit_story_path(story), :remote => true, :class => 'edit button icon_only')
|
7
|
+
= link_to( '', story, :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => 'destroy button icon_only')
|
8
|
+
%p= story.description
|
9
|
+
.chapters
|
10
|
+
= render story.chapters
|
@@ -0,0 +1 @@
|
|
1
|
+
$("#story_#{@story.id}").fadeOut()
|
data/config/routes.rb
CHANGED
@@ -5,5 +5,7 @@ WhurlEngine::Engine.routes.draw do
|
|
5
5
|
resources :header_definitions, :except => [:index, :show]
|
6
6
|
resources :whurls, :except => [:index]
|
7
7
|
resources :resources, :except => :index
|
8
|
+
resources :chapters, :except => [:index, :show]
|
9
|
+
resources :stories, :except => :show
|
8
10
|
match '/:id' => 'whurls#show', :as => :short_whurl
|
9
11
|
end
|
data/lib/whurl_engine/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whurl_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-08 00:00:00.000000000 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: coderay
|
17
|
-
requirement: &
|
17
|
+
requirement: &2156304500 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0.9'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2156304500
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: coffee-script
|
28
|
-
requirement: &
|
28
|
+
requirement: &2156304060 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2156304060
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: httmultiparty
|
39
|
-
requirement: &
|
39
|
+
requirement: &2156303500 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0.2'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2156303500
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: haml
|
50
|
-
requirement: &
|
50
|
+
requirement: &2156302980 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '3.1'
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2156302980
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: json
|
61
|
-
requirement: &
|
61
|
+
requirement: &2156302480 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '1.5'
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *2156302480
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rails
|
72
|
-
requirement: &
|
72
|
+
requirement: &2156302000 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: '3.1'
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *2156302000
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: rinku
|
83
|
-
requirement: &
|
83
|
+
requirement: &2156301520 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: '1.5'
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *2156301520
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: sass
|
94
|
-
requirement: &
|
94
|
+
requirement: &2156301040 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ~>
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: '3.1'
|
100
100
|
type: :runtime
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *2156301040
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: uglifier
|
105
|
-
requirement: &
|
105
|
+
requirement: &2156300640 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ! '>='
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: '0'
|
111
111
|
type: :runtime
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *2156300640
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: heroku
|
116
|
-
requirement: &
|
116
|
+
requirement: &2156300160 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - ! '>='
|
@@ -121,10 +121,10 @@ dependencies:
|
|
121
121
|
version: '0'
|
122
122
|
type: :development
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *2156300160
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: mysql
|
127
|
-
requirement: &
|
127
|
+
requirement: &2156299640 !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
130
130
|
- - ~>
|
@@ -132,10 +132,10 @@ dependencies:
|
|
132
132
|
version: 2.8.1
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
|
-
version_requirements: *
|
135
|
+
version_requirements: *2156299640
|
136
136
|
- !ruby/object:Gem::Dependency
|
137
137
|
name: webmock
|
138
|
-
requirement: &
|
138
|
+
requirement: &2156299140 !ruby/object:Gem::Requirement
|
139
139
|
none: false
|
140
140
|
requirements:
|
141
141
|
- - ~>
|
@@ -143,7 +143,7 @@ dependencies:
|
|
143
143
|
version: 1.7.10
|
144
144
|
type: :development
|
145
145
|
prerelease: false
|
146
|
-
version_requirements: *
|
146
|
+
version_requirements: *2156299140
|
147
147
|
description: ! "Whurl is a mountable engine for Rails 3.1+ apps allowing\n you
|
148
148
|
to show the functionality of your API. You can save API calls and share them with
|
149
149
|
your team or the public."
|
@@ -198,15 +198,19 @@ files:
|
|
198
198
|
- app/assets/stylesheets/whurl_engine/whurl.css.scss
|
199
199
|
- app/controllers/whurl_engine/application_controller.rb
|
200
200
|
- app/controllers/whurl_engine/categories_controller.rb
|
201
|
+
- app/controllers/whurl_engine/chapters_controller.rb
|
201
202
|
- app/controllers/whurl_engine/header_definitions_controller.rb
|
202
203
|
- app/controllers/whurl_engine/parameter_definitions_controller.rb
|
203
204
|
- app/controllers/whurl_engine/resources_controller.rb
|
205
|
+
- app/controllers/whurl_engine/stories_controller.rb
|
204
206
|
- app/controllers/whurl_engine/whurls_controller.rb
|
205
207
|
- app/helpers/whurl_engine/application_helper.rb
|
206
208
|
- app/models/whurl_engine/category.rb
|
209
|
+
- app/models/whurl_engine/chapter.rb
|
207
210
|
- app/models/whurl_engine/header_definition.rb
|
208
211
|
- app/models/whurl_engine/parameter_definition.rb
|
209
212
|
- app/models/whurl_engine/resource.rb
|
213
|
+
- app/models/whurl_engine/story.rb
|
210
214
|
- app/models/whurl_engine/whurl.rb
|
211
215
|
- app/views/layouts/whurl_engine/application.html.haml
|
212
216
|
- app/views/whurl_engine/categories/_category.html.haml
|
@@ -217,6 +221,13 @@ files:
|
|
217
221
|
- app/views/whurl_engine/categories/index.html.haml
|
218
222
|
- app/views/whurl_engine/categories/new.js.haml
|
219
223
|
- app/views/whurl_engine/categories/update.js.haml
|
224
|
+
- app/views/whurl_engine/chapters/_chapter.html.haml
|
225
|
+
- app/views/whurl_engine/chapters/_form.html.haml
|
226
|
+
- app/views/whurl_engine/chapters/create.js.haml
|
227
|
+
- app/views/whurl_engine/chapters/destroy.js.haml
|
228
|
+
- app/views/whurl_engine/chapters/edit.js.haml
|
229
|
+
- app/views/whurl_engine/chapters/new.js.haml
|
230
|
+
- app/views/whurl_engine/chapters/update.js.haml
|
220
231
|
- app/views/whurl_engine/header_definitions/_form.html.haml
|
221
232
|
- app/views/whurl_engine/header_definitions/_header_definition.html.haml
|
222
233
|
- app/views/whurl_engine/header_definitions/create.js.haml
|
@@ -240,6 +251,14 @@ files:
|
|
240
251
|
- app/views/whurl_engine/resources/show.html.haml
|
241
252
|
- app/views/whurl_engine/resources/update.js.haml
|
242
253
|
- app/views/whurl_engine/shared/_error.js.haml
|
254
|
+
- app/views/whurl_engine/stories/_form.html.haml
|
255
|
+
- app/views/whurl_engine/stories/_story.html.haml
|
256
|
+
- app/views/whurl_engine/stories/create.js.haml
|
257
|
+
- app/views/whurl_engine/stories/destroy.js.haml
|
258
|
+
- app/views/whurl_engine/stories/edit.js.haml
|
259
|
+
- app/views/whurl_engine/stories/index.html.haml
|
260
|
+
- app/views/whurl_engine/stories/new.js.haml
|
261
|
+
- app/views/whurl_engine/stories/update.js.haml
|
243
262
|
- app/views/whurl_engine/whurls/_edit_form.html.haml
|
244
263
|
- app/views/whurl_engine/whurls/_form.html.haml
|
245
264
|
- app/views/whurl_engine/whurls/_input_set.html.haml
|
@@ -271,6 +290,8 @@ files:
|
|
271
290
|
- db/migrate/20120118011913_whurl_create_header_definitions_table.rb
|
272
291
|
- db/migrate/20120214074332_whurl_add_message_to_whurls.rb
|
273
292
|
- db/migrate/20120221012000_whurl_add_basic_auth_fields.rb
|
293
|
+
- db/migrate/20120309045108_whurl_create_stories_table.rb
|
294
|
+
- db/migrate/20120309055033_whurl_create_chapters_table.rb
|
274
295
|
- lib/tasks/whurl_engine_tasks.rake
|
275
296
|
- lib/whurl_engine/config.rb
|
276
297
|
- lib/whurl_engine/engine.rb
|