sunrise-feedbacks 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/manage/feedbacks_controller.rb +5 -8
- data/app/views/manage/feedback_answers/_answer.html.erb +1 -1
- data/app/views/manage/feedbacks/_feedback.html.erb +7 -3
- data/app/views/manage/feedbacks/_model_filter.html.erb +13 -15
- data/app/views/manage/feedbacks/show.html.erb +8 -3
- data/lib/sunrise/feedbacks/version.rb +1 -1
- data/lib/sunrise/models/feedback_message.rb +3 -1
- metadata +6 -8
@@ -1,11 +1,13 @@
|
|
1
1
|
class Manage::FeedbacksController < Manage::BaseController
|
2
2
|
inherit_resources
|
3
3
|
defaults :route_prefix => 'manage', :resource_class => FeedbackMessage
|
4
|
-
|
5
|
-
before_filter :make_filter, :only=>[:index]
|
6
4
|
|
7
5
|
load_and_authorize_resource :class => FeedbackMessage
|
8
6
|
|
7
|
+
has_scope :with_email, :as => :user_email, :only => :index
|
8
|
+
has_scope :with_phone, :as => :phone_number, :only => :index
|
9
|
+
order_by :created_at, :updated_at
|
10
|
+
|
9
11
|
def show
|
10
12
|
@feedbacks = @feedback.siblings
|
11
13
|
@feedback_answer = FeedbackAnswer.new
|
@@ -27,11 +29,6 @@ class Manage::FeedbacksController < Manage::BaseController
|
|
27
29
|
protected
|
28
30
|
|
29
31
|
def collection
|
30
|
-
@feedbacks = (@feedbacks || end_of_association_chain).
|
31
|
-
end
|
32
|
-
|
33
|
-
def make_filter
|
34
|
-
@search = Sunrise::ModelFilter.new(FeedbackMessage, :attributes => [:user_email, :phone_number])
|
35
|
-
@search.update_attributes(params[:search])
|
32
|
+
@feedbacks = (@feedbacks || end_of_association_chain).order(search_filter.order).page(params[:page])
|
36
33
|
end
|
37
34
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class="r-corn">
|
3
3
|
<div class="buttons" style="padding-top:0px;">
|
4
4
|
<div class="act-bl">
|
5
|
-
<%= link_to
|
5
|
+
<%= link_to manage_icon("delete"),
|
6
6
|
manage_feedback_answer_path(:id=>answer.id),
|
7
7
|
:method=>:delete,
|
8
8
|
:confirm=>t("manage.confirm_delete"),
|
@@ -1,9 +1,13 @@
|
|
1
1
|
<%= content_tag(:div, :id=>dom_id(feedback), :class=>"dinamic-bl") do %>
|
2
2
|
<div class="act-bl" style="display:none;">
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
<% if can? :update, feedback, :context => :manage %>
|
4
|
+
<%= link_to manage_icon("edit"), edit_manage_feedback_path(:id=>feedback.id), :class=>"icons" %>
|
5
|
+
<% end -%>
|
6
|
+
|
7
|
+
<% if can? :delete, feedback, :context => :manage %>
|
8
|
+
<%= link_to manage_icon("delete"), manage_feedback_path(:id=>feedback.id),
|
6
9
|
:method=>:delete, :confirm=>t("manage.confirm_delete"), :class=>"icons" %>
|
10
|
+
<% end -%>
|
7
11
|
</div>
|
8
12
|
|
9
13
|
<div class="bot-bg">
|
@@ -2,15 +2,15 @@
|
|
2
2
|
<div class="filt-bl">
|
3
3
|
<%= link_to_function t('manage.model_filter.title'), "Manage.toggle_element('block_filter')", :class=>"dark-arr" %>
|
4
4
|
|
5
|
+
<%= t('manage.model_filter.total_count') %>: <%= @feedbacks.total_count %>
|
6
|
+
|
5
7
|
<%= cookie_content_tag(:div, :id=>"block_filter", :class=>"filt") do %>
|
6
|
-
<%= form_for
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<%= f.text_field :user_email, :class=>"text" %>
|
13
|
-
|
8
|
+
<%= form_for search_filter, :url => manage_feedbacks_path, :html => { :method => :get } do |f| %>
|
9
|
+
<% controller.scopes_configuration.each do |key, value| %>
|
10
|
+
<%= f.label value[:as], t(value[:as], :scope => "activerecord.attributes.feedback_message") %>
|
11
|
+
<%= f.text_field value[:as], :class => "text", :name => value[:as] %>
|
12
|
+
<% end %>
|
13
|
+
|
14
14
|
<div class="buts">
|
15
15
|
<%= content_tag(:button, :value=>"search", :type=>"submit", :name=>"commit", :class=>"gr cupid-green") do %>
|
16
16
|
<%= t('manage.model_filter.search') %>
|
@@ -23,14 +23,12 @@
|
|
23
23
|
</div>
|
24
24
|
<div class="sort">
|
25
25
|
<label><%= t('manage.sort') %></label>
|
26
|
-
<div class="select-input"><%= link_to_function t(
|
26
|
+
<div class="select-input"><%= link_to_function t(search_filter.current_order, :scope => "manage.feedbacks.sort"), "SelectList.toggle(event)", :class=>"corn", :id=>'sort_select' %></div>
|
27
27
|
<div id='sort_select_list' class="select-list" style='display:none;'>
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
<%= link_to_sort(t('feedback_message.updated_at_desc', :scope => [:manage, :sort_columns], :default => :updated_at_desc), :name => "updated_at", :order_type => 'desc') %>
|
33
|
-
<%= link_to_sort(t('feedbacks.updated_at_asc', :scope => [:manage, :sort_columns], :default => :updated_at_asc), :name => "updated_at", :order_type => 'asc') %>
|
28
|
+
<% controller.orders_configuration.each do |key, value| %>
|
29
|
+
<%= link_to_sort(t("#{key}_desc", :scope => "manage.feedbacks.sort"), :name => key, :order_type=>'desc') %>
|
30
|
+
<%= link_to_sort(t("#{key}_asc", :scope => "manage.feedbacks.sort"), :name => key, :order_type=>'asc') %>
|
31
|
+
<% end %>
|
34
32
|
</div>
|
35
33
|
</div>
|
36
34
|
</div>
|
@@ -4,9 +4,14 @@
|
|
4
4
|
</div>
|
5
5
|
|
6
6
|
<div class="act-bl">
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
<% if can? :update, @feedback, :context => :manage %>
|
8
|
+
<%= link_to manage_icon("edit"), edit_manage_feedback_path(:id=>@feedback.id), :class=>"icons" %>
|
9
|
+
<% end -%>
|
10
|
+
|
11
|
+
<% if can? :delete, @feedback, :context => :manage %>
|
12
|
+
<%= link_to manage_icon("delete"), manage_feedback_path(:id=>@feedback.id),
|
13
|
+
:method=>:delete, :confirm=>t("manage.confirm_delete"), :class=>"icons" %>
|
14
|
+
<% end -%>
|
10
15
|
</div>
|
11
16
|
</div>
|
12
17
|
|
@@ -17,7 +17,9 @@ module Sunrise
|
|
17
17
|
|
18
18
|
default_scope order("#{quoted_table_name}.id DESC")
|
19
19
|
scope :recently, order("#{quoted_table_name}.created_at DESC")
|
20
|
-
scope :with_author, lambda { |item| where(
|
20
|
+
scope :with_author, lambda { |item| where(:author_type => item.author_type, :author_id => item.author_id) }
|
21
|
+
scope :with_email, lambda { |email| where(:user_email => email) }
|
22
|
+
scope :with_phone, lambda { |phone| where(:phone_number => phone) }
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunrise-feedbacks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Igor Galeta
|
@@ -16,8 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
20
|
-
default_executable:
|
19
|
+
date: 2012-04-12 00:00:00 Z
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: sunrise-cms
|
@@ -78,7 +77,6 @@ files:
|
|
78
77
|
- lib/sunrise-feedbacks.rb
|
79
78
|
- Rakefile
|
80
79
|
- README.rdoc
|
81
|
-
has_rdoc: true
|
82
80
|
homepage: https://github.com/galetahub/sunrise-feedbacks
|
83
81
|
licenses: []
|
84
82
|
|
@@ -108,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
106
|
requirements: []
|
109
107
|
|
110
108
|
rubyforge_project: sunrise-feedbacks
|
111
|
-
rubygems_version: 1.
|
109
|
+
rubygems_version: 1.8.10
|
112
110
|
signing_key:
|
113
111
|
specification_version: 3
|
114
112
|
summary: Rails CMS votes
|