feature_box 0.8.1
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/CHANGELOG.rdoc +1 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +107 -0
- data/app/assets/javascripts/feature_box/application.js +39 -0
- data/app/assets/stylesheets/feature_box/application.css.scss +133 -0
- data/app/assets/stylesheets/feature_box/comments.css.scss +41 -0
- data/app/assets/stylesheets/feature_box/mixins.css.scss +37 -0
- data/app/assets/stylesheets/feature_box/suggestions.css.scss +110 -0
- data/app/controllers/feature_box/application_controller.rb +37 -0
- data/app/controllers/feature_box/categories_controller.rb +43 -0
- data/app/controllers/feature_box/comments_controller.rb +46 -0
- data/app/controllers/feature_box/devise/passwords_controller.rb +4 -0
- data/app/controllers/feature_box/devise/redirects.rb +21 -0
- data/app/controllers/feature_box/devise/registrations_controller.rb +4 -0
- data/app/controllers/feature_box/devise/sessions_controller.rb +4 -0
- data/app/controllers/feature_box/home_controller.rb +8 -0
- data/app/controllers/feature_box/suggestions_controller.rb +161 -0
- data/app/controllers/feature_box/users_controller.rb +32 -0
- data/app/helpers/feature_box/application_helper.rb +40 -0
- data/app/mailers/feature_box/devise/mailer.rb +3 -0
- data/app/models/feature_box/ability.rb +25 -0
- data/app/models/feature_box/category.rb +15 -0
- data/app/models/feature_box/comment.rb +15 -0
- data/app/models/feature_box/suggestion.rb +113 -0
- data/app/models/feature_box/user.rb +61 -0
- data/app/models/feature_box/vote.rb +6 -0
- data/app/views/feature_box/categories/_form.html.haml +14 -0
- data/app/views/feature_box/categories/edit.html.haml +3 -0
- data/app/views/feature_box/categories/index.html.haml +26 -0
- data/app/views/feature_box/categories/new.html.haml +3 -0
- data/app/views/feature_box/comments/_comment.html.haml +9 -0
- data/app/views/feature_box/comments/_new.html.haml +9 -0
- data/app/views/feature_box/comments/edit.html.haml +17 -0
- data/app/views/feature_box/comments/index.html.haml +8 -0
- data/app/views/feature_box/devise/_links.html.haml +9 -0
- data/app/views/feature_box/devise/confirmations/new.html.haml +7 -0
- data/app/views/feature_box/devise/mailer/confirmation_instructions.html.haml +4 -0
- data/app/views/feature_box/devise/mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/feature_box/devise/mailer/unlock_instructions.html.haml +5 -0
- data/app/views/feature_box/devise/passwords/edit.html.haml +7 -0
- data/app/views/feature_box/devise/passwords/new.html.haml +5 -0
- data/app/views/feature_box/devise/registrations/edit.html.haml +16 -0
- data/app/views/feature_box/devise/registrations/new.html.haml +8 -0
- data/app/views/feature_box/devise/sessions/new.html.haml +8 -0
- data/app/views/feature_box/shared/_pages_nav.html.haml +6 -0
- data/app/views/feature_box/suggestions/_form.html.haml +30 -0
- data/app/views/feature_box/suggestions/_order_nav.html.haml +6 -0
- data/app/views/feature_box/suggestions/_search.html.haml +4 -0
- data/app/views/feature_box/suggestions/_suggestion.html.haml +31 -0
- data/app/views/feature_box/suggestions/edit.html.haml +3 -0
- data/app/views/feature_box/suggestions/index.html.haml +27 -0
- data/app/views/feature_box/suggestions/new.html.haml +6 -0
- data/app/views/feature_box/suggestions/show.html.haml +2 -0
- data/app/views/feature_box/users/edit.html.haml +14 -0
- data/app/views/feature_box/users/index.html.haml +24 -0
- data/app/views/layouts/feature_box/application.html.haml +81 -0
- data/config/initializers/devise.rb +3 -0
- data/config/routes.rb +35 -0
- data/db/seeds.rb +11 -0
- data/lib/feature_box.rb +72 -0
- data/lib/feature_box/engine.rb +5 -0
- data/lib/feature_box/helpers.rb +49 -0
- data/lib/feature_box/version.rb +3 -0
- data/lib/generators/feature_box/existing_generator.rb +26 -0
- data/lib/generators/feature_box/generator_base.rb +47 -0
- data/lib/generators/feature_box/initializer_generator.rb +14 -0
- data/lib/generators/feature_box/migrations_generator.rb +25 -0
- data/lib/generators/feature_box/standalone_generator.rb +27 -0
- data/lib/generators/feature_box/templates/initializers/initializer.rb +32 -0
- data/lib/generators/feature_box/templates/initializers/new_devise_initializer.rb +8 -0
- data/lib/generators/feature_box/templates/migrations/00_create_feature_box_suggestions.rb +15 -0
- data/lib/generators/feature_box/templates/migrations/01_create_feature_box_categories.rb +9 -0
- data/lib/generators/feature_box/templates/migrations/02_create_feature_box_comments.rb +13 -0
- data/lib/generators/feature_box/templates/migrations/03_create_feature_box_votes.rb +12 -0
- data/lib/generators/feature_box/templates/migrations/04_create_feature_box_users.rb +10 -0
- data/lib/generators/feature_box/templates/migrations/05_add_devise_to_feature_box_users.rb +50 -0
- data/lib/generators/feature_box/templates/migrations/06_add_type_to_{model_name}.rb +5 -0
- data/lib/generators/feature_box/views_generator.rb +14 -0
- data/lib/tasks/feature_box_tasks.rake +9 -0
- data/test/existing-template/application.html.erb +40 -0
- data/test/existing-template/application_helper.rb +11 -0
- data/test/existing-template/index.html.erb +1 -0
- data/test/run-all-tests.sh +7 -0
- data/test/template.rb +29 -0
- data/vendor/assets/stylesheets/bootstrap.min.css +689 -0
- metadata +250 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module FeatureBox
|
|
2
|
+
class Category < ActiveRecord::Base
|
|
3
|
+
attr_accessible :name
|
|
4
|
+
has_many :suggestions, :dependent => :destroy
|
|
5
|
+
|
|
6
|
+
validates :name, :presence => true, :length => {
|
|
7
|
+
:maximum => Settings.max_category_name_chars
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@@default=Category.new :name=>"All Suggestions"
|
|
11
|
+
def self.default
|
|
12
|
+
@@default
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module FeatureBox
|
|
2
|
+
class Comment < ActiveRecord::Base
|
|
3
|
+
belongs_to :user
|
|
4
|
+
belongs_to :suggestion
|
|
5
|
+
attr_accessible :text
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
validates :text, :presence => true, :length => {
|
|
9
|
+
:maximum => Settings.max_comment_chars
|
|
10
|
+
}
|
|
11
|
+
validates :user, :presence => true
|
|
12
|
+
validates :suggestion, :presence => true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
module FeatureBox
|
|
2
|
+
class Suggestion < ActiveRecord::Base
|
|
3
|
+
attr_accessible :title, :description, :status
|
|
4
|
+
|
|
5
|
+
belongs_to :user, :class_name=>"FeatureBox::User"
|
|
6
|
+
belongs_to :category
|
|
7
|
+
|
|
8
|
+
has_many :votes, :dependent => :destroy
|
|
9
|
+
has_many :comments, :dependent => :destroy
|
|
10
|
+
|
|
11
|
+
validates :title, :presence => true, :length => {
|
|
12
|
+
:maximum => Settings.max_suggestion_header_chars
|
|
13
|
+
}
|
|
14
|
+
validates :description, :presence => true, :length => {
|
|
15
|
+
:maximum => Settings.max_suggestion_description_chars
|
|
16
|
+
}
|
|
17
|
+
validates :user, :presence => true
|
|
18
|
+
validates :category, :presence => true
|
|
19
|
+
validates_inclusion_of :status, :in => [:default, :in_progress, :complete]
|
|
20
|
+
|
|
21
|
+
after_save :add_first_vote
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def status
|
|
25
|
+
read_attribute(:status).to_sym
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def status= (value)
|
|
29
|
+
write_attribute(:status, value.to_s)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def user_votes(user)
|
|
33
|
+
Vote.where(:suggestion_id=>id,:user_id=>user.id).size()
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def vote(user)
|
|
37
|
+
if user.votes_left > 0 && user.can_vote?(self)
|
|
38
|
+
v=Vote.new
|
|
39
|
+
v.user=user
|
|
40
|
+
v.suggestion=self
|
|
41
|
+
v.save
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.find_those_with hash
|
|
46
|
+
category = hash[:category]
|
|
47
|
+
order_type = hash[:order_type]
|
|
48
|
+
limit = hash[:limit]
|
|
49
|
+
offset = hash[:offset]
|
|
50
|
+
|
|
51
|
+
category_filter = if category.id then Suggestion.where(:category_id => category.id) else Suggestion end
|
|
52
|
+
|
|
53
|
+
case order_type
|
|
54
|
+
when :most_popular
|
|
55
|
+
where_part = "WHERE status <> 'complete' "
|
|
56
|
+
if category.id!=nil then
|
|
57
|
+
where_part += "AND #{self.table_name}.category_id = #{category.id.to_s}"
|
|
58
|
+
end
|
|
59
|
+
suggestions = Suggestion.find_by_sql(
|
|
60
|
+
"SELECT COUNT(*) AS count_all, #{self.table_name}.*
|
|
61
|
+
FROM #{self.table_name}
|
|
62
|
+
INNER JOIN #{Vote.table_name}
|
|
63
|
+
ON #{Vote.table_name}.suggestion_id = #{self.table_name}.id
|
|
64
|
+
#{where_part}
|
|
65
|
+
GROUP BY #{self.table_name}.id
|
|
66
|
+
ORDER BY count_All DESC
|
|
67
|
+
LIMIT #{limit.to_s} OFFSET #{offset.to_s}")
|
|
68
|
+
total = category_filter.where("status <> ?", :complete).size
|
|
69
|
+
when :in_progress, :complete
|
|
70
|
+
suggestions = category_filter.where(:status => order_type).order("created_at DESC").limit(limit).offset(offset)
|
|
71
|
+
total = category_filter.where(:status => order_type).size
|
|
72
|
+
when :newest
|
|
73
|
+
suggestions = category_filter.where("status <> ?", :complete).order("created_at DESC").limit(limit).offset(offset)
|
|
74
|
+
total = category_filter.where("status <> ?", :complete).size
|
|
75
|
+
else
|
|
76
|
+
raise ArgumentError.new("Unknown order_type")
|
|
77
|
+
end
|
|
78
|
+
return suggestions, total
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def self.find_my type_of_impact, hash
|
|
82
|
+
|
|
83
|
+
user = hash[:user]
|
|
84
|
+
limit = hash[:limit]
|
|
85
|
+
offset = hash[:offset]
|
|
86
|
+
case type_of_impact
|
|
87
|
+
when :suggestions
|
|
88
|
+
suggestions = user.suggestions.order("created_at DESC").limit(limit).offset(offset)
|
|
89
|
+
total = user.suggestions.size
|
|
90
|
+
when :votes, :comments
|
|
91
|
+
impact_table_name = eval("FeatureBox::"+type_of_impact.to_s.capitalize.chomp("s")).table_name
|
|
92
|
+
suggestions = Suggestion.joins(type_of_impact).where("#{impact_table_name}.user_id = ?",user.id).order("created_at DESC").uniq.limit(limit).offset(offset)
|
|
93
|
+
total = Suggestion.count_by_sql(["SELECT COUNT(DISTINCT #{self.table_name}.id) FROM #{self.table_name} INNER JOIN #{impact_table_name} ON #{impact_table_name}.suggestion_id = #{self.table_name}.id WHERE #{self.table_name}.user_id = ?", user.id])
|
|
94
|
+
else
|
|
95
|
+
raise ArgumentError.new("Unknown type of impact")
|
|
96
|
+
end
|
|
97
|
+
return suggestions, total
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
private
|
|
102
|
+
def add_first_vote
|
|
103
|
+
if(self.votes.size == 0)
|
|
104
|
+
v = Vote.new
|
|
105
|
+
v.suggestion = self
|
|
106
|
+
v.user = self.user
|
|
107
|
+
v.save
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
end
|
|
113
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module FeatureBox
|
|
2
|
+
class User < Settings.devise_parent_model.safe_constantize
|
|
3
|
+
|
|
4
|
+
devise :database_authenticatable, :registerable, :recoverable,
|
|
5
|
+
:rememberable, :trackable, :validatable
|
|
6
|
+
|
|
7
|
+
has_many :suggestions, :dependent => :destroy
|
|
8
|
+
has_many :comments, :dependent => :destroy
|
|
9
|
+
has_many :votes, :dependent => :destroy
|
|
10
|
+
|
|
11
|
+
attr_accessible :name, :email, :password, :password_confirmation, :remember_me
|
|
12
|
+
|
|
13
|
+
def can_vote? suggestion
|
|
14
|
+
if !Settings.can_vote_own_suggestions && suggestion.user == self
|
|
15
|
+
return false
|
|
16
|
+
end
|
|
17
|
+
if votes_left <= 0 then
|
|
18
|
+
return false
|
|
19
|
+
end
|
|
20
|
+
if Settings.per_suggestion_limit == -1
|
|
21
|
+
return true
|
|
22
|
+
else
|
|
23
|
+
return Vote.where(:user_id => id, :suggestion_id=>suggestion.id).size < Settings.per_suggestion_limit
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def votes_left
|
|
28
|
+
if Settings.total_limit == -1 then
|
|
29
|
+
return 100
|
|
30
|
+
end
|
|
31
|
+
condition = Settings.time_limit.ago
|
|
32
|
+
used = Vote.where("user_id = ? AND created_at > ?", self.id, condition).size
|
|
33
|
+
return Settings.total_limit - used
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def can_vote_date
|
|
37
|
+
condition = Settings.time_limit.ago
|
|
38
|
+
last_vote = Vote.where("user_id = ? AND created_at > ?", self.id, condition).order("created_at ASC").limit(1).first
|
|
39
|
+
return last_vote.created_at.in(Settings.time_limit)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def method_missing(method, *args, &block)
|
|
43
|
+
if method == :name
|
|
44
|
+
self.errors[:base] << ("You need to define 'name' and other methods in your User model")
|
|
45
|
+
"You need to define 'name' and other methods in your User model"
|
|
46
|
+
elsif method == :name=
|
|
47
|
+
self.errors[:base] << ("You need to define 'name=' and other methods in your User model")
|
|
48
|
+
false
|
|
49
|
+
elsif method == :admin?
|
|
50
|
+
self.errors[:base] << ("You need to define 'admin?' and other methods in your User model")
|
|
51
|
+
false
|
|
52
|
+
elsif method == :admin=
|
|
53
|
+
self.errors[:base] << ("You need to define 'admin=' and other methods in your User model")
|
|
54
|
+
false
|
|
55
|
+
else
|
|
56
|
+
super
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
- if @category.errors.any?
|
|
2
|
+
.alert.alert-error
|
|
3
|
+
%h4
|
|
4
|
+
= pluralize(@category.errors.count, "error")
|
|
5
|
+
prohibited this category from being saved:
|
|
6
|
+
%ul
|
|
7
|
+
- @category.errors.full_messages.each do |msg|
|
|
8
|
+
%li= msg
|
|
9
|
+
.well
|
|
10
|
+
= form_for(@category, :html =>{:class=>'form-horizontal '}) do |f|
|
|
11
|
+
%legend= yield :header
|
|
12
|
+
- clazz="span5"
|
|
13
|
+
= generate_form_element f, :name, f.text_field(:name, :class=>clazz)
|
|
14
|
+
= generate_form_element f, nil, f.submit(:class=>"btn btn-primary")
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
%ul.nav.nav-tabs.table-nav
|
|
2
|
+
= render "feature_box/shared/pages_nav"
|
|
3
|
+
#categories
|
|
4
|
+
- if @real_categories.empty?
|
|
5
|
+
%div.empty Nothing found
|
|
6
|
+
- else
|
|
7
|
+
%table.table.table-striped
|
|
8
|
+
%thead
|
|
9
|
+
%tr
|
|
10
|
+
%th
|
|
11
|
+
%th Categories
|
|
12
|
+
%th Number of suggestions
|
|
13
|
+
%th
|
|
14
|
+
%th
|
|
15
|
+
%tbody
|
|
16
|
+
- n = @offset
|
|
17
|
+
- @real_categories.each do |category|
|
|
18
|
+
%tr
|
|
19
|
+
%td= n+=1
|
|
20
|
+
%td= category.name
|
|
21
|
+
%td= category.suggestions.size
|
|
22
|
+
%td= link_to "edit", edit_category_path(category)
|
|
23
|
+
%td= link_to "delete", category, :confirm => 'Are you sure? This will delete ALL suggestions with category '+category.name, :method=>"delete", :class=>"link danger"
|
|
24
|
+
|
|
25
|
+
.new-btn
|
|
26
|
+
= link_to 'New Category', new_category_path, :class=>"btn btn-large"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
.comment
|
|
2
|
+
.comment-date
|
|
3
|
+
= distance_of_time_in_words_to_now(comment.created_at)
|
|
4
|
+
ago
|
|
5
|
+
.comment-edit
|
|
6
|
+
- if can?(:update, comment) || can?(:destroy, comment)
|
|
7
|
+
= link_to "edit", edit_suggestion_comment_path(comment.suggestion,comment)
|
|
8
|
+
.comment-user= comment.user.name
|
|
9
|
+
.comment-text= multiline comment.text
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
- if user_signed_in? then
|
|
2
|
+
= form_for([@suggestion,c],:html =>{:class=>' well'}) do |f|
|
|
3
|
+
= generate_form_element( f, "Your comment:", f.text_area(:text,:size=>"10x5",:class=>"span8-5").gsub("
",""))
|
|
4
|
+
.pull-right.new-comment
|
|
5
|
+
= generate_form_element f, nil, f.submit(:class=>"btn btn-primary ")
|
|
6
|
+
.clearfix
|
|
7
|
+
- else
|
|
8
|
+
.center.alert.alert-info
|
|
9
|
+
= link_to "Sign in to comment", new_user_session_path
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
- if @comment.errors.any?
|
|
2
|
+
.alert.alert-error
|
|
3
|
+
%h4
|
|
4
|
+
= pluralize(@comment.errors.count, "error")
|
|
5
|
+
prohibited this comment from being saved:
|
|
6
|
+
%ul
|
|
7
|
+
- @comment.errors.full_messages.each do |msg|
|
|
8
|
+
%li= msg
|
|
9
|
+
.well
|
|
10
|
+
= form_for(@comment, :url => suggestion_comment_path(@comment.suggestion, @comment)) do |f|
|
|
11
|
+
%legend Editing comment
|
|
12
|
+
= generate_form_element( f, nil, f.text_area(:text,:size=>"10x5",:class=>"span8-5"))
|
|
13
|
+
.pull-right.new-comment
|
|
14
|
+
= f.submit(:class=>"btn btn-primary ")
|
|
15
|
+
= link_to("Delete", suggestion_comment_path(@comment.suggestion, @comment), :method=>:delete, :class=>"btn btn-danger", :confirm => 'Are you sure?')
|
|
16
|
+
.clearfix
|
|
17
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
%ul#comments-nav.nav.nav-tabs
|
|
2
|
+
= render :partial => "feature_box/shared/pages_nav"
|
|
3
|
+
#comments
|
|
4
|
+
- @comments.each do |comment|
|
|
5
|
+
= render comment
|
|
6
|
+
- if @comments.empty?
|
|
7
|
+
.empty No comments here yet. Write one
|
|
8
|
+
= render :partial =>'feature_box/comments/new', :locals => {:c=>FeatureBox::Comment.new}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
- if controller_name != 'sessions'
|
|
2
|
+
= link_to "Sign in", feature_box.new_user_session_path
|
|
3
|
+
%br/
|
|
4
|
+
- if devise_mapping.registerable? && controller_name != 'registrations'
|
|
5
|
+
= link_to "Sign up", feature_box.new_user_registration_path
|
|
6
|
+
%br/
|
|
7
|
+
- if devise_mapping.recoverable? && controller_name != 'passwords'
|
|
8
|
+
= link_to "Forgot your password?", feature_box.new_user_password_path
|
|
9
|
+
%br/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
%h2 Resend confirmation instructions
|
|
2
|
+
= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post, :class=>"form-horizontal well" }) do |f|
|
|
3
|
+
.alert.alert-error
|
|
4
|
+
= devise_error_messages!
|
|
5
|
+
= generate_form_element f,'Your name', f.email_field(:email)
|
|
6
|
+
= generate_form_element f,nil, f.submit("Resend confirmation instructions", :class=>"btn btn-primary")
|
|
7
|
+
= render "links"
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
%p
|
|
2
|
+
Hello #{@resource.email}!
|
|
3
|
+
%p Someone has requested a link to change your password, and you can do this through the link below.
|
|
4
|
+
%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)
|
|
5
|
+
%p If you didn't request this, please ignore this email.
|
|
6
|
+
%p Your password won't change until you access the link above and create a new one.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
%p
|
|
2
|
+
Hello #{@resource.email}!
|
|
3
|
+
%p Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
|
|
4
|
+
%p Click the link below to unlock your account:
|
|
5
|
+
%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html=>{:method => :put, :class=>" well form-horizontal"}) do |f|
|
|
2
|
+
= f.hidden_field :reset_password_token
|
|
3
|
+
%legend Change your password
|
|
4
|
+
= generate_form_element f,'Password', f.password_field(:password)
|
|
5
|
+
= generate_form_element f,'Password confirmation', f.password_field(:password_confirmation)
|
|
6
|
+
= generate_form_element f,nil, f.submit("Change my password", :class=>"btn btn-primary")
|
|
7
|
+
= generate_form_element f,nil, render("feature_box/devise/links")
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html=>{:method => :post, :class=>" well form-horizontal"}) do |f|
|
|
2
|
+
%legend Forgot your password?
|
|
3
|
+
= generate_form_element f,'Email', f.email_field(:email)
|
|
4
|
+
= generate_form_element f,nil, f.submit("Send me reset password instructions", :class=>"btn btn-primary")
|
|
5
|
+
= generate_form_element f,nil, render("feature_box/devise/links")
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.well
|
|
2
|
+
= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class=>"form-horizontal" }) do |f|
|
|
3
|
+
%legend Change Email
|
|
4
|
+
= generate_form_element f, :name, f.text_field(:name)
|
|
5
|
+
= generate_form_element f, :email, f.email_field(:email)
|
|
6
|
+
= generate_form_element f, :current_password, f.password_field(:current_password)
|
|
7
|
+
= generate_form_element f, nil, f.submit("Update", :class=>"btn btn-primary")
|
|
8
|
+
= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class=>"form-horizontal" }) do |f|
|
|
9
|
+
%legend Change Password
|
|
10
|
+
= generate_form_element f,'New password', f.password_field(:password, :autocomplete => "off")
|
|
11
|
+
= generate_form_element f,'Confirmation', f.password_field(:password_confirmation)
|
|
12
|
+
= generate_form_element f,'Current password', f.password_field(:current_password)
|
|
13
|
+
= generate_form_element f,nil, f.submit("Update", :class=>"btn btn-primary")
|
|
14
|
+
= form_for(resource, :url => registration_path(resource_name),:html => {:class=>'form-horizontal', :method=>:delete}) do |f|
|
|
15
|
+
%legend Cancel my account
|
|
16
|
+
= generate_form_element f, "This cannot be undone", f.submit("Cancel My Account", :class=>"btn btn-danger")
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html=>{:class=>" well form-horizontal"}) do |f|
|
|
2
|
+
%legend Sign up
|
|
3
|
+
= generate_form_element f,'Your name', f.text_field(:name)
|
|
4
|
+
= generate_form_element f,'Email', f.email_field(:email)
|
|
5
|
+
= generate_form_element f,'Password', f.password_field(:password)
|
|
6
|
+
= generate_form_element f,'Password confirmation', f.password_field(:password_confirmation)
|
|
7
|
+
= generate_form_element f,nil, f.submit("Sign up", :class=>"btn btn-primary")
|
|
8
|
+
= generate_form_element f,nil, render("feature_box/devise/links")
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html=>{:class=>" well form-horizontal"}) do |f|
|
|
2
|
+
%legend Sign in
|
|
3
|
+
= generate_form_element f,'Email', f.email_field(:email)
|
|
4
|
+
= generate_form_element f,'Password', f.password_field(:password)
|
|
5
|
+
- if devise_mapping.rememberable?
|
|
6
|
+
= generate_form_element f, nil, '<label class="checkbox">'+f.check_box(:remember_me)+"Remember me</label>"
|
|
7
|
+
= generate_form_element f,nil, f.submit("Sign in", :class=>"btn btn-primary")
|
|
8
|
+
= generate_form_element f,nil, render("feature_box/devise/links")
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
- if @suggestion.errors.any?
|
|
2
|
+
.alert.alert-error
|
|
3
|
+
%h4
|
|
4
|
+
= pluralize(@suggestion.errors.count, "error")
|
|
5
|
+
prohibited this suggestion from being saved:
|
|
6
|
+
%ul
|
|
7
|
+
- @suggestion.errors.full_messages.each do |msg|
|
|
8
|
+
%li= msg
|
|
9
|
+
- if @categories.size >1
|
|
10
|
+
.well
|
|
11
|
+
= form_for(@suggestion, :html =>{:class=>'form-horizontal '}) do |f|
|
|
12
|
+
%legend= yield :header
|
|
13
|
+
- clazz="span5"
|
|
14
|
+
= generate_form_element f, :title, f.text_field(:title, :class=>clazz)
|
|
15
|
+
= generate_form_element f, :category, f.select(:category_id, options_for_select(@categories.slice(1..9999999).map { |category| [category.name, category.id] } ), :class=>clazz)
|
|
16
|
+
- if current_user.admin?
|
|
17
|
+
= generate_form_element f, :status, f.select(:status, options_for_select([["Default", :default], ["In Progress", :in_progress], ["Complete",:complete]]))
|
|
18
|
+
= generate_form_element f, :description, f.text_area(:description, :class=>clazz,:size => "x5")
|
|
19
|
+
= generate_form_element f, nil, f.submit(:class=>"btn btn-primary")
|
|
20
|
+
- if controller.action_name=="edit"
|
|
21
|
+
= form_for(@suggestion, :html =>{:class=>'form-horizontal '}) do |f|
|
|
22
|
+
%legend Deleting suggestion
|
|
23
|
+
= generate_form_element f, "This cannot be undone", link_to("Delete", @suggestion, :method=>:delete, :class=>"btn btn-danger")
|
|
24
|
+
- else
|
|
25
|
+
- if current_user.admin?
|
|
26
|
+
.empty You need to create a category first
|
|
27
|
+
.new-btn
|
|
28
|
+
= link_to 'New Category', new_category_path, :class=>"btn btn-large"
|
|
29
|
+
- else
|
|
30
|
+
.empty Tell administrator, that he needs to create a category first
|