So I am trying to create a web application in ruby rails that runs three stopwatches.
class StopwatchesController < ApplicationController
def index
@string1 = "Timer 1"
@string2 = "Timer 2"
@string3 = "Timer 3"
@time_1 = 0
@time_2 = 0
@time_3 = 0
gon.myNum1 = @time_1
gon.myNum2 = @time_2
gon.myNum3 = @time_3
end
I'm really new at this and am trying to make it so I can have the user edit the values for all @variables in the View component. Sorry if anything comes off as atrocious in the code.
edit: I got read the comments about me not being clear, my bad guys and thanks for the feedback (:
So in my app\views\stopwatches\index.html.erb I have the following code:
<h4><%= @string1 %></h4><br>
<div class="clock_1">
<script type="text/javascript">
var clock = $('.clock_1').FlipClock(gon.myNum1, {
countdown: true,
clockFace: 'MinuteCounter',
});
This is pretty much a gem for one of the clocks, where @string1 is the name given by the user while gon.myNum1 will be a numerical value for the time. My problem is pretty much that I don't know how to create a page or form that can have the user change the contents of the variable mentioned.