Skip to content

Commit

Permalink
Merge branch 'master' of github.com:polarina/deildu
Browse files Browse the repository at this point in the history
  • Loading branch information
polarina committed Aug 21, 2012
2 parents 106521d + c6efa6e commit 386bde3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/models/ban.rb
@@ -1,7 +1,8 @@
class Ban < ActiveRecord::Base
belongs_to :user

attr_accessible :address
attr_accessible :address,
:reason

validates :address,
:uniqueness => true,
Expand Down
4 changes: 4 additions & 0 deletions app/views/bans/_form.html.haml
Expand Up @@ -11,5 +11,9 @@
= f.label :address, "Vistfang"
= f.text_field :address

%div
= f.label :reason, "Ástæða"
= f.text_field :reason

%div
= f.submit "Vista"
6 changes: 4 additions & 2 deletions app/views/bans/index.html.haml
Expand Up @@ -9,14 +9,16 @@
%tr
%th Skráð
%th.nowrap Skráð af
%th.expand Subnet
%th.nowrap Subnet
%th.expand Ástæða
%tbody
- @bans.each do |ban|
%tr
%td.nowrap= ban.created_at
%td= link_to ban.user.username, ban.user
%td= link_to ban.address, ban
%td= ban.reason
- if @bans.empty?
%tr
%td.notice{:colspan => 3}
%td.notice{:colspan => 4}
Engin bönn.
3 changes: 3 additions & 0 deletions app/views/bans/show.html.haml
Expand Up @@ -14,3 +14,6 @@

%dt Skráð af
%dd= link_to @ban.user.username, @ban.user

%dt Ástæða
%dd= @ban.reason
5 changes: 5 additions & 0 deletions db/migrate/20120821054100_add_reason_to_bans.rb
@@ -0,0 +1,5 @@
class AddReasonToBans < ActiveRecord::Migration
def change
add_column :bans, :reason, :string, :default => "", :null => false
end
end

0 comments on commit 386bde3

Please sign in to comment.