sunrise-votes 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/app/controllers/manage/ballot_box/votes_controller.rb +20 -5
- data/app/views/manage/ballot_box/votes/_model_filter.html.erb +7 -4
- data/app/views/manage/ballot_box/votes/_vote.html.erb +1 -1
- data/app/views/manage/ballot_box/votes/index.html.erb +1 -1
- data/app/views/manage/ballot_box/votes/show.html.erb +2 -2
- data/lib/sunrise/votes/version.rb +1 -1
- metadata +11 -9
data/README.rdoc
CHANGED
@@ -11,4 +11,4 @@ http://www.jqplot.com/index.php
|
|
11
11
|
|
12
12
|
== Usage
|
13
13
|
|
14
|
-
<%= link_to 'charts', manage_ballot_box_vote_path(:id => 'charts', :
|
14
|
+
<%= link_to 'charts', manage_ballot_box_vote_path(:id => 'charts', :voteable_id => work.id, :voteable_type => work.class.name) %>
|
@@ -1,36 +1,51 @@
|
|
1
1
|
class Manage::BallotBox::VotesController < Manage::BaseController
|
2
2
|
inherit_resources
|
3
3
|
|
4
|
-
belongs_to :idea, :polymorphic => true
|
5
4
|
actions :index, :show, :destroy
|
6
5
|
defaults :route_prefix => 'manage', :resource_class => BallotBox::Vote,
|
7
6
|
:collection_name => 'votes', :instance_name => 'vote'
|
8
7
|
|
9
8
|
respond_to :json, :only => [:show]
|
10
9
|
|
10
|
+
before_filter :find_voteable
|
11
11
|
before_filter :make_filter, :only=>[:index]
|
12
12
|
|
13
|
-
|
13
|
+
authorize_resource :class => BallotBox::Vote
|
14
|
+
|
15
|
+
helper_method :voteable_scope
|
14
16
|
|
15
17
|
def destroy
|
16
|
-
destroy!{ manage_ballot_box_votes_path(
|
18
|
+
destroy!{ manage_ballot_box_votes_path( voteable_scope(@voteable) ) }
|
17
19
|
end
|
18
20
|
|
19
21
|
def show
|
20
|
-
respond_with(
|
21
|
-
format.json { render :json =>
|
22
|
+
respond_with(@voteable) do |format|
|
23
|
+
format.json { render :json => @voteable.votes.chart(params[:id]) }
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
27
|
protected
|
26
28
|
|
29
|
+
def begin_of_association_chain
|
30
|
+
@voteable
|
31
|
+
end
|
32
|
+
|
27
33
|
def collection
|
28
34
|
@votes = (@votes || end_of_association_chain).page(params[:page]).merge(@search.scoped)
|
29
35
|
end
|
30
36
|
|
37
|
+
def find_voteable
|
38
|
+
klass = params[:voteable_type].to_s.classify.constantize
|
39
|
+
@voteable = klass.find(params[:voteable_id])
|
40
|
+
end
|
41
|
+
|
31
42
|
def make_filter
|
32
43
|
@search = Sunrise::ModelFilter.new(BallotBox::Vote, :attributes => [ :voter_type, :voter_id, :ip_address,
|
33
44
|
:browser_name, :browser_version, :browser_platform])
|
34
45
|
@search.update_attributes(params[:search])
|
35
46
|
end
|
47
|
+
|
48
|
+
def voteable_scope(record)
|
49
|
+
{ :voteable_id => record.id, :voteable_type => record.class.name }
|
50
|
+
end
|
36
51
|
end
|
@@ -4,7 +4,8 @@
|
|
4
4
|
|
5
5
|
<%= cookie_content_tag(:div, :id=>"block_filter", :class=>"filt") do %>
|
6
6
|
<%= form_for @search, :as => :search, :url => manage_ballot_box_votes_path, :html=>{:method=>:get, :id=>"form_filter"} do |f| %>
|
7
|
-
<%= hidden_field_tag "
|
7
|
+
<%= hidden_field_tag "voteable_id", @voteable.id %>
|
8
|
+
<%= hidden_field_tag "voteable_type", @voteable.class.name %>
|
8
9
|
|
9
10
|
<%= f.label :ip_address, t('activerecord.attributes.vote.ip_address') %>
|
10
11
|
<%= f.text_field :ip_address, :class=>"text" %>
|
@@ -16,9 +17,11 @@
|
|
16
17
|
<%= f.text_field :browser_platform, :class=>"text" %>
|
17
18
|
|
18
19
|
<div class="buts">
|
19
|
-
<%=
|
20
|
-
|
21
|
-
|
20
|
+
<%= content_tag(:button, :value => "search", :type => "submit", :name => "commit", :class => "gr cupid-green") do %>
|
21
|
+
<%= t('manage.model_filter.search') %>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<%= link_to t('manage.model_filter.clear'), manage_ballot_box_votes_path( voteable_scope(@voteable) ), :class=>"erase" %>
|
22
25
|
</div>
|
23
26
|
<% end %>
|
24
27
|
<% end %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= content_tag(:div, :id=>dom_id(vote), :class=>"dinamic-bl") do %>
|
2
2
|
<div class="act-bl" style="display:none;">
|
3
3
|
<%= link_to image_tag("manage/ico_del.gif", :title=>t('manage.delete')),
|
4
|
-
manage_ballot_box_vote_path(:id => vote.id
|
4
|
+
manage_ballot_box_vote_path( voteable_scope(@voteable).merge(:id => vote.id) ),
|
5
5
|
:method=>:delete, :confirm=>t("manage.confirm_delete"), :class=>"icons" %>
|
6
6
|
</div>
|
7
7
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<div class="row-container">
|
5
5
|
<div class="white-row">
|
6
6
|
<div class="r-corn">
|
7
|
-
<%= link_to
|
7
|
+
<%= link_to @voteable.title, manage_ballot_box_votes_path( voteable_scope(@voteable) ), :class=>"dark-text" %>
|
8
8
|
</div>
|
9
9
|
</div>
|
10
10
|
</div>
|
@@ -8,10 +8,10 @@
|
|
8
8
|
|
9
9
|
<div class="edit-bl">
|
10
10
|
<div class="bot-bg">
|
11
|
-
<div id="voteable_title" class="block-title"><%=
|
11
|
+
<div id="voteable_title" class="block-title"><%= @voteable.title %></div>
|
12
12
|
|
13
13
|
<div class="edit-cont">
|
14
|
-
<%= link_to t('manage.sunrise.votes.view'), manage_ballot_box_votes_path(
|
14
|
+
<%= link_to t('manage.sunrise.votes.view'), manage_ballot_box_votes_path( voteable_scope(@voteable) ) %>
|
15
15
|
|
16
16
|
<div id="chart_dates" style="height:400px;width:800px;"></div>
|
17
17
|
</div>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunrise-votes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Igor Galeta
|
@@ -16,9 +16,11 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-05-
|
19
|
+
date: 2011-05-31 00:00:00 +03:00
|
20
|
+
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
23
|
+
type: :runtime
|
22
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
25
|
none: false
|
24
26
|
requirements:
|
@@ -28,11 +30,11 @@ dependencies:
|
|
28
30
|
segments:
|
29
31
|
- 0
|
30
32
|
version: "0"
|
31
|
-
version_requirements: *id001
|
32
|
-
type: :runtime
|
33
33
|
name: ballot_box
|
34
|
+
version_requirements: *id001
|
34
35
|
prerelease: false
|
35
36
|
- !ruby/object:Gem::Dependency
|
37
|
+
type: :runtime
|
36
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
37
39
|
none: false
|
38
40
|
requirements:
|
@@ -42,9 +44,8 @@ dependencies:
|
|
42
44
|
segments:
|
43
45
|
- 0
|
44
46
|
version: "0"
|
45
|
-
version_requirements: *id002
|
46
|
-
type: :runtime
|
47
47
|
name: sunrise
|
48
|
+
version_requirements: *id002
|
48
49
|
prerelease: false
|
49
50
|
description: Sunrise is a Aimbulance CMS
|
50
51
|
email: galeta.igor@gmail.com
|
@@ -127,6 +128,7 @@ files:
|
|
127
128
|
- lib/sunrise/votes.rb
|
128
129
|
- lib/sunrise/votes/engine.rb
|
129
130
|
- lib/sunrise/votes/version.rb
|
131
|
+
has_rdoc: true
|
130
132
|
homepage: https://github.com/galetahub/sunrise-votes
|
131
133
|
licenses: []
|
132
134
|
|
@@ -156,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
158
|
requirements: []
|
157
159
|
|
158
160
|
rubyforge_project:
|
159
|
-
rubygems_version: 1.
|
161
|
+
rubygems_version: 1.6.2
|
160
162
|
signing_key:
|
161
163
|
specification_version: 3
|
162
164
|
summary: Rails CMS
|