Class: ODDB::View::FeedbackForm

Inherits:
Form
  • Object
show all
Includes:
HtmlGrid::ErrorMessage, HtmlGrid::InfoMessage, Captcha
Defined in:
src/view/feedbacks.rb

Direct Known Subclasses

Drugs::FeedbackForm, Migel::FeedbackForm

Constant Summary

CSS_MAP =
{
  [0,0,2,15]    =>  'list top',
  [1,4,1,15]    =>  'radio',
}
COLSPAN_MAP =
{
  [1,0] =>  2,
  [1,1] =>  2,
  [1,5] =>  2,
  [1,15]  => 2,
}
CSS_CLASS =
'composite top'
LABELS =
true
EVENT =
:update
LEGACY_INTERFACE =
false

Constants included from FormMethods

ACCEPT_CHARSET, DEFAULT_CLASS, EVENT

Instance Method Summary (collapse)

Methods included from Captcha

#captcha, #captcha_image, #challenge

Methods included from FormMethods

#delete_item, #delete_item_warn, #get_event_button, #post_event_button

Instance Method Details

- (Object) experience(model)



46
47
48
# File 'src/view/feedbacks.rb', line 46

def experience(model)
  radio_good(:experience)
end

- (Object) experience_bad(model)



49
50
51
# File 'src/view/feedbacks.rb', line 49

def experience_bad(model)
  radio_bad(:experience)
end

- (Object) feedback_text_e(model)



70
71
72
73
74
75
76
77
78
79
# File 'src/view/feedbacks.rb', line 70

def (model)
  input = HtmlGrid::Textarea.new(:message, model, @session, self)
  input.set_attribute('cols', 53)
  input.set_attribute('rows', 4)
  input.set_attribute('wrap', true)
  js = "if(this.value.length > 800) { (this.value = this.value.substr(0,800))}"
  input.set_attribute('onKeypress', js)
  input.label = true
  input
end

- (Object) helps(model)



52
53
54
# File 'src/view/feedbacks.rb', line 52

def helps(model)
  radio_good(:helps)
end

- (Object) helps_bad(model)



55
56
57
# File 'src/view/feedbacks.rb', line 55

def helps_bad(model)
  radio_bad(:helps)
end

- (Object) impression(model)



58
59
60
# File 'src/view/feedbacks.rb', line 58

def impression(model)
  radio_good(:impression)
end

- (Object) impression_bad(model)



61
62
63
# File 'src/view/feedbacks.rb', line 61

def impression_bad(model)
  radio_bad(:impression)
end

- (Object) init



35
36
37
38
39
40
41
42
43
44
45
# File 'src/view/feedbacks.rb', line 35

def init
  if(@session.state.passed_turing_test)
    components.update([1,15]=>:submit)
  else
    components.update([0,15]=>:captcha, [1,16]=>:captcha_image, [1,17]=>:submit)
    colspan_map.update([1,16]=>2, [1,17]=>2)
  end
  super
  error_message
  info_message
end

- (Object) radio_bad(bad_key)



86
87
88
89
90
91
92
93
94
95
# File 'src/view/feedbacks.rb', line 86

def radio_bad(bad_key)
  radio = HtmlGrid::InputRadio.new(bad_key, model, @session, self)
  if(model.send(bad_key).eql?(false) \
     || @session.user_input(bad_key).eql?(false))
    radio.set_attribute('checked', true)
  end
  radio.value = '0'
  radio.label = false
  radio
end

- (Object) radio_good(good_key)



96
97
98
99
100
101
102
103
# File 'src/view/feedbacks.rb', line 96

def radio_good(good_key)
  radio = HtmlGrid::InputRadio.new(good_key, model, @session, self)
  if(model.send(good_key) || @session.user_input(good_key))
    radio.set_attribute('checked', true)
  end
  radio.value = '1'
  radio
end

- (Object) recommend(model)



64
65
66
# File 'src/view/feedbacks.rb', line 64

def recommend(model)
  radio_good(:recommend)
end

- (Object) recommend_bad(model)



67
68
69
# File 'src/view/feedbacks.rb', line 67

def recommend_bad(model)
  radio_bad(:recommend)
end

- (Object) show_email(model)



80
81
82
# File 'src/view/feedbacks.rb', line 80

def show_email(model)
  radio_good(:show_email)
end

- (Object) show_email_bad(model)



83
84
85
# File 'src/view/feedbacks.rb', line 83

def show_email_bad(model)
  radio_bad(:show_email)
end