Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Commit

Permalink
Hack fuzzy checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
motiejus committed May 4, 2011
1 parent e7b1779 commit d1147df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions trool/app/controllers/messages_controller.rb
@@ -1,6 +1,14 @@
require 'ruby-debug'
class MessagesController < ApplicationController
def update
@msg = Message.find params[:id]

# TODO: learn ruby
fuzzy_arr = (params.keys.grep /fuzzy-\d+/) or []
fuzzy_bool = params[fuzzy_arr.first] == "1"

params[:msg] ||= {}
params[:msg].merge!( { :fuzzy => fuzzy_bool } )
@msg.update_attributes params[:msg]
render :nothing => true
end
Expand Down
3 changes: 1 addition & 2 deletions trool/app/views/pos/show.html.erb
Expand Up @@ -28,8 +28,7 @@
<td class="msgstuff">
<%= form_for :msg, :url => po_message_url(@po, msg),
:remote => true, :html => { :method => :put } do |f| %>
<%= f.check_box :fuzzy, :id => "fuzzy-bool-#{msg.id}",
:value => msg.fuzzy %>
<%= f.check_box :fuzzy, :name => "fuzzy-#{msg.id}", :checked => msg.fuzzy %>
<%= f.label :fuzzy %>
<% end %>
</td>
Expand Down
3 changes: 2 additions & 1 deletion trool/public/stylesheets/po.css
@@ -1,9 +1,10 @@
#messages * {
font-family: monospace;
}
#messages {
table#messages {
table-layout: fixed;
border-collapse: collapse;
width: 100%;
}
#messages td {
padding: 10px;
Expand Down

0 comments on commit d1147df

Please sign in to comment.