[10:02:54]  MarkUsBot joined #markus.
 [10:02:55]  #markus: mode change '+o MarkUsBot' by ChanServ!ChanServ@services.
 [12:35:04]  karenreid (~karenreid@64.231.18.126) joined #markus.
 [12:43:38]  karenreid (~karenreid@64.231.18.126) left irc: Remote host closed the connection
 [12:43:47]  karenreid (~karenreid@vpn-shaper00.cs.toronto.edu) joined #markus.
 [12:43:55]  #markus: mode change '+o karenreid' by MarkUsBot!~MarkUsBot@li136-145.members.linode.com
 [12:46:45]  karenreid (~karenreid@vpn-shaper00.cs.toronto.edu) left irc: Client Quit
 [13:32:58]  karenreid (~karenreid@208.113.48.188) joined #markus.
 [13:47:47]  aimenk (~aimenk@199.243.188.82) joined #markus.
 [13:58:43]  aimenk (~aimenk@199.243.188.82) left #markus.
 [14:28:42]  karenreid (~karenreid@208.113.48.188) left irc: Quit: karenreid
 [14:29:16]  karenreid (~karenreid@208.113.48.188) joined #markus.
 [14:29:44]  karenreid (~karenreid@208.113.48.188) left irc: Client Quit
 [15:38:05]  aimenk (~aimenk@199.243.188.82) joined #markus.
 [15:42:08]  ddadacha (~ddadacha@173-230-167-62.cable.teksavvy.com) joined #markus.
 [15:49:24] <aimenk>  hey ddadacha u there?
 [15:52:17] <ddadacha>  aimenk: hey, what's up
 [15:52:34] <aimenk>  sean and i r working on the code
 [15:52:36] <aimenk>  and we needed some help
 [15:52:42] <aimenk>  do u know much about checkbox_tag?
 [15:52:47] <ddadacha>  not really
 [15:53:04] <ddadacha>  but I can try, what's the problem?
 [15:53:51] <aimenk>  so we've created a modal with sever checkboxes, and a submit button
 [15:54:18] <aimenk>  we want to parce the values of the checkboxes, and change a variable
 [15:54:24] <aimenk>  when they hit submit
 [15:54:57] <aimenk>  modal with checkboxes**
 [15:55:23] <aimenk>  parse**
 [15:55:36] <aimenk>  lol, sorry, i am not used to aimen's keyboard
 [15:57:48] <aimenk>  hey its aimen now, so i'll post wat i did
 [15:57:57] <ddadacha>  macs, I know right...
 [15:57:58] <ddadacha>  :P
 [15:58:11] <aimenk>  this is our variable in the submissions_controller
 [15:58:12] <aimenk>  http://pastebin.com/CSYib608
 [15:58:25] <aimenk>  and this is the contents of the modal
 [15:58:51] <aimenk>  http://pastebin.com/eSjRhNKe
 [15:59:08] <aimenk>  we are trying to figure out how to get the value when check_box is clicked or not
 [15:59:32] <aimenk>  and how to update that value in our submission_col_header variable
 [15:59:40] <aimenk>  ddadacha: does it make sense what we r saying?
 [15:59:51] <ddadacha>  yeah
 [16:00:10] <ddadacha>  you're asking how to get the state of the checkbox after submit is hit, right?
 [16:00:20] <aimenk>  yeaaa
 [16:00:33] <aimenk>  and we kind of dont know how to create a function for when submit is hit
 [16:00:50] <aimenk>  so basically we want a function that will refresh the page and apply all the checkbox values to the page
 [16:02:15] <ddadacha>  aimenk: so basically on submit, you want to call a function in your controller that sets your variable up with the new values, then render the page again
 [16:02:24] <aimenk>  yesss
 [16:02:27] <aimenk>  exactly!!!
 [16:04:23] <ddadacha>  aimenk: so have you setup your checkbox?
 [16:04:53] <aimenk>  our checkboxes r here http://pastebin.com/eSjRhNKe
 [16:05:02] <aimenk>  we have contents page that has all the checkboxes
 [16:05:38] <aimenk>  my code is on my branch "isue327a" if u want to take a look
 [16:05:47] <aimenk>  issue327a*
 [16:07:34] <ddadacha>  aimenk: take a look at views/main/login.html.erb
 [16:07:42] <ddadacha>  aimenk: see the form_tag bit?
 [16:08:09] <ddadacha>  the way forms work are that when you declare (in HTML) a <form> tag, you pass in what the action of submitting does
 [16:08:10] <aimenk>  yeaa
 [16:08:27] <ddadacha>  so in that case, the { :action => 'login', :id => nil } is a URL
 [16:08:58] <aimenk>  so would we do something like {:action => 'browser' }
 [16:09:00] <ddadacha>  so what you should do is make a route to the new func in your controller that sets up your variable
 [16:09:03] <aimenk>  cos we want to refresh the browser?
 [16:09:19] <ddadacha>  well I don't know how you're doing things
 [16:09:29] <ddadacha>  you need to setup your variable first, right?
 [16:09:32] <aimenk>  yeaa
 [16:09:42] <aimenk>  i declared my variable in submission_Controller
 [16:09:43] <ddadacha>  so I'm not sure if you're doing that in browse
 [16:09:46] <aimenk>  but under def browse
 [16:09:50] <aimenk>  yeaaa
 [16:10:00] <aimenk>  i was trying to create a new function but somehow the rendering wasnt worki g
 [16:10:11] <aimenk>  remember i was doing that with u last week and we couldnt get render to work
 [16:10:17] <ddadacha>  yeah
 [16:10:20] <aimenk>  so i declared the variables in def broswe
 [16:10:21] <ddadacha>  but I thought we got it working?
 [16:10:24] <ddadacha>  oh right
 [16:10:26] <aimenk>  browse*
 [16:10:35] <aimenk>  yeaa
 [16:11:06] <ddadacha>  well okay so firstly, don't use the {...} stuff, you're meant to use the _path functions
 [16:11:12] <ddadacha>  aimenk: you know what those are, right?
 [16:11:27] <aimenk>  umm kindaaa
 [16:11:31] <aimenk>  i did that for my modal
 [16:11:35] <ddadacha>  yeah
 [16:11:42] <aimenk>  but it was really confusing and i kinda just followed the role_Switch modal
 [16:11:46] <ddadacha>  if you're confused, Jay wrote a nice blog posrt on it recently
 [16:11:50] <aimenk>  so i m not 100% on that
 [16:11:54] <aimenk>  oh yea i read that
 [16:11:55] <aimenk>  okk
 [16:11:56] <ddadacha>  read Jay's post
 [16:11:57] <ddadacha>  oh
 [16:12:07] <aimenk>  so do u suggest we create a new function and do all that?
 [16:12:12] <aimenk>  or should we do it in def browse?
 [16:12:19] <ddadacha>  yeah that's probably best =)
 [16:12:27] <ddadacha>  so okay the login form_tag
 [16:12:37] <ddadacha>  what it does is on submit, it'll redirect to the action 'login'
 [16:12:41] <ddadacha>  so take a look at the main controller
 [16:12:59] <aimenk>  ye
 [16:13:10] <ddadacha>  do you see line 64
 [16:13:24] <ddadacha>  the param[:user_login]
 [16:13:38] <ddadacha>  that contains whatever was in the text field user_login
 [16:13:40] <ddadacha>  that's how rails does stuff
 [16:13:52] <ddadacha>  if you create a form with fields in it
 [16:14:03] <aimenk>  yea?
 [16:14:06] <ddadacha>  (e.g. text field, checkboxes)
 [16:14:10] <aimenk>  yeaa
 [16:14:21] <ddadacha>  then on submit, you have a dictionary named params
 [16:14:29] <ddadacha>  where the keys are the names you passed into it
 [16:14:39] <aimenk>  yeaa
 [16:14:52] <aimenk>  so how do we get the values of checkbox
 [16:15:16] <aimenk>  like what is the proper way of saying :checked => submission_col_headers[:col1] = true
 [16:15:24] <aimenk>  else false
 [16:15:38] <aimenk>  like how do i get those values set up after the checbxes r clicked
 [16:15:42] <aimenk>  checked*
 [16:16:03] <ddadacha>  take a look at http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-check_box_tag
 [16:16:16] <ddadacha>  that explains the syntax of check_box_tag fairly well
 [16:16:19] <aimenk>  yea i looked at that earlier
 [16:16:24] <ddadacha>  so in your case
 [16:16:26] <aimenk>  but i m still not sure how they r getting the values
 [16:16:26] <ddadacha>  <%= check_box_tag 'col2', 'yes', true %>
 [16:16:40] <ddadacha>  the id/name is going to be col2 in this case right?
 [16:16:47] <ddadacha>  and if it is checked, the value will be 'yes'
 [16:17:20] <aimenk>  my variable is @submission_column_header[:col1]
 [16:17:41] <ddadacha>  right that's for that dict
 [16:17:42] <aimenk>  so would be something like this <%= check_box_tag '@submission_column_header[:col1]' , 'yes', true %>?
 [16:17:58] <ddadacha>  hmm so that's incorrect
 [16:18:03] <aimenk>  oh okk
 [16:18:09] <aimenk>  so how would i get the value
 [16:18:21] <aimenk>  this wil save the value is col2? <%= check_box_tag 'col2', 'yes', true %>
 [16:18:38] <ddadacha>  aimenk: hmm I think you aren't too clear on checkboxes
 [16:18:46] <aimenk>  nooo :s
 [16:18:48] <ddadacha>  aimenk: k let's say I have this as my checkbox
 [16:19:45] <aimenk>  kk
 [16:19:48] <ddadacha>  check_box_tag 'myIdAndName' 'myValue' true
 [16:19:56] <ddadacha>  so in that case, I'm going to create this html
 [16:20:37] <ddadacha>  <input id="myIdAndName" name="myIdAndName" type="checkbox" value="myValue" checked="checked">
 [16:20:47] <ddadacha>  so the important things are name, value and checked
 [16:20:54] <ddadacha>  name is how you associate with the checkbox in rails
 [16:21:03] <ddadacha>  so the names have to be unique
 [16:21:28] <ddadacha>  IF the checkbox is checked, then the value will be associated with the name using a dictionary named params
 [16:21:44] <ddadacha>  and the checked bit is just saying whether or not to render the checkbox as checked initially
 [16:21:58] <ddadacha>  the id doesn't matter, it's just an html id
 [16:22:02] <aimenk>  oh ok
 [16:22:07] <aimenk>  so the main thing is name
 [16:22:13] <ddadacha>  and the value
 [16:22:17] <aimenk>  okk
 [16:22:21] <ddadacha>  so in my case
 [16:23:09] <ddadacha>  if I check it, then hit submit, the function I end up in is given a dictionary named params that contains the key/value pair of "myIdAndName"/"myValue"
 [16:23:39] <aimenk>  so in my case what would be the myIdAndName
 [16:23:42] <ddadacha>  so you'll see params[:myIdAndName] = "myValue"
 [16:24:01] <aimenk>  so in my case it would be params[:col1]
 [16:24:05] <ddadacha>  yes
 [16:24:09] <aimenk>  and thats what i enter for name
 [16:24:10] <ddadacha>  and the value would be "yes"
 [16:24:13] <aimenk>  and value would be true?
 [16:24:20] <aimenk>  cos we r working with boolean
 [16:24:20] <ddadacha>  no you passed the value of yes
 [16:24:25] <aimenk>  oh okk
 [16:24:52] <aimenk>  and if i pass the value of yes that will change params[:col1] to true?
 [16:25:12] <ddadacha>  no it'll set params[:col1] to "yes"
 [16:25:23] <aimenk>  oh
 [16:25:32] <ddadacha>  aimenk: okay so if you do NOT check the box and hit submit, it won't be added to params
 [16:25:36] <ddadacha>  so params[:col1] would be nil
 [16:25:54] <aimenk>  hmm
 [16:25:55] <ddadacha>  so what you can do is check if params[:col1] == "yes"
 [16:26:13] <aimenk>  oh and that would be in my function in submissions_Controller?
 [16:26:30] <ddadacha>  yeah the one you're setting up your var with
 [16:27:22] <ddadacha>  please don't use a form tag in HTML, use RoR's
 [16:27:31] <ddadacha>  see the login view for the layout etc
 [16:27:37] <ddadacha>  and remember to use the _path function!
 [16:28:08] <ddadacha>  basically when you decide on a name to your setup func, just add that under the :submissions bit in the routes file
 [16:28:22] <ddadacha>  so under submissions; get myFuncName
 [16:28:34] <ddadacha>  and then run rake routes and search for that function name
 [16:28:52] <ddadacha>  then from there, the first bit of text of the line it's on will be the name of the path func
 [16:30:41]  aimenk (~aimenk@199.243.188.82) left irc: Ping timeout: 244 seconds
 [16:40:15]  aimenk (~aimenk@199.243.188.82) joined #markus.
 [16:40:15]  aimenk (~aimenk@199.243.188.82) left irc: Client Quit
 [16:40:26]  aimenk (~aimenk@199.243.188.82) joined #markus.
 [16:40:35] <aimenk>  ddadacha: u still there?
 [16:40:41] <aimenk>  sorry my internet got disconnected
 [16:40:48] <ddadacha>  yep
 [16:40:57] <ddadacha>  aimenk: check the IRC logs, I sent some messages
 [16:41:02] <ddadacha>  last one was: then from there, the first bit of text of the line it's on will be the name of the path func
 [16:41:03] <aimenk>  kk
 [16:42:50] <aimenk>  so we created a function called update_column_header
 [16:42:59] <aimenk>  and i placed it under :submissions
 [16:43:06] <aimenk>  as get 'update_column_headers'
 [16:43:55] <aimenk>  this is what my function looks like http://pastie.org/3623625
 [16:44:15] <aimenk>  its a bit ugly cos it has a bunch of if and else statement, do u know a better way to write this in rails
 [16:45:30] <ddadacha>  yeah
 [16:45:53] <ddadacha>  you can do it ac ouple of ways
 [16:46:08] <ddadacha>  1 way would be @submission_col_header[:col1] = params[:col1] == "yes"
 [16:46:12] <ddadacha>  etc etc
 [16:46:29] <aimenk>  oh yea?
 [16:46:31] <aimenk>  u can just write that
 [16:46:35] <aimenk>  no need for if else/
 [16:46:37] <aimenk>  ?*
 [16:46:37] <ddadacha>  another way would be @submission_col_header = { :col1 => params[:col1] == "yes"}
 [16:46:43] <ddadacha>  err "yes",.....}
 [16:46:45] <aimenk>  ohh i like the second way
 [16:46:55] <ddadacha>  yeah, many languages accept that
 [16:47:02] <aimenk>  oh nice
 [16:47:04] <ddadacha>  since at the end of the day the term x == y results in a boolean
 [16:47:13] <aimenk>  ok
 [16:47:27] <ddadacha>  it isn't technically the if statement's syntax, == is parsed as a function