diff --git a/trool/app/controllers/messages_controller.rb b/trool/app/controllers/messages_controller.rb index d0934f1..a3004c2 100644 --- a/trool/app/controllers/messages_controller.rb +++ b/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 diff --git a/trool/app/views/pos/show.html.erb b/trool/app/views/pos/show.html.erb index 302b91b..339c8cd 100644 --- a/trool/app/views/pos/show.html.erb +++ b/trool/app/views/pos/show.html.erb @@ -28,8 +28,7 @@ <%= 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 %> diff --git a/trool/public/stylesheets/po.css b/trool/public/stylesheets/po.css index 172a6d4..c0a0c23 100644 --- a/trool/public/stylesheets/po.css +++ b/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;