Permalink
Browse files

Merge branch 'master' of github.com:caseywebdev/blackmailr

  • Loading branch information...
2 parents 352fb48 + e664792 commit 045d26428c7eb984dd168992a4c94d322ececc65 @KSoto KSoto committed Apr 18, 2012
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -21,7 +21,12 @@ class Blackmail < ActiveRecord::Base
# Validations
validates :victim_email, email: true
validate :at_least_one_demand
-
+
+ # Concat demands
+ def concat_demands
+ demands.collect { |d| d.description }.join "\n"
+ end
+
private
def at_least_one_demand
@@ -1,41 +0,0 @@
-%h1 Create Blackmail
-= form_for(@blackmail, :html => {:multipart => true}) do |f|
- = render 'shared/error_messages', :object => f.object
- .field
- = f.hidden_field(:user_id, :value => @user_id)
- .field
- = f.label :title
- %br
- = f.text_field :title
- .field
- = f.label :description
- %br
- = f.text_area(:description, :rows => 3)
- .field
- = f.label :victim_name
- %br
- = f.text_field :victim_name
- .field
- = f.label :victim_email
- %br
- = f.text_field :victim_email
- .field
- = f.label :specify_blackmail_expiration_time
- %br
- Date:
- = f.date_select :expired_at
- Time:
- = f.time_select :expired_at, :ignore_date => true
- .field
- = fields_for :demands do |builder|
- = builder.label 'List your demands. Use a new line to separate multiple demands.'
- = builder.text_area :description, rows: 3
- .field
- - 5.times do |i|
- = label_tag :blackmail_image
- %br
- = file_field_tag "images_#{i}", :accept => 'image/png,image/gif,image/jpeg'
- %br
- .actions
- = f.submit "That's Blackmail!"
- %br
@@ -27,12 +27,10 @@
Time:
= f.time_select :expired_at, :ignore_date => true
.field
- - for i in 0..@count
- = f.fields_for :demands, @blackmail.demands[i] do |builder|
- %br
- = builder.label 'Demand'
- %br
- = builder.text_field :description, rows: 3
+ %br
+ = f.label :concat_demands, 'Demands'
+ %br
+ = f.text_area :concat_demands, rows: 3
.field
- 5.times do |i|
= label_tag :blackmail_image
@@ -1 +1,41 @@
-= render :partial => 'form'
+%h1 Create Blackmail
+= form_for(@blackmail, :html => {:multipart => true}) do |f|
+ = render 'shared/error_messages', :object => f.object
+ .field
+ = f.hidden_field(:user_id, :value => @user_id)
+ .field
+ = f.label :title
+ %br
+ = f.text_field :title
+ .field
+ = f.label :description
+ %br
+ = f.text_area(:description, :rows => 3)
+ .field
+ = f.label :victim_name
+ %br
+ = f.text_field :victim_name
+ .field
+ = f.label :victim_email
+ %br
+ = f.text_field :victim_email
+ .field
+ = f.label :specify_blackmail_expiration_time
+ %br
+ Date:
+ = f.date_select :expired_at
+ Time:
+ = f.time_select :expired_at, :ignore_date => true
+ .field
+ = fields_for :demands do |builder|
+ = builder.label 'List your demands. Use a new line to separate multiple demands.'
+ = builder.text_area :description, rows: 3
+ .field
+ - 5.times do |i|
+ = label_tag :blackmail_image
+ %br
+ = file_field_tag "images_#{i}", :accept => 'image/png,image/gif,image/jpeg'
+ %br
+ .actions
+ = f.submit "That's Blackmail!"
+ %br

0 comments on commit 045d264

Please sign in to comment.