how_are_we_doing 0.0.1 → 0.0.2
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.
- data/app/controllers/prints_controller.rb +10 -2
- data/app/controllers/shares_controller.rb +10 -2
- data/app/controllers/views_controller.rb +10 -2
- data/app/models/share.rb +5 -0
- data/lib/generators/how_are_we_doing/USAGE +8 -0
- data/lib/generators/{install_generator.rb → how_are_we_doing/install/install_generator.rb} +1 -1
- data/lib/generators/{templates → how_are_we_doing/install/templates}/db/migrate/create_prints.rb +0 -0
- data/lib/generators/{templates → how_are_we_doing/install/templates}/db/migrate/create_shares.rb +1 -1
- data/lib/generators/{templates → how_are_we_doing/install/templates}/db/migrate/create_views.rb +0 -0
- data/lib/how_are_we_doing/version.rb +1 -1
- metadata +7 -6
@@ -1,10 +1,11 @@
|
|
1
1
|
class PrintsController < ApplicationController
|
2
2
|
respond_to :html, :json, :xml, :js
|
3
|
+
before_filter :add_user
|
3
4
|
|
4
5
|
def create
|
5
|
-
@print = parent.prints.create
|
6
|
+
@print = parent.prints.create(params[:print]||{})
|
6
7
|
|
7
|
-
respond_with
|
8
|
+
respond_with(@print, :location => send("#{parent.class.name.underscore}_url",parent))
|
8
9
|
end
|
9
10
|
|
10
11
|
protected
|
@@ -13,4 +14,11 @@ class PrintsController < ApplicationController
|
|
13
14
|
instance_variable_set("@#{params[:printable_type].underscore}",@parent)
|
14
15
|
end
|
15
16
|
|
17
|
+
def add_user
|
18
|
+
if defined?(current_user) && current_user
|
19
|
+
params[:print] ||= {}
|
20
|
+
params[:print][:user_id] = current_user.id
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
16
24
|
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
class SharesController < ApplicationController
|
2
2
|
respond_to :html, :json, :xml, :js
|
3
|
+
before_filter :add_user
|
3
4
|
|
4
5
|
def create
|
5
|
-
@share = parent.shares.create
|
6
|
+
@share = parent.shares.create((params[:share]||{}))
|
6
7
|
|
7
|
-
respond_with
|
8
|
+
respond_with(@share, :location => send("#{parent.class.name.underscore}_url",parent))
|
8
9
|
end
|
9
10
|
|
10
11
|
protected
|
@@ -13,4 +14,11 @@ class SharesController < ApplicationController
|
|
13
14
|
instance_variable_set("@#{params[:shareable_type].underscore}",@parent)
|
14
15
|
end
|
15
16
|
|
17
|
+
def add_user
|
18
|
+
if defined?(current_user) && current_user
|
19
|
+
params[:share] ||= {}
|
20
|
+
params[:share][:user_id] = current_user.id
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
16
24
|
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
class ViewsController < ApplicationController
|
2
2
|
respond_to :html, :json, :xml, :js
|
3
|
+
before_filter :add_user
|
3
4
|
|
4
5
|
def create
|
5
|
-
@view = parent.views.create
|
6
|
+
@view = parent.views.create((params[:view]||{}))
|
6
7
|
|
7
|
-
respond_with
|
8
|
+
respond_with(@view, :location => send("#{parent.class.name.underscore}_url",parent))
|
8
9
|
end
|
9
10
|
|
10
11
|
protected
|
@@ -13,4 +14,11 @@ class ViewsController < ApplicationController
|
|
13
14
|
instance_variable_set("@#{params[:viewable_type].underscore}",@parent)
|
14
15
|
end
|
15
16
|
|
17
|
+
def add_user
|
18
|
+
if defined?(current_user) && current_user
|
19
|
+
params[:view] ||= {}
|
20
|
+
params[:view][:user_id] = current_user.id
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
16
24
|
end
|
data/app/models/share.rb
CHANGED
data/lib/generators/{templates → how_are_we_doing/install/templates}/db/migrate/create_prints.rb
RENAMED
File without changes
|
data/lib/generators/{templates → how_are_we_doing/install/templates}/db/migrate/create_views.rb
RENAMED
File without changes
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Gunner Technology, Cody Swann
|
@@ -41,10 +41,11 @@ files:
|
|
41
41
|
- lib/acts_as_printable.rb
|
42
42
|
- lib/acts_as_shareable.rb
|
43
43
|
- lib/acts_as_viewable.rb
|
44
|
-
- lib/generators/
|
45
|
-
- lib/generators/
|
46
|
-
- lib/generators/templates/db/migrate/
|
47
|
-
- lib/generators/templates/db/migrate/
|
44
|
+
- lib/generators/how_are_we_doing/USAGE
|
45
|
+
- lib/generators/how_are_we_doing/install/install_generator.rb
|
46
|
+
- lib/generators/how_are_we_doing/install/templates/db/migrate/create_prints.rb
|
47
|
+
- lib/generators/how_are_we_doing/install/templates/db/migrate/create_shares.rb
|
48
|
+
- lib/generators/how_are_we_doing/install/templates/db/migrate/create_views.rb
|
48
49
|
- lib/how_are_we_doing.rb
|
49
50
|
- lib/how_are_we_doing/version.rb
|
50
51
|
has_rdoc: true
|